diff options
author | Yang Zhang <yang.z.zhang@intel.com> | 2015-08-28 09:58:54 +0800 |
---|---|---|
committer | Yang Zhang <yang.z.zhang@intel.com> | 2015-09-01 12:44:00 +0800 |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/SLOF/board-qemu/slof/virtio-block.fs | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/SLOF/board-qemu/slof/virtio-block.fs')
-rw-r--r-- | qemu/roms/SLOF/board-qemu/slof/virtio-block.fs | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/qemu/roms/SLOF/board-qemu/slof/virtio-block.fs b/qemu/roms/SLOF/board-qemu/slof/virtio-block.fs new file mode 100644 index 000000000..ea388fb00 --- /dev/null +++ b/qemu/roms/SLOF/board-qemu/slof/virtio-block.fs @@ -0,0 +1,89 @@ +\ ***************************************************************************** +\ * Copyright (c) 2011 IBM Corporation +\ * All rights reserved. +\ * This program and the accompanying materials +\ * are made available under the terms of the BSD License +\ * which accompanies this distribution, and is available at +\ * http://www.opensource.org/licenses/bsd-license.php +\ * +\ * Contributors: +\ * IBM Corporation - initial implementation +\ ****************************************************************************/ + +\ ." Populating " pwd cr + +s" block" device-type + +FALSE VALUE initialized? + +\ Required interface for deblocker + +200 VALUE block-size +8000 CONSTANT max-transfer + +INSTANCE VARIABLE deblocker + +/vd-len BUFFER: virtiodev +virtiodev virtio-setup-vd + +\ Quiesce the virtqueue of this device so that no more background +\ transactions can be pending. +: shutdown ( -- ) + initialized? IF + my-phandle node>path open-dev ?dup IF + virtiodev virtio-blk-shutdown + close-dev + THEN + FALSE to initialized? + THEN +; + +\ Basic device initialization - which has only to be done once +: init ( -- ) + virtiodev virtio-blk-init to block-size + TRUE to initialized? + ['] shutdown add-quiesce-xt +; + +\ Read multiple blocks - called by deblocker package +: read-blocks ( addr block# #blocks -- #read ) + virtiodev virtio-blk-read +; + +\ Standard node "open" function +: open ( -- okay? ) + open 0= IF false EXIT THEN + dup initialized? 0= AND IF + init + THEN + 0 0 s" deblocker" $open-package dup deblocker ! dup IF + s" disk-label" find-package IF + my-args rot interpose + THEN + THEN + 0<> +; + +\ Standard node "close" function +: close ( -- ) + deblocker @ close-package + close +; + +\ Standard node "seek" function +: seek ( pos.lo pos.hi -- status ) + s" seek" deblocker @ $call-method +; + +\ Standard node "read" function +: read ( addr len -- actual ) + s" read" deblocker @ $call-method +; + +\ Set disk alias if none is set yet +: (set-alias) + s" disk" get-next-alias ?dup IF + get-node node>path set-alias + THEN +; +(set-alias) |