aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/Kconfig79
-rw-r--r--drivers/ide/Makefile2
-rw-r--r--drivers/ide/arm/icside.c16
-rw-r--r--drivers/ide/cris/ide-cris.c10
-rw-r--r--drivers/ide/ide-acpi.c38
-rw-r--r--drivers/ide/ide-cd.c101
-rw-r--r--drivers/ide/ide-cd.h3
-rw-r--r--drivers/ide/ide-disk.c33
-rw-r--r--drivers/ide/ide-dma.c70
-rw-r--r--drivers/ide/ide-io.c14
-rw-r--r--drivers/ide/ide-iops.c33
-rw-r--r--drivers/ide/ide-lib.c56
-rw-r--r--drivers/ide/ide-probe.c56
-rw-r--r--drivers/ide/ide-taskfile.c3
-rw-r--r--drivers/ide/ide.c30
-rw-r--r--drivers/ide/legacy/ali14xx.c7
-rw-r--r--drivers/ide/legacy/macide.c2
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/pci/aec62xx.c11
-rw-r--r--drivers/ide/pci/alim15x3.c5
-rw-r--r--drivers/ide/pci/cmd64x.c7
-rw-r--r--drivers/ide/pci/cs5530.c3
-rw-r--r--drivers/ide/pci/cs5535.c2
-rw-r--r--drivers/ide/pci/cy82c693.c6
-rw-r--r--drivers/ide/pci/generic.c2
-rw-r--r--drivers/ide/pci/hpt366.c101
-rw-r--r--drivers/ide/pci/it821x.c3
-rw-r--r--drivers/ide/pci/jmicron.c3
-rw-r--r--drivers/ide/pci/pdc202xx_new.c3
-rw-r--r--drivers/ide/pci/piix.c2
-rw-r--r--drivers/ide/pci/sc1200.c12
-rw-r--r--drivers/ide/pci/siimage.c45
-rw-r--r--drivers/ide/pci/sis5513.c2
-rw-r--r--drivers/ide/pci/trm290.c32
-rw-r--r--drivers/ide/ppc/pmac.c3
-rw-r--r--drivers/ide/setup-pci.c36
36 files changed, 463 insertions, 370 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 6eaece96524e..fb06555708a8 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -152,9 +152,22 @@ config BLK_DEV_IDEDISK
152 If unsure, say Y. 152 If unsure, say Y.
153 153
154config IDEDISK_MULTI_MODE 154config IDEDISK_MULTI_MODE
155 bool "Use multi-mode by default" 155 bool "Use multiple sector mode for Programmed Input/Output by default"
156 help 156 help
157 If you get this error, try to say Y here: 157 This setting is irrelevant for most IDE disks, with direct memory
158 access, to which multiple sector mode does not apply. Multiple sector
159 mode is a feature of most modern IDE hard drives, permitting the
160 transfer of multiple sectors per Programmed Input/Output interrupt,
161 rather than the usual one sector per interrupt. When this feature is
162 enabled, it can reduce operating system overhead for disk Programmed
163 Input/Output. On some systems, it also can increase the data
164 throughput of Programmed Input/Output. Some drives, however, seemed
165 to run slower with multiple sector mode enabled. Some drives claimed
166 to support multiple sector mode, but lost data at some settings.
167 Under rare circumstances, such failures could result in massive
168 filesystem corruption.
169
170 If you get the following error, try to say Y here:
158 171
159 hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } 172 hda: set_multmode: status=0x51 { DriveReady SeekComplete Error }
160 hda: set_multmode: error=0x04 { DriveStatusError } 173 hda: set_multmode: error=0x04 { DriveStatusError }
@@ -190,10 +203,6 @@ config BLK_DEV_IDECD
190 CD-ROM drive, you can say N to all other CD-ROM options, but be sure 203 CD-ROM drive, you can say N to all other CD-ROM options, but be sure
191 to say Y or M to "ISO 9660 CD-ROM file system support". 204 to say Y or M to "ISO 9660 CD-ROM file system support".
192 205
193 Note that older versions of LILO (LInux LOader) cannot properly deal
194 with IDE/ATAPI CD-ROMs, so install LILO 16 or higher, available from
195 <http://lilo.go.dyndns.org/>.
196
197 To compile this driver as a module, choose M here: the 206 To compile this driver as a module, choose M here: the
198 module will be called ide-cd. 207 module will be called ide-cd.
199 208
@@ -304,7 +313,6 @@ comment "IDE chipset support/bugfixes"
304 313
305config IDE_GENERIC 314config IDE_GENERIC
306 tristate "generic/default IDE chipset support" 315 tristate "generic/default IDE chipset support"
307 default H8300
308 help 316 help
309 If unsure, say N. 317 If unsure, say N.
310 318
@@ -380,9 +388,10 @@ config IDEPCI_SHARE_IRQ
380config IDEPCI_PCIBUS_ORDER 388config IDEPCI_PCIBUS_ORDER
381 def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI 389 def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI
382 390
391# TODO: split it on per host driver config options (or module parameters)
383config BLK_DEV_OFFBOARD 392config BLK_DEV_OFFBOARD
384 bool "Boot off-board chipsets first support" 393 bool "Boot off-board chipsets first support (DEPRECATED)"
385 depends on BLK_DEV_IDEPCI 394 depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001)
386 help 395 help
387 Normally, IDE controllers built into the motherboard (on-board 396 Normally, IDE controllers built into the motherboard (on-board
388 controllers) are assigned to ide0 and ide1 while those on add-in PCI 397 controllers) are assigned to ide0 and ide1 while those on add-in PCI
@@ -401,6 +410,10 @@ config BLK_DEV_OFFBOARD
401 Note that, if you do this, the order of the hd* devices will be 410 Note that, if you do this, the order of the hd* devices will be
402 rearranged which may require modification of fstab and other files. 411 rearranged which may require modification of fstab and other files.
403 412
413 Please also note that this method of assuring stable naming of
414 IDE devices is unreliable and use other means for achieving it
415 (i.e. udev).
416
404 If in doubt, say N. 417 If in doubt, say N.
405 418
406config BLK_DEV_GENERIC 419config BLK_DEV_GENERIC
@@ -474,6 +487,7 @@ config WDC_ALI15X3
474 487
475config BLK_DEV_AMD74XX 488config BLK_DEV_AMD74XX
476 tristate "AMD and nVidia IDE support" 489 tristate "AMD and nVidia IDE support"
490 depends on !ARM
477 select BLK_DEV_IDEDMA_PCI 491 select BLK_DEV_IDEDMA_PCI
478 help 492 help
479 This driver adds explicit support for AMD-7xx and AMD-8111 chips 493 This driver adds explicit support for AMD-7xx and AMD-8111 chips
@@ -873,6 +887,49 @@ config BLK_DEV_IDE_BAST
873 Say Y here if you want to support the onboard IDE channels on the 887 Say Y here if you want to support the onboard IDE channels on the
874 Simtec BAST or the Thorcom VR1000 888 Simtec BAST or the Thorcom VR1000
875 889
890config ETRAX_IDE
891 bool "ETRAX IDE support"
892 depends on CRIS && BROKEN
893 select BLK_DEV_IDEDMA
894 select IDE_GENERIC
895 help
896 Enables the ETRAX IDE driver.
897
898 You can't use parallel ports or SCSI ports at the same time.
899
900config ETRAX_IDE_DELAY
901 int "Delay for drives to regain consciousness"
902 depends on ETRAX_IDE && ETRAX_ARCH_V10
903 default 15
904 help
905 Number of seconds to wait for IDE drives to spin up after an IDE
906 reset.
907
908choice
909 prompt "IDE reset pin"
910 depends on ETRAX_IDE && ETRAX_ARCH_V10
911 default ETRAX_IDE_PB7_RESET
912
913config ETRAX_IDE_PB7_RESET
914 bool "Port_PB_Bit_7"
915 help
916 IDE reset on pin 7 on port B
917
918config ETRAX_IDE_G27_RESET
919 bool "Port_G_Bit_27"
920 help
921 IDE reset on pin 27 on port G
922
923endchoice
924
925config IDE_H8300
926 bool "H8300 IDE support"
927 depends on H8300
928 select IDE_GENERIC
929 default y
930 help
931 Enables the H8300 IDE driver.
932
876config BLK_DEV_GAYLE 933config BLK_DEV_GAYLE
877 bool "Amiga Gayle IDE interface support" 934 bool "Amiga Gayle IDE interface support"
878 depends on AMIGA 935 depends on AMIGA
@@ -953,7 +1010,7 @@ config BLK_DEV_Q40IDE
953 1010
954config BLK_DEV_MPC8xx_IDE 1011config BLK_DEV_MPC8xx_IDE
955 bool "MPC8xx IDE support" 1012 bool "MPC8xx IDE support"
956 depends on 8xx && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE 1013 depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE
957 select IDE_GENERIC 1014 select IDE_GENERIC
958 help 1015 help
959 This option provides support for IDE on Motorola MPC8xx Systems. 1016 This option provides support for IDE on Motorola MPC8xx Systems.
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 75dc6969e0a7..b181fc672057 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -39,7 +39,7 @@ ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o 39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
40 40
41# built-in only drivers from h8300/ 41# built-in only drivers from h8300/
42ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o 42ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o
43 43
44obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o 44obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o
45obj-$(CONFIG_IDE_GENERIC) += ide-generic.o 45obj-$(CONFIG_IDE_GENERIC) += ide-generic.o
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 410a0d13e35e..93f71fcfc04d 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -316,13 +316,13 @@ static int icside_dma_end(ide_drive_t *drive)
316 316
317 drive->waiting_for_dma = 0; 317 drive->waiting_for_dma = 0;
318 318
319 disable_dma(state->dev->dma); 319 disable_dma(ECARD_DEV(state->dev)->dma);
320 320
321 /* Teardown mappings after DMA has completed. */ 321 /* Teardown mappings after DMA has completed. */
322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, 322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents,
323 hwif->sg_dma_direction); 323 hwif->sg_dma_direction);
324 324
325 return get_dma_residue(state->dev->dma) != 0; 325 return get_dma_residue(ECARD_DEV(state->dev)->dma) != 0;
326} 326}
327 327
328static void icside_dma_start(ide_drive_t *drive) 328static void icside_dma_start(ide_drive_t *drive)
@@ -331,8 +331,8 @@ static void icside_dma_start(ide_drive_t *drive)
331 struct icside_state *state = hwif->hwif_data; 331 struct icside_state *state = hwif->hwif_data;
332 332
333 /* We can not enable DMA on both channels simultaneously. */ 333 /* We can not enable DMA on both channels simultaneously. */
334 BUG_ON(dma_channel_active(state->dev->dma)); 334 BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma));
335 enable_dma(state->dev->dma); 335 enable_dma(ECARD_DEV(state->dev)->dma);
336} 336}
337 337
338static int icside_dma_setup(ide_drive_t *drive) 338static int icside_dma_setup(ide_drive_t *drive)
@@ -350,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive)
350 /* 350 /*
351 * We can not enable DMA on both channels. 351 * We can not enable DMA on both channels.
352 */ 352 */
353 BUG_ON(dma_channel_active(state->dev->dma)); 353 BUG_ON(dma_channel_active(ECARD_DEV(state->dev)->dma));
354 354
355 icside_build_sglist(drive, rq); 355 icside_build_sglist(drive, rq);
356 356
@@ -367,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive)
367 /* 367 /*
368 * Select the correct timing for this drive. 368 * Select the correct timing for this drive.
369 */ 369 */
370 set_dma_speed(state->dev->dma, drive->drive_data); 370 set_dma_speed(ECARD_DEV(state->dev)->dma, drive->drive_data);
371 371
372 /* 372 /*
373 * Tell the DMA engine about the SG table and 373 * Tell the DMA engine about the SG table and
374 * data direction. 374 * data direction.
375 */ 375 */
376 set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents); 376 set_dma_sg(ECARD_DEV(state->dev)->dma, hwif->sg_table, hwif->sg_nents);
377 set_dma_mode(state->dev->dma, dma_mode); 377 set_dma_mode(ECARD_DEV(state->dev)->dma, dma_mode);
378 378
379 drive->waiting_for_dma = 1; 379 drive->waiting_for_dma = 1;
380 380
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index e196aefa2070..476e0d65ed43 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -748,8 +748,7 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
748 hold = ATA_DMA2_HOLD; 748 hold = ATA_DMA2_HOLD;
749 break; 749 break;
750 default: 750 default:
751 BUG(); 751 return;
752 break;
753 } 752 }
754 753
755 if (speed >= XFER_UDMA_0) 754 if (speed >= XFER_UDMA_0)
@@ -774,15 +773,16 @@ init_e100_ide (void)
774 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ 773 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */
775 ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0); 774 ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0);
776 775
777 /* first fill in some stuff in the ide_hwifs fields */ 776 for (h = 0; h < 4; h++) {
777 ide_hwif_t *hwif = NULL;
778 778
779 for(h = 0; h < MAX_HWIFS; h++) {
780 ide_hwif_t *hwif = &ide_hwifs[h];
781 ide_setup_ports(&hw, cris_ide_base_address(h), 779 ide_setup_ports(&hw, cris_ide_base_address(h),
782 ide_offsets, 780 ide_offsets,
783 0, 0, cris_ide_ack_intr, 781 0, 0, cris_ide_ack_intr,
784 ide_default_irq(0)); 782 ide_default_irq(0));
785 ide_register_hw(&hw, NULL, 1, &hwif); 783 ide_register_hw(&hw, NULL, 1, &hwif);
784 if (hwif == NULL)
785 continue;
786 hwif->mmio = 1; 786 hwif->mmio = 1;
787 hwif->chipset = ide_etrax100; 787 hwif->chipset = ide_etrax100;
788 hwif->set_pio_mode = &cris_set_pio_mode; 788 hwif->set_pio_mode = &cris_set_pio_mode;
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 89df48fdc69d..899d56536e80 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -16,6 +16,7 @@
16#include <acpi/acpi.h> 16#include <acpi/acpi.h>
17#include <linux/ide.h> 17#include <linux/ide.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/dmi.h>
19 20
20#include <acpi/acpi_bus.h> 21#include <acpi/acpi_bus.h>
21#include <acpi/acnames.h> 22#include <acpi/acnames.h>
@@ -65,6 +66,39 @@ extern int ide_noacpi;
65extern int ide_noacpitfs; 66extern int ide_noacpitfs;
66extern int ide_noacpionboot; 67extern int ide_noacpionboot;
67 68
69static bool ide_noacpi_psx;
70static int no_acpi_psx(const struct dmi_system_id *id)
71{
72 ide_noacpi_psx = true;
73 printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident);
74 return 0;
75}
76
77static const struct dmi_system_id ide_acpi_dmi_table[] = {
78 /* Bug 9673. */
79 /* We should check if this is because ACPI NVS isn't save/restored. */
80 {
81 .callback = no_acpi_psx,
82 .ident = "HP nx9005",
83 .matches = {
84 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."),
85 DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60")
86 },
87 },
88
89 { } /* terminate list */
90};
91
92static int ide_acpi_blacklist(void)
93{
94 static int done;
95 if (done)
96 return 0;
97 done = 1;
98 dmi_check_system(ide_acpi_dmi_table);
99 return 0;
100}
101
68/** 102/**
69 * ide_get_dev_handle - finds acpi_handle and PCI device.function 103 * ide_get_dev_handle - finds acpi_handle and PCI device.function
70 * @dev: device to locate 104 * @dev: device to locate
@@ -623,7 +657,7 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
623{ 657{
624 int unit; 658 int unit;
625 659
626 if (ide_noacpi) 660 if (ide_noacpi || ide_noacpi_psx)
627 return; 661 return;
628 662
629 DEBPRINT("ENTER:\n"); 663 DEBPRINT("ENTER:\n");
@@ -668,6 +702,8 @@ void ide_acpi_init(ide_hwif_t *hwif)
668 struct ide_acpi_drive_link *master; 702 struct ide_acpi_drive_link *master;
669 struct ide_acpi_drive_link *slave; 703 struct ide_acpi_drive_link *slave;
670 704
705 ide_acpi_blacklist();
706
671 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 707 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
672 if (!hwif->acpidata) 708 if (!hwif->acpidata)
673 return; 709 return;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 57a5f63d6ae3..c7d77f0ad892 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
1068 return 0; 1068 return 0;
1069 else if (ireason == 0) { 1069 else if (ireason == 0) {
1070 /* Whoops... The drive is expecting to receive data from us! */ 1070 /* Whoops... The drive is expecting to receive data from us! */
1071 printk(KERN_ERR "%s: read_intr: Drive wants to transfer data the " 1071 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
1072 "wrong way!\n", drive->name); 1072 drive->name, __FUNCTION__);
1073 1073
1074 /* Throw some data at the drive so it doesn't hang 1074 /* Throw some data at the drive so it doesn't hang
1075 and quit this request. */ 1075 and quit this request. */
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
1086 return 0; 1086 return 0;
1087 } else { 1087 } else {
1088 /* Drive wants a command packet, or invalid ireason... */ 1088 /* Drive wants a command packet, or invalid ireason... */
1089 printk(KERN_ERR "%s: read_intr: bad interrupt reason %x\n", drive->name, 1089 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
1090 ireason); 1090 drive->name, __FUNCTION__, ireason);
1091 } 1091 }
1092 1092
1093 cdrom_end_request(drive, 0); 1093 cdrom_end_request(drive, 0);
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
1112 */ 1112 */
1113 if (dma) { 1113 if (dma) {
1114 info->dma = 0; 1114 info->dma = 0;
1115 if ((dma_error = HWIF(drive)->ide_dma_end(drive))) 1115 dma_error = HWIF(drive)->ide_dma_end(drive);
1116 if (dma_error) {
1117 printk(KERN_ERR "%s: DMA read error\n", drive->name);
1116 ide_dma_off(drive); 1118 ide_dma_off(drive);
1119 }
1117 } 1120 }
1118 1121
1119 if (cdrom_decode_status(drive, 0, &stat)) 1122 if (cdrom_decode_status(drive, 0, &stat))
@@ -1443,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1443 return ide_stopped; 1446 return ide_stopped;
1444 1447
1445 /* Read the interrupt reason and the transfer length. */ 1448 /* Read the interrupt reason and the transfer length. */
1446 ireason = HWIF(drive)->INB(IDE_IREASON_REG); 1449 ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
1447 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); 1450 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG);
1448 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); 1451 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
1449 1452
@@ -1484,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1484 if (thislen > len) thislen = len; 1487 if (thislen > len) thislen = len;
1485 1488
1486 /* The drive wants to be written to. */ 1489 /* The drive wants to be written to. */
1487 if ((ireason & 3) == 0) { 1490 if (ireason == 0) {
1488 if (!rq->data) { 1491 if (!rq->data) {
1489 blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); 1492 blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
1490 goto confused; 1493 goto confused;
@@ -1506,9 +1509,9 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1506 } 1509 }
1507 1510
1508 /* Same drill for reading. */ 1511 /* Same drill for reading. */
1509 else if ((ireason & 3) == 2) { 1512 else if (ireason == 2) {
1510 if (!rq->data) { 1513 if (!rq->data) {
1511 blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); 1514 blk_dump_rq_flags(rq, "cdrom_pc_intr, read");
1512 goto confused; 1515 goto confused;
1513 } 1516 }
1514 /* Transfer the data. */ 1517 /* Transfer the data. */
@@ -1632,8 +1635,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1632 return 0; 1635 return 0;
1633 else if (ireason == 2) { 1636 else if (ireason == 2) {
1634 /* Whoops... The drive wants to send data. */ 1637 /* Whoops... The drive wants to send data. */
1635 printk(KERN_ERR "%s: write_intr: wrong transfer direction!\n", 1638 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
1636 drive->name); 1639 drive->name, __FUNCTION__);
1637 1640
1638 while (len > 0) { 1641 while (len > 0) {
1639 int dum = 0; 1642 int dum = 0;
@@ -1642,39 +1645,14 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1642 } 1645 }
1643 } else { 1646 } else {
1644 /* Drive wants a command packet, or invalid ireason... */ 1647 /* Drive wants a command packet, or invalid ireason... */
1645 printk(KERN_ERR "%s: write_intr: bad interrupt reason %x\n", 1648 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
1646 drive->name, ireason); 1649 drive->name, __FUNCTION__, ireason);
1647 } 1650 }
1648 1651
1649 cdrom_end_request(drive, 0); 1652 cdrom_end_request(drive, 0);
1650 return 1; 1653 return 1;
1651} 1654}
1652 1655
1653static void post_transform_command(struct request *req)
1654{
1655 u8 *c = req->cmd;
1656 char *ibuf;
1657
1658 if (!blk_pc_request(req))
1659 return;
1660
1661 if (req->bio)
1662 ibuf = bio_data(req->bio);
1663 else
1664 ibuf = req->data;
1665
1666 if (!ibuf)
1667 return;
1668
1669 /*
1670 * set ansi-revision and response data as atapi
1671 */
1672 if (c[0] == GPCMD_INQUIRY) {
1673 ibuf[2] |= 2;
1674 ibuf[3] = (ibuf[3] & 0xf0) | 2;
1675 }
1676}
1677
1678typedef void (xfer_func_t)(ide_drive_t *, void *, u32); 1656typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
1679 1657
1680/* 1658/*
@@ -1810,9 +1788,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1810 return ide_started; 1788 return ide_started;
1811 1789
1812end_request: 1790end_request:
1813 if (!rq->data_len)
1814 post_transform_command(rq);
1815
1816 spin_lock_irqsave(&ide_lock, flags); 1791 spin_lock_irqsave(&ide_lock, flags);
1817 blkdev_dequeue_request(rq); 1792 blkdev_dequeue_request(rq);
1818 end_that_request_last(rq, 1); 1793 end_that_request_last(rq, 1);
@@ -1833,8 +1808,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1833 /* Check for errors. */ 1808 /* Check for errors. */
1834 if (dma) { 1809 if (dma) {
1835 info->dma = 0; 1810 info->dma = 0;
1836 if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { 1811 dma_error = HWIF(drive)->ide_dma_end(drive);
1837 printk(KERN_ERR "ide-cd: write dma error\n"); 1812 if (dma_error) {
1813 printk(KERN_ERR "%s: DMA write error\n", drive->name);
1838 ide_dma_off(drive); 1814 ide_dma_off(drive);
1839 } 1815 }
1840 } 1816 }
@@ -1854,7 +1830,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1854 } 1830 }
1855 1831
1856 /* Read the interrupt reason and the transfer length. */ 1832 /* Read the interrupt reason and the transfer length. */
1857 ireason = HWIF(drive)->INB(IDE_IREASON_REG); 1833 ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
1858 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); 1834 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG);
1859 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); 1835 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
1860 1836
@@ -1867,8 +1843,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1867 */ 1843 */
1868 uptodate = 1; 1844 uptodate = 1;
1869 if (rq->current_nr_sectors > 0) { 1845 if (rq->current_nr_sectors > 0) {
1870 printk(KERN_ERR "%s: write_intr: data underrun (%d blocks)\n", 1846 printk(KERN_ERR "%s: %s: data underrun (%d blocks)\n",
1871 drive->name, rq->current_nr_sectors); 1847 drive->name, __FUNCTION__,
1848 rq->current_nr_sectors);
1872 uptodate = 0; 1849 uptodate = 0;
1873 } 1850 }
1874 cdrom_end_request(drive, uptodate); 1851 cdrom_end_request(drive, uptodate);
@@ -1888,7 +1865,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1888 int this_transfer; 1865 int this_transfer;
1889 1866
1890 if (!rq->current_nr_sectors) { 1867 if (!rq->current_nr_sectors) {
1891 printk(KERN_ERR "ide-cd: write_intr: oops\n"); 1868 printk(KERN_ERR "%s: %s: confused, missing data\n",
1869 drive->name, __FUNCTION__);
1892 break; 1870 break;
1893 } 1871 }
1894 1872
@@ -2716,14 +2694,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
2716 if (!drive->id->model[0] && 2694 if (!drive->id->model[0] &&
2717 !strncmp(drive->id->fw_rev, "241N", 4)) { 2695 !strncmp(drive->id->fw_rev, "241N", 4)) {
2718 CDROM_STATE_FLAGS(drive)->current_speed = 2696 CDROM_STATE_FLAGS(drive)->current_speed =
2719 (((unsigned int)cap->curspeed) + (176/2)) / 176; 2697 (le16_to_cpu(cap->curspeed) + (176/2)) / 176;
2720 CDROM_CONFIG_FLAGS(drive)->max_speed = 2698 CDROM_CONFIG_FLAGS(drive)->max_speed =
2721 (((unsigned int)cap->maxspeed) + (176/2)) / 176; 2699 (le16_to_cpu(cap->maxspeed) + (176/2)) / 176;
2722 } else { 2700 } else {
2723 CDROM_STATE_FLAGS(drive)->current_speed = 2701 CDROM_STATE_FLAGS(drive)->current_speed =
2724 (ntohs(cap->curspeed) + (176/2)) / 176; 2702 (be16_to_cpu(cap->curspeed) + (176/2)) / 176;
2725 CDROM_CONFIG_FLAGS(drive)->max_speed = 2703 CDROM_CONFIG_FLAGS(drive)->max_speed =
2726 (ntohs(cap->maxspeed) + (176/2)) / 176; 2704 (be16_to_cpu(cap->maxspeed) + (176/2)) / 176;
2727 } 2705 }
2728} 2706}
2729 2707
@@ -2937,6 +2915,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
2937 if (!CDROM_CONFIG_FLAGS(drive)->ram) 2915 if (!CDROM_CONFIG_FLAGS(drive)->ram)
2938 devinfo->mask |= CDC_RAM; 2916 devinfo->mask |= CDC_RAM;
2939 2917
2918 if (CDROM_CONFIG_FLAGS(drive)->no_speed_select)
2919 devinfo->mask |= CDC_SELECT_SPEED;
2920
2940 devinfo->disk = info->disk; 2921 devinfo->disk = info->disk;
2941 return register_cdrom(devinfo); 2922 return register_cdrom(devinfo);
2942} 2923}
@@ -3049,12 +3030,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
3049 else 3030 else
3050 printk(" drive"); 3031 printk(" drive");
3051 3032
3052 printk(", %dkB Cache", be16_to_cpu(cap.buffer_size)); 3033 printk(KERN_CONT ", %dkB Cache\n", be16_to_cpu(cap.buffer_size));
3053
3054 if (drive->using_dma)
3055 ide_dma_verbose(drive);
3056
3057 printk("\n");
3058 3034
3059 return nslots; 3035 return nslots;
3060} 3036}
@@ -3194,7 +3170,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
3194 CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; 3170 CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
3195 /* the 3231 model does not support the SET_CD_SPEED command */ 3171 /* the 3231 model does not support the SET_CD_SPEED command */
3196 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) 3172 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
3197 cdi->mask |= CDC_SELECT_SPEED; 3173 CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1;
3198 3174
3199#if ! STANDARD_ATAPI 3175#if ! STANDARD_ATAPI
3200 /* by default Sanyo 3 CD changer support is turned off and 3176 /* by default Sanyo 3 CD changer support is turned off and
@@ -3537,15 +3513,8 @@ static int ide_cd_probe(ide_drive_t *drive)
3537 g->driverfs_dev = &drive->gendev; 3513 g->driverfs_dev = &drive->gendev;
3538 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; 3514 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
3539 if (ide_cdrom_setup(drive)) { 3515 if (ide_cdrom_setup(drive)) {
3540 struct cdrom_device_info *devinfo = &info->devinfo;
3541 ide_proc_unregister_driver(drive, &ide_cdrom_driver); 3516 ide_proc_unregister_driver(drive, &ide_cdrom_driver);
3542 kfree(info->buffer); 3517 ide_cd_release(&info->kref);
3543 kfree(info->toc);
3544 kfree(info->changer_info);
3545 if (devinfo->handle == drive && unregister_cdrom(devinfo))
3546 printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
3547 kfree(info);
3548 drive->driver_data = NULL;
3549 goto failed; 3518 goto failed;
3550 } 3519 }
3551 3520
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 228b29c5d2e4..1b302fe2724d 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -91,7 +91,8 @@ struct ide_cd_config_flags {
91 __u8 close_tray : 1; /* can close the tray */ 91 __u8 close_tray : 1; /* can close the tray */
92 __u8 writing : 1; /* pseudo write in progress */ 92 __u8 writing : 1; /* pseudo write in progress */
93 __u8 mo_drive : 1; /* drive is an MO device */ 93 __u8 mo_drive : 1; /* drive is an MO device */
94 __u8 reserved : 2; 94 __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */
95 __u8 reserved : 1;
95 byte max_speed; /* Max speed of the drive */ 96 byte max_speed; /* Max speed of the drive */
96}; 97};
97#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) 98#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 00123d99527a..b1781908e1f2 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -13,32 +13,6 @@
13 * and Andre Hedrick <andre@linux-ide.org> 13 * and Andre Hedrick <andre@linux-ide.org>
14 * 14 *
15 * This is the IDE/ATA disk driver, as evolved from hd.c and ide.c. 15 * This is the IDE/ATA disk driver, as evolved from hd.c and ide.c.
16 *
17 * Version 1.00 move disk only code from ide.c to ide-disk.c
18 * support optional byte-swapping of all data
19 * Version 1.01 fix previous byte-swapping code
20 * Version 1.02 remove ", LBA" from drive identification msgs
21 * Version 1.03 fix display of id->buf_size for big-endian
22 * Version 1.04 add /proc configurable settings and S.M.A.R.T support
23 * Version 1.05 add capacity support for ATA3 >= 8GB
24 * Version 1.06 get boot-up messages to show full cyl count
25 * Version 1.07 disable door-locking if it fails
26 * Version 1.08 fixed CHS/LBA translations for ATA4 > 8GB,
27 * process of adding new ATA4 compliance.
28 * fixed problems in allowing fdisk to see
29 * the entire disk.
30 * Version 1.09 added increment of rq->sector in ide_multwrite
31 * added UDMA 3/4 reporting
32 * Version 1.10 request queue changes, Ultra DMA 100
33 * Version 1.11 added 48-bit lba
34 * Version 1.12 adding taskfile io access method
35 * Version 1.13 added standby and flush-cache for notifier
36 * Version 1.14 added acoustic-wcache
37 * Version 1.15 convert all calls to ide_raw_taskfile
38 * since args will return register content.
39 * Version 1.16 added suspend-resume-checkpower
40 * Version 1.17 do flush on standby, do flush on ATA < ATA6
41 * fix wcache setup.
42 */ 16 */
43 17
44#define IDEDISK_VERSION "1.18" 18#define IDEDISK_VERSION "1.18"
@@ -961,11 +935,8 @@ static void idedisk_setup (ide_drive_t *drive)
961 if (id->buf_size) 935 if (id->buf_size)
962 printk (" w/%dKiB Cache", id->buf_size/2); 936 printk (" w/%dKiB Cache", id->buf_size/2);
963 937
964 printk(", CHS=%d/%d/%d", 938 printk(KERN_CONT ", CHS=%d/%d/%d\n",
965 drive->bios_cyl, drive->bios_head, drive->bios_sect); 939 drive->bios_cyl, drive->bios_head, drive->bios_sect);
966 if (drive->using_dma)
967 ide_dma_verbose(drive);
968 printk("\n");
969 940
970 /* write cache enabled? */ 941 /* write cache enabled? */
971 if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5))) 942 if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5)))
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 428f7a8a00b6..4703837bf1fc 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -130,6 +130,7 @@ static const struct drive_list_entry drive_blacklist [] = {
130 { "_NEC DV5800A", NULL }, 130 { "_NEC DV5800A", NULL },
131 { "SAMSUNG CD-ROM SN-124", "N001" }, 131 { "SAMSUNG CD-ROM SN-124", "N001" },
132 { "Seagate STT20000A", NULL }, 132 { "Seagate STT20000A", NULL },
133 { "CD-ROM CDR_U200", "1.09" },
133 { NULL , NULL } 134 { NULL , NULL }
134 135
135}; 136};
@@ -340,7 +341,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
340 341
341 if (drive->media != ide_disk) { 342 if (drive->media != ide_disk) {
342 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) 343 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
343 return -1; 344 return 0;
344 } 345 }
345 346
346 /* 347 /*
@@ -610,12 +611,6 @@ static int __ide_dma_test_irq(ide_drive_t *drive)
610 ide_hwif_t *hwif = HWIF(drive); 611 ide_hwif_t *hwif = HWIF(drive);
611 u8 dma_stat = hwif->INB(hwif->dma_status); 612 u8 dma_stat = hwif->INB(hwif->dma_status);
612 613
613#if 0 /* do not set unless you know what you are doing */
614 if (dma_stat & 4) {
615 u8 stat = hwif->INB(IDE_STATUS_REG);
616 hwif->OUTB(hwif->dma_status, dma_stat & 0xE4);
617 }
618#endif
619 /* return 1 if INTR asserted */ 614 /* return 1 if INTR asserted */
620 if ((dma_stat & 4) == 4) 615 if ((dma_stat & 4) == 4)
621 return 1; 616 return 1;
@@ -752,9 +747,12 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
752 mode = XFER_MW_DMA_1; 747 mode = XFER_MW_DMA_1;
753 } 748 }
754 749
755 printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); 750 mode = min(mode, req_mode);
756 751
757 return min(mode, req_mode); 752 printk(KERN_INFO "%s: %s mode selected\n", drive->name,
753 mode ? ide_xfer_verbose(mode) : "no DMA");
754
755 return mode;
758} 756}
759 757
760EXPORT_SYMBOL_GPL(ide_find_dma_mode); 758EXPORT_SYMBOL_GPL(ide_find_dma_mode);
@@ -770,6 +768,9 @@ static int ide_tune_dma(ide_drive_t *drive)
770 if (__ide_dma_bad_drive(drive)) 768 if (__ide_dma_bad_drive(drive))
771 return 0; 769 return 0;
772 770
771 if (ide_id_dma_bug(drive))
772 return 0;
773
773 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) 774 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
774 return config_drive_for_dma(drive); 775 return config_drive_for_dma(drive);
775 776
@@ -804,58 +805,23 @@ static int ide_dma_check(ide_drive_t *drive)
804 return vdma ? 0 : -1; 805 return vdma ? 0 : -1;
805} 806}
806 807
807void ide_dma_verbose(ide_drive_t *drive) 808int ide_id_dma_bug(ide_drive_t *drive)
808{ 809{
809 struct hd_driveid *id = drive->id; 810 struct hd_driveid *id = drive->id;
810 ide_hwif_t *hwif = HWIF(drive);
811 811
812 if (id->field_valid & 4) { 812 if (id->field_valid & 4) {
813 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) 813 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8))
814 goto bug_dma_off; 814 goto err_out;
815 if (id->dma_ultra & ((id->dma_ultra >> 8) & hwif->ultra_mask)) {
816 if (((id->dma_ultra >> 11) & 0x1F) &&
817 eighty_ninty_three(drive)) {
818 if ((id->dma_ultra >> 15) & 1) {
819 printk(", UDMA(mode 7)");
820 } else if ((id->dma_ultra >> 14) & 1) {
821 printk(", UDMA(133)");
822 } else if ((id->dma_ultra >> 13) & 1) {
823 printk(", UDMA(100)");
824 } else if ((id->dma_ultra >> 12) & 1) {
825 printk(", UDMA(66)");
826 } else if ((id->dma_ultra >> 11) & 1) {
827 printk(", UDMA(44)");
828 } else
829 goto mode_two;
830 } else {
831 mode_two:
832 if ((id->dma_ultra >> 10) & 1) {
833 printk(", UDMA(33)");
834 } else if ((id->dma_ultra >> 9) & 1) {
835 printk(", UDMA(25)");
836 } else if ((id->dma_ultra >> 8) & 1) {
837 printk(", UDMA(16)");
838 }
839 }
840 } else {
841 printk(", (U)DMA"); /* Can be BIOS-enabled! */
842 }
843 } else if (id->field_valid & 2) { 815 } else if (id->field_valid & 2) {
844 if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) 816 if ((id->dma_mword >> 8) && (id->dma_1word >> 8))
845 goto bug_dma_off; 817 goto err_out;
846 printk(", DMA");
847 } else if (id->field_valid & 1) {
848 goto bug_dma_off;
849 } 818 }
850 return; 819 return 0;
851bug_dma_off: 820err_out:
852 printk(", BUG DMA OFF"); 821 printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
853 hwif->dma_off_quietly(drive); 822 return 1;
854 return;
855} 823}
856 824
857EXPORT_SYMBOL(ide_dma_verbose);
858
859int ide_set_dma(ide_drive_t *drive) 825int ide_set_dma(ide_drive_t *drive)
860{ 826{
861 ide_hwif_t *hwif = drive->hwif; 827 ide_hwif_t *hwif = drive->hwif;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c89f0d3058e9..bef781fec500 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -340,6 +340,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
340 if (args) { 340 if (args) {
341 args[0] = stat; 341 args[0] = stat;
342 args[1] = err; 342 args[1] = err;
343 /* be sure we're looking at the low order bits */
344 hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG);
343 args[2] = hwif->INB(IDE_NSECTOR_REG); 345 args[2] = hwif->INB(IDE_NSECTOR_REG);
344 args[3] = hwif->INB(IDE_SECTOR_REG); 346 args[3] = hwif->INB(IDE_SECTOR_REG);
345 args[4] = hwif->INB(IDE_LCYL_REG); 347 args[4] = hwif->INB(IDE_LCYL_REG);
@@ -654,7 +656,8 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
654 int retries = 10; 656 int retries = 10;
655 657
656 local_irq_enable_in_hardirq(); 658 local_irq_enable_in_hardirq();
657 if ((stat & DRQ_STAT) && args && args[3]) { 659 if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
660 (stat & DRQ_STAT) && args && args[3]) {
658 u8 io_32bit = drive->io_32bit; 661 u8 io_32bit = drive->io_32bit;
659 drive->io_32bit = 0; 662 drive->io_32bit = 0;
660 hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); 663 hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
@@ -882,7 +885,6 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
882 return do_rw_taskfile(drive, args); 885 return do_rw_taskfile(drive, args);
883 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { 886 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
884 u8 *args = rq->buffer; 887 u8 *args = rq->buffer;
885 u8 sel;
886 888
887 if (!args) 889 if (!args)
888 goto done; 890 goto done;
@@ -900,10 +902,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
900 hwif->OUTB(args[3], IDE_SECTOR_REG); 902 hwif->OUTB(args[3], IDE_SECTOR_REG);
901 hwif->OUTB(args[4], IDE_LCYL_REG); 903 hwif->OUTB(args[4], IDE_LCYL_REG);
902 hwif->OUTB(args[5], IDE_HCYL_REG); 904 hwif->OUTB(args[5], IDE_HCYL_REG);
903 sel = (args[6] & ~0x10); 905 hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG);
904 if (drive->select.b.unit)
905 sel |= 0x10;
906 hwif->OUTB(sel, IDE_SELECT_REG);
907 ide_cmd(drive, args[0], args[2], &drive_cmd_intr); 906 ide_cmd(drive, args[0], args[2], &drive_cmd_intr);
908 return ide_started; 907 return ide_started;
909 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { 908 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
@@ -971,7 +970,8 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
971 if (rc) 970 if (rc)
972 printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); 971 printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
973 SELECT_DRIVE(drive); 972 SELECT_DRIVE(drive);
974 HWIF(drive)->OUTB(8, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]); 973 if (IDE_CONTROL_REG)
974 HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
975 rc = ide_wait_not_busy(HWIF(drive), 100000); 975 rc = ide_wait_not_busy(HWIF(drive), 100000);
976 if (rc) 976 if (rc)
977 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); 977 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 95168833d069..bb9693dabe41 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -303,9 +303,6 @@ void default_hwif_transport(ide_hwif_t *hwif)
303 hwif->atapi_output_bytes = atapi_output_bytes; 303 hwif->atapi_output_bytes = atapi_output_bytes;
304} 304}
305 305
306/*
307 * Beginning of Taskfile OPCODE Library and feature sets.
308 */
309void ide_fix_driveid (struct hd_driveid *id) 306void ide_fix_driveid (struct hd_driveid *id)
310{ 307{
311#ifndef __LITTLE_ENDIAN 308#ifndef __LITTLE_ENDIAN
@@ -403,8 +400,12 @@ void ide_fix_driveid (struct hd_driveid *id)
403#endif 400#endif
404} 401}
405 402
406/* FIXME: exported for use by the USB storage (isd200.c) code only */ 403/*
407EXPORT_SYMBOL(ide_fix_driveid); 404 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
405 * removing leading/trailing blanks and compressing internal blanks.
406 * It is primarily used to tidy up the model name/number fields as
407 * returned by the WIN_[P]IDENTIFY commands.
408 */
408 409
409void ide_fixstring (u8 *s, const int bytecount, const int byteswap) 410void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
410{ 411{
@@ -582,9 +583,15 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list);
582/* 583/*
583 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. 584 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid.
584 * We list them here and depend on the device side cable detection for them. 585 * We list them here and depend on the device side cable detection for them.
586 *
587 * Some optical devices with the buggy firmwares have the same problem.
585 */ 588 */
586static const struct drive_list_entry ivb_list[] = { 589static const struct drive_list_entry ivb_list[] = {
587 { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, 590 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
591 { "TSSTcorp CDDVDW SH-S202J" , "SB00" },
592 { "TSSTcorp CDDVDW SH-S202J" , "SB01" },
593 { "TSSTcorp CDDVDW SH-S202N" , "SB00" },
594 { "TSSTcorp CDDVDW SH-S202N" , "SB01" },
588 { NULL , NULL } 595 { NULL , NULL }
589}; 596};
590 597
@@ -605,12 +612,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
605 printk(KERN_DEBUG "%s: skipping word 93 validity check\n", 612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
606 drive->name); 613 drive->name);
607 614
615 if (ide_dev_is_sata(id) && !ivb)
616 return 1;
617
608 if (hwif->cbl != ATA_CBL_PATA80 && !ivb) 618 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
609 goto no_80w; 619 goto no_80w;
610 620
611 if (ide_dev_is_sata(id))
612 return 1;
613
614 /* 621 /*
615 * FIXME: 622 * FIXME:
616 * - force bit13 (80c cable present) check also for !ivb devices 623 * - force bit13 (80c cable present) check also for !ivb devices
@@ -741,6 +748,9 @@ int ide_driveid_update(ide_drive_t *drive)
741 drive->id->dma_1word = id->dma_1word; 748 drive->id->dma_1word = id->dma_1word;
742 /* anything more ? */ 749 /* anything more ? */
743 kfree(id); 750 kfree(id);
751
752 if (drive->using_dma && ide_id_dma_bug(drive))
753 ide_dma_off(drive);
744 } 754 }
745 755
746 return 1; 756 return 1;
@@ -749,7 +759,7 @@ int ide_driveid_update(ide_drive_t *drive)
749int ide_config_drive_speed(ide_drive_t *drive, u8 speed) 759int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
750{ 760{
751 ide_hwif_t *hwif = drive->hwif; 761 ide_hwif_t *hwif = drive->hwif;
752 int error; 762 int error = 0;
753 u8 stat; 763 u8 stat;
754 764
755// while (HWGROUP(drive)->busy) 765// while (HWGROUP(drive)->busy)
@@ -760,6 +770,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
760 hwif->dma_host_off(drive); 770 hwif->dma_host_off(drive);
761#endif 771#endif
762 772
773 /* Skip setting PIO flow-control modes on pre-EIDE drives */
774 if ((speed & 0xf8) == XFER_PIO_0 && !(drive->id->capability & 0x08))
775 goto skip;
776
763 /* 777 /*
764 * Don't use ide_wait_cmd here - it will 778 * Don't use ide_wait_cmd here - it will
765 * attempt to set_geometry and recalibrate, 779 * attempt to set_geometry and recalibrate,
@@ -807,6 +821,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
807 drive->id->dma_mword &= ~0x0F00; 821 drive->id->dma_mword &= ~0x0F00;
808 drive->id->dma_1word &= ~0x0F00; 822 drive->id->dma_1word &= ~0x0F00;
809 823
824 skip:
810#ifdef CONFIG_BLK_DEV_IDEDMA 825#ifdef CONFIG_BLK_DEV_IDEDMA
811 if (speed >= XFER_SW_DMA_0) 826 if (speed >= XFER_SW_DMA_0)
812 hwif->dma_host_on(drive); 827 hwif->dma_host_on(drive);
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index af86433baede..062d3bcb2471 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -29,41 +29,44 @@
29 * Add common non I/O op stuff here. Make sure it has proper 29 * Add common non I/O op stuff here. Make sure it has proper
30 * kernel-doc function headers or your patch will be rejected 30 * kernel-doc function headers or your patch will be rejected
31 */ 31 */
32 32
33static const char *udma_str[] =
34 { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44",
35 "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" };
36static const char *mwdma_str[] =
37 { "MWDMA0", "MWDMA1", "MWDMA2" };
38static const char *swdma_str[] =
39 { "SWDMA0", "SWDMA1", "SWDMA2" };
40static const char *pio_str[] =
41 { "PIO0", "PIO1", "PIO2", "PIO3", "PIO4", "PIO5" };
33 42
34/** 43/**
35 * ide_xfer_verbose - return IDE mode names 44 * ide_xfer_verbose - return IDE mode names
36 * @xfer_rate: rate to name 45 * @mode: transfer mode
37 * 46 *
38 * Returns a constant string giving the name of the mode 47 * Returns a constant string giving the name of the mode
39 * requested. 48 * requested.
40 */ 49 */
41 50
42char *ide_xfer_verbose (u8 xfer_rate) 51const char *ide_xfer_verbose(u8 mode)
43{ 52{
44 switch(xfer_rate) { 53 const char *s;
45 case XFER_UDMA_7: return("UDMA 7"); 54 u8 i = mode & 0xf;
46 case XFER_UDMA_6: return("UDMA 6"); 55
47 case XFER_UDMA_5: return("UDMA 5"); 56 if (mode >= XFER_UDMA_0 && mode <= XFER_UDMA_7)
48 case XFER_UDMA_4: return("UDMA 4"); 57 s = udma_str[i];
49 case XFER_UDMA_3: return("UDMA 3"); 58 else if (mode >= XFER_MW_DMA_0 && mode <= XFER_MW_DMA_2)
50 case XFER_UDMA_2: return("UDMA 2"); 59 s = mwdma_str[i];
51 case XFER_UDMA_1: return("UDMA 1"); 60 else if (mode >= XFER_SW_DMA_0 && mode <= XFER_SW_DMA_2)
52 case XFER_UDMA_0: return("UDMA 0"); 61 s = swdma_str[i];
53 case XFER_MW_DMA_2: return("MW DMA 2"); 62 else if (mode >= XFER_PIO_0 && mode <= XFER_PIO_5)
54 case XFER_MW_DMA_1: return("MW DMA 1"); 63 s = pio_str[i & 0x7];
55 case XFER_MW_DMA_0: return("MW DMA 0"); 64 else if (mode == XFER_PIO_SLOW)
56 case XFER_SW_DMA_2: return("SW DMA 2"); 65 s = "PIO SLOW";
57 case XFER_SW_DMA_1: return("SW DMA 1"); 66 else
58 case XFER_SW_DMA_0: return("SW DMA 0"); 67 s = "XFER ERROR";
59 case XFER_PIO_4: return("PIO 4"); 68
60 case XFER_PIO_3: return("PIO 3"); 69 return s;
61 case XFER_PIO_2: return("PIO 2");
62 case XFER_PIO_1: return("PIO 1");
63 case XFER_PIO_0: return("PIO 0");
64 case XFER_PIO_SLOW: return("PIO SLOW");
65 default: return("XFER ERROR");
66 }
67} 70}
68 71
69EXPORT_SYMBOL(ide_xfer_verbose); 72EXPORT_SYMBOL(ide_xfer_verbose);
@@ -514,6 +517,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
514 if (drive->addressing == 1) { 517 if (drive->addressing == 1) {
515 __u64 sectors = 0; 518 __u64 sectors = 0;
516 u32 low = 0, high = 0; 519 u32 low = 0, high = 0;
520 hwif->OUTB(drive->ctl&~0x80, IDE_CONTROL_REG);
517 low = ide_read_24(drive); 521 low = ide_read_24(drive);
518 hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); 522 hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
519 high = ide_read_24(drive); 523 high = ide_read_24(drive);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 6a6f2e066b46..2994523be7bf 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -13,22 +13,8 @@
13 * 13 *
14 * This is the IDE probe module, as evolved from hd.c and ide.c. 14 * This is the IDE probe module, as evolved from hd.c and ide.c.
15 * 15 *
16 * Version 1.00 move drive probing code from ide.c to ide-probe.c 16 * -- increase WAIT_PIDENTIFY to avoid CD-ROM locking at boot
17 * Version 1.01 fix compilation problem for m68k 17 * by Andrea Arcangeli
18 * Version 1.02 increase WAIT_PIDENTIFY to avoid CD-ROM locking at boot
19 * by Andrea Arcangeli
20 * Version 1.03 fix for (hwif->chipset == ide_4drives)
21 * Version 1.04 fixed buggy treatments of known flash memory cards
22 *
23 * Version 1.05 fix for (hwif->chipset == ide_pdc4030)
24 * added ide6/7/8/9
25 * allowed for secondary flash card to be detectable
26 * with new flag : drive->ata_flash : 1;
27 * Version 1.06 stream line request queue and prep for cascade project.
28 * Version 1.07 max_sect <= 255; slower disks would get behind and
29 * then fall over when they get to 256. Paul G.
30 * Version 1.10 Update set for new IDE. drive->id is now always
31 * valid after probe time even with noprobe
32 */ 18 */
33 19
34#include <linux/module.h> 20#include <linux/module.h>
@@ -172,11 +158,12 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
172 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); 158 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap);
173 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); 159 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap);
174 160
161 /* we depend on this a lot! */
162 id->model[sizeof(id->model)-1] = '\0';
163
175 if (strstr(id->model, "E X A B Y T E N E S T")) 164 if (strstr(id->model, "E X A B Y T E N E S T"))
176 goto err_misc; 165 goto err_misc;
177 166
178 /* we depend on this a lot! */
179 id->model[sizeof(id->model)-1] = '\0';
180 printk("%s: %s, ", drive->name, id->model); 167 printk("%s: %s, ", drive->name, id->model);
181 drive->present = 1; 168 drive->present = 1;
182 drive->dead = 0; 169 drive->dead = 0;
@@ -643,7 +630,7 @@ static void hwif_register (ide_hwif_t *hwif)
643 630
644static int wait_hwif_ready(ide_hwif_t *hwif) 631static int wait_hwif_ready(ide_hwif_t *hwif)
645{ 632{
646 int rc; 633 int unit, rc;
647 634
648 printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); 635 printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);
649 636
@@ -660,20 +647,27 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
660 return rc; 647 return rc;
661 648
662 /* Now make sure both master & slave are ready */ 649 /* Now make sure both master & slave are ready */
663 SELECT_DRIVE(&hwif->drives[0]); 650 for (unit = 0; unit < MAX_DRIVES; unit++) {
664 hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); 651 ide_drive_t *drive = &hwif->drives[unit];
665 mdelay(2);
666 rc = ide_wait_not_busy(hwif, 35000);
667 if (rc)
668 return rc;
669 SELECT_DRIVE(&hwif->drives[1]);
670 hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
671 mdelay(2);
672 rc = ide_wait_not_busy(hwif, 35000);
673 652
653 /* Ignore disks that we will not probe for later. */
654 if (!drive->noprobe || drive->present) {
655 SELECT_DRIVE(drive);
656 if (IDE_CONTROL_REG)
657 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
658 mdelay(2);
659 rc = ide_wait_not_busy(hwif, 35000);
660 if (rc)
661 goto out;
662 } else
663 printk(KERN_DEBUG "%s: ide_wait_not_busy() skipped\n",
664 drive->name);
665 }
666out:
674 /* Exit function with master reselected (let's be sane) */ 667 /* Exit function with master reselected (let's be sane) */
675 SELECT_DRIVE(&hwif->drives[0]); 668 if (unit)
676 669 SELECT_DRIVE(&hwif->drives[0]);
670
677 return rc; 671 return rc;
678} 672}
679 673
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index d066546f2831..2b60f1b0437e 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -471,6 +471,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
471 struct request rq; 471 struct request rq;
472 472
473 memset(&rq, 0, sizeof(rq)); 473 memset(&rq, 0, sizeof(rq));
474 rq.ref_count = 1;
474 rq.cmd_type = REQ_TYPE_ATA_TASKFILE; 475 rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
475 rq.buffer = buf; 476 rq.buffer = buf;
476 477
@@ -511,6 +512,7 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf)
511 512
512EXPORT_SYMBOL(ide_raw_taskfile); 513EXPORT_SYMBOL(ide_raw_taskfile);
513 514
515#ifdef CONFIG_IDE_TASK_IOCTL
514int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 516int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
515{ 517{
516 ide_task_request_t *req_task; 518 ide_task_request_t *req_task;
@@ -660,6 +662,7 @@ abort:
660 662
661 return err; 663 return err;
662} 664}
665#endif
663 666
664int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) 667int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf)
665{ 668{
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 674a65c1a130..54943da6e4e5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -800,11 +800,17 @@ int set_io_32bit(ide_drive_t *drive, int arg)
800 if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) 800 if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1))
801 return -EINVAL; 801 return -EINVAL;
802 802
803 if (ide_spin_wait_hwgroup(drive))
804 return -EBUSY;
805
803 drive->io_32bit = arg; 806 drive->io_32bit = arg;
804#ifdef CONFIG_BLK_DEV_DTC2278 807#ifdef CONFIG_BLK_DEV_DTC2278
805 if (HWIF(drive)->chipset == ide_dtc2278) 808 if (HWIF(drive)->chipset == ide_dtc2278)
806 HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg; 809 HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg;
807#endif /* CONFIG_BLK_DEV_DTC2278 */ 810#endif /* CONFIG_BLK_DEV_DTC2278 */
811
812 spin_unlock_irq(&ide_lock);
813
808 return 0; 814 return 0;
809} 815}
810 816
@@ -1670,10 +1676,34 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
1670 return sprintf(buf, "ide:m-%s\n", media_string(drive)); 1676 return sprintf(buf, "ide:m-%s\n", media_string(drive));
1671} 1677}
1672 1678
1679static ssize_t model_show(struct device *dev, struct device_attribute *attr,
1680 char *buf)
1681{
1682 ide_drive_t *drive = to_ide_device(dev);
1683 return sprintf(buf, "%s\n", drive->id->model);
1684}
1685
1686static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
1687 char *buf)
1688{
1689 ide_drive_t *drive = to_ide_device(dev);
1690 return sprintf(buf, "%s\n", drive->id->fw_rev);
1691}
1692
1693static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
1694 char *buf)
1695{
1696 ide_drive_t *drive = to_ide_device(dev);
1697 return sprintf(buf, "%s\n", drive->id->serial_no);
1698}
1699
1673static struct device_attribute ide_dev_attrs[] = { 1700static struct device_attribute ide_dev_attrs[] = {
1674 __ATTR_RO(media), 1701 __ATTR_RO(media),
1675 __ATTR_RO(drivename), 1702 __ATTR_RO(drivename),
1676 __ATTR_RO(modalias), 1703 __ATTR_RO(modalias),
1704 __ATTR_RO(model),
1705 __ATTR_RO(firmware),
1706 __ATTR(serial, 0400, serial_show, NULL),
1677 __ATTR_NULL 1707 __ATTR_NULL
1678}; 1708};
1679 1709
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 10311ecc674a..38c3a6d63f30 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -53,12 +53,13 @@
53 53
54/* port addresses for auto-detection */ 54/* port addresses for auto-detection */
55#define ALI_NUM_PORTS 4 55#define ALI_NUM_PORTS 4
56static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4}; 56static const int ports[ALI_NUM_PORTS] __initdata =
57 { 0x074, 0x0f4, 0x034, 0x0e4 };
57 58
58/* register initialization data */ 59/* register initialization data */
59typedef struct { u8 reg, data; } RegInitializer; 60typedef struct { u8 reg, data; } RegInitializer;
60 61
61static RegInitializer initData[] __initdata = { 62static const RegInitializer initData[] __initdata = {
62 {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00}, 63 {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00},
63 {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f}, 64 {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f},
64 {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00}, 65 {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00},
@@ -177,7 +178,7 @@ static int __init findPort (void)
177 * Initialize controller registers with default values. 178 * Initialize controller registers with default values.
178 */ 179 */
179static int __init initRegisters (void) { 180static int __init initRegisters (void) {
180 RegInitializer *p; 181 const RegInitializer *p;
181 u8 t; 182 u8 t;
182 unsigned long flags; 183 unsigned long flags;
183 184
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index e87cd2f16430..5c6aa77c2370 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -81,7 +81,7 @@ int macide_ack_intr(ide_hwif_t* hwif)
81 * Probe for a Macintosh IDE interface 81 * Probe for a Macintosh IDE interface
82 */ 82 */
83 83
84void macide_init(void) 84void __init macide_init(void)
85{ 85{
86 hw_regs_t hw; 86 hw_regs_t hw;
87 ide_hwif_t *hwif; 87 ide_hwif_t *hwif;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index a73db1bd482d..6ea46a6723e2 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -111,7 +111,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
111 * Probe for Q40 IDE interfaces 111 * Probe for Q40 IDE interfaces
112 */ 112 */
113 113
114void q40ide_init(void) 114void __init q40ide_init(void)
115{ 115{
116 int i; 116 int i;
117 ide_hwif_t *hwif; 117 ide_hwif_t *hwif;
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 19ec421f7b9f..44268504ae43 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -260,6 +260,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
260{ 260{
261 struct ide_port_info d; 261 struct ide_port_info d;
262 u8 idx = id->driver_data; 262 u8 idx = id->driver_data;
263 int err;
264
265 err = pci_enable_device(dev);
266 if (err)
267 return err;
263 268
264 d = aec62xx_chipsets[idx]; 269 d = aec62xx_chipsets[idx];
265 270
@@ -272,7 +277,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
272 } 277 }
273 } 278 }
274 279
275 return ide_setup_pci_device(dev, &d); 280 err = ide_setup_pci_device(dev, &d);
281 if (err)
282 pci_disable_device(dev);
283
284 return err;
276} 285}
277 286
278static const struct pci_device_id aec62xx_pci_tbl[] = { 287static const struct pci_device_id aec62xx_pci_tbl[] = {
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index a607dd31a64c..ce293936af4b 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -603,6 +603,11 @@ static int ali_cable_override(struct pci_dev *pdev)
603 pdev->subsystem_device == 0x10AF) 603 pdev->subsystem_device == 0x10AF)
604 return 1; 604 return 1;
605 605
606 /* Mitac 8317 (Winbook-A) and relatives */
607 if (pdev->subsystem_vendor == 0x1071 &&
608 pdev->subsystem_device == 0x8317)
609 return 1;
610
606 /* Systems by DMI */ 611 /* Systems by DMI */
607 if (dmi_check_system(cable_dmi_table)) 612 if (dmi_check_system(cable_dmi_table))
608 return 1; 613 return 1;
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index ea0143ef5fe5..bc553337b1be 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cmd64x.c Version 1.50 May 10, 2007 2 * linux/drivers/ide/pci/cmd64x.c Version 1.52 Dec 24, 2007
3 * 3 *
4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
5 * Due to massive hardware bugs, UltraDMA is only supported 5 * Due to massive hardware bugs, UltraDMA is only supported
@@ -339,7 +339,8 @@ static int cmd648_ide_dma_end (ide_drive_t *drive)
339 u8 mrdmode = inb(hwif->dma_master + 0x01); 339 u8 mrdmode = inb(hwif->dma_master + 0x01);
340 340
341 /* clear the interrupt bit */ 341 /* clear the interrupt bit */
342 outb(mrdmode | irq_mask, hwif->dma_master + 0x01); 342 outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask,
343 hwif->dma_master + 0x01);
343 344
344 return err; 345 return err;
345} 346}
@@ -563,6 +564,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
563 .init_chipset = init_chipset_cmd64x, 564 .init_chipset = init_chipset_cmd64x,
564 .init_hwif = init_hwif_cmd64x, 565 .init_hwif = init_hwif_cmd64x,
565 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 566 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
567 .chipset = ide_cmd646,
566 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 568 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
567 .pio_mask = ATA_PIO5, 569 .pio_mask = ATA_PIO5,
568 .mwdma_mask = ATA_MWDMA2, 570 .mwdma_mask = ATA_MWDMA2,
@@ -572,7 +574,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
572 .init_chipset = init_chipset_cmd64x, 574 .init_chipset = init_chipset_cmd64x,
573 .init_hwif = init_hwif_cmd64x, 575 .init_hwif = init_hwif_cmd64x,
574 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 576 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
575 .chipset = ide_cmd646,
576 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 577 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
577 .pio_mask = ATA_PIO5, 578 .pio_mask = ATA_PIO5,
578 .mwdma_mask = ATA_MWDMA2, 579 .mwdma_mask = ATA_MWDMA2,
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 599408952bd4..547690395eee 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -117,8 +117,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
117 case XFER_MW_DMA_1: timings = 0x00012121; break; 117 case XFER_MW_DMA_1: timings = 0x00012121; break;
118 case XFER_MW_DMA_2: timings = 0x00002020; break; 118 case XFER_MW_DMA_2: timings = 0x00002020; break;
119 default: 119 default:
120 BUG(); 120 return;
121 break;
122 } 121 }
123 basereg = CS5530_BASEREG(drive->hwif); 122 basereg = CS5530_BASEREG(drive->hwif);
124 reg = inl(basereg + 4); /* get drive0 config register */ 123 reg = inl(basereg + 4); /* get drive0 config register */
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 9094916e3780..ddcbeba671e1 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -49,7 +49,7 @@
49#define ATAC_BM0_PRD 0x04 49#define ATAC_BM0_PRD 0x04
50#define CS5535_CABLE_DETECT 0x48 50#define CS5535_CABLE_DETECT 0x48
51 51
52/* Format I PIO settings. We seperate out cmd and data for safer timings */ 52/* Format I PIO settings. We separate out cmd and data for safer timings */
53 53
54static unsigned int cs5535_pio_cmd_timings[5] = 54static unsigned int cs5535_pio_cmd_timings[5] =
55{ 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 }; 55{ 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 };
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 3ef4fc10fe2c..1cd4e9cb0521 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cy82c693.c Version 0.41 Aug 27, 2007 2 * linux/drivers/ide/pci/cy82c693.c Version 0.42 Oct 23, 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer 4 * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer
5 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator 5 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator
@@ -436,10 +436,10 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
436 hwif->ide_dma_on = &cy82c693_ide_dma_on; 436 hwif->ide_dma_on = &cy82c693_ide_dma_on;
437} 437}
438 438
439static __devinitdata ide_hwif_t *primary;
440
441static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) 439static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
442{ 440{
441 static ide_hwif_t *primary;
442
443 if (PCI_FUNC(hwif->pci_dev->devfn) == 1) 443 if (PCI_FUNC(hwif->pci_dev->devfn) == 1)
444 primary = hwif; 444 primary = hwif;
445 else { 445 else {
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index f44d70852c3c..06885697ed7b 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -49,7 +49,7 @@ static int __init ide_generic_all_on(char *unused)
49 printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n"); 49 printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n");
50 return 1; 50 return 1;
51} 51}
52__setup("all-generic-ide", ide_generic_all_on); 52const __setup("all-generic-ide", ide_generic_all_on);
53#endif 53#endif
54module_param_named(all_generic_ide, ide_generic_all, bool, 0444); 54module_param_named(all_generic_ide, ide_generic_all, bool, 0444);
55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); 55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers.");
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 612b795241bf..9fce25bdec8a 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.20 Oct 1, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.22 Dec 4, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -310,6 +310,8 @@ static u32 twenty_five_base_hpt36x[] = {
310 /* XFER_PIO_0 */ 0xc0d08585 310 /* XFER_PIO_0 */ 0xc0d08585
311}; 311};
312 312
313#if 0
314/* These are the timing tables from the HighPoint open source drivers... */
313static u32 thirty_three_base_hpt37x[] = { 315static u32 thirty_three_base_hpt37x[] = {
314 /* XFER_UDMA_6 */ 0x12446231, /* 0x12646231 ?? */ 316 /* XFER_UDMA_6 */ 0x12446231, /* 0x12646231 ?? */
315 /* XFER_UDMA_5 */ 0x12446231, 317 /* XFER_UDMA_5 */ 0x12446231,
@@ -369,6 +371,73 @@ static u32 sixty_six_base_hpt37x[] = {
369 /* XFER_PIO_1 */ 0x0d029d26, 371 /* XFER_PIO_1 */ 0x0d029d26,
370 /* XFER_PIO_0 */ 0x0d029d5e 372 /* XFER_PIO_0 */ 0x0d029d5e
371}; 373};
374#else
375/*
376 * The following are the new timing tables with PIO mode data/taskfile transfer
377 * overclocking fixed...
378 */
379
380/* This table is taken from the HPT370 data manual rev. 1.02 */
381static u32 thirty_three_base_hpt37x[] = {
382 /* XFER_UDMA_6 */ 0x16455031, /* 0x16655031 ?? */
383 /* XFER_UDMA_5 */ 0x16455031,
384 /* XFER_UDMA_4 */ 0x16455031,
385 /* XFER_UDMA_3 */ 0x166d5031,
386 /* XFER_UDMA_2 */ 0x16495031,
387 /* XFER_UDMA_1 */ 0x164d5033,
388 /* XFER_UDMA_0 */ 0x16515097,
389
390 /* XFER_MW_DMA_2 */ 0x26515031,
391 /* XFER_MW_DMA_1 */ 0x26515033,
392 /* XFER_MW_DMA_0 */ 0x26515097,
393
394 /* XFER_PIO_4 */ 0x06515021,
395 /* XFER_PIO_3 */ 0x06515022,
396 /* XFER_PIO_2 */ 0x06515033,
397 /* XFER_PIO_1 */ 0x06915065,
398 /* XFER_PIO_0 */ 0x06d1508a
399};
400
401static u32 fifty_base_hpt37x[] = {
402 /* XFER_UDMA_6 */ 0x1a861842,
403 /* XFER_UDMA_5 */ 0x1a861842,
404 /* XFER_UDMA_4 */ 0x1aae1842,
405 /* XFER_UDMA_3 */ 0x1a8e1842,
406 /* XFER_UDMA_2 */ 0x1a0e1842,
407 /* XFER_UDMA_1 */ 0x1a161854,
408 /* XFER_UDMA_0 */ 0x1a1a18ea,
409
410 /* XFER_MW_DMA_2 */ 0x2a821842,
411 /* XFER_MW_DMA_1 */ 0x2a821854,
412 /* XFER_MW_DMA_0 */ 0x2a8218ea,
413
414 /* XFER_PIO_4 */ 0x0a821842,
415 /* XFER_PIO_3 */ 0x0a821843,
416 /* XFER_PIO_2 */ 0x0a821855,
417 /* XFER_PIO_1 */ 0x0ac218a8,
418 /* XFER_PIO_0 */ 0x0b02190c
419};
420
421static u32 sixty_six_base_hpt37x[] = {
422 /* XFER_UDMA_6 */ 0x1c86fe62,
423 /* XFER_UDMA_5 */ 0x1caefe62, /* 0x1c8afe62 */
424 /* XFER_UDMA_4 */ 0x1c8afe62,
425 /* XFER_UDMA_3 */ 0x1c8efe62,
426 /* XFER_UDMA_2 */ 0x1c92fe62,
427 /* XFER_UDMA_1 */ 0x1c9afe62,
428 /* XFER_UDMA_0 */ 0x1c82fe62,
429
430 /* XFER_MW_DMA_2 */ 0x2c82fe62,
431 /* XFER_MW_DMA_1 */ 0x2c82fe66,
432 /* XFER_MW_DMA_0 */ 0x2c82ff2e,
433
434 /* XFER_PIO_4 */ 0x0c82fe62,
435 /* XFER_PIO_3 */ 0x0c82fe84,
436 /* XFER_PIO_2 */ 0x0c82fea6,
437 /* XFER_PIO_1 */ 0x0d02ff26,
438 /* XFER_PIO_0 */ 0x0d42ff7f
439};
440#endif
372 441
373#define HPT366_DEBUG_DRIVE_INFO 0 442#define HPT366_DEBUG_DRIVE_INFO 0
374#define HPT371_ALLOW_ATA133_6 1 443#define HPT371_ALLOW_ATA133_6 1
@@ -433,7 +502,7 @@ static u32 *hpt37x_settings[NUM_ATA_CLOCKS] = {
433 sixty_six_base_hpt37x 502 sixty_six_base_hpt37x
434}; 503};
435 504
436static struct hpt_info hpt36x __devinitdata = { 505static const struct hpt_info hpt36x __devinitdata = {
437 .chip_name = "HPT36x", 506 .chip_name = "HPT36x",
438 .chip_type = HPT36x, 507 .chip_type = HPT36x,
439 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, 508 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2,
@@ -441,7 +510,7 @@ static struct hpt_info hpt36x __devinitdata = {
441 .settings = hpt36x_settings 510 .settings = hpt36x_settings
442}; 511};
443 512
444static struct hpt_info hpt370 __devinitdata = { 513static const struct hpt_info hpt370 __devinitdata = {
445 .chip_name = "HPT370", 514 .chip_name = "HPT370",
446 .chip_type = HPT370, 515 .chip_type = HPT370,
447 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, 516 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
@@ -449,7 +518,7 @@ static struct hpt_info hpt370 __devinitdata = {
449 .settings = hpt37x_settings 518 .settings = hpt37x_settings
450}; 519};
451 520
452static struct hpt_info hpt370a __devinitdata = { 521static const struct hpt_info hpt370a __devinitdata = {
453 .chip_name = "HPT370A", 522 .chip_name = "HPT370A",
454 .chip_type = HPT370A, 523 .chip_type = HPT370A,
455 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, 524 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
@@ -457,7 +526,7 @@ static struct hpt_info hpt370a __devinitdata = {
457 .settings = hpt37x_settings 526 .settings = hpt37x_settings
458}; 527};
459 528
460static struct hpt_info hpt374 __devinitdata = { 529static const struct hpt_info hpt374 __devinitdata = {
461 .chip_name = "HPT374", 530 .chip_name = "HPT374",
462 .chip_type = HPT374, 531 .chip_type = HPT374,
463 .udma_mask = ATA_UDMA5, 532 .udma_mask = ATA_UDMA5,
@@ -465,7 +534,7 @@ static struct hpt_info hpt374 __devinitdata = {
465 .settings = hpt37x_settings 534 .settings = hpt37x_settings
466}; 535};
467 536
468static struct hpt_info hpt372 __devinitdata = { 537static const struct hpt_info hpt372 __devinitdata = {
469 .chip_name = "HPT372", 538 .chip_name = "HPT372",
470 .chip_type = HPT372, 539 .chip_type = HPT372,
471 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 540 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -473,7 +542,7 @@ static struct hpt_info hpt372 __devinitdata = {
473 .settings = hpt37x_settings 542 .settings = hpt37x_settings
474}; 543};
475 544
476static struct hpt_info hpt372a __devinitdata = { 545static const struct hpt_info hpt372a __devinitdata = {
477 .chip_name = "HPT372A", 546 .chip_name = "HPT372A",
478 .chip_type = HPT372A, 547 .chip_type = HPT372A,
479 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 548 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -481,7 +550,7 @@ static struct hpt_info hpt372a __devinitdata = {
481 .settings = hpt37x_settings 550 .settings = hpt37x_settings
482}; 551};
483 552
484static struct hpt_info hpt302 __devinitdata = { 553static const struct hpt_info hpt302 __devinitdata = {
485 .chip_name = "HPT302", 554 .chip_name = "HPT302",
486 .chip_type = HPT302, 555 .chip_type = HPT302,
487 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 556 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -489,7 +558,7 @@ static struct hpt_info hpt302 __devinitdata = {
489 .settings = hpt37x_settings 558 .settings = hpt37x_settings
490}; 559};
491 560
492static struct hpt_info hpt371 __devinitdata = { 561static const struct hpt_info hpt371 __devinitdata = {
493 .chip_name = "HPT371", 562 .chip_name = "HPT371",
494 .chip_type = HPT371, 563 .chip_type = HPT371,
495 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 564 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -497,7 +566,7 @@ static struct hpt_info hpt371 __devinitdata = {
497 .settings = hpt37x_settings 566 .settings = hpt37x_settings
498}; 567};
499 568
500static struct hpt_info hpt372n __devinitdata = { 569static const struct hpt_info hpt372n __devinitdata = {
501 .chip_name = "HPT372N", 570 .chip_name = "HPT372N",
502 .chip_type = HPT372N, 571 .chip_type = HPT372N,
503 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 572 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -505,7 +574,7 @@ static struct hpt_info hpt372n __devinitdata = {
505 .settings = hpt37x_settings 574 .settings = hpt37x_settings
506}; 575};
507 576
508static struct hpt_info hpt302n __devinitdata = { 577static const struct hpt_info hpt302n __devinitdata = {
509 .chip_name = "HPT302N", 578 .chip_name = "HPT302N",
510 .chip_type = HPT302N, 579 .chip_type = HPT302N,
511 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 580 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -513,7 +582,7 @@ static struct hpt_info hpt302n __devinitdata = {
513 .settings = hpt37x_settings 582 .settings = hpt37x_settings
514}; 583};
515 584
516static struct hpt_info hpt371n __devinitdata = { 585static const struct hpt_info hpt371n __devinitdata = {
517 .chip_name = "HPT371N", 586 .chip_name = "HPT371N",
518 .chip_type = HPT371N, 587 .chip_type = HPT371N,
519 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 588 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -1508,7 +1577,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1508 */ 1577 */
1509static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1578static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1510{ 1579{
1511 struct hpt_info *info = NULL; 1580 const struct hpt_info *info = NULL;
1512 struct pci_dev *dev2 = NULL; 1581 struct pci_dev *dev2 = NULL;
1513 struct ide_port_info d; 1582 struct ide_port_info d;
1514 u8 idx = id->driver_data; 1583 u8 idx = id->driver_data;
@@ -1522,7 +1591,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1522 if (rev < 3) 1591 if (rev < 3)
1523 info = &hpt36x; 1592 info = &hpt36x;
1524 else { 1593 else {
1525 static struct hpt_info *hpt37x_info[] = 1594 static const struct hpt_info *hpt37x_info[] =
1526 { &hpt370, &hpt370a, &hpt372, &hpt372n }; 1595 { &hpt370, &hpt370a, &hpt372, &hpt372n };
1527 1596
1528 info = hpt37x_info[min_t(u8, rev, 6) - 3]; 1597 info = hpt37x_info[min_t(u8, rev, 6) - 3];
@@ -1552,7 +1621,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1552 d.name = info->chip_name; 1621 d.name = info->chip_name;
1553 d.udma_mask = info->udma_mask; 1622 d.udma_mask = info->udma_mask;
1554 1623
1555 pci_set_drvdata(dev, info); 1624 pci_set_drvdata(dev, (void *)info);
1556 1625
1557 if (info == &hpt36x || info == &hpt374) 1626 if (info == &hpt36x || info == &hpt374)
1558 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 1627 dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
@@ -1560,7 +1629,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1560 if (dev2) { 1629 if (dev2) {
1561 int ret; 1630 int ret;
1562 1631
1563 pci_set_drvdata(dev2, info); 1632 pci_set_drvdata(dev2, (void *)info);
1564 1633
1565 if (info == &hpt374) 1634 if (info == &hpt374)
1566 hpt374_init(dev, dev2); 1635 hpt374_init(dev, dev2);
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 5c9975435319..99b7d763b6c7 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -653,8 +653,7 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = {
653 653
654static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 654static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
655{ 655{
656 ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); 656 return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]);
657 return 0;
658} 657}
659 658
660static const struct pci_device_id it821x_pci_tbl[] = { 659static const struct pci_device_id it821x_pci_tbl[] = {
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index bdf64d997708..0083eaf89c77 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -139,8 +139,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = {
139 139
140static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) 140static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
141{ 141{
142 ide_setup_pci_device(dev, &jmicron_chipset); 142 return ide_setup_pci_device(dev, &jmicron_chipset);
143 return 0;
144} 143}
145 144
146/* All JMB PATA controllers have and will continue to have the same 145/* All JMB PATA controllers have and will continue to have the same
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 4234efeba606..2b4f44e45a1a 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -482,8 +482,9 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev)
482{ 482{
483 struct pci_dev *dev2; 483 struct pci_dev *dev2;
484 484
485 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2, 485 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 1,
486 PCI_FUNC(dev->devfn))); 486 PCI_FUNC(dev->devfn)));
487
487 if (dev2 && 488 if (dev2 &&
488 dev2->vendor == dev->vendor && 489 dev2->vendor == dev->vendor &&
489 dev2->device == dev->device) { 490 dev2->device == dev->device) {
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 9329d4a810e5..27781d294cea 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -302,9 +302,11 @@ struct ich_laptop {
302 302
303static const struct ich_laptop ich_laptop[] = { 303static const struct ich_laptop ich_laptop[] = {
304 /* devid, subvendor, subdev */ 304 /* devid, subvendor, subdev */
305 { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */
305 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 306 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
306 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 307 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
307 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 308 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
309 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */
308 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ 310 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */
309 /* end marker */ 311 /* end marker */
310 { 0, } 312 { 0, }
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index d2c8b5524f28..707d5ff66b03 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -186,8 +186,7 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
186 } 186 }
187 break; 187 break;
188 default: 188 default:
189 BUG(); 189 return;
190 break;
191 } 190 }
192 191
193 if (unit == 0) { /* are we configuring drive0? */ 192 if (unit == 0) { /* are we configuring drive0? */
@@ -324,17 +323,18 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
324 323
325 pci_disable_device(dev); 324 pci_disable_device(dev);
326 pci_set_power_state(dev, pci_choose_state(dev, state)); 325 pci_set_power_state(dev, pci_choose_state(dev, state));
327 dev->current_state = state.event;
328 return 0; 326 return 0;
329} 327}
330 328
331static int sc1200_resume (struct pci_dev *dev) 329static int sc1200_resume (struct pci_dev *dev)
332{ 330{
333 ide_hwif_t *hwif = NULL; 331 ide_hwif_t *hwif = NULL;
332 int i;
333
334 i = pci_enable_device(dev);
335 if (i)
336 return i;
334 337
335 pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state
336 dev->current_state = PM_EVENT_ON;
337 pci_enable_device(dev);
338 // 338 //
339 // loop over all interfaces that are part of this pci device: 339 // loop over all interfaces that are part of this pci device:
340 // 340 //
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 6d99441c605b..5709c252543b 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 2 * linux/drivers/ide/pci/siimage.c Version 1.19 Nov 16 2007
3 * 3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
@@ -460,48 +460,6 @@ static void sil_sata_pre_reset(ide_drive_t *drive)
460} 460}
461 461
462/** 462/**
463 * siimage_reset - reset a device on an siimage controller
464 * @drive: drive to reset
465 *
466 * Perform a controller level reset fo the device. For
467 * SATA we must also check the PHY.
468 */
469
470static void siimage_reset (ide_drive_t *drive)
471{
472 ide_hwif_t *hwif = HWIF(drive);
473 u8 reset = 0;
474 unsigned long addr = siimage_selreg(hwif, 0);
475
476 if (hwif->mmio) {
477 reset = hwif->INB(addr);
478 hwif->OUTB((reset|0x03), addr);
479 /* FIXME:posting */
480 udelay(25);
481 hwif->OUTB(reset, addr);
482 (void) hwif->INB(addr);
483 } else {
484 pci_read_config_byte(hwif->pci_dev, addr, &reset);
485 pci_write_config_byte(hwif->pci_dev, addr, reset|0x03);
486 udelay(25);
487 pci_write_config_byte(hwif->pci_dev, addr, reset);
488 pci_read_config_byte(hwif->pci_dev, addr, &reset);
489 }
490
491 if (SATA_STATUS_REG) {
492 /* SATA_STATUS_REG is valid only when in MMIO mode */
493 u32 sata_stat = readl((void __iomem *)SATA_STATUS_REG);
494 printk(KERN_WARNING "%s: reset phy, status=0x%08x, %s\n",
495 hwif->name, sata_stat, __FUNCTION__);
496 if (!(sata_stat)) {
497 printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
498 hwif->name, sata_stat);
499 drive->failures++;
500 }
501 }
502}
503
504/**
505 * proc_reports_siimage - add siimage controller to proc 463 * proc_reports_siimage - add siimage controller to proc
506 * @dev: PCI device 464 * @dev: PCI device
507 * @clocking: SCSC value 465 * @clocking: SCSC value
@@ -857,7 +815,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
857{ 815{
858 u8 sata = is_sata(hwif); 816 u8 sata = is_sata(hwif);
859 817
860 hwif->resetproc = &siimage_reset;
861 hwif->set_pio_mode = &sil_set_pio_mode; 818 hwif->set_pio_mode = &sil_set_pio_mode;
862 hwif->set_dma_mode = &sil_set_dma_mode; 819 hwif->set_dma_mode = &sil_set_dma_mode;
863 820
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 6b7bb53acefd..d90b42917775 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -356,7 +356,6 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed)
356 sis_program_timings(drive, speed); 356 sis_program_timings(drive, speed);
357 break; 357 break;
358 default: 358 default:
359 BUG();
360 break; 359 break;
361 } 360 }
362} 361}
@@ -527,6 +526,7 @@ static const struct sis_laptop sis_laptop[] = {
527 /* devid, subvendor, subdev */ 526 /* devid, subvendor, subdev */
528 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 527 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
529 { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ 528 { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */
529 { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */
530 /* end marker */ 530 /* end marker */
531 { 0, } 531 { 0, }
532}; 532};
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 5011ba22e36c..0151d7fdfb8a 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * linux/drivers/ide/pci/trm290.c Version 1.02 Mar. 18, 2000 2 * linux/drivers/ide/pci/trm290.c Version 1.05 Dec. 26, 2007
3 * 3 *
4 * Copyright (c) 1997-1998 Mark Lord 4 * Copyright (c) 1997-1998 Mark Lord
5 * Copyright (c) 2007 MontaVista Software, Inc. <source@mvista.com>
5 * May be copied or modified under the terms of the GNU General Public License 6 * May be copied or modified under the terms of the GNU General Public License
6 * 7 *
7 * June 22, 2004 - get rid of check_region 8 * June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive_t *drive)
177 trm290_prepare_drive(drive, drive->using_dma); 178 trm290_prepare_drive(drive, drive->using_dma);
178} 179}
179 180
180static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) 181static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
181{ 182{
182 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ 183 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */
183 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); 184 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
185 outb(command, IDE_COMMAND_REG); 186 outb(command, IDE_COMMAND_REG);
186} 187}
187 188
188static int trm290_ide_dma_setup(ide_drive_t *drive) 189static int trm290_dma_setup(ide_drive_t *drive)
189{ 190{
190 ide_hwif_t *hwif = drive->hwif; 191 ide_hwif_t *hwif = drive->hwif;
191 struct request *rq = hwif->hwgroup->rq; 192 struct request *rq = hwif->hwgroup->rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_drive_t *drive)
215 return 0; 216 return 0;
216} 217}
217 218
218static void trm290_ide_dma_start(ide_drive_t *drive) 219static void trm290_dma_start(ide_drive_t *drive)
219{ 220{
220} 221}
221 222
@@ -240,9 +241,14 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
240 return (status == 0x00ff); 241 return (status == 0x00ff);
241} 242}
242 243
243/* 244static void trm290_dma_host_on(ide_drive_t *drive)
244 * Invoked from ide-dma.c at boot time. 245{
245 */ 246}
247
248static void trm290_dma_host_off(ide_drive_t *drive)
249{
250}
251
246static void __devinit init_hwif_trm290(ide_hwif_t *hwif) 252static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
247{ 253{
248 unsigned int cfgbase = 0; 254 unsigned int cfgbase = 0;
@@ -283,11 +289,13 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
283 289
284 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); 290 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
285 291
286 hwif->dma_setup = &trm290_ide_dma_setup; 292 hwif->dma_host_off = &trm290_dma_host_off;
287 hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd; 293 hwif->dma_host_on = &trm290_dma_host_on;
288 hwif->dma_start = &trm290_ide_dma_start; 294 hwif->dma_setup = &trm290_dma_setup;
289 hwif->ide_dma_end = &trm290_ide_dma_end; 295 hwif->dma_exec_cmd = &trm290_dma_exec_cmd;
290 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; 296 hwif->dma_start = &trm290_dma_start;
297 hwif->ide_dma_end = &trm290_ide_dma_end;
298 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
291 299
292 hwif->selectproc = &trm290_selectproc; 300 hwif->selectproc = &trm290_selectproc;
293#if 1 301#if 1
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 816b5311dad6..7f7a59885777 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1138,6 +1138,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1138 hwif->drives[0].autotune = IDE_TUNE_AUTO; 1138 hwif->drives[0].autotune = IDE_TUNE_AUTO;
1139 hwif->drives[1].autotune = IDE_TUNE_AUTO; 1139 hwif->drives[1].autotune = IDE_TUNE_AUTO;
1140 hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | 1140 hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
1141 IDE_HFLAG_PIO_NO_DOWNGRADE |
1141 IDE_HFLAG_POST_SET_MODE; 1142 IDE_HFLAG_POST_SET_MODE;
1142 hwif->pio_mask = ATA_PIO4; 1143 hwif->pio_mask = ATA_PIO4;
1143 hwif->set_pio_mode = pmac_ide_set_pio_mode; 1144 hwif->set_pio_mode = pmac_ide_set_pio_mode;
@@ -1512,7 +1513,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
1512 1513
1513 if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) { 1514 if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) {
1514 if (pmif->broken_dma_warn == 0) { 1515 if (pmif->broken_dma_warn == 0) {
1515 printk(KERN_WARNING "%s: DMA on non aligned address," 1516 printk(KERN_WARNING "%s: DMA on non aligned address, "
1516 "switching to PIO on Ohare chipset\n", drive->name); 1517 "switching to PIO on Ohare chipset\n", drive->name);
1517 pmif->broken_dma_warn = 1; 1518 pmif->broken_dma_warn = 1;
1518 } 1519 }
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 02d14bf85ab2..d2cd5a3d38f8 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -7,11 +7,6 @@
7 * May be copied or modified under the terms of the GNU General Public License 7 * May be copied or modified under the terms of the GNU General Public License
8 */ 8 */
9 9
10/*
11 * This module provides support for automatic detection and
12 * configuration of all PCI IDE interfaces present in a system.
13 */
14
15#include <linux/module.h> 10#include <linux/module.h>
16#include <linux/types.h> 11#include <linux/types.h>
17#include <linux/kernel.h> 12#include <linux/kernel.h>
@@ -709,7 +704,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_devices);
709/* 704/*
710 * Module interfaces 705 * Module interfaces
711 */ 706 */
712 707
713static int pre_init = 1; /* Before first ordered IDE scan */ 708static int pre_init = 1; /* Before first ordered IDE scan */
714static LIST_HEAD(ide_pci_drivers); 709static LIST_HEAD(ide_pci_drivers);
715 710
@@ -719,7 +714,7 @@ static LIST_HEAD(ide_pci_drivers);
719 * @module: owner module of the driver 714 * @module: owner module of the driver
720 * 715 *
721 * Registers a driver with the IDE layer. The IDE layer arranges that 716 * Registers a driver with the IDE layer. The IDE layer arranges that
722 * boot time setup is done in the expected device order and then 717 * boot time setup is done in the expected device order and then
723 * hands the controllers off to the core PCI code to do the rest of 718 * hands the controllers off to the core PCI code to do the rest of
724 * the work. 719 * the work.
725 * 720 *
@@ -729,13 +724,12 @@ static LIST_HEAD(ide_pci_drivers);
729int __ide_pci_register_driver(struct pci_driver *driver, struct module *module, 724int __ide_pci_register_driver(struct pci_driver *driver, struct module *module,
730 const char *mod_name) 725 const char *mod_name)
731{ 726{
732 if(!pre_init) 727 if (!pre_init)
733 return __pci_register_driver(driver, module, mod_name); 728 return __pci_register_driver(driver, module, mod_name);
734 driver->driver.owner = module; 729 driver->driver.owner = module;
735 list_add_tail(&driver->node, &ide_pci_drivers); 730 list_add_tail(&driver->node, &ide_pci_drivers);
736 return 0; 731 return 0;
737} 732}
738
739EXPORT_SYMBOL_GPL(__ide_pci_register_driver); 733EXPORT_SYMBOL_GPL(__ide_pci_register_driver);
740 734
741/** 735/**
@@ -746,17 +740,18 @@ EXPORT_SYMBOL_GPL(__ide_pci_register_driver);
746 * This is only used during boot up to get the ordering correct. After 740 * This is only used during boot up to get the ordering correct. After
747 * boot up the pci layer takes over the job. 741 * boot up the pci layer takes over the job.
748 */ 742 */
749 743
750static int __init ide_scan_pcidev(struct pci_dev *dev) 744static int __init ide_scan_pcidev(struct pci_dev *dev)
751{ 745{
752 struct list_head *l; 746 struct list_head *l;
753 struct pci_driver *d; 747 struct pci_driver *d;
754 748
755 list_for_each(l, &ide_pci_drivers) { 749 list_for_each(l, &ide_pci_drivers) {
756 d = list_entry(l, struct pci_driver, node); 750 d = list_entry(l, struct pci_driver, node);
757 if (d->id_table) { 751 if (d->id_table) {
758 const struct pci_device_id *id = pci_match_id(d->id_table, 752 const struct pci_device_id *id =
759 dev); 753 pci_match_id(d->id_table, dev);
754
760 if (id != NULL && d->probe(dev, id) >= 0) { 755 if (id != NULL && d->probe(dev, id) >= 0) {
761 dev->driver = d; 756 dev->driver = d;
762 pci_dev_get(dev); 757 pci_dev_get(dev);
@@ -784,13 +779,13 @@ void __init ide_scan_pcibus (int scan_direction)
784 779
785 pre_init = 0; 780 pre_init = 0;
786 if (!scan_direction) 781 if (!scan_direction)
787 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) 782 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)))
788 ide_scan_pcidev(dev); 783 ide_scan_pcidev(dev);
789 else 784 else
790 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) 785 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID,
791 != NULL) 786 dev)))
792 ide_scan_pcidev(dev); 787 ide_scan_pcidev(dev);
793 788
794 /* 789 /*
795 * Hand the drivers over to the PCI layer now we 790 * Hand the drivers over to the PCI layer now we
796 * are post init. 791 * are post init.
@@ -799,9 +794,10 @@ void __init ide_scan_pcibus (int scan_direction)
799 list_for_each_safe(l, n, &ide_pci_drivers) { 794 list_for_each_safe(l, n, &ide_pci_drivers) {
800 list_del(l); 795 list_del(l);
801 d = list_entry(l, struct pci_driver, node); 796 d = list_entry(l, struct pci_driver, node);
802 if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name)) 797 if (__pci_register_driver(d, d->driver.owner,
803 printk(KERN_ERR "%s: failed to register driver for %s\n", 798 d->driver.mod_name))
804 __FUNCTION__, d->driver.mod_name); 799 printk(KERN_ERR "%s: failed to register %s driver\n",
800 __FUNCTION__, d->driver.mod_name);
805 } 801 }
806} 802}
807#endif 803#endif