- 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
This commit is contained in:
John Baldwin 2009-02-02 22:04:40 +00:00
parent b1e58dd43e
commit 333ebd77dc

View File

@ -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_ */