Lines Matching refs:ctlr
493 struct ahci_controller *ctlr = device_get_softc(dev); in ahci_pci_attach() local
509 ctlr->quirks = ahci_ids[i].quirks; in ahci_pci_attach()
511 if (ctlr->quirks & AHCI_Q_IOMMU_BUSWIDE) { in ahci_pci_attach()
525 ctlr->quirks |= AHCI_Q_SATA1_UNIT0; in ahci_pci_attach()
527 "quirks", &ctlr->quirks); in ahci_pci_attach()
528 ctlr->vendorid = pci_get_vendor(dev); in ahci_pci_attach()
529 ctlr->deviceid = pci_get_device(dev); in ahci_pci_attach()
530 ctlr->subvendorid = pci_get_subvendor(dev); in ahci_pci_attach()
531 ctlr->subdeviceid = pci_get_subdevice(dev); in ahci_pci_attach()
534 if (ctlr->quirks & AHCI_Q_ABAR0) in ahci_pci_attach()
535 ctlr->r_rid = PCIR_BAR(0); in ahci_pci_attach()
537 ctlr->r_rid = PCIR_BAR(5); in ahci_pci_attach()
538 if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in ahci_pci_attach()
539 &ctlr->r_rid, RF_ACTIVE))) in ahci_pci_attach()
551 vscap = ATA_INL(ctlr->r_mem, AHCI_VSCAP); in ahci_pci_attach()
553 uint32_t cap = ATA_INL(ctlr->r_mem, 0x800); /* Intel's REMAP CAP */ in ahci_pci_attach()
556 ctlr->remap_offset = 0x4000; in ahci_pci_attach()
557 ctlr->remap_size = 0x4000; in ahci_pci_attach()
566 (ATA_INL(ctlr->r_mem, 0x880 + i * 0x80) == in ahci_pci_attach()
570 ctlr->remapped_devices++; in ahci_pci_attach()
575 if (ctlr->remapped_devices > 0) { in ahci_pci_attach()
577 ctlr->remapped_devices); in ahci_pci_attach()
578 ctlr->quirks |= (AHCI_Q_NOMSIX | AHCI_Q_NOMSI); in ahci_pci_attach()
583 if (ctlr->quirks & AHCI_Q_NOMSIX) in ahci_pci_attach()
590 ctlr->r_msix_tab_rid = table_bar; in ahci_pci_attach()
591 ctlr->r_msix_pba_rid = pba_bar; in ahci_pci_attach()
604 ctlr->r_msix_table = NULL; in ahci_pci_attach()
605 if (ctlr->r_msix_tab_rid != ctlr->r_rid) { in ahci_pci_attach()
607 ctlr->r_msix_table = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in ahci_pci_attach()
608 &ctlr->r_msix_tab_rid, RF_ACTIVE); in ahci_pci_attach()
609 if (ctlr->r_msix_table == NULL) { in ahci_pci_attach()
619 ctlr->r_msix_pba = NULL; in ahci_pci_attach()
620 if ((ctlr->r_msix_pba_rid != ctlr->r_msix_tab_rid) && in ahci_pci_attach()
621 (ctlr->r_msix_pba_rid != ctlr->r_rid)) { in ahci_pci_attach()
623 ctlr->r_msix_pba = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in ahci_pci_attach()
624 &ctlr->r_msix_pba_rid, RF_ACTIVE); in ahci_pci_attach()
625 if (ctlr->r_msix_pba == NULL) { in ahci_pci_attach()
643 caps = ATA_INL(ctlr->r_mem, AHCI_CAP); in ahci_pci_attach()
644 pi = ATA_INL(ctlr->r_mem, AHCI_PI); in ahci_pci_attach()
645 if (ctlr->quirks & AHCI_Q_NOMSI) in ahci_pci_attach()
646 ctlr->msi = 0; in ahci_pci_attach()
647 else if ((ctlr->quirks & AHCI_Q_1MSI) || in ahci_pci_attach()
649 ctlr->msi = 1; in ahci_pci_attach()
651 ctlr->msi = 2; in ahci_pci_attach()
653 device_get_unit(dev), "msi", &ctlr->msi); in ahci_pci_attach()
654 ctlr->numirqs = 1; in ahci_pci_attach()
656 ctlr->msi = 0; in ahci_pci_attach()
657 if (ctlr->msi < 0) in ahci_pci_attach()
658 ctlr->msi = 0; in ahci_pci_attach()
659 else if (ctlr->msi == 1) { in ahci_pci_attach()
662 } else if (ctlr->msi > 1) in ahci_pci_attach()
663 ctlr->msi = 2; in ahci_pci_attach()
666 if (ctlr->msi > 0) { in ahci_pci_attach()
673 ctlr->numirqs = msix_count; in ahci_pci_attach()
683 ctlr->numirqs = msi_count; in ahci_pci_attach()
688 ctlr->msi = 0; in ahci_pci_attach()
696 if (ctlr->msi > 0) in ahci_pci_attach()
715 struct ahci_controller *ctlr = device_get_softc(dev); in ahci_pci_suspend() local
719 ATA_OUTL(ctlr->r_mem, AHCI_GHC, in ahci_pci_suspend()
720 ATA_INL(ctlr->r_mem, AHCI_GHC) & (~AHCI_GHC_IE)); in ahci_pci_suspend()