From owner-freebsd-arch Sat Oct 30 22:31:27 1999 Delivered-To: freebsd-arch@freebsd.org Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (Postfix) with ESMTP id 8574014CC7 for ; Sat, 30 Oct 1999 22:31:24 -0700 (PDT) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.3/8.9.3) with ESMTP id GAA14818 for ; Sun, 31 Oct 1999 06:31:23 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id GAA64253 for freebsd-arch@freebsd.org; Sun, 31 Oct 1999 06:31:23 +0100 (MET) Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by hub.freebsd.org (Postfix) with ESMTP id 25FF814CC7 for ; Sat, 30 Oct 1999 22:31:04 -0700 (PDT) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.9.3/8.9.1) id XAA22921 for freebsd-arch@FreeBSD.ORG; Sat, 30 Oct 1999 23:31:04 -0600 (MDT) (envelope-from ken) Message-Id: <199910310531.XAA22921@panzer.kdm.org> Subject: replacing pci/pci_ioctl.h with sys/pciio.h To: freebsd-arch@freebsd.org Date: Sat, 30 Oct 1999 23:31:04 -0600 (MDT) From: "Kenneth D. Merry" X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Here's a set of patches (against -current from a couple of days ago) to replace pci/pci_ioctl.h with sys/pciio.h. Since random header files from sys/pci aren't installed in /usr/include (and shouldn't be), it makes it difficult for userland applications to use the PCI ioctl interface. pciconf(8) just adjusts its include path to pull in the current header, but the Alpha XFree86 port has to do some hackery to pull in the right source file. This also includes a man page for pci(4). Steve Price has tested this with buildworlds and GENERIC kernel builds on both Alpha and i386. Any objections or (relevant!) comments? Ken -- Kenneth Merry ken@kdm.org Index: share/man/man4/Makefile =================================================================== RCS file: /home/ncvs/src/share/man/man4/Makefile,v retrieving revision 1.59 diff -u -r1.59 Makefile --- Makefile 1999/08/22 23:40:40 1.59 +++ Makefile 1999/10/24 15:52:28 @@ -5,7 +5,7 @@ icmp.4 ifmib.4 iic.4 iicbb.4 iicbus.4 iicsmb.4 \ inet.4 intpm.4 intro.4 ip.4 ipfirewall.4 kld.4 \ lo.4 lp.4 lpbb.4 lpt.4 natm.4 netintro.4 \ - null.4 pass.4 ppbus.4 ppi.4 ppp.4 pt.4 pty.4 \ + null.4 pass.4 pci.4 ppbus.4 ppi.4 ppp.4 pt.4 pty.4 \ route.4 sa.4 scsi.4 \ sd.4 sl.4 smb.4 smbus.4 smp.4 snp.4 sppp.4 ssc.4 st.4 su.4 tcp.4 \ termios.4 ttcp.4 tty.4 tun.4 udp.4 uk.4 unix.4 update.4 vinum.4 vn.4 \ Index: share/man/man4/pci.4 =================================================================== RCS file: pci.4 diff -N pci.4 --- /dev/null Sun Oct 24 10:45:05 1999 +++ pci.4 Sun Oct 24 10:46:32 1999 @@ -0,0 +1,295 @@ +.\" +.\" Copyright (c) 1999 Kenneth D. Merry. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 24, 1999 +.Dt PCI 4 +.Os FreeBSD 4.0 +.Sh NAME +.Nm pci +.Nd Generic PCI driver +.Sh SYNOPSYIS +.Cd controller pci0 +.Sh DESCRIPTION +The +.Nm pci +driver provides a way for userland programs to read and write +.Tn PCI +configuration registers. It also provides a way for userland programs to +get a list of all +.Tn PCI +devices, or all +.Tn PCI +devices that match various patterns. +.Pp +Since the +.Nm pci +driver provides a write interface for +.Tn PCI +configuration registers, system administrators should exercise caution when +granting access to the +.Nm pci +device. If used improperly, this driver can allow userland applications to +crash a machine or cause data loss. +.Sh KERNEL CONFIGURATION +It is only necessary to specify one +.Nm pci +controller in the kernel. Additional +.Tn PCI +busses are handled automatically as they are encountered. +.Sh IOCTLS +The following +.Xr ioctl 2 +calls are supported by the +.Nm pci +driver. They are defined in the header file +.Aq Pa sys/pciio.h . +.Bl -tag -width 012345678901234 +.Pp +.It PCIOCGETCONF +This +.Xr ioctl 2 +takes a +.Va pci_conf_io +structure. It allows the user to retrieve information on all +.Tn PCI +devices in the system, or on +.Tn PCI +devices matching patterns supplied by the user. +The +.Va pci_conf_io +structure consists of a number of fields: +.Bl -tag -width match_buf_len +.It pat_buf_len +The length, in bytes, of the buffer filled with user-supplied patterns. +.It num_patterns +The number of user-supplied patterns. +.It patterns +Pointer to a buffer filled with user-supplied patterns. +.Va patterns +is a pointer to +.Va num_patterns +.Va pci_match_conf +structures. The +.Va pci_match_conf +structure consists of the following elements: +.Bl -tag -width pd_vendor +.It pc_sel +.Tn PCI +bus, slot and function. +.It pd_name +.Tn PCI +device driver name. +.It pd_unit +.Tn PCI +device driver unit number. +.It pc_vendor +.Tn PCI +vendor ID. +.It pc_device +.Tn PCI +device ID. +.It pc_class +.Tn PCI +device class. +.It flags +The flags describe which of the fields the kernel should match against. +A device must match all specified fields in order to be returned. The +match flags are enumerated in the +.Va pci_getconf_flags +structure. +Hopefully the flag values are obvious enough that they don't need to +described in detail. +.El +.It match_buf_len +Length of the +.Va matches +buffer allocated by the user to hold the results of the +.Dv PCIOCGETCONF +query. +.It num_matches +Number of matches returned by the kernel. +.It matches +Buffer containing matching devices returned by the kernel. The items in +this buffer are of type +.Va pci_conf , +which consists of the following items: +.Bl -tag -width pc_subvendor +.It pc_sel +.Tn PCI +bus, slot and function. +.It pc_hdr +.Tn PCI +header type. +.It pc_subvendor +.Tn PCI +subvendor ID. +.It pc_subdevice +.Tn PCI +subdevice ID. +.It pc_vendor +.Tn PCI +vendor ID. +.It pc_device +.Tn PCI +device ID. +.It pc_class +.Tn PCI +device class. +.It pc_subclass +.Tn PCI +device subclass. +.It pc_progif +.Tn PCI +device programming interface. +.It pc_revid +.Tn PCI +revision ID. +.It pd_name +Driver name. +.It pd_unit +Driver unit number. +.El +.It offset +The offset is passed in by the user to tell the kernel where it should +start traversing the device list. The value passed out by the kernel +points to the record immediately after the last one returned. The user may +pass the value returned by the kernel in subsequent calls to the +.Dv PCIOCGETCONF +ioctl. If the user does not intend to use the offset, it must be set to +zero. +.It generation +.Tn PCI +configuration generation. This value only needs to be set if the offset is +set. The kernel will compare the current generation number of its internal +device list to the generation passed in by the user to determine whether +its device list has changed since the user last called the +.Dv PCIOCGETCONF +ioctl. If the device list has changed, a status of +.Va PCI_GETCONF_LIST_CHANGED +will be passed back. +.It status +The status tells the user the disposition of his request for a device list. +The possible status values are: +.Bl -ohang +.It PCI_GETCONF_LAST_DEVICE +This means that there are no more devices in the PCI device list after the +ones returned in the +.Va matches +buffer. +.It PCI_GETCONF_LIST_CHANGED +This status tells the user that the +.Tn PCI +device list has changed since his last call to the +.Dv PCIOCGETCONF +ioctl and he must reset the +.Va offset +and +.Va generation +to zero to start over at the beginning of the list. +.It PCI_GETCONF_MORE_DEVS +This tells the user that his buffer was not large enough to hold all of the +remaining devices in the device list that possibly match his criteria. It +is possible for this status to be returned, even when none of the remaining +devices in the list would match the user's criteria. +.It PCI_GETCONF_ERROR +This indicates a general error while servicing the user's request. A more +specific indication of the problem may or may not be printed in the kernel +message buffer (and by implication, the system console). +.El +.El +.It PCIOCREAD +This +.Xr ioctl 2 +reads the +.Tn PCI +configuration registers specified by the passed-in +.Va pci_io +structure. The +.Va pci_io +structure consists of the following fields: +.Bl -tag -width pi_width +.It pi_sel +A +.Va pcisel +structure which specifies the bus, slot and function the user would like to +query. +.It pi_reg +The +.Tn PCI +configuration register the user would like to access. +.It pi_width +The width, in bytes, of the data the user would like to read. This value +may be either 1, 2, or 4. 3-byte reads and reads larger than 4 bytes are +not supported. +.It pi_data +The data returned by the kernel. +.El +.It PCIOCWRITE +This +.Xr ioctl 2 +allows users to write to the +.Tn PCI +specified in the passed-in +.Va pci_io +structure. The +.Va pci_io +structure is described above. The limitations on data width described for +reading registers, above, also apply to writing +.Tn PCI +configuration registers. +.El +.Sh FILES +.Bl -tag -width 01234567890 -compact +.It Pa /dev/pci +Character device for the +.Nm pci +driver. +.El +.Sh DIAGNOSTICS +None. +.Sh SEE ALSO +.Xr pciconf 8 +.Sh HISTORY +The +.Nm pci +driver (not the kernel's +.Tn PCI +support code) first appeared in +.Fx 2.2 , +and was written by Stefan Esser and Garrett Wollman. +Support for device listing and matching was re-implemented by +Kenneth Merry, and first appeared in +.Fx 3.0 . +.Sh AUTHORS +.An Kenneth Merry Aq ken@FreeBSD.ORG +.Sh BUGS +It isn't possible for users to specify an accurate offset into the device +list without calling the +.Dv PCIOCGETCONF +at least once, since they have no way of knowing the current generation +number otherwise. This probably isn't a serious problem, though, since +users can easily narrow their search by specifying a pattern or patterns +for the kernel to match against. Index: sys/alpha/alpha/dec_2100_a50.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/dec_2100_a50.c,v retrieving revision 1.4 diff -u -r1.4 dec_2100_a50.c --- dec_2100_a50.c 1999/10/05 21:19:33 1.4 +++ dec_2100_a50.c 1999/10/24 15:52:42 @@ -45,7 +45,6 @@ #include #include #include -#include #include #include Index: sys/alpha/alpha/dec_axppci_33.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/dec_axppci_33.c,v retrieving revision 1.5 diff -u -r1.5 dec_axppci_33.c --- dec_axppci_33.c 1999/10/05 21:19:34 1.5 +++ dec_axppci_33.c 1999/10/24 15:52:53 @@ -42,7 +42,6 @@ #include #include #include -#include #include #include "sio.h" Index: sys/alpha/alpha/dec_eb64plus.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/dec_eb64plus.c,v retrieving revision 1.3 diff -u -r1.3 dec_eb64plus.c --- dec_eb64plus.c 1999/10/05 21:19:34 1.3 +++ dec_eb64plus.c 1999/10/24 15:53:03 @@ -60,7 +60,6 @@ #include #include -#include #include #include Index: sys/alpha/alpha/dec_kn20aa.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/dec_kn20aa.c,v retrieving revision 1.6 diff -u -r1.6 dec_kn20aa.c --- dec_kn20aa.c 1999/10/05 21:19:34 1.6 +++ dec_kn20aa.c 1999/10/24 15:53:23 @@ -42,7 +42,6 @@ #include #include #include -#include #include #include Index: sys/alpha/alpha/dec_st550.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/dec_st550.c,v retrieving revision 1.4 diff -u -r1.4 dec_st550.c --- dec_st550.c 1999/10/05 21:19:34 1.4 +++ dec_st550.c 1999/10/24 15:53:32 @@ -48,7 +48,6 @@ #include #include #include -#include #include #include Index: sys/alpha/alpha/dec_st6600.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/dec_st6600.c,v retrieving revision 1.3 diff -u -r1.3 dec_st6600.c --- dec_st6600.c 1999/10/05 21:19:34 1.3 +++ dec_st6600.c 1999/10/24 15:53:39 @@ -41,7 +41,6 @@ #include #include #include -#include #include #include Index: sys/pci/pci.c =================================================================== RCS file: /home/ncvs/src/sys/pci/pci.c,v retrieving revision 1.123 diff -u -r1.123 pci.c --- pci.c 1999/10/17 06:48:47 1.123 +++ pci.c 1999/10/24 15:53:49 @@ -54,7 +54,7 @@ #include #include -#include +#include #ifdef APIC_IO #include Index: sys/pci/pci_ioctl.h =================================================================== RCS file: pci_ioctl.h diff -N pci_ioctl.h --- /tmp/cvse16454 Sun Oct 24 11:14:40 1999 +++ /dev/null Sun Oct 24 10:45:05 1999 @@ -1,128 +0,0 @@ -#ifndef _PCI_IOCTL_H -#define _PCI_IOCTL_H 1 - -#include - - -#define PCI_MAXNAMELEN 16 /* max no. of characters in a device name */ - -typedef enum { - PCI_GETCONF_LAST_DEVICE, - PCI_GETCONF_LIST_CHANGED, - PCI_GETCONF_MORE_DEVS, - PCI_GETCONF_ERROR -} pci_getconf_status; - -typedef enum { - PCI_GETCONF_NO_MATCH = 0x00, - PCI_GETCONF_MATCH_BUS = 0x01, - PCI_GETCONF_MATCH_DEV = 0x02, - PCI_GETCONF_MATCH_FUNC = 0x04, - PCI_GETCONF_MATCH_NAME = 0x08, - PCI_GETCONF_MATCH_UNIT = 0x10, - PCI_GETCONF_MATCH_VENDOR = 0x20, - PCI_GETCONF_MATCH_DEVICE = 0x40, - PCI_GETCONF_MATCH_CLASS = 0x80 -} pci_getconf_flags; - -struct pcisel { - u_int8_t pc_bus; /* bus number */ - u_int8_t pc_dev; /* device on this bus */ - u_int8_t pc_func; /* function on this device */ -}; - -struct pci_conf { - struct pcisel pc_sel; /* bus+slot+function */ - u_int8_t pc_hdr; /* PCI header type */ - u_int16_t pc_subvendor; /* card vendor ID */ - u_int16_t pc_subdevice; /* card device ID, assigned by - card vendor */ - u_int16_t pc_vendor; /* chip vendor ID */ - u_int16_t pc_device; /* chip device ID, assigned by - chip vendor */ - u_int8_t pc_class; /* chip PCI class */ - u_int8_t pc_subclass; /* chip PCI subclass */ - u_int8_t pc_progif; /* chip PCI programming interface */ - u_int8_t pc_revid; /* chip revision ID */ - char pd_name[PCI_MAXNAMELEN + 1]; /* Name of peripheral - device */ - u_long pd_unit; /* Unit number */ -}; - -struct pci_match_conf { - struct pcisel pc_sel; /* bus+slot+function */ - char pd_name[PCI_MAXNAMELEN + 1]; /* Name of peripheral - device */ - u_long pd_unit; /* Unit number */ - u_int16_t pc_vendor; /* PCI Vendor ID */ - u_int16_t pc_device; /* PCI Device ID */ - u_int8_t pc_class; /* PCI class */ - pci_getconf_flags flags; /* Matching expression */ -}; - -struct pci_conf_io { - u_int32_t pat_buf_len; /* - * Length of buffer passed in from - * user space. - */ - u_int32_t num_patterns; /* - * Number of pci_match_conf structures - * passed in by the user. - */ - struct pci_match_conf *patterns; /* - * Patterns passed in by the user. - */ - u_int32_t match_buf_len;/* - * Length of match buffer passed - * in by the user. - */ - u_int32_t num_matches; /* - * Number of matches returned by - * the kernel. - */ - struct pci_conf *matches; /* - * PCI device matches returned by - * the kernel. - */ - u_int32_t offset; /* - * Passed in by the user code to - * indicate where the kernel should - * start traversing the device list. - * The value passed out by the kernel - * points to the record immediately - * after the last one returned. - * i.e. this value may be passed back - * unchanged by the user for a - * subsequent call. - */ - u_int32_t generation; /* - * PCI configuration generation. - * This only needs to be set if the - * offset is set. The kernel will - * compare its current generation - * number to the generation passed - * in by the user to determine - * whether the PCI device list has - * changed since the user last - * called the GETCONF ioctl. - */ - pci_getconf_status status; /* - * Status passed back from the - * kernel. - */ -}; - -struct pci_io { - struct pcisel pi_sel; /* device to operate on */ - int pi_reg; /* configuration register to examine */ - int pi_width; /* width (in bytes) of read or write */ - u_int32_t pi_data; /* data to write or result of read */ -}; - - -#define PCIOCGETCONF _IOWR('p', 1, 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) - -#endif /* _PCI_IOCTL_H */ Index: sys/pci/pcivar.h =================================================================== RCS file: /home/ncvs/src/sys/pci/pcivar.h,v retrieving revision 1.36 diff -u -r1.36 pcivar.h --- pcivar.h 1999/10/14 21:38:33 1.36 +++ pcivar.h 1999/10/24 15:54:02 @@ -34,7 +34,6 @@ #define PCI_COMPAT #endif -#include /* XXX KDM */ #include /* some PCI bus constants */ Index: sys/sys/pciio.h =================================================================== RCS file: pciio.h diff -N pciio.h --- /dev/null Sun Oct 24 10:45:05 1999 +++ pciio.h Sun Oct 24 10:47:03 1999 @@ -0,0 +1,115 @@ +/*- + * Copyright (c) 1997, Stefan Esser + * Copyright (c) 1997, 1998, 1999, Kenneth D. Merry + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef _SYS_PCIIO_H_ +#define _SYS_PCIIO_H_ + +#include + +#define PCI_MAXNAMELEN 16 + +typedef enum { + PCI_GETCONF_LAST_DEVICE, + PCI_GETCONF_LIST_CHANGED, + PCI_GETCONF_MORE_DEVS, + PCI_GETCONF_ERROR +} pci_getconf_status; + +typedef enum { + PCI_GETCONF_NO_MATCH = 0x00, + PCI_GETCONF_MATCH_BUS = 0x01, + PCI_GETCONF_MATCH_DEV = 0x02, + PCI_GETCONF_MATCH_FUNC = 0x04, + PCI_GETCONF_MATCH_NAME = 0x08, + PCI_GETCONF_MATCH_UNIT = 0x10, + PCI_GETCONF_MATCH_VENDOR = 0x20, + PCI_GETCONF_MATCH_DEVICE = 0x40, + PCI_GETCONF_MATCH_CLASS = 0x80 +} pci_getconf_flags; + +struct pcisel { + u_int8_t pc_bus; /* bus number */ + u_int8_t pc_dev; /* device on this bus */ + u_int8_t pc_func; /* function on this device */ +}; + +struct pci_conf { + struct pcisel pc_sel; /* bus+slot+function */ + u_int8_t pc_hdr; /* PCI header type */ + u_int16_t pc_subvendor; /* card vendor ID */ + u_int16_t pc_subdevice; /* card device ID, assigned by + card vendor */ + u_int16_t pc_vendor; /* chip vendor ID */ + u_int16_t pc_device; /* chip device ID, assigned by + chip vendor */ + u_int8_t pc_class; /* chip PCI class */ + u_int8_t pc_subclass; /* chip PCI subclass */ + u_int8_t pc_progif; /* chip PCI programming interface */ + u_int8_t pc_revid; /* chip revision ID */ + char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ + u_long pd_unit; /* device unit number */ +}; + +struct pci_match_conf { + struct pcisel pc_sel; /* bus+slot+function */ + char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ + u_long pd_unit; /* Unit number */ + u_int16_t pc_vendor; /* PCI Vendor ID */ + u_int16_t pc_device; /* PCI Device ID */ + u_int8_t pc_class; /* PCI class */ + pci_getconf_flags flags; /* Matching expression */ +}; + +struct pci_conf_io { + u_int32_t pat_buf_len; /* pattern buffer length */ + u_int32_t num_patterns; /* number of patterns */ + struct pci_match_conf *patterns; /* pattern buffer */ + u_int32_t match_buf_len; /* match buffer length */ + u_int32_t num_matches; /* number of matches returned */ + struct pci_conf *matches; /* match buffer */ + u_int32_t offset; /* offset into device list */ + u_int32_t generation; /* device list generation */ + pci_getconf_status status; /* request status */ +}; + +struct pci_io { + struct pcisel pi_sel; /* device to operate on */ + int pi_reg; /* configuration register to examine */ + int pi_width; /* width (in bytes) of read or write */ + u_int32_t pi_data; /* data to write or result of read */ +}; + + +#define PCIOCGETCONF _IOWR('p', 1, 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) + +#endif /* !_SYS_PCIIO_H_ */ Index: usr.sbin/pciconf/pciconf.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pciconf/pciconf.c,v retrieving revision 1.9 diff -u -r1.9 pciconf.c --- pciconf.c 1999/08/28 01:17:39 1.9 +++ pciconf.c 1999/10/24 15:54:10 @@ -40,9 +40,7 @@ #include #include #include - -#include -#include +#include #include "pathnames.h" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message