summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-06-28 08:55:02 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-06-28 08:55:02 +0000
commitf6cf69c88bd2e3e585fd9232b544ea1b050e75b5 (patch)
tree3948ca1813b80321e456d85ca791d7e36dc5d7b8 /linux
parent512c25572bffac58dfeea41a5b95d6c04329a139 (diff)
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.
Diffstat (limited to 'linux')
-rw-r--r--linux/dev/drivers/block/ide.c22
1 files changed, 15 insertions, 7 deletions
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 ") &&