FreeBSD/Linux Kernel Cross Reference
sys/sys/pciio.h
1 /*-
2 * Copyright (c) 1997, Stefan Esser <se@FreeBSD.ORG>
3 * Copyright (c) 1997, 1998, 1999, Kenneth D. Merry <ken@FreeBSD.ORG>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice unmodified, this list of conditions, and the following
11 * disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * $FreeBSD: releng/5.2/sys/sys/pciio.h 83045 2001-09-05 01:22:14Z obrien $
28 *
29 */
30
31 #ifndef _SYS_PCIIO_H_
32 #define _SYS_PCIIO_H_
33
34 #include <sys/ioccom.h>
35
36 #define PCI_MAXNAMELEN 16
37
38 typedef enum {
39 PCI_GETCONF_LAST_DEVICE,
40 PCI_GETCONF_LIST_CHANGED,
41 PCI_GETCONF_MORE_DEVS,
42 PCI_GETCONF_ERROR
43 } pci_getconf_status;
44
45 typedef enum {
46 PCI_GETCONF_NO_MATCH = 0x00,
47 PCI_GETCONF_MATCH_BUS = 0x01,
48 PCI_GETCONF_MATCH_DEV = 0x02,
49 PCI_GETCONF_MATCH_FUNC = 0x04,
50 PCI_GETCONF_MATCH_NAME = 0x08,
51 PCI_GETCONF_MATCH_UNIT = 0x10,
52 PCI_GETCONF_MATCH_VENDOR = 0x20,
53 PCI_GETCONF_MATCH_DEVICE = 0x40,
54 PCI_GETCONF_MATCH_CLASS = 0x80
55 } pci_getconf_flags;
56
57 struct pcisel {
58 u_int8_t pc_bus; /* bus number */
59 u_int8_t pc_dev; /* device on this bus */
60 u_int8_t pc_func; /* function on this device */
61 };
62
63 struct pci_conf {
64 struct pcisel pc_sel; /* bus+slot+function */
65 u_int8_t pc_hdr; /* PCI header type */
66 u_int16_t pc_subvendor; /* card vendor ID */
67 u_int16_t pc_subdevice; /* card device ID, assigned by
68 card vendor */
69 u_int16_t pc_vendor; /* chip vendor ID */
70 u_int16_t pc_device; /* chip device ID, assigned by
71 chip vendor */
72 u_int8_t pc_class; /* chip PCI class */
73 u_int8_t pc_subclass; /* chip PCI subclass */
74 u_int8_t pc_progif; /* chip PCI programming interface */
75 u_int8_t pc_revid; /* chip revision ID */
76 char pd_name[PCI_MAXNAMELEN + 1]; /* device name */
77 u_long pd_unit; /* device unit number */
78 };
79
80 struct pci_match_conf {
81 struct pcisel pc_sel; /* bus+slot+function */
82 char pd_name[PCI_MAXNAMELEN + 1]; /* device name */
83 u_long pd_unit; /* Unit number */
84 u_int16_t pc_vendor; /* PCI Vendor ID */
85 u_int16_t pc_device; /* PCI Device ID */
86 u_int8_t pc_class; /* PCI class */
87 pci_getconf_flags flags; /* Matching expression */
88 };
89
90 struct pci_conf_io {
91 u_int32_t pat_buf_len; /* pattern buffer length */
92 u_int32_t num_patterns; /* number of patterns */
93 struct pci_match_conf *patterns; /* pattern buffer */
94 u_int32_t match_buf_len; /* match buffer length */
95 u_int32_t num_matches; /* number of matches returned */
96 struct pci_conf *matches; /* match buffer */
97 u_int32_t offset; /* offset into device list */
98 u_int32_t generation; /* device list generation */
99 pci_getconf_status status; /* request status */
100 };
101
102 struct pci_io {
103 struct pcisel pi_sel; /* device to operate on */
104 int pi_reg; /* configuration register to examine */
105 int pi_width; /* width (in bytes) of read or write */
106 u_int32_t pi_data; /* data to write or result of read */
107 };
108
109
110 #define PCIOCGETCONF _IOWR('p', 1, struct pci_conf_io)
111 #define PCIOCREAD _IOWR('p', 2, struct pci_io)
112 #define PCIOCWRITE _IOWR('p', 3, struct pci_io)
113 #define PCIOCATTACHED _IOWR('p', 4, struct pci_io)
114
115 #endif /* !_SYS_PCIIO_H_ */
Cache object: c3bdebe3ccb65148b064b66b1639d34d
|