Date: Thu, 03 Sep 2015 15:57:15 -0700 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org, Nomad Esst <noname.esst@yahoo.com> Cc: "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org> Subject: Re: Get pci slot number in driver Message-ID: <8357967.OxrZP5NxFz@ralph.baldwin.cx> In-Reply-To: <1473579278.716147.1440404222458.JavaMail.yahoo@mail.yahoo.com> References: <1473579278.716147.1440404222458.JavaMail.yahoo@mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, August 24, 2015 08:17:02 AM Nomad Esst via freebsd-hackers wrote: > Is it possible to find out the pci slot number on which the card is mounted in driver? I tried pci_get_slot but it's always 0.Any ideas about doing this? > regards It depends on what you mean by slot. If you mean the label of the physical slot in a chassis / motherboard, then there is no reliable way to determine this. (There are some PCI extended capabilities that I've never seen in the wild that can communicate this. There are various firmware tables ($PIR and SMBIOS) on x86 that can in theory tell you this, but it's a crap shoot whether the tables are correct or a pack of lies. If you want to determine the "device" field of a PCI device's (bus, device, function) config space access, you can use pci_get_slot() (FreeBSD calls it a slot even though the standard name in the PCI spec is "device" for legacy reasons as in original PCI a physical slot did have a unique "device" address on a given bus). -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8357967.OxrZP5NxFz>