diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | linux/dev/drivers/block/ide.c | 22 |
2 files changed, 27 insertions, 7 deletions
@@ -1,3 +1,15 @@ +2001-06-28 Marcus Brinkmann <marcus@gnu.org> + + * linux/dev/drivers/block/ide.c (lba_capacity_is_ok): Do not + attempt to correct id->cyls, it is a short and for large disks the + number of cylinders necessary would not fit. Subsequent checks + for lba support would fail. + (current_capacity): Likewise for drive->cyl. + (do_identify): Store value returned by current_capacity in + CAPACITY. The check which corrects the number of bios cylinders + is not aggressive enough. Update it with the check in linux + kernel-2.2.19. + 2001-06-25 Marcus Brinkmann <marcus@gnu.org> * i386/bogus/fpe.h (FPE): Define FPE to 0, as the floating point diff --git a/linux/dev/drivers/block/ide.c b/linux/dev/drivers/block/ide.c index 9444653..3be7787 100644 --- a/linux/dev/drivers/block/ide.c +++ b/linux/dev/drivers/block/ide.c @@ -613,7 +613,6 @@ static int lba_capacity_is_ok (struct hd_driveid *id) /* very large drives (8GB+) may lie about the number of cylinders */ if (id->cyls == 16383 && id->heads == 16 && id->sectors == 63 && lba_sects > chs_sects) { - id->cyls = lba_sects / (16 * 63); /* correct cyls */ return 1; /* lba_capacity is our only option */ } /* perform a rough sanity check on lba_sects: within 10% is "okay" */ @@ -650,7 +649,6 @@ static unsigned long current_capacity (ide_drive_t *drive) /* Determine capacity, and use LBA if the drive properly supports it */ if (id != NULL && (id->capability & 2) && lba_capacity_is_ok(id)) { if (id->lba_capacity >= capacity) { - drive->cyl = id->lba_capacity / (drive->head * drive->sect); capacity = id->lba_capacity; drive->select.b.lba = 1; } @@ -2598,13 +2596,23 @@ static inline void do_identify (ide_drive_t *drive, byte cmd) } /* calculate drive capacity, and select LBA if possible */ - (void) current_capacity (drive); + capacity = current_capacity (drive); /* Correct the number of cyls if the bios value is too small */ - if (drive->sect == drive->bios_sect && drive->head == drive->bios_head) { - if (drive->cyl > drive->bios_cyl) - drive->bios_cyl = drive->cyl; - } + if (!drive->forced_geom && + capacity > drive->bios_cyl * drive->bios_sect * drive->bios_head) { + unsigned long cylsize; + cylsize = drive->bios_sect * drive->bios_head; + if (cylsize == 0 || capacity/cylsize > 65535) { + drive->bios_sect = 63; + drive->bios_head = 255; + cylsize = 63*255; + } + if (capacity/cylsize > 65535) + drive->bios_cyl = 65535; + else + drive->bios_cyl = capacity/cylsize; + } if (!strncmp(id->model, "BMI ", 4) && strstr(id->model, " ENHANCED IDE ") && |