From 55aaf894e8a76fe780757ef6d9d1119c367946cf Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Sun, 30 Sep 2007 11:05:18 +0000 Subject: Make the PCI code aware of PCI domains (aka PCI segments) so we can support machines having multiple independently numbered PCI domains and don't support reenumeration without ambiguity amongst the devices as seen by the OS and represented by PCI location strings. This includes introducing a function pci_find_dbsf(9) which works like pci_find_bsf(9) but additionally takes a domain number argument and limiting pci_find_bsf(9) to only search devices in domain 0 (the only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order to no longer report false positives when searching for siblings and dupe devices in the same domain respectively. Along with this change the sole host-PCI bridge driver converted to actually make use of PCI domain support is uninorth(4), the others continue to use domain 0 only for now and need to be converted as appropriate later on. Note that this means that the format of the location strings as used by pciconf(8) has been changed and that consumers of potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat) --- sys/dev/pci/pci_user.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sys/dev/pci/pci_user.c') diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 469dc40afcd2..78b760895d61 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -125,6 +125,11 @@ pci_conf_match(struct pci_match_conf *matches, int num_matches, * comparison. If the comparison fails, we don't have a * match, go on to the next item if there is one. */ + if (((matches[i].flags & PCI_GETCONF_MATCH_DOMAIN) != 0) + && (match_buf->pc_sel.pc_domain != + matches[i].pc_sel.pc_domain)) + continue; + if (((matches[i].flags & PCI_GETCONF_MATCH_BUS) != 0) && (match_buf->pc_sel.pc_bus != matches[i].pc_sel.pc_bus)) continue; @@ -388,8 +393,9 @@ getconfexit: * Look up the grandparent, i.e. the bridge device, * so that we can issue configuration space cycles. */ - pcidev = pci_find_bsf(io->pi_sel.pc_bus, - io->pi_sel.pc_dev, io->pi_sel.pc_func); + pcidev = pci_find_dbsf(io->pi_sel.pc_domain, + io->pi_sel.pc_bus, io->pi_sel.pc_dev, + io->pi_sel.pc_func); if (pcidev) { device_t busdev, brdev; -- cgit v1.3