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
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
13 \ ." Populating " pwd cr
17 FALSE VALUE initialized?
19 \ Required interface for deblocker
22 8000 CONSTANT max-transfer
24 INSTANCE VARIABLE deblocker
26 /vd-len BUFFER: virtiodev
27 virtiodev virtio-setup-vd
29 \ Quiesce the virtqueue of this device so that no more background
30 \ transactions can be pending.
33 my-phandle node>path open-dev ?dup IF
34 virtiodev virtio-blk-shutdown
41 \ Basic device initialization - which has only to be done once
43 virtiodev virtio-blk-init to block-size
45 ['] shutdown add-quiesce-xt
48 \ Read multiple blocks - called by deblocker package
49 : read-blocks ( addr block# #blocks -- #read )
50 virtiodev virtio-blk-read
53 \ Standard node "open" function
55 open 0= IF false EXIT THEN
56 dup initialized? 0= AND IF
59 0 0 s" deblocker" $open-package dup deblocker ! dup IF
60 s" disk-label" find-package IF
67 \ Standard node "close" function
69 deblocker @ close-package
73 \ Standard node "seek" function
74 : seek ( pos.lo pos.hi -- status )
75 s" seek" deblocker @ $call-method
78 \ Standard node "read" function
79 : read ( addr len -- actual )
80 s" read" deblocker @ $call-method
83 \ Set disk alias if none is set yet
85 s" disk" get-next-alias ?dup IF
86 get-node node>path set-alias