diff options
Diffstat (limited to 'ide.c')
-rw-r--r-- | ide.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -17,6 +17,7 @@ #define IDE_ERR 0x01 static int diskno = 0; +int disk_channel; static int ide_wait_ready(int check_error) @@ -43,6 +44,7 @@ void ide_intr(void) { cprintf("ide_intr\n"); + wakeup(&disk_channel); } @@ -78,12 +80,10 @@ ide_set_disk(int d) } int -ide_read(uint32_t secno, void *dst, unsigned nsecs) +ide_start_read(uint32_t secno, void *dst, unsigned nsecs) { - int r; - if(nsecs > 256) - panic("ide_read"); + panic("ide_start_read: nsecs too large"); ide_wait_ready(0); @@ -95,14 +95,19 @@ ide_read(uint32_t secno, void *dst, unsigned nsecs) outb(0x1F6, 0xE0 | ((diskno&1)<<4) | ((secno>>24)&0x0F)); outb(0x1F7, 0x20); // CMD 0x20 means read sector -#if 0 + return 0; +} + +int +ide_read(uint32_t secno, void *dst, unsigned nsecs) +{ + int r; + for (; nsecs > 0; nsecs--, dst += 512) { if ((r = ide_wait_ready(1)) < 0) return r; insl(0x1F0, dst, 512/4); } -#endif - return 0; } |