Check in patch to refine DevicePath Module and USB2HostController Module.
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / Undi / RuntimeDxe / Undi32.h
CommitLineData
878ddf1f 1\r
2/*++\r
3\r
abf537ea 4Copyright (c) 2006, Intel Corporation.\r
878ddf1f 5All rights reserved. This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13Module Name:\r
14\r
15 undi32.h\r
16\r
17Abstract:\r
18\r
19 EFI internal structures for the EFI UNDI driver\r
20\r
21\r
22\r
23Revision History\r
24\r
25--*/\r
26\r
27#ifndef _UNDI_32_H_\r
28#define _UNDI_32_H_\r
29\r
30\r
31#include "E100b.h"\r
f0ec738d 32#include <IndustryStandard/pci22.h>\r
878ddf1f 33\r
34#define MAX_NIC_INTERFACES 16\r
35\r
36#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31 0x00010001\r
37#define PXE_ROMID_MINORVER_31 0x10\r
38#define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000\r
39\r
40//\r
41// UNDI_CALL_TABLE.state can have the following values\r
42//\r
43#define DONT_CHECK -1\r
44#define ANY_STATE -1\r
45#define MUST_BE_STARTED 1\r
46#define MUST_BE_INITIALIZED 2\r
47\r
48#define UNDI_DEV_SIGNATURE EFI_SIGNATURE_32('u','n','d','i')\r
49#define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol, UNDI_DEV_SIGNATURE)\r
50#define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)\r
51\r
52typedef struct {\r
53 UINTN Signature;\r
54 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol;\r
55 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;\r
56 EFI_HANDLE DeviceHandle;\r
57 EFI_DEVICE_PATH_PROTOCOL *Undi32BaseDevPath;\r
58 EFI_DEVICE_PATH_PROTOCOL *Undi32DevPath;\r
59 NIC_DATA_INSTANCE NicInfo;\r
60} UNDI32_DEV;\r
61\r
62typedef struct {\r
63 UINT16 cpbsize;\r
64 UINT16 dbsize;\r
65 UINT16 opflags;\r
66 UINT16 state;\r
67 VOID (*api_ptr)();\r
68} UNDI_CALL_TABLE;\r
69\r
70typedef struct {\r
71 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *InterfacePointer;\r
72 EFI_DEVICE_PATH_PROTOCOL *DevicePathPointer;\r
73} NII_ENTRY;\r
74\r
75typedef struct NII_CONFIG_ENTRY {\r
76 UINT32 NumEntries;\r
77 UINT32 Reserved; // padding for alignment\r
78 struct NII_CONFIG_ENTRY *NextLink;\r
79 NII_ENTRY NiiEntry[1];\r
80} NII_TABLE;\r
81\r
82typedef VOID (*ptr)(VOID);\r
83typedef VOID (*bsptr_30)(UINTN);\r
84typedef VOID (*virtphys_30)(UINT64, UINT64);\r
85typedef VOID (*block_30)(UINT32);\r
86typedef VOID (*mem_io_30)(UINT8, UINT8, UINT64, UINT64);\r
87\r
88typedef VOID (*bsptr)(UINT64, UINTN);\r
89typedef VOID (*virtphys)(UINT64, UINT64, UINT64);\r
90typedef VOID (*block)(UINT64, UINT32);\r
91typedef VOID (*mem_io)(UINT64, UINT8, UINT8, UINT64, UINT64);\r
92\r
93typedef VOID (*map_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);\r
94typedef VOID (*unmap_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);\r
95typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);\r
96\r
97//\r
98// functions defined in e100b.c\r
99//\r
100UINT8 InByte (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);\r
101UINT16 InWord (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);\r
102UINT32 InLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);\r
103VOID OutByte (NIC_DATA_INSTANCE *AdapterInfo, UINT8 Data, UINT32 Port);\r
104VOID OutWord (NIC_DATA_INSTANCE *AdapterInfo, UINT16 Data, UINT32 Port);\r
105VOID OutLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Data, UINT32 Port);\r
106\r
107UINTN E100bInit (NIC_DATA_INSTANCE *AdapterInfo);\r
108UINTN E100bReset (NIC_DATA_INSTANCE *AdapterInfo, INT32 OpFlags);\r
109UINTN E100bShutdown (NIC_DATA_INSTANCE *AdapterInfo);\r
110UINTN E100bTransmit (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT16 opflags);\r
111UINTN E100bReceive (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT64 db);\r
112UINTN E100bSetfilter (NIC_DATA_INSTANCE *AdapterInfo, UINT16 New_filter,\r
113 UINT64 cpb, UINT32 cpbsize);\r
114UINTN E100bStatistics(NIC_DATA_INSTANCE *AdapterInfo, UINT64 db, UINT16 dbsize);\r
115UINT8 E100bSetupIAAddr (NIC_DATA_INSTANCE *AdapterInfo);\r
116UINT8 E100bSetInterruptState (NIC_DATA_INSTANCE *AdapterInfo);\r
117\r
118UINT8 E100bGetEepromAddrLen (NIC_DATA_INSTANCE *AdapterInfo);\r
119UINT16 E100bReadEeprom (NIC_DATA_INSTANCE *AdapterInfo, INT32 Location, UINT8 address_len);\r
120INT16 E100bReadEepromAndStationAddress (NIC_DATA_INSTANCE *AdapterInfo);\r
121\r
122UINT16 next(UINT16);\r
123UINT8 SetupCBlink (NIC_DATA_INSTANCE *AdapterInfo);\r
124VOID SetFreeCB (NIC_DATA_INSTANCE *AdapterInfo,TxCB *);\r
125TxCB *GetFreeCB (NIC_DATA_INSTANCE *AdapterInfo);\r
126UINT16 CheckCBList (NIC_DATA_INSTANCE *AdapterInfo);\r
127\r
128UINT8 SelectiveReset (NIC_DATA_INSTANCE *AdapterInfo);\r
129UINT16 InitializeChip (NIC_DATA_INSTANCE *AdapterInfo);\r
130UINT8 SetupReceiveQueues (NIC_DATA_INSTANCE *AdapterInfo);\r
131VOID Recycle_RFD (NIC_DATA_INSTANCE *AdapterInfo, UINT16);\r
132VOID XmitWaitForCompletion (NIC_DATA_INSTANCE *AdapterInfo);\r
133INT8 CommandWaitForCompletion (TxCB *cmd_ptr, NIC_DATA_INSTANCE *AdapterInfo);\r
134\r
135BOOLEAN PhyDetect (NIC_DATA_INSTANCE *AdapterInfo);\r
136VOID PhyReset (NIC_DATA_INSTANCE *AdapterInfo);\r
137VOID\r
138MdiWrite (\r
139 IN NIC_DATA_INSTANCE *AdapterInfo,\r
140 IN UINT8 RegAddress, \r
141 IN UINT8 PhyAddress,\r
142 IN UINT16 DataValue\r
143 );\r
144\r
145VOID\r
146MdiRead(\r
147 IN NIC_DATA_INSTANCE *AdapterInfo,\r
148 IN UINT8 RegAddress, \r
149 IN UINT8 PhyAddress,\r
150 IN OUT UINT16 *DataValue\r
151 );\r
152\r
153BOOLEAN SetupPhy (NIC_DATA_INSTANCE *AdapterInfo);\r
154VOID FindPhySpeedAndDpx (NIC_DATA_INSTANCE *AdapterInfo, UINT32 PhyId);\r
155\r
156\r
157\r
158//\r
159// functions defined in init.c\r
160//\r
161VOID\r
162TmpDelay (\r
163 IN UINT64 UnqId,\r
164 IN UINTN MicroSeconds\r
165 );\r
166\r
167VOID\r
168TmpMemIo (\r
169 IN UINT64 UnqId,\r
170 IN UINT8 ReadWrite,\r
171 IN UINT8 Len,\r
172 IN UINT64 Port,\r
173 IN UINT64 BufAddr\r
174 );\r
175\r
176//\r
177// functions defined in decode.c\r
178//\r
179VOID UNDI_GetState();\r
180VOID UNDI_Start();\r
181VOID UNDI_Stop();\r
182VOID UNDI_GetInitInfo();\r
183VOID UNDI_GetConfigInfo();\r
184VOID UNDI_Initialize();\r
185VOID UNDI_Reset();\r
186VOID UNDI_Shutdown();\r
187VOID UNDI_Interrupt();\r
188VOID UNDI_RecFilter();\r
189VOID UNDI_StnAddr();\r
190VOID UNDI_Statistics();\r
191VOID UNDI_ip2mac();\r
192VOID UNDI_NVData();\r
193VOID UNDI_Status();\r
194VOID UNDI_FillHeader();\r
195VOID UNDI_Transmit();\r
196VOID UNDI_Receive();\r
197\r
198VOID UNDI_APIEntry_new(UINT64);\r
199VOID UNDI_APIEntry_old(UINT64);\r
200VOID UNDI_APIEntry_Common(UINT64);\r
201\r
202PXE_IPV4 convert_mcip(PXE_MAC_ADDR *);\r
203INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);\r
204\r
205VOID PxeStructInit (PXE_SW_UNDI *PxePtr, UINTN VersionFlag);\r
206VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);\r
207\r
208#endif\r