Remove gEfiNetworkInterfaceIdentifierProtocolGuid reference from code base. Only left its definition in MdePkg.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4295 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2007-11-13 09:08:17 +00:00
parent cfe9de5244
commit 41057d7787
13 changed files with 75 additions and 570 deletions

View File

@ -1290,52 +1290,6 @@ Returns:
return ; return ;
} }
VOID
UNDI_APIEntry_old (
IN UINT64 cdb
)
/*++
Routine Description:
This is the main SW UNDI API entry using the older nii protocol.
The parameter passed in is a 64 bit flat model virtual
address of the cdb. We then jump into the common routine for both old and
new nii protocol entries.
Arguments:
CdbPtr - Pointer to the command descriptor block.
AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
Returns:
None
--*/
// TODO: cdb - add argument and description to function comment
{
PXE_CDB *CdbPtr;
NIC_DATA_INSTANCE *AdapterInfo;
if (cdb == (UINT64) 0) {
return ;
}
CdbPtr = (PXE_CDB *) (UINTN) cdb;
if (CdbPtr->IFnum >= pxe->IFcnt) {
CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
return ;
}
AdapterInfo = &(UNDI32DeviceList[CdbPtr->IFnum]->NicInfo);
//
// entering from older entry point
//
AdapterInfo->VersionFlag = 0x30;
UNDI_APIEntry_Common (cdb);
}
VOID VOID
UNDI_APIEntry_new ( UNDI_APIEntry_new (
@ -1580,8 +1534,7 @@ Returns:
VOID VOID
PxeStructInit ( PxeStructInit (
IN PXE_SW_UNDI *PxePtr, IN PXE_SW_UNDI *PxePtr
IN UINTN VersionFlag
) )
/*++ /*++
@ -1629,12 +1582,8 @@ Returns:
PXE_ROMID_IMP_SOFTWARE_INT_SUPPORTED | PXE_ROMID_IMP_SOFTWARE_INT_SUPPORTED |
PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED; PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED;
if (VersionFlag == 0x30) { PxePtr->EntryPoint = (UINT64) UNDI_APIEntry_new;
PxePtr->EntryPoint = (UINT64) UNDI_APIEntry_old; PxePtr->MinorVer = PXE_ROMID_MINORVER_31;
} else {
PxePtr->EntryPoint = (UINT64) UNDI_APIEntry_new;
PxePtr->MinorVer = PXE_ROMID_MINORVER_31;
}
PxePtr->reserved2[0] = 0; PxePtr->reserved2[0] = 0;
PxePtr->reserved2[1] = 0; PxePtr->reserved2[1] = 0;

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -630,7 +630,7 @@ typedef struct s_data_instance {
UINT8 Rx_Filter; UINT8 Rx_Filter;
UINT8 VersionFlag; // UNDI30 or UNDI31?? UINT8 VersionFlag; // UNDI30 or UNDI31??
UINT8 rsvd[3]; UINT8 rsvd[3];
struct mc{ struct mc{
UINT16 reserved [3]; // padding for this structure to make it 8 byte aligned UINT16 reserved [3]; // padding for this structure to make it 8 byte aligned
UINT16 list_len; UINT16 list_len;

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -26,10 +26,9 @@ Revision History
// //
// Global Variables // Global Variables
// //
PXE_SW_UNDI *pxe = 0; // 3.0 entry point
PXE_SW_UNDI *pxe_31 = 0; // 3.1 entry
UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];
PXE_SW_UNDI *pxe_31 = NULL; // 3.1 entry
UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];
NII_TABLE *UndiDataPointer = NULL; NII_TABLE *UndiDataPointer = NULL;
VOID VOID
@ -381,16 +380,10 @@ Returns:
} else { } else {
pxe_31 = (PXE_SW_UNDI *) TmpPxePointer; pxe_31 = (PXE_SW_UNDI *) TmpPxePointer;
} }
//
// assuming that the sizeof pxe_31 is a 16 byte multiple
//
pxe = (PXE_SW_UNDI *) ((CHAR8 *) (pxe_31) + sizeof (PXE_SW_UNDI));
PxeStructInit (pxe, 0x30); PxeStructInit (pxe_31);
PxeStructInit (pxe_31, 0x31);
} }
UNDI32Device->NIIProtocol.ID = (UINT64) (UINTN) (pxe);
UNDI32Device->NIIProtocol_31.ID = (UINT64) (UINTN) (pxe_31); UNDI32Device->NIIProtocol_31.ID = (UINT64) (UINTN) (pxe_31);
Status = PciIoFncs->Attributes ( Status = PciIoFncs->Attributes (
@ -454,15 +447,13 @@ Returns:
// the IfNum index for the current interface will be the total number // the IfNum index for the current interface will be the total number
// of interfaces initialized so far // of interfaces initialized so far
// //
UNDI32Device->NIIProtocol.IfNum = pxe->IFcnt;
UNDI32Device->NIIProtocol_31.IfNum = pxe_31->IFcnt; UNDI32Device->NIIProtocol_31.IfNum = pxe_31->IFcnt;
PxeUpdate (&UNDI32Device->NicInfo, pxe);
PxeUpdate (&UNDI32Device->NicInfo, pxe_31); PxeUpdate (&UNDI32Device->NicInfo, pxe_31);
UNDI32Device->NicInfo.Io_Function = PciIoFncs; UNDI32Device->NicInfo.Io_Function = PciIoFncs;
UNDI32DeviceList[UNDI32Device->NIIProtocol.IfNum] = UNDI32Device; UNDI32DeviceList[UNDI32Device->NIIProtocol_31.IfNum] = UNDI32Device;
UNDI32Device->Undi32BaseDevPath = UndiDevicePath; UNDI32Device->Undi32BaseDevPath = UndiDevicePath;
Status = AppendMac2DevPath ( Status = AppendMac2DevPath (
&UNDI32Device->Undi32DevPath, &UNDI32Device->Undi32DevPath,
@ -476,19 +467,6 @@ Returns:
UNDI32Device->Signature = UNDI_DEV_SIGNATURE; UNDI32Device->Signature = UNDI_DEV_SIGNATURE;
UNDI32Device->NIIProtocol.Revision = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION;
UNDI32Device->NIIProtocol.Type = EfiNetworkInterfaceUndi;
UNDI32Device->NIIProtocol.MajorVer = PXE_ROMID_MAJORVER;
UNDI32Device->NIIProtocol.MinorVer = PXE_ROMID_MINORVER;
UNDI32Device->NIIProtocol.ImageSize = 0;
UNDI32Device->NIIProtocol.ImageAddr = 0;
UNDI32Device->NIIProtocol.Ipv6Supported = FALSE;
UNDI32Device->NIIProtocol.StringId[0] = 'U';
UNDI32Device->NIIProtocol.StringId[1] = 'N';
UNDI32Device->NIIProtocol.StringId[2] = 'D';
UNDI32Device->NIIProtocol.StringId[3] = 'I';
UNDI32Device->NIIProtocol_31.Revision = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31; UNDI32Device->NIIProtocol_31.Revision = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31;
UNDI32Device->NIIProtocol_31.Type = EfiNetworkInterfaceUndi; UNDI32Device->NIIProtocol_31.Type = EfiNetworkInterfaceUndi;
UNDI32Device->NIIProtocol_31.MajorVer = PXE_ROMID_MAJORVER; UNDI32Device->NIIProtocol_31.MajorVer = PXE_ROMID_MAJORVER;
@ -511,8 +489,6 @@ Returns:
&UNDI32Device->DeviceHandle, &UNDI32Device->DeviceHandle,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
&UNDI32Device->NIIProtocol_31, &UNDI32Device->NIIProtocol_31,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
&UNDI32Device->NIIProtocol,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
UNDI32Device->Undi32DevPath, UNDI32Device->Undi32DevPath,
NULL NULL
@ -557,19 +533,16 @@ UndiErrorAllocDataPointer:
&UNDI32Device->DeviceHandle, &UNDI32Device->DeviceHandle,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
&UNDI32Device->NIIProtocol_31, &UNDI32Device->NIIProtocol_31,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
&UNDI32Device->NIIProtocol,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
UNDI32Device->Undi32DevPath, UNDI32Device->Undi32DevPath,
NULL NULL
); );
UndiErrorDeleteDevicePath: UndiErrorDeleteDevicePath:
UNDI32DeviceList[UNDI32Device->NIIProtocol.IfNum] = NULL; UNDI32DeviceList[UNDI32Device->NIIProtocol_31.IfNum] = NULL;
gBS->FreePool (UNDI32Device->Undi32DevPath); gBS->FreePool (UNDI32Device->Undi32DevPath);
UndiErrorDeletePxe: UndiErrorDeletePxe:
PxeUpdate (NULL, pxe);
PxeUpdate (NULL, pxe_31); PxeUpdate (NULL, pxe_31);
if (TmpPxePointer != NULL) { if (TmpPxePointer != NULL) {
gBS->FreePool (TmpPxePointer); gBS->FreePool (TmpPxePointer);
@ -673,7 +646,7 @@ Returns:
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
ChildHandleBuffer[Index], ChildHandleBuffer[Index],
&gEfiNetworkInterfaceIdentifierProtocolGuid, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
(VOID **) &NIIProtocol, (VOID **) &NIIProtocol,
This->DriverBindingHandle, This->DriverBindingHandle,
Controller, Controller,
@ -707,8 +680,6 @@ Returns:
UNDI32Device->Undi32DevPath, UNDI32Device->Undi32DevPath,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
&UNDI32Device->NIIProtocol_31, &UNDI32Device->NIIProtocol_31,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
&UNDI32Device->NIIProtocol,
NULL NULL
); );

View File

@ -1,7 +1,7 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation. Copyright (c) 2006 - 2007, Intel Corporation.
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -61,12 +61,11 @@ Revision History
#define MUST_BE_INITIALIZED 2 #define MUST_BE_INITIALIZED 2
#define UNDI_DEV_SIGNATURE EFI_SIGNATURE_32('u','n','d','i') #define UNDI_DEV_SIGNATURE EFI_SIGNATURE_32('u','n','d','i')
#define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol, UNDI_DEV_SIGNATURE) #define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol_31, UNDI_DEV_SIGNATURE)
#define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE) #define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol;
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31; EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;
EFI_HANDLE DeviceHandle; EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH_PROTOCOL *Undi32BaseDevPath; EFI_DEVICE_PATH_PROTOCOL *Undi32BaseDevPath;
@ -110,7 +109,6 @@ typedef VOID (*unmap_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64); typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
extern UNDI_CALL_TABLE api_table[]; extern UNDI_CALL_TABLE api_table[];
extern PXE_SW_UNDI *pxe; // !pxe structure
extern PXE_SW_UNDI *pxe_31; // !pxe structure for 3.1 drivers extern PXE_SW_UNDI *pxe_31; // !pxe structure for 3.1 drivers
extern UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES]; extern UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];
@ -362,13 +360,12 @@ UNDI_Receive (
); );
VOID UNDI_APIEntry_new(UINT64); VOID UNDI_APIEntry_new(UINT64);
VOID UNDI_APIEntry_old(UINT64);
VOID UNDI_APIEntry_Common(UINT64); VOID UNDI_APIEntry_Common(UINT64);
PXE_IPV4 convert_mcip(PXE_MAC_ADDR *); PXE_IPV4 convert_mcip(PXE_MAC_ADDR *);
INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr); INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);
VOID PxeStructInit (PXE_SW_UNDI *PxePtr, UINTN VersionFlag); VOID PxeStructInit (PXE_SW_UNDI *PxePtr);
VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr); VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);
#endif #endif

View File

@ -51,13 +51,12 @@
[Guids] [Guids]
gEfiEventExitBootServicesGuid gEfiEventExitBootServicesGuid
gEfiEventVirtualAddressChangeGuid gEfiEventVirtualAddressChangeGuid
[Protocols] [Protocols]
gEfiNetworkInterfaceIdentifierProtocolGuid_31 gEfiNetworkInterfaceIdentifierProtocolGuid_31
gEfiNetworkInterfaceIdentifierProtocolGuid gEfiPciIoProtocolGuid
gEfiPciIoProtocolGuid gEfiDevicePathProtocolGuid
gEfiDevicePathProtocolGuid

View File

@ -2172,19 +2172,9 @@ PxeBcDriverStart (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Status = gBS->OpenProtocol ( goto PxeBcError;
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
(VOID **) &Private->NiiPtr,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
goto PxeBcError;
}
} }
// //
// Get the Snp interface // Get the Snp interface
// //

View File

@ -86,7 +86,6 @@
gEfiLoadFileProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiLoadFileProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiNetworkInterfaceIdentifierProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiTcpProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiTcpProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiNetworkInterfaceIdentifierProtocolGuid_31 # PROTOCOL ALWAYS_CONSUMED gEfiNetworkInterfaceIdentifierProtocolGuid_31 # PROTOCOL ALWAYS_CONSUMED

View File

@ -42,7 +42,6 @@ pxe_getstatus (
{ {
PXE_DB_GET_STATUS *db; PXE_DB_GET_STATUS *db;
UINT16 InterruptFlags; UINT16 InterruptFlags;
UINT64 TempData;
db = snp->db; db = snp->db;
snp->cdb.OpCode = PXE_OPCODE_GET_STATUS; snp->cdb.OpCode = PXE_OPCODE_GET_STATUS;
@ -122,10 +121,6 @@ pxe_getstatus (
(snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY) (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY)
) ? 0 : (VOID *) (UINTN) db->TxBuffer[0]; ) ? 0 : (VOID *) (UINTN) db->TxBuffer[0];
TempData = (UINT64) (UINTN) (*TransmitBufferListPtr);
if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
del_v2p ((VOID *) (UINTN) (db->TxBuffer[0]));
}
} }
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -54,47 +54,13 @@ pxe_receive (
PXE_CPB_RECEIVE *cpb; PXE_CPB_RECEIVE *cpb;
PXE_DB_RECEIVE *db; PXE_DB_RECEIVE *db;
UINTN buf_size; UINTN buf_size;
UINT64 TempData;
cpb = snp->cpb; cpb = snp->cpb;
db = snp->db; db = snp->db;
buf_size = *BuffSizePtr; buf_size = *BuffSizePtr;
//
// IMPORTANT NOTE: cpb->BufferAddr = (UINT64)(UINTN) BufferPtr;
// In case of the older 3.0 UNDI, if the input buffer address is beyond 4GB, cpb->BufferLen = (UINT32) *BuffSizePtr;
// DO NOT call the map function on the given buffer, instead use
// a global buffer. The reason is that UNDI3.0 has some unnecessary check of
// making sure that all the addresses (whether or not they will be given
// to the NIC ) supplied to it are below 4GB. It may or may not use
// the mapped address after all (like in case of CPB and DB)!
// Instead of using the global buffer whose address is allocated within the
// 2GB limit if I start mapping the given buffer we lose the data, here is
// why!!!
// if our address is > 4GB, the map call creates another buffer below 2GB and
// copies data to/from the original buffer to the mapped buffer either at
// map time or unmap time depending on the map direction.
// UNDI will not complain since we already mapped the buffer to be
// within the 2GB limit but will not use (I know undi) the mapped address
// since it does not give the user buffers to the NIC's receive unit,
// It just copies the received packet into the user buffer using the virtual
// (CPU) address rather than the mapped (device or physical) address.
// When the UNDI call returns, if we then unmap the buffer, we will lose
// the contents because unmap copies the contents of the mapped buffer into
// the original buffer (since the direction is FROM_DEVICE) !!!
//
// this is not a problem in Undi 3.1 because this undi uses it's map callback
// routine to map a cpu address to device address and it does it only if
// it is giving the address to the device and unmaps it before using the cpu
// address!
//
TempData = (UINT64) (UINTN) BufferPtr;
if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
cpb->BufferAddr = (UINT64)(UINTN) snp->receive_buf;
cpb->BufferLen = (UINT32) (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
} else {
cpb->BufferAddr = (UINT64)(UINTN) BufferPtr;
cpb->BufferLen = (UINT32) *BuffSizePtr;
}
cpb->reserved = 0; cpb->reserved = 0;
@ -162,11 +128,6 @@ pxe_receive (
*ProtocolPtr = (UINT16) PXE_SWAP_UINT16 (db->Protocol); /* we need to do the byte swapping */ *ProtocolPtr = (UINT16) PXE_SWAP_UINT16 (db->Protocol); /* we need to do the byte swapping */
} }
TempData = (UINT64) (UINTN) BufferPtr;
if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
CopyMem (BufferPtr, snp->receive_buf, snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
}
return (*BuffSizePtr <= buf_size) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL; return (*BuffSizePtr <= buf_size) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;
} }

