1
\ *****************************************************************************
2
\ * Copyright (c) 2004, 2008 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
\ ****************************************************************************/
14
\ Generic disk support
17
\ name of device ( e.g. "disk", "cdrom", ... )
20
\ Needs from parent in device tree:
21
\ dev-read-blocks ( addr block# #blocks phys.lo ... phys.hi -- #read )
28
\ read ( addr len -- actual )
29
\ seek ( pos.lo pos.hi -- status )
30
\ read-blocks ( addr block# #blocks -- #read )
32
\ disk-label package interpose for partition and file systems support
33
\ deblocker package for byte read support
35
( str len phys.lo ... phys.hi -- )
36
new-device set-unit ( str len )
38
s" 0 pci-alias-" 2swap $cat evaluate
41
\ Requiered interface for deblocker
43
s" block-size" $call-parent CONSTANT block-size
44
s" max-transfer" $call-parent CONSTANT max-transfer
46
: read-blocks ( addr block# #blocks -- #read )
47
my-unit s" dev-read-blocks" $call-parent
50
INSTANCE VARIABLE deblocker
53
0 0 s" deblocker" $open-package dup deblocker ! dup IF
54
s" disk-label" find-package IF
60
deblocker @ close-package ;
62
: seek ( pos.lo pos.hi -- status )
63
s" seek" deblocker @ $call-method ;
65
: read ( addr len -- actual )
66
s" read" deblocker @ $call-method ;