diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-01-04 00:32:47 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-01-04 00:32:47 +0100 |
commit | fe0653f3ea02611f63d21880e3a48137fcec975b (patch) | |
tree | f4fee54cbda3ce39f03d639a0cd29b0a362b8695 | |
parent | 6044a9e9a4faa4d28a0c16e30c166c39fc57198d (diff) |
ignore bogus FDPT information from BIOS
-rw-r--r-- | linux/src/drivers/block/ide.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c index 5dcd0aa..e52cbed 100644 --- a/linux/src/drivers/block/ide.c +++ b/linux/src/drivers/block/ide.c @@ -2914,11 +2914,23 @@ static void probe_cmos_for_drives (ide_hwif_t *hwif) for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; if ((cmos_disks & (0xf0 >> (unit*4))) && !drive->present && !drive->nobios) { - drive->cyl = drive->bios_cyl = *(unsigned short *)BIOS; - drive->head = drive->bios_head = *(BIOS+2); - drive->sect = drive->bios_sect = *(BIOS+14); - drive->ctl = *(BIOS+8); - drive->present = 1; + unsigned short cyl = *(unsigned short *)BIOS; + unsigned char head = *(BIOS+2); + unsigned char sect = *(BIOS+14); + unsigned char ctl = *(BIOS+8); + 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 = ctl; + drive->present = 1; + printk("hd%d: got CHS=%d/%d/%d CTL=%x from BIOS\n", + unit, cyl, head, sect, ctl); + + } else { + printk("hd%d: CHS=%d/%d/%d CTL=%x from BIOS ignored\n", + unit, cyl, head, sect, ctl); + } } BIOS += 16; } |