]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/PciRootBridgeNoEnumerationDxe/PcatPciRootBridge.h
Remove use of 'VOLATILE'. Use 'volatile' instead.
[mirror_edk2.git] / DuetPkg / PciRootBridgeNoEnumerationDxe / PcatPciRootBridge.h
CommitLineData
c69dd9df 1/*++\r
2\r
3Copyright (c) 2005 - 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13 PcatPciRootBridge.h\r
14\r
15Abstract:\r
16\r
17 The driver for the host to pci bridge (root bridge).\r
18\r
19--*/\r
20\r
21#ifndef _PCAT_PCI_ROOT_BRIDGE_H_\r
22#define _PCAT_PCI_ROOT_BRIDGE_H_\r
23\r
24#include <PiDxe.h>\r
25#include <Protocol/PciRootBridgeIo.h>\r
26#include <Protocol/DeviceIo.h>\r
27#include <Protocol/CpuIo.h>\r
28\r
29#include <Library/UefiLib.h>\r
30#include <Library/BaseLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/DebugLib.h>\r
34#include <Library/BaseMemoryLib.h>\r
35#include <Library/DevicePathLib.h>\r
36#include <Library/HobLib.h>\r
37\r
38#include <Guid/PciOptionRomTable.h>\r
39#include <Guid/HobList.h>\r
40#include <Guid/PciExpressBaseAddress.h>\r
41\r
42#include <IndustryStandard/Acpi.h>\r
43#include <IndustryStandard/Pci.h>\r
44//\r
45// Driver Instance Data Prototypes\r
46//\r
47#define PCAT_PCI_ROOT_BRIDGE_SIGNATURE EFI_SIGNATURE_32('p', 'c', 'r', 'b')\r
48\r
49typedef struct {\r
50 UINT32 Signature;\r
51 EFI_HANDLE Handle;\r
52 \r
53 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
54 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;\r
55 EFI_CPU_IO_PROTOCOL *CpuIo;\r
56\r
57 UINT32 RootBridgeNumber;\r
58 UINT32 PrimaryBus;\r
59 UINT32 SubordinateBus;\r
60 \r
61 UINT64 MemBase; // Offsets host to bus memory addr.\r
62 UINT64 MemLimit; // Max allowable memory access\r
63 \r
64 UINT64 IoBase; // Offsets host to bus io addr.\r
65 UINT64 IoLimit; // Max allowable io access\r
66 \r
67 UINT64 PciAddress;\r
68 UINT64 PciData;\r
69 \r
70 UINT64 PhysicalMemoryBase;\r
71 UINT64 PhysicalIoBase;\r
72 \r
73 EFI_LOCK PciLock;\r
74 \r
75 UINT64 Attributes;\r
76 \r
77 UINT64 Mem32Base;\r
78 UINT64 Mem32Limit;\r
79 UINT64 Pmem32Base;\r
80 UINT64 Pmem32Limit;\r
81 UINT64 Mem64Base;\r
82 UINT64 Mem64Limit;\r
83 UINT64 Pmem64Base;\r
84 UINT64 Pmem64Limit;\r
85\r
86 UINT64 PciExpressBaseAddress;\r
87\r
88 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration;\r
89\r
90 LIST_ENTRY MapInfo;\r
91} PCAT_PCI_ROOT_BRIDGE_INSTANCE;\r
92\r
93//\r
94// Driver Instance Data Macros\r
95//\r
96#define DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(a) \\r
97 CR(a, PCAT_PCI_ROOT_BRIDGE_INSTANCE, Io, PCAT_PCI_ROOT_BRIDGE_SIGNATURE)\r
98\r
c69dd9df 99//\r
100// Private data types\r
101//\r
102typedef union {\r
e1cdd2eb 103 UINT8 volatile *buf;\r
104 UINT8 volatile *ui8;\r
105 UINT16 volatile *ui16;\r
106 UINT32 volatile *ui32;\r
107 UINT64 volatile *ui64;\r
108 UINTN volatile ui;\r
c69dd9df 109} PTR;\r
110\r
111typedef struct {\r
112 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation;\r
113 UINTN NumberOfBytes;\r
114 UINTN NumberOfPages;\r
115 EFI_PHYSICAL_ADDRESS HostAddress;\r
116 EFI_PHYSICAL_ADDRESS MappedHostAddress;\r
117} MAP_INFO;\r
118\r
119typedef struct {\r
120 LIST_ENTRY Link;\r
121 MAP_INFO * Map; \r
122} MAP_INFO_INSTANCE;\r
123\r
124typedef\r
125VOID\r
126(*EFI_PCI_BUS_SCAN_CALLBACK) (\r
127 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
128 UINT16 MinBus,\r
129 UINT16 MaxBus,\r
130 UINT16 MinDevice,\r
131 UINT16 MaxDevice,\r
132 UINT16 MinFunc,\r
133 UINT16 MaxFunc,\r
134 UINT16 Bus,\r
135 UINT16 Device,\r
136 UINT16 Func,\r
137 IN VOID *Context\r
138 );\r
139\r
140typedef struct {\r
141 UINT16 *CommandRegisterBuffer;\r
142 UINT32 PpbMemoryWindow; \r
143} PCAT_PCI_ROOT_BRIDGE_SCAN_FOR_ROM_CONTEXT;\r
144\r
8ad48840 145typedef struct {\r
146 UINT8 Register;\r
147 UINT8 Function;\r
148 UINT8 Device;\r
149 UINT8 Bus;\r
150 UINT8 Reserved[4];\r
151} DEFIO_PCI_ADDR;\r
152\r
c69dd9df 153//\r
154// Driver Protocol Constructor Prototypes\r
155//\r
156EFI_STATUS \r
157ConstructConfiguration(\r
158 IN OUT PCAT_PCI_ROOT_BRIDGE_INSTANCE *PrivateData\r
159 );\r
160\r
161EFI_STATUS\r
162PcatPciRootBridgeParseBars (\r
163 IN PCAT_PCI_ROOT_BRIDGE_INSTANCE *PrivateData,\r
164 IN UINT16 Command,\r
165 IN UINTN Bus,\r
166 IN UINTN Device,\r
167 IN UINTN Function\r
168 );\r
169\r
170EFI_STATUS\r
171ScanPciRootBridgeForRoms(\r
172 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
173 );\r
174\r
175EFI_STATUS\r
176PcatRootBridgeDevicePathConstructor (\r
177 IN EFI_DEVICE_PATH_PROTOCOL **Protocol,\r
178 IN UINTN RootBridgeNumber,\r
179 IN BOOLEAN IsPciExpress\r
180 );\r
181\r
182EFI_STATUS\r
183PcatRootBridgeIoConstructor (\r
184 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol,\r
185 IN UINTN SegmentNumber\r
186 );\r
187\r
188EFI_STATUS\r
189PcatRootBridgeIoGetIoPortMapping (\r
190 OUT EFI_PHYSICAL_ADDRESS *IoPortMapping,\r
191 OUT EFI_PHYSICAL_ADDRESS *MemoryPortMapping\r
192 );\r
193\r
194EFI_STATUS\r
195PcatRootBridgeIoPciRW (\r
196 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
197 IN BOOLEAN Write,\r
198 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
199 IN UINT64 UserAddress,\r
200 IN UINTN Count,\r
201 IN OUT VOID *UserBuffer\r
202 );\r
203\r
204UINT64\r
205GetPciExpressBaseAddressForRootBridge (\r
206 IN UINTN HostBridgeNumber,\r
207 IN UINTN RootBridgeNumber\r
208 );\r
209\r
210//\r
211// Driver entry point prototype\r
212//\r
213EFI_STATUS\r
214EFIAPI\r
215InitializePcatPciRootBridge (\r
216 IN EFI_HANDLE ImageHandle,\r
217 IN EFI_SYSTEM_TABLE *SystemTable\r
218 );\r
219\r
220extern EFI_CPU_IO_PROTOCOL *gCpuIo;\r
221\r
222#endif\r