53 DEBUG ((DEBUG_ERROR,
"\nIssueHwUndiCommand() - This should not be called!"));
56 return EFI_INVALID_PARAMETER;
62 return EFI_UNSUPPORTED;
87 if ((Ptr ==
NULL) || (Length == 0)) {
91 while (Length-- != 0) {
92 Cksum = (UINT8)(Cksum + *Ptr++);
128 Status =
gBS->OpenProtocol (
130 &gEfiDevicePathProtocolGuid,
132 This->DriverBindingHandle,
134 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
136 if (EFI_ERROR (Status)) {
140 Status =
gBS->OpenProtocol (
142 &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
143 (VOID **)&NiiProtocol,
144 This->DriverBindingHandle,
146 EFI_OPEN_PROTOCOL_BY_DRIVER
149 if (EFI_ERROR (Status)) {
150 if (Status == EFI_ALREADY_STARTED) {
151 DEBUG ((DEBUG_INFO,
"Support(): Already Started. on handle %p\n", Controller));
157 DEBUG ((DEBUG_INFO,
"Support(): UNDI3.1 found on handle %p\n", Controller));
162 if (NiiProtocol->
Type != EfiNetworkInterfaceUndi) {
163 Status = EFI_UNSUPPORTED;
170 if ((NiiProtocol->
Id & 0x0F) != 0) {
171 DEBUG ((DEBUG_NET,
"\n!PXE structure is not paragraph aligned.\n"));
172 Status = EFI_UNSUPPORTED;
182 DEBUG ((DEBUG_NET,
"\n!PXE signature is not valid.\n"));
183 Status = EFI_UNSUPPORTED;
188 DEBUG ((DEBUG_NET,
"\n!PXE.Rev is not supported.\n"));
189 Status = EFI_UNSUPPORTED;
194 DEBUG ((DEBUG_NET,
"\n!PXE.MajorVer is not supported.\n"));
195 Status = EFI_UNSUPPORTED;
198 DEBUG ((DEBUG_NET,
"\n!PXE.MinorVer is not supported."));
199 Status = EFI_UNSUPPORTED;
208 DEBUG ((DEBUG_NET,
"\n!PXE S/W entry point is not valid."));
209 Status = EFI_UNSUPPORTED;
213 if (Pxe->sw.
BusCnt == 0) {
214 DEBUG ((DEBUG_NET,
"\n!PXE.BusCnt is zero."));
215 Status = EFI_UNSUPPORTED;
221 DEBUG ((DEBUG_INFO,
"Support(): supported on %p\n", Controller));
226 &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
227 This->DriverBindingHandle,
272 BOOLEAN FoundMemoryBar;
274 DEBUG ((DEBUG_NET,
"\nSnpNotifyNetworkInterfaceIdentifier() "));
276 Status =
gBS->OpenProtocol (
278 &gEfiDevicePathProtocolGuid,
279 (VOID **)&NiiDevicePath,
280 This->DriverBindingHandle,
282 EFI_OPEN_PROTOCOL_BY_DRIVER
285 if (EFI_ERROR (Status)) {
289 Status =
gBS->LocateDevicePath (
290 &gEfiPciIoProtocolGuid,
295 if (EFI_ERROR (Status)) {
299 Status =
gBS->OpenProtocol (
301 &gEfiPciIoProtocolGuid,
303 This->DriverBindingHandle,
305 EFI_OPEN_PROTOCOL_GET_PROTOCOL
307 if (EFI_ERROR (Status)) {
314 Status =
gBS->OpenProtocol (
316 &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
318 This->DriverBindingHandle,
320 EFI_OPEN_PROTOCOL_BY_DRIVER
322 if (EFI_ERROR (Status)) {
325 &gEfiDevicePathProtocolGuid,
326 This->DriverBindingHandle,
332 DEBUG ((DEBUG_INFO,
"Start(): UNDI3.1 found\n"));
337 DEBUG ((DEBUG_NET,
"\n!PXE checksum is not correct.\n"));
341 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {
345 }
else if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {
352 DEBUG ((DEBUG_NET,
"\nUNDI does not have promiscuous or broadcast support."));
360 Status = PciIo->AllocateBuffer (
370 DEBUG ((DEBUG_NET,
"\nCould not allocate SNP_DRIVER structure.\n"));
379 Snp->Signature = SNP_DRIVER_SIGNATURE;
383 Snp->Snp.
Revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;
399 Snp->Snp.
Mode = &Snp->Mode;
401 Snp->TxRxBufferSize = 0;
402 Snp->TxRxBuffer =
NULL;
404 Snp->RecycledTxBuf =
AllocatePool (
sizeof (UINT64) * SNP_TX_BUFFER_INCREASEMENT);
405 if (Snp->RecycledTxBuf ==
NULL) {
406 Status = EFI_OUT_OF_RESOURCES;
407 goto Error_DeleteSNP;
410 Snp->MaxRecycledTxBuf = SNP_TX_BUFFER_INCREASEMENT;
411 Snp->RecycledTxBufCount = 0;
413 if (Nii->
Revision >= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION) {
414 Snp->IfNum = Nii->
IfNum;
416 Snp->IfNum = (UINT8)(Nii->
IfNum & 0xFF);
420 Snp->IsSwUndi =
FALSE;
423 Snp->IsSwUndi =
TRUE;
426 Snp->IssueUndi32Command = (ISSUE_UNDI32_COMMAND)(
UINTN)Pxe->sw.
EntryPoint;
428 Snp->IssueUndi32Command = (ISSUE_UNDI32_COMMAND)(
UINTN)((UINT8)(
UINTN)Pxe + Pxe->sw.
EntryPoint);
448 Status = PciIo->AllocateBuffer (
452 SNP_MEM_PAGES (4096),
458 DEBUG ((DEBUG_NET,
"\nCould not allocate CPB and DB structures.\n"));
459 goto Error_DeleteSNP;
462 Snp->Cpb = (VOID *)(
UINTN)Address;
463 Snp->Db = (VOID *)((
UINTN)Address + 2048);
472 Snp->MemoryBarIndex = PCI_MAX_BAR;
473 Snp->IoBarIndex = PCI_MAX_BAR;
474 FoundMemoryBar =
FALSE;
476 for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
477 Status = PciIo->GetBarAttributes (
483 if (Status == EFI_UNSUPPORTED) {
485 }
else if (EFI_ERROR (Status)) {
486 goto Error_DeleteSNP;
489 if ((!FoundMemoryBar) && (BarDesc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM)) {
490 Snp->MemoryBarIndex = BarIndex;
491 FoundMemoryBar =
TRUE;
492 }
else if ((!FoundIoBar) && (BarDesc->ResType == ACPI_ADDRESS_SPACE_TYPE_IO)) {
493 Snp->IoBarIndex = BarIndex;
499 if (FoundMemoryBar && FoundIoBar) {
507 goto Error_DeleteSNP;
511 Snp->Cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
516 Snp->Cdb.DBsize = (UINT16)
sizeof (Snp->InitInfo);
517 Snp->Cdb.DBaddr = (UINT64)(
UINTN)(&Snp->InitInfo);
519 Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
520 Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
522 Snp->Cdb.IFnum = Snp->IfNum;
523 Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
525 DEBUG ((DEBUG_NET,
"\nSnp->undi.get_init_info() "));
527 (*Snp->IssueUndi32Command)((UINT64)(
UINTN)&Snp->Cdb);
532 InitStatFlags = Snp->Cdb.StatFlags;
535 DEBUG ((DEBUG_NET,
"\nSnp->undi.init_info() %xh:%xh\n", Snp->Cdb.StatFlags, Snp->Cdb.StatCode));
537 goto Error_DeleteSNP;
543 Snp->Mode.
State = EfiSimpleNetworkStopped;
554 case PXE_STATFLAGS_CABLE_DETECT_SUPPORTED:
555 Snp->CableDetectSupported =
TRUE;
558 case PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED:
560 Snp->CableDetectSupported =
FALSE;
563 switch (InitStatFlags & PXE_STATFLAGS_GET_STATUS_NO_MEDIA_MASK) {
564 case PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED:
565 Snp->MediaStatusSupported =
TRUE;
568 case PXE_STATFLAGS_GET_STATUS_NO_MEDIA_NOT_SUPPORTED:
570 Snp->MediaStatusSupported =
FALSE;
573 if (Snp->CableDetectSupported || Snp->MediaStatusSupported) {
577 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) != 0) {
583 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED) != 0) {
591 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {
595 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {
599 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {
603 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED) != 0) {
607 if ((Pxe->hw.
Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {
618 Status =
PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);
620 if (EFI_ERROR (Status)) {
622 goto Error_DeleteSNP;
628 DEBUG ((DEBUG_ERROR,
"\nSnp->undi.get_station_addr() failed.\n"));
631 goto Error_DeleteSNP;
649 if (
PcdGetBool (PcdSnpCreateExitBootServicesEvent)) {
653 Status =
gBS->CreateEventEx (
658 &gEfiEventExitBootServicesGuid,
659 &Snp->ExitBootServicesEvent
661 if (EFI_ERROR (Status)) {
662 goto Error_DeleteSNP;
669 Status =
gBS->InstallProtocolInterface (
671 &gEfiSimpleNetworkProtocolGuid,
676 if (!EFI_ERROR (Status)) {
682 SNP_MEM_PAGES (4096),
688 if (Snp->RecycledTxBuf !=
NULL) {
700 &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
701 This->DriverBindingHandle,
707 &gEfiDevicePathProtocolGuid,
708 This->DriverBindingHandle,
715 if (!EFI_ERROR (Status)) {
716 Status = EFI_DEVICE_ERROR;
757 Status =
gBS->OpenProtocol (
759 &gEfiSimpleNetworkProtocolGuid,
760 (VOID **)&SnpProtocol,
761 This->DriverBindingHandle,
763 EFI_OPEN_PROTOCOL_GET_PROTOCOL
766 if (EFI_ERROR (Status)) {
767 return EFI_UNSUPPORTED;
770 Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (SnpProtocol);
772 Status =
gBS->UninstallProtocolInterface (
774 &gEfiSimpleNetworkProtocolGuid,
778 if (EFI_ERROR (Status)) {
782 if (
PcdGetBool (PcdSnpCreateExitBootServicesEvent)) {
786 gBS->CloseEvent (Snp->ExitBootServicesEvent);
789 Status =
gBS->CloseProtocol (
791 &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
792 This->DriverBindingHandle,
796 Status =
gBS->CloseProtocol (
798 &gEfiDevicePathProtocolGuid,
799 This->DriverBindingHandle,
811 SNP_MEM_PAGES (4096),
860 &gSimpleNetworkDriverBinding,
862 &gSimpleNetworkComponentName,
863 &gSimpleNetworkComponentName2
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI SnpUndi32GetStatus(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, OUT UINT32 *InterruptStatus OPTIONAL, OUT VOID **TxBuf OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32McastIpToMac(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC)
#define DEBUG(Expression)
EFI_STATUS PxeInit(SNP_DRIVER *Snp, UINT16 CableDetectFlag)
EFI_STATUS EFIAPI SnpUndi32Initialize(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINTN ExtraRxBufferSize OPTIONAL, IN UINTN ExtraTxBufferSize OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32Reset(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
EFI_STATUS EFIAPI SnpUndi32NvData(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ReadWrite, IN UINTN Offset, IN UINTN BufferSize, IN OUT VOID *Buffer)
#define PcdGetBool(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI SnpUndi32Receive(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, OUT UINTN *HeaderSize OPTIONAL, IN OUT UINTN *BufferSize, OUT VOID *Buffer, OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, OUT UINT16 *Protocol OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32ReceiveFilters(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32Shutdown(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
EFI_STATUS PxeShutdown(IN SNP_DRIVER *Snp)
EFI_STATUS EFIAPI SimpleNetworkDriverSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI InitializeSnpNiiDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
UINT8 Calc8BitCksum(VOID *Buffer, UINTN Length)
VOID EFIAPI SnpNotifyExitBootServices(EFI_EVENT Event, VOID *Context)
EFI_STATUS EFIAPI IssueHwUndiCommand(UINT64 Cdb)
EFI_STATUS EFIAPI SimpleNetworkDriverStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI SimpleNetworkDriverStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS PxeStop(SNP_DRIVER *Snp)
EFI_STATUS PxeGetStnAddr(SNP_DRIVER *Snp)
EFI_STATUS PxeStart(IN SNP_DRIVER *Snp)
EFI_STATUS EFIAPI SnpUndi32Stop(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
EFI_STATUS EFIAPI SnpUndi32Statistics(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, IN OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32Transmit(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32StationAddress(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN EFI_MAC_ADDRESS *New OPTIONAL)
EFI_STATUS EFIAPI SnpUndi32Start(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
EFI_LOCK *EFIAPI EfiInitializeLock(IN OUT EFI_LOCK *Lock, IN EFI_TPL Priority)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
#define PXE_ROMID_MAJORVER
#define PXE_CPBSIZE_NOT_USED
zero
#define PXE_ROMID_SIGNATURE
#define PXE_DBADDR_NOT_USED
zero
#define PXE_ROMID_IMP_HW_UNDI
#define PXE_STATFLAGS_CABLE_DETECT_MASK
#define PXE_OPCODE_GET_INIT_INFO
#define PXE_STATCODE_SUCCESS
UINT64 Revision
The revision of the EFI_NETWORK_INTERFACE_IDENTIFIER protocol.
EFI_SIMPLE_NETWORK_MODE * Mode
BOOLEAN MacAddressChangeable
BOOLEAN MultipleTxSupported
UINT32 MaxMCastFilterCount
BOOLEAN MediaPresentSupported
UINT32 ReceiveFilterSetting
PXE_UINT32 MemoryRequired
PXE_UINT16 MCastFilterCnt
PXE_UINT16 MediaHeaderLen
PXE_UINT32 Implementation
PXE_UINT8 Len
sizeof(PXE_HW_UNDI).
PXE_UINT32 Signature
PXE_ROMID_SIGNATURE.
PXE_UINT8 Rev
PXE_ROMID_REV.
PXE_UINT8 MinorVer
PXE_ROMID_MINORVER.
PXE_UINT8 MajorVer
PXE_ROMID_MAJORVER.
PXE_UINT32 Implementation
Implementation flags.
PXE_UINT64 EntryPoint
API entry point.
PXE_UINT8 Len
sizeof(PXE_SW_UNDI).
PXE_UINT8 BusCnt
number of bustypes supported.