diff options
Diffstat (limited to 'drivers/block/ide-geometry.c')
-rw-r--r-- | drivers/block/ide-geometry.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/block/ide-geometry.c b/drivers/block/ide-geometry.c index 79abaca2b..0f24b0ac3 100644 --- a/drivers/block/ide-geometry.c +++ b/drivers/block/ide-geometry.c @@ -60,6 +60,7 @@ void probe_cmos_for_drives (ide_hwif_t *hwif) /* Extract drive geometry from CMOS+BIOS if not already setup */ for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; +#if 0 if ((cmos_disks & (0xf0 >> (unit*4))) && !drive->present && !drive->nobios) { drive->cyl = drive->bios_cyl = *(unsigned short *)BIOS; @@ -67,6 +68,22 @@ void probe_cmos_for_drives (ide_hwif_t *hwif) drive->sect = drive->bios_sect = *(BIOS+14); drive->ctl = *(BIOS+8); } +#else + if ((cmos_disks & (0xf0 >> (unit*4))) + && !drive->present && !drive->nobios) { + unsigned short cyl = *(unsigned short *)BIOS; + unsigned char head = *(BIOS+2); + unsigned char sect = *(BIOS+14); + if (cyl > 0 && head > 0 && sect > 0 && sect < 64) { + drive->cyl = drive->bios_cyl = cyl; + drive->head = drive->bios_head = head; + drive->sect = drive->bios_sect = sect; + drive->ctl = *(BIOS+8); + } else { + printk("hd%d: C/H/S=%d/%d/%d from BIOS ignored\n", unit, cyl, head, sect); + } + } +#endif BIOS += 16; } #endif @@ -78,7 +95,7 @@ void probe_cmos_for_drives (ide_hwif_t *hwif) * Otherwise: find out how OnTrack Disk Manager would translate the disk. */ static void -ontrack(ide_drive_t *drive, int heads, int *c, int *h, int *s) { +ontrack(ide_drive_t *drive, int heads, unsigned int *c, int *h, int *s) { static const byte dm_head_vals[] = {4, 8, 16, 32, 64, 128, 255, 0}; const byte *headp = dm_head_vals; unsigned long total, tracks; |