aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
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/ide/pci
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/ide/pci')
-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
9 files changed, 56 insertions, 49 deletions
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)) ||