File indexing completed on 2025-05-11 08:23:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef BSP_PCI_H
0030 #define BSP_PCI_H
0031
0032 #include <rtems/pci.h>
0033 #include <bsp.h>
0034 #include <stdio.h>
0035
0036 struct _pin_routes
0037 {
0038 int pin, int_name[4];
0039 };
0040 struct _int_map
0041 {
0042 int bus, slot, opts;
0043 struct _pin_routes pin_route[5];
0044 };
0045 struct pcibridge
0046 {
0047 int bus;
0048 int slot;
0049 };
0050
0051
0052
0053
0054
0055 #define PCI_FIXUP_OPT_OVERRIDE_NAME (1<<0)
0056
0057 void FixupPCI( const struct _int_map *, int (*swizzler)(int,int) );
0058
0059
0060 extern unsigned char pci_bus_count(void);
0061
0062 int indirect_pci_read_config_byte(
0063 unsigned char bus,
0064 unsigned char slot,
0065 unsigned char function,
0066 unsigned char offset,
0067 uint8_t *val
0068 );
0069
0070 int indirect_pci_read_config_word(
0071 unsigned char bus,
0072 unsigned char slot,
0073 unsigned char function,
0074 unsigned char offset,
0075 uint16_t *val
0076 );
0077
0078 int indirect_pci_read_config_dword(
0079 unsigned char bus,
0080 unsigned char slot,
0081 unsigned char function,
0082 unsigned char offset,
0083 uint32_t *val
0084 );
0085
0086 int indirect_pci_write_config_byte(
0087 unsigned char bus,
0088 unsigned char slot,
0089 unsigned char function,
0090 unsigned char offset,
0091 uint8_t val
0092 );
0093
0094 int indirect_pci_write_config_word(
0095 unsigned char bus,
0096 unsigned char slot,
0097 unsigned char function,
0098 unsigned char offset,
0099 uint16_t val
0100 );
0101
0102 int indirect_pci_write_config_dword(
0103 unsigned char bus,
0104 unsigned char slot,
0105 unsigned char function,
0106 unsigned char offset,
0107 uint32_t val
0108 );
0109
0110
0111 int FindPCIbridge( int mybus, struct pcibridge *pb );
0112
0113 extern const pci_config_access_functions pci_indirect_functions;
0114
0115 void pci_out_le32( uint32_t base, uint32_t addr, uint32_t val);
0116 void pci_out_32( uint32_t base, uint32_t addr, uint32_t val);
0117 uint8_t pci_in_8 ( uint32_t base, uint32_t addr );
0118 int16_t pci_in_le16 ( uint32_t base, uint32_t addr );
0119 uint32_t pci_in_le32 ( uint32_t base, uint32_t addr );
0120 int16_t pci_in_16 ( uint32_t base, uint32_t addr );
0121 uint32_t pci_in_32 ( uint32_t base, uint32_t addr );
0122 void pci_out_8 ( uint32_t base, uint32_t addr, uint8_t val );
0123 void pci_out_le16( uint32_t base, uint32_t addr, uint16_t val );
0124 void pci_out_16( uint32_t base, uint32_t addr, uint16_t val );
0125 void pci_out_32 ( uint32_t base, uint32_t addr, uint32_t val);
0126
0127 #define out_32(_addr, _val) pci_out_32(BSP_PCI_BASE_ADDRESS, _addr, _val)
0128 #define out_le32(_addr, _val) pci_out_le32(BSP_PCI_BASE_ADDRESS, _addr, _val)
0129 #define out_32(_addr, _val) pci_out_32(BSP_PCI_BASE_ADDRESS, _addr, _val)
0130 #define in_8(_addr) pci_in_8( BSP_PCI_BASE_ADDRESS, _addr )
0131 #define in_le16(_addr) pci_in_le16( BSP_PCI_BASE_ADDRESS, _addr )
0132 #define in_le32(_addr) pci_in_le32( BSP_PCI_BASE_ADDRESS, _addr )
0133 #define in_16(_addr) pci_in_16( BSP_PCI_BASE_ADDRESS, _addr )
0134 #define in_32(_addr) pci_in_32( BSP_PCI_BASE_ADDRESS, _addr )
0135 #define out_8(_addr,_val) pci_out_8( BSP_PCI_BASE_ADDRESS, _addr, _val )
0136 #define out_le16(_addr,_val) pci_out_le16( BSP_PCI_BASE_ADDRESS, _addr, _val )
0137 #define out_16(_addr,_val) pci_out_16( BSP_PCI_BASE_ADDRESS, _addr, _val )
0138
0139 #endif