Lines Matching refs:pdev
87 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
92 static void ahci_mcp89_apple_enable(struct pci_dev *pdev);
93 static bool is_mcp89_apple(struct pci_dev *pdev);
97 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
98 static int ahci_pci_device_resume(struct pci_dev *pdev);
587 static void ahci_pci_save_initial_config(struct pci_dev *pdev, in ahci_pci_save_initial_config() argument
590 if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { in ahci_pci_save_initial_config()
591 dev_info(&pdev->dev, "JMB361 has only one port\n"); in ahci_pci_save_initial_config()
601 if (pdev->device == 0x6121) in ahci_pci_save_initial_config()
605 dev_info(&pdev->dev, in ahci_pci_save_initial_config()
609 ahci_save_initial_config(&pdev->dev, hpriv); in ahci_pci_save_initial_config()
614 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_pci_reset_controller() local
618 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { in ahci_pci_reset_controller()
623 pci_read_config_word(pdev, 0x92, &tmp16); in ahci_pci_reset_controller()
626 pci_write_config_word(pdev, 0x92, tmp16); in ahci_pci_reset_controller()
636 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_pci_init_controller() local
642 if (pdev->device == 0x6121) in ahci_pci_init_controller()
767 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_avn_hardreset() local
784 pci_read_config_word(pdev, 0x92, &val); in ahci_avn_hardreset()
786 pci_write_config_word(pdev, 0x92, val); in ahci_avn_hardreset()
789 pci_write_config_word(pdev, 0x92, val); in ahci_avn_hardreset()
804 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) in ahci_pci_device_suspend() argument
806 struct ata_host *host = pci_get_drvdata(pdev); in ahci_pci_device_suspend()
813 dev_err(&pdev->dev, in ahci_pci_device_suspend()
829 return ata_pci_device_suspend(pdev, mesg); in ahci_pci_device_suspend()
832 static int ahci_pci_device_resume(struct pci_dev *pdev) in ahci_pci_device_resume() argument
834 struct ata_host *host = pci_get_drvdata(pdev); in ahci_pci_device_resume()
837 rc = ata_pci_device_do_resume(pdev); in ahci_pci_device_resume()
842 if (is_mcp89_apple(pdev)) in ahci_pci_device_resume()
843 ahci_mcp89_apple_enable(pdev); in ahci_pci_device_resume()
845 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { in ahci_pci_device_resume()
859 static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac) in ahci_configure_dma_masks() argument
867 if (pdev->dma_mask && pdev->dma_mask < DMA_BIT_MASK(32)) in ahci_configure_dma_masks()
871 !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { in ahci_configure_dma_masks()
872 rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); in ahci_configure_dma_masks()
874 rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); in ahci_configure_dma_masks()
876 dev_err(&pdev->dev, in ahci_configure_dma_masks()
882 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in ahci_configure_dma_masks()
884 dev_err(&pdev->dev, "32-bit DMA enable failed\n"); in ahci_configure_dma_masks()
887 rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); in ahci_configure_dma_masks()
889 dev_err(&pdev->dev, in ahci_configure_dma_masks()
899 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_pci_print_info() local
903 pci_read_config_word(pdev, 0x0a, &cc); in ahci_pci_print_info()
947 struct pci_dev *pdev = to_pci_dev(host->dev); in ahci_p5wdh_workaround() local
949 if (pdev->bus->number == 0 && pdev->devfn == PCI_DEVFN(0x1f, 2) && in ahci_p5wdh_workaround()
953 dev_info(&pdev->dev, in ahci_p5wdh_workaround()
965 static void ahci_mcp89_apple_enable(struct pci_dev *pdev) in ahci_mcp89_apple_enable() argument
971 pci_read_config_dword(pdev, 0xf8, &val); in ahci_mcp89_apple_enable()
975 pci_write_config_dword(pdev, 0xf8, val); in ahci_mcp89_apple_enable()
977 pci_read_config_dword(pdev, 0x54c, &val); in ahci_mcp89_apple_enable()
979 pci_write_config_dword(pdev, 0x54c, val); in ahci_mcp89_apple_enable()
981 pci_read_config_dword(pdev, 0x4a4, &val); in ahci_mcp89_apple_enable()
984 pci_write_config_dword(pdev, 0x4a4, val); in ahci_mcp89_apple_enable()
986 pci_read_config_dword(pdev, 0x54c, &val); in ahci_mcp89_apple_enable()
988 pci_write_config_dword(pdev, 0x54c, val); in ahci_mcp89_apple_enable()
990 pci_read_config_dword(pdev, 0xf8, &val); in ahci_mcp89_apple_enable()
992 pci_write_config_dword(pdev, 0xf8, val); in ahci_mcp89_apple_enable()
995 static bool is_mcp89_apple(struct pci_dev *pdev) in is_mcp89_apple() argument
997 return pdev->vendor == PCI_VENDOR_ID_NVIDIA && in is_mcp89_apple()
998 pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA && in is_mcp89_apple()
999 pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE && in is_mcp89_apple()
1000 pdev->subsystem_device == 0xcb89; in is_mcp89_apple()
1004 static bool ahci_sb600_enable_64bit(struct pci_dev *pdev) in ahci_sb600_enable_64bit() argument
1082 if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) || in ahci_sb600_enable_64bit()
1095 dev_warn(&pdev->dev, in ahci_sb600_enable_64bit()
1102 dev_warn(&pdev->dev, "%s: enabling 64bit DMA\n", match->ident); in ahci_sb600_enable_64bit()
1106 static bool ahci_broken_system_poweroff(struct pci_dev *pdev) in ahci_broken_system_poweroff() argument
1135 return slot == PCI_SLOT(pdev->devfn); in ahci_broken_system_poweroff()
1141 static bool ahci_broken_suspend(struct pci_dev *pdev) in ahci_broken_suspend() argument
1216 if (!dmi || pdev->bus->number || pdev->devfn != PCI_DEVFN(0x1f, 2)) in ahci_broken_suspend()
1225 static bool ahci_broken_online(struct pci_dev *pdev) in ahci_broken_online() argument
1272 return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); in ahci_broken_online()
1275 static bool ahci_broken_devslp(struct pci_dev *pdev) in ahci_broken_devslp() argument
1283 return pci_match_id(ids, pdev); in ahci_broken_devslp()
1339 static int ahci_init_msix(struct pci_dev *pdev, unsigned int n_ports, in ahci_init_msix() argument
1349 nvec = pci_msix_vec_count(pdev); in ahci_init_msix()
1362 rc = pci_enable_msix_exact(pdev, &entry, 1); in ahci_init_msix()
1370 dev_err(&pdev->dev, in ahci_init_msix()
1377 static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, in ahci_init_msi() argument
1385 nvec = pci_msi_vec_count(pdev); in ahci_init_msi()
1397 rc = pci_enable_msi_exact(pdev, nvec); in ahci_init_msi()
1405 pci_disable_msi(pdev); in ahci_init_msi()
1418 rc = pci_enable_msi(pdev); in ahci_init_msi()
1422 hpriv->irq = pdev->irq; in ahci_init_msi()
1427 static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, in ahci_init_interrupts() argument
1432 nvec = ahci_init_msi(pdev, n_ports, hpriv); in ahci_init_interrupts()
1441 nvec = ahci_init_msix(pdev, n_ports, hpriv); in ahci_init_interrupts()
1446 pci_intx(pdev, 1); in ahci_init_interrupts()
1447 hpriv->irq = pdev->irq; in ahci_init_interrupts()
1452 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) in ahci_init_one() argument
1457 struct device *dev = &pdev->dev; in ahci_init_one()
1467 ata_print_version_once(&pdev->dev, DRV_VERSION); in ahci_init_one()
1472 if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable) in ahci_init_one()
1476 if (is_mcp89_apple(pdev)) in ahci_init_one()
1477 ahci_mcp89_apple_enable(pdev); in ahci_init_one()
1483 if (pdev->vendor == PCI_VENDOR_ID_PROMISE) in ahci_init_one()
1484 dev_info(&pdev->dev, in ahci_init_one()
1488 if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06) in ahci_init_one()
1490 else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) in ahci_init_one()
1492 else if (pdev->vendor == 0x177d && pdev->device == 0xa01c) in ahci_init_one()
1496 rc = pcim_enable_device(pdev); in ahci_init_one()
1500 if (pdev->vendor == PCI_VENDOR_ID_INTEL && in ahci_init_one()
1501 (pdev->device == 0x2652 || pdev->device == 0x2653)) { in ahci_init_one()
1508 pci_read_config_byte(pdev, ICH_MAP, &map); in ahci_init_one()
1510 dev_info(&pdev->dev, in ahci_init_one()
1519 rc = pcim_iomap_regions_request_all(pdev, 1 << ahci_pci_bar, DRV_NAME); in ahci_init_one()
1521 pcim_pin_device(pdev); in ahci_init_one()
1532 (pdev->revision == 0xa1 || pdev->revision == 0xa2)) in ahci_init_one()
1536 if (board_id == board_ahci_sb700 && pdev->revision >= 0x40) in ahci_init_one()
1540 if (ahci_sb600_enable_64bit(pdev)) in ahci_init_one()
1543 hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar]; in ahci_init_one()
1546 if (ahci_broken_devslp(pdev)) in ahci_init_one()
1550 ahci_pci_save_initial_config(pdev, hpriv); in ahci_init_one()
1578 if (ahci_broken_system_poweroff(pdev)) { in ahci_init_one()
1580 dev_info(&pdev->dev, in ahci_init_one()
1584 if (ahci_broken_suspend(pdev)) { in ahci_init_one()
1586 dev_warn(&pdev->dev, in ahci_init_one()
1590 if (ahci_broken_online(pdev)) { in ahci_init_one()
1592 dev_info(&pdev->dev, in ahci_init_one()
1603 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); in ahci_init_one()
1608 ahci_init_interrupts(pdev, n_ports, hpriv); in ahci_init_one()
1613 dev_info(&pdev->dev, "SSS flag set, parallel bus scan disabled\n"); in ahci_init_one()
1642 rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64); in ahci_init_one()
1653 pci_set_master(pdev); in ahci_init_one()