Rev 4532 | Rev 4621 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4532 | Rev 4545 | ||
---|---|---|---|
Line 70... | Line 70... | ||
70 | 70 | ||
71 | static disk_t disk[MAX_DISKS]; |
71 | static disk_t disk[MAX_DISKS]; |
72 | 72 | ||
73 | static int ata_bd_init(void); |
73 | static int ata_bd_init(void); |
74 | static void ata_bd_connection(ipc_callid_t iid, ipc_call_t *icall); |
74 | static void ata_bd_connection(ipc_callid_t iid, ipc_call_t *icall); |
75 | static int ata_bd_rdwr(int disk_id, ipcarg_t method, off_t offset, off_t size, |
75 | static int ata_bd_rdwr(int disk_id, ipcarg_t method, off_t offset, size_t size, |
76 | void *buf); |
76 | void *buf); |
77 | static int ata_bd_read_block(int disk_id, uint64_t blk_idx, size_t blk_cnt, |
77 | static int ata_bd_read_block(int disk_id, uint64_t blk_idx, size_t blk_cnt, |
78 | void *buf); |
78 | void *buf); |
79 | static int ata_bd_write_block(int disk_id, uint64_t blk_idx, size_t blk_cnt, |
79 | static int ata_bd_write_block(int disk_id, uint64_t blk_idx, size_t blk_cnt, |
80 | const void *buf); |
80 | const void *buf); |
Line 144... | Line 144... | ||
144 | 144 | ||
145 | static int drive_identify(int disk_id, disk_t *d) |
145 | static int drive_identify(int disk_id, disk_t *d) |
146 | { |
146 | { |
147 | uint16_t data; |
147 | uint16_t data; |
148 | uint8_t status; |
148 | uint8_t status; |
149 | int i; |
149 | size_t i; |
150 | 150 | ||
151 | printf("Identify drive %d\n", disk_id); |
151 | printf("Identify drive %d\n", disk_id); |
152 | pio_write_8(&cmd->drive_head, ((disk_id != 0) ? DHR_DRV : 0)); |
152 | pio_write_8(&cmd->drive_head, ((disk_id != 0) ? DHR_DRV : 0)); |
153 | async_usleep(100); |
153 | async_usleep(100); |
154 | pio_write_8(&cmd->command, CMD_IDENTIFY_DRIVE); |
154 | pio_write_8(&cmd->command, CMD_IDENTIFY_DRIVE); |
Line 232... | Line 232... | ||
232 | ipcarg_t method; |
232 | ipcarg_t method; |
233 | dev_handle_t dh; |
233 | dev_handle_t dh; |
234 | int flags; |
234 | int flags; |
235 | int retval; |
235 | int retval; |
236 | off_t idx; |
236 | off_t idx; |
237 | off_t size; |
237 | size_t size; |
238 | int disk_id, i; |
238 | int disk_id, i; |
239 | 239 | ||
240 | /* Get the device handle. */ |
240 | /* Get the device handle. */ |
241 | dh = IPC_GET_ARG1(*icall); |
241 | dh = IPC_GET_ARG1(*icall); |
242 | 242 | ||
Line 292... | Line 292... | ||
292 | } |
292 | } |
293 | ipc_answer_0(callid, retval); |
293 | ipc_answer_0(callid, retval); |
294 | } |
294 | } |
295 | } |
295 | } |
296 | 296 | ||
297 | static int ata_bd_rdwr(int disk_id, ipcarg_t method, off_t blk_idx, off_t size, |
297 | static int ata_bd_rdwr(int disk_id, ipcarg_t method, off_t blk_idx, size_t size, |
298 | void *buf) |
298 | void *buf) |
299 | { |
299 | { |
300 | int rc; |
300 | int rc; |
301 | off_t now; |
301 | size_t now; |
302 | 302 | ||
303 | while (size > 0) { |
303 | while (size > 0) { |
304 | now = size < block_size ? size : (off_t) block_size; |
304 | now = size < block_size ? size : block_size; |
305 | if (now != block_size) |
305 | if (now != block_size) |
306 | return EINVAL; |
306 | return EINVAL; |
307 | 307 | ||
308 | if (method == BD_READ_BLOCK) |
308 | if (method == BD_READ_BLOCK) |
309 | rc = ata_bd_read_block(disk_id, blk_idx, 1, buf); |
309 | rc = ata_bd_read_block(disk_id, blk_idx, 1, buf); |