RTEMS  5.0.0
pci.h
Go to the documentation of this file.
1 
5 /*
6  * COPYRIGHT (c) 1989-2012.
7  * On-Line Applications Research Corporation (OAR).
8  *
9  * The license and distribution terms for this file may be
10  * found in the file LICENSE in this distribution or at
11  * http://www.rtems.org/license/LICENSE.
12  */
13 
14 /*
15  *
16  * PCI defines and function prototypes
17  * Copyright 1994, Drew Eckhardt
18  * Copyright 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
19  *
20  * For more information, please consult the following manuals (look at
21  * http://www.pcisig.com/ for how to get them):
22  *
23  * PCI BIOS Specification
24  * PCI Local Bus Specification
25  * PCI to PCI Bridge Specification
26  * PCI System Design Guide
27  */
28 
29 #ifndef BSP_PCI_H
30 #define BSP_PCI_H
31 
32 #include <rtems/pci.h>
33 #include <bsp.h>
34 #include <stdio.h>
35 
37 {
38  int pin, int_name[4];
39 };
40 struct _int_map
41 {
42  int bus, slot, opts;
43  struct _pin_routes pin_route[5];
44 };
45 struct pcibridge
46 {
47  int bus;
48  int slot;
49 };
50 
51 /* If there's a conflict between a name in the routing table and
52  * what's already set on the device, reprogram the device setting
53  * to reflect int_name[0] for the routing table entry
54  */
55 #define PCI_FIXUP_OPT_OVERRIDE_NAME (1<<0)
56 
57 void FixupPCI( const struct _int_map *, int (*swizzler)(int,int) );
58 
59 /* FIXME: This probably belongs into rtems/pci.h */
60 extern unsigned char pci_bus_count(void);
61 
62 int indirect_pci_read_config_byte(
63  unsigned char bus,
64  unsigned char slot,
65  unsigned char function,
66  unsigned char offset,
67  uint8_t *val
68 );
69 
70 int indirect_pci_read_config_word(
71  unsigned char bus,
72  unsigned char slot,
73  unsigned char function,
74  unsigned char offset,
75  uint16_t *val
76 );
77 
78 int indirect_pci_read_config_dword(
79  unsigned char bus,
80  unsigned char slot,
81  unsigned char function,
82  unsigned char offset,
83  uint32_t *val
84 );
85 
86 int indirect_pci_write_config_byte(
87  unsigned char bus,
88  unsigned char slot,
89  unsigned char function,
90  unsigned char offset,
91  uint8_t val
92 );
93 
94 int indirect_pci_write_config_word(
95  unsigned char bus,
96  unsigned char slot,
97  unsigned char function,
98  unsigned char offset,
99  uint16_t val
100 );
101 
102 int indirect_pci_write_config_dword(
103  unsigned char bus,
104  unsigned char slot,
105  unsigned char function,
106  unsigned char offset,
107  uint32_t val
108 );
109 
110 /* Can these be moved to the rtems pci.h? */
111 int FindPCIbridge( int mybus, struct pcibridge *pb );
112 
113 const pci_config_access_functions pci_indirect_functions;
114 
115 void pci_out_le32( uint32_t base, uint32_t addr, uint32_t val);
116 void pci_out_32( uint32_t base, uint32_t addr, uint32_t val);
117 uint8_t pci_in_8 ( uint32_t base, uint32_t addr );
118 int16_t pci_in_le16 ( uint32_t base, uint32_t addr );
119 uint32_t pci_in_le32 ( uint32_t base, uint32_t addr );
120 int16_t pci_in_16 ( uint32_t base, uint32_t addr );
121 uint32_t pci_in_32 ( uint32_t base, uint32_t addr );
122 void pci_out_8 ( uint32_t base, uint32_t addr, uint8_t val );
123 void pci_out_le16( uint32_t base, uint32_t addr, uint16_t val );
124 void pci_out_16( uint32_t base, uint32_t addr, uint16_t val );
125 void pci_out_32 ( uint32_t base, uint32_t addr, uint32_t val);
126 
127 #define out_32(_addr, _val) pci_out_32(BSP_PCI_BASE_ADDRESS, _addr, _val)
128 #define out_le32(_addr, _val) pci_out_le32(BSP_PCI_BASE_ADDRESS, _addr, _val)
129 #define out_32(_addr, _val) pci_out_32(BSP_PCI_BASE_ADDRESS, _addr, _val)
130 #define in_8(_addr) pci_in_8( BSP_PCI_BASE_ADDRESS, _addr )
131 #define in_le16(_addr) pci_in_le16( BSP_PCI_BASE_ADDRESS, _addr )
132 #define in_le32(_addr) pci_in_le32( BSP_PCI_BASE_ADDRESS, _addr )
133 #define in_16(_addr) pci_in_16( BSP_PCI_BASE_ADDRESS, _addr )
134 #define in_32(_addr) pci_in_32( BSP_PCI_BASE_ADDRESS, _addr )
135 #define out_8(_addr,_val) pci_out_8( BSP_PCI_BASE_ADDRESS, _addr, _val )
136 #define out_le16(_addr,_val) pci_out_le16( BSP_PCI_BASE_ADDRESS, _addr, _val )
137 #define out_16(_addr,_val) pci_out_16( BSP_PCI_BASE_ADDRESS, _addr, _val )
138 
139 #endif /* BSP_PCI_H */
Definition: pci.h:40
Definition: pci.h:1123
Definition: pci.h:36
Definition: pci.h:45