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