aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:19 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:19 -0400
commit4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab (patch)
treeee3be70390e4c617b44329edef0a05039f59c81a /drivers
parent5b90e990928919ae411a68b865e8a6ecac09a603 (diff)
ide: make drive->id an union (take 2)
Make drive->id an unnamed union so id can be accessed either by using 'u16 *id' or 'struct hd_driveid *driveid'. Then convert all existing drive->id users accordingly (using 'u16 *id' when possible). This is an intermediate step to make ide 'struct hd_driveid'-free. While at it: - Add missing KERN_CONTs in it821x.c. - Use ATA_ID_WORDS and ATA_ID_*_LEN defines. - Remove unnecessary checks for drive->id. - s/drive_table/table/ in ide_in_drive_list(). - Cleanup ide_config_drive_speed() a bit. - s/drive1/dev1/ & s/drive0/dev0/ in ide_undecoded_slave(). v2: Fix typo in drivers/ide/ppc/pmac.c. (From Stephen Rothwell) There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/arm/icside.c4
-rw-r--r--drivers/ide/arm/palm_bk3710.c3
-rw-r--r--drivers/ide/ide-acpi.c6
-rw-r--r--drivers/ide/ide-cd.c15
-rw-r--r--drivers/ide/ide-disk.c63
-rw-r--r--drivers/ide/ide-dma.c50
-rw-r--r--drivers/ide/ide-floppy.c14
-rw-r--r--drivers/ide/ide-iops.c80
-rw-r--r--drivers/ide/ide-lib.c24
-rw-r--r--drivers/ide/ide-probe.c117
-rw-r--r--drivers/ide/ide-proc.c5
-rw-r--r--drivers/ide/ide-tape.c7
-rw-r--r--drivers/ide/ide-taskfile.c6
-rw-r--r--drivers/ide/ide-timings.c21
-rw-r--r--drivers/ide/ide.c8
-rw-r--r--drivers/ide/legacy/qd65xx.c22
-rw-r--r--drivers/ide/pci/alim15x3.c4
-rw-r--r--drivers/ide/pci/cs5530.c10
-rw-r--r--drivers/ide/pci/hpt366.c8
-rw-r--r--drivers/ide/pci/it821x.c51
-rw-r--r--drivers/ide/pci/pdc202xx_new.c4
-rw-r--r--drivers/ide/pci/pdc202xx_old.c6
-rw-r--r--drivers/ide/pci/sc1200.c10
-rw-r--r--drivers/ide/pci/serverworks.c4
-rw-r--r--drivers/ide/pci/siimage.c8
-rw-r--r--drivers/ide/ppc/pmac.c6
-rw-r--r--drivers/scsi/ide-scsi.c13
27 files changed, 298 insertions, 271 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index df4af4083954..ca9e8ea32ee2 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -265,8 +265,8 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode)
265 * If we're going to be doing MW_DMA_1 or MW_DMA_2, we should 265 * If we're going to be doing MW_DMA_1 or MW_DMA_2, we should
266 * take care to note the values in the ID... 266 * take care to note the values in the ID...
267 */ 267 */
268 if (use_dma_info && drive->id->eide_dma_time > cycle_time) 268 if (use_dma_info && drive->id[ATA_ID_EIDE_DMA_TIME] > cycle_time)
269 cycle_time = drive->id->eide_dma_time; 269 cycle_time = drive->id[ATA_ID_EIDE_DMA_TIME];
270 270
271 drive->drive_data = cycle_time; 271 drive->drive_data = cycle_time;
272 272
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index 4fd91dcf1dc2..6cea984776fd 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -213,7 +213,8 @@ static void palm_bk3710_set_dma_mode(ide_drive_t *drive, u8 xferspeed)
213 palm_bk3710_setudmamode(base, is_slave, 213 palm_bk3710_setudmamode(base, is_slave,
214 xferspeed - XFER_UDMA_0); 214 xferspeed - XFER_UDMA_0);
215 } else { 215 } else {
216 palm_bk3710_setdmamode(base, is_slave, drive->id->eide_dma_min, 216 palm_bk3710_setdmamode(base, is_slave,
217 drive->id[ATA_ID_EIDE_DMA_MIN],
217 xferspeed); 218 xferspeed);
218 } 219 }
219} 220}
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 6f704628c27d..2427c380b3dc 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -584,7 +584,7 @@ void ide_acpi_get_timing(ide_hwif_t *hwif)
584 * This function executes the _STM ACPI method for the target channel. 584 * This function executes the _STM ACPI method for the target channel.
585 * 585 *
586 * _STM requires Identify Drive data, which has to passed as an argument. 586 * _STM requires Identify Drive data, which has to passed as an argument.
587 * Unfortunately hd_driveid is a mangled version which we can't readily 587 * Unfortunately drive->id is a mangled version which we can't readily
588 * use; hence we'll get the information afresh. 588 * use; hence we'll get the information afresh.
589 */ 589 */
590void ide_acpi_push_timing(ide_hwif_t *hwif) 590void ide_acpi_push_timing(ide_hwif_t *hwif)
@@ -614,10 +614,10 @@ void ide_acpi_push_timing(ide_hwif_t *hwif)
614 in_params[0].buffer.length = sizeof(struct GTM_buffer); 614 in_params[0].buffer.length = sizeof(struct GTM_buffer);
615 in_params[0].buffer.pointer = (u8 *)&hwif->acpidata->gtm; 615 in_params[0].buffer.pointer = (u8 *)&hwif->acpidata->gtm;
616 in_params[1].type = ACPI_TYPE_BUFFER; 616 in_params[1].type = ACPI_TYPE_BUFFER;
617 in_params[1].buffer.length = sizeof(struct hd_driveid); 617 in_params[1].buffer.length = sizeof(ATA_ID_WORDS * 2);
618 in_params[1].buffer.pointer = (u8 *)&master->idbuff; 618 in_params[1].buffer.pointer = (u8 *)&master->idbuff;
619 in_params[2].type = ACPI_TYPE_BUFFER; 619 in_params[2].type = ACPI_TYPE_BUFFER;
620 in_params[2].buffer.length = sizeof(struct hd_driveid); 620 in_params[2].buffer.length = sizeof(ATA_ID_WORDS * 2);
621 in_params[2].buffer.pointer = (u8 *)&slave->idbuff; 621 in_params[2].buffer.pointer = (u8 *)&slave->idbuff;
622 /* Output buffer: _STM has no output */ 622 /* Output buffer: _STM has no output */
623 623
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 03c2cb6a58bc..46f9720f1ec9 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1866,14 +1866,14 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
1866 { NULL, NULL, 0 } 1866 { NULL, NULL, 0 }
1867}; 1867};
1868 1868
1869static unsigned int ide_cd_flags(struct hd_driveid *id) 1869static unsigned int ide_cd_flags(u16 *id)
1870{ 1870{
1871 const struct cd_list_entry *cle = ide_cd_quirks_list; 1871 const struct cd_list_entry *cle = ide_cd_quirks_list;
1872 1872
1873 while (cle->id_model) { 1873 while (cle->id_model) {
1874 if (strcmp(cle->id_model, id->model) == 0 && 1874 if (strcmp(cle->id_model, (char *)&id[ATA_ID_PROD]) == 0 &&
1875 (cle->id_firmware == NULL || 1875 (cle->id_firmware == NULL ||
1876 strstr(id->fw_rev, cle->id_firmware))) 1876 strstr((char *)&id[ATA_ID_FW_REV], cle->id_firmware)))
1877 return cle->cd_flags; 1877 return cle->cd_flags;
1878 cle++; 1878 cle++;
1879 } 1879 }
@@ -1885,7 +1885,8 @@ static int ide_cdrom_setup(ide_drive_t *drive)
1885{ 1885{
1886 struct cdrom_info *cd = drive->driver_data; 1886 struct cdrom_info *cd = drive->driver_data;
1887 struct cdrom_device_info *cdi = &cd->devinfo; 1887 struct cdrom_device_info *cdi = &cd->devinfo;
1888 struct hd_driveid *id = drive->id; 1888 u16 *id = drive->id;
1889 char *fw_rev = (char *)&id[ATA_ID_FW_REV];
1889 int nslots; 1890 int nslots;
1890 1891
1891 blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); 1892 blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn);
@@ -1900,15 +1901,15 @@ static int ide_cdrom_setup(ide_drive_t *drive)
1900 drive->atapi_flags = IDE_AFLAG_MEDIA_CHANGED | IDE_AFLAG_NO_EJECT | 1901 drive->atapi_flags = IDE_AFLAG_MEDIA_CHANGED | IDE_AFLAG_NO_EJECT |
1901 ide_cd_flags(id); 1902 ide_cd_flags(id);
1902 1903
1903 if ((id->config & 0x0060) == 0x20) 1904 if ((id[ATA_ID_CONFIG] & 0x0060) == 0x20)
1904 drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT; 1905 drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
1905 1906
1906 if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) && 1907 if ((drive->atapi_flags & IDE_AFLAG_VERTOS_300_SSD) &&
1907 id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') 1908 fw_rev[4] == '1' && fw_rev[6] <= '2')
1908 drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD | 1909 drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD |
1909 IDE_AFLAG_TOCADDR_AS_BCD); 1910 IDE_AFLAG_TOCADDR_AS_BCD);
1910 else if ((drive->atapi_flags & IDE_AFLAG_VERTOS_600_ESD) && 1911 else if ((drive->atapi_flags & IDE_AFLAG_VERTOS_600_ESD) &&
1911 id->fw_rev[4] == '1' && id->fw_rev[6] <= '2') 1912 fw_rev[4] == '1' && fw_rev[6] <= '2')
1912 drive->atapi_flags |= IDE_AFLAG_TOCTRACKS_AS_BCD; 1913 drive->atapi_flags |= IDE_AFLAG_TOCTRACKS_AS_BCD;
1913 else if (drive->atapi_flags & IDE_AFLAG_SANYO_3CD) 1914 else if (drive->atapi_flags & IDE_AFLAG_SANYO_3CD)
1914 /* 3 => use CD in slot 0 */ 1915 /* 3 => use CD in slot 0 */
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 33ea8c048717..f1669bca3cab 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -99,12 +99,13 @@ static void ide_disk_put(struct ide_disk_obj *idkp)
99 * 99 *
100 * It is called only once for each drive. 100 * It is called only once for each drive.
101 */ 101 */
102static int lba_capacity_is_ok(struct hd_driveid *id) 102static int lba_capacity_is_ok(u16 *id)
103{ 103{
104 struct hd_driveid *driveid = (struct hd_driveid *)id;
104 unsigned long lba_sects, chs_sects, head, tail; 105 unsigned long lba_sects, chs_sects, head, tail;
105 106
106 /* No non-LBA info .. so valid! */ 107 /* No non-LBA info .. so valid! */
107 if (id->cyls == 0) 108 if (id[ATA_ID_CYLS] == 0)
108 return 1; 109 return 1;
109 110
110 /* 111 /*
@@ -113,15 +114,15 @@ static int lba_capacity_is_ok(struct hd_driveid *id)
113 * Some drives can be jumpered to use 15 heads instead of 16. 114 * Some drives can be jumpered to use 15 heads instead of 16.
114 * Some drives can be jumpered to use 4092 cyls instead of 16383. 115 * Some drives can be jumpered to use 4092 cyls instead of 16383.
115 */ 116 */
116 if ((id->cyls == 16383 117 if ((id[ATA_ID_CYLS] == 16383 ||
117 || (id->cyls == 4092 && id->cur_cyls == 16383)) && 118 (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) &&
118 id->sectors == 63 && 119 id[ATA_ID_SECTORS] == 63 &&
119 (id->heads == 15 || id->heads == 16) && 120 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) &&
120 (id->lba_capacity >= 16383*63*id->heads)) 121 (driveid->lba_capacity >= 16383 * 63 * id[ATA_ID_HEADS]))
121 return 1; 122 return 1;
122 123
123 lba_sects = id->lba_capacity; 124 lba_sects = driveid->lba_capacity;
124 chs_sects = id->cyls * id->heads * id->sectors; 125 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS];
125 126
126 /* 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 */
127 if ((lba_sects - chs_sects) < chs_sects/10) 128 if ((lba_sects - chs_sects) < chs_sects/10)
@@ -132,7 +133,7 @@ static int lba_capacity_is_ok(struct hd_driveid *id)
132 tail = (lba_sects & 0xffff); 133 tail = (lba_sects & 0xffff);
133 lba_sects = (head | (tail << 16)); 134 lba_sects = (head | (tail << 16));
134 if ((lba_sects - chs_sects) < chs_sects/10) { 135 if ((lba_sects - chs_sects) < chs_sects/10) {
135 id->lba_capacity = lba_sects; 136 driveid->lba_capacity = lba_sects;
136 return 1; /* lba_capacity is (now) good */ 137 return 1; /* lba_capacity is (now) good */
137 } 138 }
138 139
@@ -389,18 +390,20 @@ static unsigned long long sectors_to_MB(unsigned long long n)
389 * so on non-buggy drives we need test only one. 390 * so on non-buggy drives we need test only one.
390 * However, we should also check whether these fields are valid. 391 * However, we should also check whether these fields are valid.
391 */ 392 */
392static inline int idedisk_supports_hpa(const struct hd_driveid *id) 393static inline int idedisk_supports_hpa(const u16 *id)
393{ 394{
394 return (id->command_set_1 & 0x0400) && (id->cfs_enable_1 & 0x0400); 395 return (id[ATA_ID_COMMAND_SET_1] & 0x0400) &&
396 (id[ATA_ID_CFS_ENABLE_1] & 0x0400);
395} 397}
396 398
397/* 399/*
398 * The same here. 400 * The same here.
399 */ 401 */
400static inline int idedisk_supports_lba48(const struct hd_driveid *id) 402static inline int idedisk_supports_lba48(const u16 *id)
401{ 403{
402 return (id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) 404 return (id[ATA_ID_COMMAND_SET_2] & 0x0400) &&
403 && id->lba_capacity_2; 405 (id[ATA_ID_CFS_ENABLE_2] & 0x0400) &&
406 ((struct hd_driveid *)id)->lba_capacity_2;
404} 407}
405 408
406/* 409/*
@@ -453,7 +456,8 @@ static void idedisk_check_hpa(ide_drive_t *drive)
453 456
454static void init_idedisk_capacity(ide_drive_t *drive) 457static void init_idedisk_capacity(ide_drive_t *drive)
455{ 458{
456 struct hd_driveid *id = drive->id; 459 struct hd_driveid *driveid = drive->driveid;
460 u16 *id = drive->id;
457 /* 461 /*
458 * If this drive supports the Host Protected Area feature set, 462 * If this drive supports the Host Protected Area feature set,
459 * then we may need to change our opinion about the drive's capacity. 463 * then we may need to change our opinion about the drive's capacity.
@@ -463,13 +467,13 @@ static void init_idedisk_capacity(ide_drive_t *drive)
463 if (idedisk_supports_lba48(id)) { 467 if (idedisk_supports_lba48(id)) {
464 /* drive speaks 48-bit LBA */ 468 /* drive speaks 48-bit LBA */
465 drive->select.b.lba = 1; 469 drive->select.b.lba = 1;
466 drive->capacity64 = id->lba_capacity_2; 470 drive->capacity64 = driveid->lba_capacity_2;
467 if (hpa) 471 if (hpa)
468 idedisk_check_hpa(drive); 472 idedisk_check_hpa(drive);
469 } else if ((id->capability & 2) && lba_capacity_is_ok(id)) { 473 } else if ((driveid->capability & 2) && lba_capacity_is_ok(id)) {
470 /* drive speaks 28-bit LBA */ 474 /* drive speaks 28-bit LBA */
471 drive->select.b.lba = 1; 475 drive->select.b.lba = 1;
472 drive->capacity64 = id->lba_capacity; 476 drive->capacity64 = driveid->lba_capacity;
473 if (hpa) 477 if (hpa)
474 idedisk_check_hpa(drive); 478 idedisk_check_hpa(drive);
475 } else { 479 } else {
@@ -523,7 +527,7 @@ static int proc_idedisk_read_cache
523 int len; 527 int len;
524 528
525 if (drive->id_read) 529 if (drive->id_read)
526 len = sprintf(out, "%i\n", drive->id->buf_size / 2); 530 len = sprintf(out, "%i\n", drive->id[ATA_ID_BUF_SIZE] / 2);
527 else 531 else
528 len = sprintf(out, "(none)\n"); 532 len = sprintf(out, "(none)\n");
529 533
@@ -618,7 +622,7 @@ static int set_multcount(ide_drive_t *drive, int arg)
618 struct request *rq; 622 struct request *rq;
619 int error; 623 int error;
620 624
621 if (arg < 0 || arg > drive->id->max_multsect) 625 if (arg < 0 || arg > drive->driveid->max_multsect)
622 return -EINVAL; 626 return -EINVAL;
623 627
624 if (drive->special.b.set_multmode) 628 if (drive->special.b.set_multmode)
@@ -650,7 +654,7 @@ static int set_nowerr(ide_drive_t *drive, int arg)
650 654
651static void update_ordered(ide_drive_t *drive) 655static void update_ordered(ide_drive_t *drive)
652{ 656{
653 struct hd_driveid *id = drive->id; 657 u16 *id = drive->id;
654 unsigned ordered = QUEUE_ORDERED_NONE; 658 unsigned ordered = QUEUE_ORDERED_NONE;
655 prepare_flush_fn *prep_fn = NULL; 659 prepare_flush_fn *prep_fn = NULL;
656 660
@@ -762,8 +766,6 @@ static int set_lba_addressing(ide_drive_t *drive, int arg)
762#ifdef CONFIG_IDE_PROC_FS 766#ifdef CONFIG_IDE_PROC_FS
763static void idedisk_add_settings(ide_drive_t *drive) 767static void idedisk_add_settings(ide_drive_t *drive)
764{ 768{
765 struct hd_driveid *id = drive->id;
766
767 ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, 769 ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1,
768 &drive->bios_cyl, NULL); 770 &drive->bios_cyl, NULL);
769 ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, 771 ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1,
@@ -773,7 +775,7 @@ static void idedisk_add_settings(ide_drive_t *drive)
773 ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, 775 ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1,
774 &drive->addressing, set_lba_addressing); 776 &drive->addressing, set_lba_addressing);
775 ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, 777 ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0,
776 id->max_multsect, 1, 1, &drive->mult_count, 778 drive->driveid->max_multsect, 1, 1, &drive->mult_count,
777 set_multcount); 779 set_multcount);
778 ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, 780 ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
779 &drive->nowerr, set_nowerr); 781 &drive->nowerr, set_nowerr);
@@ -795,7 +797,8 @@ static inline void idedisk_add_settings(ide_drive_t *drive) { ; }
795static void idedisk_setup(ide_drive_t *drive) 797static void idedisk_setup(ide_drive_t *drive)
796{ 798{
797 ide_hwif_t *hwif = drive->hwif; 799 ide_hwif_t *hwif = drive->hwif;
798 struct hd_driveid *id = drive->id; 800 u16 *id = drive->id;
801 char *m = (char *)&id[ATA_ID_PROD];
799 unsigned long long capacity; 802 unsigned long long capacity;
800 803
801 idedisk_add_settings(drive); 804 idedisk_add_settings(drive);
@@ -807,7 +810,7 @@ static void idedisk_setup(ide_drive_t *drive)
807 /* 810 /*
808 * Removable disks (eg. SYQUEST); ignore 'WD' drives 811 * Removable disks (eg. SYQUEST); ignore 'WD' drives
809 */ 812 */
810 if (id->model[0] != 'W' || id->model[1] != 'D') 813 if (m[0] != 'W' || m[1] != 'D')
811 drive->doorlocking = 1; 814 drive->doorlocking = 1;
812 } 815 }
813 816
@@ -880,14 +883,14 @@ static void idedisk_setup(ide_drive_t *drive)
880 drive->name, capacity, sectors_to_MB(capacity)); 883 drive->name, capacity, sectors_to_MB(capacity));
881 884
882 /* Only print cache size when it was specified */ 885 /* Only print cache size when it was specified */
883 if (id->buf_size) 886 if (id[ATA_ID_BUF_SIZE])
884 printk(KERN_CONT " w/%dKiB Cache", id->buf_size / 2); 887 printk(KERN_CONT " w/%dKiB Cache", id[ATA_ID_BUF_SIZE] / 2);
885 888
886 printk(KERN_CONT ", CHS=%d/%d/%d\n", 889 printk(KERN_CONT ", CHS=%d/%d/%d\n",
887 drive->bios_cyl, drive->bios_head, drive->bios_sect); 890 drive->bios_cyl, drive->bios_head, drive->bios_sect);
888 891
889 /* write cache enabled? */ 892 /* write cache enabled? */
890 if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5))) 893 if ((id[ATA_ID_CSFO] & 1) || (id[ATA_ID_CFS_ENABLE_1] & (1 << 5)))
891 drive->wcache = 1; 894 drive->wcache = 1;
892 895
893 write_cache(drive, 1); 896 write_cache(drive, 1);
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 3fa07c0aeaa4..abab26de7687 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -288,7 +288,7 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
288static int config_drive_for_dma (ide_drive_t *drive) 288static int config_drive_for_dma (ide_drive_t *drive)
289{ 289{
290 ide_hwif_t *hwif = drive->hwif; 290 ide_hwif_t *hwif = drive->hwif;
291 struct hd_driveid *id = drive->id; 291 u16 *id = drive->id;
292 292
293 if (drive->media != ide_disk) { 293 if (drive->media != ide_disk) {
294 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) 294 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
@@ -299,16 +299,17 @@ static int config_drive_for_dma (ide_drive_t *drive)
299 * Enable DMA on any drive that has 299 * Enable DMA on any drive that has
300 * UltraDMA (mode 0/1/2/3/4/5/6) enabled 300 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
301 */ 301 */
302 if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f)) 302 if ((id[ATA_ID_FIELD_VALID] & 4) &&
303 ((id[ATA_ID_UDMA_MODES] >> 8) & 0x7f))
303 return 1; 304 return 1;
304 305
305 /* 306 /*
306 * Enable DMA on any drive that has mode2 DMA 307 * Enable DMA on any drive that has mode2 DMA
307 * (multi or single) enabled 308 * (multi or single) enabled
308 */ 309 */
309 if (id->field_valid & 2) /* regular DMA */ 310 if (id[ATA_ID_FIELD_VALID] & 2) /* regular DMA */
310 if ((id->dma_mword & 0x404) == 0x404 || 311 if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 ||
311 (id->dma_1word & 0x404) == 0x404) 312 (id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404)
312 return 1; 313 return 1;
313 314
314 /* Consult the list of known "good" drives */ 315 /* Consult the list of known "good" drives */
@@ -591,12 +592,12 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
591 592
592int __ide_dma_bad_drive (ide_drive_t *drive) 593int __ide_dma_bad_drive (ide_drive_t *drive)
593{ 594{
594 struct hd_driveid *id = drive->id; 595 u16 *id = drive->id;
595 596
596 int blacklist = ide_in_drive_list(id, drive_blacklist); 597 int blacklist = ide_in_drive_list(id, drive_blacklist);
597 if (blacklist) { 598 if (blacklist) {
598 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n", 599 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n",
599 drive->name, id->model); 600 drive->name, (char *)&id[ATA_ID_PROD]);
600 return blacklist; 601 return blacklist;
601 } 602 }
602 return 0; 603 return 0;
@@ -612,21 +613,21 @@ static const u8 xfer_mode_bases[] = {
612 613
613static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) 614static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
614{ 615{
615 struct hd_driveid *id = drive->id; 616 u16 *id = drive->id;
616 ide_hwif_t *hwif = drive->hwif; 617 ide_hwif_t *hwif = drive->hwif;
617 const struct ide_port_ops *port_ops = hwif->port_ops; 618 const struct ide_port_ops *port_ops = hwif->port_ops;
618 unsigned int mask = 0; 619 unsigned int mask = 0;
619 620
620 switch(base) { 621 switch(base) {
621 case XFER_UDMA_0: 622 case XFER_UDMA_0:
622 if ((id->field_valid & 4) == 0) 623 if ((id[ATA_ID_FIELD_VALID] & 4) == 0)
623 break; 624 break;
624 625
625 if (port_ops && port_ops->udma_filter) 626 if (port_ops && port_ops->udma_filter)
626 mask = port_ops->udma_filter(drive); 627 mask = port_ops->udma_filter(drive);
627 else 628 else
628 mask = hwif->ultra_mask; 629 mask = hwif->ultra_mask;
629 mask &= id->dma_ultra; 630 mask &= id[ATA_ID_UDMA_MODES];
630 631
631 /* 632 /*
632 * avoid false cable warning from eighty_ninty_three() 633 * avoid false cable warning from eighty_ninty_three()
@@ -637,19 +638,19 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
637 } 638 }
638 break; 639 break;
639 case XFER_MW_DMA_0: 640 case XFER_MW_DMA_0:
640 if ((id->field_valid & 2) == 0) 641 if ((id[ATA_ID_FIELD_VALID] & 2) == 0)
641 break; 642 break;
642 if (port_ops && port_ops->mdma_filter) 643 if (port_ops && port_ops->mdma_filter)
643 mask = port_ops->mdma_filter(drive); 644 mask = port_ops->mdma_filter(drive);
644 else 645 else
645 mask = hwif->mwdma_mask; 646 mask = hwif->mwdma_mask;
646 mask &= id->dma_mword; 647 mask &= id[ATA_ID_MWDMA_MODES];
647 break; 648 break;
648 case XFER_SW_DMA_0: 649 case XFER_SW_DMA_0:
649 if (id->field_valid & 2) { 650 if (id[ATA_ID_FIELD_VALID] & 2) {
650 mask = id->dma_1word & hwif->swdma_mask; 651 mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask;
651 } else if (id->tDMA) { 652 } else if (drive->driveid->tDMA) {
652 u8 mode = id->tDMA; 653 u8 mode = drive->driveid->tDMA;
653 654
654 /* 655 /*
655 * if the mode is valid convert it to the mask 656 * if the mode is valid convert it to the mask
@@ -706,7 +707,8 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
706 /* 707 /*
707 * is this correct? 708 * is this correct?
708 */ 709 */
709 if (ide_dma_good_drive(drive) && drive->id->eide_dma_time < 150) 710 if (ide_dma_good_drive(drive) &&
711 drive->id[ATA_ID_EIDE_DMA_TIME] < 150)
710 mode = XFER_MW_DMA_1; 712 mode = XFER_MW_DMA_1;
711 } 713 }
712 714
@@ -725,7 +727,7 @@ static int ide_tune_dma(ide_drive_t *drive)
725 ide_hwif_t *hwif = drive->hwif; 727 ide_hwif_t *hwif = drive->hwif;
726 u8 speed; 728 u8 speed;
727 729
728 if (drive->nodma || (drive->id->capability & 1) == 0) 730 if (drive->nodma || (drive->driveid->capability & 1) == 0)
729 return 0; 731 return 0;
730 732
731 /* consult the list of known "bad" drives */ 733 /* consult the list of known "bad" drives */
@@ -767,13 +769,15 @@ static int ide_dma_check(ide_drive_t *drive)
767 769
768int ide_id_dma_bug(ide_drive_t *drive) 770int ide_id_dma_bug(ide_drive_t *drive)
769{ 771{
770 struct hd_driveid *id = drive->id; 772 u16 *id = drive->id;
771 773
772 if (id->field_valid & 4) { 774 if (id[ATA_ID_FIELD_VALID] & 4) {
773 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) 775 if ((id[ATA_ID_UDMA_MODES] >> 8) &&
776 (id[ATA_ID_MWDMA_MODES] >> 8))
774 goto err_out; 777 goto err_out;
775 } else if (id->field_valid & 2) { 778 } else if (id[ATA_ID_FIELD_VALID] & 2) {
776 if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) 779 if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
780 (id[ATA_ID_SWDMA_MODES] >> 8))
777 goto err_out; 781 goto err_out;
778 } 782 }
779 return 0; 783 return 0;
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index e9034c0125f3..67f93a46f510 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -965,12 +965,12 @@ static sector_t idefloppy_capacity(ide_drive_t *drive)
965 * Check whether we can support a drive, based on the ATAPI IDENTIFY command 965 * Check whether we can support a drive, based on the ATAPI IDENTIFY command
966 * results. 966 * results.
967 */ 967 */
968static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id) 968static int idefloppy_identify_device(ide_drive_t *drive, u16 *id)
969{ 969{
970 u8 gcw[2]; 970 u8 gcw[2];
971 u8 device_type, protocol, removable, drq_type, packet_size; 971 u8 device_type, protocol, removable, drq_type, packet_size;
972 972
973 *((u16 *) &gcw) = id->config; 973 *((u16 *)&gcw) = id[ATA_ID_CONFIG];
974 974
975 device_type = gcw[1] & 0x1F; 975 device_type = gcw[1] & 0x1F;
976 removable = (gcw[0] & 0x80) >> 7; 976 removable = (gcw[0] & 0x80) >> 7;
@@ -981,7 +981,8 @@ static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id)
981#ifdef CONFIG_PPC 981#ifdef CONFIG_PPC
982 /* kludge for Apple PowerBook internal zip */ 982 /* kludge for Apple PowerBook internal zip */
983 if (device_type == 5 && 983 if (device_type == 5 &&
984 !strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP")) 984 !strstr((char *)&id[ATA_ID_PROD], "CD-ROM") &&
985 strstr((char *)&id[ATA_ID_PROD], "ZIP"))
985 device_type = 0; 986 device_type = 0;
986#endif 987#endif
987 988
@@ -1024,9 +1025,10 @@ static inline void idefloppy_add_settings(ide_drive_t *drive) { ; }
1024 1025
1025static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) 1026static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1026{ 1027{
1028 u16 *id = drive->id;
1027 u8 gcw[2]; 1029 u8 gcw[2];
1028 1030
1029 *((u16 *) &gcw) = drive->id->config; 1031 *((u16 *)&gcw) = id[ATA_ID_CONFIG];
1030 floppy->pc = floppy->pc_stack; 1032 floppy->pc = floppy->pc_stack;
1031 drive->pc_callback = ide_floppy_callback; 1033 drive->pc_callback = ide_floppy_callback;
1032 1034
@@ -1041,7 +1043,7 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1041 * it. It should be fixed as of version 1.9, but to be on the safe side 1043 * it. It should be fixed as of version 1.9, but to be on the safe side
1042 * we'll leave the limitation below for the 2.2.x tree. 1044 * we'll leave the limitation below for the 2.2.x tree.
1043 */ 1045 */
1044 if (!strncmp(drive->id->model, "IOMEGA ZIP 100 ATAPI", 20)) { 1046 if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) {
1045 drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; 1047 drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE;
1046 /* This value will be visible in the /proc/ide/hdx/settings */ 1048 /* This value will be visible in the /proc/ide/hdx/settings */
1047 floppy->ticks = IDEFLOPPY_TICKS_DELAY; 1049 floppy->ticks = IDEFLOPPY_TICKS_DELAY;
@@ -1052,7 +1054,7 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1052 * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes 1054 * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes
1053 * nasty clicking noises without it, so please don't remove this. 1055 * nasty clicking noises without it, so please don't remove this.
1054 */ 1056 */
1055 if (strncmp(drive->id->model, "IOMEGA Clik!", 11) == 0) { 1057 if (strncmp((char *)&id[ATA_ID_PROD], "IOMEGA Clik!", 11) == 0) {
1056 blk_queue_max_sectors(drive->queue, 64); 1058 blk_queue_max_sectors(drive->queue, 64);
1057 drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; 1059 drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE;
1058 } 1060 }
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 68d655e0fa47..01b1943b315e 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -400,11 +400,11 @@ const struct ide_tp_ops default_tp_ops = {
400 .output_data = ide_output_data, 400 .output_data = ide_output_data,
401}; 401};
402 402
403void ide_fix_driveid(struct hd_driveid *driveid) 403void ide_fix_driveid(u16 *id)
404{ 404{
405#ifndef __LITTLE_ENDIAN 405#ifndef __LITTLE_ENDIAN
406# ifdef __BIG_ENDIAN 406# ifdef __BIG_ENDIAN
407 u16 *id = (u16 *)driveid; 407 struct hd_driveid *driveid = (struct hd_driveid *)id;
408 int i; 408 int i;
409 409
410 for (i = 0; i < 256; i++) { 410 for (i = 0; i < 256; i++) {
@@ -593,18 +593,18 @@ EXPORT_SYMBOL(ide_wait_stat);
593/** 593/**
594 * ide_in_drive_list - look for drive in black/white list 594 * ide_in_drive_list - look for drive in black/white list
595 * @id: drive identifier 595 * @id: drive identifier
596 * @drive_table: list to inspect 596 * @table: list to inspect
597 * 597 *
598 * Look for a drive in the blacklist and the whitelist tables 598 * Look for a drive in the blacklist and the whitelist tables
599 * Returns 1 if the drive is found in the table. 599 * Returns 1 if the drive is found in the table.
600 */ 600 */
601 601
602int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) 602int ide_in_drive_list(u16 *id, const struct drive_list_entry *table)
603{ 603{
604 for ( ; drive_table->id_model; drive_table++) 604 for ( ; table->id_model; table++)
605 if ((!strcmp(drive_table->id_model, id->model)) && 605 if ((!strcmp(table->id_model, (char *)&id[ATA_ID_PROD])) &&
606 (!drive_table->id_firmware || 606 (!table->id_firmware ||
607 strstr(id->fw_rev, drive_table->id_firmware))) 607 strstr((char *)&id[ATA_ID_FW_REV], table->id_firmware)))
608 return 1; 608 return 1;
609 return 0; 609 return 0;
610} 610}
@@ -635,7 +635,7 @@ static const struct drive_list_entry ivb_list[] = {
635u8 eighty_ninty_three (ide_drive_t *drive) 635u8 eighty_ninty_three (ide_drive_t *drive)
636{ 636{
637 ide_hwif_t *hwif = drive->hwif; 637 ide_hwif_t *hwif = drive->hwif;
638 struct hd_driveid *id = drive->id; 638 u16 *id = drive->id;
639 int ivb = ide_in_drive_list(id, ivb_list); 639 int ivb = ide_in_drive_list(id, ivb_list);
640 640
641 if (hwif->cbl == ATA_CBL_PATA40_SHORT) 641 if (hwif->cbl == ATA_CBL_PATA40_SHORT)
@@ -657,7 +657,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)
657 * - force bit13 (80c cable present) check also for !ivb devices 657 * - force bit13 (80c cable present) check also for !ivb devices
658 * (unless the slave device is pre-ATA3) 658 * (unless the slave device is pre-ATA3)
659 */ 659 */
660 if ((id->hw_config & 0x4000) || (ivb && (id->hw_config & 0x2000))) 660 if ((id[ATA_ID_HW_CONFIG] & 0x4000) ||
661 (ivb && (id[ATA_ID_HW_CONFIG] & 0x2000)))
661 return 1; 662 return 1;
662 663
663no_80w: 664no_80w:
@@ -678,7 +679,7 @@ int ide_driveid_update(ide_drive_t *drive)
678{ 679{
679 ide_hwif_t *hwif = drive->hwif; 680 ide_hwif_t *hwif = drive->hwif;
680 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 681 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
681 struct hd_driveid *id; 682 u16 *id;
682 unsigned long timeout, flags; 683 unsigned long timeout, flags;
683 u8 stat; 684 u8 stat;
684 685
@@ -722,16 +723,16 @@ int ide_driveid_update(ide_drive_t *drive)
722 local_irq_enable(); 723 local_irq_enable();
723 local_irq_restore(flags); 724 local_irq_restore(flags);
724 ide_fix_driveid(id); 725 ide_fix_driveid(id);
725 if (id) { 726
726 drive->id->dma_ultra = id->dma_ultra; 727 drive->id[ATA_ID_UDMA_MODES] = id[ATA_ID_UDMA_MODES];
727 drive->id->dma_mword = id->dma_mword; 728 drive->id[ATA_ID_MWDMA_MODES] = id[ATA_ID_MWDMA_MODES];
728 drive->id->dma_1word = id->dma_1word; 729 drive->id[ATA_ID_SWDMA_MODES] = id[ATA_ID_SWDMA_MODES];
729 /* anything more ? */ 730 /* anything more ? */
730 kfree(id); 731
731 732 kfree(id);
732 if (drive->using_dma && ide_id_dma_bug(drive)) 733
733 ide_dma_off(drive); 734 if (drive->using_dma && ide_id_dma_bug(drive))
734 } 735 ide_dma_off(drive);
735 736
736 return 1; 737 return 1;
737} 738}
@@ -740,6 +741,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
740{ 741{
741 ide_hwif_t *hwif = drive->hwif; 742 ide_hwif_t *hwif = drive->hwif;
742 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 743 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
744 u16 *id = drive->id, i;
743 int error = 0; 745 int error = 0;
744 u8 stat; 746 u8 stat;
745 ide_task_t task; 747 ide_task_t task;
@@ -750,7 +752,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
750#endif 752#endif
751 753
752 /* Skip setting PIO flow-control modes on pre-EIDE drives */ 754 /* Skip setting PIO flow-control modes on pre-EIDE drives */
753 if ((speed & 0xf8) == XFER_PIO_0 && !(drive->id->capability & 0x08)) 755 if ((speed & 0xf8) == XFER_PIO_0 && !(drive->driveid->capability & 8))
754 goto skip; 756 goto skip;
755 757
756 /* 758 /*
@@ -802,9 +804,9 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
802 return error; 804 return error;
803 } 805 }
804 806
805 drive->id->dma_ultra &= ~0xFF00; 807 id[ATA_ID_UDMA_MODES] &= ~0xFF00;
806 drive->id->dma_mword &= ~0x0F00; 808 id[ATA_ID_MWDMA_MODES] &= ~0x0F00;
807 drive->id->dma_1word &= ~0x0F00; 809 id[ATA_ID_SWDMA_MODES] &= ~0x0F00;
808 810
809 skip: 811 skip:
810#ifdef CONFIG_BLK_DEV_IDEDMA 812#ifdef CONFIG_BLK_DEV_IDEDMA
@@ -814,23 +816,17 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
814 ide_dma_off_quietly(drive); 816 ide_dma_off_quietly(drive);
815#endif 817#endif
816 818
817 switch(speed) { 819 if (speed >= XFER_UDMA_0) {
818 case XFER_UDMA_7: drive->id->dma_ultra |= 0x8080; break; 820 i = 1 << (speed - XFER_UDMA_0);
819 case XFER_UDMA_6: drive->id->dma_ultra |= 0x4040; break; 821 id[ATA_ID_UDMA_MODES] |= (i << 8 | i);
820 case XFER_UDMA_5: drive->id->dma_ultra |= 0x2020; break; 822 } else if (speed >= XFER_MW_DMA_0) {
821 case XFER_UDMA_4: drive->id->dma_ultra |= 0x1010; break; 823 i = 1 << (speed - XFER_MW_DMA_0);
822 case XFER_UDMA_3: drive->id->dma_ultra |= 0x0808; break; 824 id[ATA_ID_MWDMA_MODES] |= (i << 8 | i);
823 case XFER_UDMA_2: drive->id->dma_ultra |= 0x0404; break; 825 } else if (speed >= XFER_SW_DMA_0) {
824 case XFER_UDMA_1: drive->id->dma_ultra |= 0x0202; break; 826 i = 1 << (speed - XFER_SW_DMA_0);
825 case XFER_UDMA_0: drive->id->dma_ultra |= 0x0101; break; 827 id[ATA_ID_SWDMA_MODES] |= (i << 8 | i);
826 case XFER_MW_DMA_2: drive->id->dma_mword |= 0x0404; break;
827 case XFER_MW_DMA_1: drive->id->dma_mword |= 0x0202; break;
828 case XFER_MW_DMA_0: drive->id->dma_mword |= 0x0101; break;
829 case XFER_SW_DMA_2: drive->id->dma_1word |= 0x0404; break;
830 case XFER_SW_DMA_1: drive->id->dma_1word |= 0x0202; break;
831 case XFER_SW_DMA_0: drive->id->dma_1word |= 0x0101; break;
832 default: break;
833 } 828 }
829
834 if (!drive->init_speed) 830 if (!drive->init_speed)
835 drive->init_speed = speed; 831 drive->init_speed = speed;
836 drive->current_speed = speed; 832 drive->current_speed = speed;
@@ -1035,7 +1031,7 @@ out:
1035 1031
1036static void ide_disk_pre_reset(ide_drive_t *drive) 1032static void ide_disk_pre_reset(ide_drive_t *drive)
1037{ 1033{
1038 int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1; 1034 int legacy = (drive->id[ATA_ID_CFS_ENABLE_2] & 0x0400) ? 0 : 1;
1039 1035
1040 drive->special.all = 0; 1036 drive->special.all = 0;
1041 drive->special.b.set_geometry = legacy; 1037 drive->special.b.set_geometry = legacy;
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 97fefabea8b8..3066d7e75c73 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -90,29 +90,31 @@ static u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
90 90
91u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) 91u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
92{ 92{
93 int pio_mode; 93 u16 *id = drive->id;
94 struct hd_driveid* id = drive->id; 94 int pio_mode = -1, overridden = 0;
95 int overridden = 0;
96 95
97 if (mode_wanted != 255) 96 if (mode_wanted != 255)
98 return min_t(u8, mode_wanted, max_mode); 97 return min_t(u8, mode_wanted, max_mode);
99 98
100 if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && 99 if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0)
101 (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 100 pio_mode = ide_scan_pio_blacklist((char *)&id[ATA_ID_PROD]);
101
102 if (pio_mode != -1) {
102 printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); 103 printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name);
103 } else { 104 } else {
104 pio_mode = id->tPIO; 105 pio_mode = drive->driveid->tPIO;
105 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ 106 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */
106 pio_mode = 2; 107 pio_mode = 2;
107 overridden = 1; 108 overridden = 1;
108 } 109 }
109 if (id->field_valid & 2) { /* drive implements ATA2? */ 110
110 if (id->capability & 8) { /* IORDY supported? */ 111 if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */
111 if (id->eide_pio_modes & 7) { 112 if (drive->driveid->capability & 8) { /* IORDY sup? */
113 if (id[ATA_ID_PIO_MODES] & 7) {
112 overridden = 0; 114 overridden = 0;
113 if (id->eide_pio_modes & 4) 115 if (id[ATA_ID_PIO_MODES] & 4)
114 pio_mode = 5; 116 pio_mode = 5;
115 else if (id->eide_pio_modes & 2) 117 else if (id[ATA_ID_PIO_MODES] & 2)
116 pio_mode = 4; 118 pio_mode = 4;
117 else 119 else
118 pio_mode = 3; 120 pio_mode = 3;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index a776a6d73c54..b4f8ca106639 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -50,44 +50,44 @@
50 50
51static void generic_id(ide_drive_t *drive) 51static void generic_id(ide_drive_t *drive)
52{ 52{
53 drive->id->cyls = drive->cyl; 53 u16 *id = drive->id;
54 drive->id->heads = drive->head; 54
55 drive->id->sectors = drive->sect; 55 id[ATA_ID_CUR_CYLS] = id[ATA_ID_CYLS] = drive->cyl;
56 drive->id->cur_cyls = drive->cyl; 56 id[ATA_ID_CUR_HEADS] = id[ATA_ID_HEADS] = drive->head;
57 drive->id->cur_heads = drive->head; 57 id[ATA_ID_CUR_SECTORS] = id[ATA_ID_SECTORS] = drive->sect;
58 drive->id->cur_sectors = drive->sect;
59} 58}
60 59
61static void ide_disk_init_chs(ide_drive_t *drive) 60static void ide_disk_init_chs(ide_drive_t *drive)
62{ 61{
63 struct hd_driveid *id = drive->id; 62 u16 *id = drive->id;
64 63
65 /* Extract geometry if we did not already have one for the drive */ 64 /* Extract geometry if we did not already have one for the drive */
66 if (!drive->cyl || !drive->head || !drive->sect) { 65 if (!drive->cyl || !drive->head || !drive->sect) {
67 drive->cyl = drive->bios_cyl = id->cyls; 66 drive->cyl = drive->bios_cyl = id[ATA_ID_CYLS];
68 drive->head = drive->bios_head = id->heads; 67 drive->head = drive->bios_head = id[ATA_ID_HEADS];
69 drive->sect = drive->bios_sect = id->sectors; 68 drive->sect = drive->bios_sect = id[ATA_ID_SECTORS];
70 } 69 }
71 70
72 /* Handle logical geometry translation by the drive */ 71 /* Handle logical geometry translation by the drive */
73 if ((id->field_valid & 1) && id->cur_cyls && 72 if ((id[ATA_ID_FIELD_VALID] & 1) && id[ATA_ID_CUR_CYLS] &&
74 id->cur_heads && (id->cur_heads <= 16) && id->cur_sectors) { 73 id[ATA_ID_CUR_HEADS] && id[ATA_ID_CUR_HEADS] <= 16 &&
75 drive->cyl = id->cur_cyls; 74 id[ATA_ID_CUR_SECTORS]) {
76 drive->head = id->cur_heads; 75 drive->cyl = id[ATA_ID_CUR_CYLS];
77 drive->sect = id->cur_sectors; 76 drive->head = id[ATA_ID_CUR_HEADS];
77 drive->sect = id[ATA_ID_CUR_SECTORS];
78 } 78 }
79 79
80 /* Use physical geometry if what we have still makes no sense */ 80 /* Use physical geometry if what we have still makes no sense */
81 if (drive->head > 16 && id->heads && id->heads <= 16) { 81 if (drive->head > 16 && id[ATA_ID_HEADS] && id[ATA_ID_HEADS] <= 16) {
82 drive->cyl = id->cyls; 82 drive->cyl = id[ATA_ID_CYLS];
83 drive->head = id->heads; 83 drive->head = id[ATA_ID_HEADS];
84 drive->sect = id->sectors; 84 drive->sect = id[ATA_ID_SECTORS];
85 } 85 }
86} 86}
87 87
88static void ide_disk_init_mult_count(ide_drive_t *drive) 88static void ide_disk_init_mult_count(ide_drive_t *drive)
89{ 89{
90 struct hd_driveid *id = drive->id; 90 struct hd_driveid *id = drive->driveid;
91 91
92 if (id->max_multsect) { 92 if (id->max_multsect) {
93#ifdef CONFIG_IDEDISK_MULTI_MODE 93#ifdef CONFIG_IDEDISK_MULTI_MODE
@@ -118,10 +118,10 @@ static void ide_disk_init_mult_count(ide_drive_t *drive)
118static inline void do_identify (ide_drive_t *drive, u8 cmd) 118static inline void do_identify (ide_drive_t *drive, u8 cmd)
119{ 119{
120 ide_hwif_t *hwif = HWIF(drive); 120 ide_hwif_t *hwif = HWIF(drive);
121 u16 *id = drive->id;
122 char *m = (char *)&id[ATA_ID_PROD];
121 int bswap = 1; 123 int bswap = 1;
122 struct hd_driveid *id;
123 124
124 id = drive->id;
125 /* read 512 bytes of id info */ 125 /* read 512 bytes of id info */
126 hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE); 126 hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE);
127 127
@@ -138,23 +138,24 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
138 * WIN_PIDENTIFY *usually* returns little-endian info. 138 * WIN_PIDENTIFY *usually* returns little-endian info.
139 */ 139 */
140 if (cmd == WIN_PIDENTIFY) { 140 if (cmd == WIN_PIDENTIFY) {
141 if ((id->model[0] == 'N' && id->model[1] == 'E') /* NEC */ 141 if ((m[0] == 'N' && m[1] == 'E') || /* NEC */
142 || (id->model[0] == 'F' && id->model[1] == 'X') /* Mitsumi */ 142 (m[0] == 'F' && m[1] == 'X') || /* Mitsumi */
143 || (id->model[0] == 'P' && id->model[1] == 'i'))/* Pioneer */ 143 (m[0] == 'P' && m[1] == 'i')) /* Pioneer */
144 /* Vertos drives may still be weird */ 144 /* Vertos drives may still be weird */
145 bswap ^= 1; 145 bswap ^= 1;
146 } 146 }
147 ide_fixstring(id->model, sizeof(id->model), bswap); 147
148 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); 148 ide_fixstring(m, ATA_ID_PROD_LEN, bswap);
149 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); 149 ide_fixstring((char *)&id[ATA_ID_FW_REV], ATA_ID_FW_REV_LEN, bswap);
150 ide_fixstring((char *)&id[ATA_ID_SERNO], ATA_ID_SERNO_LEN, bswap);
150 151
151 /* we depend on this a lot! */ 152 /* we depend on this a lot! */
152 id->model[sizeof(id->model)-1] = '\0'; 153 m[ATA_ID_PROD_LEN - 1] = '\0';
153 154
154 if (strstr(id->model, "E X A B Y T E N E S T")) 155 if (strstr(m, "E X A B Y T E N E S T"))
155 goto err_misc; 156 goto err_misc;
156 157
157 printk(KERN_INFO "%s: %s, ", drive->name, id->model); 158 printk(KERN_INFO "%s: %s, ", drive->name, m);
158 159
159 drive->present = 1; 160 drive->present = 1;
160 drive->dead = 0; 161 drive->dead = 0;
@@ -163,15 +164,15 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
163 * Check for an ATAPI device 164 * Check for an ATAPI device
164 */ 165 */
165 if (cmd == WIN_PIDENTIFY) { 166 if (cmd == WIN_PIDENTIFY) {
166 u8 type = (id->config >> 8) & 0x1f; 167 u8 type = (id[ATA_ID_CONFIG] >> 8) & 0x1f;
167 168
168 printk(KERN_CONT "ATAPI "); 169 printk(KERN_CONT "ATAPI ");
169 switch (type) { 170 switch (type) {
170 case ide_floppy: 171 case ide_floppy:
171 if (!strstr(id->model, "CD-ROM")) { 172 if (!strstr(m, "CD-ROM")) {
172 if (!strstr(id->model, "oppy") && 173 if (!strstr(m, "oppy") &&
173 !strstr(id->model, "poyp") && 174 !strstr(m, "poyp") &&
174 !strstr(id->model, "ZIP")) 175 !strstr(m, "ZIP"))
175 printk(KERN_CONT "cdrom or floppy?, assuming "); 176 printk(KERN_CONT "cdrom or floppy?, assuming ");
176 if (drive->media != ide_cdrom) { 177 if (drive->media != ide_cdrom) {
177 printk(KERN_CONT "FLOPPY"); 178 printk(KERN_CONT "FLOPPY");
@@ -185,8 +186,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
185 drive->removable = 1; 186 drive->removable = 1;
186#ifdef CONFIG_PPC 187#ifdef CONFIG_PPC
187 /* kludge for Apple PowerBook internal zip */ 188 /* kludge for Apple PowerBook internal zip */
188 if (!strstr(id->model, "CD-ROM") && 189 if (!strstr(m, "CD-ROM") && strstr(m, "ZIP")) {
189 strstr(id->model, "ZIP")) {
190 printk(KERN_CONT "FLOPPY"); 190 printk(KERN_CONT "FLOPPY");
191 type = ide_floppy; 191 type = ide_floppy;
192 break; 192 break;
@@ -220,14 +220,13 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
220 * 0x848a = CompactFlash device 220 * 0x848a = CompactFlash device
221 * These are *not* removable in Linux definition of the term 221 * These are *not* removable in Linux definition of the term
222 */ 222 */
223 223 if (id[ATA_ID_CONFIG] != 0x848a && (id[ATA_ID_CONFIG] & (1 << 7)))
224 if ((id->config != 0x848a) && (id->config & (1<<7)))
225 drive->removable = 1; 224 drive->removable = 1;
226 225
227 drive->media = ide_disk; 226 drive->media = ide_disk;
228 227
229 printk(KERN_CONT "%s DISK drive\n", 228 printk(KERN_CONT "%s DISK drive\n",
230 (id->config == 0x848a) ? "CFA" : "ATA"); 229 (id[ATA_ID_CONFIG] == 0x848a) ? "CFA" : "ATA");
231 230
232 return; 231 return;
233 232
@@ -525,7 +524,8 @@ static void enable_nest (ide_drive_t *drive)
525 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 524 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
526 u8 stat; 525 u8 stat;
527 526
528 printk(KERN_INFO "%s: enabling %s -- ", hwif->name, drive->id->model); 527 printk(KERN_INFO "%s: enabling %s -- ",
528 hwif->name, (char *)&drive->id[ATA_ID_PROD]);
529 529
530 SELECT_DRIVE(drive); 530 SELECT_DRIVE(drive);
531 msleep(50); 531 msleep(50);
@@ -566,6 +566,8 @@ static void enable_nest (ide_drive_t *drive)
566 566
567static inline u8 probe_for_drive (ide_drive_t *drive) 567static inline u8 probe_for_drive (ide_drive_t *drive)
568{ 568{
569 char *m;
570
569 /* 571 /*
570 * In order to keep things simple we have an id 572 * In order to keep things simple we have an id
571 * block for all drives at all times. If the device 573 * block for all drives at all times. If the device
@@ -582,8 +584,10 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
582 printk(KERN_ERR "ide: out of memory for id data.\n"); 584 printk(KERN_ERR "ide: out of memory for id data.\n");
583 return 0; 585 return 0;
584 } 586 }
585 strcpy(drive->id->model, "UNKNOWN"); 587
586 588 m = (char *)&drive->id[ATA_ID_PROD];
589 strcpy(m, "UNKNOWN");
590
587 /* skip probing? */ 591 /* skip probing? */
588 if (!drive->noprobe) 592 if (!drive->noprobe)
589 { 593 {
@@ -595,7 +599,8 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
595 if (!drive->present) 599 if (!drive->present)
596 /* drive not found */ 600 /* drive not found */
597 return 0; 601 return 0;
598 if (strstr(drive->id->model, "E X A B Y T E N E S T")) 602
603 if (strstr(m, "E X A B Y T E N E S T"))
599 enable_nest(drive); 604 enable_nest(drive);
600 605
601 /* identification failed? */ 606 /* identification failed? */
@@ -739,36 +744,38 @@ out:
739 744
740/** 745/**
741 * ide_undecoded_slave - look for bad CF adapters 746 * ide_undecoded_slave - look for bad CF adapters
742 * @drive1: drive 747 * @dev1: slave device
743 * 748 *
744 * Analyse the drives on the interface and attempt to decide if we 749 * Analyse the drives on the interface and attempt to decide if we
745 * have the same drive viewed twice. This occurs with crap CF adapters 750 * have the same drive viewed twice. This occurs with crap CF adapters
746 * and PCMCIA sometimes. 751 * and PCMCIA sometimes.
747 */ 752 */
748 753
749void ide_undecoded_slave(ide_drive_t *drive1) 754void ide_undecoded_slave(ide_drive_t *dev1)
750{ 755{
751 ide_drive_t *drive0 = &drive1->hwif->drives[0]; 756 ide_drive_t *dev0 = &dev1->hwif->drives[0];
752 757
753 if ((drive1->dn & 1) == 0 || drive0->present == 0) 758 if ((dev1->dn & 1) == 0 || dev0->present == 0)
754 return; 759 return;
755 760
756 /* If the models don't match they are not the same product */ 761 /* If the models don't match they are not the same product */
757 if (strcmp(drive0->id->model, drive1->id->model)) 762 if (strcmp((char *)&dev0->id[ATA_ID_PROD],
763 (char *)&dev1->id[ATA_ID_PROD]))
758 return; 764 return;
759 765
760 /* Serial numbers do not match */ 766 /* Serial numbers do not match */
761 if (strncmp(drive0->id->serial_no, drive1->id->serial_no, 20)) 767 if (strncmp((char *)&dev0->id[ATA_ID_SERNO],
768 (char *)&dev1->id[ATA_ID_SERNO], ATA_ID_SERNO_LEN))
762 return; 769 return;
763 770
764 /* No serial number, thankfully very rare for CF */ 771 /* No serial number, thankfully very rare for CF */
765 if (drive0->id->serial_no[0] == 0) 772 if (*(char *)&dev0->id[ATA_ID_SERNO] == 0)
766 return; 773 return;
767 774
768 /* Appears to be an IDE flash adapter with decode bugs */ 775 /* Appears to be an IDE flash adapter with decode bugs */
769 printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n"); 776 printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n");
770 777
771 drive1->present = 0; 778 dev1->present = 0;
772} 779}
773 780
774EXPORT_SYMBOL_GPL(ide_undecoded_slave); 781EXPORT_SYMBOL_GPL(ide_undecoded_slave);
@@ -852,7 +859,7 @@ static void ide_port_tune_devices(ide_hwif_t *hwif)
852 if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) 859 if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT)
853 drive->no_io_32bit = 1; 860 drive->no_io_32bit = 1;
854 else 861 else
855 drive->no_io_32bit = drive->id->dword_io ? 1 : 0; 862 drive->no_io_32bit = drive->id[ATA_ID_DWORD_IO] ? 1 : 0;
856 } 863 }
857} 864}
858 865
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index f66c9c3f6fc6..0bdbb9bf90ba 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -561,11 +561,10 @@ static int proc_ide_read_dmodel
561 (char *page, char **start, off_t off, int count, int *eof, void *data) 561 (char *page, char **start, off_t off, int count, int *eof, void *data)
562{ 562{
563 ide_drive_t *drive = (ide_drive_t *) data; 563 ide_drive_t *drive = (ide_drive_t *) data;
564 struct hd_driveid *id = drive->id; 564 char *m = (char *)&drive->id[ATA_ID_PROD];
565 int len; 565 int len;
566 566
567 len = sprintf(page, "%.40s\n", 567 len = sprintf(page, "%.40s\n", m[0] ? m : "(none)");
568 (id && id->model[0]) ? (char *)id->model : "(none)");
569 PROC_IDE_READ_RETURN(page, start, off, count, eof, len); 568 PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
570} 569}
571 570
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index a373cc4142b7..2c4c6674db61 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2311,7 +2311,7 @@ static int idetape_identify_device(ide_drive_t *drive)
2311 if (drive->id_read == 0) 2311 if (drive->id_read == 0)
2312 return 1; 2312 return 1;
2313 2313
2314 *((unsigned short *) &gcw) = drive->id->config; 2314 *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG];
2315 2315
2316 protocol = (gcw[1] & 0xC0) >> 6; 2316 protocol = (gcw[1] & 0xC0) >> 6;
2317 device_type = gcw[1] & 0x1F; 2317 device_type = gcw[1] & 0x1F;
@@ -2463,7 +2463,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2463 drive->dsc_overlap = 0; 2463 drive->dsc_overlap = 0;
2464 } 2464 }
2465 /* Seagate Travan drives do not support DSC overlap. */ 2465 /* Seagate Travan drives do not support DSC overlap. */
2466 if (strstr(drive->id->model, "Seagate STT3401")) 2466 if (strstr((char *)&drive->id[ATA_ID_PROD], "Seagate STT3401"))
2467 drive->dsc_overlap = 0; 2467 drive->dsc_overlap = 0;
2468 tape->minor = minor; 2468 tape->minor = minor;
2469 tape->name[0] = 'h'; 2469 tape->name[0] = 'h';
@@ -2471,7 +2471,8 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2471 tape->name[2] = '0' + minor; 2471 tape->name[2] = '0' + minor;
2472 tape->chrdev_dir = IDETAPE_DIR_NONE; 2472 tape->chrdev_dir = IDETAPE_DIR_NONE;
2473 tape->pc = tape->pc_stack; 2473 tape->pc = tape->pc_stack;
2474 *((unsigned short *) &gcw) = drive->id->config; 2474
2475 *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG];
2475 2476
2476 /* Command packet DRQ type */ 2477 /* Command packet DRQ type */
2477 if (((gcw[0] & 0x60) >> 5) == 1) 2478 if (((gcw[0] & 0x60) >> 5) == 1)
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 7fb6f1c86272..f889373d7f95 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -729,7 +729,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
729 u8 args[4], xfer_rate = 0; 729 u8 args[4], xfer_rate = 0;
730 ide_task_t tfargs; 730 ide_task_t tfargs;
731 struct ide_taskfile *tf = &tfargs.tf; 731 struct ide_taskfile *tf = &tfargs.tf;
732 struct hd_driveid *id = drive->id; 732 u16 *id = drive->id;
733 733
734 if (NULL == (void *) arg) { 734 if (NULL == (void *) arg) {
735 struct request *rq; 735 struct request *rq;
@@ -772,7 +772,9 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
772 if (tf->command == WIN_SETFEATURES && 772 if (tf->command == WIN_SETFEATURES &&
773 tf->feature == SETFEATURES_XFER && 773 tf->feature == SETFEATURES_XFER &&
774 tf->nsect >= XFER_SW_DMA_0 && 774 tf->nsect >= XFER_SW_DMA_0 &&
775 (id->dma_ultra || id->dma_mword || id->dma_1word)) { 775 (id[ATA_ID_UDMA_MODES] ||
776 id[ATA_ID_MWDMA_MODES] ||
777 id[ATA_ID_SWDMA_MODES])) {
776 xfer_rate = args[1]; 778 xfer_rate = args[1];
777 if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) { 779 if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) {
778 printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " 780 printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c
index 8c2f8327f487..d64f345f2fc0 100644
--- a/drivers/ide/ide-timings.c
+++ b/drivers/ide/ide-timings.c
@@ -78,15 +78,15 @@ EXPORT_SYMBOL_GPL(ide_timing_find_mode);
78 78
79u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio) 79u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
80{ 80{
81 struct hd_driveid *id = drive->id; 81 u16 *id = drive->id;
82 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); 82 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
83 u16 cycle = 0; 83 u16 cycle = 0;
84 84
85 if (id->field_valid & 2) { 85 if (id[ATA_ID_FIELD_VALID] & 2) {
86 if (id->capability & 8) 86 if (drive->driveid->capability & 8)
87 cycle = id->eide_pio_iordy; 87 cycle = id[ATA_ID_EIDE_PIO_IORDY];
88 else 88 else
89 cycle = id->eide_pio; 89 cycle = id[ATA_ID_EIDE_PIO];
90 90
91 /* conservative "downgrade" for all pre-ATA2 drives */ 91 /* conservative "downgrade" for all pre-ATA2 drives */
92 if (pio < 3 && cycle < t->cycle) 92 if (pio < 3 && cycle < t->cycle)
@@ -138,7 +138,7 @@ EXPORT_SYMBOL_GPL(ide_timing_merge);
138int ide_timing_compute(ide_drive_t *drive, u8 speed, 138int ide_timing_compute(ide_drive_t *drive, u8 speed,
139 struct ide_timing *t, int T, int UT) 139 struct ide_timing *t, int T, int UT)
140{ 140{
141 struct hd_driveid *id = drive->id; 141 u16 *id = drive->id;
142 struct ide_timing *s, p; 142 struct ide_timing *s, p;
143 143
144 /* 144 /*
@@ -157,16 +157,15 @@ int ide_timing_compute(ide_drive_t *drive, u8 speed,
157 * If the drive is an EIDE drive, it can tell us it needs extended 157 * If the drive is an EIDE drive, it can tell us it needs extended
158 * PIO/MWDMA cycle timing. 158 * PIO/MWDMA cycle timing.
159 */ 159 */
160 if (id && id->field_valid & 2) { /* EIDE drive */ 160 if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */
161
162 memset(&p, 0, sizeof(p)); 161 memset(&p, 0, sizeof(p));
163 162
164 if (speed <= XFER_PIO_2) 163 if (speed <= XFER_PIO_2)
165 p.cycle = p.cyc8b = id->eide_pio; 164 p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO];
166 else if (speed <= XFER_PIO_5) 165 else if (speed <= XFER_PIO_5)
167 p.cycle = p.cyc8b = id->eide_pio_iordy; 166 p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY];
168 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) 167 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
169 p.cycle = id->eide_dma_min; 168 p.cycle = id[ATA_ID_EIDE_DMA_MIN];
170 169
171 ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B); 170 ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B);
172 } 171 }
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 772451600e4d..8d3fab33a3c7 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->id || !(drive->id->capability & 1)) 331 if ((drive->driveid->capability & 1) == 0)
332 goto out; 332 goto out;
333 333
334 if (hwif->dma_ops == NULL) 334 if (hwif->dma_ops == NULL)
@@ -710,21 +710,21 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr,
710 char *buf) 710 char *buf)
711{ 711{
712 ide_drive_t *drive = to_ide_device(dev); 712 ide_drive_t *drive = to_ide_device(dev);
713 return sprintf(buf, "%s\n", drive->id->model); 713 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]);
714} 714}
715 715
716static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, 716static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
717 char *buf) 717 char *buf)
718{ 718{
719 ide_drive_t *drive = to_ide_device(dev); 719 ide_drive_t *drive = to_ide_device(dev);
720 return sprintf(buf, "%s\n", drive->id->fw_rev); 720 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]);
721} 721}
722 722
723static ssize_t serial_show(struct device *dev, struct device_attribute *attr, 723static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
724 char *buf) 724 char *buf)
725{ 725{
726 ide_drive_t *drive = to_ide_device(dev); 726 ide_drive_t *drive = to_ide_device(dev);
727 return sprintf(buf, "%s\n", drive->id->serial_no); 727 return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]);
728} 728}
729 729
730static struct device_attribute ide_dev_attrs[] = { 730static struct device_attribute ide_dev_attrs[] = {
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 2338f344ea24..ef4e84053a81 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -151,12 +151,14 @@ static int qd_find_disk_type (ide_drive_t *drive,
151 int *active_time, int *recovery_time) 151 int *active_time, int *recovery_time)
152{ 152{
153 struct qd65xx_timing_s *p; 153 struct qd65xx_timing_s *p;
154 char model[40]; 154 char *m = (char *)&drive->id[ATA_ID_PROD];
155 char model[ATA_ID_PROD_LEN];
155 156
156 if (!*drive->id->model) return 0; 157 if (*m == 0)
158 return 0;
157 159
158 strncpy(model,drive->id->model,40); 160 strncpy(model, m, ATA_ID_PROD_LEN);
159 ide_fixstring(model,40,1); /* byte-swap */ 161 ide_fixstring(model, ATA_ID_PROD_LEN, 1); /* byte-swap */
160 162
161 for (p = qd65xx_timing ; p->offset != -1 ; p++) { 163 for (p = qd65xx_timing ; p->offset != -1 ; p++) {
162 if (!strncmp(p->model, model+p->offset, 4)) { 164 if (!strncmp(p->model, model+p->offset, 4)) {
@@ -185,20 +187,20 @@ static void qd_set_timing (ide_drive_t *drive, u8 timing)
185 187
186static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) 188static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio)
187{ 189{
190 u16 *id = drive->id;
188 int active_time = 175; 191 int active_time = 175;
189 int recovery_time = 415; /* worst case values from the dos driver */ 192 int recovery_time = 415; /* worst case values from the dos driver */
190 193
191 /* 194 /*
192 * FIXME: use "pio" value 195 * FIXME: use "pio" value
193 */ 196 */
194 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time) 197 if (!qd_find_disk_type(drive, &active_time, &recovery_time) &&
195 && drive->id->tPIO && (drive->id->field_valid & 0x02) 198 drive->driveid->tPIO && (id[ATA_ID_FIELD_VALID] & 2) &&
196 && drive->id->eide_pio >= 240) { 199 id[ATA_ID_EIDE_PIO] >= 240) {
197
198 printk(KERN_INFO "%s: PIO mode%d\n", drive->name, 200 printk(KERN_INFO "%s: PIO mode%d\n", drive->name,
199 drive->id->tPIO); 201 drive->driveid->tPIO);
200 active_time = 110; 202 active_time = 110;
201 recovery_time = drive->id->eide_pio - 120; 203 recovery_time = drive->id[ATA_ID_EIDE_PIO] - 120;
202 } 204 }
203 205
204 qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); 206 qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time));
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index d647526af557..fcc701b3c0a2 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -134,8 +134,8 @@ static u8 ali_udma_filter(ide_drive_t *drive)
134 if (m5229_revision > 0x20 && m5229_revision < 0xC2) { 134 if (m5229_revision > 0x20 && m5229_revision < 0xC2) {
135 if (drive->media != ide_disk) 135 if (drive->media != ide_disk)
136 return 0; 136 return 0;
137 if (chip_is_1543c_e && strstr(drive->id->model, "WDC ") && 137 if (wdc_udma == 0 && chip_is_1543c_e &&
138 wdc_udma == 0) 138 strstr((char *)&drive->id[ATA_ID_PROD], "WDC "))
139 return 0; 139 return 0;
140 } 140 }
141 141
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index f235db8c678b..774ff58603a2 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -82,16 +82,18 @@ static u8 cs5530_udma_filter(ide_drive_t *drive)
82{ 82{
83 ide_hwif_t *hwif = drive->hwif; 83 ide_hwif_t *hwif = drive->hwif;
84 ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1]; 84 ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1];
85 struct hd_driveid *mateid = mate->id; 85 u16 *mateid = mate->id;
86 u8 mask = hwif->ultra_mask; 86 u8 mask = hwif->ultra_mask;
87 87
88 if (mate->present == 0) 88 if (mate->present == 0)
89 goto out; 89 goto out;
90 90
91 if ((mateid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { 91 if ((mate->driveid->capability & 1) && __ide_dma_bad_drive(mate) == 0) {
92 if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7)) 92 if ((mateid[ATA_ID_FIELD_VALID] & 4) &&
93 (mateid[ATA_ID_UDMA_MODES] & 7))
93 goto out; 94 goto out;
94 if ((mateid->field_valid & 2) && (mateid->dma_mword & 7)) 95 if ((mateid[ATA_ID_FIELD_VALID] & 2) &&
96 (mateid[ATA_ID_MWDMA_MODES] & 7))
95 mask = 0; 97 mask = 0;
96 } 98 }
97out: 99out:
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index c37ab1743819..b7f77fd3cb6e 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -605,10 +605,10 @@ static const struct hpt_info hpt371n __devinitdata = {
605 605
606static int check_in_drive_list(ide_drive_t *drive, const char **list) 606static int check_in_drive_list(ide_drive_t *drive, const char **list)
607{ 607{
608 struct hd_driveid *id = drive->id; 608 char *m = (char *)&drive->id[ATA_ID_PROD];
609 609
610 while (*list) 610 while (*list)
611 if (!strcmp(*list++,id->model)) 611 if (!strcmp(*list++, m))
612 return 1; 612 return 1;
613 return 0; 613 return 0;
614} 614}
@@ -731,11 +731,11 @@ static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
731 731
732static void hpt3xx_quirkproc(ide_drive_t *drive) 732static void hpt3xx_quirkproc(ide_drive_t *drive)
733{ 733{
734 struct hd_driveid *id = drive->id; 734 char *m = (char *)&drive->id[ATA_ID_PROD];
735 const char **list = quirk_drives; 735 const char **list = quirk_drives;
736 736
737 while (*list) 737 while (*list)
738 if (strstr(id->model, *list++)) { 738 if (strstr(m, *list++)) {
739 drive->quirk_list = 1; 739 drive->quirk_list = 1;
740 return; 740 return;
741 } 741 }
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 4a1508a707cc..31d4e6aef1b8 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -446,8 +446,7 @@ static u8 it821x_cable_detect(ide_hwif_t *hwif)
446static void it821x_quirkproc(ide_drive_t *drive) 446static void it821x_quirkproc(ide_drive_t *drive)
447{ 447{
448 struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif); 448 struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif);
449 struct hd_driveid *id = drive->id; 449 u16 *id = drive->id;
450 u16 *idbits = (u16 *)drive->id;
451 450
452 if (!itdev->smart) { 451 if (!itdev->smart) {
453 /* 452 /*
@@ -466,36 +465,36 @@ static void it821x_quirkproc(ide_drive_t *drive)
466 */ 465 */
467 466
468 /* Check for RAID v native */ 467 /* Check for RAID v native */
469 if(strstr(id->model, "Integrated Technology Express")) { 468 if (strstr((char *)&id[ATA_ID_PROD],
469 "Integrated Technology Express")) {
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 id->capability |= 3; /* LBA28, DMA */ 473 drive->driveid->capability |= 3; /* LBA28, DMA */
474 id->command_set_2 |= 0x0400; /* LBA48 valid */ 474 id[ATA_ID_COMMAND_SET_2] |= 0x0400; /* LBA48 valid */
475 id->cfs_enable_2 |= 0x0400; /* LBA48 on */ 475 id[ATA_ID_CFS_ENABLE_2] |= 0x0400; /* LBA48 on */
476 /* Reporting logic */ 476 /* Reporting logic */
477 printk(KERN_INFO "%s: IT8212 %sRAID %d volume", 477 printk(KERN_INFO "%s: IT8212 %sRAID %d volume",
478 drive->name, 478 drive->name, id[147] ? "Bootable " : "",
479 idbits[147] ? "Bootable ":"", 479 id[ATA_ID_CSFO]);
480 idbits[129]); 480 if (id[ATA_ID_CSFO] != 1)
481 if(idbits[129] != 1) 481 printk(KERN_CONT "(%dK stripe)", id[146]);
482 printk("(%dK stripe)", idbits[146]); 482 printk(KERN_CONT ".\n");
483 printk(".\n");
484 } else { 483 } else {
485 /* Non RAID volume. Fixups to stop the core code 484 /* Non RAID volume. Fixups to stop the core code
486 doing unsupported things */ 485 doing unsupported things */
487 id->field_valid &= 3; 486 id[ATA_ID_FIELD_VALID] &= 3;
488 id->queue_depth = 0; 487 id[ATA_ID_QUEUE_DEPTH] = 0;
489 id->command_set_1 = 0; 488 id[ATA_ID_COMMAND_SET_1] = 0;
490 id->command_set_2 &= 0xC400; 489 id[ATA_ID_COMMAND_SET_2] &= 0xC400;
491 id->cfsse &= 0xC000; 490 id[ATA_ID_CFSSE] &= 0xC000;
492 id->cfs_enable_1 = 0; 491 id[ATA_ID_CFS_ENABLE_1] = 0;
493 id->cfs_enable_2 &= 0xC400; 492 id[ATA_ID_CFS_ENABLE_2] &= 0xC400;
494 id->csf_default &= 0xC000; 493 id[ATA_ID_CSF_DEFAULT] &= 0xC000;
495 id->word127 = 0; 494 id[127] = 0;
496 id->dlf = 0; 495 id[ATA_ID_DLF] = 0;
497 id->csfo = 0; 496 id[ATA_ID_CSFO] = 0;
498 id->cfa_power = 0; 497 id[ATA_ID_CFA_POWER] = 0;
499 printk(KERN_INFO "%s: Performing identify fixups.\n", 498 printk(KERN_INFO "%s: Performing identify fixups.\n",
500 drive->name); 499 drive->name);
501 } 500 }
@@ -505,8 +504,8 @@ static void it821x_quirkproc(ide_drive_t *drive)
505 * IDE core that DMA is supported (it821x hardware 504 * IDE core that DMA is supported (it821x hardware
506 * takes care of DMA mode programming). 505 * takes care of DMA mode programming).
507 */ 506 */
508 if (id->capability & 1) { 507 if (drive->driveid->capability & 1) {
509 id->dma_mword |= 0x0101; 508 id[ATA_ID_MWDMA_MODES] |= 0x0101;
510 drive->current_speed = XFER_MW_DMA_0; 509 drive->current_speed = XFER_MW_DMA_0;
511 } 510 }
512 } 511 }
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index d477da6b5858..7ecfcd06f47e 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -203,10 +203,10 @@ static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
203 203
204static void pdcnew_quirkproc(ide_drive_t *drive) 204static void pdcnew_quirkproc(ide_drive_t *drive)
205{ 205{
206 const char **list, *model = drive->id->model; 206 const char **list, *m = (char *)&drive->id[ATA_ID_PROD];
207 207
208 for (list = pdc_quirk_drives; *list != NULL; list++) 208 for (list = pdc_quirk_drives; *list != NULL; list++)
209 if (strstr(model, *list) != NULL) { 209 if (strstr(m, *list) != NULL) {
210 drive->quirk_list = 2; 210 drive->quirk_list = 2;
211 return; 211 return;
212 } 212 }
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index de9a27400462..23e861b177ce 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->id->capability & 4) 89 if (drive->driveid->capability & 4)
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 */
@@ -154,10 +154,10 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
154 154
155static void pdc202xx_quirkproc(ide_drive_t *drive) 155static void pdc202xx_quirkproc(ide_drive_t *drive)
156{ 156{
157 const char **list, *model = drive->id->model; 157 const char **list, *m = (char *)&drive->id[ATA_ID_PROD];
158 158
159 for (list = pdc_quirk_drives; *list != NULL; list++) 159 for (list = pdc_quirk_drives; *list != NULL; list++)
160 if (strstr(model, *list) != NULL) { 160 if (strstr(m, *list) != NULL) {
161 drive->quirk_list = 2; 161 drive->quirk_list = 2;
162 return; 162 return;
163 } 163 }
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 8efaed16fea3..5c8367df14e4 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -105,16 +105,18 @@ static u8 sc1200_udma_filter(ide_drive_t *drive)
105{ 105{
106 ide_hwif_t *hwif = drive->hwif; 106 ide_hwif_t *hwif = drive->hwif;
107 ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1]; 107 ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1];
108 struct hd_driveid *mateid = mate->id; 108 u16 *mateid = mate->id;
109 u8 mask = hwif->ultra_mask; 109 u8 mask = hwif->ultra_mask;
110 110
111 if (mate->present == 0) 111 if (mate->present == 0)
112 goto out; 112 goto out;
113 113
114 if ((mateid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { 114 if ((mate->driveid->capability & 1) && __ide_dma_bad_drive(mate) == 0) {
115 if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7)) 115 if ((mateid[ATA_ID_FIELD_VALID] & 4) &&
116 (mateid[ATA_ID_UDMA_MODES] & 7))
116 goto out; 117 goto out;
117 if ((mateid->field_valid & 2) && (mateid->dma_mword & 7)) 118 if ((mateid[ATA_ID_FIELD_VALID] & 2) &&
119 (mateid[ATA_ID_MWDMA_MODES] & 7))
118 mask = 0; 120 mask = 0;
119 } 121 }
120out: 122out:
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index c3bdc6e51a48..ded6a13fd406 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -57,8 +57,10 @@ static struct pci_dev *isa_dev;
57 57
58static int check_in_drive_lists (ide_drive_t *drive, const char **list) 58static int check_in_drive_lists (ide_drive_t *drive, const char **list)
59{ 59{
60 char *m = (char *)&drive->id[ATA_ID_PROD];
61
60 while (*list) 62 while (*list)
61 if (!strcmp(*list++, drive->id->model)) 63 if (!strcmp(*list++, m))
62 return 1; 64 return 1;
63 return 0; 65 return 0;
64} 66}
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index db2b88a369ab..7b5bd8729f64 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -223,7 +223,9 @@ static u8 sil_pata_udma_filter(ide_drive_t *drive)
223 223
224static u8 sil_sata_udma_filter(ide_drive_t *drive) 224static u8 sil_sata_udma_filter(ide_drive_t *drive)
225{ 225{
226 return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6; 226 char *m = (char *)&drive->id[ATA_ID_PROD];
227
228 return strstr(m, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6;
227} 229}
228 230
229/** 231/**
@@ -616,8 +618,8 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
616 618
617static int is_dev_seagate_sata(ide_drive_t *drive) 619static int is_dev_seagate_sata(ide_drive_t *drive)
618{ 620{
619 const char *s = &drive->id->model[0]; 621 const char *s = (const char *)&drive->id[ATA_ID_PROD];
620 unsigned len = strnlen(s, sizeof(drive->id->model)); 622 unsigned len = strnlen(s, ATA_ID_PROD_LEN);
621 623
622 if ((len > 4) && (!memcmp(s, "ST", 2))) 624 if ((len > 4) && (!memcmp(s, "ST", 2)))
623 if ((!memcmp(s + len - 2, "AS", 2)) || 625 if ((!memcmp(s + len - 2, "AS", 2)) ||
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index fa2be26272d5..c3432da78d52 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -669,9 +669,9 @@ static void
669set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, 669set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
670 u8 speed) 670 u8 speed)
671{ 671{
672 u16 *id = drive->id;
672 int cycleTime, accessTime = 0, recTime = 0; 673 int cycleTime, accessTime = 0, recTime = 0;
673 unsigned accessTicks, recTicks; 674 unsigned accessTicks, recTicks;
674 struct hd_driveid *id = drive->id;
675 struct mdma_timings_t* tm = NULL; 675 struct mdma_timings_t* tm = NULL;
676 int i; 676 int i;
677 677
@@ -686,8 +686,8 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
686 } 686 }
687 687
688 /* Check if drive provides explicit DMA cycle time */ 688 /* Check if drive provides explicit DMA cycle time */
689 if ((id->field_valid & 2) && id->eide_dma_time) 689 if ((id[ATA_ID_FIELD_VALID] & 2) && id[ATA_ID_EIDE_DMA_TIME])
690 cycleTime = max_t(int, id->eide_dma_time, cycleTime); 690 cycleTime = max_t(int, id[ATA_ID_EIDE_DMA_TIME], cycleTime);
691 691
692 /* OHare limits according to some old Apple sources */ 692 /* OHare limits according to some old Apple sources */
693 if ((intf_type == controller_ohare) && (cycleTime < 150)) 693 if ((intf_type == controller_ohare) && (cycleTime < 150))
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 81c16cba5417..b1b506f31be8 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -452,7 +452,7 @@ static inline void idescsi_add_settings(ide_drive_t *drive) { ; }
452 */ 452 */
453static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi) 453static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
454{ 454{
455 if (drive->id && (drive->id->config & 0x0060) == 0x20) 455 if ((drive->id[ATA_ID_CONFIG] & 0x0060) == 0x20)
456 set_bit(IDE_AFLAG_DRQ_INTERRUPT, &drive->atapi_flags); 456 set_bit(IDE_AFLAG_DRQ_INTERRUPT, &drive->atapi_flags);
457 clear_bit(IDESCSI_SG_TRANSFORM, &scsi->transform); 457 clear_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
458#if IDESCSI_DEBUG_LOG 458#if IDESCSI_DEBUG_LOG
@@ -811,6 +811,7 @@ static int ide_scsi_probe(ide_drive_t *drive)
811 struct gendisk *g; 811 struct gendisk *g;
812 static int warned; 812 static int warned;
813 int err = -ENOMEM; 813 int err = -ENOMEM;
814 u16 last_lun;
814 815
815 if (!warned && drive->media == ide_cdrom) { 816 if (!warned && drive->media == ide_cdrom) {
816 printk(KERN_WARNING "ide-scsi is deprecated for cd burning! Use ide-cd and give dev=/dev/hdX as device\n"); 817 printk(KERN_WARNING "ide-scsi is deprecated for cd burning! Use ide-cd and give dev=/dev/hdX as device\n");
@@ -836,12 +837,12 @@ static int ide_scsi_probe(ide_drive_t *drive)
836 837
837 host->max_id = 1; 838 host->max_id = 1;
838 839
839 if (drive->id->last_lun) 840 last_lun = drive->id[ATA_ID_LAST_LUN];
840 debug_log("%s: id->last_lun=%u\n", drive->name, 841 if (last_lun)
841 drive->id->last_lun); 842 debug_log("%s: last_lun=%u\n", drive->name, last_lun);
842 843
843 if ((drive->id->last_lun & 0x7) != 7) 844 if ((last_lun & 7) != 7)
844 host->max_lun = (drive->id->last_lun & 0x7) + 1; 845 host->max_lun = (last_lun & 7) + 1;
845 else 846 else
846 host->max_lun = 1; 847 host->max_lun = 1;
847 848