summaryrefslogtreecommitdiffstats
path: root/sys/sys/pciio.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-02-02 22:04:40 +0000
committerjhb <jhb@FreeBSD.org>2009-02-02 22:04:40 +0000
commita37ff990182c633e11c19b0528fe943f1bdd2fa6 (patch)
tree62c6b90f41955b83b714a7366f946904ec0a813d /sys/sys/pciio.h
parent1ceada5d55c2ffd656a1895fec7e6d01d87cf557 (diff)
downloadFreeBSD-src-a37ff990182c633e11c19b0528fe943f1bdd2fa6.zip
FreeBSD-src-a37ff990182c633e11c19b0528fe943f1bdd2fa6.tar.gz
- Add a new ioctl to /dev/pci to fetch details on an individual BAR of a
device. The details include the current value of the BAR (including all the flag bits and the current base address), its length, and whether or not it is enabled. Since this operation is not invasive, non-root users are allowed to use it (unlike manual config register access which requires root). The intention is that userland apps (such as Xorg) will use this interface rather than dangerously frobbing the BARs from userland to obtain this information. - Add a new sub-mode to the 'list' mode of pciconf. The -b flag when used with -l will now list all the active BARs for each device. (Missed in previous commit) MFC after: 1 week
Diffstat (limited to 'sys/sys/pciio.h')
-rw-r--r--sys/sys/pciio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/sys/pciio.h b/sys/sys/pciio.h
index 29771e4..a0c4560 100644
--- a/sys/sys/pciio.h
+++ b/sys/sys/pciio.h
@@ -108,9 +108,18 @@ struct pci_io {
u_int32_t pi_data; /* data to write or result of read */
};
+struct pci_bar_io {
+ struct pcisel pbi_sel; /* device to operate on */
+ int pbi_reg; /* starting address of BAR */
+ int pbi_enabled; /* decoding enabled */
+ uint64_t pbi_base; /* current value of BAR */
+ uint64_t pbi_length; /* length of BAR */
+};
+
#define PCIOCGETCONF _IOWR('p', 5, struct pci_conf_io)
#define PCIOCREAD _IOWR('p', 2, struct pci_io)
#define PCIOCWRITE _IOWR('p', 3, struct pci_io)
#define PCIOCATTACHED _IOWR('p', 4, struct pci_io)
+#define PCIOCGETBAR _IOWR('p', 6, struct pci_bar_io)
#endif /* !_SYS_PCIIO_H_ */
OpenPOWER on IntegriCloud