2 * Creation Date: <2003/12/07 19:08:33 samuel>
3 * Time-stamp: <2004/01/07 19:38:36 samuel>
9 * Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se)
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
18 #include "libopenbios/bindings.h"
20 #include "osi_calls.h"
28 DECLARE_NODE( osiblk, INSTALL_OPEN, sizeof(osiblk_data_t),
29 "/pci/pci-bridge/mol-blk/disk", "/mol/mol-blk" );
33 osiblk_open( osiblk_data_t *pb )
39 pb->channel = 0; /* FIXME */
41 selfword("open-deblocker");
43 /* interpose disk-label */
44 ph = find_dev("/packages/disk-label");
49 /* printk("osi-blk: open %d\n", pb->unit ); */
54 osiblk_close( osiblk_data_t *pb )
56 selfword("close-deblocker");
60 /* ( buf blk nblks -- actual ) */
62 osiblk_read_blocks( osiblk_data_t *pb )
66 char *dest = (char*)POP();
68 /* printk("osiblk_read_blocks %x block=%d n=%d\n", (int)dest, blk, n ); */
72 int m = MIN( n-i, sizeof(buf)/512 );
74 if( OSI_ABlkSyncRead(pb->channel, pb->unit, blk+i, (int)buf, m*512) < 0 ) {
75 printk("SyncRead: error\n");
78 memcpy( dest, buf, m * 512 );
87 osiblk_block_size( osiblk_data_t *pb )
94 osiblk_max_transfer( osiblk_data_t *pb )
100 osiblk_initialize( osiblk_data_t *pb )
102 fword("is-deblocker");
106 NODE_METHODS( osiblk ) = {
107 { NULL, osiblk_initialize },
108 { "open", osiblk_open },
109 { "close", osiblk_close },
110 { "read-blocks", osiblk_read_blocks },
111 { "block-size", osiblk_block_size },
112 { "max-transfer", osiblk_max_transfer },
118 REGISTER_NODE( osiblk );