Annotation of qemu/roms/SLOF/board-qemu/slof/rtas.fs, revision 1.1.1.2

1.1       root        1: \ *****************************************************************************
                      2: \ * Copyright (c) 2011 IBM Corporation
                      3: \ * All rights reserved.
                      4: \ * This program and the accompanying materials
                      5: \ * are made available under the terms of the BSD License
                      6: \ * which accompanies this distribution, and is available at
                      7: \ * http://www.opensource.org/licenses/bsd-license.php
                      8: \ *
                      9: \ * Contributors:
                     10: \ *     IBM Corporation - initial implementation
                     11: \ ****************************************************************************/
                     12: 
                     13: \ KVM/qemu RTAS
                     14: 
                     15: \ rtas control block
                     16: 
                     17: 4d0 cp
                     18: 
                     19: STRUCT
                     20:     /l field rtas>token
                     21:     /l field rtas>nargs
                     22:     /l field rtas>nret
                     23:     /l field rtas>args0
                     24:     /l field rtas>args1
                     25:     /l field rtas>args2
                     26:     /l field rtas>args3
                     27:     /l field rtas>args4
                     28:     /l field rtas>args5
                     29:     /l field rtas>args6
                     30:     /l field rtas>args7
                     31:     /l C * field rtas>args
                     32:     /l field rtas>bla
                     33: CONSTANT /rtas-control-block
                     34: 
                     35: CREATE rtas-cb /rtas-control-block allot
                     36: rtas-cb /rtas-control-block erase
                     37: 
                     38: 0 VALUE rtas-base
                     39: 0 VALUE rtas-size
                     40: 0 VALUE rtas-entry
                     41: 0 VALUE rtas-node
                     42: 
                     43: \ Locate qemu RTAS, remove the linux,... properties we really don't
                     44: \ want them to stick around
                     45: 
                     46: 4d1 cp
                     47: 
                     48: : find-qemu-rtas ( -- )
                     49:     " /rtas" find-device get-node to rtas-node
                     50: 
                     51:     " linux,rtas-base" rtas-node get-package-property IF
                     52:          device-end EXIT THEN
                     53:     drop l@ to rtas-base
                     54:     " linux,rtas-base" delete-property
                     55: 
                     56:     " rtas-size" rtas-node get-package-property IF
                     57:          device-end EXIT THEN
                     58:     drop l@ to rtas-size
                     59: 
                     60:     " linux,rtas-entry" rtas-node get-package-property IF
                     61:         rtas-base to rtas-entry
                     62:     ELSE
                     63:         drop l@ to rtas-entry
                     64:         " linux,rtas-entry" delete-property
                     65:     THEN
                     66: 
                     67:     \ ." RTAS found, base=" rtas-base . ."  size=" rtas-size . cr
                     68: 
                     69:     device-end
                     70: ;
                     71: find-qemu-rtas
                     72: 
                     73: 4d2 cp
                     74: 
                     75: : enter-rtas ( -- )
                     76:     rtas-cb rtas-base 0 rtas-entry call-c drop
                     77: ;
                     78: 
                     79: : rtas-get-token ( str len -- token | 0 )
                     80:     rtas-node get-package-property IF 0 ELSE drop l@ THEN
                     81: ;
                     82: 
                     83: : rtas-start-cpu  ( pid loc r3 -- status )
                     84:    " start-cpu" rtas-get-token rtas-cb rtas>token l!
                     85:    3  rtas-cb rtas>nargs l!
                     86:    1  rtas-cb rtas>nret l!
                     87:    rtas-cb rtas>args2 l!
                     88:    rtas-cb rtas>args1 l!
                     89:    rtas-cb rtas>args0 l!
                     90:    0 rtas-cb rtas>args3 l!
                     91:    enter-rtas
                     92:    rtas-cb rtas>args3 l@
                     93: ;
                     94: 
                     95: : rtas-set-tce-bypass ( unit enable -- )
                     96:     " ibm,set-tce-bypass" rtas-get-token rtas-cb rtas>token l!
                     97:     2 rtas-cb rtas>nargs l!
                     98:     0 rtas-cb rtas>nret l!
                     99:     rtas-cb rtas>args1 l!
                    100:     rtas-cb rtas>args0 l!
                    101:     enter-rtas
                    102: ;
                    103: 
                    104: : rtas-quiesce ( -- )
                    105:     " quiesce" rtas-get-token rtas-cb rtas>token l!
                    106:     0 rtas-cb rtas>nargs l!
                    107:     0 rtas-cb rtas>nret l!
                    108:     enter-rtas
                    109: ;
                    110: 
