]> git.proxmox.com Git - mirror_edk2.git/blob - OptionRomPkg/UndiRuntimeDxe/Undi32.h
Consume the UNDI_CONFIG_TABLE defined in MdePkg and remove the local definition of...
[mirror_edk2.git] / OptionRomPkg / UndiRuntimeDxe / Undi32.h
1 /** @file
2 EFI internal structures for the EFI UNDI driver.
3
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _UNDI_32_H_
16 #define _UNDI_32_H_
17
18 #include <Uefi.h>
19
20 #include <Guid/EventGroup.h>
21 #include <Protocol/PciIo.h>
22 #include <Protocol/NetworkInterfaceIdentifier.h>
23 #include <Protocol/DevicePath.h>
24
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/UefiRuntimeLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/BaseLib.h>
32 #include <Library/DevicePathLib.h>
33
34 #include <IndustryStandard/Pci.h>
35
36
37 #include "E100b.h"
38
39 #define MAX_NIC_INTERFACES 16
40
41 #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31 0x00010001
42 #define PXE_ROMID_MINORVER_31 0x10
43 #define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000
44
45 //
46 // UNDI_CALL_TABLE.state can have the following values
47 //
48 #define DONT_CHECK -1
49 #define ANY_STATE -1
50 #define MUST_BE_STARTED 1
51 #define MUST_BE_INITIALIZED 2
52
53 #define UNDI_DEV_SIGNATURE SIGNATURE_32('u','n','d','i')
54 #define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol_31, UNDI_DEV_SIGNATURE)
55 #define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
56
57 typedef struct {
58 UINTN Signature;
59 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;
60 EFI_HANDLE DeviceHandle;
61 EFI_DEVICE_PATH_PROTOCOL *Undi32BaseDevPath;
62 EFI_DEVICE_PATH_PROTOCOL *Undi32DevPath;
63 NIC_DATA_INSTANCE NicInfo;
64 } UNDI32_DEV;
65
66 typedef struct {
67 UINT16 cpbsize;
68 UINT16 dbsize;
69 UINT16 opflags;
70 UINT16 state;
71 VOID (*api_ptr)();
72 } UNDI_CALL_TABLE;
73
74 typedef VOID (*ptr)(VOID);
75 typedef VOID (*bsptr_30)(UINTN);
76 typedef VOID (*virtphys_30)(UINT64, UINT64);
77 typedef VOID (*block_30)(UINT32);
78 typedef VOID (*mem_io_30)(UINT8, UINT8, UINT64, UINT64);
79
80 typedef VOID (*bsptr)(UINT64, UINTN);
81 typedef VOID (*virtphys)(UINT64, UINT64, UINT64);
82 typedef VOID (*block)(UINT64, UINT32);
83 typedef VOID (*mem_io)(UINT64, UINT8, UINT8, UINT64, UINT64);
84
85 typedef VOID (*map_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
86 typedef VOID (*unmap_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
87 typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
88
89 extern UNDI_CALL_TABLE api_table[];
90 extern PXE_SW_UNDI *pxe_31; // !pxe structure for 3.1 drivers
91 extern UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];
92
93 //
94 // functions defined in e100b.c
95 //
96 UINT8 InByte (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
97 UINT16 InWord (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
98 UINT32 InLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
99 VOID OutByte (NIC_DATA_INSTANCE *AdapterInfo, UINT8 Data, UINT32 Port);
100 VOID OutWord (NIC_DATA_INSTANCE *AdapterInfo, UINT16 Data, UINT32 Port);
101 VOID OutLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Data, UINT32 Port);
102
103 UINTN E100bInit (NIC_DATA_INSTANCE *AdapterInfo);
104 UINTN E100bReset (NIC_DATA_INSTANCE *AdapterInfo, INT32 OpFlags);
105 UINTN E100bShutdown (NIC_DATA_INSTANCE *AdapterInfo);
106 UINTN E100bTransmit (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT16 opflags);
107 UINTN E100bReceive (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT64 db);
108 UINTN E100bSetfilter (NIC_DATA_INSTANCE *AdapterInfo, UINT16 New_filter,
109 UINT64 cpb, UINT32 cpbsize);
110 UINTN E100bStatistics(NIC_DATA_INSTANCE *AdapterInfo, UINT64 db, UINT16 dbsize);
111 UINT8 E100bSetupIAAddr (NIC_DATA_INSTANCE *AdapterInfo);
112 UINT8 E100bSetInterruptState (NIC_DATA_INSTANCE *AdapterInfo);
113
114 UINT8 E100bGetEepromAddrLen (NIC_DATA_INSTANCE *AdapterInfo);
115 UINT16 E100bReadEeprom (NIC_DATA_INSTANCE *AdapterInfo, INT32 Location, UINT8 address_len);
116 INT16 E100bReadEepromAndStationAddress (NIC_DATA_INSTANCE *AdapterInfo);
117
118 UINT16 next(UINT16);
119 UINT8 SetupCBlink (NIC_DATA_INSTANCE *AdapterInfo);
120 VOID SetFreeCB (NIC_DATA_INSTANCE *AdapterInfo,TxCB *);
121 TxCB *GetFreeCB (NIC_DATA_INSTANCE *AdapterInfo);
122 UINT16 CheckCBList (NIC_DATA_INSTANCE *AdapterInfo);
123
124 UINT8 SelectiveReset (NIC_DATA_INSTANCE *AdapterInfo);
125 UINT16 InitializeChip (NIC_DATA_INSTANCE *AdapterInfo);
126 UINT8 SetupReceiveQueues (NIC_DATA_INSTANCE *AdapterInfo);
127 VOID Recycle_RFD (NIC_DATA_INSTANCE *AdapterInfo, UINT16);
128 VOID XmitWaitForCompletion (NIC_DATA_INSTANCE *AdapterInfo);
129 INT8 CommandWaitForCompletion (TxCB *cmd_ptr, NIC_DATA_INSTANCE *AdapterInfo);
130
131 BOOLEAN PhyDetect (NIC_DATA_INSTANCE *AdapterInfo);
132 VOID PhyReset (NIC_DATA_INSTANCE *AdapterInfo);
133 VOID
134 MdiWrite (
135 IN NIC_DATA_INSTANCE *AdapterInfo,
136 IN UINT8 RegAddress,
137 IN UINT8 PhyAddress,
138 IN UINT16 DataValue
139 );
140
141 VOID
142 MdiRead(
143 IN NIC_DATA_INSTANCE *AdapterInfo,
144 IN UINT8 RegAddress,
145 IN UINT8 PhyAddress,
146 IN OUT UINT16 *DataValue
147 );
148
149 BOOLEAN SetupPhy (NIC_DATA_INSTANCE *AdapterInfo);
150 VOID FindPhySpeedAndDpx (NIC_DATA_INSTANCE *AdapterInfo, UINT32 PhyId);
151
152
153
154 //
155 // functions defined in init.c
156 //
157 EFI_STATUS
158 InstallConfigTable (
159 IN VOID
160 );
161
162 EFI_STATUS
163 EFIAPI
164 InitializeUNDIDriver (
165 IN EFI_HANDLE ImageHandle,
166 IN EFI_SYSTEM_TABLE *SystemTable
167 );
168
169 VOID
170 UNDI_notify_virtual (
171 EFI_EVENT event,
172 VOID *context
173 );
174
175 VOID
176 EFIAPI
177 UndiNotifyExitBs (
178 EFI_EVENT Event,
179 VOID *Context
180 );
181
182 EFI_STATUS
183 EFIAPI
184 UndiDriverSupported (
185 IN EFI_DRIVER_BINDING_PROTOCOL *This,
186 IN EFI_HANDLE Controller,
187 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
188 );
189
190 EFI_STATUS
191 EFIAPI
192 UndiDriverStart (
193 IN EFI_DRIVER_BINDING_PROTOCOL *This,
194 IN EFI_HANDLE Controller,
195 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
196 );
197
198 EFI_STATUS
199 EFIAPI
200 UndiDriverStop (
201 IN EFI_DRIVER_BINDING_PROTOCOL *This,
202 IN EFI_HANDLE Controller,
203 IN UINTN NumberOfChildren,
204 IN EFI_HANDLE *ChildHandleBuffer
205 );
206
207 EFI_STATUS
208 AppendMac2DevPath (
209 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPtr,
210 IN EFI_DEVICE_PATH_PROTOCOL *BaseDevPtr,
211 IN NIC_DATA_INSTANCE *AdapterInfo
212 );
213
214 VOID
215 TmpDelay (
216 IN UINT64 UnqId,
217 IN UINTN MicroSeconds
218 );
219
220 VOID
221 TmpMemIo (
222 IN UINT64 UnqId,
223 IN UINT8 ReadWrite,
224 IN UINT8 Len,
225 IN UINT64 Port,
226 IN UINT64 BufAddr
227 );
228
229 //
230 // functions defined in decode.c
231 //
232 VOID
233 UNDI_GetState (
234 IN PXE_CDB *CdbPtr,
235 IN NIC_DATA_INSTANCE *AdapterInfo
236 );
237
238 VOID
239 UNDI_Start (
240 IN PXE_CDB *CdbPtr,
241 IN NIC_DATA_INSTANCE *AdapterInfo
242 );
243
244 VOID
245 UNDI_Stop (
246 IN PXE_CDB *CdbPtr,
247 IN NIC_DATA_INSTANCE *AdapterInfo
248 );
249
250 VOID
251 UNDI_GetInitInfo (
252 IN PXE_CDB *CdbPtr,
253 IN NIC_DATA_INSTANCE *AdapterInfo
254 );
255
256 VOID
257 UNDI_GetConfigInfo (
258 IN PXE_CDB *CdbPtr,
259 IN NIC_DATA_INSTANCE *AdapterInfo
260 );
261
262 VOID
263 UNDI_Initialize (
264 IN PXE_CDB *CdbPtr,
265 NIC_DATA_INSTANCE *AdapterInfo
266 );
267
268 VOID
269 UNDI_Reset (
270 IN PXE_CDB *CdbPtr,
271 IN NIC_DATA_INSTANCE *AdapterInfo
272 );
273
274 VOID
275 UNDI_Shutdown (
276 IN PXE_CDB *CdbPtr,
277 IN NIC_DATA_INSTANCE *AdapterInfo
278 );
279
280 VOID
281 UNDI_Interrupt (
282 IN PXE_CDB *CdbPtr,
283 IN NIC_DATA_INSTANCE *AdapterInfo
284 );
285
286 VOID
287 UNDI_RecFilter (
288 IN PXE_CDB *CdbPtr,
289 IN NIC_DATA_INSTANCE *AdapterInfo
290 );
291
292 VOID
293 UNDI_StnAddr (
294 IN PXE_CDB *CdbPtr,
295 IN NIC_DATA_INSTANCE *AdapterInfo
296 );
297
298 VOID
299 UNDI_Statistics (
300 IN PXE_CDB *CdbPtr,
301 IN NIC_DATA_INSTANCE *AdapterInfo
302 );
303
304 VOID
305 UNDI_ip2mac (
306 IN PXE_CDB *CdbPtr,
307 IN NIC_DATA_INSTANCE *AdapterInfo
308 );
309
310 VOID
311 UNDI_NVData (
312 IN PXE_CDB *CdbPtr,
313 IN NIC_DATA_INSTANCE *AdapterInfo
314 );
315
316 VOID
317 UNDI_Status (
318 IN PXE_CDB *CdbPtr,
319 IN NIC_DATA_INSTANCE *AdapterInfo
320 );
321
322 VOID
323 UNDI_FillHeader (
324 IN PXE_CDB *CdbPtr,
325 IN NIC_DATA_INSTANCE *AdapterInfo
326 );
327
328 VOID
329 UNDI_Transmit (
330 IN PXE_CDB *CdbPtr,
331 IN NIC_DATA_INSTANCE *AdapterInfo
332 );
333
334 VOID
335 UNDI_Receive (
336 IN PXE_CDB *CdbPtr,
337 IN NIC_DATA_INSTANCE *AdapterInfo
338 );
339
340 VOID UNDI_APIEntry_new(UINT64);
341 VOID UNDI_APIEntry_Common(UINT64);
342
343 PXE_IPV4 convert_mcip(PXE_MAC_ADDR *);
344 INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);
345
346 VOID PxeStructInit (PXE_SW_UNDI *PxePtr);
347 VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);
348
349 #endif