pciio.h revision 1.2.4.2 1 1.2.4.2 fvdl /* $NetBSD: pciio.h,v 1.2.4.2 2001/10/01 12:46:03 fvdl Exp $ */
2 1.2.4.2 fvdl
3 1.2.4.2 fvdl /*
4 1.2.4.2 fvdl * Copyright 2001 Wasabi Systems, Inc.
5 1.2.4.2 fvdl * All rights reserved.
6 1.2.4.2 fvdl *
7 1.2.4.2 fvdl * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 1.2.4.2 fvdl *
9 1.2.4.2 fvdl * Redistribution and use in source and binary forms, with or without
10 1.2.4.2 fvdl * modification, are permitted provided that the following conditions
11 1.2.4.2 fvdl * are met:
12 1.2.4.2 fvdl * 1. Redistributions of source code must retain the above copyright
13 1.2.4.2 fvdl * notice, this list of conditions and the following disclaimer.
14 1.2.4.2 fvdl * 2. Redistributions in binary form must reproduce the above copyright
15 1.2.4.2 fvdl * notice, this list of conditions and the following disclaimer in the
16 1.2.4.2 fvdl * documentation and/or other materials provided with the distribution.
17 1.2.4.2 fvdl * 3. All advertising materials mentioning features or use of this software
18 1.2.4.2 fvdl * must display the following acknowledgement:
19 1.2.4.2 fvdl * This product includes software developed for the NetBSD Project by
20 1.2.4.2 fvdl * Wasabi Systems, Inc.
21 1.2.4.2 fvdl * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.2.4.2 fvdl * or promote products derived from this software without specific prior
23 1.2.4.2 fvdl * written permission.
24 1.2.4.2 fvdl *
25 1.2.4.2 fvdl * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.2.4.2 fvdl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.2.4.2 fvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.2.4.2 fvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.2.4.2 fvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.2.4.2 fvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.2.4.2 fvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.2.4.2 fvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.2.4.2 fvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.2.4.2 fvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.2.4.2 fvdl * POSSIBILITY OF SUCH DAMAGE.
36 1.2.4.2 fvdl */
37 1.2.4.2 fvdl
38 1.2.4.2 fvdl #ifndef _DEV_PCI_PCIIO_H_
39 1.2.4.2 fvdl #define _DEV_PCI_PCIIO_H_
40 1.2.4.2 fvdl
41 1.2.4.2 fvdl /*
42 1.2.4.2 fvdl * User -> kernel interface for PCI bus access.
43 1.2.4.2 fvdl */
44 1.2.4.2 fvdl
45 1.2.4.2 fvdl #include <sys/ioccom.h>
46 1.2.4.2 fvdl
47 1.2.4.2 fvdl /*
48 1.2.4.2 fvdl * pciio_cfgreg:
49 1.2.4.2 fvdl *
50 1.2.4.2 fvdl * Representation of a PCI config space register.
51 1.2.4.2 fvdl */
52 1.2.4.2 fvdl struct pciio_cfgreg {
53 1.2.4.2 fvdl u_int reg; /* offset into PCI configuration space */
54 1.2.4.2 fvdl uint32_t val; /* value of the register */
55 1.2.4.2 fvdl };
56 1.2.4.2 fvdl
57 1.2.4.2 fvdl /*
58 1.2.4.2 fvdl * Read and write PCI configuration space registers on a
59 1.2.4.2 fvdl * specific device.
60 1.2.4.2 fvdl */
61 1.2.4.2 fvdl #define PCI_IOC_CFGREAD _IOWR('P', 0, struct pciio_cfgreg)
62 1.2.4.2 fvdl #define PCI_IOC_CFGWRITE _IOW('P', 1, struct pciio_cfgreg)
63 1.2.4.2 fvdl
64 1.2.4.2 fvdl /*
65 1.2.4.2 fvdl * pciio_bdf_cfgreg:
66 1.2.4.2 fvdl *
67 1.2.4.2 fvdl * Like pciio_cfgreg, except for any bus/dev/func within
68 1.2.4.2 fvdl * a given PCI domain.
69 1.2.4.2 fvdl */
70 1.2.4.2 fvdl struct pciio_bdf_cfgreg {
71 1.2.4.2 fvdl u_int bus;
72 1.2.4.2 fvdl u_int device;
73 1.2.4.2 fvdl u_int function;
74 1.2.4.2 fvdl struct pciio_cfgreg cfgreg;
75 1.2.4.2 fvdl };
76 1.2.4.2 fvdl
77 1.2.4.2 fvdl /*
78 1.2.4.2 fvdl * Read and write PCI configuration space registers on any
79 1.2.4.2 fvdl * device within a given PCI domain.
80 1.2.4.2 fvdl */
81 1.2.4.2 fvdl #define PCI_IOC_BDF_CFGREAD _IOWR('P', 2, struct pciio_bdf_cfgreg)
82 1.2.4.2 fvdl #define PCI_IOC_BDF_CFGWRITE _IOW('P', 3, struct pciio_bdf_cfgreg)
83 1.2.4.2 fvdl
84 1.2.4.2 fvdl /*
85 1.2.4.2 fvdl * pciio_businfo:
86 1.2.4.2 fvdl *
87 1.2.4.2 fvdl * Information for a PCI bus (autconfiguration node) instance.
88 1.2.4.2 fvdl */
89 1.2.4.2 fvdl struct pciio_businfo {
90 1.2.4.2 fvdl u_int busno; /* bus number */
91 1.2.4.2 fvdl u_int maxdevs; /* max devices on bus */
92 1.2.4.2 fvdl };
93 1.2.4.2 fvdl
94 1.2.4.2 fvdl #define PCI_IOC_BUSINFO _IOR('P', 4, struct pciio_businfo)
95 1.2.4.2 fvdl
96 1.2.4.2 fvdl #endif /* _DEV_PCI_PCIIO_H_ */
97