4 Copyright (c) 2004, Intel Corporation
5 All rights reserved. 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
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.
19 EFI internal structures for the EFI UNDI driver
32 #include <IndustryStandard/pci22.h>
34 #define MAX_NIC_INTERFACES 16
36 #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31 0x00010001
37 #define PXE_ROMID_MINORVER_31 0x10
38 #define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000
41 // UNDI_CALL_TABLE.state can have the following values
45 #define MUST_BE_STARTED 1
46 #define MUST_BE_INITIALIZED 2
48 #define UNDI_DEV_SIGNATURE EFI_SIGNATURE_32('u','n','d','i')
49 #define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol, UNDI_DEV_SIGNATURE)
50 #define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
54 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol
;
55 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31
;
56 EFI_HANDLE DeviceHandle
;
57 EFI_DEVICE_PATH_PROTOCOL
*Undi32BaseDevPath
;
58 EFI_DEVICE_PATH_PROTOCOL
*Undi32DevPath
;
59 NIC_DATA_INSTANCE NicInfo
;
71 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
*InterfacePointer
;
72 EFI_DEVICE_PATH_PROTOCOL
*DevicePathPointer
;
75 typedef struct NII_CONFIG_ENTRY
{
77 UINT32 Reserved
; // padding for alignment
78 struct NII_CONFIG_ENTRY
*NextLink
;
79 NII_ENTRY NiiEntry
[1];
82 typedef VOID (*ptr
)(VOID
);
83 typedef VOID (*bsptr_30
)(UINTN
);
84 typedef VOID (*virtphys_30
)(UINT64
, UINT64
);
85 typedef VOID (*block_30
)(UINT32
);
86 typedef VOID (*mem_io_30
)(UINT8
, UINT8
, UINT64
, UINT64
);
88 typedef VOID (*bsptr
)(UINT64
, UINTN
);
89 typedef VOID (*virtphys
)(UINT64
, UINT64
, UINT64
);
90 typedef VOID (*block
)(UINT64
, UINT32
);
91 typedef VOID (*mem_io
)(UINT64
, UINT8
, UINT8
, UINT64
, UINT64
);
93 typedef VOID (*map_mem
)(UINT64
, UINT64
, UINT32
, UINT32
, UINT64
);
94 typedef VOID (*unmap_mem
)(UINT64
, UINT64
, UINT32
, UINT32
, UINT64
);
95 typedef VOID (*sync_mem
)(UINT64
, UINT64
, UINT32
, UINT32
, UINT64
);
98 // functions defined in e100b.c
100 UINT8
InByte (NIC_DATA_INSTANCE
*AdapterInfo
, UINT32 Port
);
101 UINT16
InWord (NIC_DATA_INSTANCE
*AdapterInfo
, UINT32 Port
);
102 UINT32
InLong (NIC_DATA_INSTANCE
*AdapterInfo
, UINT32 Port
);
103 VOID
OutByte (NIC_DATA_INSTANCE
*AdapterInfo
, UINT8 Data
, UINT32 Port
);
104 VOID
OutWord (NIC_DATA_INSTANCE
*AdapterInfo
, UINT16 Data
, UINT32 Port
);
105 VOID
OutLong (NIC_DATA_INSTANCE
*AdapterInfo
, UINT32 Data
, UINT32 Port
);
107 UINTN
E100bInit (NIC_DATA_INSTANCE
*AdapterInfo
);
108 UINTN
E100bReset (NIC_DATA_INSTANCE
*AdapterInfo
, INT32 OpFlags
);
109 UINTN
E100bShutdown (NIC_DATA_INSTANCE
*AdapterInfo
);
110 UINTN
E100bTransmit (NIC_DATA_INSTANCE
*AdapterInfo
, UINT64 cpb
, UINT16 opflags
);
111 UINTN
E100bReceive (NIC_DATA_INSTANCE
*AdapterInfo
, UINT64 cpb
, UINT64 db
);
112 UINTN
E100bSetfilter (NIC_DATA_INSTANCE
*AdapterInfo
, UINT16 New_filter
,
113 UINT64 cpb
, UINT32 cpbsize
);
114 UINTN
E100bStatistics(NIC_DATA_INSTANCE
*AdapterInfo
, UINT64 db
, UINT16 dbsize
);
115 UINT8
E100bSetupIAAddr (NIC_DATA_INSTANCE
*AdapterInfo
);
116 UINT8
E100bSetInterruptState (NIC_DATA_INSTANCE
*AdapterInfo
);
118 UINT8
E100bGetEepromAddrLen (NIC_DATA_INSTANCE
*AdapterInfo
);
119 UINT16
E100bReadEeprom (NIC_DATA_INSTANCE
*AdapterInfo
, INT32 Location
, UINT8 address_len
);
120 INT16
E100bReadEepromAndStationAddress (NIC_DATA_INSTANCE
*AdapterInfo
);
123 UINT8
SetupCBlink (NIC_DATA_INSTANCE
*AdapterInfo
);
124 VOID
SetFreeCB (NIC_DATA_INSTANCE
*AdapterInfo
,TxCB
*);
125 TxCB
*GetFreeCB (NIC_DATA_INSTANCE
*AdapterInfo
);
126 UINT16
CheckCBList (NIC_DATA_INSTANCE
*AdapterInfo
);
128 UINT8
SelectiveReset (NIC_DATA_INSTANCE
*AdapterInfo
);
129 UINT16
InitializeChip (NIC_DATA_INSTANCE
*AdapterInfo
);
130 UINT8
SetupReceiveQueues (NIC_DATA_INSTANCE
*AdapterInfo
);
131 VOID
Recycle_RFD (NIC_DATA_INSTANCE
*AdapterInfo
, UINT16
);
132 VOID
XmitWaitForCompletion (NIC_DATA_INSTANCE
*AdapterInfo
);
133 INT8
CommandWaitForCompletion (TxCB
*cmd_ptr
, NIC_DATA_INSTANCE
*AdapterInfo
);
135 BOOLEAN
PhyDetect (NIC_DATA_INSTANCE
*AdapterInfo
);
136 VOID
PhyReset (NIC_DATA_INSTANCE
*AdapterInfo
);
139 IN NIC_DATA_INSTANCE
*AdapterInfo
,
147 IN NIC_DATA_INSTANCE
*AdapterInfo
,
150 IN OUT UINT16
*DataValue
153 BOOLEAN
SetupPhy (NIC_DATA_INSTANCE
*AdapterInfo
);
154 VOID
FindPhySpeedAndDpx (NIC_DATA_INSTANCE
*AdapterInfo
, UINT32 PhyId
);
159 // functions defined in init.c
164 IN UINTN MicroSeconds
177 // functions defined in decode.c
179 VOID
UNDI_GetState();
182 VOID
UNDI_GetInitInfo();
183 VOID
UNDI_GetConfigInfo();
184 VOID
UNDI_Initialize();
186 VOID
UNDI_Shutdown();
187 VOID
UNDI_Interrupt();
188 VOID
UNDI_RecFilter();
190 VOID
UNDI_Statistics();
194 VOID
UNDI_FillHeader();
195 VOID
UNDI_Transmit();
198 VOID
UNDI_APIEntry_new(UINT64
);
199 VOID
UNDI_APIEntry_old(UINT64
);
200 VOID
UNDI_APIEntry_Common(UINT64
);
202 PXE_IPV4
convert_mcip(PXE_MAC_ADDR
*);
203 INT32
validate_mcip (PXE_MAC_ADDR
*MCastAddr
);
205 VOID
PxeStructInit (PXE_SW_UNDI
*PxePtr
, UINTN VersionFlag
);
206 VOID
PxeUpdate (NIC_DATA_INSTANCE
*NicPtr
, PXE_SW_UNDI
*PxePtr
);