diff options
-rw-r--r-- | Documentation/DocBook/libata.tmpl | 12 | ||||
-rw-r--r-- | drivers/Kconfig | 2 | ||||
-rw-r--r-- | drivers/Makefile | 1 | ||||
-rw-r--r-- | drivers/ata/Kconfig | 150 | ||||
-rw-r--r-- | drivers/ata/Makefile | 21 | ||||
-rw-r--r-- | drivers/ata/ahci.c (renamed from drivers/scsi/ahci.c) | 661 | ||||
-rw-r--r-- | drivers/ata/ata_piix.c (renamed from drivers/scsi/ata_piix.c) | 26 | ||||
-rw-r--r-- | drivers/ata/libata-bmdma.c (renamed from drivers/scsi/libata-bmdma.c) | 160 | ||||
-rw-r--r-- | drivers/ata/libata-core.c (renamed from drivers/scsi/libata-core.c) | 358 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c (renamed from drivers/scsi/libata-eh.c) | 2 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c (renamed from drivers/scsi/libata-scsi.c) | 157 | ||||
-rw-r--r-- | drivers/ata/libata.h (renamed from drivers/scsi/libata.h) | 5 | ||||
-rw-r--r-- | drivers/ata/pdc_adma.c (renamed from drivers/scsi/pdc_adma.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c (renamed from drivers/scsi/sata_mv.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_nv.c (renamed from drivers/scsi/sata_nv.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_promise.c (renamed from drivers/scsi/sata_promise.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_promise.h (renamed from drivers/scsi/sata_promise.h) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_qstor.c (renamed from drivers/scsi/sata_qstor.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_sil.c (renamed from drivers/scsi/sata_sil.c) | 12 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c (renamed from drivers/scsi/sata_sil24.c) | 8 | ||||
-rw-r--r-- | drivers/ata/sata_sis.c (renamed from drivers/scsi/sata_sis.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_svw.c (renamed from drivers/scsi/sata_svw.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_sx4.c (renamed from drivers/scsi/sata_sx4.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_uli.c (renamed from drivers/scsi/sata_uli.c) | 2 | ||||
-rw-r--r-- | drivers/ata/sata_via.c (renamed from drivers/scsi/sata_via.c) | 3 | ||||
-rw-r--r-- | drivers/ata/sata_vsc.c (renamed from drivers/scsi/sata_vsc.c) | 2 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 6 | ||||
-rw-r--r-- | drivers/scsi/Kconfig | 138 | ||||
-rw-r--r-- | drivers/scsi/Makefile | 16 | ||||
-rw-r--r-- | include/asm-alpha/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/asm-generic/libata-portmap.h | 12 | ||||
-rw-r--r-- | include/asm-i386/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/asm-ia64/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/asm-sparc/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/asm-sparc64/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/asm-x86_64/libata-portmap.h | 1 | ||||
-rw-r--r-- | include/linux/ata.h | 22 | ||||
-rw-r--r-- | include/linux/libata.h | 39 |
39 files changed, 1189 insertions, 649 deletions
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index e97c32314541..065e8dc23e3a 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl | |||
@@ -868,18 +868,18 @@ and other resources, etc. | |||
868 | 868 | ||
869 | <chapter id="libataExt"> | 869 | <chapter id="libataExt"> |
870 | <title>libata Library</title> | 870 | <title>libata Library</title> |
871 | !Edrivers/scsi/libata-core.c | 871 | !Edrivers/ata/libata-core.c |
872 | </chapter> | 872 | </chapter> |
873 | 873 | ||
874 | <chapter id="libataInt"> | 874 | <chapter id="libataInt"> |
875 | <title>libata Core Internals</title> | 875 | <title>libata Core Internals</title> |
876 | !Idrivers/scsi/libata-core.c | 876 | !Idrivers/ata/libata-core.c |
877 | </chapter> | 877 | </chapter> |
878 | 878 | ||
879 | <chapter id="libataScsiInt"> | 879 | <chapter id="libataScsiInt"> |
880 | <title>libata SCSI translation/emulation</title> | 880 | <title>libata SCSI translation/emulation</title> |
881 | !Edrivers/scsi/libata-scsi.c | 881 | !Edrivers/ata/libata-scsi.c |
882 | !Idrivers/scsi/libata-scsi.c | 882 | !Idrivers/ata/libata-scsi.c |
883 | </chapter> | 883 | </chapter> |
884 | 884 | ||
885 | <chapter id="ataExceptions"> | 885 | <chapter id="ataExceptions"> |
@@ -1600,12 +1600,12 @@ and other resources, etc. | |||
1600 | 1600 | ||
1601 | <chapter id="PiixInt"> | 1601 | <chapter id="PiixInt"> |
1602 | <title>ata_piix Internals</title> | 1602 | <title>ata_piix Internals</title> |
1603 | !Idrivers/scsi/ata_piix.c | 1603 | !Idrivers/ata/ata_piix.c |
1604 | </chapter> | 1604 | </chapter> |
1605 | 1605 | ||
1606 | <chapter id="SILInt"> | 1606 | <chapter id="SILInt"> |
1607 | <title>sata_sil Internals</title> | 1607 | <title>sata_sil Internals</title> |
1608 | !Idrivers/scsi/sata_sil.c | 1608 | !Idrivers/ata/sata_sil.c |
1609 | </chapter> | 1609 | </chapter> |
1610 | 1610 | ||
1611 | <chapter id="libataThanks"> | 1611 | <chapter id="libataThanks"> |
diff --git a/drivers/Kconfig b/drivers/Kconfig index 8b11cebe65df..263e86ddc1a4 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -18,6 +18,8 @@ source "drivers/ide/Kconfig" | |||
18 | 18 | ||
19 | source "drivers/scsi/Kconfig" | 19 | source "drivers/scsi/Kconfig" |
20 | 20 | ||
21 | source "drivers/ata/Kconfig" | ||
22 | |||
21 | source "drivers/cdrom/Kconfig" | 23 | source "drivers/cdrom/Kconfig" |
22 | 24 | ||
23 | source "drivers/md/Kconfig" | 25 | source "drivers/md/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index fc2d744a4e4a..4ac14dab3079 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -34,6 +34,7 @@ obj-$(CONFIG_PPC_PMAC) += macintosh/ | |||
34 | obj-$(CONFIG_IDE) += ide/ | 34 | obj-$(CONFIG_IDE) += ide/ |
35 | obj-$(CONFIG_FC4) += fc4/ | 35 | obj-$(CONFIG_FC4) += fc4/ |
36 | obj-$(CONFIG_SCSI) += scsi/ | 36 | obj-$(CONFIG_SCSI) += scsi/ |
37 | obj-$(CONFIG_ATA) += ata/ | ||
37 | obj-$(CONFIG_FUSION) += message/ | 38 | obj-$(CONFIG_FUSION) += message/ |
38 | obj-$(CONFIG_IEEE1394) += ieee1394/ | 39 | obj-$(CONFIG_IEEE1394) += ieee1394/ |
39 | obj-y += cdrom/ | 40 | obj-y += cdrom/ |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig new file mode 100644 index 000000000000..13027d56b7f6 --- /dev/null +++ b/drivers/ata/Kconfig | |||
@@ -0,0 +1,150 @@ | |||
1 | # | ||
2 | # SATA/PATA driver configuration | ||
3 | # | ||
4 | |||
5 | menu "Serial ATA (prod) and Parallel ATA (experimental) drivers" | ||
6 | |||
7 | config ATA | ||
8 | tristate "ATA device support" | ||
9 | select SCSI | ||
10 | ---help--- | ||
11 | If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or | ||
12 | any other ATA device under Linux, say Y and make sure that you know | ||
13 | the name of your ATA host adapter (the card inside your computer | ||
14 | that "speaks" the ATA protocol, also called ATA controller), | ||
15 | because you will be asked for it. | ||
16 | |||
17 | if ATA | ||
18 | |||
19 | config SATA_AHCI | ||
20 | tristate "AHCI SATA support" | ||
21 | depends on PCI | ||
22 | help | ||
23 | This option enables support for AHCI Serial ATA. | ||
24 | |||
25 | If unsure, say N. | ||
26 | |||
27 | config SATA_SVW | ||
28 | tristate "ServerWorks Frodo / Apple K2 SATA support" | ||
29 | depends on PCI | ||
30 | help | ||
31 | This option enables support for Broadcom/Serverworks/Apple K2 | ||
32 | SATA support. | ||
33 | |||
34 | If unsure, say N. | ||
35 | |||
36 | config ATA_PIIX | ||
37 | tristate "Intel PIIX/ICH SATA support" | ||
38 | depends on PCI | ||
39 | help | ||
40 | This option enables support for ICH5/6/7/8 Serial ATA. | ||
41 | If PATA support was enabled previously, this enables | ||
42 | support for select Intel PIIX/ICH PATA host controllers. | ||
43 | |||
44 | If unsure, say N. | ||
45 | |||
46 | config SATA_MV | ||
47 | tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)" | ||
48 | depends on PCI && EXPERIMENTAL | ||
49 | help | ||
50 | This option enables support for the Marvell Serial ATA family. | ||
51 | Currently supports 88SX[56]0[48][01] chips. | ||
52 | |||
53 | If unsure, say N. | ||
54 | |||
55 | config SATA_NV | ||
56 | tristate "NVIDIA SATA support" | ||
57 | depends on PCI | ||
58 | help | ||
59 | This option enables support for NVIDIA Serial ATA. | ||
60 | |||
61 | If unsure, say N. | ||
62 | |||
63 | config PDC_ADMA | ||
64 | tristate "Pacific Digital ADMA support" | ||
65 | depends on PCI | ||
66 | help | ||
67 | This option enables support for Pacific Digital ADMA controllers | ||
68 | |||
69 | If unsure, say N. | ||
70 | |||
71 | config SATA_QSTOR | ||
72 | tristate "Pacific Digital SATA QStor support" | ||
73 | depends on PCI | ||
74 | help | ||
75 | This option enables support for Pacific Digital Serial ATA QStor. | ||
76 | |||
77 | If unsure, say N. | ||
78 | |||
79 | config SATA_PROMISE | ||
80 | tristate "Promise SATA TX2/TX4 support" | ||
81 | depends on PCI | ||
82 | help | ||
83 | This option enables support for Promise Serial ATA TX2/TX4. | ||
84 | |||
85 | If unsure, say N. | ||
86 | |||
87 | config SATA_SX4 | ||
88 | tristate "Promise SATA SX4 support" | ||
89 | depends on PCI && EXPERIMENTAL | ||
90 | help | ||
91 | This option enables support for Promise Serial ATA SX4. | ||
92 | |||
93 | If unsure, say N. | ||
94 | |||
95 | config SATA_SIL | ||
96 | tristate "Silicon Image SATA support" | ||
97 | depends on PCI | ||
98 | help | ||
99 | This option enables support for Silicon Image Serial ATA. | ||
100 | |||
101 | If unsure, say N. | ||
102 | |||
103 | config SATA_SIL24 | ||
104 | tristate "Silicon Image 3124/3132 SATA support" | ||
105 | depends on PCI | ||
106 | help | ||
107 | This option enables support for Silicon Image 3124/3132 Serial ATA. | ||
108 | |||
109 | If unsure, say N. | ||
110 | |||
111 | config SATA_SIS | ||
112 | tristate "SiS 964/180 SATA support" | ||
113 | depends on PCI | ||
114 | help | ||
115 | This option enables support for SiS Serial ATA 964/180. | ||
116 | |||
117 | If unsure, say N. | ||
118 | |||
119 | config SATA_ULI | ||
120 | tristate "ULi Electronics SATA support" | ||
121 | depends on PCI | ||
122 | help | ||
123 | This option enables support for ULi Electronics SATA. | ||
124 | |||
125 | If unsure, say N. | ||
126 | |||
127 | config SATA_VIA | ||
128 | tristate "VIA SATA support" | ||
129 | depends on PCI | ||
130 | help | ||
131 | This option enables support for VIA Serial ATA. | ||
132 | |||
133 | If unsure, say N. | ||
134 | |||
135 | config SATA_VITESSE | ||
136 | tristate "VITESSE VSC-7174 / INTEL 31244 SATA support" | ||
137 | depends on PCI | ||
138 | help | ||
139 | This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA. | ||
140 | |||
141 | If unsure, say N. | ||
142 | |||
143 | config SATA_INTEL_COMBINED | ||
144 | bool | ||
145 | depends on IDE=y && !BLK_DEV_IDE_SATA && (SATA_AHCI || ATA_PIIX) | ||
146 | default y | ||
147 | |||
148 | endif | ||
149 | endmenu | ||
150 | |||
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile new file mode 100644 index 000000000000..c17ae9c8b91d --- /dev/null +++ b/drivers/ata/Makefile | |||
@@ -0,0 +1,21 @@ | |||
1 | |||
2 | obj-$(CONFIG_ATA) += libata.o | ||
3 | |||
4 | obj-$(CONFIG_SATA_AHCI) += ahci.o | ||
5 | obj-$(CONFIG_SATA_SVW) += sata_svw.o | ||
6 | obj-$(CONFIG_ATA_PIIX) += ata_piix.o | ||
7 | obj-$(CONFIG_SATA_PROMISE) += sata_promise.o | ||
8 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o | ||
9 | obj-$(CONFIG_SATA_SIL) += sata_sil.o | ||
10 | obj-$(CONFIG_SATA_SIL24) += sata_sil24.o | ||
11 | obj-$(CONFIG_SATA_VIA) += sata_via.o | ||
12 | obj-$(CONFIG_SATA_VITESSE) += sata_vsc.o | ||
13 | obj-$(CONFIG_SATA_SIS) += sata_sis.o | ||
14 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o | ||
15 | obj-$(CONFIG_SATA_NV) += sata_nv.o | ||
16 | obj-$(CONFIG_SATA_ULI) += sata_uli.o | ||
17 | obj-$(CONFIG_SATA_MV) += sata_mv.o | ||
18 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o | ||
19 | |||
20 | libata-objs := libata-core.o libata-scsi.o libata-bmdma.o libata-eh.o | ||
21 | |||
diff --git a/drivers/scsi/ahci.c b/drivers/ata/ahci.c index 904c25fb4ba4..813031c01fba 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -92,7 +92,9 @@ enum { | |||
92 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ | 92 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ |
93 | 93 | ||
94 | /* HOST_CAP bits */ | 94 | /* HOST_CAP bits */ |
95 | HOST_CAP_SSC = (1 << 14), /* Slumber capable */ | ||
95 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ | 96 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ |
97 | HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ | ||
96 | HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ | 98 | HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ |
97 | HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ | 99 | HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ |
98 | 100 | ||
@@ -155,6 +157,7 @@ enum { | |||
155 | PORT_CMD_SPIN_UP = (1 << 1), /* Spin up device */ | 157 | PORT_CMD_SPIN_UP = (1 << 1), /* Spin up device */ |
156 | PORT_CMD_START = (1 << 0), /* Enable port DMA engine */ | 158 | PORT_CMD_START = (1 << 0), /* Enable port DMA engine */ |
157 | 159 | ||
160 | PORT_CMD_ICC_MASK = (0xf << 28), /* i/f ICC state mask */ | ||
158 | PORT_CMD_ICC_ACTIVE = (0x1 << 28), /* Put i/f in active state */ | 161 | PORT_CMD_ICC_ACTIVE = (0x1 << 28), /* Put i/f in active state */ |
159 | PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ | 162 | PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ |
160 | PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ | 163 | PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ |
@@ -212,6 +215,10 @@ static void ahci_freeze(struct ata_port *ap); | |||
212 | static void ahci_thaw(struct ata_port *ap); | 215 | static void ahci_thaw(struct ata_port *ap); |
213 | static void ahci_error_handler(struct ata_port *ap); | 216 | static void ahci_error_handler(struct ata_port *ap); |
214 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); | 217 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); |
218 | static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg); | ||
219 | static int ahci_port_resume(struct ata_port *ap); | ||
220 | static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
221 | static int ahci_pci_device_resume(struct pci_dev *pdev); | ||
215 | static void ahci_remove_one (struct pci_dev *pdev); | 222 | static void ahci_remove_one (struct pci_dev *pdev); |
216 | 223 | ||
217 | static struct scsi_host_template ahci_sht = { | 224 | static struct scsi_host_template ahci_sht = { |
@@ -231,6 +238,8 @@ static struct scsi_host_template ahci_sht = { | |||
231 | .slave_configure = ata_scsi_slave_config, | 238 | .slave_configure = ata_scsi_slave_config, |
232 | .slave_destroy = ata_scsi_slave_destroy, | 239 | .slave_destroy = ata_scsi_slave_destroy, |
233 | .bios_param = ata_std_bios_param, | 240 | .bios_param = ata_std_bios_param, |
241 | .suspend = ata_scsi_device_suspend, | ||
242 | .resume = ata_scsi_device_resume, | ||
234 | }; | 243 | }; |
235 | 244 | ||
236 | static const struct ata_port_operations ahci_ops = { | 245 | static const struct ata_port_operations ahci_ops = { |
@@ -257,6 +266,9 @@ static const struct ata_port_operations ahci_ops = { | |||
257 | .error_handler = ahci_error_handler, | 266 | .error_handler = ahci_error_handler, |
258 | .post_internal_cmd = ahci_post_internal_cmd, | 267 | .post_internal_cmd = ahci_post_internal_cmd, |
259 | 268 | ||
269 | .port_suspend = ahci_port_suspend, | ||
270 | .port_resume = ahci_port_resume, | ||
271 | |||
260 | .port_start = ahci_port_start, | 272 | .port_start = ahci_port_start, |
261 | .port_stop = ahci_port_stop, | 273 | .port_stop = ahci_port_stop, |
262 | }; | 274 | }; |
@@ -350,6 +362,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
350 | { PCI_VENDOR_ID_NVIDIA, 0x044f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 362 | { PCI_VENDOR_ID_NVIDIA, 0x044f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
351 | board_ahci }, /* MCP65 */ | 363 | board_ahci }, /* MCP65 */ |
352 | 364 | ||
365 | /* SiS */ | ||
366 | { PCI_VENDOR_ID_SI, 0x1184, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
367 | board_ahci }, /* SiS 966 */ | ||
368 | { PCI_VENDOR_ID_SI, 0x1185, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
369 | board_ahci }, /* SiS 966 */ | ||
370 | { PCI_VENDOR_ID_SI, 0x0186, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
371 | board_ahci }, /* SiS 968 */ | ||
372 | |||
353 | { } /* terminate list */ | 373 | { } /* terminate list */ |
354 | }; | 374 | }; |
355 | 375 | ||
@@ -358,6 +378,8 @@ static struct pci_driver ahci_pci_driver = { | |||
358 | .name = DRV_NAME, | 378 | .name = DRV_NAME, |
359 | .id_table = ahci_pci_tbl, | 379 | .id_table = ahci_pci_tbl, |
360 | .probe = ahci_init_one, | 380 | .probe = ahci_init_one, |
381 | .suspend = ahci_pci_device_suspend, | ||
382 | .resume = ahci_pci_device_resume, | ||
361 | .remove = ahci_remove_one, | 383 | .remove = ahci_remove_one, |
362 | }; | 384 | }; |
363 | 385 | ||
@@ -372,177 +394,288 @@ static inline void __iomem *ahci_port_base (void __iomem *base, unsigned int por | |||
372 | return (void __iomem *) ahci_port_base_ul((unsigned long)base, port); | 394 | return (void __iomem *) ahci_port_base_ul((unsigned long)base, port); |
373 | } | 395 | } |
374 | 396 | ||
375 | static int ahci_port_start(struct ata_port *ap) | 397 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) |
376 | { | 398 | { |
377 | struct device *dev = ap->host_set->dev; | 399 | unsigned int sc_reg; |
378 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | ||
379 | struct ahci_port_priv *pp; | ||
380 | void __iomem *mmio = ap->host_set->mmio_base; | ||
381 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
382 | void *mem; | ||
383 | dma_addr_t mem_dma; | ||
384 | int rc; | ||
385 | |||
386 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); | ||
387 | if (!pp) | ||
388 | return -ENOMEM; | ||
389 | memset(pp, 0, sizeof(*pp)); | ||
390 | 400 | ||
391 | rc = ata_pad_alloc(ap, dev); | 401 | switch (sc_reg_in) { |
392 | if (rc) { | 402 | case SCR_STATUS: sc_reg = 0; break; |
393 | kfree(pp); | 403 | case SCR_CONTROL: sc_reg = 1; break; |
394 | return rc; | 404 | case SCR_ERROR: sc_reg = 2; break; |
405 | case SCR_ACTIVE: sc_reg = 3; break; | ||
406 | default: | ||
407 | return 0xffffffffU; | ||
395 | } | 408 | } |
396 | 409 | ||
397 | mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); | 410 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
398 | if (!mem) { | 411 | } |
399 | ata_pad_free(ap, dev); | ||
400 | kfree(pp); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); | ||
404 | 412 | ||
405 | /* | ||
406 | * First item in chunk of DMA memory: 32-slot command table, | ||
407 | * 32 bytes each in size | ||
408 | */ | ||
409 | pp->cmd_slot = mem; | ||
410 | pp->cmd_slot_dma = mem_dma; | ||
411 | 413 | ||
412 | mem += AHCI_CMD_SLOT_SZ; | 414 | static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in, |
413 | mem_dma += AHCI_CMD_SLOT_SZ; | 415 | u32 val) |
416 | { | ||
417 | unsigned int sc_reg; | ||
414 | 418 | ||
415 | /* | 419 | switch (sc_reg_in) { |
416 | * Second item: Received-FIS area | 420 | case SCR_STATUS: sc_reg = 0; break; |
417 | */ | 421 | case SCR_CONTROL: sc_reg = 1; break; |
418 | pp->rx_fis = mem; | 422 | case SCR_ERROR: sc_reg = 2; break; |
419 | pp->rx_fis_dma = mem_dma; | 423 | case SCR_ACTIVE: sc_reg = 3; break; |
424 | default: | ||
425 | return; | ||
426 | } | ||
420 | 427 | ||
421 | mem += AHCI_RX_FIS_SZ; | 428 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
422 | mem_dma += AHCI_RX_FIS_SZ; | 429 | } |
423 | 430 | ||
424 | /* | 431 | static void ahci_start_engine(void __iomem *port_mmio) |
425 | * Third item: data area for storing a single command | 432 | { |
426 | * and its scatter-gather table | 433 | u32 tmp; |
427 | */ | ||
428 | pp->cmd_tbl = mem; | ||
429 | pp->cmd_tbl_dma = mem_dma; | ||
430 | 434 | ||
431 | ap->private_data = pp; | 435 | /* start DMA */ |
436 | tmp = readl(port_mmio + PORT_CMD); | ||
437 | tmp |= PORT_CMD_START; | ||
438 | writel(tmp, port_mmio + PORT_CMD); | ||
439 | readl(port_mmio + PORT_CMD); /* flush */ | ||
440 | } | ||
432 | 441 | ||
433 | if (hpriv->cap & HOST_CAP_64) | 442 | static int ahci_stop_engine(void __iomem *port_mmio) |
434 | writel((pp->cmd_slot_dma >> 16) >> 16, port_mmio + PORT_LST_ADDR_HI); | 443 | { |
435 | writel(pp->cmd_slot_dma & 0xffffffff, port_mmio + PORT_LST_ADDR); | 444 | u32 tmp; |
436 | readl(port_mmio + PORT_LST_ADDR); /* flush */ | ||
437 | 445 | ||
438 | if (hpriv->cap & HOST_CAP_64) | 446 | tmp = readl(port_mmio + PORT_CMD); |
439 | writel((pp->rx_fis_dma >> 16) >> 16, port_mmio + PORT_FIS_ADDR_HI); | ||
440 | writel(pp->rx_fis_dma & 0xffffffff, port_mmio + PORT_FIS_ADDR); | ||
441 | readl(port_mmio + PORT_FIS_ADDR); /* flush */ | ||
442 | 447 | ||
443 | writel(PORT_CMD_ICC_ACTIVE | PORT_CMD_FIS_RX | | 448 | /* check if the HBA is idle */ |
444 | PORT_CMD_POWER_ON | PORT_CMD_SPIN_UP | | 449 | if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0) |
445 | PORT_CMD_START, port_mmio + PORT_CMD); | 450 | return 0; |
446 | readl(port_mmio + PORT_CMD); /* flush */ | 451 | |
452 | /* setting HBA to idle */ | ||
453 | tmp &= ~PORT_CMD_START; | ||
454 | writel(tmp, port_mmio + PORT_CMD); | ||
455 | |||
456 | /* wait for engine to stop. This could be as long as 500 msec */ | ||
457 | tmp = ata_wait_register(port_mmio + PORT_CMD, | ||
458 | PORT_CMD_LIST_ON, PORT_CMD_LIST_ON, 1, 500); | ||
459 | if (tmp & PORT_CMD_LIST_ON) | ||
460 | return -EIO; | ||
447 | 461 | ||
448 | return 0; | 462 | return 0; |
449 | } | 463 | } |
450 | 464 | ||
465 | static void ahci_start_fis_rx(void __iomem *port_mmio, u32 cap, | ||
466 | dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma) | ||
467 | { | ||
468 | u32 tmp; | ||
469 | |||
470 | /* set FIS registers */ | ||
471 | if (cap & HOST_CAP_64) | ||
472 | writel((cmd_slot_dma >> 16) >> 16, port_mmio + PORT_LST_ADDR_HI); | ||
473 | writel(cmd_slot_dma & 0xffffffff, port_mmio + PORT_LST_ADDR); | ||
451 | 474 | ||
452 | static void ahci_port_stop(struct ata_port *ap) | 475 | if (cap & HOST_CAP_64) |
476 | writel((rx_fis_dma >> 16) >> 16, port_mmio + PORT_FIS_ADDR_HI); | ||
477 | writel(rx_fis_dma & 0xffffffff, port_mmio + PORT_FIS_ADDR); | ||
478 | |||
479 | /* enable FIS reception */ | ||
480 | tmp = readl(port_mmio + PORT_CMD); | ||
481 | tmp |= PORT_CMD_FIS_RX; | ||
482 | writel(tmp, port_mmio + PORT_CMD); | ||
483 | |||
484 | /* flush */ | ||
485 | readl(port_mmio + PORT_CMD); | ||
486 | } | ||
487 | |||
488 | static int ahci_stop_fis_rx(void __iomem *port_mmio) | ||
453 | { | 489 | { |
454 | struct device *dev = ap->host_set->dev; | ||
455 | struct ahci_port_priv *pp = ap->private_data; | ||
456 | void __iomem *mmio = ap->host_set->mmio_base; | ||
457 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
458 | u32 tmp; | 490 | u32 tmp; |
459 | 491 | ||
492 | /* disable FIS reception */ | ||
460 | tmp = readl(port_mmio + PORT_CMD); | 493 | tmp = readl(port_mmio + PORT_CMD); |
461 | tmp &= ~(PORT_CMD_START | PORT_CMD_FIS_RX); | 494 | tmp &= ~PORT_CMD_FIS_RX; |
462 | writel(tmp, port_mmio + PORT_CMD); | 495 | writel(tmp, port_mmio + PORT_CMD); |
463 | readl(port_mmio + PORT_CMD); /* flush */ | ||
464 | 496 | ||
465 | /* spec says 500 msecs for each PORT_CMD_{START,FIS_RX} bit, so | 497 | /* wait for completion, spec says 500ms, give it 1000 */ |
466 | * this is slightly incorrect. | 498 | tmp = ata_wait_register(port_mmio + PORT_CMD, PORT_CMD_FIS_ON, |
467 | */ | 499 | PORT_CMD_FIS_ON, 10, 1000); |
468 | msleep(500); | 500 | if (tmp & PORT_CMD_FIS_ON) |
501 | return -EBUSY; | ||
469 | 502 | ||
470 | ap->private_data = NULL; | 503 | return 0; |
471 | dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, | ||
472 | pp->cmd_slot, pp->cmd_slot_dma); | ||
473 | ata_pad_free(ap, dev); | ||
474 | kfree(pp); | ||
475 | } | 504 | } |
476 | 505 | ||
477 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) | 506 | static void ahci_power_up(void __iomem *port_mmio, u32 cap) |
478 | { | 507 | { |
479 | unsigned int sc_reg; | 508 | u32 cmd; |
480 | 509 | ||
481 | switch (sc_reg_in) { | 510 | cmd = readl(port_mmio + PORT_CMD) & ~PORT_CMD_ICC_MASK; |
482 | case SCR_STATUS: sc_reg = 0; break; | 511 | |
483 | case SCR_CONTROL: sc_reg = 1; break; | 512 | /* spin up device */ |
484 | case SCR_ERROR: sc_reg = 2; break; | 513 | if (cap & HOST_CAP_SSS) { |
485 | case SCR_ACTIVE: sc_reg = 3; break; | 514 | cmd |= PORT_CMD_SPIN_UP; |
486 | default: | 515 | writel(cmd, port_mmio + PORT_CMD); |
487 | return 0xffffffffU; | ||
488 | } | 516 | } |
489 | 517 | ||
490 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 518 | /* wake up link */ |
519 | writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); | ||
491 | } | 520 | } |
492 | 521 | ||
522 | static void ahci_power_down(void __iomem *port_mmio, u32 cap) | ||
523 | { | ||
524 | u32 cmd, scontrol; | ||
493 | 525 | ||
494 | static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in, | 526 | cmd = readl(port_mmio + PORT_CMD) & ~PORT_CMD_ICC_MASK; |
495 | u32 val) | 527 | |
528 | if (cap & HOST_CAP_SSC) { | ||
529 | /* enable transitions to slumber mode */ | ||
530 | scontrol = readl(port_mmio + PORT_SCR_CTL); | ||
531 | if ((scontrol & 0x0f00) > 0x100) { | ||
532 | scontrol &= ~0xf00; | ||
533 | writel(scontrol, port_mmio + PORT_SCR_CTL); | ||
534 | } | ||
535 | |||
536 | /* put device into slumber mode */ | ||
537 | writel(cmd | PORT_CMD_ICC_SLUMBER, port_mmio + PORT_CMD); | ||
538 | |||
539 | /* wait for the transition to complete */ | ||
540 | ata_wait_register(port_mmio + PORT_CMD, PORT_CMD_ICC_SLUMBER, | ||
541 | PORT_CMD_ICC_SLUMBER, 1, 50); | ||
542 | } | ||
543 | |||
544 | /* put device into listen mode */ | ||
545 | if (cap & HOST_CAP_SSS) { | ||
546 | /* first set PxSCTL.DET to 0 */ | ||
547 | scontrol = readl(port_mmio + PORT_SCR_CTL); | ||
548 | scontrol &= ~0xf; | ||
549 | writel(scontrol, port_mmio + PORT_SCR_CTL); | ||
550 | |||
551 | /* then set PxCMD.SUD to 0 */ | ||
552 | cmd &= ~PORT_CMD_SPIN_UP; | ||
553 | writel(cmd, port_mmio + PORT_CMD); | ||
554 | } | ||
555 | } | ||
556 | |||
557 | static void ahci_init_port(void __iomem *port_mmio, u32 cap, | ||
558 | dma_addr_t cmd_slot_dma, dma_addr_t rx_fis_dma) | ||
496 | { | 559 | { |
497 | unsigned int sc_reg; | 560 | /* power up */ |
561 | ahci_power_up(port_mmio, cap); | ||
498 | 562 | ||
499 | switch (sc_reg_in) { | 563 | /* enable FIS reception */ |
500 | case SCR_STATUS: sc_reg = 0; break; | 564 | ahci_start_fis_rx(port_mmio, cap, cmd_slot_dma, rx_fis_dma); |
501 | case SCR_CONTROL: sc_reg = 1; break; | 565 | |
502 | case SCR_ERROR: sc_reg = 2; break; | 566 | /* enable DMA */ |
503 | case SCR_ACTIVE: sc_reg = 3; break; | 567 | ahci_start_engine(port_mmio); |
504 | default: | 568 | } |
505 | return; | 569 | |
570 | static int ahci_deinit_port(void __iomem *port_mmio, u32 cap, const char **emsg) | ||
571 | { | ||
572 | int rc; | ||
573 | |||
574 | /* disable DMA */ | ||
575 | rc = ahci_stop_engine(port_mmio); | ||
576 | if (rc) { | ||
577 | *emsg = "failed to stop engine"; | ||
578 | return rc; | ||
506 | } | 579 | } |
507 | 580 | ||
508 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 581 | /* disable FIS reception */ |
582 | rc = ahci_stop_fis_rx(port_mmio); | ||
583 | if (rc) { | ||
584 | *emsg = "failed stop FIS RX"; | ||
585 | return rc; | ||
586 | } | ||
587 | |||
588 | /* put device into slumber mode */ | ||
589 | ahci_power_down(port_mmio, cap); | ||
590 | |||
591 | return 0; | ||
509 | } | 592 | } |
510 | 593 | ||
511 | static int ahci_stop_engine(struct ata_port *ap) | 594 | static int ahci_reset_controller(void __iomem *mmio, struct pci_dev *pdev) |
512 | { | 595 | { |
513 | void __iomem *mmio = ap->host_set->mmio_base; | 596 | u32 cap_save, tmp; |
514 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
515 | int work; | ||
516 | u32 tmp; | ||
517 | 597 | ||
518 | tmp = readl(port_mmio + PORT_CMD); | 598 | cap_save = readl(mmio + HOST_CAP); |
519 | tmp &= ~PORT_CMD_START; | 599 | cap_save &= ( (1<<28) | (1<<17) ); |
520 | writel(tmp, port_mmio + PORT_CMD); | 600 | cap_save |= (1 << 27); |
521 | 601 | ||
522 | /* wait for engine to stop. TODO: this could be | 602 | /* global controller reset */ |
523 | * as long as 500 msec | 603 | tmp = readl(mmio + HOST_CTL); |
604 | if ((tmp & HOST_RESET) == 0) { | ||
605 | writel(tmp | HOST_RESET, mmio + HOST_CTL); | ||
606 | readl(mmio + HOST_CTL); /* flush */ | ||
607 | } | ||
608 | |||
609 | /* reset must complete within 1 second, or | ||
610 | * the hardware should be considered fried. | ||
524 | */ | 611 | */ |
525 | work = 1000; | 612 | ssleep(1); |
526 | while (work-- > 0) { | 613 | |
527 | tmp = readl(port_mmio + PORT_CMD); | 614 | tmp = readl(mmio + HOST_CTL); |
528 | if ((tmp & PORT_CMD_LIST_ON) == 0) | 615 | if (tmp & HOST_RESET) { |
529 | return 0; | 616 | dev_printk(KERN_ERR, &pdev->dev, |
530 | udelay(10); | 617 | "controller reset failed (0x%x)\n", tmp); |
618 | return -EIO; | ||
531 | } | 619 | } |
532 | 620 | ||
533 | return -EIO; | 621 | writel(HOST_AHCI_EN, mmio + HOST_CTL); |
622 | (void) readl(mmio + HOST_CTL); /* flush */ | ||
623 | writel(cap_save, mmio + HOST_CAP); | ||
624 | writel(0xf, mmio + HOST_PORTS_IMPL); | ||
625 | (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ | ||
626 | |||
627 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { | ||
628 | u16 tmp16; | ||
629 | |||
630 | /* configure PCS */ | ||
631 | pci_read_config_word(pdev, 0x92, &tmp16); | ||
632 | tmp16 |= 0xf; | ||
633 | pci_write_config_word(pdev, 0x92, tmp16); | ||
634 | } | ||
635 | |||
636 | return 0; | ||
534 | } | 637 | } |
535 | 638 | ||
536 | static void ahci_start_engine(struct ata_port *ap) | 639 | static void ahci_init_controller(void __iomem *mmio, struct pci_dev *pdev, |
640 | int n_ports, u32 cap) | ||
537 | { | 641 | { |
538 | void __iomem *mmio = ap->host_set->mmio_base; | 642 | int i, rc; |
539 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
540 | u32 tmp; | 643 | u32 tmp; |
541 | 644 | ||
542 | tmp = readl(port_mmio + PORT_CMD); | 645 | for (i = 0; i < n_ports; i++) { |
543 | tmp |= PORT_CMD_START; | 646 | void __iomem *port_mmio = ahci_port_base(mmio, i); |
544 | writel(tmp, port_mmio + PORT_CMD); | 647 | const char *emsg = NULL; |
545 | readl(port_mmio + PORT_CMD); /* flush */ | 648 | |
649 | #if 0 /* BIOSen initialize this incorrectly */ | ||
650 | if (!(hpriv->port_map & (1 << i))) | ||
651 | continue; | ||
652 | #endif | ||
653 | |||
654 | /* make sure port is not active */ | ||
655 | rc = ahci_deinit_port(port_mmio, cap, &emsg); | ||
656 | if (rc) | ||
657 | dev_printk(KERN_WARNING, &pdev->dev, | ||
658 | "%s (%d)\n", emsg, rc); | ||
659 | |||
660 | /* clear SError */ | ||
661 | tmp = readl(port_mmio + PORT_SCR_ERR); | ||
662 | VPRINTK("PORT_SCR_ERR 0x%x\n", tmp); | ||
663 | writel(tmp, port_mmio + PORT_SCR_ERR); | ||
664 | |||
665 | /* clear port IRQ */ | ||
666 | tmp = readl(port_mmio + PORT_IRQ_STAT); | ||
667 | VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp); | ||
668 | if (tmp) | ||
669 | writel(tmp, port_mmio + PORT_IRQ_STAT); | ||
670 | |||
671 | writel(1 << i, mmio + HOST_IRQ_STAT); | ||
672 | } | ||
673 | |||
674 | tmp = readl(mmio + HOST_CTL); | ||
675 | VPRINTK("HOST_CTL 0x%x\n", tmp); | ||
676 | writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL); | ||
677 | tmp = readl(mmio + HOST_CTL); | ||
678 | VPRINTK("HOST_CTL 0x%x\n", tmp); | ||
546 | } | 679 | } |
547 | 680 | ||
548 | static unsigned int ahci_dev_classify(struct ata_port *ap) | 681 | static unsigned int ahci_dev_classify(struct ata_port *ap) |
@@ -626,7 +759,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class) | |||
626 | } | 759 | } |
627 | 760 | ||
628 | /* prepare for SRST (AHCI-1.1 10.4.1) */ | 761 | /* prepare for SRST (AHCI-1.1 10.4.1) */ |
629 | rc = ahci_stop_engine(ap); | 762 | rc = ahci_stop_engine(port_mmio); |
630 | if (rc) { | 763 | if (rc) { |
631 | reason = "failed to stop engine"; | 764 | reason = "failed to stop engine"; |
632 | goto fail_restart; | 765 | goto fail_restart; |
@@ -647,7 +780,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class) | |||
647 | } | 780 | } |
648 | 781 | ||
649 | /* restart engine */ | 782 | /* restart engine */ |
650 | ahci_start_engine(ap); | 783 | ahci_start_engine(port_mmio); |
651 | 784 | ||
652 | ata_tf_init(ap->device, &tf); | 785 | ata_tf_init(ap->device, &tf); |
653 | fis = pp->cmd_tbl; | 786 | fis = pp->cmd_tbl; |
@@ -706,7 +839,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class) | |||
706 | return 0; | 839 | return 0; |
707 | 840 | ||
708 | fail_restart: | 841 | fail_restart: |
709 | ahci_start_engine(ap); | 842 | ahci_start_engine(port_mmio); |
710 | fail: | 843 | fail: |
711 | ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason); | 844 | ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason); |
712 | return rc; | 845 | return rc; |
@@ -717,11 +850,13 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class) | |||
717 | struct ahci_port_priv *pp = ap->private_data; | 850 | struct ahci_port_priv *pp = ap->private_data; |
718 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 851 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
719 | struct ata_taskfile tf; | 852 | struct ata_taskfile tf; |
853 | void __iomem *mmio = ap->host_set->mmio_base; | ||
854 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
720 | int rc; | 855 | int rc; |
721 | 856 | ||
722 | DPRINTK("ENTER\n"); | 857 | DPRINTK("ENTER\n"); |
723 | 858 | ||
724 | ahci_stop_engine(ap); | 859 | ahci_stop_engine(port_mmio); |
725 | 860 | ||
726 | /* clear D2H reception area to properly wait for D2H FIS */ | 861 | /* clear D2H reception area to properly wait for D2H FIS */ |
727 | ata_tf_init(ap->device, &tf); | 862 | ata_tf_init(ap->device, &tf); |
@@ -730,7 +865,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class) | |||
730 | 865 | ||
731 | rc = sata_std_hardreset(ap, class); | 866 | rc = sata_std_hardreset(ap, class); |
732 | 867 | ||
733 | ahci_start_engine(ap); | 868 | ahci_start_engine(port_mmio); |
734 | 869 | ||
735 | if (rc == 0 && ata_port_online(ap)) | 870 | if (rc == 0 && ata_port_online(ap)) |
736 | *class = ahci_dev_classify(ap); | 871 | *class = ahci_dev_classify(ap); |
@@ -1046,10 +1181,13 @@ static void ahci_thaw(struct ata_port *ap) | |||
1046 | 1181 | ||
1047 | static void ahci_error_handler(struct ata_port *ap) | 1182 | static void ahci_error_handler(struct ata_port *ap) |
1048 | { | 1183 | { |
1184 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1185 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
1186 | |||
1049 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { | 1187 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { |
1050 | /* restart engine */ | 1188 | /* restart engine */ |
1051 | ahci_stop_engine(ap); | 1189 | ahci_stop_engine(port_mmio); |
1052 | ahci_start_engine(ap); | 1190 | ahci_start_engine(port_mmio); |
1053 | } | 1191 | } |
1054 | 1192 | ||
1055 | /* perform recovery */ | 1193 | /* perform recovery */ |
@@ -1060,15 +1198,176 @@ static void ahci_error_handler(struct ata_port *ap) | |||
1060 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) | 1198 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) |
1061 | { | 1199 | { |
1062 | struct ata_port *ap = qc->ap; | 1200 | struct ata_port *ap = qc->ap; |
1201 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1202 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
1063 | 1203 | ||
1064 | if (qc->flags & ATA_QCFLAG_FAILED) | 1204 | if (qc->flags & ATA_QCFLAG_FAILED) |
1065 | qc->err_mask |= AC_ERR_OTHER; | 1205 | qc->err_mask |= AC_ERR_OTHER; |
1066 | 1206 | ||
1067 | if (qc->err_mask) { | 1207 | if (qc->err_mask) { |
1068 | /* make DMA engine forget about the failed command */ | 1208 | /* make DMA engine forget about the failed command */ |
1069 | ahci_stop_engine(ap); | 1209 | ahci_stop_engine(port_mmio); |
1070 | ahci_start_engine(ap); | 1210 | ahci_start_engine(port_mmio); |
1211 | } | ||
1212 | } | ||
1213 | |||
1214 | static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) | ||
1215 | { | ||
1216 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | ||
1217 | struct ahci_port_priv *pp = ap->private_data; | ||
1218 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1219 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
1220 | const char *emsg = NULL; | ||
1221 | int rc; | ||
1222 | |||
1223 | rc = ahci_deinit_port(port_mmio, hpriv->cap, &emsg); | ||
1224 | if (rc) { | ||
1225 | ata_port_printk(ap, KERN_ERR, "%s (%d)\n", emsg, rc); | ||
1226 | ahci_init_port(port_mmio, hpriv->cap, | ||
1227 | pp->cmd_slot_dma, pp->rx_fis_dma); | ||
1071 | } | 1228 | } |
1229 | |||
1230 | return rc; | ||
1231 | } | ||
1232 | |||
1233 | static int ahci_port_resume(struct ata_port *ap) | ||
1234 | { | ||
1235 | struct ahci_port_priv *pp = ap->private_data; | ||
1236 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | ||
1237 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1238 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
1239 | |||
1240 | ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma); | ||
1241 | |||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1245 | static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | ||
1246 | { | ||
1247 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); | ||
1248 | void __iomem *mmio = host_set->mmio_base; | ||
1249 | u32 ctl; | ||
1250 | |||
1251 | if (mesg.event == PM_EVENT_SUSPEND) { | ||
1252 | /* AHCI spec rev1.1 section 8.3.3: | ||
1253 | * Software must disable interrupts prior to requesting a | ||
1254 | * transition of the HBA to D3 state. | ||
1255 | */ | ||
1256 | ctl = readl(mmio + HOST_CTL); | ||
1257 | ctl &= ~HOST_IRQ_EN; | ||
1258 | writel(ctl, mmio + HOST_CTL); | ||
1259 | readl(mmio + HOST_CTL); /* flush */ | ||
1260 | } | ||
1261 | |||
1262 | return ata_pci_device_suspend(pdev, mesg); | ||
1263 | } | ||
1264 | |||
1265 | static int ahci_pci_device_resume(struct pci_dev *pdev) | ||
1266 | { | ||
1267 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); | ||
1268 | struct ahci_host_priv *hpriv = host_set->private_data; | ||
1269 | void __iomem *mmio = host_set->mmio_base; | ||
1270 | int rc; | ||
1271 | |||
1272 | ata_pci_device_do_resume(pdev); | ||
1273 | |||
1274 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { | ||
1275 | rc = ahci_reset_controller(mmio, pdev); | ||
1276 | if (rc) | ||
1277 | return rc; | ||
1278 | |||
1279 | ahci_init_controller(mmio, pdev, host_set->n_ports, hpriv->cap); | ||
1280 | } | ||
1281 | |||
1282 | ata_host_set_resume(host_set); | ||
1283 | |||
1284 | return 0; | ||
1285 | } | ||
1286 | |||
1287 | static int ahci_port_start(struct ata_port *ap) | ||
1288 | { | ||
1289 | struct device *dev = ap->host_set->dev; | ||
1290 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | ||
1291 | struct ahci_port_priv *pp; | ||
1292 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1293 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
1294 | void *mem; | ||
1295 | dma_addr_t mem_dma; | ||
1296 | int rc; | ||
1297 | |||
1298 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); | ||
1299 | if (!pp) | ||
1300 | return -ENOMEM; | ||
1301 | memset(pp, 0, sizeof(*pp)); | ||
1302 | |||
1303 | rc = ata_pad_alloc(ap, dev); | ||
1304 | if (rc) { | ||
1305 | kfree(pp); | ||
1306 | return rc; | ||
1307 | } | ||
1308 | |||
1309 | mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); | ||
1310 | if (!mem) { | ||
1311 | ata_pad_free(ap, dev); | ||
1312 | kfree(pp); | ||
1313 | return -ENOMEM; | ||
1314 | } | ||
1315 | memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); | ||
1316 | |||
1317 | /* | ||
1318 | * First item in chunk of DMA memory: 32-slot command table, | ||
1319 | * 32 bytes each in size | ||
1320 | */ | ||
1321 | pp->cmd_slot = mem; | ||
1322 | pp->cmd_slot_dma = mem_dma; | ||
1323 | |||
1324 | mem += AHCI_CMD_SLOT_SZ; | ||
1325 | mem_dma += AHCI_CMD_SLOT_SZ; | ||
1326 | |||
1327 | /* | ||
1328 | * Second item: Received-FIS area | ||
1329 | */ | ||
1330 | pp->rx_fis = mem; | ||
1331 | pp->rx_fis_dma = mem_dma; | ||
1332 | |||
1333 | mem += AHCI_RX_FIS_SZ; | ||
1334 | mem_dma += AHCI_RX_FIS_SZ; | ||
1335 | |||
1336 | /* | ||
1337 | * Third item: data area for storing a single command | ||
1338 | * and its scatter-gather table | ||
1339 | */ | ||
1340 | pp->cmd_tbl = mem; | ||
1341 | pp->cmd_tbl_dma = mem_dma; | ||
1342 | |||
1343 | ap->private_data = pp; | ||
1344 | |||
1345 | /* initialize port */ | ||
1346 | ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma); | ||
1347 | |||
1348 | return 0; | ||
1349 | } | ||
1350 | |||
1351 | static void ahci_port_stop(struct ata_port *ap) | ||
1352 | { | ||
1353 | struct device *dev = ap->host_set->dev; | ||
1354 | struct ahci_host_priv *hpriv = ap->host_set->private_data; | ||
1355 | struct ahci_port_priv *pp = ap->private_data; | ||
1356 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1357 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | ||
1358 | const char *emsg = NULL; | ||
1359 | int rc; | ||
1360 | |||
1361 | /* de-initialize port */ | ||
1362 | rc = ahci_deinit_port(port_mmio, hpriv->cap, &emsg); | ||
1363 | if (rc) | ||
1364 | ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc); | ||
1365 | |||
1366 | ap->private_data = NULL; | ||
1367 | dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, | ||
1368 | pp->cmd_slot, pp->cmd_slot_dma); | ||
1369 | ata_pad_free(ap, dev); | ||
1370 | kfree(pp); | ||
1072 | } | 1371 | } |
1073 | 1372 | ||
1074 | static void ahci_setup_port(struct ata_ioports *port, unsigned long base, | 1373 | static void ahci_setup_port(struct ata_ioports *port, unsigned long base, |
@@ -1089,47 +1388,12 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
1089 | struct ahci_host_priv *hpriv = probe_ent->private_data; | 1388 | struct ahci_host_priv *hpriv = probe_ent->private_data; |
1090 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | 1389 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); |
1091 | void __iomem *mmio = probe_ent->mmio_base; | 1390 | void __iomem *mmio = probe_ent->mmio_base; |
1092 | u32 tmp, cap_save; | 1391 | unsigned int i, using_dac; |
1093 | unsigned int i, j, using_dac; | ||
1094 | int rc; | 1392 | int rc; |
1095 | void __iomem *port_mmio; | ||
1096 | 1393 | ||
1097 | cap_save = readl(mmio + HOST_CAP); | 1394 | rc = ahci_reset_controller(mmio, pdev); |
1098 | cap_save &= ( (1<<28) | (1<<17) ); | 1395 | if (rc) |
1099 | cap_save |= (1 << 27); | 1396 | return rc; |
1100 | |||
1101 | /* global controller reset */ | ||
1102 | tmp = readl(mmio + HOST_CTL); | ||
1103 | if ((tmp & HOST_RESET) == 0) { | ||
1104 | writel(tmp | HOST_RESET, mmio + HOST_CTL); | ||
1105 | readl(mmio + HOST_CTL); /* flush */ | ||
1106 | } | ||
1107 | |||
1108 | /* reset must complete within 1 second, or | ||
1109 | * the hardware should be considered fried. | ||
1110 | */ | ||
1111 | ssleep(1); | ||
1112 | |||
1113 | tmp = readl(mmio + HOST_CTL); | ||
1114 | if (tmp & HOST_RESET) { | ||
1115 | dev_printk(KERN_ERR, &pdev->dev, | ||
1116 | "controller reset failed (0x%x)\n", tmp); | ||
1117 | return -EIO; | ||
1118 | } | ||
1119 | |||
1120 | writel(HOST_AHCI_EN, mmio + HOST_CTL); | ||
1121 | (void) readl(mmio + HOST_CTL); /* flush */ | ||
1122 | writel(cap_save, mmio + HOST_CAP); | ||
1123 | writel(0xf, mmio + HOST_PORTS_IMPL); | ||
1124 | (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ | ||
1125 | |||
1126 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { | ||
1127 | u16 tmp16; | ||
1128 | |||
1129 | pci_read_config_word(pdev, 0x92, &tmp16); | ||
1130 | tmp16 |= 0xf; | ||
1131 | pci_write_config_word(pdev, 0x92, tmp16); | ||
1132 | } | ||
1133 | 1397 | ||
1134 | hpriv->cap = readl(mmio + HOST_CAP); | 1398 | hpriv->cap = readl(mmio + HOST_CAP); |
1135 | hpriv->port_map = readl(mmio + HOST_PORTS_IMPL); | 1399 | hpriv->port_map = readl(mmio + HOST_PORTS_IMPL); |
@@ -1165,63 +1429,10 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
1165 | } | 1429 | } |
1166 | } | 1430 | } |
1167 | 1431 | ||
1168 | for (i = 0; i < probe_ent->n_ports; i++) { | 1432 | for (i = 0; i < probe_ent->n_ports; i++) |
1169 | #if 0 /* BIOSen initialize this incorrectly */ | 1433 | ahci_setup_port(&probe_ent->port[i], (unsigned long) mmio, i); |
1170 | if (!(hpriv->port_map & (1 << i))) | ||
1171 | continue; | ||
1172 | #endif | ||
1173 | |||
1174 | port_mmio = ahci_port_base(mmio, i); | ||
1175 | VPRINTK("mmio %p port_mmio %p\n", mmio, port_mmio); | ||
1176 | |||
1177 | ahci_setup_port(&probe_ent->port[i], | ||
1178 | (unsigned long) mmio, i); | ||
1179 | |||
1180 | /* make sure port is not active */ | ||
1181 | tmp = readl(port_mmio + PORT_CMD); | ||
1182 | VPRINTK("PORT_CMD 0x%x\n", tmp); | ||
1183 | if (tmp & (PORT_CMD_LIST_ON | PORT_CMD_FIS_ON | | ||
1184 | PORT_CMD_FIS_RX | PORT_CMD_START)) { | ||
1185 | tmp &= ~(PORT_CMD_LIST_ON | PORT_CMD_FIS_ON | | ||
1186 | PORT_CMD_FIS_RX | PORT_CMD_START); | ||
1187 | writel(tmp, port_mmio + PORT_CMD); | ||
1188 | readl(port_mmio + PORT_CMD); /* flush */ | ||
1189 | |||
1190 | /* spec says 500 msecs for each bit, so | ||
1191 | * this is slightly incorrect. | ||
1192 | */ | ||
1193 | msleep(500); | ||
1194 | } | ||
1195 | |||
1196 | writel(PORT_CMD_SPIN_UP, port_mmio + PORT_CMD); | ||
1197 | |||
1198 | j = 0; | ||
1199 | while (j < 100) { | ||
1200 | msleep(10); | ||
1201 | tmp = readl(port_mmio + PORT_SCR_STAT); | ||
1202 | if ((tmp & 0xf) == 0x3) | ||
1203 | break; | ||
1204 | j++; | ||
1205 | } | ||
1206 | |||
1207 | tmp = readl(port_mmio + PORT_SCR_ERR); | ||
1208 | VPRINTK("PORT_SCR_ERR 0x%x\n", tmp); | ||
1209 | writel(tmp, port_mmio + PORT_SCR_ERR); | ||
1210 | 1434 | ||
1211 | /* ack any pending irq events for this port */ | 1435 | ahci_init_controller(mmio, pdev, probe_ent->n_ports, hpriv->cap); |
1212 | tmp = readl(port_mmio + PORT_IRQ_STAT); | ||
1213 | VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp); | ||
1214 | if (tmp) | ||
1215 | writel(tmp, port_mmio + PORT_IRQ_STAT); | ||
1216 | |||
1217 | writel(1 << i, mmio + HOST_IRQ_STAT); | ||
1218 | } | ||
1219 | |||
1220 | tmp = readl(mmio + HOST_CTL); | ||
1221 | VPRINTK("HOST_CTL 0x%x\n", tmp); | ||
1222 | writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL); | ||
1223 | tmp = readl(mmio + HOST_CTL); | ||
1224 | VPRINTK("HOST_CTL 0x%x\n", tmp); | ||
1225 | 1436 | ||
1226 | pci_set_master(pdev); | 1437 | pci_set_master(pdev); |
1227 | 1438 | ||
@@ -1454,7 +1665,7 @@ static void ahci_remove_one (struct pci_dev *pdev) | |||
1454 | 1665 | ||
1455 | static int __init ahci_init(void) | 1666 | static int __init ahci_init(void) |
1456 | { | 1667 | { |
1457 | return pci_module_init(&ahci_pci_driver); | 1668 | return pci_register_driver(&ahci_pci_driver); |
1458 | } | 1669 | } |
1459 | 1670 | ||
1460 | static void __exit ahci_exit(void) | 1671 | static void __exit ahci_exit(void) |
diff --git a/drivers/scsi/ata_piix.c b/drivers/ata/ata_piix.c index 2d20caf377f5..0ca4c3b78dc5 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -493,7 +493,7 @@ static void piix_pata_cbl_detect(struct ata_port *ap) | |||
493 | goto cbl40; | 493 | goto cbl40; |
494 | 494 | ||
495 | /* check BIOS cable detect results */ | 495 | /* check BIOS cable detect results */ |
496 | mask = ap->hard_port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; | 496 | mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; |
497 | pci_read_config_byte(pdev, PIIX_IOCFG, &tmp); | 497 | pci_read_config_byte(pdev, PIIX_IOCFG, &tmp); |
498 | if ((tmp & mask) == 0) | 498 | if ((tmp & mask) == 0) |
499 | goto cbl40; | 499 | goto cbl40; |
@@ -519,7 +519,7 @@ static int piix_pata_prereset(struct ata_port *ap) | |||
519 | { | 519 | { |
520 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 520 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
521 | 521 | ||
522 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { | 522 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) { |
523 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); | 523 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); |
524 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | 524 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; |
525 | return 0; | 525 | return 0; |
@@ -554,7 +554,7 @@ static unsigned int piix_sata_present_mask(struct ata_port *ap) | |||
554 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 554 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
555 | struct piix_host_priv *hpriv = ap->host_set->private_data; | 555 | struct piix_host_priv *hpriv = ap->host_set->private_data; |
556 | const unsigned int *map = hpriv->map; | 556 | const unsigned int *map = hpriv->map; |
557 | int base = 2 * ap->hard_port_no; | 557 | int base = 2 * ap->port_no; |
558 | unsigned int present_mask = 0; | 558 | unsigned int present_mask = 0; |
559 | int port, i; | 559 | int port, i; |
560 | u16 pcs; | 560 | u16 pcs; |
@@ -633,7 +633,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
633 | unsigned int pio = adev->pio_mode - XFER_PIO_0; | 633 | unsigned int pio = adev->pio_mode - XFER_PIO_0; |
634 | struct pci_dev *dev = to_pci_dev(ap->host_set->dev); | 634 | struct pci_dev *dev = to_pci_dev(ap->host_set->dev); |
635 | unsigned int is_slave = (adev->devno != 0); | 635 | unsigned int is_slave = (adev->devno != 0); |
636 | unsigned int master_port= ap->hard_port_no ? 0x42 : 0x40; | 636 | unsigned int master_port= ap->port_no ? 0x42 : 0x40; |
637 | unsigned int slave_port = 0x44; | 637 | unsigned int slave_port = 0x44; |
638 | u16 master_data; | 638 | u16 master_data; |
639 | u8 slave_data; | 639 | u8 slave_data; |
@@ -651,10 +651,10 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
651 | /* enable PPE, IE and TIME */ | 651 | /* enable PPE, IE and TIME */ |
652 | master_data |= 0x0070; | 652 | master_data |= 0x0070; |
653 | pci_read_config_byte(dev, slave_port, &slave_data); | 653 | pci_read_config_byte(dev, slave_port, &slave_data); |
654 | slave_data &= (ap->hard_port_no ? 0x0f : 0xf0); | 654 | slave_data &= (ap->port_no ? 0x0f : 0xf0); |
655 | slave_data |= | 655 | slave_data |= |
656 | (timings[pio][0] << 2) | | 656 | (timings[pio][0] << 2) | |
657 | (timings[pio][1] << (ap->hard_port_no ? 4 : 0)); | 657 | (timings[pio][1] << (ap->port_no ? 4 : 0)); |
658 | } else { | 658 | } else { |
659 | master_data &= 0xccf8; | 659 | master_data &= 0xccf8; |
660 | /* enable PPE, IE and TIME */ | 660 | /* enable PPE, IE and TIME */ |
@@ -684,9 +684,9 @@ static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
684 | { | 684 | { |
685 | unsigned int udma = adev->dma_mode; /* FIXME: MWDMA too */ | 685 | unsigned int udma = adev->dma_mode; /* FIXME: MWDMA too */ |
686 | struct pci_dev *dev = to_pci_dev(ap->host_set->dev); | 686 | struct pci_dev *dev = to_pci_dev(ap->host_set->dev); |
687 | u8 maslave = ap->hard_port_no ? 0x42 : 0x40; | 687 | u8 maslave = ap->port_no ? 0x42 : 0x40; |
688 | u8 speed = udma; | 688 | u8 speed = udma; |
689 | unsigned int drive_dn = (ap->hard_port_no ? 2 : 0) + adev->devno; | 689 | unsigned int drive_dn = (ap->port_no ? 2 : 0) + adev->devno; |
690 | int a_speed = 3 << (drive_dn * 4); | 690 | int a_speed = 3 << (drive_dn * 4); |
691 | int u_flag = 1 << drive_dn; | 691 | int u_flag = 1 << drive_dn; |
692 | int v_flag = 0x01 << drive_dn; | 692 | int v_flag = 0x01 << drive_dn; |
@@ -978,17 +978,19 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
978 | 978 | ||
979 | static void piix_host_stop(struct ata_host_set *host_set) | 979 | static void piix_host_stop(struct ata_host_set *host_set) |
980 | { | 980 | { |
981 | if (host_set->next == NULL) | 981 | struct piix_host_priv *hpriv = host_set->private_data; |
982 | kfree(host_set->private_data); | 982 | |
983 | ata_host_stop(host_set); | 983 | ata_host_stop(host_set); |
984 | |||
985 | kfree(hpriv); | ||
984 | } | 986 | } |
985 | 987 | ||
986 | static int __init piix_init(void) | 988 | static int __init piix_init(void) |
987 | { | 989 | { |
988 | int rc; | 990 | int rc; |
989 | 991 | ||
990 | DPRINTK("pci_module_init\n"); | 992 | DPRINTK("pci_register_driver\n"); |
991 | rc = pci_module_init(&piix_pci_driver); | 993 | rc = pci_register_driver(&piix_pci_driver); |
992 | if (rc) | 994 | if (rc) |
993 | return rc; | 995 | return rc; |
994 | 996 | ||
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/ata/libata-bmdma.c index 9ce221f25954..158f62dbf21b 100644 --- a/drivers/scsi/libata-bmdma.c +++ b/drivers/ata/libata-bmdma.c | |||
@@ -797,32 +797,6 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) | |||
797 | } | 797 | } |
798 | 798 | ||
799 | #ifdef CONFIG_PCI | 799 | #ifdef CONFIG_PCI |
800 | static struct ata_probe_ent * | ||
801 | ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port) | ||
802 | { | ||
803 | struct ata_probe_ent *probe_ent; | ||
804 | |||
805 | probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL); | ||
806 | if (!probe_ent) { | ||
807 | printk(KERN_ERR DRV_NAME "(%s): out of memory\n", | ||
808 | kobject_name(&(dev->kobj))); | ||
809 | return NULL; | ||
810 | } | ||
811 | |||
812 | INIT_LIST_HEAD(&probe_ent->node); | ||
813 | probe_ent->dev = dev; | ||
814 | |||
815 | probe_ent->sht = port->sht; | ||
816 | probe_ent->host_flags = port->host_flags; | ||
817 | probe_ent->pio_mask = port->pio_mask; | ||
818 | probe_ent->mwdma_mask = port->mwdma_mask; | ||
819 | probe_ent->udma_mask = port->udma_mask; | ||
820 | probe_ent->port_ops = port->port_ops; | ||
821 | |||
822 | return probe_ent; | ||
823 | } | ||
824 | |||
825 | |||
826 | /** | 800 | /** |
827 | * ata_pci_init_native_mode - Initialize native-mode driver | 801 | * ata_pci_init_native_mode - Initialize native-mode driver |
828 | * @pdev: pci device to be initialized | 802 | * @pdev: pci device to be initialized |
@@ -880,7 +854,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
880 | if (bmdma) { | 854 | if (bmdma) { |
881 | bmdma += 8; | 855 | bmdma += 8; |
882 | if(inb(bmdma + 2) & 0x80) | 856 | if(inb(bmdma + 2) & 0x80) |
883 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | 857 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; |
884 | probe_ent->port[p].bmdma_addr = bmdma; | 858 | probe_ent->port[p].bmdma_addr = bmdma; |
885 | } | 859 | } |
886 | ata_std_ports(&probe_ent->port[p]); | 860 | ata_std_ports(&probe_ent->port[p]); |
@@ -893,44 +867,48 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
893 | 867 | ||
894 | 868 | ||
895 | static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | 869 | static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, |
896 | struct ata_port_info *port, int port_num) | 870 | struct ata_port_info **port, int port_mask) |
897 | { | 871 | { |
898 | struct ata_probe_ent *probe_ent; | 872 | struct ata_probe_ent *probe_ent; |
899 | unsigned long bmdma; | 873 | unsigned long bmdma = pci_resource_start(pdev, 4); |
900 | 874 | ||
901 | probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port); | 875 | probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); |
902 | if (!probe_ent) | 876 | if (!probe_ent) |
903 | return NULL; | 877 | return NULL; |
904 | 878 | ||
905 | probe_ent->legacy_mode = 1; | 879 | probe_ent->n_ports = 2; |
906 | probe_ent->n_ports = 1; | 880 | probe_ent->private_data = port[0]->private_data; |
907 | probe_ent->hard_port_no = port_num; | ||
908 | probe_ent->private_data = port->private_data; | ||
909 | |||
910 | switch(port_num) | ||
911 | { | ||
912 | case 0: | ||
913 | probe_ent->irq = 14; | ||
914 | probe_ent->port[0].cmd_addr = 0x1f0; | ||
915 | probe_ent->port[0].altstatus_addr = | ||
916 | probe_ent->port[0].ctl_addr = 0x3f6; | ||
917 | break; | ||
918 | case 1: | ||
919 | probe_ent->irq = 15; | ||
920 | probe_ent->port[0].cmd_addr = 0x170; | ||
921 | probe_ent->port[0].altstatus_addr = | ||
922 | probe_ent->port[0].ctl_addr = 0x376; | ||
923 | break; | ||
924 | } | ||
925 | 881 | ||
926 | bmdma = pci_resource_start(pdev, 4); | 882 | if (port_mask & ATA_PORT_PRIMARY) { |
927 | if (bmdma != 0) { | 883 | probe_ent->irq = 14; |
928 | bmdma += 8 * port_num; | 884 | probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD; |
929 | probe_ent->port[0].bmdma_addr = bmdma; | 885 | probe_ent->port[0].altstatus_addr = |
930 | if (inb(bmdma + 2) & 0x80) | 886 | probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL; |
931 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | 887 | if (bmdma) { |
932 | } | 888 | probe_ent->port[0].bmdma_addr = bmdma; |
933 | ata_std_ports(&probe_ent->port[0]); | 889 | if (inb(bmdma + 2) & 0x80) |
890 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | ||
891 | } | ||
892 | ata_std_ports(&probe_ent->port[0]); | ||
893 | } else | ||
894 | probe_ent->dummy_port_mask |= ATA_PORT_PRIMARY; | ||
895 | |||
896 | if (port_mask & ATA_PORT_SECONDARY) { | ||
897 | if (probe_ent->irq) | ||
898 | probe_ent->irq2 = 15; | ||
899 | else | ||
900 | probe_ent->irq = 15; | ||
901 | probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD; | ||
902 | probe_ent->port[1].altstatus_addr = | ||
903 | probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL; | ||
904 | if (bmdma) { | ||
905 | probe_ent->port[1].bmdma_addr = bmdma + 8; | ||
906 | if (inb(bmdma + 10) & 0x80) | ||
907 | probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; | ||
908 | } | ||
909 | ata_std_ports(&probe_ent->port[1]); | ||
910 | } else | ||
911 | probe_ent->dummy_port_mask |= ATA_PORT_SECONDARY; | ||
934 | 912 | ||
935 | return probe_ent; | 913 | return probe_ent; |
936 | } | 914 | } |
@@ -950,6 +928,10 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | |||
950 | * regions, sets the dma mask, enables bus master mode, and calls | 928 | * regions, sets the dma mask, enables bus master mode, and calls |
951 | * ata_device_add() | 929 | * ata_device_add() |
952 | * | 930 | * |
931 | * ASSUMPTION: | ||
932 | * Nobody makes a single channel controller that appears solely as | ||
933 | * the secondary legacy port on PCI. | ||
934 | * | ||
953 | * LOCKING: | 935 | * LOCKING: |
954 | * Inherited from PCI layer (may sleep). | 936 | * Inherited from PCI layer (may sleep). |
955 | * | 937 | * |
@@ -960,7 +942,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | |||
960 | int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 942 | int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
961 | unsigned int n_ports) | 943 | unsigned int n_ports) |
962 | { | 944 | { |
963 | struct ata_probe_ent *probe_ent = NULL, *probe_ent2 = NULL; | 945 | struct ata_probe_ent *probe_ent = NULL; |
964 | struct ata_port_info *port[2]; | 946 | struct ata_port_info *port[2]; |
965 | u8 tmp8, mask; | 947 | u8 tmp8, mask; |
966 | unsigned int legacy_mode = 0; | 948 | unsigned int legacy_mode = 0; |
@@ -1009,35 +991,34 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1009 | goto err_out; | 991 | goto err_out; |
1010 | } | 992 | } |
1011 | 993 | ||
1012 | /* FIXME: Should use platform specific mappers for legacy port ranges */ | ||
1013 | if (legacy_mode) { | 994 | if (legacy_mode) { |
1014 | if (!request_region(0x1f0, 8, "libata")) { | 995 | if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) { |
1015 | struct resource *conflict, res; | 996 | struct resource *conflict, res; |
1016 | res.start = 0x1f0; | 997 | res.start = ATA_PRIMARY_CMD; |
1017 | res.end = 0x1f0 + 8 - 1; | 998 | res.end = ATA_PRIMARY_CMD + 8 - 1; |
1018 | conflict = ____request_resource(&ioport_resource, &res); | 999 | conflict = ____request_resource(&ioport_resource, &res); |
1019 | if (!strcmp(conflict->name, "libata")) | 1000 | if (!strcmp(conflict->name, "libata")) |
1020 | legacy_mode |= (1 << 0); | 1001 | legacy_mode |= ATA_PORT_PRIMARY; |
1021 | else { | 1002 | else { |
1022 | disable_dev_on_err = 0; | 1003 | disable_dev_on_err = 0; |
1023 | printk(KERN_WARNING "ata: 0x1f0 IDE port busy\n"); | 1004 | printk(KERN_WARNING "ata: 0x%0X IDE port busy\n", ATA_PRIMARY_CMD); |
1024 | } | 1005 | } |
1025 | } else | 1006 | } else |
1026 | legacy_mode |= (1 << 0); | 1007 | legacy_mode |= ATA_PORT_PRIMARY; |
1027 | 1008 | ||
1028 | if (!request_region(0x170, 8, "libata")) { | 1009 | if (!request_region(ATA_SECONDARY_CMD, 8, "libata")) { |
1029 | struct resource *conflict, res; | 1010 | struct resource *conflict, res; |
1030 | res.start = 0x170; | 1011 | res.start = ATA_SECONDARY_CMD; |
1031 | res.end = 0x170 + 8 - 1; | 1012 | res.end = ATA_SECONDARY_CMD + 8 - 1; |
1032 | conflict = ____request_resource(&ioport_resource, &res); | 1013 | conflict = ____request_resource(&ioport_resource, &res); |
1033 | if (!strcmp(conflict->name, "libata")) | 1014 | if (!strcmp(conflict->name, "libata")) |
1034 | legacy_mode |= (1 << 1); | 1015 | legacy_mode |= ATA_PORT_SECONDARY; |
1035 | else { | 1016 | else { |
1036 | disable_dev_on_err = 0; | 1017 | disable_dev_on_err = 0; |
1037 | printk(KERN_WARNING "ata: 0x170 IDE port busy\n"); | 1018 | printk(KERN_WARNING "ata: 0x%X IDE port busy\n", ATA_SECONDARY_CMD); |
1038 | } | 1019 | } |
1039 | } else | 1020 | } else |
1040 | legacy_mode |= (1 << 1); | 1021 | legacy_mode |= ATA_PORT_SECONDARY; |
1041 | } | 1022 | } |
1042 | 1023 | ||
1043 | /* we have legacy mode, but all ports are unavailable */ | 1024 | /* we have legacy mode, but all ports are unavailable */ |
@@ -1055,17 +1036,14 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1055 | goto err_out_regions; | 1036 | goto err_out_regions; |
1056 | 1037 | ||
1057 | if (legacy_mode) { | 1038 | if (legacy_mode) { |
1058 | if (legacy_mode & (1 << 0)) | 1039 | probe_ent = ata_pci_init_legacy_port(pdev, port, legacy_mode); |
1059 | probe_ent = ata_pci_init_legacy_port(pdev, port[0], 0); | ||
1060 | if (legacy_mode & (1 << 1)) | ||
1061 | probe_ent2 = ata_pci_init_legacy_port(pdev, port[1], 1); | ||
1062 | } else { | 1040 | } else { |
1063 | if (n_ports == 2) | 1041 | if (n_ports == 2) |
1064 | probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); | 1042 | probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); |
1065 | else | 1043 | else |
1066 | probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY); | 1044 | probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY); |
1067 | } | 1045 | } |
1068 | if (!probe_ent && !probe_ent2) { | 1046 | if (!probe_ent) { |
1069 | rc = -ENOMEM; | 1047 | rc = -ENOMEM; |
1070 | goto err_out_regions; | 1048 | goto err_out_regions; |
1071 | } | 1049 | } |
@@ -1073,35 +1051,17 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1073 | pci_set_master(pdev); | 1051 | pci_set_master(pdev); |
1074 | 1052 | ||
1075 | /* FIXME: check ata_device_add return */ | 1053 | /* FIXME: check ata_device_add return */ |
1076 | if (legacy_mode) { | 1054 | ata_device_add(probe_ent); |
1077 | struct device *dev = &pdev->dev; | ||
1078 | struct ata_host_set *host_set = NULL; | ||
1079 | |||
1080 | if (legacy_mode & (1 << 0)) { | ||
1081 | ata_device_add(probe_ent); | ||
1082 | host_set = dev_get_drvdata(dev); | ||
1083 | } | ||
1084 | |||
1085 | if (legacy_mode & (1 << 1)) { | ||
1086 | ata_device_add(probe_ent2); | ||
1087 | if (host_set) { | ||
1088 | host_set->next = dev_get_drvdata(dev); | ||
1089 | dev_set_drvdata(dev, host_set); | ||
1090 | } | ||
1091 | } | ||
1092 | } else | ||
1093 | ata_device_add(probe_ent); | ||
1094 | 1055 | ||
1095 | kfree(probe_ent); | 1056 | kfree(probe_ent); |
1096 | kfree(probe_ent2); | ||
1097 | 1057 | ||
1098 | return 0; | 1058 | return 0; |
1099 | 1059 | ||
1100 | err_out_regions: | 1060 | err_out_regions: |
1101 | if (legacy_mode & (1 << 0)) | 1061 | if (legacy_mode & ATA_PORT_PRIMARY) |
1102 | release_region(0x1f0, 8); | 1062 | release_region(ATA_PRIMARY_CMD, 8); |
1103 | if (legacy_mode & (1 << 1)) | 1063 | if (legacy_mode & ATA_PORT_SECONDARY) |
1104 | release_region(0x170, 8); | 1064 | release_region(ATA_SECONDARY_CMD, 8); |
1105 | pci_release_regions(pdev); | 1065 | pci_release_regions(pdev); |
1106 | err_out: | 1066 | err_out: |
1107 | if (disable_dev_on_err) | 1067 | if (disable_dev_on_err) |
diff --git a/drivers/scsi/libata-core.c b/drivers/ata/libata-core.c index 73dd6c8deede..9092416a6301 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/jiffies.h> | 50 | #include <linux/jiffies.h> |
51 | #include <linux/scatterlist.h> | 51 | #include <linux/scatterlist.h> |
52 | #include <scsi/scsi.h> | 52 | #include <scsi/scsi.h> |
53 | #include "scsi_priv.h" | ||
54 | #include <scsi/scsi_cmnd.h> | 53 | #include <scsi/scsi_cmnd.h> |
55 | #include <scsi/scsi_host.h> | 54 | #include <scsi/scsi_host.h> |
56 | #include <linux/libata.h> | 55 | #include <linux/libata.h> |
@@ -387,9 +386,13 @@ static const char *ata_mode_string(unsigned int xfer_mask) | |||
387 | "PIO2", | 386 | "PIO2", |
388 | "PIO3", | 387 | "PIO3", |
389 | "PIO4", | 388 | "PIO4", |
389 | "PIO5", | ||
390 | "PIO6", | ||
390 | "MWDMA0", | 391 | "MWDMA0", |
391 | "MWDMA1", | 392 | "MWDMA1", |
392 | "MWDMA2", | 393 | "MWDMA2", |
394 | "MWDMA3", | ||
395 | "MWDMA4", | ||
393 | "UDMA/16", | 396 | "UDMA/16", |
394 | "UDMA/25", | 397 | "UDMA/25", |
395 | "UDMA/33", | 398 | "UDMA/33", |
@@ -876,6 +879,23 @@ static unsigned int ata_id_xfermask(const u16 *id) | |||
876 | 879 | ||
877 | mwdma_mask = id[ATA_ID_MWDMA_MODES] & 0x07; | 880 | mwdma_mask = id[ATA_ID_MWDMA_MODES] & 0x07; |
878 | 881 | ||
882 | if (ata_id_is_cfa(id)) { | ||
883 | /* | ||
884 | * Process compact flash extended modes | ||
885 | */ | ||
886 | int pio = id[163] & 0x7; | ||
887 | int dma = (id[163] >> 3) & 7; | ||
888 | |||
889 | if (pio) | ||
890 | pio_mask |= (1 << 5); | ||
891 | if (pio > 1) | ||
892 | pio_mask |= (1 << 6); | ||
893 | if (dma) | ||
894 | mwdma_mask |= (1 << 3); | ||
895 | if (dma > 1) | ||
896 | mwdma_mask |= (1 << 4); | ||
897 | } | ||
898 | |||
879 | udma_mask = 0; | 899 | udma_mask = 0; |
880 | if (id[ATA_ID_FIELD_VALID] & (1 << 2)) | 900 | if (id[ATA_ID_FIELD_VALID] & (1 << 2)) |
881 | udma_mask = id[ATA_ID_UDMA_MODES] & 0xff; | 901 | udma_mask = id[ATA_ID_UDMA_MODES] & 0xff; |
@@ -1357,6 +1377,7 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1357 | struct ata_port *ap = dev->ap; | 1377 | struct ata_port *ap = dev->ap; |
1358 | const u16 *id = dev->id; | 1378 | const u16 *id = dev->id; |
1359 | unsigned int xfer_mask; | 1379 | unsigned int xfer_mask; |
1380 | char revbuf[7]; /* XYZ-99\0 */ | ||
1360 | int rc; | 1381 | int rc; |
1361 | 1382 | ||
1362 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { | 1383 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { |
@@ -1400,6 +1421,15 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1400 | 1421 | ||
1401 | /* ATA-specific feature tests */ | 1422 | /* ATA-specific feature tests */ |
1402 | if (dev->class == ATA_DEV_ATA) { | 1423 | if (dev->class == ATA_DEV_ATA) { |
1424 | if (ata_id_is_cfa(id)) { | ||
1425 | if (id[162] & 1) /* CPRM may make this media unusable */ | ||
1426 | ata_dev_printk(dev, KERN_WARNING, "ata%u: device %u supports DRM functions and may not be fully accessable.\n", | ||
1427 | ap->id, dev->devno); | ||
1428 | snprintf(revbuf, 7, "CFA"); | ||
1429 | } | ||
1430 | else | ||
1431 | snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id)); | ||
1432 | |||
1403 | dev->n_sectors = ata_id_n_sectors(id); | 1433 | dev->n_sectors = ata_id_n_sectors(id); |
1404 | 1434 | ||
1405 | if (ata_id_has_lba(id)) { | 1435 | if (ata_id_has_lba(id)) { |
@@ -1418,9 +1448,9 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1418 | 1448 | ||
1419 | /* print device info to dmesg */ | 1449 | /* print device info to dmesg */ |
1420 | if (ata_msg_drv(ap) && print_info) | 1450 | if (ata_msg_drv(ap) && print_info) |
1421 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " | 1451 | ata_dev_printk(dev, KERN_INFO, "%s, " |
1422 | "max %s, %Lu sectors: %s %s\n", | 1452 | "max %s, %Lu sectors: %s %s\n", |
1423 | ata_id_major_version(id), | 1453 | revbuf, |
1424 | ata_mode_string(xfer_mask), | 1454 | ata_mode_string(xfer_mask), |
1425 | (unsigned long long)dev->n_sectors, | 1455 | (unsigned long long)dev->n_sectors, |
1426 | lba_desc, ncq_desc); | 1456 | lba_desc, ncq_desc); |
@@ -1441,9 +1471,9 @@ int ata_dev_configure(struct ata_device *dev, int print_info) | |||
1441 | 1471 | ||
1442 | /* print device info to dmesg */ | 1472 | /* print device info to dmesg */ |
1443 | if (ata_msg_drv(ap) && print_info) | 1473 | if (ata_msg_drv(ap) && print_info) |
1444 | ata_dev_printk(dev, KERN_INFO, "ATA-%d, " | 1474 | ata_dev_printk(dev, KERN_INFO, "%s, " |
1445 | "max %s, %Lu sectors: CHS %u/%u/%u\n", | 1475 | "max %s, %Lu sectors: CHS %u/%u/%u\n", |
1446 | ata_id_major_version(id), | 1476 | revbuf, |
1447 | ata_mode_string(xfer_mask), | 1477 | ata_mode_string(xfer_mask), |
1448 | (unsigned long long)dev->n_sectors, | 1478 | (unsigned long long)dev->n_sectors, |
1449 | dev->cylinders, dev->heads, | 1479 | dev->cylinders, dev->heads, |
@@ -1528,7 +1558,7 @@ err_out_nosup: | |||
1528 | * Zero on success, negative errno otherwise. | 1558 | * Zero on success, negative errno otherwise. |
1529 | */ | 1559 | */ |
1530 | 1560 | ||
1531 | static int ata_bus_probe(struct ata_port *ap) | 1561 | int ata_bus_probe(struct ata_port *ap) |
1532 | { | 1562 | { |
1533 | unsigned int classes[ATA_MAX_DEVICES]; | 1563 | unsigned int classes[ATA_MAX_DEVICES]; |
1534 | int tries[ATA_MAX_DEVICES]; | 1564 | int tries[ATA_MAX_DEVICES]; |
@@ -1901,10 +1931,11 @@ int sata_set_spd(struct ata_port *ap) | |||
1901 | * drivers/ide/ide-timing.h and was originally written by Vojtech Pavlik | 1931 | * drivers/ide/ide-timing.h and was originally written by Vojtech Pavlik |
1902 | */ | 1932 | */ |
1903 | /* | 1933 | /* |
1904 | * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). | 1934 | * PIO 0-4, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). |
1905 | * These were taken from ATA/ATAPI-6 standard, rev 0a, except | 1935 | * These were taken from ATA/ATAPI-6 standard, rev 0a, except |
1906 | * for PIO 5, which is a nonstandard extension and UDMA6, which | 1936 | * for UDMA6, which is currently supported only by Maxtor drives. |
1907 | * is currently supported only by Maxtor drives. | 1937 | * |
1938 | * For PIO 5/6 MWDMA 3/4 see the CFA specification 3.0. | ||
1908 | */ | 1939 | */ |
1909 | 1940 | ||
1910 | static const struct ata_timing ata_timing[] = { | 1941 | static const struct ata_timing ata_timing[] = { |
@@ -1914,6 +1945,8 @@ static const struct ata_timing ata_timing[] = { | |||
1914 | { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, | 1945 | { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, |
1915 | { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, | 1946 | { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, |
1916 | 1947 | ||
1948 | { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 80, 0 }, | ||
1949 | { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 100, 0 }, | ||
1917 | { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 }, | 1950 | { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 }, |
1918 | { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 }, | 1951 | { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 }, |
1919 | { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, | 1952 | { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, |
@@ -1928,7 +1961,8 @@ static const struct ata_timing ata_timing[] = { | |||
1928 | { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, | 1961 | { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, |
1929 | { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, | 1962 | { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, |
1930 | 1963 | ||
1931 | /* { XFER_PIO_5, 20, 50, 30, 100, 50, 30, 100, 0 }, */ | 1964 | { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 80, 0 }, |
1965 | { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 100, 0 }, | ||
1932 | { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 }, | 1966 | { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 }, |
1933 | { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 }, | 1967 | { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 }, |
1934 | 1968 | ||
@@ -3040,10 +3074,6 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
3040 | * known limits including host controller limits, device | 3074 | * known limits including host controller limits, device |
3041 | * blacklist, etc... | 3075 | * blacklist, etc... |
3042 | * | 3076 | * |
3043 | * FIXME: The current implementation limits all transfer modes to | ||
3044 | * the fastest of the lowested device on the port. This is not | ||
3045 | * required on most controllers. | ||
3046 | * | ||
3047 | * LOCKING: | 3077 | * LOCKING: |
3048 | * None. | 3078 | * None. |
3049 | */ | 3079 | */ |
@@ -3052,8 +3082,8 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
3052 | struct ata_port *ap = dev->ap; | 3082 | struct ata_port *ap = dev->ap; |
3053 | struct ata_host_set *hs = ap->host_set; | 3083 | struct ata_host_set *hs = ap->host_set; |
3054 | unsigned long xfer_mask; | 3084 | unsigned long xfer_mask; |
3055 | int i; | ||
3056 | 3085 | ||
3086 | /* controller modes available */ | ||
3057 | xfer_mask = ata_pack_xfermask(ap->pio_mask, | 3087 | xfer_mask = ata_pack_xfermask(ap->pio_mask, |
3058 | ap->mwdma_mask, ap->udma_mask); | 3088 | ap->mwdma_mask, ap->udma_mask); |
3059 | 3089 | ||
@@ -3063,34 +3093,31 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
3063 | if (ap->cbl == ATA_CBL_PATA40) | 3093 | if (ap->cbl == ATA_CBL_PATA40) |
3064 | xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); | 3094 | xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); |
3065 | 3095 | ||
3066 | /* FIXME: Use port-wide xfermask for now */ | 3096 | xfer_mask &= ata_pack_xfermask(dev->pio_mask, |
3067 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 3097 | dev->mwdma_mask, dev->udma_mask); |
3068 | struct ata_device *d = &ap->device[i]; | 3098 | xfer_mask &= ata_id_xfermask(dev->id); |
3069 | |||
3070 | if (ata_dev_absent(d)) | ||
3071 | continue; | ||
3072 | |||
3073 | if (ata_dev_disabled(d)) { | ||
3074 | /* to avoid violating device selection timing */ | ||
3075 | xfer_mask &= ata_pack_xfermask(d->pio_mask, | ||
3076 | UINT_MAX, UINT_MAX); | ||
3077 | continue; | ||
3078 | } | ||
3079 | 3099 | ||
3080 | xfer_mask &= ata_pack_xfermask(d->pio_mask, | 3100 | /* |
3081 | d->mwdma_mask, d->udma_mask); | 3101 | * CFA Advanced TrueIDE timings are not allowed on a shared |
3082 | xfer_mask &= ata_id_xfermask(d->id); | 3102 | * cable |
3083 | if (ata_dma_blacklisted(d)) | 3103 | */ |
3084 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 3104 | if (ata_dev_pair(dev)) { |
3105 | /* No PIO5 or PIO6 */ | ||
3106 | xfer_mask &= ~(0x03 << (ATA_SHIFT_PIO + 5)); | ||
3107 | /* No MWDMA3 or MWDMA 4 */ | ||
3108 | xfer_mask &= ~(0x03 << (ATA_SHIFT_MWDMA + 3)); | ||
3085 | } | 3109 | } |
3086 | 3110 | ||
3087 | if (ata_dma_blacklisted(dev)) | 3111 | if (ata_dma_blacklisted(dev)) { |
3112 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | ||
3088 | ata_dev_printk(dev, KERN_WARNING, | 3113 | ata_dev_printk(dev, KERN_WARNING, |
3089 | "device is on DMA blacklist, disabling DMA\n"); | 3114 | "device is on DMA blacklist, disabling DMA\n"); |
3115 | } | ||
3090 | 3116 | ||
3091 | if (hs->flags & ATA_HOST_SIMPLEX) { | 3117 | if ((hs->flags & ATA_HOST_SIMPLEX) && hs->simplex_claimed) { |
3092 | if (hs->simplex_claimed) | 3118 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
3093 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 3119 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " |
3120 | "other device, disabling DMA\n"); | ||
3094 | } | 3121 | } |
3095 | 3122 | ||
3096 | if (ap->ops->mode_filter) | 3123 | if (ap->ops->mode_filter) |
@@ -5218,41 +5245,29 @@ void ata_dev_init(struct ata_device *dev) | |||
5218 | } | 5245 | } |
5219 | 5246 | ||
5220 | /** | 5247 | /** |
5221 | * ata_host_init - Initialize an ata_port structure | 5248 | * ata_port_init - Initialize an ata_port structure |
5222 | * @ap: Structure to initialize | 5249 | * @ap: Structure to initialize |
5223 | * @host: associated SCSI mid-layer structure | ||
5224 | * @host_set: Collection of hosts to which @ap belongs | 5250 | * @host_set: Collection of hosts to which @ap belongs |
5225 | * @ent: Probe information provided by low-level driver | 5251 | * @ent: Probe information provided by low-level driver |
5226 | * @port_no: Port number associated with this ata_port | 5252 | * @port_no: Port number associated with this ata_port |
5227 | * | 5253 | * |
5228 | * Initialize a new ata_port structure, and its associated | 5254 | * Initialize a new ata_port structure. |
5229 | * scsi_host. | ||
5230 | * | 5255 | * |
5231 | * LOCKING: | 5256 | * LOCKING: |
5232 | * Inherited from caller. | 5257 | * Inherited from caller. |
5233 | */ | 5258 | */ |
5234 | static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | 5259 | void ata_port_init(struct ata_port *ap, struct ata_host_set *host_set, |
5235 | struct ata_host_set *host_set, | 5260 | const struct ata_probe_ent *ent, unsigned int port_no) |
5236 | const struct ata_probe_ent *ent, unsigned int port_no) | ||
5237 | { | 5261 | { |
5238 | unsigned int i; | 5262 | unsigned int i; |
5239 | 5263 | ||
5240 | host->max_id = 16; | ||
5241 | host->max_lun = 1; | ||
5242 | host->max_channel = 1; | ||
5243 | host->unique_id = ata_unique_id++; | ||
5244 | host->max_cmd_len = 12; | ||
5245 | |||
5246 | ap->lock = &host_set->lock; | 5264 | ap->lock = &host_set->lock; |
5247 | ap->flags = ATA_FLAG_DISABLED; | 5265 | ap->flags = ATA_FLAG_DISABLED; |
5248 | ap->id = host->unique_id; | 5266 | ap->id = ata_unique_id++; |
5249 | ap->host = host; | ||
5250 | ap->ctl = ATA_DEVCTL_OBS; | 5267 | ap->ctl = ATA_DEVCTL_OBS; |
5251 | ap->host_set = host_set; | 5268 | ap->host_set = host_set; |
5252 | ap->dev = ent->dev; | 5269 | ap->dev = ent->dev; |
5253 | ap->port_no = port_no; | 5270 | ap->port_no = port_no; |
5254 | ap->hard_port_no = | ||
5255 | ent->legacy_mode ? ent->hard_port_no : port_no; | ||
5256 | ap->pio_mask = ent->pio_mask; | 5271 | ap->pio_mask = ent->pio_mask; |
5257 | ap->mwdma_mask = ent->mwdma_mask; | 5272 | ap->mwdma_mask = ent->mwdma_mask; |
5258 | ap->udma_mask = ent->udma_mask; | 5273 | ap->udma_mask = ent->udma_mask; |
@@ -5298,7 +5313,28 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
5298 | } | 5313 | } |
5299 | 5314 | ||
5300 | /** | 5315 | /** |
5301 | * ata_host_add - Attach low-level ATA driver to system | 5316 | * ata_port_init_shost - Initialize SCSI host associated with ATA port |
5317 | * @ap: ATA port to initialize SCSI host for | ||
5318 | * @shost: SCSI host associated with @ap | ||
5319 | * | ||
5320 | * Initialize SCSI host @shost associated with ATA port @ap. | ||
5321 | * | ||
5322 | * LOCKING: | ||
5323 | * Inherited from caller. | ||
5324 | */ | ||
5325 | static void ata_port_init_shost(struct ata_port *ap, struct Scsi_Host *shost) | ||
5326 | { | ||
5327 | ap->host = shost; | ||
5328 | |||
5329 | shost->unique_id = ap->id; | ||
5330 | shost->max_id = 16; | ||
5331 | shost->max_lun = 1; | ||
5332 | shost->max_channel = 1; | ||
5333 | shost->max_cmd_len = 12; | ||
5334 | } | ||
5335 | |||
5336 | /** | ||
5337 | * ata_port_add - Attach low-level ATA driver to system | ||
5302 | * @ent: Information provided by low-level driver | 5338 | * @ent: Information provided by low-level driver |
5303 | * @host_set: Collections of ports to which we add | 5339 | * @host_set: Collections of ports to which we add |
5304 | * @port_no: Port number associated with this host | 5340 | * @port_no: Port number associated with this host |
@@ -5311,14 +5347,12 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
5311 | * RETURNS: | 5347 | * RETURNS: |
5312 | * New ata_port on success, for NULL on error. | 5348 | * New ata_port on success, for NULL on error. |
5313 | */ | 5349 | */ |
5314 | 5350 | static struct ata_port * ata_port_add(const struct ata_probe_ent *ent, | |
5315 | static struct ata_port * ata_host_add(const struct ata_probe_ent *ent, | ||
5316 | struct ata_host_set *host_set, | 5351 | struct ata_host_set *host_set, |
5317 | unsigned int port_no) | 5352 | unsigned int port_no) |
5318 | { | 5353 | { |
5319 | struct Scsi_Host *host; | 5354 | struct Scsi_Host *shost; |
5320 | struct ata_port *ap; | 5355 | struct ata_port *ap; |
5321 | int rc; | ||
5322 | 5356 | ||
5323 | DPRINTK("ENTER\n"); | 5357 | DPRINTK("ENTER\n"); |
5324 | 5358 | ||
@@ -5329,25 +5363,40 @@ static struct ata_port * ata_host_add(const struct ata_probe_ent *ent, | |||
5329 | return NULL; | 5363 | return NULL; |
5330 | } | 5364 | } |
5331 | 5365 | ||
5332 | host = scsi_host_alloc(ent->sht, sizeof(struct ata_port)); | 5366 | shost = scsi_host_alloc(ent->sht, sizeof(struct ata_port)); |
5333 | if (!host) | 5367 | if (!shost) |
5334 | return NULL; | 5368 | return NULL; |
5335 | 5369 | ||
5336 | host->transportt = &ata_scsi_transport_template; | 5370 | shost->transportt = &ata_scsi_transport_template; |
5337 | 5371 | ||
5338 | ap = ata_shost_to_port(host); | 5372 | ap = ata_shost_to_port(shost); |
5339 | 5373 | ||
5340 | ata_host_init(ap, host, host_set, ent, port_no); | 5374 | ata_port_init(ap, host_set, ent, port_no); |
5341 | 5375 | ata_port_init_shost(ap, shost); | |
5342 | rc = ap->ops->port_start(ap); | ||
5343 | if (rc) | ||
5344 | goto err_out; | ||
5345 | 5376 | ||
5346 | return ap; | 5377 | return ap; |
5378 | } | ||
5347 | 5379 | ||
5348 | err_out: | 5380 | /** |
5349 | scsi_host_put(host); | 5381 | * ata_sas_host_init - Initialize a host_set struct |
5350 | return NULL; | 5382 | * @host_set: host_set to initialize |
5383 | * @dev: device host_set is attached to | ||
5384 | * @flags: host_set flags | ||
5385 | * @ops: port_ops | ||
5386 | * | ||
5387 | * LOCKING: | ||
5388 | * PCI/etc. bus probe sem. | ||
5389 | * | ||
5390 | */ | ||
5391 | |||
5392 | void ata_host_set_init(struct ata_host_set *host_set, | ||
5393 | struct device *dev, unsigned long flags, | ||
5394 | const struct ata_port_operations *ops) | ||
5395 | { | ||
5396 | spin_lock_init(&host_set->lock); | ||
5397 | host_set->dev = dev; | ||
5398 | host_set->flags = flags; | ||
5399 | host_set->ops = ops; | ||
5351 | } | 5400 | } |
5352 | 5401 | ||
5353 | /** | 5402 | /** |
@@ -5370,7 +5419,7 @@ err_out: | |||
5370 | */ | 5419 | */ |
5371 | int ata_device_add(const struct ata_probe_ent *ent) | 5420 | int ata_device_add(const struct ata_probe_ent *ent) |
5372 | { | 5421 | { |
5373 | unsigned int count = 0, i; | 5422 | unsigned int i; |
5374 | struct device *dev = ent->dev; | 5423 | struct device *dev = ent->dev; |
5375 | struct ata_host_set *host_set; | 5424 | struct ata_host_set *host_set; |
5376 | int rc; | 5425 | int rc; |
@@ -5381,50 +5430,65 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5381 | (ent->n_ports * sizeof(void *)), GFP_KERNEL); | 5430 | (ent->n_ports * sizeof(void *)), GFP_KERNEL); |
5382 | if (!host_set) | 5431 | if (!host_set) |
5383 | return 0; | 5432 | return 0; |
5384 | spin_lock_init(&host_set->lock); | ||
5385 | 5433 | ||
5386 | host_set->dev = dev; | 5434 | ata_host_set_init(host_set, dev, ent->host_set_flags, ent->port_ops); |
5387 | host_set->n_ports = ent->n_ports; | 5435 | host_set->n_ports = ent->n_ports; |
5388 | host_set->irq = ent->irq; | 5436 | host_set->irq = ent->irq; |
5437 | host_set->irq2 = ent->irq2; | ||
5389 | host_set->mmio_base = ent->mmio_base; | 5438 | host_set->mmio_base = ent->mmio_base; |
5390 | host_set->private_data = ent->private_data; | 5439 | host_set->private_data = ent->private_data; |
5391 | host_set->ops = ent->port_ops; | ||
5392 | host_set->flags = ent->host_set_flags; | ||
5393 | 5440 | ||
5394 | /* register each port bound to this device */ | 5441 | /* register each port bound to this device */ |
5395 | for (i = 0; i < ent->n_ports; i++) { | 5442 | for (i = 0; i < host_set->n_ports; i++) { |
5396 | struct ata_port *ap; | 5443 | struct ata_port *ap; |
5397 | unsigned long xfer_mode_mask; | 5444 | unsigned long xfer_mode_mask; |
5445 | int irq_line = ent->irq; | ||
5398 | 5446 | ||
5399 | ap = ata_host_add(ent, host_set, i); | 5447 | ap = ata_port_add(ent, host_set, i); |
5400 | if (!ap) | 5448 | if (!ap) |
5401 | goto err_out; | 5449 | goto err_out; |
5402 | 5450 | ||
5403 | host_set->ports[i] = ap; | 5451 | host_set->ports[i] = ap; |
5452 | |||
5453 | /* dummy? */ | ||
5454 | if (ent->dummy_port_mask & (1 << i)) { | ||
5455 | ata_port_printk(ap, KERN_INFO, "DUMMY\n"); | ||
5456 | ap->ops = &ata_dummy_port_ops; | ||
5457 | continue; | ||
5458 | } | ||
5459 | |||
5460 | /* start port */ | ||
5461 | rc = ap->ops->port_start(ap); | ||
5462 | if (rc) { | ||
5463 | host_set->ports[i] = NULL; | ||
5464 | scsi_host_put(ap->host); | ||
5465 | goto err_out; | ||
5466 | } | ||
5467 | |||
5468 | /* Report the secondary IRQ for second channel legacy */ | ||
5469 | if (i == 1 && ent->irq2) | ||
5470 | irq_line = ent->irq2; | ||
5471 | |||
5404 | xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) | | 5472 | xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) | |
5405 | (ap->mwdma_mask << ATA_SHIFT_MWDMA) | | 5473 | (ap->mwdma_mask << ATA_SHIFT_MWDMA) | |
5406 | (ap->pio_mask << ATA_SHIFT_PIO); | 5474 | (ap->pio_mask << ATA_SHIFT_PIO); |
5407 | 5475 | ||
5408 | /* print per-port info to dmesg */ | 5476 | /* print per-port info to dmesg */ |
5409 | ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%lX " | 5477 | ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%lX " |
5410 | "ctl 0x%lX bmdma 0x%lX irq %lu\n", | 5478 | "ctl 0x%lX bmdma 0x%lX irq %d\n", |
5411 | ap->flags & ATA_FLAG_SATA ? 'S' : 'P', | 5479 | ap->flags & ATA_FLAG_SATA ? 'S' : 'P', |
5412 | ata_mode_string(xfer_mode_mask), | 5480 | ata_mode_string(xfer_mode_mask), |
5413 | ap->ioaddr.cmd_addr, | 5481 | ap->ioaddr.cmd_addr, |
5414 | ap->ioaddr.ctl_addr, | 5482 | ap->ioaddr.ctl_addr, |
5415 | ap->ioaddr.bmdma_addr, | 5483 | ap->ioaddr.bmdma_addr, |
5416 | ent->irq); | 5484 | irq_line); |
5417 | 5485 | ||
5418 | ata_chk_status(ap); | 5486 | ata_chk_status(ap); |
5419 | host_set->ops->irq_clear(ap); | 5487 | host_set->ops->irq_clear(ap); |
5420 | ata_eh_freeze_port(ap); /* freeze port before requesting IRQ */ | 5488 | ata_eh_freeze_port(ap); /* freeze port before requesting IRQ */ |
5421 | count++; | ||
5422 | } | 5489 | } |
5423 | 5490 | ||
5424 | if (!count) | 5491 | /* obtain irq, that may be shared between channels */ |
5425 | goto err_free_ret; | ||
5426 | |||
5427 | /* obtain irq, that is shared between channels */ | ||
5428 | rc = request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, | 5492 | rc = request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, |
5429 | DRV_NAME, host_set); | 5493 | DRV_NAME, host_set); |
5430 | if (rc) { | 5494 | if (rc) { |
@@ -5433,15 +5497,28 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5433 | goto err_out; | 5497 | goto err_out; |
5434 | } | 5498 | } |
5435 | 5499 | ||
5500 | /* do we have a second IRQ for the other channel, eg legacy mode */ | ||
5501 | if (ent->irq2) { | ||
5502 | /* We will get weird core code crashes later if this is true | ||
5503 | so trap it now */ | ||
5504 | BUG_ON(ent->irq == ent->irq2); | ||
5505 | |||
5506 | rc = request_irq(ent->irq2, ent->port_ops->irq_handler, ent->irq_flags, | ||
5507 | DRV_NAME, host_set); | ||
5508 | if (rc) { | ||
5509 | dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n", | ||
5510 | ent->irq2, rc); | ||
5511 | goto err_out_free_irq; | ||
5512 | } | ||
5513 | } | ||
5514 | |||
5436 | /* perform each probe synchronously */ | 5515 | /* perform each probe synchronously */ |
5437 | DPRINTK("probe begin\n"); | 5516 | DPRINTK("probe begin\n"); |
5438 | for (i = 0; i < count; i++) { | 5517 | for (i = 0; i < host_set->n_ports; i++) { |
5439 | struct ata_port *ap; | 5518 | struct ata_port *ap = host_set->ports[i]; |
5440 | u32 scontrol; | 5519 | u32 scontrol; |
5441 | int rc; | 5520 | int rc; |
5442 | 5521 | ||
5443 | ap = host_set->ports[i]; | ||
5444 | |||
5445 | /* init sata_spd_limit to the current value */ | 5522 | /* init sata_spd_limit to the current value */ |
5446 | if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { | 5523 | if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { |
5447 | int spd = (scontrol >> 4) & 0xf; | 5524 | int spd = (scontrol >> 4) & 0xf; |
@@ -5497,7 +5574,7 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5497 | 5574 | ||
5498 | /* probes are done, now scan each port's disk(s) */ | 5575 | /* probes are done, now scan each port's disk(s) */ |
5499 | DPRINTK("host probe begin\n"); | 5576 | DPRINTK("host probe begin\n"); |
5500 | for (i = 0; i < count; i++) { | 5577 | for (i = 0; i < host_set->n_ports; i++) { |
5501 | struct ata_port *ap = host_set->ports[i]; | 5578 | struct ata_port *ap = host_set->ports[i]; |
5502 | 5579 | ||
5503 | ata_scsi_scan_host(ap); | 5580 | ata_scsi_scan_host(ap); |
@@ -5508,15 +5585,17 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5508 | VPRINTK("EXIT, returning %u\n", ent->n_ports); | 5585 | VPRINTK("EXIT, returning %u\n", ent->n_ports); |
5509 | return ent->n_ports; /* success */ | 5586 | return ent->n_ports; /* success */ |
5510 | 5587 | ||
5588 | err_out_free_irq: | ||
5589 | free_irq(ent->irq, host_set); | ||
5511 | err_out: | 5590 | err_out: |
5512 | for (i = 0; i < count; i++) { | 5591 | for (i = 0; i < host_set->n_ports; i++) { |
5513 | struct ata_port *ap = host_set->ports[i]; | 5592 | struct ata_port *ap = host_set->ports[i]; |
5514 | if (ap) { | 5593 | if (ap) { |
5515 | ap->ops->port_stop(ap); | 5594 | ap->ops->port_stop(ap); |
5516 | scsi_host_put(ap->host); | 5595 | scsi_host_put(ap->host); |
5517 | } | 5596 | } |
5518 | } | 5597 | } |
5519 | err_free_ret: | 5598 | |
5520 | kfree(host_set); | 5599 | kfree(host_set); |
5521 | VPRINTK("EXIT, returning 0\n"); | 5600 | VPRINTK("EXIT, returning 0\n"); |
5522 | return 0; | 5601 | return 0; |
@@ -5599,6 +5678,8 @@ void ata_host_set_remove(struct ata_host_set *host_set) | |||
5599 | ata_port_detach(host_set->ports[i]); | 5678 | ata_port_detach(host_set->ports[i]); |
5600 | 5679 | ||
5601 | free_irq(host_set->irq, host_set); | 5680 | free_irq(host_set->irq, host_set); |
5681 | if (host_set->irq2) | ||
5682 | free_irq(host_set->irq2, host_set); | ||
5602 | 5683 | ||
5603 | for (i = 0; i < host_set->n_ports; i++) { | 5684 | for (i = 0; i < host_set->n_ports; i++) { |
5604 | struct ata_port *ap = host_set->ports[i]; | 5685 | struct ata_port *ap = host_set->ports[i]; |
@@ -5608,10 +5689,11 @@ void ata_host_set_remove(struct ata_host_set *host_set) | |||
5608 | if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { | 5689 | if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { |
5609 | struct ata_ioports *ioaddr = &ap->ioaddr; | 5690 | struct ata_ioports *ioaddr = &ap->ioaddr; |
5610 | 5691 | ||
5611 | if (ioaddr->cmd_addr == 0x1f0) | 5692 | /* FIXME: Add -ac IDE pci mods to remove these special cases */ |
5612 | release_region(0x1f0, 8); | 5693 | if (ioaddr->cmd_addr == ATA_PRIMARY_CMD) |
5613 | else if (ioaddr->cmd_addr == 0x170) | 5694 | release_region(ATA_PRIMARY_CMD, 8); |
5614 | release_region(0x170, 8); | 5695 | else if (ioaddr->cmd_addr == ATA_SECONDARY_CMD) |
5696 | release_region(ATA_SECONDARY_CMD, 8); | ||
5615 | } | 5697 | } |
5616 | 5698 | ||
5617 | scsi_host_put(ap->host); | 5699 | scsi_host_put(ap->host); |
@@ -5650,6 +5732,31 @@ int ata_scsi_release(struct Scsi_Host *host) | |||
5650 | return 1; | 5732 | return 1; |
5651 | } | 5733 | } |
5652 | 5734 | ||
5735 | struct ata_probe_ent * | ||
5736 | ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port) | ||
5737 | { | ||
5738 | struct ata_probe_ent *probe_ent; | ||
5739 | |||
5740 | probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL); | ||
5741 | if (!probe_ent) { | ||
5742 | printk(KERN_ERR DRV_NAME "(%s): out of memory\n", | ||
5743 | kobject_name(&(dev->kobj))); | ||
5744 | return NULL; | ||
5745 | } | ||
5746 | |||
5747 | INIT_LIST_HEAD(&probe_ent->node); | ||
5748 | probe_ent->dev = dev; | ||
5749 | |||
5750 | probe_ent->sht = port->sht; | ||
5751 | probe_ent->host_flags = port->host_flags; | ||
5752 | probe_ent->pio_mask = port->pio_mask; | ||
5753 | probe_ent->mwdma_mask = port->mwdma_mask; | ||
5754 | probe_ent->udma_mask = port->udma_mask; | ||
5755 | probe_ent->port_ops = port->port_ops; | ||
5756 | |||
5757 | return probe_ent; | ||
5758 | } | ||
5759 | |||
5653 | /** | 5760 | /** |
5654 | * ata_std_ports - initialize ioaddr with standard port offsets. | 5761 | * ata_std_ports - initialize ioaddr with standard port offsets. |
5655 | * @ioaddr: IO address structure to be initialized | 5762 | * @ioaddr: IO address structure to be initialized |
@@ -5704,11 +5811,8 @@ void ata_pci_remove_one (struct pci_dev *pdev) | |||
5704 | { | 5811 | { |
5705 | struct device *dev = pci_dev_to_dev(pdev); | 5812 | struct device *dev = pci_dev_to_dev(pdev); |
5706 | struct ata_host_set *host_set = dev_get_drvdata(dev); | 5813 | struct ata_host_set *host_set = dev_get_drvdata(dev); |
5707 | struct ata_host_set *host_set2 = host_set->next; | ||
5708 | 5814 | ||
5709 | ata_host_set_remove(host_set); | 5815 | ata_host_set_remove(host_set); |
5710 | if (host_set2) | ||
5711 | ata_host_set_remove(host_set2); | ||
5712 | 5816 | ||
5713 | pci_release_regions(pdev); | 5817 | pci_release_regions(pdev); |
5714 | pci_disable_device(pdev); | 5818 | pci_disable_device(pdev); |
@@ -5749,11 +5853,11 @@ int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits) | |||
5749 | return (tmp == bits->val) ? 1 : 0; | 5853 | return (tmp == bits->val) ? 1 : 0; |
5750 | } | 5854 | } |
5751 | 5855 | ||
5752 | void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t state) | 5856 | void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg) |
5753 | { | 5857 | { |
5754 | pci_save_state(pdev); | 5858 | pci_save_state(pdev); |
5755 | 5859 | ||
5756 | if (state.event == PM_EVENT_SUSPEND) { | 5860 | if (mesg.event == PM_EVENT_SUSPEND) { |
5757 | pci_disable_device(pdev); | 5861 | pci_disable_device(pdev); |
5758 | pci_set_power_state(pdev, PCI_D3hot); | 5862 | pci_set_power_state(pdev, PCI_D3hot); |
5759 | } | 5863 | } |
@@ -5767,24 +5871,16 @@ void ata_pci_device_do_resume(struct pci_dev *pdev) | |||
5767 | pci_set_master(pdev); | 5871 | pci_set_master(pdev); |
5768 | } | 5872 | } |
5769 | 5873 | ||
5770 | int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state) | 5874 | int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) |
5771 | { | 5875 | { |
5772 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); | 5876 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); |
5773 | int rc = 0; | 5877 | int rc = 0; |
5774 | 5878 | ||
5775 | rc = ata_host_set_suspend(host_set, state); | 5879 | rc = ata_host_set_suspend(host_set, mesg); |
5776 | if (rc) | 5880 | if (rc) |
5777 | return rc; | 5881 | return rc; |
5778 | 5882 | ||
5779 | if (host_set->next) { | 5883 | ata_pci_device_do_suspend(pdev, mesg); |
5780 | rc = ata_host_set_suspend(host_set->next, state); | ||
5781 | if (rc) { | ||
5782 | ata_host_set_resume(host_set); | ||
5783 | return rc; | ||
5784 | } | ||
5785 | } | ||
5786 | |||
5787 | ata_pci_device_do_suspend(pdev, state); | ||
5788 | 5884 | ||
5789 | return 0; | 5885 | return 0; |
5790 | } | 5886 | } |
@@ -5795,9 +5891,6 @@ int ata_pci_device_resume(struct pci_dev *pdev) | |||
5795 | 5891 | ||
5796 | ata_pci_device_do_resume(pdev); | 5892 | ata_pci_device_do_resume(pdev); |
5797 | ata_host_set_resume(host_set); | 5893 | ata_host_set_resume(host_set); |
5798 | if (host_set->next) | ||
5799 | ata_host_set_resume(host_set->next); | ||
5800 | |||
5801 | return 0; | 5894 | return 0; |
5802 | } | 5895 | } |
5803 | #endif /* CONFIG_PCI */ | 5896 | #endif /* CONFIG_PCI */ |
@@ -5897,6 +5990,39 @@ u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | |||
5897 | } | 5990 | } |
5898 | 5991 | ||
5899 | /* | 5992 | /* |
5993 | * Dummy port_ops | ||
5994 | */ | ||
5995 | static void ata_dummy_noret(struct ata_port *ap) { } | ||
5996 | static int ata_dummy_ret0(struct ata_port *ap) { return 0; } | ||
5997 | static void ata_dummy_qc_noret(struct ata_queued_cmd *qc) { } | ||
5998 | |||
5999 | static u8 ata_dummy_check_status(struct ata_port *ap) | ||
6000 | { | ||
6001 | return ATA_DRDY; | ||
6002 | } | ||
6003 | |||
6004 | static unsigned int ata_dummy_qc_issue(struct ata_queued_cmd *qc) | ||
6005 | { | ||
6006 | return AC_ERR_SYSTEM; | ||
6007 | } | ||
6008 | |||
6009 | const struct ata_port_operations ata_dummy_port_ops = { | ||
6010 | .port_disable = ata_port_disable, | ||
6011 | .check_status = ata_dummy_check_status, | ||
6012 | .check_altstatus = ata_dummy_check_status, | ||
6013 | .dev_select = ata_noop_dev_select, | ||
6014 | .qc_prep = ata_noop_qc_prep, | ||
6015 | .qc_issue = ata_dummy_qc_issue, | ||
6016 | .freeze = ata_dummy_noret, | ||
6017 | .thaw = ata_dummy_noret, | ||
6018 | .error_handler = ata_dummy_noret, | ||
6019 | .post_internal_cmd = ata_dummy_qc_noret, | ||
6020 | .irq_clear = ata_dummy_noret, | ||
6021 | .port_start = ata_dummy_ret0, | ||
6022 | .port_stop = ata_dummy_noret, | ||
6023 | }; | ||
6024 | |||
6025 | /* | ||
5900 | * libata is essentially a library of internal helper functions for | 6026 | * libata is essentially a library of internal helper functions for |
5901 | * low-level ATA host controller drivers. As such, the API/ABI is | 6027 | * low-level ATA host controller drivers. As such, the API/ABI is |
5902 | * likely to change as new drivers are added and updated. | 6028 | * likely to change as new drivers are added and updated. |
@@ -5906,8 +6032,10 @@ u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | |||
5906 | EXPORT_SYMBOL_GPL(sata_deb_timing_normal); | 6032 | EXPORT_SYMBOL_GPL(sata_deb_timing_normal); |
5907 | EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); | 6033 | EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); |
5908 | EXPORT_SYMBOL_GPL(sata_deb_timing_long); | 6034 | EXPORT_SYMBOL_GPL(sata_deb_timing_long); |
6035 | EXPORT_SYMBOL_GPL(ata_dummy_port_ops); | ||
5909 | EXPORT_SYMBOL_GPL(ata_std_bios_param); | 6036 | EXPORT_SYMBOL_GPL(ata_std_bios_param); |
5910 | EXPORT_SYMBOL_GPL(ata_std_ports); | 6037 | EXPORT_SYMBOL_GPL(ata_std_ports); |
6038 | EXPORT_SYMBOL_GPL(ata_host_set_init); | ||
5911 | EXPORT_SYMBOL_GPL(ata_device_add); | 6039 | EXPORT_SYMBOL_GPL(ata_device_add); |
5912 | EXPORT_SYMBOL_GPL(ata_port_detach); | 6040 | EXPORT_SYMBOL_GPL(ata_port_detach); |
5913 | EXPORT_SYMBOL_GPL(ata_host_set_remove); | 6041 | EXPORT_SYMBOL_GPL(ata_host_set_remove); |
diff --git a/drivers/scsi/libata-eh.c b/drivers/ata/libata-eh.c index 29f59345305d..2c476eee463f 100644 --- a/drivers/scsi/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <scsi/scsi_eh.h> | 39 | #include <scsi/scsi_eh.h> |
40 | #include <scsi/scsi_device.h> | 40 | #include <scsi/scsi_device.h> |
41 | #include <scsi/scsi_cmnd.h> | 41 | #include <scsi/scsi_cmnd.h> |
42 | #include "scsi_transport_api.h" | 42 | #include "../scsi/scsi_transport_api.h" |
43 | 43 | ||
44 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
45 | 45 | ||
diff --git a/drivers/scsi/libata-scsi.c b/drivers/ata/libata-scsi.c index e92c31d698ff..d168e3413661 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -400,7 +400,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf) | |||
400 | /** | 400 | /** |
401 | * ata_scsi_device_suspend - suspend ATA device associated with sdev | 401 | * ata_scsi_device_suspend - suspend ATA device associated with sdev |
402 | * @sdev: the SCSI device to suspend | 402 | * @sdev: the SCSI device to suspend |
403 | * @state: target power management state | 403 | * @mesg: target power management message |
404 | * | 404 | * |
405 | * Request suspend EH action on the ATA device associated with | 405 | * Request suspend EH action on the ATA device associated with |
406 | * @sdev and wait for the operation to complete. | 406 | * @sdev and wait for the operation to complete. |
@@ -411,7 +411,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf) | |||
411 | * RETURNS: | 411 | * RETURNS: |
412 | * 0 on success, -errno otherwise. | 412 | * 0 on success, -errno otherwise. |
413 | */ | 413 | */ |
414 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) | 414 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t mesg) |
415 | { | 415 | { |
416 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 416 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
417 | struct ata_device *dev = ata_scsi_find_dev(ap, sdev); | 417 | struct ata_device *dev = ata_scsi_find_dev(ap, sdev); |
@@ -438,7 +438,7 @@ int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) | |||
438 | 438 | ||
439 | /* request suspend */ | 439 | /* request suspend */ |
440 | action = ATA_EH_SUSPEND; | 440 | action = ATA_EH_SUSPEND; |
441 | if (state.event != PM_EVENT_SUSPEND) | 441 | if (mesg.event != PM_EVENT_SUSPEND) |
442 | action |= ATA_EH_PM_FREEZE; | 442 | action |= ATA_EH_PM_FREEZE; |
443 | ap->eh_info.dev_action[dev->devno] |= action; | 443 | ap->eh_info.dev_action[dev->devno] |= action; |
444 | ap->eh_info.flags |= ATA_EHI_QUIET; | 444 | ap->eh_info.flags |= ATA_EHI_QUIET; |
@@ -463,7 +463,7 @@ int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) | |||
463 | spin_unlock_irqrestore(ap->lock, flags); | 463 | spin_unlock_irqrestore(ap->lock, flags); |
464 | out: | 464 | out: |
465 | if (rc == 0) | 465 | if (rc == 0) |
466 | sdev->sdev_gendev.power.power_state = state; | 466 | sdev->sdev_gendev.power.power_state = mesg; |
467 | return rc; | 467 | return rc; |
468 | } | 468 | } |
469 | 469 | ||
@@ -3171,3 +3171,152 @@ void ata_scsi_dev_rescan(void *data) | |||
3171 | scsi_rescan_device(&(dev->sdev->sdev_gendev)); | 3171 | scsi_rescan_device(&(dev->sdev->sdev_gendev)); |
3172 | } | 3172 | } |
3173 | } | 3173 | } |
3174 | |||
3175 | /** | ||
3176 | * ata_sas_port_alloc - Allocate port for a SAS attached SATA device | ||
3177 | * @pdev: PCI device that the scsi device is attached to | ||
3178 | * @port_info: Information from low-level host driver | ||
3179 | * @host: SCSI host that the scsi device is attached to | ||
3180 | * | ||
3181 | * LOCKING: | ||
3182 | * PCI/etc. bus probe sem. | ||
3183 | * | ||
3184 | * RETURNS: | ||
3185 | * ata_port pointer on success / NULL on failure. | ||
3186 | */ | ||
3187 | |||
3188 | struct ata_port *ata_sas_port_alloc(struct ata_host_set *host_set, | ||
3189 | struct ata_port_info *port_info, | ||
3190 | struct Scsi_Host *host) | ||
3191 | { | ||
3192 | struct ata_port *ap = kzalloc(sizeof(*ap), GFP_KERNEL); | ||
3193 | struct ata_probe_ent *ent; | ||
3194 | |||
3195 | if (!ap) | ||
3196 | return NULL; | ||
3197 | |||
3198 | ent = ata_probe_ent_alloc(host_set->dev, port_info); | ||
3199 | if (!ent) { | ||
3200 | kfree(ap); | ||
3201 | return NULL; | ||
3202 | } | ||
3203 | |||
3204 | ata_port_init(ap, host_set, ent, 0); | ||
3205 | ap->lock = host->host_lock; | ||
3206 | kfree(ent); | ||
3207 | return ap; | ||
3208 | } | ||
3209 | EXPORT_SYMBOL_GPL(ata_sas_port_alloc); | ||
3210 | |||
3211 | /** | ||
3212 | * ata_sas_port_start - Set port up for dma. | ||
3213 | * @ap: Port to initialize | ||
3214 | * | ||
3215 | * Called just after data structures for each port are | ||
3216 | * initialized. Allocates DMA pad. | ||
3217 | * | ||
3218 | * May be used as the port_start() entry in ata_port_operations. | ||
3219 | * | ||
3220 | * LOCKING: | ||
3221 | * Inherited from caller. | ||
3222 | */ | ||
3223 | int ata_sas_port_start(struct ata_port *ap) | ||
3224 | { | ||
3225 | return ata_pad_alloc(ap, ap->dev); | ||
3226 | } | ||
3227 | EXPORT_SYMBOL_GPL(ata_sas_port_start); | ||
3228 | |||
3229 | /** | ||
3230 | * ata_port_stop - Undo ata_sas_port_start() | ||
3231 | * @ap: Port to shut down | ||
3232 | * | ||
3233 | * Frees the DMA pad. | ||
3234 | * | ||
3235 | * May be used as the port_stop() entry in ata_port_operations. | ||
3236 | * | ||
3237 | * LOCKING: | ||
3238 | * Inherited from caller. | ||
3239 | */ | ||
3240 | |||
3241 | void ata_sas_port_stop(struct ata_port *ap) | ||
3242 | { | ||
3243 | ata_pad_free(ap, ap->dev); | ||
3244 | } | ||
3245 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); | ||
3246 | |||
3247 | /** | ||
3248 | * ata_sas_port_init - Initialize a SATA device | ||
3249 | * @ap: SATA port to initialize | ||
3250 | * | ||
3251 | * LOCKING: | ||
3252 | * PCI/etc. bus probe sem. | ||
3253 | * | ||
3254 | * RETURNS: | ||
3255 | * Zero on success, non-zero on error. | ||
3256 | */ | ||
3257 | |||
3258 | int ata_sas_port_init(struct ata_port *ap) | ||
3259 | { | ||
3260 | int rc = ap->ops->port_start(ap); | ||
3261 | |||
3262 | if (!rc) | ||
3263 | rc = ata_bus_probe(ap); | ||
3264 | |||
3265 | return rc; | ||
3266 | } | ||
3267 | EXPORT_SYMBOL_GPL(ata_sas_port_init); | ||
3268 | |||
3269 | /** | ||
3270 | * ata_sas_port_destroy - Destroy a SATA port allocated by ata_sas_port_alloc | ||
3271 | * @ap: SATA port to destroy | ||
3272 | * | ||
3273 | */ | ||
3274 | |||
3275 | void ata_sas_port_destroy(struct ata_port *ap) | ||
3276 | { | ||
3277 | ap->ops->port_stop(ap); | ||
3278 | kfree(ap); | ||
3279 | } | ||
3280 | EXPORT_SYMBOL_GPL(ata_sas_port_destroy); | ||
3281 | |||
3282 | /** | ||
3283 | * ata_sas_slave_configure - Default slave_config routine for libata devices | ||
3284 | * @sdev: SCSI device to configure | ||
3285 | * @ap: ATA port to which SCSI device is attached | ||
3286 | * | ||
3287 | * RETURNS: | ||
3288 | * Zero. | ||
3289 | */ | ||
3290 | |||
3291 | int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) | ||
3292 | { | ||
3293 | ata_scsi_sdev_config(sdev); | ||
3294 | ata_scsi_dev_config(sdev, ap->device); | ||
3295 | return 0; | ||
3296 | } | ||
3297 | EXPORT_SYMBOL_GPL(ata_sas_slave_configure); | ||
3298 | |||
3299 | /** | ||
3300 | * ata_sas_queuecmd - Issue SCSI cdb to libata-managed device | ||
3301 | * @cmd: SCSI command to be sent | ||
3302 | * @done: Completion function, called when command is complete | ||
3303 | * @ap: ATA port to which the command is being sent | ||
3304 | * | ||
3305 | * RETURNS: | ||
3306 | * Zero. | ||
3307 | */ | ||
3308 | |||
3309 | int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | ||
3310 | struct ata_port *ap) | ||
3311 | { | ||
3312 | ata_scsi_dump_cdb(ap, cmd); | ||
3313 | |||
3314 | if (likely(ata_scsi_dev_enabled(ap->device))) | ||
3315 | __ata_scsi_queuecmd(cmd, done, ap->device); | ||
3316 | else { | ||
3317 | cmd->result = (DID_BAD_TARGET << 16); | ||
3318 | done(cmd); | ||
3319 | } | ||
3320 | return 0; | ||
3321 | } | ||
3322 | EXPORT_SYMBOL_GPL(ata_sas_queuecmd); | ||
diff --git a/drivers/scsi/libata.h b/drivers/ata/libata.h index c325679d9b54..d4a4f82360ec 100644 --- a/drivers/scsi/libata.h +++ b/drivers/ata/libata.h | |||
@@ -69,6 +69,10 @@ extern int ata_flush_cache(struct ata_device *dev); | |||
69 | extern void ata_dev_init(struct ata_device *dev); | 69 | extern void ata_dev_init(struct ata_device *dev); |
70 | extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); | 70 | extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); |
71 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); | 71 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); |
72 | extern void ata_port_init(struct ata_port *ap, struct ata_host_set *host_set, | ||
73 | const struct ata_probe_ent *ent, unsigned int port_no); | ||
74 | extern struct ata_probe_ent *ata_probe_ent_alloc(struct device *dev, | ||
75 | const struct ata_port_info *port); | ||
72 | 76 | ||
73 | 77 | ||
74 | /* libata-scsi.c */ | 78 | /* libata-scsi.c */ |
@@ -107,6 +111,7 @@ extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |||
107 | u8 *rbuf, unsigned int buflen)); | 111 | u8 *rbuf, unsigned int buflen)); |
108 | extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); | 112 | extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); |
109 | extern void ata_scsi_dev_rescan(void *data); | 113 | extern void ata_scsi_dev_rescan(void *data); |
114 | extern int ata_bus_probe(struct ata_port *ap); | ||
110 | 115 | ||
111 | /* libata-eh.c */ | 116 | /* libata-eh.c */ |
112 | extern enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd); | 117 | extern enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd); |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/ata/pdc_adma.c index efc8fff1d250..61d2aa697b4d 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -722,7 +722,7 @@ err_out: | |||
722 | 722 | ||
723 | static int __init adma_ata_init(void) | 723 | static int __init adma_ata_init(void) |
724 | { | 724 | { |
725 | return pci_module_init(&adma_ata_pci_driver); | 725 | return pci_register_driver(&adma_ata_pci_driver); |
726 | } | 726 | } |
727 | 727 | ||
728 | static void __exit adma_ata_exit(void) | 728 | static void __exit adma_ata_exit(void) |
diff --git a/drivers/scsi/sata_mv.c b/drivers/ata/sata_mv.c index 1053c7c76b7d..a2915a56accd 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -2447,7 +2447,7 @@ err_out: | |||
2447 | 2447 | ||
2448 | static int __init mv_init(void) | 2448 | static int __init mv_init(void) |
2449 | { | 2449 | { |
2450 | return pci_module_init(&mv_pci_driver); | 2450 | return pci_register_driver(&mv_pci_driver); |
2451 | } | 2451 | } |
2452 | 2452 | ||
2453 | static void __exit mv_exit(void) | 2453 | static void __exit mv_exit(void) |
diff --git a/drivers/scsi/sata_nv.c b/drivers/ata/sata_nv.c index 56da25581f31..be46df75ab5a 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -583,7 +583,7 @@ static void nv_ck804_host_stop(struct ata_host_set *host_set) | |||
583 | 583 | ||
584 | static int __init nv_init(void) | 584 | static int __init nv_init(void) |
585 | { | 585 | { |
586 | return pci_module_init(&nv_pci_driver); | 586 | return pci_register_driver(&nv_pci_driver); |
587 | } | 587 | } |
588 | 588 | ||
589 | static void __exit nv_exit(void) | 589 | static void __exit nv_exit(void) |
diff --git a/drivers/scsi/sata_promise.c b/drivers/ata/sata_promise.c index 4776f4e55839..a5b3a7db7a9f 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -824,7 +824,7 @@ err_out: | |||
824 | 824 | ||
825 | static int __init pdc_ata_init(void) | 825 | static int __init pdc_ata_init(void) |
826 | { | 826 | { |
827 | return pci_module_init(&pdc_ata_pci_driver); | 827 | return pci_register_driver(&pdc_ata_pci_driver); |
828 | } | 828 | } |
829 | 829 | ||
830 | 830 | ||
diff --git a/drivers/scsi/sata_promise.h b/drivers/ata/sata_promise.h index 6ee5e190262d..6ee5e190262d 100644 --- a/drivers/scsi/sata_promise.h +++ b/drivers/ata/sata_promise.h | |||
diff --git a/drivers/scsi/sata_qstor.c b/drivers/ata/sata_qstor.c index d374c1db0cf3..71bd6712b377 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -712,7 +712,7 @@ err_out: | |||
712 | 712 | ||
713 | static int __init qs_ata_init(void) | 713 | static int __init qs_ata_init(void) |
714 | { | 714 | { |
715 | return pci_module_init(&qs_ata_pci_driver); | 715 | return pci_register_driver(&qs_ata_pci_driver); |
716 | } | 716 | } |
717 | 717 | ||
718 | static void __exit qs_ata_exit(void) | 718 | static void __exit qs_ata_exit(void) |
diff --git a/drivers/scsi/sata_sil.c b/drivers/ata/sata_sil.c index d0a85073ebf7..f17b3ae4dd37 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -109,7 +109,9 @@ enum { | |||
109 | }; | 109 | }; |
110 | 110 | ||
111 | static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 111 | static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
112 | #ifdef CONFIG_PM | ||
112 | static int sil_pci_device_resume(struct pci_dev *pdev); | 113 | static int sil_pci_device_resume(struct pci_dev *pdev); |
114 | #endif | ||
113 | static void sil_dev_config(struct ata_port *ap, struct ata_device *dev); | 115 | static void sil_dev_config(struct ata_port *ap, struct ata_device *dev); |
114 | static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg); | 116 | static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg); |
115 | static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 117 | static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
@@ -141,12 +143,8 @@ static const struct sil_drivelist { | |||
141 | { "ST330013AS", SIL_QUIRK_MOD15WRITE }, | 143 | { "ST330013AS", SIL_QUIRK_MOD15WRITE }, |
142 | { "ST340017AS", SIL_QUIRK_MOD15WRITE }, | 144 | { "ST340017AS", SIL_QUIRK_MOD15WRITE }, |
143 | { "ST360015AS", SIL_QUIRK_MOD15WRITE }, | 145 | { "ST360015AS", SIL_QUIRK_MOD15WRITE }, |
144 | { "ST380013AS", SIL_QUIRK_MOD15WRITE }, | ||
145 | { "ST380023AS", SIL_QUIRK_MOD15WRITE }, | 146 | { "ST380023AS", SIL_QUIRK_MOD15WRITE }, |
146 | { "ST3120023AS", SIL_QUIRK_MOD15WRITE }, | 147 | { "ST3120023AS", SIL_QUIRK_MOD15WRITE }, |
147 | { "ST3160023AS", SIL_QUIRK_MOD15WRITE }, | ||
148 | { "ST3120026AS", SIL_QUIRK_MOD15WRITE }, | ||
149 | { "ST3200822AS", SIL_QUIRK_MOD15WRITE }, | ||
150 | { "ST340014ASL", SIL_QUIRK_MOD15WRITE }, | 148 | { "ST340014ASL", SIL_QUIRK_MOD15WRITE }, |
151 | { "ST360014ASL", SIL_QUIRK_MOD15WRITE }, | 149 | { "ST360014ASL", SIL_QUIRK_MOD15WRITE }, |
152 | { "ST380011ASL", SIL_QUIRK_MOD15WRITE }, | 150 | { "ST380011ASL", SIL_QUIRK_MOD15WRITE }, |
@@ -161,8 +159,10 @@ static struct pci_driver sil_pci_driver = { | |||
161 | .id_table = sil_pci_tbl, | 159 | .id_table = sil_pci_tbl, |
162 | .probe = sil_init_one, | 160 | .probe = sil_init_one, |
163 | .remove = ata_pci_remove_one, | 161 | .remove = ata_pci_remove_one, |
162 | #ifdef CONFIG_PM | ||
164 | .suspend = ata_pci_device_suspend, | 163 | .suspend = ata_pci_device_suspend, |
165 | .resume = sil_pci_device_resume, | 164 | .resume = sil_pci_device_resume, |
165 | #endif | ||
166 | }; | 166 | }; |
167 | 167 | ||
168 | static struct scsi_host_template sil_sht = { | 168 | static struct scsi_host_template sil_sht = { |
@@ -700,6 +700,7 @@ err_out: | |||
700 | return rc; | 700 | return rc; |
701 | } | 701 | } |
702 | 702 | ||
703 | #ifdef CONFIG_PM | ||
703 | static int sil_pci_device_resume(struct pci_dev *pdev) | 704 | static int sil_pci_device_resume(struct pci_dev *pdev) |
704 | { | 705 | { |
705 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); | 706 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); |
@@ -711,10 +712,11 @@ static int sil_pci_device_resume(struct pci_dev *pdev) | |||
711 | 712 | ||
712 | return 0; | 713 | return 0; |
713 | } | 714 | } |
715 | #endif | ||
714 | 716 | ||
715 | static int __init sil_init(void) | 717 | static int __init sil_init(void) |
716 | { | 718 | { |
717 | return pci_module_init(&sil_pci_driver); | 719 | return pci_register_driver(&sil_pci_driver); |
718 | } | 720 | } |
719 | 721 | ||
720 | static void __exit sil_exit(void) | 722 | static void __exit sil_exit(void) |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/ata/sata_sil24.c index 3f368c7d3ef9..2d7cf3264587 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -339,7 +339,9 @@ static int sil24_port_start(struct ata_port *ap); | |||
339 | static void sil24_port_stop(struct ata_port *ap); | 339 | static void sil24_port_stop(struct ata_port *ap); |
340 | static void sil24_host_stop(struct ata_host_set *host_set); | 340 | static void sil24_host_stop(struct ata_host_set *host_set); |
341 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 341 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
342 | #ifdef CONFIG_PM | ||
342 | static int sil24_pci_device_resume(struct pci_dev *pdev); | 343 | static int sil24_pci_device_resume(struct pci_dev *pdev); |
344 | #endif | ||
343 | 345 | ||
344 | static const struct pci_device_id sil24_pci_tbl[] = { | 346 | static const struct pci_device_id sil24_pci_tbl[] = { |
345 | { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, | 347 | { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, |
@@ -355,8 +357,10 @@ static struct pci_driver sil24_pci_driver = { | |||
355 | .id_table = sil24_pci_tbl, | 357 | .id_table = sil24_pci_tbl, |
356 | .probe = sil24_init_one, | 358 | .probe = sil24_init_one, |
357 | .remove = ata_pci_remove_one, /* safe? */ | 359 | .remove = ata_pci_remove_one, /* safe? */ |
360 | #ifdef CONFIG_PM | ||
358 | .suspend = ata_pci_device_suspend, | 361 | .suspend = ata_pci_device_suspend, |
359 | .resume = sil24_pci_device_resume, | 362 | .resume = sil24_pci_device_resume, |
363 | #endif | ||
360 | }; | 364 | }; |
361 | 365 | ||
362 | static struct scsi_host_template sil24_sht = { | 366 | static struct scsi_host_template sil24_sht = { |
@@ -1184,6 +1188,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1184 | return rc; | 1188 | return rc; |
1185 | } | 1189 | } |
1186 | 1190 | ||
1191 | #ifdef CONFIG_PM | ||
1187 | static int sil24_pci_device_resume(struct pci_dev *pdev) | 1192 | static int sil24_pci_device_resume(struct pci_dev *pdev) |
1188 | { | 1193 | { |
1189 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); | 1194 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); |
@@ -1202,10 +1207,11 @@ static int sil24_pci_device_resume(struct pci_dev *pdev) | |||
1202 | 1207 | ||
1203 | return 0; | 1208 | return 0; |
1204 | } | 1209 | } |
1210 | #endif | ||
1205 | 1211 | ||
1206 | static int __init sil24_init(void) | 1212 | static int __init sil24_init(void) |
1207 | { | 1213 | { |
1208 | return pci_module_init(&sil24_pci_driver); | 1214 | return pci_register_driver(&sil24_pci_driver); |
1209 | } | 1215 | } |
1210 | 1216 | ||
1211 | static void __exit sil24_exit(void) | 1217 | static void __exit sil24_exit(void) |
diff --git a/drivers/scsi/sata_sis.c b/drivers/ata/sata_sis.c index ee6b5df41d30..ac24f66897f6 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -334,7 +334,7 @@ err_out: | |||
334 | 334 | ||
335 | static int __init sis_init(void) | 335 | static int __init sis_init(void) |
336 | { | 336 | { |
337 | return pci_module_init(&sis_pci_driver); | 337 | return pci_register_driver(&sis_pci_driver); |
338 | } | 338 | } |
339 | 339 | ||
340 | static void __exit sis_exit(void) | 340 | static void __exit sis_exit(void) |
diff --git a/drivers/scsi/sata_svw.c b/drivers/ata/sata_svw.c index 7d0858095e1f..baf259a966d0 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -488,7 +488,7 @@ static struct pci_driver k2_sata_pci_driver = { | |||
488 | 488 | ||
489 | static int __init k2_sata_init(void) | 489 | static int __init k2_sata_init(void) |
490 | { | 490 | { |
491 | return pci_module_init(&k2_sata_pci_driver); | 491 | return pci_register_driver(&k2_sata_pci_driver); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
diff --git a/drivers/scsi/sata_sx4.c b/drivers/ata/sata_sx4.c index ccc8cad24f7d..0da83cba5c12 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -1482,7 +1482,7 @@ err_out: | |||
1482 | 1482 | ||
1483 | static int __init pdc_sata_init(void) | 1483 | static int __init pdc_sata_init(void) |
1484 | { | 1484 | { |
1485 | return pci_module_init(&pdc_sata_pci_driver); | 1485 | return pci_register_driver(&pdc_sata_pci_driver); |
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | 1488 | ||
diff --git a/drivers/scsi/sata_uli.c b/drivers/ata/sata_uli.c index 33cdb4867ef1..654aae2b25c5 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -287,7 +287,7 @@ err_out: | |||
287 | 287 | ||
288 | static int __init uli_init(void) | 288 | static int __init uli_init(void) |
289 | { | 289 | { |
290 | return pci_module_init(&uli_pci_driver); | 290 | return pci_register_driver(&uli_pci_driver); |
291 | } | 291 | } |
292 | 292 | ||
293 | static void __exit uli_exit(void) | 293 | static void __exit uli_exit(void) |
diff --git a/drivers/scsi/sata_via.c b/drivers/ata/sata_via.c index 01d40369a8a5..a0699a1728d4 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -77,6 +77,7 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | |||
77 | static void vt6420_error_handler(struct ata_port *ap); | 77 | static void vt6420_error_handler(struct ata_port *ap); |
78 | 78 | ||
79 | static const struct pci_device_id svia_pci_tbl[] = { | 79 | static const struct pci_device_id svia_pci_tbl[] = { |
80 | { 0x1106, 0x0591, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, | ||
80 | { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, | 81 | { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, |
81 | { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, | 82 | { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, |
82 | 83 | ||
@@ -488,7 +489,7 @@ err_out: | |||
488 | 489 | ||
489 | static int __init svia_init(void) | 490 | static int __init svia_init(void) |
490 | { | 491 | { |
491 | return pci_module_init(&svia_pci_driver); | 492 | return pci_register_driver(&svia_pci_driver); |
492 | } | 493 | } |
493 | 494 | ||
494 | static void __exit svia_exit(void) | 495 | static void __exit svia_exit(void) |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/ata/sata_vsc.c index ad37871594f5..4c69a705a483 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -462,7 +462,7 @@ static struct pci_driver vsc_sata_pci_driver = { | |||
462 | 462 | ||
463 | static int __init vsc_sata_init(void) | 463 | static int __init vsc_sata_init(void) |
464 | { | 464 | { |
465 | return pci_module_init(&vsc_sata_pci_driver); | 465 | return pci_register_driver(&vsc_sata_pci_driver); |
466 | } | 466 | } |
467 | 467 | ||
468 | 468 | ||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index fb08bc951ac0..2d967b460d98 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1209,7 +1209,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_ | |||
1209 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); | 1209 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); |
1210 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); | 1210 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); |
1211 | 1211 | ||
1212 | #if defined(CONFIG_SCSI_SATA) || defined(CONFIG_SCSI_SATA_MODULE) | 1212 | #if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE) |
1213 | 1213 | ||
1214 | /* | 1214 | /* |
1215 | * If we are using libata we can drive this chip properly but must | 1215 | * If we are using libata we can drive this chip properly but must |
@@ -1299,7 +1299,7 @@ static int __init combined_setup(char *str) | |||
1299 | } | 1299 | } |
1300 | __setup("combined_mode=", combined_setup); | 1300 | __setup("combined_mode=", combined_setup); |
1301 | 1301 | ||
1302 | #ifdef CONFIG_SCSI_SATA_INTEL_COMBINED | 1302 | #ifdef CONFIG_SATA_INTEL_COMBINED |
1303 | static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) | 1303 | static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) |
1304 | { | 1304 | { |
1305 | u8 prog, comb, tmp; | 1305 | u8 prog, comb, tmp; |
@@ -1392,7 +1392,7 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) | |||
1392 | request_region(0x170, 8, "libata"); /* port 1 */ | 1392 | request_region(0x170, 8, "libata"); /* port 1 */ |
1393 | } | 1393 | } |
1394 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined ); | 1394 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined ); |
1395 | #endif /* CONFIG_SCSI_SATA_INTEL_COMBINED */ | 1395 | #endif /* CONFIG_SATA_INTEL_COMBINED */ |
1396 | 1396 | ||
1397 | 1397 | ||
1398 | int pcie_mch_quirk; | 1398 | int pcie_mch_quirk; |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 96a81cd17617..2df4d15c9634 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -471,67 +471,6 @@ config SCSI_IN2000 | |||
471 | 471 | ||
472 | source "drivers/scsi/megaraid/Kconfig.megaraid" | 472 | source "drivers/scsi/megaraid/Kconfig.megaraid" |
473 | 473 | ||
474 | config SCSI_SATA | ||
475 | tristate "Serial ATA (SATA) support" | ||
476 | depends on SCSI | ||
477 | help | ||
478 | This driver family supports Serial ATA host controllers | ||
479 | and devices. | ||
480 | |||
481 | If unsure, say N. | ||
482 | |||
483 | config SCSI_SATA_AHCI | ||
484 | tristate "AHCI SATA support" | ||
485 | depends on SCSI_SATA && PCI | ||
486 | help | ||
487 | This option enables support for AHCI Serial ATA. | ||
488 | |||
489 | If unsure, say N. | ||
490 | |||
491 | config SCSI_SATA_SVW | ||
492 | tristate "ServerWorks Frodo / Apple K2 SATA support" | ||
493 | depends on SCSI_SATA && PCI | ||
494 | help | ||
495 | This option enables support for Broadcom/Serverworks/Apple K2 | ||
496 | SATA support. | ||
497 | |||
498 | If unsure, say N. | ||
499 | |||
500 | config SCSI_ATA_PIIX | ||
501 | tristate "Intel PIIX/ICH SATA support" | ||
502 | depends on SCSI_SATA && PCI | ||
503 | help | ||
504 | This option enables support for ICH5/6/7/8 Serial ATA. | ||
505 | If PATA support was enabled previously, this enables | ||
506 | support for select Intel PIIX/ICH PATA host controllers. | ||
507 | |||
508 | If unsure, say N. | ||
509 | |||
510 | config SCSI_SATA_MV | ||
511 | tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)" | ||
512 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
513 | help | ||
514 | This option enables support for the Marvell Serial ATA family. | ||
515 | Currently supports 88SX[56]0[48][01] chips. | ||
516 | |||
517 | If unsure, say N. | ||
518 | |||
519 | config SCSI_SATA_NV | ||
520 | tristate "NVIDIA SATA support" | ||
521 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
522 | help | ||
523 | This option enables support for NVIDIA Serial ATA. | ||
524 | |||
525 | If unsure, say N. | ||
526 | |||
527 | config SCSI_PDC_ADMA | ||
528 | tristate "Pacific Digital ADMA support" | ||
529 | depends on SCSI_SATA && PCI | ||
530 | help | ||
531 | This option enables support for Pacific Digital ADMA controllers | ||
532 | |||
533 | If unsure, say N. | ||
534 | |||
535 | config SCSI_HPTIOP | 474 | config SCSI_HPTIOP |
536 | tristate "HighPoint RocketRAID 3xxx Controller support" | 475 | tristate "HighPoint RocketRAID 3xxx Controller support" |
537 | depends on SCSI && PCI | 476 | depends on SCSI && PCI |
@@ -542,83 +481,6 @@ config SCSI_HPTIOP | |||
542 | To compile this driver as a module, choose M here; the module | 481 | To compile this driver as a module, choose M here; the module |
543 | will be called hptiop. If unsure, say N. | 482 | will be called hptiop. If unsure, say N. |
544 | 483 | ||
545 | config SCSI_SATA_QSTOR | ||
546 | tristate "Pacific Digital SATA QStor support" | ||
547 | depends on SCSI_SATA && PCI | ||
548 | help | ||
549 | This option enables support for Pacific Digital Serial ATA QStor. | ||
550 | |||
551 | If unsure, say N. | ||
552 | |||
553 | config SCSI_SATA_PROMISE | ||
554 | tristate "Promise SATA TX2/TX4 support" | ||
555 | depends on SCSI_SATA && PCI | ||
556 | help | ||
557 | This option enables support for Promise Serial ATA TX2/TX4. | ||
558 | |||
559 | If unsure, say N. | ||
560 | |||
561 | config SCSI_SATA_SX4 | ||
562 | tristate "Promise SATA SX4 support" | ||
563 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
564 | help | ||
565 | This option enables support for Promise Serial ATA SX4. | ||
566 | |||
567 | If unsure, say N. | ||
568 | |||
569 | config SCSI_SATA_SIL | ||
570 | tristate "Silicon Image SATA support" | ||
571 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
572 | help | ||
573 | This option enables support for Silicon Image Serial ATA. | ||
574 | |||
575 | If unsure, say N. | ||
576 | |||
577 | config SCSI_SATA_SIL24 | ||
578 | tristate "Silicon Image 3124/3132 SATA support" | ||
579 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
580 | help | ||
581 | This option enables support for Silicon Image 3124/3132 Serial ATA. | ||
582 | |||
583 | If unsure, say N. | ||
584 | |||
585 | config SCSI_SATA_SIS | ||
586 | tristate "SiS 964/180 SATA support" | ||
587 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
588 | help | ||
589 | This option enables support for SiS Serial ATA 964/180. | ||
590 | |||
591 | If unsure, say N. | ||
592 | |||
593 | config SCSI_SATA_ULI | ||
594 | tristate "ULi Electronics SATA support" | ||
595 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
596 | help | ||
597 | This option enables support for ULi Electronics SATA. | ||
598 | |||
599 | If unsure, say N. | ||
600 | |||
601 | config SCSI_SATA_VIA | ||
602 | tristate "VIA SATA support" | ||
603 | depends on SCSI_SATA && PCI | ||
604 | help | ||
605 | This option enables support for VIA Serial ATA. | ||
606 | |||
607 | If unsure, say N. | ||
608 | |||
609 | config SCSI_SATA_VITESSE | ||
610 | tristate "VITESSE VSC-7174 / INTEL 31244 SATA support" | ||
611 | depends on SCSI_SATA && PCI | ||
612 | help | ||
613 | This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA. | ||
614 | |||
615 | If unsure, say N. | ||
616 | |||
617 | config SCSI_SATA_INTEL_COMBINED | ||
618 | bool | ||
619 | depends on IDE=y && !BLK_DEV_IDE_SATA && (SCSI_SATA_AHCI || SCSI_ATA_PIIX) | ||
620 | default y | ||
621 | |||
622 | config SCSI_BUSLOGIC | 484 | config SCSI_BUSLOGIC |
623 | tristate "BusLogic SCSI support" | 485 | tristate "BusLogic SCSI support" |
624 | depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API | 486 | depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API |
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index ebd0cf00bf3e..b678f957cfe2 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -122,21 +122,6 @@ obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o | |||
122 | obj-$(CONFIG_SCSI_NSP32) += nsp32.o | 122 | obj-$(CONFIG_SCSI_NSP32) += nsp32.o |
123 | obj-$(CONFIG_SCSI_IPR) += ipr.o | 123 | obj-$(CONFIG_SCSI_IPR) += ipr.o |
124 | obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/ | 124 | obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/ |
125 | obj-$(CONFIG_SCSI_SATA_AHCI) += libata.o ahci.o | ||
126 | obj-$(CONFIG_SCSI_SATA_SVW) += libata.o sata_svw.o | ||
127 | obj-$(CONFIG_SCSI_ATA_PIIX) += libata.o ata_piix.o | ||
128 | obj-$(CONFIG_SCSI_SATA_PROMISE) += libata.o sata_promise.o | ||
129 | obj-$(CONFIG_SCSI_SATA_QSTOR) += libata.o sata_qstor.o | ||
130 | obj-$(CONFIG_SCSI_SATA_SIL) += libata.o sata_sil.o | ||
131 | obj-$(CONFIG_SCSI_SATA_SIL24) += libata.o sata_sil24.o | ||
132 | obj-$(CONFIG_SCSI_SATA_VIA) += libata.o sata_via.o | ||
133 | obj-$(CONFIG_SCSI_SATA_VITESSE) += libata.o sata_vsc.o | ||
134 | obj-$(CONFIG_SCSI_SATA_SIS) += libata.o sata_sis.o | ||
135 | obj-$(CONFIG_SCSI_SATA_SX4) += libata.o sata_sx4.o | ||
136 | obj-$(CONFIG_SCSI_SATA_NV) += libata.o sata_nv.o | ||
137 | obj-$(CONFIG_SCSI_SATA_ULI) += libata.o sata_uli.o | ||
138 | obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o | ||
139 | obj-$(CONFIG_SCSI_PDC_ADMA) += libata.o pdc_adma.o | ||
140 | obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o | 125 | obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o |
141 | 126 | ||
142 | obj-$(CONFIG_ARM) += arm/ | 127 | obj-$(CONFIG_ARM) += arm/ |
@@ -166,7 +151,6 @@ ncr53c8xx-flags-$(CONFIG_SCSI_ZALON) \ | |||
166 | CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m) | 151 | CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m) |
167 | zalon7xx-objs := zalon.o ncr53c8xx.o | 152 | zalon7xx-objs := zalon.o ncr53c8xx.o |
168 | NCR_Q720_mod-objs := NCR_Q720.o ncr53c8xx.o | 153 | NCR_Q720_mod-objs := NCR_Q720.o ncr53c8xx.o |
169 | libata-objs := libata-core.o libata-scsi.o libata-bmdma.o libata-eh.o | ||
170 | oktagon_esp_mod-objs := oktagon_esp.o oktagon_io.o | 154 | oktagon_esp_mod-objs := oktagon_esp.o oktagon_io.o |
171 | 155 | ||
172 | # Files generated that shall be removed upon make clean | 156 | # Files generated that shall be removed upon make clean |
diff --git a/include/asm-alpha/libata-portmap.h b/include/asm-alpha/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-alpha/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h new file mode 100644 index 000000000000..9202fd02d5be --- /dev/null +++ b/include/asm-generic/libata-portmap.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ASM_GENERIC_LIBATA_PORTMAP_H | ||
2 | #define __ASM_GENERIC_LIBATA_PORTMAP_H | ||
3 | |||
4 | #define ATA_PRIMARY_CMD 0x1F0 | ||
5 | #define ATA_PRIMARY_CTL 0x3F6 | ||
6 | #define ATA_PRIMARY_IRQ 14 | ||
7 | |||
8 | #define ATA_SECONDARY_CMD 0x170 | ||
9 | #define ATA_SECONDARY_CTL 0x376 | ||
10 | #define ATA_SECONDARY_IRQ 15 | ||
11 | |||
12 | #endif | ||
diff --git a/include/asm-i386/libata-portmap.h b/include/asm-i386/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-i386/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-ia64/libata-portmap.h b/include/asm-ia64/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-ia64/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-powerpc/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-sparc/libata-portmap.h b/include/asm-sparc/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-sparc/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-sparc64/libata-portmap.h b/include/asm-sparc64/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-sparc64/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-x86_64/libata-portmap.h b/include/asm-x86_64/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-x86_64/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/linux/ata.h b/include/linux/ata.h index 3671af869696..991b858acc30 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -40,6 +40,8 @@ enum { | |||
40 | ATA_MAX_DEVICES = 2, /* per bus/port */ | 40 | ATA_MAX_DEVICES = 2, /* per bus/port */ |
41 | ATA_MAX_PRD = 256, /* we could make these 256/256 */ | 41 | ATA_MAX_PRD = 256, /* we could make these 256/256 */ |
42 | ATA_SECT_SIZE = 512, | 42 | ATA_SECT_SIZE = 512, |
43 | ATA_MAX_SECTORS = 256, | ||
44 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ | ||
43 | 45 | ||
44 | ATA_ID_WORDS = 256, | 46 | ATA_ID_WORDS = 256, |
45 | ATA_ID_SERNO_OFS = 10, | 47 | ATA_ID_SERNO_OFS = 10, |
@@ -168,12 +170,16 @@ enum { | |||
168 | XFER_UDMA_2 = 0x42, | 170 | XFER_UDMA_2 = 0x42, |
169 | XFER_UDMA_1 = 0x41, | 171 | XFER_UDMA_1 = 0x41, |
170 | XFER_UDMA_0 = 0x40, | 172 | XFER_UDMA_0 = 0x40, |
173 | XFER_MW_DMA_4 = 0x24, /* CFA only */ | ||
174 | XFER_MW_DMA_3 = 0x23, /* CFA only */ | ||
171 | XFER_MW_DMA_2 = 0x22, | 175 | XFER_MW_DMA_2 = 0x22, |
172 | XFER_MW_DMA_1 = 0x21, | 176 | XFER_MW_DMA_1 = 0x21, |
173 | XFER_MW_DMA_0 = 0x20, | 177 | XFER_MW_DMA_0 = 0x20, |
174 | XFER_SW_DMA_2 = 0x12, | 178 | XFER_SW_DMA_2 = 0x12, |
175 | XFER_SW_DMA_1 = 0x11, | 179 | XFER_SW_DMA_1 = 0x11, |
176 | XFER_SW_DMA_0 = 0x10, | 180 | XFER_SW_DMA_0 = 0x10, |
181 | XFER_PIO_6 = 0x0E, /* CFA only */ | ||
182 | XFER_PIO_5 = 0x0D, /* CFA only */ | ||
177 | XFER_PIO_4 = 0x0C, | 183 | XFER_PIO_4 = 0x0C, |
178 | XFER_PIO_3 = 0x0B, | 184 | XFER_PIO_3 = 0x0B, |
179 | XFER_PIO_2 = 0x0A, | 185 | XFER_PIO_2 = 0x0A, |
@@ -272,7 +278,6 @@ struct ata_taskfile { | |||
272 | }; | 278 | }; |
273 | 279 | ||
274 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 280 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) |
275 | #define ata_id_is_cfa(id) ((id)[0] == 0x848A) | ||
276 | #define ata_id_is_sata(id) ((id)[93] == 0) | 281 | #define ata_id_is_sata(id) ((id)[93] == 0) |
277 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) | 282 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) |
278 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) | 283 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) |
@@ -304,6 +309,9 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
304 | { | 309 | { |
305 | unsigned int mver; | 310 | unsigned int mver; |
306 | 311 | ||
312 | if (id[ATA_ID_MAJOR_VER] == 0xFFFF) | ||
313 | return 0; | ||
314 | |||
307 | for (mver = 14; mver >= 1; mver--) | 315 | for (mver = 14; mver >= 1; mver--) |
308 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) | 316 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) |
309 | break; | 317 | break; |
@@ -322,6 +330,18 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
322 | id[56]; /* sectors in current translation */ | 330 | id[56]; /* sectors in current translation */ |
323 | } | 331 | } |
324 | 332 | ||
333 | static inline int ata_id_is_cfa(const u16 *id) | ||
334 | { | ||
335 | u16 v = id[0]; | ||
336 | if (v == 0x848A) /* Standard CF */ | ||
337 | return 1; | ||
338 | /* Could be CF hiding as standard ATA */ | ||
339 | if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF && | ||
340 | (id[82] & ( 1 << 2))) | ||
341 | return 1; | ||
342 | return 0; | ||
343 | } | ||
344 | |||
325 | static inline int atapi_cdb_len(const u16 *dev_id) | 345 | static inline int atapi_cdb_len(const u16 *dev_id) |
326 | { | 346 | { |
327 | u16 tmp = dev_id[0] & 0x3; | 347 | u16 tmp = dev_id[0] & 0x3; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 66c3100c2b94..806682603ac5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
38 | 38 | ||
39 | #include <asm/libata-portmap.h> | ||
40 | |||
39 | /* | 41 | /* |
40 | * compile-time options: to be removed as soon as all the drivers are | 42 | * compile-time options: to be removed as soon as all the drivers are |
41 | * converted to the new debugging mechanism | 43 | * converted to the new debugging mechanism |
@@ -112,8 +114,6 @@ enum { | |||
112 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 114 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
113 | ATA_MAX_QUEUE = 32, | 115 | ATA_MAX_QUEUE = 32, |
114 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 116 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
115 | ATA_MAX_SECTORS = 200, /* FIXME */ | ||
116 | ATA_MAX_SECTORS_LBA48 = 65535, | ||
117 | ATA_MAX_BUS = 2, | 117 | ATA_MAX_BUS = 2, |
118 | ATA_DEF_BUSY_WAIT = 10000, | 118 | ATA_DEF_BUSY_WAIT = 10000, |
119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, |
@@ -225,8 +225,8 @@ enum { | |||
225 | /* encoding various smaller bitmaps into a single | 225 | /* encoding various smaller bitmaps into a single |
226 | * unsigned int bitmap | 226 | * unsigned int bitmap |
227 | */ | 227 | */ |
228 | ATA_BITS_PIO = 5, | 228 | ATA_BITS_PIO = 7, |
229 | ATA_BITS_MWDMA = 3, | 229 | ATA_BITS_MWDMA = 5, |
230 | ATA_BITS_UDMA = 8, | 230 | ATA_BITS_UDMA = 8, |
231 | 231 | ||
232 | ATA_SHIFT_PIO = 0, | 232 | ATA_SHIFT_PIO = 0, |
@@ -350,12 +350,12 @@ struct ata_probe_ent { | |||
350 | struct scsi_host_template *sht; | 350 | struct scsi_host_template *sht; |
351 | struct ata_ioports port[ATA_MAX_PORTS]; | 351 | struct ata_ioports port[ATA_MAX_PORTS]; |
352 | unsigned int n_ports; | 352 | unsigned int n_ports; |
353 | unsigned int hard_port_no; | 353 | unsigned int dummy_port_mask; |
354 | unsigned int pio_mask; | 354 | unsigned int pio_mask; |
355 | unsigned int mwdma_mask; | 355 | unsigned int mwdma_mask; |
356 | unsigned int udma_mask; | 356 | unsigned int udma_mask; |
357 | unsigned int legacy_mode; | ||
358 | unsigned long irq; | 357 | unsigned long irq; |
358 | unsigned long irq2; | ||
359 | unsigned int irq_flags; | 359 | unsigned int irq_flags; |
360 | unsigned long host_flags; | 360 | unsigned long host_flags; |
361 | unsigned long host_set_flags; | 361 | unsigned long host_set_flags; |
@@ -367,6 +367,7 @@ struct ata_host_set { | |||
367 | spinlock_t lock; | 367 | spinlock_t lock; |
368 | struct device *dev; | 368 | struct device *dev; |
369 | unsigned long irq; | 369 | unsigned long irq; |
370 | unsigned long irq2; | ||
370 | void __iomem *mmio_base; | 371 | void __iomem *mmio_base; |
371 | unsigned int n_ports; | 372 | unsigned int n_ports; |
372 | void *private_data; | 373 | void *private_data; |
@@ -374,7 +375,6 @@ struct ata_host_set { | |||
374 | unsigned long flags; | 375 | unsigned long flags; |
375 | int simplex_claimed; /* Keep seperate in case we | 376 | int simplex_claimed; /* Keep seperate in case we |
376 | ever need to do this locked */ | 377 | ever need to do this locked */ |
377 | struct ata_host_set *next; /* for legacy mode */ | ||
378 | struct ata_port *ports[0]; | 378 | struct ata_port *ports[0]; |
379 | }; | 379 | }; |
380 | 380 | ||
@@ -505,7 +505,6 @@ struct ata_port { | |||
505 | unsigned int pflags; /* ATA_PFLAG_xxx */ | 505 | unsigned int pflags; /* ATA_PFLAG_xxx */ |
506 | unsigned int id; /* unique id req'd by scsi midlyr */ | 506 | unsigned int id; /* unique id req'd by scsi midlyr */ |
507 | unsigned int port_no; /* unique port #; from zero */ | 507 | unsigned int port_no; /* unique port #; from zero */ |
508 | unsigned int hard_port_no; /* hardware port #; from zero */ | ||
509 | 508 | ||
510 | struct ata_prd *prd; /* our SG list */ | 509 | struct ata_prd *prd; /* our SG list */ |
511 | dma_addr_t prd_dma; /* and its DMA mapping */ | 510 | dma_addr_t prd_dma; /* and its DMA mapping */ |
@@ -649,6 +648,8 @@ extern const unsigned long sata_deb_timing_normal[]; | |||
649 | extern const unsigned long sata_deb_timing_hotplug[]; | 648 | extern const unsigned long sata_deb_timing_hotplug[]; |
650 | extern const unsigned long sata_deb_timing_long[]; | 649 | extern const unsigned long sata_deb_timing_long[]; |
651 | 650 | ||
651 | extern const struct ata_port_operations ata_dummy_port_ops; | ||
652 | |||
652 | static inline const unsigned long * | 653 | static inline const unsigned long * |
653 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | 654 | sata_ehc_deb_timing(struct ata_eh_context *ehc) |
654 | { | 655 | { |
@@ -658,6 +659,11 @@ sata_ehc_deb_timing(struct ata_eh_context *ehc) | |||
658 | return sata_deb_timing_normal; | 659 | return sata_deb_timing_normal; |
659 | } | 660 | } |
660 | 661 | ||
662 | static inline int ata_port_is_dummy(struct ata_port *ap) | ||
663 | { | ||
664 | return ap->ops == &ata_dummy_port_ops; | ||
665 | } | ||
666 | |||
661 | extern void ata_port_probe(struct ata_port *); | 667 | extern void ata_port_probe(struct ata_port *); |
662 | extern void __sata_phy_reset(struct ata_port *ap); | 668 | extern void __sata_phy_reset(struct ata_port *ap); |
663 | extern void sata_phy_reset(struct ata_port *ap); | 669 | extern void sata_phy_reset(struct ata_port *ap); |
@@ -676,19 +682,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr); | |||
676 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 682 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
677 | unsigned int n_ports); | 683 | unsigned int n_ports); |
678 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 684 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
679 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t state); | 685 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
680 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); | 686 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); |
681 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); | 687 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
682 | extern int ata_pci_device_resume(struct pci_dev *pdev); | 688 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
683 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 689 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
684 | #endif /* CONFIG_PCI */ | 690 | #endif /* CONFIG_PCI */ |
685 | extern int ata_device_add(const struct ata_probe_ent *ent); | 691 | extern int ata_device_add(const struct ata_probe_ent *ent); |
686 | extern void ata_port_detach(struct ata_port *ap); | 692 | extern void ata_port_detach(struct ata_port *ap); |
693 | extern void ata_host_set_init(struct ata_host_set *, struct device *, | ||
694 | unsigned long, const struct ata_port_operations *); | ||
687 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 695 | extern void ata_host_set_remove(struct ata_host_set *host_set); |
688 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 696 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
689 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 697 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
690 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 698 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
691 | extern int ata_scsi_release(struct Scsi_Host *host); | 699 | extern int ata_scsi_release(struct Scsi_Host *host); |
700 | extern void ata_sas_port_destroy(struct ata_port *); | ||
701 | extern struct ata_port *ata_sas_port_alloc(struct ata_host_set *, | ||
702 | struct ata_port_info *, struct Scsi_Host *); | ||
703 | extern int ata_sas_port_init(struct ata_port *); | ||
704 | extern int ata_sas_port_start(struct ata_port *ap); | ||
705 | extern void ata_sas_port_stop(struct ata_port *ap); | ||
706 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | ||
707 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | ||
708 | struct ata_port *ap); | ||
692 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 709 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
693 | extern int sata_scr_valid(struct ata_port *ap); | 710 | extern int sata_scr_valid(struct ata_port *ap); |
694 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); | 711 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); |
@@ -697,7 +714,7 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); | |||
697 | extern int ata_port_online(struct ata_port *ap); | 714 | extern int ata_port_online(struct ata_port *ap); |
698 | extern int ata_port_offline(struct ata_port *ap); | 715 | extern int ata_port_offline(struct ata_port *ap); |
699 | extern int ata_scsi_device_resume(struct scsi_device *); | 716 | extern int ata_scsi_device_resume(struct scsi_device *); |
700 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); | 717 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); |
701 | extern int ata_host_set_suspend(struct ata_host_set *host_set, | 718 | extern int ata_host_set_suspend(struct ata_host_set *host_set, |
702 | pm_message_t mesg); | 719 | pm_message_t mesg); |
703 | extern void ata_host_set_resume(struct ata_host_set *host_set); | 720 | extern void ata_host_set_resume(struct ata_host_set *host_set); |