diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:19 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:19 -0400 |
commit | 48fb2688aa67baba373531cc4ed2d9e695983c3f (patch) | |
tree | 9382e5175e43b914fd06bb778cc6f37a4967ab9d | |
parent | 4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab (diff) |
ide: remove drive->driveid
* Factor out HDIO_[OBSOLETE,GET]_IDENTITY ioctls handling
to ide_get_identity_ioctl().
* Use temporary buffer in ide_get_identity_ioctl() instead
of accessing drive->id directly.
* Add ide_id_to_hd_driveid() inline to convert raw id into
struct hd_driveid format (needed on big-endian).
* Use ide_id_to_hd_driveid() in ide_get_identity_ioctl(),
cleanup ide_fix_driveid() and switch ide to use use raw id.
* Remove no longer needed drive->driveid.
This leaves us with 3 users of struct hd_driveid in tree:
- arch/um/drivers/ubd_kern.c
- drivers/block/xsysace.c
- drivers/usb/storage/isd200.c
While at it:
* Use ata_id_u{32,64}() and ata_id_has_{dma,lba,iordy}() macros.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-disk.c | 23 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 6 | ||||
-rw-r--r-- | drivers/ide/ide-iops.c | 20 | ||||
-rw-r--r-- | drivers/ide/ide-lib.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 22 | ||||
-rw-r--r-- | drivers/ide/ide-timings.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide.c | 59 | ||||
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/cs5530.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/it821x.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/pdc202xx_old.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/sc1200.c | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 9 |
13 files changed, 90 insertions, 69 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index f1669bca3cab..8f1ec037309a 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -101,13 +101,14 @@ static void ide_disk_put(struct ide_disk_obj *idkp) | |||
101 | */ | 101 | */ |
102 | static int lba_capacity_is_ok(u16 *id) | 102 | static int lba_capacity_is_ok(u16 *id) |
103 | { | 103 | { |
104 | struct hd_driveid *driveid = (struct hd_driveid *)id; | ||
105 | unsigned long lba_sects, chs_sects, head, tail; | 104 | unsigned long lba_sects, chs_sects, head, tail; |
106 | 105 | ||
107 | /* No non-LBA info .. so valid! */ | 106 | /* No non-LBA info .. so valid! */ |
108 | if (id[ATA_ID_CYLS] == 0) | 107 | if (id[ATA_ID_CYLS] == 0) |
109 | return 1; | 108 | return 1; |
110 | 109 | ||
110 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
111 | |||
111 | /* | 112 | /* |
112 | * The ATA spec tells large drives to return | 113 | * The ATA spec tells large drives to return |
113 | * C/H/S = 16383/16/63 independent of their size. | 114 | * C/H/S = 16383/16/63 independent of their size. |
@@ -118,10 +119,9 @@ static int lba_capacity_is_ok(u16 *id) | |||
118 | (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) && | 119 | (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) && |
119 | id[ATA_ID_SECTORS] == 63 && | 120 | id[ATA_ID_SECTORS] == 63 && |
120 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && | 121 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && |
121 | (driveid->lba_capacity >= 16383 * 63 * id[ATA_ID_HEADS])) | 122 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) |
122 | return 1; | 123 | return 1; |
123 | 124 | ||
124 | lba_sects = driveid->lba_capacity; | ||
125 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; | 125 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; |
126 | 126 | ||
127 | /* perform a rough sanity check on lba_sects: within 10% is OK */ | 127 | /* perform a rough sanity check on lba_sects: within 10% is OK */ |
@@ -133,7 +133,7 @@ static int lba_capacity_is_ok(u16 *id) | |||
133 | tail = (lba_sects & 0xffff); | 133 | tail = (lba_sects & 0xffff); |
134 | lba_sects = (head | (tail << 16)); | 134 | lba_sects = (head | (tail << 16)); |
135 | if ((lba_sects - chs_sects) < chs_sects/10) { | 135 | if ((lba_sects - chs_sects) < chs_sects/10) { |
136 | driveid->lba_capacity = lba_sects; | 136 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); |
137 | return 1; /* lba_capacity is (now) good */ | 137 | return 1; /* lba_capacity is (now) good */ |
138 | } | 138 | } |
139 | 139 | ||
@@ -403,7 +403,7 @@ static inline int idedisk_supports_lba48(const u16 *id) | |||
403 | { | 403 | { |
404 | return (id[ATA_ID_COMMAND_SET_2] & 0x0400) && | 404 | return (id[ATA_ID_COMMAND_SET_2] & 0x0400) && |
405 | (id[ATA_ID_CFS_ENABLE_2] & 0x0400) && | 405 | (id[ATA_ID_CFS_ENABLE_2] & 0x0400) && |
406 | ((struct hd_driveid *)id)->lba_capacity_2; | 406 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); |
407 | } | 407 | } |
408 | 408 | ||
409 | /* | 409 | /* |
@@ -456,7 +456,6 @@ static void idedisk_check_hpa(ide_drive_t *drive) | |||
456 | 456 | ||
457 | static void init_idedisk_capacity(ide_drive_t *drive) | 457 | static void init_idedisk_capacity(ide_drive_t *drive) |
458 | { | 458 | { |
459 | struct hd_driveid *driveid = drive->driveid; | ||
460 | u16 *id = drive->id; | 459 | u16 *id = drive->id; |
461 | /* | 460 | /* |
462 | * If this drive supports the Host Protected Area feature set, | 461 | * If this drive supports the Host Protected Area feature set, |
@@ -467,13 +466,13 @@ static void init_idedisk_capacity(ide_drive_t *drive) | |||
467 | if (idedisk_supports_lba48(id)) { | 466 | if (idedisk_supports_lba48(id)) { |
468 | /* drive speaks 48-bit LBA */ | 467 | /* drive speaks 48-bit LBA */ |
469 | drive->select.b.lba = 1; | 468 | drive->select.b.lba = 1; |
470 | drive->capacity64 = driveid->lba_capacity_2; | 469 | drive->capacity64 = ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); |
471 | if (hpa) | 470 | if (hpa) |
472 | idedisk_check_hpa(drive); | 471 | idedisk_check_hpa(drive); |
473 | } else if ((driveid->capability & 2) && lba_capacity_is_ok(id)) { | 472 | } else if (ata_id_has_lba(id) && lba_capacity_is_ok(id)) { |
474 | /* drive speaks 28-bit LBA */ | 473 | /* drive speaks 28-bit LBA */ |
475 | drive->select.b.lba = 1; | 474 | drive->select.b.lba = 1; |
476 | drive->capacity64 = driveid->lba_capacity; | 475 | drive->capacity64 = ata_id_u32(id, ATA_ID_LBA_CAPACITY); |
477 | if (hpa) | 476 | if (hpa) |
478 | idedisk_check_hpa(drive); | 477 | idedisk_check_hpa(drive); |
479 | } else { | 478 | } else { |
@@ -622,7 +621,7 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
622 | struct request *rq; | 621 | struct request *rq; |
623 | int error; | 622 | int error; |
624 | 623 | ||
625 | if (arg < 0 || arg > drive->driveid->max_multsect) | 624 | if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff)) |
626 | return -EINVAL; | 625 | return -EINVAL; |
627 | 626 | ||
628 | if (drive->special.b.set_multmode) | 627 | if (drive->special.b.set_multmode) |
@@ -775,8 +774,8 @@ static void idedisk_add_settings(ide_drive_t *drive) | |||
775 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, | 774 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, |
776 | &drive->addressing, set_lba_addressing); | 775 | &drive->addressing, set_lba_addressing); |
777 | ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, | 776 | ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, |
778 | drive->driveid->max_multsect, 1, 1, &drive->mult_count, | 777 | drive->id[ATA_ID_MAX_MULTSECT] & 0xff, 1, 1, |
779 | set_multcount); | 778 | &drive->mult_count, set_multcount); |
780 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, | 779 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, |
781 | &drive->nowerr, set_nowerr); | 780 | &drive->nowerr, set_nowerr); |
782 | ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, | 781 | ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index abab26de7687..15e608f52eba 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -649,8 +649,8 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) | |||
649 | case XFER_SW_DMA_0: | 649 | case XFER_SW_DMA_0: |
650 | if (id[ATA_ID_FIELD_VALID] & 2) { | 650 | if (id[ATA_ID_FIELD_VALID] & 2) { |
651 | mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask; | 651 | mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask; |
652 | } else if (drive->driveid->tDMA) { | 652 | } else if (id[ATA_ID_OLD_DMA_MODES] >> 8) { |
653 | u8 mode = drive->driveid->tDMA; | 653 | u8 mode = id[ATA_ID_OLD_DMA_MODES] >> 8; |
654 | 654 | ||
655 | /* | 655 | /* |
656 | * if the mode is valid convert it to the mask | 656 | * if the mode is valid convert it to the mask |
@@ -727,7 +727,7 @@ static int ide_tune_dma(ide_drive_t *drive) | |||
727 | ide_hwif_t *hwif = drive->hwif; | 727 | ide_hwif_t *hwif = drive->hwif; |
728 | u8 speed; | 728 | u8 speed; |
729 | 729 | ||
730 | if (drive->nodma || (drive->driveid->capability & 1) == 0) | 730 | if (drive->nodma || ata_id_has_dma(drive->id) == 0) |
731 | return 0; | 731 | return 0; |
732 | 732 | ||
733 | /* consult the list of known "bad" drives */ | 733 | /* consult the list of known "bad" drives */ |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 01b1943b315e..95495e4219ff 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -404,26 +404,10 @@ void ide_fix_driveid(u16 *id) | |||
404 | { | 404 | { |
405 | #ifndef __LITTLE_ENDIAN | 405 | #ifndef __LITTLE_ENDIAN |
406 | # ifdef __BIG_ENDIAN | 406 | # ifdef __BIG_ENDIAN |
407 | struct hd_driveid *driveid = (struct hd_driveid *)id; | ||
408 | int i; | 407 | int i; |
409 | 408 | ||
410 | for (i = 0; i < 256; i++) { | 409 | for (i = 0; i < 256; i++) |
411 | /* these words are accessed as two 8-bit values */ | ||
412 | if (i == 47 || i == 49 || i == 51 || i == 52 || i == 59) | ||
413 | continue; | ||
414 | if (i == 60 || i == 61) /* ->lba_capacity is 32-bit */ | ||
415 | continue; | ||
416 | if (i == 98 || i == 99) /* ->spg is 32-bit */ | ||
417 | continue; | ||
418 | if (i > 99 && i < 104) /* ->lba_capacity_2 is 64-bit */ | ||
419 | continue; | ||
420 | |||
421 | id[i] = __le16_to_cpu(id[i]); | 410 | id[i] = __le16_to_cpu(id[i]); |
422 | } | ||
423 | |||
424 | driveid->lba_capacity = __le32_to_cpu(driveid->lba_capacity); | ||
425 | driveid->spg = __le32_to_cpu(driveid->spg); | ||
426 | driveid->lba_capacity_2 = __le64_to_cpu(driveid->lba_capacity_2); | ||
427 | # else | 411 | # else |
428 | # error "Please fix <asm/byteorder.h>" | 412 | # error "Please fix <asm/byteorder.h>" |
429 | # endif | 413 | # endif |
@@ -752,7 +736,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
752 | #endif | 736 | #endif |
753 | 737 | ||
754 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ | 738 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ |
755 | if ((speed & 0xf8) == XFER_PIO_0 && !(drive->driveid->capability & 8)) | 739 | if ((speed & 0xf8) == XFER_PIO_0 && ata_id_has_iordy(drive->id) == 0) |
756 | goto skip; | 740 | goto skip; |
757 | 741 | ||
758 | /* | 742 | /* |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 3066d7e75c73..738c007a04d3 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -102,14 +102,14 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) | |||
102 | if (pio_mode != -1) { | 102 | if (pio_mode != -1) { |
103 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); | 103 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); |
104 | } else { | 104 | } else { |
105 | pio_mode = drive->driveid->tPIO; | 105 | pio_mode = id[ATA_ID_OLD_PIO_MODES] >> 8; |
106 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ | 106 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ |
107 | pio_mode = 2; | 107 | pio_mode = 2; |
108 | overridden = 1; | 108 | overridden = 1; |
109 | } | 109 | } |
110 | 110 | ||
111 | if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */ | 111 | if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */ |
112 | if (drive->driveid->capability & 8) { /* IORDY sup? */ | 112 | if (ata_id_has_iordy(id)) { |
113 | if (id[ATA_ID_PIO_MODES] & 7) { | 113 | if (id[ATA_ID_PIO_MODES] & 7) { |
114 | overridden = 0; | 114 | overridden = 0; |
115 | if (id[ATA_ID_PIO_MODES] & 4) | 115 | if (id[ATA_ID_PIO_MODES] & 4) |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index b4f8ca106639..1bb4b2c0e2f4 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -87,20 +87,20 @@ static void ide_disk_init_chs(ide_drive_t *drive) | |||
87 | 87 | ||
88 | static void ide_disk_init_mult_count(ide_drive_t *drive) | 88 | static void ide_disk_init_mult_count(ide_drive_t *drive) |
89 | { | 89 | { |
90 | struct hd_driveid *id = drive->driveid; | 90 | u16 *id = drive->id; |
91 | u8 max_multsect = id[ATA_ID_MAX_MULTSECT] & 0xff; | ||
91 | 92 | ||
92 | if (id->max_multsect) { | 93 | if (max_multsect) { |
93 | #ifdef CONFIG_IDEDISK_MULTI_MODE | 94 | #ifdef CONFIG_IDEDISK_MULTI_MODE |
94 | if ((id->max_multsect / 2) > 1) { | 95 | if ((max_multsect / 2) > 1) |
95 | id->multsect = id->max_multsect; | 96 | id[ATA_ID_MULTSECT] = max_multsect | 0x100; |
96 | id->multsect_valid = 1; | 97 | else |
97 | } else { | 98 | id[ATA_ID_MULTSECT] &= ~0x1ff; |
98 | id->multsect = 0; | 99 | |
99 | id->multsect_valid = 0; | 100 | drive->mult_req = id[ATA_ID_MULTSECT] & 0xff; |
100 | } | ||
101 | drive->mult_req = id->multsect; | ||
102 | #endif | 101 | #endif |
103 | if ((id->multsect_valid & 1) && id->multsect) | 102 | if ((id[ATA_ID_MULTSECT] & 0x100) && |
103 | (id[ATA_ID_MULTSECT] & 0xff)) | ||
104 | drive->special.b.set_multmode = 1; | 104 | drive->special.b.set_multmode = 1; |
105 | } | 105 | } |
106 | } | 106 | } |
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c index d64f345f2fc0..96e3d467a74c 100644 --- a/drivers/ide/ide-timings.c +++ b/drivers/ide/ide-timings.c | |||
@@ -83,7 +83,7 @@ u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio) | |||
83 | u16 cycle = 0; | 83 | u16 cycle = 0; |
84 | 84 | ||
85 | if (id[ATA_ID_FIELD_VALID] & 2) { | 85 | if (id[ATA_ID_FIELD_VALID] & 2) { |
86 | if (drive->driveid->capability & 8) | 86 | if (ata_id_has_iordy(drive->id)) |
87 | cycle = id[ATA_ID_EIDE_PIO_IORDY]; | 87 | cycle = id[ATA_ID_EIDE_PIO_IORDY]; |
88 | else | 88 | else |
89 | cycle = id[ATA_ID_EIDE_PIO]; | 89 | cycle = id[ATA_ID_EIDE_PIO]; |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 8d3fab33a3c7..21b3a767e7d7 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -328,7 +328,7 @@ int set_using_dma(ide_drive_t *drive, int arg) | |||
328 | if (arg < 0 || arg > 1) | 328 | if (arg < 0 || arg > 1) |
329 | return -EINVAL; | 329 | return -EINVAL; |
330 | 330 | ||
331 | if ((drive->driveid->capability & 1) == 0) | 331 | if (ata_id_has_dma(drive->id) == 0) |
332 | goto out; | 332 | goto out; |
333 | 333 | ||
334 | if (hwif->dma_ops == NULL) | 334 | if (hwif->dma_ops == NULL) |
@@ -502,12 +502,60 @@ static int generic_drive_reset(ide_drive_t *drive) | |||
502 | return ret; | 502 | return ret; |
503 | } | 503 | } |
504 | 504 | ||
505 | static inline void ide_id_to_hd_driveid(u16 *id) | ||
506 | { | ||
507 | #ifdef __BIG_ENDIAN | ||
508 | /* accessed in struct hd_driveid as 8-bit values */ | ||
509 | id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]); | ||
510 | id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]); | ||
511 | id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]); | ||
512 | id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]); | ||
513 | id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]); | ||
514 | |||
515 | /* as 32-bit values */ | ||
516 | *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
517 | *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG); | ||
518 | |||
519 | /* as 64-bit value */ | ||
520 | *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] = | ||
521 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | ||
522 | #endif | ||
523 | } | ||
524 | |||
525 | static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, | ||
526 | unsigned long arg) | ||
527 | { | ||
528 | u16 *id = NULL; | ||
529 | int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142; | ||
530 | int rc = 0; | ||
531 | |||
532 | if (drive->id_read == 0) { | ||
533 | rc = -ENOMSG; | ||
534 | goto out; | ||
535 | } | ||
536 | |||
537 | id = kmalloc(size, GFP_KERNEL); | ||
538 | if (id == NULL) { | ||
539 | rc = -ENOMEM; | ||
540 | goto out; | ||
541 | } | ||
542 | |||
543 | memcpy(id, drive->id, size); | ||
544 | ide_id_to_hd_driveid(id); | ||
545 | |||
546 | if (copy_to_user((void __user *)arg, id, size)) | ||
547 | rc = -EFAULT; | ||
548 | |||
549 | kfree(id); | ||
550 | out: | ||
551 | return rc; | ||
552 | } | ||
553 | |||
505 | int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev, | 554 | int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev, |
506 | unsigned int cmd, unsigned long arg) | 555 | unsigned int cmd, unsigned long arg) |
507 | { | 556 | { |
508 | unsigned long flags; | 557 | unsigned long flags; |
509 | ide_driver_t *drv; | 558 | ide_driver_t *drv; |
510 | void __user *p = (void __user *)arg; | ||
511 | int err = 0, (*setfunc)(ide_drive_t *, int); | 559 | int err = 0, (*setfunc)(ide_drive_t *, int); |
512 | u8 *val; | 560 | u8 *val; |
513 | 561 | ||
@@ -528,12 +576,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
528 | case HDIO_GET_IDENTITY: | 576 | case HDIO_GET_IDENTITY: |
529 | if (bdev != bdev->bd_contains) | 577 | if (bdev != bdev->bd_contains) |
530 | return -EINVAL; | 578 | return -EINVAL; |
531 | if (drive->id_read == 0) | 579 | return ide_get_identity_ioctl(drive, cmd, arg); |
532 | return -ENOMSG; | ||
533 | if (copy_to_user(p, drive->id, (cmd == HDIO_GET_IDENTITY) ? sizeof(*drive->id) : 142)) | ||
534 | return -EFAULT; | ||
535 | return 0; | ||
536 | |||
537 | case HDIO_GET_NICE: | 580 | case HDIO_GET_NICE: |
538 | return put_user(drive->dsc_overlap << IDE_NICE_DSC_OVERLAP | | 581 | return put_user(drive->dsc_overlap << IDE_NICE_DSC_OVERLAP | |
539 | drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP | | 582 | drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP | |
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index ef4e84053a81..6d7f548655e4 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -195,10 +195,10 @@ static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
195 | * FIXME: use "pio" value | 195 | * FIXME: use "pio" value |
196 | */ | 196 | */ |
197 | if (!qd_find_disk_type(drive, &active_time, &recovery_time) && | 197 | if (!qd_find_disk_type(drive, &active_time, &recovery_time) && |
198 | drive->driveid->tPIO && (id[ATA_ID_FIELD_VALID] & 2) && | 198 | (id[ATA_ID_OLD_PIO_MODES] & 0xff) && (id[ATA_ID_FIELD_VALID] & 2) && |
199 | id[ATA_ID_EIDE_PIO] >= 240) { | 199 | id[ATA_ID_EIDE_PIO] >= 240) { |
200 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, | 200 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, |
201 | drive->driveid->tPIO); | 201 | id[ATA_ID_OLD_PIO_MODES] & 0xff); |
202 | active_time = 110; | 202 | active_time = 110; |
203 | recovery_time = drive->id[ATA_ID_EIDE_PIO] - 120; | 203 | recovery_time = drive->id[ATA_ID_EIDE_PIO] - 120; |
204 | } | 204 | } |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 774ff58603a2..ef91e9d7c54f 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -88,7 +88,7 @@ static u8 cs5530_udma_filter(ide_drive_t *drive) | |||
88 | if (mate->present == 0) | 88 | if (mate->present == 0) |
89 | goto out; | 89 | goto out; |
90 | 90 | ||
91 | if ((mate->driveid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { | 91 | if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { |
92 | if ((mateid[ATA_ID_FIELD_VALID] & 4) && | 92 | if ((mateid[ATA_ID_FIELD_VALID] & 4) && |
93 | (mateid[ATA_ID_UDMA_MODES] & 7)) | 93 | (mateid[ATA_ID_UDMA_MODES] & 7)) |
94 | goto out; | 94 | goto out; |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 31d4e6aef1b8..ed24065f74e8 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -470,7 +470,7 @@ static void it821x_quirkproc(ide_drive_t *drive) | |||
470 | /* In raid mode the ident block is slightly buggy | 470 | /* In raid mode the ident block is slightly buggy |
471 | We need to set the bits so that the IDE layer knows | 471 | We need to set the bits so that the IDE layer knows |
472 | LBA28. LBA48 and DMA ar valid */ | 472 | LBA28. LBA48 and DMA ar valid */ |
473 | drive->driveid->capability |= 3; /* LBA28, DMA */ | 473 | id[ATA_ID_CAPABILITY] |= (3 << 8); /* LBA28, DMA */ |
474 | id[ATA_ID_COMMAND_SET_2] |= 0x0400; /* LBA48 valid */ | 474 | id[ATA_ID_COMMAND_SET_2] |= 0x0400; /* LBA48 valid */ |
475 | id[ATA_ID_CFS_ENABLE_2] |= 0x0400; /* LBA48 on */ | 475 | id[ATA_ID_CFS_ENABLE_2] |= 0x0400; /* LBA48 on */ |
476 | /* Reporting logic */ | 476 | /* Reporting logic */ |
@@ -504,7 +504,7 @@ static void it821x_quirkproc(ide_drive_t *drive) | |||
504 | * IDE core that DMA is supported (it821x hardware | 504 | * IDE core that DMA is supported (it821x hardware |
505 | * takes care of DMA mode programming). | 505 | * takes care of DMA mode programming). |
506 | */ | 506 | */ |
507 | if (drive->driveid->capability & 1) { | 507 | if (ata_id_has_dma(id)) { |
508 | id[ATA_ID_MWDMA_MODES] |= 0x0101; | 508 | id[ATA_ID_MWDMA_MODES] |= 0x0101; |
509 | drive->current_speed = XFER_MW_DMA_0; | 509 | drive->current_speed = XFER_MW_DMA_0; |
510 | } | 510 | } |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 23e861b177ce..5d4436f3efd4 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -86,7 +86,7 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | |||
86 | * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A | 86 | * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A |
87 | */ | 87 | */ |
88 | AP &= ~0x3f; | 88 | AP &= ~0x3f; |
89 | if (drive->driveid->capability & 4) | 89 | if (ata_id_iordy_disable(drive->id)) |
90 | AP |= 0x20; /* set IORDY_EN bit */ | 90 | AP |= 0x20; /* set IORDY_EN bit */ |
91 | if (drive->media == ide_disk) | 91 | if (drive->media == ide_disk) |
92 | AP |= 0x10; /* set Prefetch_EN bit */ | 92 | AP |= 0x10; /* set Prefetch_EN bit */ |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 5c8367df14e4..695cc9742048 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -111,7 +111,7 @@ static u8 sc1200_udma_filter(ide_drive_t *drive) | |||
111 | if (mate->present == 0) | 111 | if (mate->present == 0) |
112 | goto out; | 112 | goto out; |
113 | 113 | ||
114 | if ((mate->driveid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { | 114 | if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { |
115 | if ((mateid[ATA_ID_FIELD_VALID] & 4) && | 115 | if ((mateid[ATA_ID_FIELD_VALID] & 4) && |
116 | (mateid[ATA_ID_UDMA_MODES] & 7)) | 116 | (mateid[ATA_ID_UDMA_MODES] & 7)) |
117 | goto out; | 117 | goto out; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 0c85aff3edf1..e887927e00e6 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -380,11 +380,7 @@ struct ide_drive_s { | |||
380 | struct request *rq; /* current request */ | 380 | struct request *rq; /* current request */ |
381 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 381 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
382 | void *driver_data; /* extra driver data */ | 382 | void *driver_data; /* extra driver data */ |
383 | union { | 383 | u16 *id; /* identification info */ |
384 | /* identification info */ | ||
385 | struct hd_driveid *driveid; | ||
386 | u16 *id; | ||
387 | }; | ||
388 | #ifdef CONFIG_IDE_PROC_FS | 384 | #ifdef CONFIG_IDE_PROC_FS |
389 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 385 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
390 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ | 386 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ |
@@ -1353,8 +1349,7 @@ extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | |||
1353 | 1349 | ||
1354 | static inline int ide_dev_has_iordy(u16 *id) | 1350 | static inline int ide_dev_has_iordy(u16 *id) |
1355 | { | 1351 | { |
1356 | return ((id[ATA_ID_FIELD_VALID] & 2) && | 1352 | return ((id[ATA_ID_FIELD_VALID] & 2) && ata_id_has_iordy(id)) ? 1 : 0; |
1357 | (((struct hd_driveid *)id)->capability & 8)) ? 1 : 0; | ||
1358 | } | 1353 | } |
1359 | 1354 | ||
1360 | static inline int ide_dev_is_sata(u16 *id) | 1355 | static inline int ide_dev_is_sata(u16 *id) |