Commit 4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab
1 parent
5b90e99092
Exists in
master
and in
4 other branches
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>
Showing 28 changed files with 312 additions and 280 deletions Side-by-side Diff
- drivers/ide/arm/icside.c
- drivers/ide/arm/palm_bk3710.c
- drivers/ide/ide-acpi.c
- drivers/ide/ide-cd.c
- drivers/ide/ide-disk.c
- drivers/ide/ide-dma.c
- drivers/ide/ide-floppy.c
- drivers/ide/ide-iops.c
- drivers/ide/ide-lib.c
- drivers/ide/ide-probe.c
- drivers/ide/ide-proc.c
- drivers/ide/ide-tape.c
- drivers/ide/ide-taskfile.c
- drivers/ide/ide-timings.c
- drivers/ide/ide.c
- drivers/ide/legacy/qd65xx.c
- drivers/ide/pci/alim15x3.c
- drivers/ide/pci/cs5530.c
- drivers/ide/pci/hpt366.c
- drivers/ide/pci/it821x.c
- drivers/ide/pci/pdc202xx_new.c
- drivers/ide/pci/pdc202xx_old.c
- drivers/ide/pci/sc1200.c
- drivers/ide/pci/serverworks.c
- drivers/ide/pci/siimage.c
- drivers/ide/ppc/pmac.c
- drivers/scsi/ide-scsi.c
- include/linux/ide.h
drivers/ide/arm/icside.c
... | ... | @@ -265,8 +265,8 @@ |
265 | 265 | * If we're going to be doing MW_DMA_1 or MW_DMA_2, we should |
266 | 266 | * take care to note the values in the ID... |
267 | 267 | */ |
268 | - if (use_dma_info && drive->id->eide_dma_time > cycle_time) | |
269 | - cycle_time = drive->id->eide_dma_time; | |
268 | + if (use_dma_info && drive->id[ATA_ID_EIDE_DMA_TIME] > cycle_time) | |
269 | + cycle_time = drive->id[ATA_ID_EIDE_DMA_TIME]; | |
270 | 270 | |
271 | 271 | drive->drive_data = cycle_time; |
272 | 272 |
drivers/ide/arm/palm_bk3710.c
... | ... | @@ -213,7 +213,8 @@ |
213 | 213 | palm_bk3710_setudmamode(base, is_slave, |
214 | 214 | xferspeed - XFER_UDMA_0); |
215 | 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 | 218 | xferspeed); |
218 | 219 | } |
219 | 220 | } |
drivers/ide/ide-acpi.c
... | ... | @@ -584,7 +584,7 @@ |
584 | 584 | * This function executes the _STM ACPI method for the target channel. |
585 | 585 | * |
586 | 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 | 588 | * use; hence we'll get the information afresh. |
589 | 589 | */ |
590 | 590 | void ide_acpi_push_timing(ide_hwif_t *hwif) |
591 | 591 | |
... | ... | @@ -614,10 +614,10 @@ |
614 | 614 | in_params[0].buffer.length = sizeof(struct GTM_buffer); |
615 | 615 | in_params[0].buffer.pointer = (u8 *)&hwif->acpidata->gtm; |
616 | 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 | 618 | in_params[1].buffer.pointer = (u8 *)&master->idbuff; |
619 | 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 | 621 | in_params[2].buffer.pointer = (u8 *)&slave->idbuff; |
622 | 622 | /* Output buffer: _STM has no output */ |
623 | 623 |
drivers/ide/ide-cd.c
... | ... | @@ -1866,14 +1866,14 @@ |
1866 | 1866 | { NULL, NULL, 0 } |
1867 | 1867 | }; |
1868 | 1868 | |
1869 | -static unsigned int ide_cd_flags(struct hd_driveid *id) | |
1869 | +static unsigned int ide_cd_flags(u16 *id) | |
1870 | 1870 | { |
1871 | 1871 | const struct cd_list_entry *cle = ide_cd_quirks_list; |
1872 | 1872 | |
1873 | 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 | 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 | 1877 | return cle->cd_flags; |
1878 | 1878 | cle++; |
1879 | 1879 | } |
... | ... | @@ -1885,7 +1885,8 @@ |
1885 | 1885 | { |
1886 | 1886 | struct cdrom_info *cd = drive->driver_data; |
1887 | 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 | 1890 | int nslots; |
1890 | 1891 | |
1891 | 1892 | blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); |
1892 | 1893 | |
1893 | 1894 | |
... | ... | @@ -1900,15 +1901,15 @@ |
1900 | 1901 | drive->atapi_flags = IDE_AFLAG_MEDIA_CHANGED | IDE_AFLAG_NO_EJECT | |
1901 | 1902 | ide_cd_flags(id); |
1902 | 1903 | |
1903 | - if ((id->config & 0x0060) == 0x20) | |
1904 | + if ((id[ATA_ID_CONFIG] & 0x0060) == 0x20) | |
1904 | 1905 | drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT; |
1905 | 1906 | |
1906 | 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 | 1909 | drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD | |
1909 | 1910 | IDE_AFLAG_TOCADDR_AS_BCD); |
1910 | 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 | 1913 | drive->atapi_flags |= IDE_AFLAG_TOCTRACKS_AS_BCD; |
1913 | 1914 | else if (drive->atapi_flags & IDE_AFLAG_SANYO_3CD) |
1914 | 1915 | /* 3 => use CD in slot 0 */ |
drivers/ide/ide-disk.c
... | ... | @@ -99,12 +99,13 @@ |
99 | 99 | * |
100 | 100 | * It is called only once for each drive. |
101 | 101 | */ |
102 | -static int lba_capacity_is_ok(struct hd_driveid *id) | |
102 | +static int lba_capacity_is_ok(u16 *id) | |
103 | 103 | { |
104 | + struct hd_driveid *driveid = (struct hd_driveid *)id; | |
104 | 105 | unsigned long lba_sects, chs_sects, head, tail; |
105 | 106 | |
106 | 107 | /* No non-LBA info .. so valid! */ |
107 | - if (id->cyls == 0) | |
108 | + if (id[ATA_ID_CYLS] == 0) | |
108 | 109 | return 1; |
109 | 110 | |
110 | 111 | /* |
111 | 112 | |
... | ... | @@ -113,15 +114,15 @@ |
113 | 114 | * Some drives can be jumpered to use 15 heads instead of 16. |
114 | 115 | * Some drives can be jumpered to use 4092 cyls instead of 16383. |
115 | 116 | */ |
116 | - if ((id->cyls == 16383 | |
117 | - || (id->cyls == 4092 && id->cur_cyls == 16383)) && | |
118 | - id->sectors == 63 && | |
119 | - (id->heads == 15 || id->heads == 16) && | |
120 | - (id->lba_capacity >= 16383*63*id->heads)) | |
117 | + if ((id[ATA_ID_CYLS] == 16383 || | |
118 | + (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) && | |
119 | + id[ATA_ID_SECTORS] == 63 && | |
120 | + (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && | |
121 | + (driveid->lba_capacity >= 16383 * 63 * id[ATA_ID_HEADS])) | |
121 | 122 | return 1; |
122 | 123 | |
123 | - lba_sects = id->lba_capacity; | |
124 | - chs_sects = id->cyls * id->heads * id->sectors; | |
124 | + lba_sects = driveid->lba_capacity; | |
125 | + chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; | |
125 | 126 | |
126 | 127 | /* perform a rough sanity check on lba_sects: within 10% is OK */ |
127 | 128 | if ((lba_sects - chs_sects) < chs_sects/10) |
... | ... | @@ -132,7 +133,7 @@ |
132 | 133 | tail = (lba_sects & 0xffff); |
133 | 134 | lba_sects = (head | (tail << 16)); |
134 | 135 | if ((lba_sects - chs_sects) < chs_sects/10) { |
135 | - id->lba_capacity = lba_sects; | |
136 | + driveid->lba_capacity = lba_sects; | |
136 | 137 | return 1; /* lba_capacity is (now) good */ |
137 | 138 | } |
138 | 139 | |
139 | 140 | |
140 | 141 | |
141 | 142 | |
... | ... | @@ -389,18 +390,20 @@ |
389 | 390 | * so on non-buggy drives we need test only one. |
390 | 391 | * However, we should also check whether these fields are valid. |
391 | 392 | */ |
392 | -static inline int idedisk_supports_hpa(const struct hd_driveid *id) | |
393 | +static 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 | 400 | * The same here. |
399 | 401 | */ |
400 | -static inline int idedisk_supports_lba48(const struct hd_driveid *id) | |
402 | +static inline int idedisk_supports_lba48(const u16 *id) | |
401 | 403 | { |
402 | - return (id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) | |
403 | - && id->lba_capacity_2; | |
404 | + return (id[ATA_ID_COMMAND_SET_2] & 0x0400) && | |
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 @@ |
453 | 456 | |
454 | 457 | static 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 | 462 | * If this drive supports the Host Protected Area feature set, |
459 | 463 | * then we may need to change our opinion about the drive's capacity. |
460 | 464 | |
461 | 465 | |
... | ... | @@ -463,13 +467,13 @@ |
463 | 467 | if (idedisk_supports_lba48(id)) { |
464 | 468 | /* drive speaks 48-bit LBA */ |
465 | 469 | drive->select.b.lba = 1; |
466 | - drive->capacity64 = id->lba_capacity_2; | |
470 | + drive->capacity64 = driveid->lba_capacity_2; | |
467 | 471 | if (hpa) |
468 | 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 | 474 | /* drive speaks 28-bit LBA */ |
471 | 475 | drive->select.b.lba = 1; |
472 | - drive->capacity64 = id->lba_capacity; | |
476 | + drive->capacity64 = driveid->lba_capacity; | |
473 | 477 | if (hpa) |
474 | 478 | idedisk_check_hpa(drive); |
475 | 479 | } else { |
... | ... | @@ -523,7 +527,7 @@ |
523 | 527 | int len; |
524 | 528 | |
525 | 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 | 531 | else |
528 | 532 | len = sprintf(out, "(none)\n"); |
529 | 533 | |
... | ... | @@ -618,7 +622,7 @@ |
618 | 622 | struct request *rq; |
619 | 623 | int error; |
620 | 624 | |
621 | - if (arg < 0 || arg > drive->id->max_multsect) | |
625 | + if (arg < 0 || arg > drive->driveid->max_multsect) | |
622 | 626 | return -EINVAL; |
623 | 627 | |
624 | 628 | if (drive->special.b.set_multmode) |
... | ... | @@ -650,7 +654,7 @@ |
650 | 654 | |
651 | 655 | static void update_ordered(ide_drive_t *drive) |
652 | 656 | { |
653 | - struct hd_driveid *id = drive->id; | |
657 | + u16 *id = drive->id; | |
654 | 658 | unsigned ordered = QUEUE_ORDERED_NONE; |
655 | 659 | prepare_flush_fn *prep_fn = NULL; |
656 | 660 | |
... | ... | @@ -762,8 +766,6 @@ |
762 | 766 | #ifdef CONFIG_IDE_PROC_FS |
763 | 767 | static void idedisk_add_settings(ide_drive_t *drive) |
764 | 768 | { |
765 | - struct hd_driveid *id = drive->id; | |
766 | - | |
767 | 769 | ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, |
768 | 770 | &drive->bios_cyl, NULL); |
769 | 771 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, |
... | ... | @@ -773,7 +775,7 @@ |
773 | 775 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, |
774 | 776 | &drive->addressing, set_lba_addressing); |
775 | 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 | 779 | set_multcount); |
778 | 780 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, |
779 | 781 | &drive->nowerr, set_nowerr); |
... | ... | @@ -795,7 +797,8 @@ |
795 | 797 | static void idedisk_setup(ide_drive_t *drive) |
796 | 798 | { |
797 | 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 | 802 | unsigned long long capacity; |
800 | 803 | |
801 | 804 | idedisk_add_settings(drive); |
... | ... | @@ -807,7 +810,7 @@ |
807 | 810 | /* |
808 | 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 | 814 | drive->doorlocking = 1; |
812 | 815 | } |
813 | 816 | |
814 | 817 | |
... | ... | @@ -880,14 +883,14 @@ |
880 | 883 | drive->name, capacity, sectors_to_MB(capacity)); |
881 | 884 | |
882 | 885 | /* Only print cache size when it was specified */ |
883 | - if (id->buf_size) | |
884 | - printk(KERN_CONT " w/%dKiB Cache", id->buf_size / 2); | |
886 | + if (id[ATA_ID_BUF_SIZE]) | |
887 | + printk(KERN_CONT " w/%dKiB Cache", id[ATA_ID_BUF_SIZE] / 2); | |
885 | 888 | |
886 | 889 | printk(KERN_CONT ", CHS=%d/%d/%d\n", |
887 | 890 | drive->bios_cyl, drive->bios_head, drive->bios_sect); |
888 | 891 | |
889 | 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 | 894 | drive->wcache = 1; |
892 | 895 | |
893 | 896 | write_cache(drive, 1); |
drivers/ide/ide-dma.c
... | ... | @@ -288,7 +288,7 @@ |
288 | 288 | static int config_drive_for_dma (ide_drive_t *drive) |
289 | 289 | { |
290 | 290 | ide_hwif_t *hwif = drive->hwif; |
291 | - struct hd_driveid *id = drive->id; | |
291 | + u16 *id = drive->id; | |
292 | 292 | |
293 | 293 | if (drive->media != ide_disk) { |
294 | 294 | if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) |
295 | 295 | |
... | ... | @@ -299,16 +299,17 @@ |
299 | 299 | * Enable DMA on any drive that has |
300 | 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 | 304 | return 1; |
304 | 305 | |
305 | 306 | /* |
306 | 307 | * Enable DMA on any drive that has mode2 DMA |
307 | 308 | * (multi or single) enabled |
308 | 309 | */ |
309 | - if (id->field_valid & 2) /* regular DMA */ | |
310 | - if ((id->dma_mword & 0x404) == 0x404 || | |
311 | - (id->dma_1word & 0x404) == 0x404) | |
310 | + if (id[ATA_ID_FIELD_VALID] & 2) /* regular DMA */ | |
311 | + if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 || | |
312 | + (id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404) | |
312 | 313 | return 1; |
313 | 314 | |
314 | 315 | /* Consult the list of known "good" drives */ |
315 | 316 | |
... | ... | @@ -591,12 +592,12 @@ |
591 | 592 | |
592 | 593 | int __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 | 597 | int blacklist = ide_in_drive_list(id, drive_blacklist); |
597 | 598 | if (blacklist) { |
598 | 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 | 601 | return blacklist; |
601 | 602 | } |
602 | 603 | return 0; |
603 | 604 | |
604 | 605 | |
... | ... | @@ -612,21 +613,21 @@ |
612 | 613 | |
613 | 614 | static 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 | 617 | ide_hwif_t *hwif = drive->hwif; |
617 | 618 | const struct ide_port_ops *port_ops = hwif->port_ops; |
618 | 619 | unsigned int mask = 0; |
619 | 620 | |
620 | 621 | switch(base) { |
621 | 622 | case XFER_UDMA_0: |
622 | - if ((id->field_valid & 4) == 0) | |
623 | + if ((id[ATA_ID_FIELD_VALID] & 4) == 0) | |
623 | 624 | break; |
624 | 625 | |
625 | 626 | if (port_ops && port_ops->udma_filter) |
626 | 627 | mask = port_ops->udma_filter(drive); |
627 | 628 | else |
628 | 629 | mask = hwif->ultra_mask; |
629 | - mask &= id->dma_ultra; | |
630 | + mask &= id[ATA_ID_UDMA_MODES]; | |
630 | 631 | |
631 | 632 | /* |
632 | 633 | * avoid false cable warning from eighty_ninty_three() |
633 | 634 | |
634 | 635 | |
... | ... | @@ -637,19 +638,19 @@ |
637 | 638 | } |
638 | 639 | break; |
639 | 640 | case XFER_MW_DMA_0: |
640 | - if ((id->field_valid & 2) == 0) | |
641 | + if ((id[ATA_ID_FIELD_VALID] & 2) == 0) | |
641 | 642 | break; |
642 | 643 | if (port_ops && port_ops->mdma_filter) |
643 | 644 | mask = port_ops->mdma_filter(drive); |
644 | 645 | else |
645 | 646 | mask = hwif->mwdma_mask; |
646 | - mask &= id->dma_mword; | |
647 | + mask &= id[ATA_ID_MWDMA_MODES]; | |
647 | 648 | break; |
648 | 649 | case XFER_SW_DMA_0: |
649 | - if (id->field_valid & 2) { | |
650 | - mask = id->dma_1word & hwif->swdma_mask; | |
651 | - } else if (id->tDMA) { | |
652 | - u8 mode = id->tDMA; | |
650 | + if (id[ATA_ID_FIELD_VALID] & 2) { | |
651 | + mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask; | |
652 | + } else if (drive->driveid->tDMA) { | |
653 | + u8 mode = drive->driveid->tDMA; | |
653 | 654 | |
654 | 655 | /* |
655 | 656 | * if the mode is valid convert it to the mask |
... | ... | @@ -706,7 +707,8 @@ |
706 | 707 | /* |
707 | 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 | 712 | mode = XFER_MW_DMA_1; |
711 | 713 | } |
712 | 714 | |
... | ... | @@ -725,7 +727,7 @@ |
725 | 727 | ide_hwif_t *hwif = drive->hwif; |
726 | 728 | u8 speed; |
727 | 729 | |
728 | - if (drive->nodma || (drive->id->capability & 1) == 0) | |
730 | + if (drive->nodma || (drive->driveid->capability & 1) == 0) | |
729 | 731 | return 0; |
730 | 732 | |
731 | 733 | /* consult the list of known "bad" drives */ |
732 | 734 | |
733 | 735 | |
... | ... | @@ -767,13 +769,15 @@ |
767 | 769 | |
768 | 770 | int 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) { | |
773 | - if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) | |
774 | + if (id[ATA_ID_FIELD_VALID] & 4) { | |
775 | + if ((id[ATA_ID_UDMA_MODES] >> 8) && | |
776 | + (id[ATA_ID_MWDMA_MODES] >> 8)) | |
774 | 777 | goto err_out; |
775 | - } else if (id->field_valid & 2) { | |
776 | - if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) | |
778 | + } else if (id[ATA_ID_FIELD_VALID] & 2) { | |
779 | + if ((id[ATA_ID_MWDMA_MODES] >> 8) && | |
780 | + (id[ATA_ID_SWDMA_MODES] >> 8)) | |
777 | 781 | goto err_out; |
778 | 782 | } |
779 | 783 | return 0; |
drivers/ide/ide-floppy.c
... | ... | @@ -965,12 +965,12 @@ |
965 | 965 | * Check whether we can support a drive, based on the ATAPI IDENTIFY command |
966 | 966 | * results. |
967 | 967 | */ |
968 | -static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id) | |
968 | +static int idefloppy_identify_device(ide_drive_t *drive, u16 *id) | |
969 | 969 | { |
970 | 970 | u8 gcw[2]; |
971 | 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 | 975 | device_type = gcw[1] & 0x1F; |
976 | 976 | removable = (gcw[0] & 0x80) >> 7; |
... | ... | @@ -981,7 +981,8 @@ |
981 | 981 | #ifdef CONFIG_PPC |
982 | 982 | /* kludge for Apple PowerBook internal zip */ |
983 | 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 | 986 | device_type = 0; |
986 | 987 | #endif |
987 | 988 | |
988 | 989 | |
... | ... | @@ -1024,9 +1025,10 @@ |
1024 | 1025 | |
1025 | 1026 | static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) |
1026 | 1027 | { |
1028 | + u16 *id = drive->id; | |
1027 | 1029 | u8 gcw[2]; |
1028 | 1030 | |
1029 | - *((u16 *) &gcw) = drive->id->config; | |
1031 | + *((u16 *)&gcw) = id[ATA_ID_CONFIG]; | |
1030 | 1032 | floppy->pc = floppy->pc_stack; |
1031 | 1033 | drive->pc_callback = ide_floppy_callback; |
1032 | 1034 | |
... | ... | @@ -1041,7 +1043,7 @@ |
1041 | 1043 | * it. It should be fixed as of version 1.9, but to be on the safe side |
1042 | 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 | 1047 | drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; |
1046 | 1048 | /* This value will be visible in the /proc/ide/hdx/settings */ |
1047 | 1049 | floppy->ticks = IDEFLOPPY_TICKS_DELAY; |
... | ... | @@ -1052,7 +1054,7 @@ |
1052 | 1054 | * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes |
1053 | 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 | 1058 | blk_queue_max_sectors(drive->queue, 64); |
1057 | 1059 | drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; |
1058 | 1060 | } |
drivers/ide/ide-iops.c
... | ... | @@ -400,11 +400,11 @@ |
400 | 400 | .output_data = ide_output_data, |
401 | 401 | }; |
402 | 402 | |
403 | -void ide_fix_driveid(struct hd_driveid *driveid) | |
403 | +void ide_fix_driveid(u16 *id) | |
404 | 404 | { |
405 | 405 | #ifndef __LITTLE_ENDIAN |
406 | 406 | # ifdef __BIG_ENDIAN |
407 | - u16 *id = (u16 *)driveid; | |
407 | + struct hd_driveid *driveid = (struct hd_driveid *)id; | |
408 | 408 | int i; |
409 | 409 | |
410 | 410 | for (i = 0; i < 256; i++) { |
411 | 411 | |
412 | 412 | |
... | ... | @@ -593,18 +593,18 @@ |
593 | 593 | /** |
594 | 594 | * ide_in_drive_list - look for drive in black/white list |
595 | 595 | * @id: drive identifier |
596 | - * @drive_table: list to inspect | |
596 | + * @table: list to inspect | |
597 | 597 | * |
598 | 598 | * Look for a drive in the blacklist and the whitelist tables |
599 | 599 | * Returns 1 if the drive is found in the table. |
600 | 600 | */ |
601 | 601 | |
602 | -int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) | |
602 | +int ide_in_drive_list(u16 *id, const struct drive_list_entry *table) | |
603 | 603 | { |
604 | - for ( ; drive_table->id_model; drive_table++) | |
605 | - if ((!strcmp(drive_table->id_model, id->model)) && | |
606 | - (!drive_table->id_firmware || | |
607 | - strstr(id->fw_rev, drive_table->id_firmware))) | |
604 | + for ( ; table->id_model; table++) | |
605 | + if ((!strcmp(table->id_model, (char *)&id[ATA_ID_PROD])) && | |
606 | + (!table->id_firmware || | |
607 | + strstr((char *)&id[ATA_ID_FW_REV], table->id_firmware))) | |
608 | 608 | return 1; |
609 | 609 | return 0; |
610 | 610 | } |
... | ... | @@ -635,7 +635,7 @@ |
635 | 635 | u8 eighty_ninty_three (ide_drive_t *drive) |
636 | 636 | { |
637 | 637 | ide_hwif_t *hwif = drive->hwif; |
638 | - struct hd_driveid *id = drive->id; | |
638 | + u16 *id = drive->id; | |
639 | 639 | int ivb = ide_in_drive_list(id, ivb_list); |
640 | 640 | |
641 | 641 | if (hwif->cbl == ATA_CBL_PATA40_SHORT) |
... | ... | @@ -657,7 +657,8 @@ |
657 | 657 | * - force bit13 (80c cable present) check also for !ivb devices |
658 | 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 | 662 | return 1; |
662 | 663 | |
663 | 664 | no_80w: |
... | ... | @@ -678,7 +679,7 @@ |
678 | 679 | { |
679 | 680 | ide_hwif_t *hwif = drive->hwif; |
680 | 681 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
681 | - struct hd_driveid *id; | |
682 | + u16 *id; | |
682 | 683 | unsigned long timeout, flags; |
683 | 684 | u8 stat; |
684 | 685 | |
685 | 686 | |
686 | 687 | |
... | ... | @@ -722,17 +723,17 @@ |
722 | 723 | local_irq_enable(); |
723 | 724 | local_irq_restore(flags); |
724 | 725 | ide_fix_driveid(id); |
725 | - if (id) { | |
726 | - drive->id->dma_ultra = id->dma_ultra; | |
727 | - drive->id->dma_mword = id->dma_mword; | |
728 | - drive->id->dma_1word = id->dma_1word; | |
729 | - /* anything more ? */ | |
730 | - kfree(id); | |
731 | 726 | |
732 | - if (drive->using_dma && ide_id_dma_bug(drive)) | |
733 | - ide_dma_off(drive); | |
734 | - } | |
727 | + drive->id[ATA_ID_UDMA_MODES] = id[ATA_ID_UDMA_MODES]; | |
728 | + drive->id[ATA_ID_MWDMA_MODES] = id[ATA_ID_MWDMA_MODES]; | |
729 | + drive->id[ATA_ID_SWDMA_MODES] = id[ATA_ID_SWDMA_MODES]; | |
730 | + /* anything more ? */ | |
735 | 731 | |
732 | + kfree(id); | |
733 | + | |
734 | + if (drive->using_dma && ide_id_dma_bug(drive)) | |
735 | + ide_dma_off(drive); | |
736 | + | |
736 | 737 | return 1; |
737 | 738 | } |
738 | 739 | |
... | ... | @@ -740,6 +741,7 @@ |
740 | 741 | { |
741 | 742 | ide_hwif_t *hwif = drive->hwif; |
742 | 743 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
744 | + u16 *id = drive->id, i; | |
743 | 745 | int error = 0; |
744 | 746 | u8 stat; |
745 | 747 | ide_task_t task; |
... | ... | @@ -750,7 +752,7 @@ |
750 | 752 | #endif |
751 | 753 | |
752 | 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 | 756 | goto skip; |
755 | 757 | |
756 | 758 | /* |
... | ... | @@ -802,9 +804,9 @@ |
802 | 804 | return error; |
803 | 805 | } |
804 | 806 | |
805 | - drive->id->dma_ultra &= ~0xFF00; | |
806 | - drive->id->dma_mword &= ~0x0F00; | |
807 | - drive->id->dma_1word &= ~0x0F00; | |
807 | + id[ATA_ID_UDMA_MODES] &= ~0xFF00; | |
808 | + id[ATA_ID_MWDMA_MODES] &= ~0x0F00; | |
809 | + id[ATA_ID_SWDMA_MODES] &= ~0x0F00; | |
808 | 810 | |
809 | 811 | skip: |
810 | 812 | #ifdef CONFIG_BLK_DEV_IDEDMA |
811 | 813 | |
... | ... | @@ -814,23 +816,17 @@ |
814 | 816 | ide_dma_off_quietly(drive); |
815 | 817 | #endif |
816 | 818 | |
817 | - switch(speed) { | |
818 | - case XFER_UDMA_7: drive->id->dma_ultra |= 0x8080; break; | |
819 | - case XFER_UDMA_6: drive->id->dma_ultra |= 0x4040; break; | |
820 | - case XFER_UDMA_5: drive->id->dma_ultra |= 0x2020; break; | |
821 | - case XFER_UDMA_4: drive->id->dma_ultra |= 0x1010; break; | |
822 | - case XFER_UDMA_3: drive->id->dma_ultra |= 0x0808; break; | |
823 | - case XFER_UDMA_2: drive->id->dma_ultra |= 0x0404; break; | |
824 | - case XFER_UDMA_1: drive->id->dma_ultra |= 0x0202; break; | |
825 | - case XFER_UDMA_0: drive->id->dma_ultra |= 0x0101; break; | |
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; | |
819 | + if (speed >= XFER_UDMA_0) { | |
820 | + i = 1 << (speed - XFER_UDMA_0); | |
821 | + id[ATA_ID_UDMA_MODES] |= (i << 8 | i); | |
822 | + } else if (speed >= XFER_MW_DMA_0) { | |
823 | + i = 1 << (speed - XFER_MW_DMA_0); | |
824 | + id[ATA_ID_MWDMA_MODES] |= (i << 8 | i); | |
825 | + } else if (speed >= XFER_SW_DMA_0) { | |
826 | + i = 1 << (speed - XFER_SW_DMA_0); | |
827 | + id[ATA_ID_SWDMA_MODES] |= (i << 8 | i); | |
833 | 828 | } |
829 | + | |
834 | 830 | if (!drive->init_speed) |
835 | 831 | drive->init_speed = speed; |
836 | 832 | drive->current_speed = speed; |
... | ... | @@ -1035,7 +1031,7 @@ |
1035 | 1031 | |
1036 | 1032 | static 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 | 1036 | drive->special.all = 0; |
1041 | 1037 | drive->special.b.set_geometry = legacy; |
drivers/ide/ide-lib.c
... | ... | @@ -90,29 +90,31 @@ |
90 | 90 | |
91 | 91 | u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) |
92 | 92 | { |
93 | - int pio_mode; | |
94 | - struct hd_driveid* id = drive->id; | |
95 | - int overridden = 0; | |
93 | + u16 *id = drive->id; | |
94 | + int pio_mode = -1, overridden = 0; | |
96 | 95 | |
97 | 96 | if (mode_wanted != 255) |
98 | 97 | return min_t(u8, mode_wanted, max_mode); |
99 | 98 | |
100 | - if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && | |
101 | - (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { | |
99 | + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0) | |
100 | + pio_mode = ide_scan_pio_blacklist((char *)&id[ATA_ID_PROD]); | |
101 | + | |
102 | + if (pio_mode != -1) { | |
102 | 103 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); |
103 | 104 | } else { |
104 | - pio_mode = id->tPIO; | |
105 | + pio_mode = drive->driveid->tPIO; | |
105 | 106 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ |
106 | 107 | pio_mode = 2; |
107 | 108 | overridden = 1; |
108 | 109 | } |
109 | - if (id->field_valid & 2) { /* drive implements ATA2? */ | |
110 | - if (id->capability & 8) { /* IORDY supported? */ | |
111 | - if (id->eide_pio_modes & 7) { | |
110 | + | |
111 | + if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */ | |
112 | + if (drive->driveid->capability & 8) { /* IORDY sup? */ | |
113 | + if (id[ATA_ID_PIO_MODES] & 7) { | |
112 | 114 | overridden = 0; |
113 | - if (id->eide_pio_modes & 4) | |
115 | + if (id[ATA_ID_PIO_MODES] & 4) | |
114 | 116 | pio_mode = 5; |
115 | - else if (id->eide_pio_modes & 2) | |
117 | + else if (id[ATA_ID_PIO_MODES] & 2) | |
116 | 118 | pio_mode = 4; |
117 | 119 | else |
118 | 120 | pio_mode = 3; |
drivers/ide/ide-probe.c
... | ... | @@ -50,44 +50,44 @@ |
50 | 50 | |
51 | 51 | static void generic_id(ide_drive_t *drive) |
52 | 52 | { |
53 | - drive->id->cyls = drive->cyl; | |
54 | - drive->id->heads = drive->head; | |
55 | - drive->id->sectors = drive->sect; | |
56 | - drive->id->cur_cyls = drive->cyl; | |
57 | - drive->id->cur_heads = drive->head; | |
58 | - drive->id->cur_sectors = drive->sect; | |
53 | + u16 *id = drive->id; | |
54 | + | |
55 | + id[ATA_ID_CUR_CYLS] = id[ATA_ID_CYLS] = drive->cyl; | |
56 | + id[ATA_ID_CUR_HEADS] = id[ATA_ID_HEADS] = drive->head; | |
57 | + id[ATA_ID_CUR_SECTORS] = id[ATA_ID_SECTORS] = drive->sect; | |
59 | 58 | } |
60 | 59 | |
61 | 60 | static 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 | 64 | /* Extract geometry if we did not already have one for the drive */ |
66 | 65 | if (!drive->cyl || !drive->head || !drive->sect) { |
67 | - drive->cyl = drive->bios_cyl = id->cyls; | |
68 | - drive->head = drive->bios_head = id->heads; | |
69 | - drive->sect = drive->bios_sect = id->sectors; | |
66 | + drive->cyl = drive->bios_cyl = id[ATA_ID_CYLS]; | |
67 | + drive->head = drive->bios_head = id[ATA_ID_HEADS]; | |
68 | + drive->sect = drive->bios_sect = id[ATA_ID_SECTORS]; | |
70 | 69 | } |
71 | 70 | |
72 | 71 | /* Handle logical geometry translation by the drive */ |
73 | - if ((id->field_valid & 1) && id->cur_cyls && | |
74 | - id->cur_heads && (id->cur_heads <= 16) && id->cur_sectors) { | |
75 | - drive->cyl = id->cur_cyls; | |
76 | - drive->head = id->cur_heads; | |
77 | - drive->sect = id->cur_sectors; | |
72 | + if ((id[ATA_ID_FIELD_VALID] & 1) && id[ATA_ID_CUR_CYLS] && | |
73 | + id[ATA_ID_CUR_HEADS] && id[ATA_ID_CUR_HEADS] <= 16 && | |
74 | + id[ATA_ID_CUR_SECTORS]) { | |
75 | + drive->cyl = id[ATA_ID_CUR_CYLS]; | |
76 | + drive->head = id[ATA_ID_CUR_HEADS]; | |
77 | + drive->sect = id[ATA_ID_CUR_SECTORS]; | |
78 | 78 | } |
79 | 79 | |
80 | 80 | /* Use physical geometry if what we have still makes no sense */ |
81 | - if (drive->head > 16 && id->heads && id->heads <= 16) { | |
82 | - drive->cyl = id->cyls; | |
83 | - drive->head = id->heads; | |
84 | - drive->sect = id->sectors; | |
81 | + if (drive->head > 16 && id[ATA_ID_HEADS] && id[ATA_ID_HEADS] <= 16) { | |
82 | + drive->cyl = id[ATA_ID_CYLS]; | |
83 | + drive->head = id[ATA_ID_HEADS]; | |
84 | + drive->sect = id[ATA_ID_SECTORS]; | |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | 88 | static 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 | 92 | if (id->max_multsect) { |
93 | 93 | #ifdef CONFIG_IDEDISK_MULTI_MODE |
94 | 94 | |
95 | 95 | |
... | ... | @@ -118,10 +118,10 @@ |
118 | 118 | static inline void do_identify (ide_drive_t *drive, u8 cmd) |
119 | 119 | { |
120 | 120 | ide_hwif_t *hwif = HWIF(drive); |
121 | + u16 *id = drive->id; | |
122 | + char *m = (char *)&id[ATA_ID_PROD]; | |
121 | 123 | int bswap = 1; |
122 | - struct hd_driveid *id; | |
123 | 124 | |
124 | - id = drive->id; | |
125 | 125 | /* read 512 bytes of id info */ |
126 | 126 | hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE); |
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | 130 | |
131 | 131 | |
132 | 132 | |
133 | 133 | |
... | ... | @@ -138,23 +138,24 @@ |
138 | 138 | * WIN_PIDENTIFY *usually* returns little-endian info. |
139 | 139 | */ |
140 | 140 | if (cmd == WIN_PIDENTIFY) { |
141 | - if ((id->model[0] == 'N' && id->model[1] == 'E') /* NEC */ | |
142 | - || (id->model[0] == 'F' && id->model[1] == 'X') /* Mitsumi */ | |
143 | - || (id->model[0] == 'P' && id->model[1] == 'i'))/* Pioneer */ | |
141 | + if ((m[0] == 'N' && m[1] == 'E') || /* NEC */ | |
142 | + (m[0] == 'F' && m[1] == 'X') || /* Mitsumi */ | |
143 | + (m[0] == 'P' && m[1] == 'i')) /* Pioneer */ | |
144 | 144 | /* Vertos drives may still be weird */ |
145 | - bswap ^= 1; | |
145 | + bswap ^= 1; | |
146 | 146 | } |
147 | - ide_fixstring(id->model, sizeof(id->model), bswap); | |
148 | - ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); | |
149 | - ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); | |
150 | 147 | |
148 | + ide_fixstring(m, ATA_ID_PROD_LEN, 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); | |
151 | + | |
151 | 152 | /* we depend on this a lot! */ |
152 | - id->model[sizeof(id->model)-1] = '1] = '\0';'; | |
153 | + m[ATA_ID_PROD_LEN - 1] = '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 | 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 | 160 | drive->present = 1; |
160 | 161 | drive->dead = 0; |
161 | 162 | |
... | ... | @@ -163,15 +164,15 @@ |
163 | 164 | * Check for an ATAPI device |
164 | 165 | */ |
165 | 166 | if (cmd == WIN_PIDENTIFY) { |
166 | - u8 type = (id->config >> 8) & 0x1f; | |
167 | + u8 type = (id[ATA_ID_CONFIG] >> 8) & 0x1f; | |
167 | 168 | |
168 | 169 | printk(KERN_CONT "ATAPI "); |
169 | 170 | switch (type) { |
170 | 171 | case ide_floppy: |
171 | - if (!strstr(id->model, "CD-ROM")) { | |
172 | - if (!strstr(id->model, "oppy") && | |
173 | - !strstr(id->model, "poyp") && | |
174 | - !strstr(id->model, "ZIP")) | |
172 | + if (!strstr(m, "CD-ROM")) { | |
173 | + if (!strstr(m, "oppy") && | |
174 | + !strstr(m, "poyp") && | |
175 | + !strstr(m, "ZIP")) | |
175 | 176 | printk(KERN_CONT "cdrom or floppy?, assuming "); |
176 | 177 | if (drive->media != ide_cdrom) { |
177 | 178 | printk(KERN_CONT "FLOPPY"); |
... | ... | @@ -185,8 +186,7 @@ |
185 | 186 | drive->removable = 1; |
186 | 187 | #ifdef CONFIG_PPC |
187 | 188 | /* kludge for Apple PowerBook internal zip */ |
188 | - if (!strstr(id->model, "CD-ROM") && | |
189 | - strstr(id->model, "ZIP")) { | |
189 | + if (!strstr(m, "CD-ROM") && strstr(m, "ZIP")) { | |
190 | 190 | printk(KERN_CONT "FLOPPY"); |
191 | 191 | type = ide_floppy; |
192 | 192 | break; |
193 | 193 | |
... | ... | @@ -220,14 +220,13 @@ |
220 | 220 | * 0x848a = CompactFlash device |
221 | 221 | * These are *not* removable in Linux definition of the term |
222 | 222 | */ |
223 | - | |
224 | - if ((id->config != 0x848a) && (id->config & (1<<7))) | |
223 | + if (id[ATA_ID_CONFIG] != 0x848a && (id[ATA_ID_CONFIG] & (1 << 7))) | |
225 | 224 | drive->removable = 1; |
226 | 225 | |
227 | 226 | drive->media = ide_disk; |
228 | 227 | |
229 | 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 | 231 | return; |
233 | 232 | |
... | ... | @@ -525,7 +524,8 @@ |
525 | 524 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
526 | 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 | 530 | SELECT_DRIVE(drive); |
531 | 531 | msleep(50); |
... | ... | @@ -566,6 +566,8 @@ |
566 | 566 | |
567 | 567 | static inline u8 probe_for_drive (ide_drive_t *drive) |
568 | 568 | { |
569 | + char *m; | |
570 | + | |
569 | 571 | /* |
570 | 572 | * In order to keep things simple we have an id |
571 | 573 | * block for all drives at all times. If the device |
... | ... | @@ -582,8 +584,10 @@ |
582 | 584 | printk(KERN_ERR "ide: out of memory for id data.\n"); |
583 | 585 | return 0; |
584 | 586 | } |
585 | - strcpy(drive->id->model, "UNKNOWN"); | |
586 | - | |
587 | + | |
588 | + m = (char *)&drive->id[ATA_ID_PROD]; | |
589 | + strcpy(m, "UNKNOWN"); | |
590 | + | |
587 | 591 | /* skip probing? */ |
588 | 592 | if (!drive->noprobe) |
589 | 593 | { |
... | ... | @@ -595,7 +599,8 @@ |
595 | 599 | if (!drive->present) |
596 | 600 | /* drive not found */ |
597 | 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 | 604 | enable_nest(drive); |
600 | 605 | |
601 | 606 | /* identification failed? */ |
602 | 607 | |
603 | 608 | |
604 | 609 | |
605 | 610 | |
606 | 611 | |
607 | 612 | |
608 | 613 | |
... | ... | @@ -739,36 +744,38 @@ |
739 | 744 | |
740 | 745 | /** |
741 | 746 | * ide_undecoded_slave - look for bad CF adapters |
742 | - * @drive1: drive | |
747 | + * @dev1: slave device | |
743 | 748 | * |
744 | 749 | * Analyse the drives on the interface and attempt to decide if we |
745 | 750 | * have the same drive viewed twice. This occurs with crap CF adapters |
746 | 751 | * and PCMCIA sometimes. |
747 | 752 | */ |
748 | 753 | |
749 | -void ide_undecoded_slave(ide_drive_t *drive1) | |
754 | +void 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 | 759 | return; |
755 | 760 | |
756 | 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 | 764 | return; |
759 | 765 | |
760 | 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 | 769 | return; |
763 | 770 | |
764 | 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 | 773 | return; |
767 | 774 | |
768 | 775 | /* Appears to be an IDE flash adapter with decode bugs */ |
769 | 776 | printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n"); |
770 | 777 | |
771 | - drive1->present = 0; | |
778 | + dev1->present = 0; | |
772 | 779 | } |
773 | 780 | |
774 | 781 | EXPORT_SYMBOL_GPL(ide_undecoded_slave); |
... | ... | @@ -852,7 +859,7 @@ |
852 | 859 | if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) |
853 | 860 | drive->no_io_32bit = 1; |
854 | 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 |
drivers/ide/ide-proc.c
... | ... | @@ -561,11 +561,10 @@ |
561 | 561 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
562 | 562 | { |
563 | 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 | 565 | int len; |
566 | 566 | |
567 | - len = sprintf(page, "%.40s\n", | |
568 | - (id && id->model[0]) ? (char *)id->model : "(none)"); | |
567 | + len = sprintf(page, "%.40s\n", m[0] ? m : "(none)"); | |
569 | 568 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
570 | 569 | } |
571 | 570 |
drivers/ide/ide-tape.c
... | ... | @@ -2311,7 +2311,7 @@ |
2311 | 2311 | if (drive->id_read == 0) |
2312 | 2312 | return 1; |
2313 | 2313 | |
2314 | - *((unsigned short *) &gcw) = drive->id->config; | |
2314 | + *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG]; | |
2315 | 2315 | |
2316 | 2316 | protocol = (gcw[1] & 0xC0) >> 6; |
2317 | 2317 | device_type = gcw[1] & 0x1F; |
... | ... | @@ -2463,7 +2463,7 @@ |
2463 | 2463 | drive->dsc_overlap = 0; |
2464 | 2464 | } |
2465 | 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 | 2467 | drive->dsc_overlap = 0; |
2468 | 2468 | tape->minor = minor; |
2469 | 2469 | tape->name[0] = 'h'; |
... | ... | @@ -2471,7 +2471,8 @@ |
2471 | 2471 | tape->name[2] = '0' + minor; |
2472 | 2472 | tape->chrdev_dir = IDETAPE_DIR_NONE; |
2473 | 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 | 2477 | /* Command packet DRQ type */ |
2477 | 2478 | if (((gcw[0] & 0x60) >> 5) == 1) |
drivers/ide/ide-taskfile.c
... | ... | @@ -729,7 +729,7 @@ |
729 | 729 | u8 args[4], xfer_rate = 0; |
730 | 730 | ide_task_t tfargs; |
731 | 731 | struct ide_taskfile *tf = &tfargs.tf; |
732 | - struct hd_driveid *id = drive->id; | |
732 | + u16 *id = drive->id; | |
733 | 733 | |
734 | 734 | if (NULL == (void *) arg) { |
735 | 735 | struct request *rq; |
... | ... | @@ -772,7 +772,9 @@ |
772 | 772 | if (tf->command == WIN_SETFEATURES && |
773 | 773 | tf->feature == SETFEATURES_XFER && |
774 | 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 | 778 | xfer_rate = args[1]; |
777 | 779 | if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) { |
778 | 780 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " |
drivers/ide/ide-timings.c
... | ... | @@ -78,15 +78,15 @@ |
78 | 78 | |
79 | 79 | u16 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 | 82 | struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); |
83 | 83 | u16 cycle = 0; |
84 | 84 | |
85 | - if (id->field_valid & 2) { | |
86 | - if (id->capability & 8) | |
87 | - cycle = id->eide_pio_iordy; | |
85 | + if (id[ATA_ID_FIELD_VALID] & 2) { | |
86 | + if (drive->driveid->capability & 8) | |
87 | + cycle = id[ATA_ID_EIDE_PIO_IORDY]; | |
88 | 88 | else |
89 | - cycle = id->eide_pio; | |
89 | + cycle = id[ATA_ID_EIDE_PIO]; | |
90 | 90 | |
91 | 91 | /* conservative "downgrade" for all pre-ATA2 drives */ |
92 | 92 | if (pio < 3 && cycle < t->cycle) |
... | ... | @@ -138,7 +138,7 @@ |
138 | 138 | int ide_timing_compute(ide_drive_t *drive, u8 speed, |
139 | 139 | struct ide_timing *t, int T, int UT) |
140 | 140 | { |
141 | - struct hd_driveid *id = drive->id; | |
141 | + u16 *id = drive->id; | |
142 | 142 | struct ide_timing *s, p; |
143 | 143 | |
144 | 144 | /* |
145 | 145 | |
146 | 146 | |
147 | 147 | |
... | ... | @@ -157,16 +157,15 @@ |
157 | 157 | * If the drive is an EIDE drive, it can tell us it needs extended |
158 | 158 | * PIO/MWDMA cycle timing. |
159 | 159 | */ |
160 | - if (id && id->field_valid & 2) { /* EIDE drive */ | |
161 | - | |
160 | + if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ | |
162 | 161 | memset(&p, 0, sizeof(p)); |
163 | 162 | |
164 | 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 | 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 | 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 | 170 | ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B); |
172 | 171 | } |
drivers/ide/ide.c
... | ... | @@ -328,7 +328,7 @@ |
328 | 328 | if (arg < 0 || arg > 1) |
329 | 329 | return -EINVAL; |
330 | 330 | |
331 | - if (!drive->id || !(drive->id->capability & 1)) | |
331 | + if ((drive->driveid->capability & 1) == 0) | |
332 | 332 | goto out; |
333 | 333 | |
334 | 334 | if (hwif->dma_ops == NULL) |
335 | 335 | |
336 | 336 | |
... | ... | @@ -710,21 +710,21 @@ |
710 | 710 | char *buf) |
711 | 711 | { |
712 | 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 | |
716 | 716 | static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, |
717 | 717 | char *buf) |
718 | 718 | { |
719 | 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 | |
723 | 723 | static ssize_t serial_show(struct device *dev, struct device_attribute *attr, |
724 | 724 | char *buf) |
725 | 725 | { |
726 | 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 | |
730 | 730 | static struct device_attribute ide_dev_attrs[] = { |
drivers/ide/legacy/qd65xx.c
... | ... | @@ -151,12 +151,14 @@ |
151 | 151 | int *active_time, int *recovery_time) |
152 | 152 | { |
153 | 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); | |
159 | - ide_fixstring(model,40,1); /* byte-swap */ | |
160 | + strncpy(model, m, ATA_ID_PROD_LEN); | |
161 | + ide_fixstring(model, ATA_ID_PROD_LEN, 1); /* byte-swap */ | |
160 | 162 | |
161 | 163 | for (p = qd65xx_timing ; p->offset != -1 ; p++) { |
162 | 164 | if (!strncmp(p->model, model+p->offset, 4)) { |
163 | 165 | |
164 | 166 | |
165 | 167 | |
... | ... | @@ -185,20 +187,20 @@ |
185 | 187 | |
186 | 188 | static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) |
187 | 189 | { |
190 | + u16 *id = drive->id; | |
188 | 191 | int active_time = 175; |
189 | 192 | int recovery_time = 415; /* worst case values from the dos driver */ |
190 | 193 | |
191 | 194 | /* |
192 | 195 | * FIXME: use "pio" value |
193 | 196 | */ |
194 | - if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time) | |
195 | - && drive->id->tPIO && (drive->id->field_valid & 0x02) | |
196 | - && drive->id->eide_pio >= 240) { | |
197 | - | |
197 | + if (!qd_find_disk_type(drive, &active_time, &recovery_time) && | |
198 | + drive->driveid->tPIO && (id[ATA_ID_FIELD_VALID] & 2) && | |
199 | + id[ATA_ID_EIDE_PIO] >= 240) { | |
198 | 200 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, |
199 | - drive->id->tPIO); | |
201 | + drive->driveid->tPIO); | |
200 | 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 | 206 | qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); |
drivers/ide/pci/alim15x3.c
... | ... | @@ -134,8 +134,8 @@ |
134 | 134 | if (m5229_revision > 0x20 && m5229_revision < 0xC2) { |
135 | 135 | if (drive->media != ide_disk) |
136 | 136 | return 0; |
137 | - if (chip_is_1543c_e && strstr(drive->id->model, "WDC ") && | |
138 | - wdc_udma == 0) | |
137 | + if (wdc_udma == 0 && chip_is_1543c_e && | |
138 | + strstr((char *)&drive->id[ATA_ID_PROD], "WDC ")) | |
139 | 139 | return 0; |
140 | 140 | } |
141 | 141 |
drivers/ide/pci/cs5530.c
... | ... | @@ -82,16 +82,18 @@ |
82 | 82 | { |
83 | 83 | ide_hwif_t *hwif = drive->hwif; |
84 | 84 | ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1]; |
85 | - struct hd_driveid *mateid = mate->id; | |
85 | + u16 *mateid = mate->id; | |
86 | 86 | u8 mask = hwif->ultra_mask; |
87 | 87 | |
88 | 88 | if (mate->present == 0) |
89 | 89 | goto out; |
90 | 90 | |
91 | - if ((mateid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { | |
92 | - if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7)) | |
91 | + if ((mate->driveid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { | |
92 | + if ((mateid[ATA_ID_FIELD_VALID] & 4) && | |
93 | + (mateid[ATA_ID_UDMA_MODES] & 7)) | |
93 | 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 | 97 | mask = 0; |
96 | 98 | } |
97 | 99 | out: |
drivers/ide/pci/hpt366.c
... | ... | @@ -605,10 +605,10 @@ |
605 | 605 | |
606 | 606 | static 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 | 610 | while (*list) |
611 | - if (!strcmp(*list++,id->model)) | |
611 | + if (!strcmp(*list++, m)) | |
612 | 612 | return 1; |
613 | 613 | return 0; |
614 | 614 | } |
615 | 615 | |
... | ... | @@ -731,11 +731,11 @@ |
731 | 731 | |
732 | 732 | static 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 | 735 | const char **list = quirk_drives; |
736 | 736 | |
737 | 737 | while (*list) |
738 | - if (strstr(id->model, *list++)) { | |
738 | + if (strstr(m, *list++)) { | |
739 | 739 | drive->quirk_list = 1; |
740 | 740 | return; |
741 | 741 | } |
drivers/ide/pci/it821x.c
... | ... | @@ -446,8 +446,7 @@ |
446 | 446 | static void it821x_quirkproc(ide_drive_t *drive) |
447 | 447 | { |
448 | 448 | struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif); |
449 | - struct hd_driveid *id = drive->id; | |
450 | - u16 *idbits = (u16 *)drive->id; | |
449 | + u16 *id = drive->id; | |
451 | 450 | |
452 | 451 | if (!itdev->smart) { |
453 | 452 | /* |
454 | 453 | |
455 | 454 | |
456 | 455 | |
... | ... | @@ -466,36 +465,36 @@ |
466 | 465 | */ |
467 | 466 | |
468 | 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 | 470 | /* In raid mode the ident block is slightly buggy |
471 | 471 | We need to set the bits so that the IDE layer knows |
472 | 472 | LBA28. LBA48 and DMA ar valid */ |
473 | - id->capability |= 3; /* LBA28, DMA */ | |
474 | - id->command_set_2 |= 0x0400; /* LBA48 valid */ | |
475 | - id->cfs_enable_2 |= 0x0400; /* LBA48 on */ | |
473 | + drive->driveid->capability |= 3; /* LBA28, DMA */ | |
474 | + id[ATA_ID_COMMAND_SET_2] |= 0x0400; /* LBA48 valid */ | |
475 | + id[ATA_ID_CFS_ENABLE_2] |= 0x0400; /* LBA48 on */ | |
476 | 476 | /* Reporting logic */ |
477 | 477 | printk(KERN_INFO "%s: IT8212 %sRAID %d volume", |
478 | - drive->name, | |
479 | - idbits[147] ? "Bootable ":"", | |
480 | - idbits[129]); | |
481 | - if(idbits[129] != 1) | |
482 | - printk("(%dK stripe)", idbits[146]); | |
483 | - printk(".\n"); | |
478 | + drive->name, id[147] ? "Bootable " : "", | |
479 | + id[ATA_ID_CSFO]); | |
480 | + if (id[ATA_ID_CSFO] != 1) | |
481 | + printk(KERN_CONT "(%dK stripe)", id[146]); | |
482 | + printk(KERN_CONT ".\n"); | |
484 | 483 | } else { |
485 | 484 | /* Non RAID volume. Fixups to stop the core code |
486 | 485 | doing unsupported things */ |
487 | - id->field_valid &= 3; | |
488 | - id->queue_depth = 0; | |
489 | - id->command_set_1 = 0; | |
490 | - id->command_set_2 &= 0xC400; | |
491 | - id->cfsse &= 0xC000; | |
492 | - id->cfs_enable_1 = 0; | |
493 | - id->cfs_enable_2 &= 0xC400; | |
494 | - id->csf_default &= 0xC000; | |
495 | - id->word127 = 0; | |
496 | - id->dlf = 0; | |
497 | - id->csfo = 0; | |
498 | - id->cfa_power = 0; | |
486 | + id[ATA_ID_FIELD_VALID] &= 3; | |
487 | + id[ATA_ID_QUEUE_DEPTH] = 0; | |
488 | + id[ATA_ID_COMMAND_SET_1] = 0; | |
489 | + id[ATA_ID_COMMAND_SET_2] &= 0xC400; | |
490 | + id[ATA_ID_CFSSE] &= 0xC000; | |
491 | + id[ATA_ID_CFS_ENABLE_1] = 0; | |
492 | + id[ATA_ID_CFS_ENABLE_2] &= 0xC400; | |
493 | + id[ATA_ID_CSF_DEFAULT] &= 0xC000; | |
494 | + id[127] = 0; | |
495 | + id[ATA_ID_DLF] = 0; | |
496 | + id[ATA_ID_CSFO] = 0; | |
497 | + id[ATA_ID_CFA_POWER] = 0; | |
499 | 498 | printk(KERN_INFO "%s: Performing identify fixups.\n", |
500 | 499 | drive->name); |
501 | 500 | } |
... | ... | @@ -505,8 +504,8 @@ |
505 | 504 | * IDE core that DMA is supported (it821x hardware |
506 | 505 | * takes care of DMA mode programming). |
507 | 506 | */ |
508 | - if (id->capability & 1) { | |
509 | - id->dma_mword |= 0x0101; | |
507 | + if (drive->driveid->capability & 1) { | |
508 | + id[ATA_ID_MWDMA_MODES] |= 0x0101; | |
510 | 509 | drive->current_speed = XFER_MW_DMA_0; |
511 | 510 | } |
512 | 511 | } |
drivers/ide/pci/pdc202xx_new.c
... | ... | @@ -203,10 +203,10 @@ |
203 | 203 | |
204 | 204 | static 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 | 208 | for (list = pdc_quirk_drives; *list != NULL; list++) |
209 | - if (strstr(model, *list) != NULL) { | |
209 | + if (strstr(m, *list) != NULL) { | |
210 | 210 | drive->quirk_list = 2; |
211 | 211 | return; |
212 | 212 | } |
drivers/ide/pci/pdc202xx_old.c
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A |
87 | 87 | */ |
88 | 88 | AP &= ~0x3f; |
89 | - if (drive->id->capability & 4) | |
89 | + if (drive->driveid->capability & 4) | |
90 | 90 | AP |= 0x20; /* set IORDY_EN bit */ |
91 | 91 | if (drive->media == ide_disk) |
92 | 92 | AP |= 0x10; /* set Prefetch_EN bit */ |
93 | 93 | |
... | ... | @@ -154,10 +154,10 @@ |
154 | 154 | |
155 | 155 | static 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 | 159 | for (list = pdc_quirk_drives; *list != NULL; list++) |
160 | - if (strstr(model, *list) != NULL) { | |
160 | + if (strstr(m, *list) != NULL) { | |
161 | 161 | drive->quirk_list = 2; |
162 | 162 | return; |
163 | 163 | } |
drivers/ide/pci/sc1200.c
... | ... | @@ -105,16 +105,18 @@ |
105 | 105 | { |
106 | 106 | ide_hwif_t *hwif = drive->hwif; |
107 | 107 | ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1]; |
108 | - struct hd_driveid *mateid = mate->id; | |
108 | + u16 *mateid = mate->id; | |
109 | 109 | u8 mask = hwif->ultra_mask; |
110 | 110 | |
111 | 111 | if (mate->present == 0) |
112 | 112 | goto out; |
113 | 113 | |
114 | - if ((mateid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { | |
115 | - if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7)) | |
114 | + if ((mate->driveid->capability & 1) && __ide_dma_bad_drive(mate) == 0) { | |
115 | + if ((mateid[ATA_ID_FIELD_VALID] & 4) && | |
116 | + (mateid[ATA_ID_UDMA_MODES] & 7)) | |
116 | 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 | 120 | mask = 0; |
119 | 121 | } |
120 | 122 | out: |
drivers/ide/pci/serverworks.c
... | ... | @@ -57,8 +57,10 @@ |
57 | 57 | |
58 | 58 | static 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 | 62 | while (*list) |
61 | - if (!strcmp(*list++, drive->id->model)) | |
63 | + if (!strcmp(*list++, m)) | |
62 | 64 | return 1; |
63 | 65 | return 0; |
64 | 66 | } |
drivers/ide/pci/siimage.c
... | ... | @@ -223,7 +223,9 @@ |
223 | 223 | |
224 | 224 | static 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 @@ |
616 | 618 | |
617 | 619 | static int is_dev_seagate_sata(ide_drive_t *drive) |
618 | 620 | { |
619 | - const char *s = &drive->id->model[0]; | |
620 | - unsigned len = strnlen(s, sizeof(drive->id->model)); | |
621 | + const char *s = (const char *)&drive->id[ATA_ID_PROD]; | |
622 | + unsigned len = strnlen(s, ATA_ID_PROD_LEN); | |
621 | 623 | |
622 | 624 | if ((len > 4) && (!memcmp(s, "ST", 2))) |
623 | 625 | if ((!memcmp(s + len - 2, "AS", 2)) || |
drivers/ide/ppc/pmac.c
... | ... | @@ -669,9 +669,9 @@ |
669 | 669 | set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, |
670 | 670 | u8 speed) |
671 | 671 | { |
672 | + u16 *id = drive->id; | |
672 | 673 | int cycleTime, accessTime = 0, recTime = 0; |
673 | 674 | unsigned accessTicks, recTicks; |
674 | - struct hd_driveid *id = drive->id; | |
675 | 675 | struct mdma_timings_t* tm = NULL; |
676 | 676 | int i; |
677 | 677 | |
... | ... | @@ -686,8 +686,8 @@ |
686 | 686 | } |
687 | 687 | |
688 | 688 | /* Check if drive provides explicit DMA cycle time */ |
689 | - if ((id->field_valid & 2) && id->eide_dma_time) | |
690 | - cycleTime = max_t(int, id->eide_dma_time, cycleTime); | |
689 | + if ((id[ATA_ID_FIELD_VALID] & 2) && id[ATA_ID_EIDE_DMA_TIME]) | |
690 | + cycleTime = max_t(int, id[ATA_ID_EIDE_DMA_TIME], cycleTime); | |
691 | 691 | |
692 | 692 | /* OHare limits according to some old Apple sources */ |
693 | 693 | if ((intf_type == controller_ohare) && (cycleTime < 150)) |
drivers/scsi/ide-scsi.c
... | ... | @@ -452,7 +452,7 @@ |
452 | 452 | */ |
453 | 453 | static 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 | 456 | set_bit(IDE_AFLAG_DRQ_INTERRUPT, &drive->atapi_flags); |
457 | 457 | clear_bit(IDESCSI_SG_TRANSFORM, &scsi->transform); |
458 | 458 | #if IDESCSI_DEBUG_LOG |
... | ... | @@ -811,6 +811,7 @@ |
811 | 811 | struct gendisk *g; |
812 | 812 | static int warned; |
813 | 813 | int err = -ENOMEM; |
814 | + u16 last_lun; | |
814 | 815 | |
815 | 816 | if (!warned && drive->media == ide_cdrom) { |
816 | 817 | printk(KERN_WARNING "ide-scsi is deprecated for cd burning! Use ide-cd and give dev=/dev/hdX as device\n"); |
817 | 818 | |
... | ... | @@ -836,12 +837,12 @@ |
836 | 837 | |
837 | 838 | host->max_id = 1; |
838 | 839 | |
839 | - if (drive->id->last_lun) | |
840 | - debug_log("%s: id->last_lun=%u\n", drive->name, | |
841 | - drive->id->last_lun); | |
840 | + last_lun = drive->id[ATA_ID_LAST_LUN]; | |
841 | + if (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 | - host->max_lun = (drive->id->last_lun & 0x7) + 1; | |
844 | + if ((last_lun & 7) != 7) | |
845 | + host->max_lun = (last_lun & 7) + 1; | |
845 | 846 | else |
846 | 847 | host->max_lun = 1; |
847 | 848 |
include/linux/ide.h
... | ... | @@ -380,7 +380,11 @@ |
380 | 380 | struct request *rq; /* current request */ |
381 | 381 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
382 | 382 | void *driver_data; /* extra driver data */ |
383 | - struct hd_driveid *id; /* drive model identification info */ | |
383 | + union { | |
384 | + /* identification info */ | |
385 | + struct hd_driveid *driveid; | |
386 | + u16 *id; | |
387 | + }; | |
384 | 388 | #ifdef CONFIG_IDE_PROC_FS |
385 | 389 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
386 | 390 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ |
... | ... | @@ -920,7 +924,7 @@ |
920 | 924 | |
921 | 925 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
922 | 926 | |
923 | -extern void ide_fix_driveid(struct hd_driveid *); | |
927 | +void ide_fix_driveid(u16 *); | |
924 | 928 | |
925 | 929 | extern void ide_fixstring(u8 *, const int, const int); |
926 | 930 | |
... | ... | @@ -1240,7 +1244,7 @@ |
1240 | 1244 | const char *id_firmware; |
1241 | 1245 | }; |
1242 | 1246 | |
1243 | -int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | |
1247 | +int ide_in_drive_list(u16 *, const struct drive_list_entry *); | |
1244 | 1248 | |
1245 | 1249 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1246 | 1250 | int __ide_dma_bad_drive(ide_drive_t *); |
1247 | 1251 | |
1248 | 1252 | |
... | ... | @@ -1347,12 +1351,13 @@ |
1347 | 1351 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1348 | 1352 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1349 | 1353 | |
1350 | -static inline int ide_dev_has_iordy(struct hd_driveid *id) | |
1354 | +static inline int ide_dev_has_iordy(u16 *id) | |
1351 | 1355 | { |
1352 | - return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | |
1356 | + return ((id[ATA_ID_FIELD_VALID] & 2) && | |
1357 | + (((struct hd_driveid *)id)->capability & 8)) ? 1 : 0; | |
1353 | 1358 | } |
1354 | 1359 | |
1355 | -static inline int ide_dev_is_sata(struct hd_driveid *id) | |
1360 | +static inline int ide_dev_is_sata(u16 *id) | |
1356 | 1361 | { |
1357 | 1362 | /* |
1358 | 1363 | * See if word 93 is 0 AND drive is at least ATA-5 compatible |
... | ... | @@ -1360,7 +1365,7 @@ |
1360 | 1365 | * this trick allows us to filter out the reserved values of |
1361 | 1366 | * 0x0000 and 0xffff along with the earlier ATA revisions... |
1362 | 1367 | */ |
1363 | - if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) | |
1368 | + if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) | |
1364 | 1369 | return 1; |
1365 | 1370 | return 0; |
1366 | 1371 | } |
1367 | 1372 | |
... | ... | @@ -1437,11 +1442,11 @@ |
1437 | 1442 | extern struct class *ide_port_class; |
1438 | 1443 | |
1439 | 1444 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ |
1440 | -#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | |
1445 | +#define ide_id_has_flush_cache(id) ((id)[ATA_ID_CFS_ENABLE_2] & 0x3000) | |
1441 | 1446 | |
1442 | 1447 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ |
1443 | 1448 | #define ide_id_has_flush_cache_ext(id) \ |
1444 | - (((id)->cfs_enable_2 & 0x2400) == 0x2400) | |
1449 | + (((id)[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400) | |
1445 | 1450 | |
1446 | 1451 | static inline void ide_dump_identify(u8 *id) |
1447 | 1452 | { |