xref: /freebsd/sys/x86/include/pci_cfgreg.h (revision 1368987ae424617c7c314315a5e1b3c222773868)
1*1368987aSJohn Baldwin /*-
2*1368987aSJohn Baldwin  * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3*1368987aSJohn Baldwin  * All rights reserved.
4*1368987aSJohn Baldwin  *
5*1368987aSJohn Baldwin  * Redistribution and use in source and binary forms, with or without
6*1368987aSJohn Baldwin  * modification, are permitted provided that the following conditions
7*1368987aSJohn Baldwin  * are met:
8*1368987aSJohn Baldwin  * 1. Redistributions of source code must retain the above copyright
9*1368987aSJohn Baldwin  *    notice unmodified, this list of conditions, and the following
10*1368987aSJohn Baldwin  *    disclaimer.
11*1368987aSJohn Baldwin  * 2. Redistributions in binary form must reproduce the above copyright
12*1368987aSJohn Baldwin  *    notice, this list of conditions and the following disclaimer in the
13*1368987aSJohn Baldwin  *    documentation and/or other materials provided with the distribution.
14*1368987aSJohn Baldwin  *
15*1368987aSJohn Baldwin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*1368987aSJohn Baldwin  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*1368987aSJohn Baldwin  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*1368987aSJohn Baldwin  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*1368987aSJohn Baldwin  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*1368987aSJohn Baldwin  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*1368987aSJohn Baldwin  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*1368987aSJohn Baldwin  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*1368987aSJohn Baldwin  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*1368987aSJohn Baldwin  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*1368987aSJohn Baldwin  *
26*1368987aSJohn Baldwin  * $FreeBSD$
27*1368987aSJohn Baldwin  *
28*1368987aSJohn Baldwin  */
29*1368987aSJohn Baldwin 
30*1368987aSJohn Baldwin #ifndef __X86_PCI_CFGREG_H__
31*1368987aSJohn Baldwin #define	__X86_PCI_CFGREG_H__
32*1368987aSJohn Baldwin 
33*1368987aSJohn Baldwin #define CONF1_ADDR_PORT    0x0cf8
34*1368987aSJohn Baldwin #define CONF1_DATA_PORT    0x0cfc
35*1368987aSJohn Baldwin 
36*1368987aSJohn Baldwin #define CONF1_ENABLE       0x80000000ul
37*1368987aSJohn Baldwin #define CONF1_ENABLE_CHK   0x80000000ul
38*1368987aSJohn Baldwin #define CONF1_ENABLE_MSK   0x7f000000ul
39*1368987aSJohn Baldwin #define CONF1_ENABLE_CHK1  0xff000001ul
40*1368987aSJohn Baldwin #define CONF1_ENABLE_MSK1  0x80000001ul
41*1368987aSJohn Baldwin #define CONF1_ENABLE_RES1  0x80000000ul
42*1368987aSJohn Baldwin 
43*1368987aSJohn Baldwin #define CONF2_ENABLE_PORT  0x0cf8
44*1368987aSJohn Baldwin #define CONF2_FORWARD_PORT 0x0cfa
45*1368987aSJohn Baldwin 
46*1368987aSJohn Baldwin #define CONF2_ENABLE_CHK   0x0e
47*1368987aSJohn Baldwin #define CONF2_ENABLE_RES   0x0e
48*1368987aSJohn Baldwin 
49*1368987aSJohn Baldwin u_long		hostb_alloc_start(int type, u_long start, u_long end, u_long count);
50*1368987aSJohn Baldwin int		pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus);
51*1368987aSJohn Baldwin int		pci_cfgregopen(void);
52*1368987aSJohn Baldwin u_int32_t	pci_cfgregread(int bus, int slot, int func, int reg, int bytes);
53*1368987aSJohn Baldwin void		pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes);
54*1368987aSJohn Baldwin #ifdef __HAVE_PIR
55*1368987aSJohn Baldwin void		pci_pir_open(void);
56*1368987aSJohn Baldwin int		pci_pir_probe(int bus, int require_parse);
57*1368987aSJohn Baldwin int		pci_pir_route_interrupt(int bus, int device, int func, int pin);
58*1368987aSJohn Baldwin #endif
59*1368987aSJohn Baldwin 
60*1368987aSJohn Baldwin #endif /* !__X86_PCI_CFGREG_H__ */
61