aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-02-26 06:24:03 -0500
committerJeff Garzik <jeff@garzik.org>2007-03-01 20:19:45 -0500
commite34bb370dec4919b7e8b769d51ad2bc2535b6982 (patch)
tree3fa5c0a00bfdb56a0bdf5974c0b3b61bf2ffa82c /drivers
parent5ee2ae7fb2079c5775d8802cd282140d71632a2d (diff)
ahci/pata_jmicron: match class not function number
Make jmiron_ata quirk update pdev->class after programming the device and update ahci and pata_jmicron such that they match class code instead of checking function number manually. For ahci, it matches for vendor and class. For pata_jmicron, it matches vendor, device and class as IDE class isn't as well defined as AHCI class. This makes jmicron device matching more conventional and script friendly. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c16
-rw-r--r--drivers/ata/pata_jmicron.c19
-rw-r--r--drivers/pci/quirks.c5
3 files changed, 17 insertions, 23 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 6d932409aadd..45785ec702a1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -384,12 +384,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
384 { PCI_VDEVICE(INTEL, 0x294d), board_ahci_pi }, /* ICH9 */ 384 { PCI_VDEVICE(INTEL, 0x294d), board_ahci_pi }, /* ICH9 */
385 { PCI_VDEVICE(INTEL, 0x294e), board_ahci_pi }, /* ICH9M */ 385 { PCI_VDEVICE(INTEL, 0x294e), board_ahci_pi }, /* ICH9M */
386 386
387 /* JMicron */ 387 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
388 { PCI_VDEVICE(JMICRON, 0x2360), board_ahci_ign_iferr }, /* JMB360 */ 388 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
389 { PCI_VDEVICE(JMICRON, 0x2361), board_ahci_ign_iferr }, /* JMB361 */ 389 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr },
390 { PCI_VDEVICE(JMICRON, 0x2363), board_ahci_ign_iferr }, /* JMB363 */
391 { PCI_VDEVICE(JMICRON, 0x2365), board_ahci_ign_iferr }, /* JMB365 */
392 { PCI_VDEVICE(JMICRON, 0x2366), board_ahci_ign_iferr }, /* JMB366 */
393 390
394 /* ATI */ 391 /* ATI */
395 { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */ 392 { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */
@@ -1665,13 +1662,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1665 if (!printed_version++) 1662 if (!printed_version++)
1666 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1663 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1667 1664
1668 if (pdev->vendor == PCI_VENDOR_ID_JMICRON) {
1669 /* Function 1 is the PATA controller except on the 368, where
1670 we are not AHCI anyway */
1671 if (PCI_FUNC(pdev->devfn))
1672 return -ENODEV;
1673 }
1674
1675 rc = pcim_enable_device(pdev); 1665 rc = pcim_enable_device(pdev);
1676 if (rc) 1666 if (rc)
1677 return rc; 1667 return rc;
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index c40d09206e45..47d0f94fd792 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -202,19 +202,20 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
202 }; 202 };
203 struct ata_port_info *port_info[2] = { &info, &info }; 203 struct ata_port_info *port_info[2] = { &info, &info };
204 204
205 /* PATA controller is fn 1, AHCI is fn 0 */
206 if (id->driver_data != 368 && PCI_FUNC(pdev->devfn) != 1)
207 return -ENODEV;
208
209 return ata_pci_init_one(pdev, port_info, 2); 205 return ata_pci_init_one(pdev, port_info, 2);
210} 206}
211 207
212static const struct pci_device_id jmicron_pci_tbl[] = { 208static const struct pci_device_id jmicron_pci_tbl[] = {
213 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 361}, 209 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361,
214 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB363), 363}, 210 PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 361 },
215 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB365), 365}, 211 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363,
216 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB366), 366}, 212 PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 363 },
217 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB368), 368}, 213 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365,
214 PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 365 },
215 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366,
216 PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 366 },
217 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368,
218 PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 368 },
218 219
219 { } /* terminate list */ 220 { } /* terminate list */
220}; 221};
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1e6e1e4d3327..1bf548287564 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1220,7 +1220,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, asus_hides_a
1220 */ 1220 */
1221static void quirk_jmicron_ata(struct pci_dev *pdev) 1221static void quirk_jmicron_ata(struct pci_dev *pdev)
1222{ 1222{
1223 u32 conf1, conf5; 1223 u32 conf1, conf5, class;
1224 u8 hdr; 1224 u8 hdr;
1225 1225
1226 /* Only poke fn 0 */ 1226 /* Only poke fn 0 */
@@ -1264,6 +1264,9 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
1264 pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr); 1264 pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr);
1265 pdev->hdr_type = hdr & 0x7f; 1265 pdev->hdr_type = hdr & 0x7f;
1266 pdev->multifunction = !!(hdr & 0x80); 1266 pdev->multifunction = !!(hdr & 0x80);
1267
1268 pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class);
1269 pdev->class = class >> 8;
1267} 1270}
1268DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata); 1271DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
1269DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata); 1272DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);