1.1.1.2 ! root      111: 
        !           112: 0 value puid
        !           113: 
        !           114: : rtas-do-config-@ ( config-addr size -- value)
        !           115:     \ We really want to cache this !
        !           116:     " ibm,read-pci-config" rtas-get-token rtas-cb rtas>token l!
        !           117:     4 rtas-cb rtas>nargs l!
        !           118:     2 rtas-cb rtas>nret l!
        !           119:     ( addr size ) rtas-cb rtas>args3 l!
        !           120:     puid ffffffff and rtas-cb rtas>args2 l!
        !           121:     puid 20 rshift rtas-cb rtas>args1 l!
        !           122:     ( addr ) rtas-cb rtas>args0 l!
        !           123:     enter-rtas
        !           124:     rtas-cb rtas>args4 l@ dup IF
        !           125:         \ Do not warn on error as this is part of the
        !           126:        \ normal PCI probing pass
        !           127:        drop ffffffff
        !           128:     ELSE
        !           129:        drop rtas-cb rtas>args5 l@
        !           130:     THEN
        !           131: ;
        !           132: 
        !           133: : rtas-do-config-! ( value config-addr size )
        !           134:     \ We really want to cache this !
        !           135:     " ibm,write-pci-config" rtas-get-token rtas-cb rtas>token l!
        !           136:     5 rtas-cb rtas>nargs l!
        !           137:     1 rtas-cb rtas>nret l!
        !           138:     ( value addr size ) rtas-cb rtas>args3 l!
        !           139:     puid ffffffff and rtas-cb rtas>args2 l!
        !           140:     puid 20 rshift rtas-cb rtas>args1 l!
        !           141:     ( value addr ) rtas-cb rtas>args0 l!
        !           142:     ( value ) rtas-cb rtas>args4 l!
        !           143:     enter-rtas
        !           144:     rtas-cb rtas>args5 l@ dup IF
        !           145:            ." RTAS write config err " . cr
        !           146:     ELSE drop THEN
        !           147: ;
        !           148: 
        !           149: : rtas-config-b@ ( config-addr -- value )
        !           150:   1 rtas-do-config-@ ff and
        !           151: ;
        !           152: : rtas-config-b! ( value config-addr -- )
        !           153:   1 rtas-do-config-!
        !           154: ;
        !           155: : rtas-config-w@ ( config-addr -- value )
        !           156:   2 rtas-do-config-@ ffff and
        !           157: ;
        !           158: : rtas-config-w! ( value config-addr -- )
        !           159:   2 rtas-do-config-!
        !           160: ;
        !           161: : rtas-config-l@ ( config-addr -- value )
        !           162:   4 rtas-do-config-@ ffffffff and
        !           163: ;
        !           164: : rtas-config-l! ( value config-addr -- )
        !           165:   4 rtas-do-config-!
        !           166: ;
        !           167: 
1.1       root      168: : of-start-cpu rtas-start-cpu ;
                    169: 
                    170: \ Methods of the rtas node proper
                    171: rtas-node set-node
                    172: 
                    173: : open true ;
                    174: : close ;
                    175: 
                    176: : instantiate-rtas ( adr -- entry )
                    177:     dup rtas-base swap rtas-size move
                    178:     rtas-entry rtas-base - +
                    179: ;
                    180: 
                    181: device-end
                    182: 
                    183: 4d8 cp

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.