EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

OptionRomPkg/UndiRuntimeDxe/Undi32.h

Go to the documentation of this file.
00001 
00015 #ifndef _UNDI_32_H_
00016 #define _UNDI_32_H_
00017 
00018 #include <Uefi.h>
00019 
00020 #include <Guid/EventGroup.h>
00021 #include <Protocol/PciIo.h>
00022 #include <Protocol/NetworkInterfaceIdentifier.h>
00023 #include <Protocol/DevicePath.h>
00024 
00025 #include <Library/UefiDriverEntryPoint.h>
00026 #include <Library/UefiRuntimeLib.h>
00027 #include <Library/DebugLib.h>
00028 #include <Library/BaseMemoryLib.h>
00029 #include <Library/UefiBootServicesTableLib.h>
00030 #include <Library/UefiLib.h>
00031 #include <Library/BaseLib.h>
00032 #include <Library/DevicePathLib.h>
00033 
00034 #include <IndustryStandard/Pci.h>
00035 
00036 
00037 #include "E100b.h"
00038 
00039 #define MAX_NIC_INTERFACES 16
00040 
00041 #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31 0x00010001
00042 #define PXE_ROMID_MINORVER_31 0x10
00043 #define PXE_STATFLAGS_DB_WRITE_TRUNCATED  0x2000
00044 
00045 //
00046 // UNDI_CALL_TABLE.state can have the following values
00047 //
00048 #define DONT_CHECK -1
00049 #define ANY_STATE -1
00050 #define MUST_BE_STARTED 1
00051 #define MUST_BE_INITIALIZED 2
00052 
00053 #define UNDI_DEV_SIGNATURE   SIGNATURE_32('u','n','d','i')
00054 #define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol_31, UNDI_DEV_SIGNATURE)
00055 #define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
00056 
00057 typedef struct {
00058   UINTN                                     Signature;
00059   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;
00060   EFI_HANDLE                                DeviceHandle;
00061   EFI_DEVICE_PATH_PROTOCOL                  *Undi32BaseDevPath;
00062   EFI_DEVICE_PATH_PROTOCOL                  *Undi32DevPath;
00063   NIC_DATA_INSTANCE                         NicInfo;
00064 } UNDI32_DEV;
00065 
00066 typedef struct {
00067   UINT16 cpbsize;
00068   UINT16 dbsize;
00069   UINT16 opflags;
00070   UINT16 state;
00071   VOID (*api_ptr)();
00072 } UNDI_CALL_TABLE;
00073 
00074 typedef VOID (*ptr)(VOID);
00075 typedef VOID (*bsptr_30)(UINTN);
00076 typedef VOID (*virtphys_30)(UINT64, UINT64);
00077 typedef VOID (*block_30)(UINT32);
00078 typedef VOID (*mem_io_30)(UINT8, UINT8, UINT64, UINT64);
00079 
00080 typedef VOID (*bsptr)(UINT64, UINTN);
00081 typedef VOID (*virtphys)(UINT64, UINT64, UINT64);
00082 typedef VOID (*block)(UINT64, UINT32);
00083 typedef VOID (*mem_io)(UINT64, UINT8, UINT8, UINT64, UINT64);
00084 
00085 typedef VOID (*map_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
00086 typedef VOID (*unmap_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
00087 typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
00088 
00089 extern UNDI_CALL_TABLE  api_table[];
00090 extern PXE_SW_UNDI      *pxe_31;  // !pxe structure for 3.1 drivers
00091 extern UNDI32_DEV       *UNDI32DeviceList[MAX_NIC_INTERFACES];
00092 
00093 //
00094 // functions defined in e100b.c
00095 //
00096 UINT8 InByte (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
00097 UINT16 InWord (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
00098 UINT32 InLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
00099 VOID  OutByte (NIC_DATA_INSTANCE *AdapterInfo, UINT8 Data, UINT32 Port);
00100 VOID  OutWord (NIC_DATA_INSTANCE *AdapterInfo, UINT16 Data, UINT32 Port);
00101 VOID  OutLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Data, UINT32 Port);
00102 
00103 UINTN E100bInit (NIC_DATA_INSTANCE *AdapterInfo);
00104 UINTN E100bReset (NIC_DATA_INSTANCE *AdapterInfo, INT32 OpFlags);
00105 UINTN E100bShutdown (NIC_DATA_INSTANCE *AdapterInfo);
00106 UINTN E100bTransmit (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT16 opflags);
00107 UINTN E100bReceive (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT64 db);
00108 UINTN E100bSetfilter (NIC_DATA_INSTANCE *AdapterInfo, UINT16 New_filter,
00109                       UINT64 cpb, UINT32 cpbsize);
00110 UINTN E100bStatistics(NIC_DATA_INSTANCE *AdapterInfo, UINT64 db, UINT16 dbsize);
00111 UINT8 E100bSetupIAAddr (NIC_DATA_INSTANCE *AdapterInfo);
00112 UINT8 E100bSetInterruptState (NIC_DATA_INSTANCE *AdapterInfo);
00113 
00114 UINT8 E100bGetEepromAddrLen (NIC_DATA_INSTANCE *AdapterInfo);
00115 UINT16 E100bReadEeprom (NIC_DATA_INSTANCE *AdapterInfo, INT32 Location, UINT8 address_len);
00116 INT16 E100bReadEepromAndStationAddress (NIC_DATA_INSTANCE *AdapterInfo);
00117 
00118 UINT16 next(UINT16);
00119 UINT8 SetupCBlink (NIC_DATA_INSTANCE *AdapterInfo);
00120 VOID SetFreeCB (NIC_DATA_INSTANCE *AdapterInfo,TxCB *);
00121 TxCB *GetFreeCB (NIC_DATA_INSTANCE *AdapterInfo);
00122 UINT16 CheckCBList (NIC_DATA_INSTANCE *AdapterInfo);
00123 
00124 UINT8 SelectiveReset (NIC_DATA_INSTANCE *AdapterInfo);
00125 UINT16 InitializeChip (NIC_DATA_INSTANCE *AdapterInfo);
00126 UINT8 SetupReceiveQueues (NIC_DATA_INSTANCE *AdapterInfo);
00127 VOID  Recycle_RFD (NIC_DATA_INSTANCE *AdapterInfo, UINT16);
00128 VOID XmitWaitForCompletion (NIC_DATA_INSTANCE *AdapterInfo);
00129 INT8 CommandWaitForCompletion (TxCB *cmd_ptr, NIC_DATA_INSTANCE *AdapterInfo);
00130 
00131 BOOLEAN PhyDetect (NIC_DATA_INSTANCE *AdapterInfo);
00132 VOID PhyReset (NIC_DATA_INSTANCE *AdapterInfo);
00133 VOID
00134 MdiWrite (
00135   IN NIC_DATA_INSTANCE *AdapterInfo,
00136   IN UINT8 RegAddress,
00137   IN UINT8 PhyAddress,
00138   IN UINT16 DataValue
00139   );
00140 
00141 VOID
00142 MdiRead(
00143   IN NIC_DATA_INSTANCE *AdapterInfo,
00144   IN UINT8 RegAddress,
00145   IN UINT8 PhyAddress,
00146   IN OUT UINT16 *DataValue
00147   );
00148 
00149 BOOLEAN SetupPhy (NIC_DATA_INSTANCE *AdapterInfo);
00150 VOID FindPhySpeedAndDpx (NIC_DATA_INSTANCE *AdapterInfo, UINT32 PhyId);
00151 
00152 
00153 
00154 //
00155 // functions defined in init.c
00156 //
00157 EFI_STATUS
00158 InstallConfigTable (
00159   IN VOID
00160   );
00161 
00162 EFI_STATUS
00163 EFIAPI
00164 InitializeUNDIDriver (
00165   IN EFI_HANDLE           ImageHandle,
00166   IN EFI_SYSTEM_TABLE     *SystemTable
00167   );
00168 
00169 VOID
00170 UNDI_notify_virtual (
00171   EFI_EVENT event,
00172   VOID      *context
00173   );
00174 
00175 VOID
00176 EFIAPI
00177 UndiNotifyExitBs (
00178   EFI_EVENT Event,
00179   VOID      *Context
00180   );
00181 
00182 EFI_STATUS
00183 EFIAPI
00184 UndiDriverSupported (
00185   IN EFI_DRIVER_BINDING_PROTOCOL    *This,
00186   IN EFI_HANDLE                     Controller,
00187   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
00188   );
00189 
00190 EFI_STATUS
00191 EFIAPI
00192 UndiDriverStart (
00193   IN EFI_DRIVER_BINDING_PROTOCOL    *This,
00194   IN EFI_HANDLE                     Controller,
00195   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
00196   );
00197 
00198 EFI_STATUS
00199 EFIAPI
00200 UndiDriverStop (
00201   IN  EFI_DRIVER_BINDING_PROTOCOL    *This,
00202   IN  EFI_HANDLE                     Controller,
00203   IN  UINTN                          NumberOfChildren,
00204   IN  EFI_HANDLE                     *ChildHandleBuffer
00205   );
00206 
00207 EFI_STATUS
00208 AppendMac2DevPath (
00209   IN OUT  EFI_DEVICE_PATH_PROTOCOL **DevPtr,
00210   IN      EFI_DEVICE_PATH_PROTOCOL *BaseDevPtr,
00211   IN      NIC_DATA_INSTANCE        *AdapterInfo
00212   );
00213 
00214 VOID
00215 TmpDelay (
00216   IN UINT64 UnqId,
00217   IN UINTN MicroSeconds
00218   );
00219 
00220 VOID
00221 TmpMemIo (
00222   IN UINT64 UnqId,
00223   IN UINT8 ReadWrite,
00224   IN UINT8 Len,
00225   IN UINT64 Port,
00226   IN UINT64 BufAddr
00227   );
00228 
00229 //
00230 // functions defined in decode.c
00231 //
00232 VOID
00233 UNDI_GetState (
00234   IN  PXE_CDB           *CdbPtr,
00235   IN  NIC_DATA_INSTANCE *AdapterInfo
00236   );
00237 
00238 VOID
00239 UNDI_Start (
00240   IN  PXE_CDB           *CdbPtr,
00241   IN  NIC_DATA_INSTANCE *AdapterInfo
00242   );
00243 
00244 VOID
00245 UNDI_Stop (
00246   IN  PXE_CDB           *CdbPtr,
00247   IN  NIC_DATA_INSTANCE *AdapterInfo
00248   );
00249 
00250 VOID
00251 UNDI_GetInitInfo (
00252   IN  PXE_CDB           *CdbPtr,
00253   IN  NIC_DATA_INSTANCE *AdapterInfo
00254   );
00255 
00256 VOID
00257 UNDI_GetConfigInfo (
00258   IN  PXE_CDB           *CdbPtr,
00259   IN  NIC_DATA_INSTANCE *AdapterInfo
00260   );
00261 
00262 VOID
00263 UNDI_Initialize (
00264   IN  PXE_CDB       *CdbPtr,
00265   NIC_DATA_INSTANCE *AdapterInfo
00266   );
00267 
00268 VOID
00269 UNDI_Reset (
00270   IN  PXE_CDB           *CdbPtr,
00271   IN  NIC_DATA_INSTANCE *AdapterInfo
00272   );
00273 
00274 VOID
00275 UNDI_Shutdown (
00276   IN  PXE_CDB           *CdbPtr,
00277   IN  NIC_DATA_INSTANCE *AdapterInfo
00278   );
00279 
00280 VOID
00281 UNDI_Interrupt (
00282   IN  PXE_CDB           *CdbPtr,
00283   IN  NIC_DATA_INSTANCE *AdapterInfo
00284   );
00285 
00286 VOID
00287 UNDI_RecFilter (
00288   IN  PXE_CDB           *CdbPtr,
00289   IN  NIC_DATA_INSTANCE *AdapterInfo
00290   );
00291 
00292 VOID
00293 UNDI_StnAddr (
00294   IN  PXE_CDB           *CdbPtr,
00295   IN  NIC_DATA_INSTANCE *AdapterInfo
00296   );
00297 
00298 VOID
00299 UNDI_Statistics (
00300   IN  PXE_CDB           *CdbPtr,
00301   IN  NIC_DATA_INSTANCE *AdapterInfo
00302   );
00303 
00304 VOID
00305 UNDI_ip2mac (
00306   IN  PXE_CDB           *CdbPtr,
00307   IN  NIC_DATA_INSTANCE *AdapterInfo
00308   );
00309 
00310 VOID
00311 UNDI_NVData (
00312   IN  PXE_CDB           *CdbPtr,
00313   IN  NIC_DATA_INSTANCE *AdapterInfo
00314   );
00315 
00316 VOID
00317 UNDI_Status (
00318   IN  PXE_CDB           *CdbPtr,
00319   IN  NIC_DATA_INSTANCE *AdapterInfo
00320   );
00321 
00322 VOID
00323 UNDI_FillHeader (
00324   IN  PXE_CDB           *CdbPtr,
00325   IN  NIC_DATA_INSTANCE *AdapterInfo
00326   );
00327 
00328 VOID
00329 UNDI_Transmit (
00330   IN  PXE_CDB           *CdbPtr,
00331   IN  NIC_DATA_INSTANCE *AdapterInfo
00332   );
00333 
00334 VOID
00335 UNDI_Receive (
00336   IN  PXE_CDB           *CdbPtr,
00337   IN  NIC_DATA_INSTANCE *AdapterInfo
00338   );
00339 
00340 VOID UNDI_APIEntry_new(UINT64);
00341 VOID UNDI_APIEntry_Common(UINT64);
00342 
00343 PXE_IPV4 convert_mcip(PXE_MAC_ADDR *);
00344 INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);
00345 
00346 VOID PxeStructInit (PXE_SW_UNDI *PxePtr);
00347 VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);
00348 
00349 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines