svn commit: r188032 - head/sys/sys

John Baldwin jhb at FreeBSD.org
Mon Feb 2 14:04:41 PST 2009


Author: jhb
Date: Mon Feb  2 22:04:40 2009
New Revision: 188032
URL: http://svn.freebsd.org/changeset/base/188032

Log:
  - 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

Modified:
  head/sys/sys/pciio.h

Modified: head/sys/sys/pciio.h
==============================================================================
--- head/sys/sys/pciio.h	Mon Feb  2 21:51:52 2009	(r188031)
+++ head/sys/sys/pciio.h	Mon Feb  2 22:04:40 2009	(r188032)
@@ -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_ */


More information about the svn-src-head mailing list