Annotation of qemu/roms/SLOF/board-qemu/slof/virtio-block.fs, revision 1.1.1.1

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: \ ." Populating " pwd cr
                     14: 
                     15: s" block" device-type
                     16: 
                     17: FALSE VALUE initialized?
                     18: 
                     19: \ Required interface for deblocker
                     20: 
                     21: 200 CONSTANT block-size
                     22: 8000 CONSTANT max-transfer 
                     23: 
                     24: INSTANCE VARIABLE deblocker
                     25: 
                     26: /vd-len BUFFER: virtiodev
                     27: virtiodev virtio-setup-vd
                     28: 
                     29: \ Quiesce the virtqueue of this device so that no more background
                     30: \ transactions can be pending.
                     31: : shutdown  ( -- )
                     32:    virtiodev virtio-blk-shutdown
                     33:    FALSE to initialized?
                     34: ;
                     35: 
                     36: \ Basic device initialization - which has only to be done once
                     37: : init  ( -- )
                     38:    virtiodev virtio-blk-init
                     39:    TRUE to initialized?
                     40:    ['] shutdown add-quiesce-xt
                     41: ;
                     42: 
                     43: \ Read multiple blocks - called by deblocker package
                     44: : read-blocks  ( addr block# #blocks -- #read )
                     45:    virtiodev virtio-blk-read
                     46: ;
                     47: 
                     48: \ Standard node "open" function
                     49: : open  ( -- okay? )
                     50:    open 0= IF false EXIT THEN
                     51:    0 0 s" deblocker" $open-package dup deblocker ! dup IF
                     52:       s" disk-label" find-package IF
                     53:          my-args rot interpose
                     54:       THEN
                     55:    THEN
                     56:    dup initialized? 0= AND IF
                     57:       init
                     58:    THEN
                     59:    0<>
                     60: ;
                     61: 
                     62: \ Standard node "close" function
                     63: : close  ( -- )
                     64:    deblocker @ close-package
                     65:    close
                     66: ;
                     67: 
                     68: \ Standard node "seek" function
                     69: : seek  ( pos.lo pos.hi -- status )
                     70:    s" seek" deblocker @ $call-method
                     71: ;
                     72: 
                     73: \ Standard node "read" function
                     74: : read  ( addr len -- actual )
                     75:    s" read" deblocker @ $call-method
                     76: ;
                     77: 
                     78: \ Set disk alias if none is set yet
                     79: : (set-alias)
                     80:    s" disk" find-alias 0= IF
                     81:        s" disk" get-node node>path set-alias
                     82:    ELSE
                     83:       drop
                     84:    THEN
                     85: ;
                     86: (set-alias)

unix.superglobalmegacorp.com

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