View File

@ -329,9 +329,7 @@ SimpleNetworkDriverSupported (
EFI_STATUS Status; EFI_STATUS Status;
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiProtocol; EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiProtocol;
PXE_UNDI *pxe; PXE_UNDI *pxe;
BOOLEAN IsUndi31;
IsUndi31 = FALSE;
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
@ -352,34 +350,16 @@ SimpleNetworkDriverSupported (
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (Status == EFI_ALREADY_STARTED)
{
DEBUG ((EFI_D_INFO, "Support(): Already Started. on handle %x\n", Controller));
return EFI_ALREADY_STARTED;
}
if (!EFI_ERROR (Status)) if (EFI_ERROR (Status)) {
{ if (Status == EFI_ALREADY_STARTED) {
DEBUG ((EFI_D_INFO, "Support(): UNDI3.1 found on handle %x\n", Controller)); DEBUG ((EFI_D_INFO, "Support(): Already Started. on handle %x\n", Controller));
IsUndi31 = TRUE;
} else {
//
// try the older 3.0 driver
//
Status = gBS->OpenProtocol (
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
(VOID **) &NiiProtocol,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
return Status;
} }
return Status;
DEBUG ((EFI_D_INFO, "Support(): UNDI3.0 found on handle %x\n", Controller));
} }
DEBUG ((EFI_D_INFO, "Support(): UNDI3.1 found on handle %x\n", Controller));
// //
// check the version, we don't want to connect to the undi16 // check the version, we don't want to connect to the undi16
// //
@ -445,22 +425,12 @@ SimpleNetworkDriverSupported (
DEBUG ((EFI_D_INFO, "Support(): supported on %x\n", Controller)); DEBUG ((EFI_D_INFO, "Support(): supported on %x\n", Controller));
Done: Done:
if (IsUndi31) { gBS->CloseProtocol (
gBS->CloseProtocol ( Controller,
Controller, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31, This->DriverBindingHandle,
This->DriverBindingHandle, Controller
Controller );
);
} else {
gBS->CloseProtocol (
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
return Status; return Status;
} }
@ -491,11 +461,7 @@ SimpleNetworkDriverStart (
PXE_UNDI *pxe; PXE_UNDI *pxe;
SNP_DRIVER *snp; SNP_DRIVER *snp;
VOID *addr; VOID *addr;
VOID *addrUnmap;
EFI_PHYSICAL_ADDRESS paddr;
EFI_HANDLE Handle; EFI_HANDLE Handle;
UINTN Size;
BOOLEAN UndiNew;
PXE_PCI_CONFIG_INFO ConfigInfo; PXE_PCI_CONFIG_INFO ConfigInfo;
PCI_TYPE00 *ConfigHeader; PCI_TYPE00 *ConfigHeader;
UINT32 *TempBar; UINT32 *TempBar;
@ -539,8 +505,7 @@ SimpleNetworkDriverStart (
return Status; return Status;
} }
// //
// Get the NII interface. look for 3.1 undi first, if it is not there // Get the NII interface.
// then look for 3.0, validate the interface.
// //
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
@ -550,7 +515,7 @@ SimpleNetworkDriverStart (
Controller, Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (Status == EFI_ALREADY_STARTED) { if (EFI_ERROR (Status)) {
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
@ -560,36 +525,7 @@ SimpleNetworkDriverStart (
return Status; return Status;
} }
if (!EFI_ERROR (Status)) { DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));
//
// probably not a 3.1 UNDI
//
UndiNew = TRUE;
DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));
} else {
UndiNew = FALSE;
Status = gBS->OpenProtocol (
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
(VOID **) &Nii,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
return Status;
}
DEBUG ((EFI_D_INFO, "Start(): UNDI3.0 found\n"));
}
pxe = (PXE_UNDI *) (UINTN) (Nii->ID); pxe = (PXE_UNDI *) (UINTN) (Nii->ID);
@ -632,30 +568,9 @@ SimpleNetworkDriverStart (
snp = (SNP_DRIVER *) (UINTN) addr; snp = (SNP_DRIVER *) (UINTN) addr;
if (!UndiNew) {
Size = SNP_MEM_PAGES (sizeof (SNP_DRIVER));
Status = mPciIoFncs->Map (
mPciIoFncs,
EfiPciIoOperationBusMasterCommonBuffer,
addr,
&Size,
&paddr,
&addrUnmap
);
ASSERT (paddr);
DEBUG ((EFI_D_NET, "\nSNP_DRIVER @ %Xh, sizeof(SNP_DRIVER) == %d", addr, sizeof (SNP_DRIVER)));
snp = (SNP_DRIVER *) (UINTN) paddr;
snp->SnpDriverUnmap = addrUnmap;
}
ZeroMem (snp, sizeof (SNP_DRIVER)); ZeroMem (snp, sizeof (SNP_DRIVER));
snp->IoFncs = mPciIoFncs; snp->IoFncs = mPciIoFncs;
snp->IsOldUndi = (BOOLEAN) (!UndiNew);
snp->Signature = SNP_DRIVER_SIGNATURE; snp->Signature = SNP_DRIVER_SIGNATURE;
EfiInitializeLock (&snp->lock, TPL_NOTIFY); EfiInitializeLock (&snp->lock, TPL_NOTIFY);
@ -725,26 +640,9 @@ SimpleNetworkDriverStart (
goto Error_DeleteSNP; goto Error_DeleteSNP;
} }
if (snp->IsOldUndi) { snp->cpb = (VOID *) (UINTN) addr;
Size = SNP_MEM_PAGES (4096); snp->db = (VOID *) ((UINTN) addr + 2048);
Status = mPciIoFncs->Map (
mPciIoFncs,
EfiPciIoOperationBusMasterCommonBuffer,
addr,
&Size,
&paddr,
&snp->CpbUnmap
);
ASSERT (paddr);
snp->cpb = (VOID *) (UINTN) paddr;
snp->db = (VOID *) ((UINTN) paddr + 2048);
} else {
snp->cpb = (VOID *) (UINTN) addr;
snp->db = (VOID *) ((UINTN) addr + 2048);
}
// //
// pxe_start call is going to give the callback functions to UNDI, these callback // pxe_start call is going to give the callback functions to UNDI, these callback
// functions use the BarIndex values from the snp structure, so these must be initialized // functions use the BarIndex values from the snp structure, so these must be initialized
@ -762,7 +660,7 @@ SimpleNetworkDriverStart (
Status = pxe_start (snp); Status = pxe_start (snp);
if (Status != EFI_SUCCESS) { if (Status != EFI_SUCCESS) {
goto Error_DeleteCPBDB; goto Error_DeleteSNP;
} }
snp->cdb.OpCode = PXE_OPCODE_GET_INIT_INFO; snp->cdb.OpCode = PXE_OPCODE_GET_INIT_INFO;
@ -792,7 +690,7 @@ SimpleNetworkDriverStart (
if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) { if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
DEBUG ((EFI_D_NET, "\nsnp->undi.init_info() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode)); DEBUG ((EFI_D_NET, "\nsnp->undi.init_info() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));
pxe_stop (snp); pxe_stop (snp);
goto Error_DeleteCPBDB; goto Error_DeleteSNP;
} }
snp->cdb.OpCode = PXE_OPCODE_GET_CONFIG_INFO; snp->cdb.OpCode = PXE_OPCODE_GET_CONFIG_INFO;
@ -817,7 +715,7 @@ SimpleNetworkDriverStart (
if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) { if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
DEBUG ((EFI_D_NET, "\nsnp->undi.config_info() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode)); DEBUG ((EFI_D_NET, "\nsnp->undi.config_info() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));
pxe_stop (snp); pxe_stop (snp);
goto Error_DeleteCPBDB; goto Error_DeleteSNP;
} }
// //
// Find the correct BAR to do IO. // Find the correct BAR to do IO.
@ -846,79 +744,6 @@ SimpleNetworkDriverStart (
TempBar++; TempBar++;
} }
//
// We allocate 2 more global buffers for undi 3.0 interface. We use these
// buffers to pass to undi when the user buffers are beyond 4GB.
// UNDI 3.0 wants all the addresses passed to it to be
// within 2GB limit, create them here and map them so that when undi calls
// v2p callback to check if the physical address is < 2gb, we will pass.
//
// For 3.1 and later UNDIs, we do not do this because undi is
// going to call the map() callback if and only if it wants to use the
// device address for any address it receives.
//
if (snp->IsOldUndi) {
//
// buffer for receive
//
Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
Status = mPciIoFncs->AllocateBuffer (
mPciIoFncs,
AllocateAnyPages,
EfiBootServicesData,
Size,
&addr,
0
);
if (Status != EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "\nCould not allocate receive buffer.\n"));
goto Error_DeleteCPBDB;
}
Status = mPciIoFncs->Map (
mPciIoFncs,
EfiPciIoOperationBusMasterCommonBuffer,
addr,
&Size,
&paddr,
&snp->ReceiveBufUnmap
);
ASSERT (paddr);
snp->receive_buf = (UINT8 *) (UINTN) paddr;
//
// buffer for fill_header
//
Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen);
Status = mPciIoFncs->AllocateBuffer (
mPciIoFncs,
AllocateAnyPages,
EfiBootServicesData,
Size,
&addr,
0
);
if (Status != EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "\nCould not allocate fill_header buffer.\n"));
goto Error_DeleteRCVBuf;
}
Status = mPciIoFncs->Map (
mPciIoFncs,
EfiPciIoOperationBusMasterCommonBuffer,
addr,
&Size,
&paddr,
&snp->FillHdrBufUnmap
);
ASSERT (paddr);
snp->fill_hdr_buf = (UINT8 *) (UINTN) paddr;
}
// //
// Initialize simple network protocol mode structure // Initialize simple network protocol mode structure
// //
@ -992,7 +817,7 @@ SimpleNetworkDriverStart (
if (Status) { if (Status) {
pxe_stop (snp); pxe_stop (snp);
goto Error_DeleteHdrBuf; goto Error_DeleteSNP;
} }
Status = pxe_get_stn_addr (snp); Status = pxe_get_stn_addr (snp);
@ -1001,7 +826,7 @@ SimpleNetworkDriverStart (
DEBUG ((EFI_D_ERROR, "\nsnp->undi.get_station_addr() failed.\n")); DEBUG ((EFI_D_ERROR, "\nsnp->undi.get_station_addr() failed.\n"));
pxe_shutdown (snp); pxe_shutdown (snp);
pxe_stop (snp); pxe_stop (snp);
goto Error_DeleteHdrBuf; goto Error_DeleteSNP;
} }
snp->mode.MediaPresent = FALSE; snp->mode.MediaPresent = FALSE;
@ -1033,43 +858,6 @@ SimpleNetworkDriverStart (
return Status; return Status;
} }
Error_DeleteHdrBuf:
if (snp->IsOldUndi) {
Status = mPciIoFncs->Unmap (
mPciIoFncs,
snp->FillHdrBufUnmap
);
Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen);
mPciIoFncs->FreeBuffer (
mPciIoFncs,
Size,
snp->fill_hdr_buf
);
}
Error_DeleteRCVBuf:
if (snp->IsOldUndi) {
Status = mPciIoFncs->Unmap (
mPciIoFncs,
snp->ReceiveBufUnmap
);
Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
mPciIoFncs->FreeBuffer (
mPciIoFncs,
Size,
snp->receive_buf
);
}
Error_DeleteCPBDB:
if (snp->IsOldUndi) {
Status = mPciIoFncs->Unmap (
mPciIoFncs,
snp->CpbUnmap
);
}
Status = mPciIoFncs->FreeBuffer ( Status = mPciIoFncs->FreeBuffer (
mPciIoFncs, mPciIoFncs,
SNP_MEM_PAGES (4096), SNP_MEM_PAGES (4096),
@ -1077,12 +865,6 @@ Error_DeleteCPBDB:
); );
Error_DeleteSNP: Error_DeleteSNP:
if (snp->IsOldUndi) {
Status = mPciIoFncs->Unmap (
mPciIoFncs,
snp->SnpDriverUnmap
);
}
mPciIoFncs->FreeBuffer ( mPciIoFncs->FreeBuffer (
mPciIoFncs, mPciIoFncs,
@ -1090,21 +872,12 @@ Error_DeleteSNP:
snp snp
); );
NiiError: NiiError:
if (!UndiNew) { gBS->CloseProtocol (
gBS->CloseProtocol ( Controller,
Controller, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
&gEfiNetworkInterfaceIdentifierProtocolGuid, This->DriverBindingHandle,
This->DriverBindingHandle, Controller
Controller );
);
} else {
gBS->CloseProtocol (
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31,
This->DriverBindingHandle,
Controller
);
}
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,
@ -1163,21 +936,12 @@ SimpleNetworkDriverStop (
return Status; return Status;
} }
if (!Snp->IsOldUndi) { Status = gBS->CloseProtocol (
Status = gBS->CloseProtocol ( Controller,
Controller, &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
&gEfiNetworkInterfaceIdentifierProtocolGuid_31, This->DriverBindingHandle,
This->DriverBindingHandle, Controller
Controller );
);
} else {
Status = gBS->CloseProtocol (
Controller,
&gEfiNetworkInterfaceIdentifierProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
Status = gBS->CloseProtocol ( Status = gBS->CloseProtocol (
Controller, Controller,
@ -1189,38 +953,6 @@ SimpleNetworkDriverStop (
pxe_shutdown (Snp); pxe_shutdown (Snp);
pxe_stop (Snp); pxe_stop (Snp);
if (Snp->IsOldUndi) {
Status = mPciIoFncs->Unmap (
mPciIoFncs,
Snp->FillHdrBufUnmap
);
mPciIoFncs->FreeBuffer (
mPciIoFncs,
SNP_MEM_PAGES (Snp->init_info.MediaHeaderLen),
Snp->fill_hdr_buf
);
Status = mPciIoFncs->Unmap (
mPciIoFncs,
Snp->ReceiveBufUnmap
);
mPciIoFncs->FreeBuffer (
mPciIoFncs,
SNP_MEM_PAGES (Snp->init_info.MediaHeaderLen + Snp->init_info.FrameDataLen),
Snp->receive_buf
);
Status = mPciIoFncs->Unmap (
mPciIoFncs,
Snp->CpbUnmap
);
Status = mPciIoFncs->Unmap (
mPciIoFncs,
Snp->SnpDriverUnmap
);
}
mPciIoFncs->FreeBuffer ( mPciIoFncs->FreeBuffer (
mPciIoFncs, mPciIoFncs,
SNP_MEM_PAGES (4096), SNP_MEM_PAGES (4096),

View File

@ -95,7 +95,7 @@ typedef struct {
EFI_PCI_IO_PROTOCOL *IoFncs; EFI_PCI_IO_PROTOCOL *IoFncs;
UINT8 IoBarIndex; UINT8 IoBarIndex;
UINT8 MemoryBarIndex; UINT8 MemoryBarIndex;
BOOLEAN IsOldUndi; // true for EFI1.0 UNDI (3.0) drivers
// //
// Buffers for command descriptor block, command parameter block // Buffers for command descriptor block, command parameter block
// and data block. // and data block.

View File

@ -33,10 +33,8 @@ pxe_start (
SNP_DRIVER *snp SNP_DRIVER *snp
) )
{ {
PXE_CPB_START_30 *cpb;
PXE_CPB_START_31 *cpb_31; PXE_CPB_START_31 *cpb_31;
cpb = snp->cpb;
cpb_31 = snp->cpb; cpb_31 = snp->cpb;
// //
// Initialize UNDI Start CDB for H/W UNDI // Initialize UNDI Start CDB for H/W UNDI
@ -57,37 +55,23 @@ pxe_start (
// a S/W UNDI. // a S/W UNDI.
// //
if (snp->is_swundi) { if (snp->is_swundi) {
if (snp->IsOldUndi) { snp->cdb.CPBsize = sizeof (PXE_CPB_START_31);
snp->cdb.CPBsize = sizeof (PXE_CPB_START_30); snp->cdb.CPBaddr = (UINT64)(UINTN) cpb_31;
snp->cdb.CPBaddr = (UINT64)(UINTN) cpb;
cpb->Delay = (UINT64)(UINTN) &snp_undi32_callback_delay_30; cpb_31->Delay = (UINT64)(UINTN) &snp_undi32_callback_delay;
cpb->Block = (UINT64)(UINTN) &snp_undi32_callback_block_30; cpb_31->Block = (UINT64)(UINTN) &snp_undi32_callback_block;
// //
// Virtual == Physical. This can be set to zero. // Virtual == Physical. This can be set to zero.
// //
cpb->Virt2Phys = (UINT64)(UINTN) &snp_undi32_callback_v2p_30; cpb_31->Virt2Phys = (UINT64)(UINTN) 0;
cpb->Mem_IO = (UINT64)(UINTN) &snp_undi32_callback_memio_30; cpb_31->Mem_IO = (UINT64)(UINTN) &snp_undi32_callback_memio;
} else {
snp->cdb.CPBsize = sizeof (PXE_CPB_START_31);
snp->cdb.CPBaddr = (UINT64)(UINTN) cpb_31;
cpb_31->Delay = (UINT64)(UINTN) &snp_undi32_callback_delay; cpb_31->Map_Mem = (UINT64)(UINTN) &snp_undi32_callback_map;
cpb_31->Block = (UINT64)(UINTN) &snp_undi32_callback_block; cpb_31->UnMap_Mem = (UINT64)(UINTN) &snp_undi32_callback_unmap;
cpb_31->Sync_Mem = (UINT64)(UINTN) &snp_undi32_callback_sync;
// cpb_31->Unique_ID = (UINT64)(UINTN) snp;
// Virtual == Physical. This can be set to zero.
//
cpb_31->Virt2Phys = (UINT64)(UINTN) 0;
cpb_31->Mem_IO = (UINT64)(UINTN) &snp_undi32_callback_memio;
cpb_31->Map_Mem = (UINT64)(UINTN) &snp_undi32_callback_map;
cpb_31->UnMap_Mem = (UINT64)(UINTN) &snp_undi32_callback_unmap;
cpb_31->Sync_Mem = (UINT64)(UINTN) &snp_undi32_callback_sync;
cpb_31->Unique_ID = (UINT64)(UINTN) snp;
}
} }
// //
// Issue UNDI command and check result. // Issue UNDI command and check result.

View File

@ -52,9 +52,6 @@ pxe_fillheader (
) )
{ {
PXE_CPB_FILL_HEADER_FRAGMENTED *cpb; PXE_CPB_FILL_HEADER_FRAGMENTED *cpb;
EFI_STATUS Status;
struct s_v2p *pkt_v2p;
UINT64 TempData;
cpb = snp->cpb; cpb = snp->cpb;
if (SourceAddrPtr) { if (SourceAddrPtr) {
@ -95,35 +92,6 @@ pxe_fillheader (
cpb->FragDesc[0].reserved = cpb->FragDesc[1].reserved = 0; cpb->FragDesc[0].reserved = cpb->FragDesc[1].reserved = 0;
if (snp->IsOldUndi) {
TempData = (UINT64) (UINTN) MacHeaderPtr;
if (TempData >= FOUR_GIGABYTES) {
cpb->FragDesc[0].FragAddr = (UINT64) (UINTN) snp->fill_hdr_buf;
cpb->FragDesc[0].FragLen = (UINT32) snp->init_info.MediaHeaderLen;
}
TempData = (UINT64) (UINTN) (BufferPtr);
if (TempData >= FOUR_GIGABYTES) {
//
// Let the device just read this buffer
//
Status = add_v2p (
&pkt_v2p,
EfiPciIoOperationBusMasterRead,
BufferPtr,
BufferLength
);
if (Status != EFI_SUCCESS) {
return Status;
}
//
// give the virtual address to UNDI and it will call back on Virt2Phys
// to get the mapped address, if it needs it
//
cpb->FragDesc[1].FragLen = (UINT32) pkt_v2p->bsize;
}
}
snp->cdb.OpCode = PXE_OPCODE_FILL_HEADER; snp->cdb.OpCode = PXE_OPCODE_FILL_HEADER;
snp->cdb.OpFlags = PXE_OPFLAGS_FILL_HEADER_FRAGMENTED; snp->cdb.OpFlags = PXE_OPFLAGS_FILL_HEADER_FRAGMENTED;
@ -145,24 +113,6 @@ pxe_fillheader (
(*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb); (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
if (snp->IsOldUndi) {
TempData = (UINT64) (UINTN) (BufferPtr);
if (TempData >= FOUR_GIGABYTES) {
del_v2p (BufferPtr);
}
//
// if we used the global buffer for header, copy the contents
//
TempData = (UINT64) (UINTN) MacHeaderPtr;
if (TempData >= FOUR_GIGABYTES) {
CopyMem (
MacHeaderPtr,
snp->fill_hdr_buf,
snp->init_info.MediaHeaderLen
);
}
}
switch (snp->cdb.StatCode) { switch (snp->cdb.StatCode) {
case PXE_STATCODE_SUCCESS: case PXE_STATCODE_SUCCESS:
return EFI_SUCCESS; return EFI_SUCCESS;
@ -211,32 +161,10 @@ pxe_transmit (
{ {
PXE_CPB_TRANSMIT *cpb; PXE_CPB_TRANSMIT *cpb;
EFI_STATUS Status; EFI_STATUS Status;
struct s_v2p *v2p;
UINT64 TempData;
cpb = snp->cpb; cpb = snp->cpb;
cpb->FrameAddr = (UINT64) (UINTN) BufferPtr; cpb->FrameAddr = (UINT64) (UINTN) BufferPtr;
cpb->DataLen = (UINT32) BufferLength; cpb->DataLen = (UINT32) BufferLength;
TempData = (UINT64) (UINTN) BufferPtr;
if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
//
// we need to create a mapping now and give it to the undi when it calls
// the Virt2Phys on this address.
// this is a transmit, just map it for the device to READ
//
Status = add_v2p (
&v2p,
EfiPciIoOperationBusMasterRead,
BufferPtr,
BufferLength
);
if (Status != EFI_SUCCESS) {
return Status;
}
cpb->DataLen = (UINT32) v2p->bsize;
}
cpb->MediaheaderLen = 0; cpb->MediaheaderLen = 0;
cpb->reserved = 0; cpb->reserved = 0;