SecurityPkg: Tcg2Dxe: Report correct FinalEventLog size
[mirror_edk2.git] / Omap35xxPkg / PciEmulation / PciEmulation.h
CommitLineData
a3f98646 1/** @file\r
2\r
3d70643b 3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
a3f98646 4\r
3d70643b 5 This program and the accompanying materials\r
a3f98646 6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _PCI_ROOT_BRIDGE_H_\r
16#define _PCI_ROOT_BRIDGE_H_\r
17\r
18#include <PiDxe.h>\r
19\r
20#include <TPS65950.h>\r
21\r
22#include <Library/BaseLib.h>\r
23#include <Library/BaseMemoryLib.h>\r
24#include <Library/DebugLib.h>\r
25#include <Library/DxeServicesTableLib.h>\r
26#include <Library/IoLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
28#include <Library/PciLib.h>\r
29#include <Library/UefiLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
7f814ffd 31#include <Library/OmapDmaLib.h>\r
81bc205d 32#include <Library/DmaLib.h>\r
a3f98646 33\r
34#include <Protocol/EmbeddedExternalDevice.h>\r
a3f98646 35#include <Protocol/DevicePath.h>\r
36#include <Protocol/PciIo.h>\r
37#include <Protocol/PciRootBridgeIo.h>\r
38#include <Protocol/PciHostBridgeResourceAllocation.h>\r
39\r
40#include <IndustryStandard/Pci22.h>\r
41#include <IndustryStandard/Acpi.h>\r
42\r
1e57a462 43#include <Omap3530/Omap3530.h>\r
7f814ffd 44\r
45\r
a3f98646 46\r
47#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL\r
48#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL\r
49#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL\r
50\r
51\r
52typedef struct {\r
53 ACPI_HID_DEVICE_PATH AcpiDevicePath;\r
54 EFI_DEVICE_PATH_PROTOCOL EndDevicePath;\r
55} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;\r
56\r
57\r
58#define ACPI_CONFIG_IO 0\r
59#define ACPI_CONFIG_MMIO 1\r
60#define ACPI_CONFIG_BUS 2\r
61\r
62typedef struct {\r
63 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR Desc[3];\r
64 EFI_ACPI_END_TAG_DESCRIPTOR EndDesc;\r
65} ACPI_CONFIG_INFO;\r
66\r
67\r
68#define PCI_ROOT_BRIDGE_SIGNATURE SIGNATURE_32 ('P', 'c', 'i', 'F')\r
69\r
70typedef struct {\r
71 UINT32 Signature;\r
72 EFI_HANDLE Handle;\r
73 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;\r
74 EFI_PCI_ROOT_BRIDGE_DEVICE_PATH DevicePath;\r
3402aac7 75\r
a3f98646 76 UINT8 StartBus;\r
77 UINT8 EndBus;\r
78 UINT16 Type;\r
79 UINT32 MemoryStart;\r
80 UINT32 MemorySize;\r
81 UINTN IoOffset;\r
82 UINT32 IoStart;\r
83 UINT32 IoSize;\r
3402aac7 84 UINT64 PciAttributes;\r
a3f98646 85\r
86 ACPI_CONFIG_INFO *Config;\r
87\r
88} PCI_ROOT_BRIDGE;\r
89\r
90\r
91#define INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(a) CR (a, PCI_ROOT_BRIDGE, Io, PCI_ROOT_BRIDGE_SIGNATURE)\r
92\r
93\r
94typedef union {\r
95 UINT8 volatile *buf;\r
96 UINT8 volatile *ui8;\r
97 UINT16 volatile *ui16;\r
98 UINT32 volatile *ui32;\r
99 UINT64 volatile *ui64;\r
100 UINTN volatile ui;\r
101} PTR;\r
102\r
103\r
a3f98646 104\r
105EFI_STATUS\r
106EFIAPI\r
3402aac7 107PciRootBridgeIoPollMem (\r
a3f98646 108 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
109 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
110 IN UINT64 Address,\r
111 IN UINT64 Mask,\r
112 IN UINT64 Value,\r
113 IN UINT64 Delay,\r
114 OUT UINT64 *Result\r
115 );\r
3402aac7 116\r
a3f98646 117EFI_STATUS\r
118EFIAPI\r
3402aac7 119PciRootBridgeIoPollIo (\r
a3f98646 120 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
121 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
122 IN UINT64 Address,\r
123 IN UINT64 Mask,\r
124 IN UINT64 Value,\r
125 IN UINT64 Delay,\r
126 OUT UINT64 *Result\r
127 );\r
3402aac7 128\r
a3f98646 129EFI_STATUS\r
130EFIAPI\r
131PciRootBridgeIoMemRead (\r
132 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
133 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
134 IN UINT64 Address,\r
135 IN UINTN Count,\r
136 IN OUT VOID *Buffer\r
137 );\r
138\r
139EFI_STATUS\r
140EFIAPI\r
141PciRootBridgeIoMemWrite (\r
142 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
143 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
144 IN UINT64 Address,\r
145 IN UINTN Count,\r
146 IN OUT VOID *Buffer\r
147 );\r
148\r
149EFI_STATUS\r
150EFIAPI\r
151PciRootBridgeIoIoRead (\r
152 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
153 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
154 IN UINT64 UserAddress,\r
155 IN UINTN Count,\r
156 IN OUT VOID *UserBuffer\r
157 );\r
158\r
159EFI_STATUS\r
160EFIAPI\r
161PciRootBridgeIoIoWrite (\r
162 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
163 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
164 IN UINT64 UserAddress,\r
165 IN UINTN Count,\r
166 IN OUT VOID *UserBuffer\r
167 );\r
168\r
169EFI_STATUS\r
170EFIAPI\r
171PciRootBridgeIoCopyMem (\r
172 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
173 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
174 IN UINT64 DestAddress,\r
175 IN UINT64 SrcAddress,\r
176 IN UINTN Count\r
177 );\r
178\r
179EFI_STATUS\r
180EFIAPI\r
181PciRootBridgeIoPciRead (\r
182 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
183 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
184 IN UINT64 Address,\r
185 IN UINTN Count,\r
186 IN OUT VOID *Buffer\r
187 );\r
188\r
189EFI_STATUS\r
190EFIAPI\r
191PciRootBridgeIoPciWrite (\r
192 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
193 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
194 IN UINT64 Address,\r
195 IN UINTN Count,\r
196 IN OUT VOID *Buffer\r
197 );\r
198\r
199EFI_STATUS\r
200EFIAPI\r
201PciRootBridgeIoMap (\r
202 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
203 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,\r
204 IN VOID *HostAddress,\r
205 IN OUT UINTN *NumberOfBytes,\r
206 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
207 OUT VOID **Mapping\r
208 );\r
209\r
210EFI_STATUS\r
211EFIAPI\r
212PciRootBridgeIoUnmap (\r
213 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
214 IN VOID *Mapping\r
215 );\r
216\r
217EFI_STATUS\r
218EFIAPI\r
219PciRootBridgeIoAllocateBuffer (\r
220 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
221 IN EFI_ALLOCATE_TYPE Type,\r
222 IN EFI_MEMORY_TYPE MemoryType,\r
223 IN UINTN Pages,\r
224 OUT VOID **HostAddress,\r
225 IN UINT64 Attributes\r
226 );\r
227\r
228EFI_STATUS\r
229EFIAPI\r
230PciRootBridgeIoFreeBuffer (\r
231 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
232 IN UINTN Pages,\r
233 OUT VOID *HostAddress\r
234 );\r
235\r
236EFI_STATUS\r
237EFIAPI\r
238PciRootBridgeIoFlush (\r
239 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This\r
240 );\r
241\r
242EFI_STATUS\r
243EFIAPI\r
244PciRootBridgeIoGetAttributes (\r
245 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
246 OUT UINT64 *Supported,\r
247 OUT UINT64 *Attributes\r
248 );\r
249\r
250EFI_STATUS\r
251EFIAPI\r
252PciRootBridgeIoSetAttributes (\r
253 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
254 IN UINT64 Attributes,\r
255 IN OUT UINT64 *ResourceBase,\r
3402aac7
RC
256 IN OUT UINT64 *ResourceLength\r
257 );\r
a3f98646 258\r
259EFI_STATUS\r
260EFIAPI\r
261PciRootBridgeIoConfiguration (\r
262 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
263 OUT VOID **Resources\r
264 );\r
265\r
266//\r
267// Private Function Prototypes\r
268//\r
269EFI_STATUS\r
270EFIAPI\r
271PciRootBridgeIoMemRW (\r
272 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
273 IN UINTN Count,\r
274 IN BOOLEAN InStrideFlag,\r
275 IN PTR In,\r
276 IN BOOLEAN OutStrideFlag,\r
277 OUT PTR Out\r
278 );\r
279\r
280BOOLEAN\r
281PciIoMemAddressValid (\r
282 IN EFI_PCI_IO_PROTOCOL *This,\r
283 IN UINT64 Address\r
284 );\r
285\r
286EFI_STATUS\r
287EmulatePciIoForEhci (\r
288 INTN MvPciIfMaxIf\r
289 );\r
290\r
291#endif\r
292\r