1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
//
// Hal specific PCI bus structures
//
#define PCI_MAX_LOCAL_DEVICE 7
#define PCI_MAX_BUS_NUMBER 31
#define PCI_MAX_IO_ADDRESS 0x1FFFFFFF // (PCI_IO_PHYSICAL_BASE + 0x1FFFFFFF)
#define PCI_MAX_MEMORY_ADDRESS 0x1FFFFFFF //(PCI_MEMORY_PHYSICAL_BASE + 0x1FFFFFFF)
#define PCI_MAX_SPARSE_MEMORY_ADDRESS PCI_MAX_MEMORY_ADDRESS
#define PCI_MIN_DENSE_MEMORY_ADDRESS PCI_MEMORY_PHYSICAL_BASE
#define PCI_MAX_DENSE_MEMORY_ADDRESS PCI_MAX_MEMORY_ADDRESS
#define PCI_MAX_INTERRUPT_VECTOR 0xF
//
// Values used to index both the
// HalpPciConfigSelectDecodeTable[]
// and HalpPCIPinToLineTable[].
//
#define PCI_ISA_DEVICE_NUMBER 0
#define PCI_OBENET_DEVICE_NUMBER 1
#define PCI_OBSCSI_DEVICE_NUMBER 2
#define PCI_VID_DEVICE_NUMBER 3
#define PCI_SLOT0_DEVICE_NUMBER 4
#define PCI_SLOT1_DEVICE_NUMBER 5
#define PCI_SLOT2_DEVICE_NUMBER 6
#define PCI_PMP_DEVICE_NUMBER 7
//
// Define PCI slot validity
//
typedef enum _VALID_SLOT {
InvalidBus = 0,
InvalidSlot,
ValidSlot
} VALID_SLOT;
//
// New data structures for Hal Bus Extender API
//
typedef NTSTATUS
(*PciIrqRange) (
IN PBUS_HANDLER BusHandler,
IN PBUS_HANDLER RootHandler,
IN PCI_SLOT_NUMBER PciSlot,
OUT PSUPPORTED_RANGE *Interrupt
);
typedef struct tagPCIPBUSDATA {
//
// Defined PCI data
//
PCIBUSDATA CommonData;
//
// Implementation specific data
//
union {
struct {
PULONG Address;
ULONG Data;
} Type1;
struct {
PUCHAR CSE;
PUCHAR Forward;
ULONG Base;
} Type2;
} Config;
ULONG MaxDevice;
PciIrqRange GetIrqRange;
BOOLEAN BridgeConfigRead;
UCHAR ParentBus;
UCHAR reserved[2];
UCHAR SwizzleIn[4];
RTL_BITMAP DeviceConfigured;
ULONG ConfiguredBits[PCI_MAX_DEVICES * PCI_MAX_FUNCTION / 32];
} PCIPBUSDATA, *PPCIPBUSDATA;
//
// Macro used to determin if Type 0 or Type 1
// device
//
#define PCI_CONFIG_TYPE(PciData) ((PciData)->HeaderType & ~PCI_MULTIFUNCTION)
//
// Define PciConfigAddr register structure
//
typedef struct _PCI_CONFIG_ADDR {
ULONG Type : 1;
ULONG Reserved2 : 7;
ULONG FunctionNumber : 3;
ULONG DeviceNumber : 5;
ULONG BusNumber : 8;
ULONG Reserved1 : 8;
} PCI_CONFIG_ADDR, *PPCI_CONFIG_ADDR;
//
// Define PCI configuration cycle types.
//
typedef enum _PCI_CONFIGURATION_TYPES {
PciConfigTypeInvalid = -1,
PciConfigType0 = 0,
PciConfigType1 = 1
} PCI_CONFIGURATION_TYPES, *PPCI_CONFIGURATION_TYPES;
//
// Define PCI cycle/command types.
//
typedef enum _PCI_COMMAND_TYPES{
PciCommandInterruptAcknowledge = 0x0,
PciCommandSpecialCycle = 0x1,
PciCommandIoRead = 0x2,
PciCommandIoWrite = 0x3,
PciCommandMemoryRead = 0x6,
PciCommandMemoryWrite = 0x7,
PciCommandConfigurationRead = 0xa,
PciCommandConfigurationWrite = 0xb,
PciCommandMemoryReadMultiple = 0xc,
PciCommandDualAddressCycle = 0xd,
PciCommandMemoryReadLine = 0xe,
PciCommandMemoryWriteAndInvalidate = 0xf,
MaximumPciCommand
} PCI_COMMAND_TYPES, *PPCI_COMMAND_TYPES;
//
// PCI platform-specific functions
//
|