]> git.proxmox.com Git - mirror_edk2.git/blame - Omap35xxPkg/PciEmulation/PciEmulation.h
NullDmaLib:DmaMap() function needs to return valid DeviceAddress.
[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
a3f98646 32\r
33#include <Protocol/EmbeddedExternalDevice.h>\r
a3f98646 34#include <Protocol/DevicePath.h>\r
35#include <Protocol/PciIo.h>\r
36#include <Protocol/PciRootBridgeIo.h>\r
37#include <Protocol/PciHostBridgeResourceAllocation.h>\r
38\r
39#include <IndustryStandard/Pci22.h>\r
40#include <IndustryStandard/Acpi.h>\r
41\r
7f814ffd 42#include <Omap3530/Omap3530.h>
43\r
44\r
a3f98646 45\r
46#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL\r
47#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL\r
48#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL\r
49\r
50\r
51typedef struct {\r
52 ACPI_HID_DEVICE_PATH AcpiDevicePath;\r
53 EFI_DEVICE_PATH_PROTOCOL EndDevicePath;\r
54} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;\r
55\r
56\r
57#define ACPI_CONFIG_IO 0\r
58#define ACPI_CONFIG_MMIO 1\r
59#define ACPI_CONFIG_BUS 2\r
60\r
61typedef struct {\r
62 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR Desc[3];\r
63 EFI_ACPI_END_TAG_DESCRIPTOR EndDesc;\r
64} ACPI_CONFIG_INFO;\r
65\r
66\r
67#define PCI_ROOT_BRIDGE_SIGNATURE SIGNATURE_32 ('P', 'c', 'i', 'F')\r
68\r
69typedef struct {\r
70 UINT32 Signature;\r
71 EFI_HANDLE Handle;\r
72 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;\r
73 EFI_PCI_ROOT_BRIDGE_DEVICE_PATH DevicePath;\r
74 \r
75 UINT8 StartBus;\r
76 UINT8 EndBus;\r
77 UINT16 Type;\r
78 UINT32 MemoryStart;\r
79 UINT32 MemorySize;\r
80 UINTN IoOffset;\r
81 UINT32 IoStart;\r
82 UINT32 IoSize;\r
83 UINT64 PciAttributes; \r
84\r
85 ACPI_CONFIG_INFO *Config;\r
86\r
87} PCI_ROOT_BRIDGE;\r
88\r
89\r
90#define INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(a) CR (a, PCI_ROOT_BRIDGE, Io, PCI_ROOT_BRIDGE_SIGNATURE)\r
91\r
92\r
93typedef union {\r
94 UINT8 volatile *buf;\r
95 UINT8 volatile *ui8;\r
96 UINT16 volatile *ui16;\r
97 UINT32 volatile *ui32;\r
98 UINT64 volatile *ui64;\r
99 UINTN volatile ui;\r
100} PTR;\r
101\r
102\r
a3f98646 103\r
104EFI_STATUS\r
105EFIAPI\r
106PciRootBridgeIoPollMem ( \r
107 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
108 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
109 IN UINT64 Address,\r
110 IN UINT64 Mask,\r
111 IN UINT64 Value,\r
112 IN UINT64 Delay,\r
113 OUT UINT64 *Result\r
114 );\r
115 \r
116EFI_STATUS\r
117EFIAPI\r
118PciRootBridgeIoPollIo ( \r
119 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
120 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
121 IN UINT64 Address,\r
122 IN UINT64 Mask,\r
123 IN UINT64 Value,\r
124 IN UINT64 Delay,\r
125 OUT UINT64 *Result\r
126 );\r
127 \r
128EFI_STATUS\r
129EFIAPI\r
130PciRootBridgeIoMemRead (\r
131 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
132 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
133 IN UINT64 Address,\r
134 IN UINTN Count,\r
135 IN OUT VOID *Buffer\r
136 );\r
137\r
138EFI_STATUS\r
139EFIAPI\r
140PciRootBridgeIoMemWrite (\r
141 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
142 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
143 IN UINT64 Address,\r
144 IN UINTN Count,\r
145 IN OUT VOID *Buffer\r
146 );\r
147\r
148EFI_STATUS\r
149EFIAPI\r
150PciRootBridgeIoIoRead (\r
151 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
152 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
153 IN UINT64 UserAddress,\r
154 IN UINTN Count,\r
155 IN OUT VOID *UserBuffer\r
156 );\r
157\r
158EFI_STATUS\r
159EFIAPI\r
160PciRootBridgeIoIoWrite (\r
161 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
162 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
163 IN UINT64 UserAddress,\r
164 IN UINTN Count,\r
165 IN OUT VOID *UserBuffer\r
166 );\r
167\r
168EFI_STATUS\r
169EFIAPI\r
170PciRootBridgeIoCopyMem (\r
171 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
172 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
173 IN UINT64 DestAddress,\r
174 IN UINT64 SrcAddress,\r
175 IN UINTN Count\r
176 );\r
177\r
178EFI_STATUS\r
179EFIAPI\r
180PciRootBridgeIoPciRead (\r
181 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
182 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
183 IN UINT64 Address,\r
184 IN UINTN Count,\r
185 IN OUT VOID *Buffer\r
186 );\r
187\r
188EFI_STATUS\r
189EFIAPI\r
190PciRootBridgeIoPciWrite (\r
191 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
192 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
193 IN UINT64 Address,\r
194 IN UINTN Count,\r
195 IN OUT VOID *Buffer\r
196 );\r
197\r
198EFI_STATUS\r
199EFIAPI\r
200PciRootBridgeIoMap (\r
201 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
202 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,\r
203 IN VOID *HostAddress,\r
204 IN OUT UINTN *NumberOfBytes,\r
205 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
206 OUT VOID **Mapping\r
207 );\r
208\r
209EFI_STATUS\r
210EFIAPI\r
211PciRootBridgeIoUnmap (\r
212 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
213 IN VOID *Mapping\r
214 );\r
215\r
216EFI_STATUS\r
217EFIAPI\r
218PciRootBridgeIoAllocateBuffer (\r
219 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
220 IN EFI_ALLOCATE_TYPE Type,\r
221 IN EFI_MEMORY_TYPE MemoryType,\r
222 IN UINTN Pages,\r
223 OUT VOID **HostAddress,\r
224 IN UINT64 Attributes\r
225 );\r
226\r
227EFI_STATUS\r
228EFIAPI\r
229PciRootBridgeIoFreeBuffer (\r
230 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
231 IN UINTN Pages,\r
232 OUT VOID *HostAddress\r
233 );\r
234\r
235EFI_STATUS\r
236EFIAPI\r
237PciRootBridgeIoFlush (\r
238 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This\r
239 );\r
240\r
241EFI_STATUS\r
242EFIAPI\r
243PciRootBridgeIoGetAttributes (\r
244 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
245 OUT UINT64 *Supported,\r
246 OUT UINT64 *Attributes\r
247 );\r
248\r
249EFI_STATUS\r
250EFIAPI\r
251PciRootBridgeIoSetAttributes (\r
252 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
253 IN UINT64 Attributes,\r
254 IN OUT UINT64 *ResourceBase,\r
255 IN OUT UINT64 *ResourceLength \r
256 ); \r
257\r
258EFI_STATUS\r
259EFIAPI\r
260PciRootBridgeIoConfiguration (\r
261 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
262 OUT VOID **Resources\r
263 );\r
264\r
265//\r
266// Private Function Prototypes\r
267//\r
268EFI_STATUS\r
269EFIAPI\r
270PciRootBridgeIoMemRW (\r
271 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
272 IN UINTN Count,\r
273 IN BOOLEAN InStrideFlag,\r
274 IN PTR In,\r
275 IN BOOLEAN OutStrideFlag,\r
276 OUT PTR Out\r
277 );\r
278\r
279BOOLEAN\r
280PciIoMemAddressValid (\r
281 IN EFI_PCI_IO_PROTOCOL *This,\r
282 IN UINT64 Address\r
283 );\r
284\r
285EFI_STATUS\r
286EmulatePciIoForEhci (\r
287 INTN MvPciIfMaxIf\r
288 );\r
289\r
290#endif\r
291\r