diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-07-11 11:57:44 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-07-16 11:48:28 -0400 |
commit | 08f12edc335d24a89ba2f50b0a5b9d12295ce198 (patch) | |
tree | 5d329f7c0baa0bfd3d46481fb2a5a12e23b02a21 | |
parent | ea35d29e2fa8b3d766a2ce8fbcce599dce8d2734 (diff) |
[libata] ata_piix: attempt to fix ICH8 support
Take into account the fact that ICH8 changed the register layout of
the MAP and PCS register bits.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/scsi/ata_piix.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 18b3542236d2..a960bb71c545 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -126,6 +126,7 @@ enum { | |||
126 | ich6_sata = 4, | 126 | ich6_sata = 4, |
127 | ich6_sata_ahci = 5, | 127 | ich6_sata_ahci = 5, |
128 | ich6m_sata_ahci = 6, | 128 | ich6m_sata_ahci = 6, |
129 | ich8_sata_ahci = 7, | ||
129 | 130 | ||
130 | /* constants for mapping table */ | 131 | /* constants for mapping table */ |
131 | P0 = 0, /* port 0 */ | 132 | P0 = 0, /* port 0 */ |
@@ -142,11 +143,13 @@ enum { | |||
142 | struct piix_map_db { | 143 | struct piix_map_db { |
143 | const u32 mask; | 144 | const u32 mask; |
144 | const u32 port_enable; | 145 | const u32 port_enable; |
146 | const int present_shift; | ||
145 | const int map[][4]; | 147 | const int map[][4]; |
146 | }; | 148 | }; |
147 | 149 | ||
148 | struct piix_host_priv { | 150 | struct piix_host_priv { |
149 | const int *map; | 151 | const int *map; |
152 | const struct piix_map_db *map_db; | ||
150 | }; | 153 | }; |
151 | 154 | ||
152 | static int piix_init_one (struct pci_dev *pdev, | 155 | static int piix_init_one (struct pci_dev *pdev, |
@@ -192,11 +195,11 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
192 | /* Enterprise Southbridge 2 (where's the datasheet?) */ | 195 | /* Enterprise Southbridge 2 (where's the datasheet?) */ |
193 | { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, | 196 | { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
194 | /* SATA Controller 1 IDE (ICH8, no datasheet yet) */ | 197 | /* SATA Controller 1 IDE (ICH8, no datasheet yet) */ |
195 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, | 198 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
196 | /* SATA Controller 2 IDE (ICH8, ditto) */ | 199 | /* SATA Controller 2 IDE (ICH8, ditto) */ |
197 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, | 200 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
198 | /* Mobile SATA Controller IDE (ICH8M, ditto) */ | 201 | /* Mobile SATA Controller IDE (ICH8M, ditto) */ |
199 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata_ahci }, | 202 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
200 | 203 | ||
201 | { } /* terminate list */ | 204 | { } /* terminate list */ |
202 | }; | 205 | }; |
@@ -296,6 +299,7 @@ static const struct ata_port_operations piix_sata_ops = { | |||
296 | static const struct piix_map_db ich5_map_db = { | 299 | static const struct piix_map_db ich5_map_db = { |
297 | .mask = 0x7, | 300 | .mask = 0x7, |
298 | .port_enable = 0x3, | 301 | .port_enable = 0x3, |
302 | .present_shift = 4, | ||
299 | .map = { | 303 | .map = { |
300 | /* PM PS SM SS MAP */ | 304 | /* PM PS SM SS MAP */ |
301 | { P0, NA, P1, NA }, /* 000b */ | 305 | { P0, NA, P1, NA }, /* 000b */ |
@@ -312,6 +316,7 @@ static const struct piix_map_db ich5_map_db = { | |||
312 | static const struct piix_map_db ich6_map_db = { | 316 | static const struct piix_map_db ich6_map_db = { |
313 | .mask = 0x3, | 317 | .mask = 0x3, |
314 | .port_enable = 0xf, | 318 | .port_enable = 0xf, |
319 | .present_shift = 4, | ||
315 | .map = { | 320 | .map = { |
316 | /* PM PS SM SS MAP */ | 321 | /* PM PS SM SS MAP */ |
317 | { P0, P2, P1, P3 }, /* 00b */ | 322 | { P0, P2, P1, P3 }, /* 00b */ |
@@ -324,6 +329,7 @@ static const struct piix_map_db ich6_map_db = { | |||
324 | static const struct piix_map_db ich6m_map_db = { | 329 | static const struct piix_map_db ich6m_map_db = { |
325 | .mask = 0x3, | 330 | .mask = 0x3, |
326 | .port_enable = 0x5, | 331 | .port_enable = 0x5, |
332 | .present_shift = 4, | ||
327 | .map = { | 333 | .map = { |
328 | /* PM PS SM SS MAP */ | 334 | /* PM PS SM SS MAP */ |
329 | { P0, P2, RV, RV }, /* 00b */ | 335 | { P0, P2, RV, RV }, /* 00b */ |
@@ -333,12 +339,26 @@ static const struct piix_map_db ich6m_map_db = { | |||
333 | }, | 339 | }, |
334 | }; | 340 | }; |
335 | 341 | ||
342 | static const struct piix_map_db ich8_map_db = { | ||
343 | .mask = 0x3, | ||
344 | .port_enable = 0x3, | ||
345 | .present_shift = 8, | ||
346 | .map = { | ||
347 | /* PM PS SM SS MAP */ | ||
348 | { P0, RV, P1, RV }, /* 00b (hardwired) */ | ||
349 | { RV, RV, RV, RV }, | ||
350 | { RV, RV, RV, RV }, /* 10b (never) */ | ||
351 | { RV, RV, RV, RV }, | ||
352 | }, | ||
353 | }; | ||
354 | |||
336 | static const struct piix_map_db *piix_map_db_table[] = { | 355 | static const struct piix_map_db *piix_map_db_table[] = { |
337 | [ich5_sata] = &ich5_map_db, | 356 | [ich5_sata] = &ich5_map_db, |
338 | [esb_sata] = &ich5_map_db, | 357 | [esb_sata] = &ich5_map_db, |
339 | [ich6_sata] = &ich6_map_db, | 358 | [ich6_sata] = &ich6_map_db, |
340 | [ich6_sata_ahci] = &ich6_map_db, | 359 | [ich6_sata_ahci] = &ich6_map_db, |
341 | [ich6m_sata_ahci] = &ich6m_map_db, | 360 | [ich6m_sata_ahci] = &ich6m_map_db, |
361 | [ich8_sata_ahci] = &ich8_map_db, | ||
342 | }; | 362 | }; |
343 | 363 | ||
344 | static struct ata_port_info piix_port_info[] = { | 364 | static struct ata_port_info piix_port_info[] = { |
@@ -426,6 +446,18 @@ static struct ata_port_info piix_port_info[] = { | |||
426 | .udma_mask = 0x7f, /* udma0-6 */ | 446 | .udma_mask = 0x7f, /* udma0-6 */ |
427 | .port_ops = &piix_sata_ops, | 447 | .port_ops = &piix_sata_ops, |
428 | }, | 448 | }, |
449 | |||
450 | /* ich8_sata_ahci */ | ||
451 | { | ||
452 | .sht = &piix_sht, | ||
453 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED_ICH6 | | ||
454 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | | ||
455 | PIIX_FLAG_AHCI, | ||
456 | .pio_mask = 0x1f, /* pio0-4 */ | ||
457 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
458 | .udma_mask = 0x7f, /* udma0-6 */ | ||
459 | .port_ops = &piix_sata_ops, | ||
460 | }, | ||
429 | }; | 461 | }; |
430 | 462 | ||
431 | static struct pci_bits piix_enable_bits[] = { | 463 | static struct pci_bits piix_enable_bits[] = { |
@@ -534,7 +566,8 @@ static int piix_sata_prereset(struct ata_port *ap) | |||
534 | port = map[base + i]; | 566 | port = map[base + i]; |
535 | if (port < 0) | 567 | if (port < 0) |
536 | continue; | 568 | continue; |
537 | if (ap->flags & PIIX_FLAG_IGNORE_PCS || pcs & 1 << (4 + port)) | 569 | if ((ap->flags & PIIX_FLAG_IGNORE_PCS) || |
570 | (pcs & 1 << (hpriv->map_db->present_shift + port))) | ||
538 | present = 1; | 571 | present = 1; |
539 | } | 572 | } |
540 | 573 | ||
@@ -817,6 +850,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev, | |||
817 | "invalid MAP value %u\n", map_value); | 850 | "invalid MAP value %u\n", map_value); |
818 | 851 | ||
819 | hpriv->map = map; | 852 | hpriv->map = map; |
853 | hpriv->map_db = map_db; | ||
820 | } | 854 | } |
821 | 855 | ||
822 | /** | 856 | /** |