From d60b8a3096c2760d921f7f4b6e99280cb82f8c7b Mon Sep 17 00:00:00 2001 From: marius 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) --- usr.sbin/pciconf/pciconf.8 | 13 ++++++++----- usr.sbin/pciconf/pciconf.c | 8 +++++--- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'usr.sbin/pciconf') diff --git a/usr.sbin/pciconf/pciconf.8 b/usr.sbin/pciconf/pciconf.8 index ba5f61a..4195d28 100644 --- a/usr.sbin/pciconf/pciconf.8 +++ b/usr.sbin/pciconf/pciconf.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2007 +.Dd September 30, 2007 .Dt PCICONF 8 .Os .Sh NAME @@ -56,9 +56,12 @@ With the .Fl l option, it lists all devices found by the boot probe in the following format: .Bd -literal -foo0@pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00 -bar0@pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00 -none0@pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00 +foo0@pci0:0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 \ +hdr=0x00 +bar0@pci0:0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 \ +hdr=0x00 +none0@pci0:0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 \ +hdr=0x00 .Ed .Pp The first column gives the @@ -139,7 +142,7 @@ except for require a .Ar selector of the form -.Li pci Ns Va bus Ns \&: Ns Va device +.Li pci Ns Va domain Ns \&: Ns Va bus Ns \&: Ns Va device (optionally followed by .Li \&: Ns Va function ) . A final colon may be appended and diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c index a42435c..07b6feb 100644 --- a/usr.sbin/pciconf/pciconf.c +++ b/usr.sbin/pciconf/pciconf.c @@ -203,13 +203,12 @@ list_devs(int verbose, int caps) return; } for (p = conf; p < &conf[pc.num_matches]; p++) { - - printf("%s%d@pci%d:%d:%d:\tclass=0x%06x card=0x%08x " + printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x card=0x%08x " "chip=0x%08x rev=0x%02x hdr=0x%02x\n", (p->pd_name && *p->pd_name) ? p->pd_name : "none", (p->pd_name && *p->pd_name) ? (int)p->pd_unit : - none_count++, + none_count++, p->pc_sel.pc_domain, p->pc_sel.pc_bus, p->pc_sel.pc_dev, p->pc_sel.pc_func, (p->pc_class << 16) | (p->pc_subclass << 8) | p->pc_progif, @@ -497,6 +496,9 @@ getsel(const char *str) if (strncmp(ep, "pci", 3) == 0) { ep += 3; + sel.pc_domain = strtoul(ep, &ep, 0); + if (!ep || *ep++ != ':') + errx(1, "cannot parse selector %s", str); sel.pc_bus = strtoul(ep, &ep, 0); if (!ep || *ep++ != ':') errx(1, "cannot parse selector %s", str); -- cgit v1.1