summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/src/drivers/block/ide.c22
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;
}