From owner-svn-src-head@FreeBSD.ORG Mon Feb 2 22:04:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2977E1065674; Mon, 2 Feb 2009 22:04:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 122418FC0C; Mon, 2 Feb 2009 22:04:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12M4elZ008778; Mon, 2 Feb 2009 22:04:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12M4e0C008777; Mon, 2 Feb 2009 22:04:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200902022204.n12M4e0C008777@svn.freebsd.org> From: John Baldwin Date: Mon, 2 Feb 2009 22:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188032 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2009 22:04:41 -0000 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_ */