Lines Matching +full:pci +full:- +full:domain
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
39 #include <dev/pci/pcivar.h>
40 #include <dev/pci/pcireg.h>
47 uint16_t domain;
52 static uint32_t pci_docfgregread(int domain, int bus, int slot, int func,
54 static struct pcie_mcfg_region *pcie_lookup_region(int domain, int bus);
66 * For amd64 we assume that type 1 I/O port-based access always works.
68 * switch to memory-mapped access.
80 "Enable support for PCI-e memory mapped config access");
90 pcie_lookup_region(int domain, int bus)
93 if (mcfg_regions[i].domain == domain &&
101 pci_docfgregread(int domain, int bus, int slot, int func, int reg, int bytes)
103 if (domain == 0 && bus == 0 && (1 << slot & pcie_badslots) != 0)
109 region = pcie_lookup_region(domain, bus);
115 if (domain == 0)
118 return (-1);
125 pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes)
132 * numbers in the range 128-254 to indicate something strange and
134 * and map them to 255, which the rest of the PCI code recognizes as
138 line = pci_docfgregread(domain, bus, slot, func, PCIR_INTLINE,
144 return (pci_docfgregread(domain, bus, slot, func, reg, bytes));
151 pci_cfgregwrite(int domain, int bus, int slot, int func, int reg, uint32_t data,
154 if (domain == 0 && bus == 0 && (1 << slot & pcie_badslots) != 0) {
162 region = pcie_lookup_region(domain, bus);
170 if (domain == 0)
186 (unsigned)bytes <= 4 && (reg & (bytes - 1)) == 0) {
208 int data = -1;
263 * inaccessible using memory-mapped PCI config access. Walk
281 pcie_cfgregopen(uint64_t base, uint16_t domain, uint8_t minbus, uint8_t maxbus)
289 printf("PCI: MCFG domain %u bus %u-%u base @ 0x%lx\n",
290 domain, minbus, maxbus, base);
299 region->base = pmap_mapdev_pciecfg(base + (minbus << 20), (maxbus + 1 - minbus) << 20);
300 region->domain = domain;
301 region->minbus = minbus;
302 region->maxbus = maxbus;
307 if (domain == 0 && minbus == 0)
322 * have a requirement that all accesses to the memory mapped PCI configuration
333 int data = -1;
335 MPASS(bus >= region->minbus && bus <= region->maxbus);
338 return (-1);
340 va = PCIE_VADDR(region->base, reg, bus - region->minbus, slot, func);
366 MPASS(bus >= region->minbus && bus <= region->maxbus);
371 va = PCIE_VADDR(region->base, reg, bus - region->minbus, slot, func);