Update the structure of EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL, PXE_HW_UNDI, PXE_SW_UNDI to support greater than 256NICs in UNDI (Request by UEFI2.4 Mantis991).

Signed-off-by: Qian Ouyang <qian.ouyang@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
             Siyuan Fu <siyuan.fu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14569 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Qian Ouyang 2013-08-20 02:22:00 +00:00 committed by qianouyang
parent 2e969d2e9e
commit 61f2ab909d
5 changed files with 43 additions and 27 deletions

View File

@ -410,8 +410,13 @@ SimpleNetworkDriverStart (
Snp->TxRxBufferSize = 0; Snp->TxRxBufferSize = 0;
Snp->TxRxBuffer = NULL; Snp->TxRxBuffer = NULL;
if (Nii->Revision >= EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION) {
Snp->IfNum = Nii->IfNum;
Snp->IfNum = Nii->IfNum; } else {
Snp->IfNum = (UINT8) (Nii->IfNum & 0xFF);
}
if ((Pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) != 0) { if ((Pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) != 0) {
Snp->IsSwUndi = FALSE; Snp->IsSwUndi = FALSE;

View File

@ -1,7 +1,7 @@
/** @file /** @file
EFI Network Interface Identifier Protocol. EFI Network Interface Identifier Protocol.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution. the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at The full text of the license may be found at
@ -34,7 +34,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
0x1ACED566, 0x76ED, 0x4218, {0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } \ 0x1ACED566, 0x76ED, 0x4218, {0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } \
} }
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00010000 //
// Revision defined in UEFI Specification 2.4
//
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00020000
/// ///
/// Revision defined in EFI1.1. /// Revision defined in EFI1.1.
@ -70,9 +74,9 @@ struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {
UINT8 MajorVer; ///< Major version number. UINT8 MajorVer; ///< Major version number.
UINT8 MinorVer; ///< Minor version number. UINT8 MinorVer; ///< Minor version number.
BOOLEAN Ipv6Supported; ///< TRUE if the network interface supports IPv6; otherwise FALSE. BOOLEAN Ipv6Supported; ///< TRUE if the network interface supports IPv6; otherwise FALSE.
UINT8 IfNum; ///< The network interface number that is being identified by this Network UINT16 IfNum; ///< The network interface number that is being identified by this Network
///< Interface Identifier Protocol. This field must be less than or equal ///< Interface Identifier Protocol. This field must be less than or
///< to the IFcnt field in the !PXE structure. ///< equal to the (IFcnt | IFcntExt <<8 ) fields in the !PXE structure.
}; };

View File

@ -3,7 +3,7 @@
structure prototypes, global variables and constants that structure prototypes, global variables and constants that
are needed for porting PXE to EFI. are needed for porting PXE to EFI.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution. the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at The full text of the license may be found at
@ -719,10 +719,11 @@ typedef struct s_pxe_hw_undi {
PXE_UINT8 Len; ///< sizeof(PXE_HW_UNDI). PXE_UINT8 Len; ///< sizeof(PXE_HW_UNDI).
PXE_UINT8 Fudge; ///< makes 8-bit cksum equal zero. PXE_UINT8 Fudge; ///< makes 8-bit cksum equal zero.
PXE_UINT8 Rev; ///< PXE_ROMID_REV. PXE_UINT8 Rev; ///< PXE_ROMID_REV.
PXE_UINT8 IFcnt; ///< physical connector count. PXE_UINT8 IFcnt; ///< physical connector count lower byte.
PXE_UINT8 MajorVer; ///< PXE_ROMID_MAJORVER. PXE_UINT8 MajorVer; ///< PXE_ROMID_MAJORVER.
PXE_UINT8 MinorVer; ///< PXE_ROMID_MINORVER. PXE_UINT8 MinorVer; ///< PXE_ROMID_MINORVER.
PXE_UINT16 reserved; ///< zero, not used. PXE_UINT8 IFcntExt; ///< physical connector count upper byte.
PXE_UINT8 reserved; ///< zero, not used.
PXE_UINT32 Implementation; ///< implementation flags. PXE_UINT32 Implementation; ///< implementation flags.
///< reserved ///< vendor use. ///< reserved ///< vendor use.
///< UINT32 Status; ///< status port. ///< UINT32 Status; ///< status port.
@ -815,10 +816,11 @@ typedef struct s_pxe_sw_undi {
PXE_UINT8 Len; ///< sizeof(PXE_SW_UNDI). PXE_UINT8 Len; ///< sizeof(PXE_SW_UNDI).
PXE_UINT8 Fudge; ///< makes 8-bit cksum zero. PXE_UINT8 Fudge; ///< makes 8-bit cksum zero.
PXE_UINT8 Rev; ///< PXE_ROMID_REV. PXE_UINT8 Rev; ///< PXE_ROMID_REV.
PXE_UINT8 IFcnt; ///< physical connector count. PXE_UINT8 IFcnt; ///< physical connector count lower byte.
PXE_UINT8 MajorVer; ///< PXE_ROMID_MAJORVER. PXE_UINT8 MajorVer; ///< PXE_ROMID_MAJORVER.
PXE_UINT8 MinorVer; ///< PXE_ROMID_MINORVER. PXE_UINT8 MinorVer; ///< PXE_ROMID_MINORVER.
PXE_UINT16 reserved1; ///< zero, not used. PXE_UINT8 IFcntExt; ///< physical connector count upper byte.
PXE_UINT8 reserved1; ///< zero, not used.
PXE_UINT32 Implementation; ///< Implementation flags. PXE_UINT32 Implementation; ///< Implementation flags.
PXE_UINT64 EntryPoint; ///< API entry point. PXE_UINT64 EntryPoint; ///< API entry point.
PXE_UINT8 reserved2[3]; ///< zero, not used. PXE_UINT8 reserved2[3]; ///< zero, not used.

View File

@ -1,7 +1,7 @@
/** @file /** @file
Provides the basic UNID functions. Provides the basic UNID functions.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials 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
@ -1290,7 +1290,7 @@ UNDI_APIEntry_new (
CdbPtr = (PXE_CDB *) (UINTN) cdb; CdbPtr = (PXE_CDB *) (UINTN) cdb;
if (CdbPtr->IFnum >= pxe_31->IFcnt) { if (CdbPtr->IFnum >= (pxe_31->IFcnt | pxe_31->IFcntExt << 8) ) {
CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED; CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB; CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
return ; return ;
@ -1336,7 +1336,7 @@ UNDI_APIEntry_Common (
if ((CdbPtr->OpCode > PXE_OPCODE_LAST_VALID) || if ((CdbPtr->OpCode > PXE_OPCODE_LAST_VALID) ||
(CdbPtr->StatCode != PXE_STATCODE_INITIALIZE) || (CdbPtr->StatCode != PXE_STATCODE_INITIALIZE) ||
(CdbPtr->StatFlags != PXE_STATFLAGS_INITIALIZE) || (CdbPtr->StatFlags != PXE_STATFLAGS_INITIALIZE) ||
(CdbPtr->IFnum >= pxe_31->IFcnt) ) { (CdbPtr->IFnum >= (pxe_31->IFcnt | pxe_31->IFcntExt << 8) ) {
goto badcdb; goto badcdb;
} }
@ -1436,24 +1436,28 @@ PxeUpdate (
IN PXE_SW_UNDI *PxePtr IN PXE_SW_UNDI *PxePtr
) )
{ {
UINT16 NicNum;
NicNum = (PxePtr->IFcnt | PxePtr->IFcntEx << 8);
if (NicPtr == NULL) { if (NicPtr == NULL) {
if (PxePtr->IFcnt > 0) { if (NicNum > 0) {
// //
// number of NICs this undi supports // number of NICs this undi supports
// //
PxePtr->IFcnt--; NicNum --;
} }
goto done;
PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len));
return ;
} }
// //
// number of NICs this undi supports // number of NICs this undi supports
// //
PxePtr->IFcnt++; NicNum++;
done:
PxePtr->IFcnt = (UINT8)(NicNum & 0xFF);
PxePtr->IFcntEx = (UINT8) ((NicNum & 0xFF00) >> 8);
PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len)); PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len));
return ; return ;
} }
@ -1485,6 +1489,7 @@ PxeStructInit (
// number of NICs this undi supports // number of NICs this undi supports
// //
PxePtr->IFcnt = 0; PxePtr->IFcnt = 0;
PxePtr->IFcntEx = 0;
PxePtr->Rev = PXE_ROMID_REV; PxePtr->Rev = PXE_ROMID_REV;
PxePtr->MajorVer = PXE_ROMID_MAJORVER; PxePtr->MajorVer = PXE_ROMID_MAJORVER;
PxePtr->MinorVer = PXE_ROMID_MINORVER; PxePtr->MinorVer = PXE_ROMID_MINORVER;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Initialization functions for EFI UNDI32 driver. Initialization functions for EFI UNDI32 driver.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials 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
@ -64,7 +64,7 @@ UndiNotifyVirtual (
// //
// UNDI32DeviceList is an array of pointers // UNDI32DeviceList is an array of pointers
// //
for (Index = 0; Index < pxe_31->IFcnt; Index++) { for (Index = 0; Index < (pxe_31->IFcnt | pxe_31->IFcntExt << 8); Index++) {
UNDI32DeviceList[Index]->NIIProtocol_31.Id = (UINT64) (UINTN) Pxe31Pointer; UNDI32DeviceList[Index]->NIIProtocol_31.Id = (UINT64) (UINTN) Pxe31Pointer;
EfiConvertPointer ( EfiConvertPointer (
EFI_OPTIONAL_PTR, EFI_OPTIONAL_PTR,
@ -409,7 +409,7 @@ UndiDriverStart (
// 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_31.IfNum = pxe_31->IFcnt; UNDI32Device->NIIProtocol_31.IfNum = pxe_31->IFcnt | pxe_31->IFcntExt << 8;
PxeUpdate (&UNDI32Device->NicInfo, pxe_31); PxeUpdate (&UNDI32Device->NicInfo, pxe_31);
@ -470,7 +470,7 @@ UndiDriverStart (
goto UndiErrorDeleteDevicePath; goto UndiErrorDeleteDevicePath;
} }
Len = (pxe_31->IFcnt * sizeof (UndiDataPointer->NII_entry)) + sizeof (UndiDataPointer); Len = ((pxe_31->IFcnt|pxe_31->IFcntExt << 8)* sizeof (UndiDataPointer->NII_entry)) + sizeof (UndiDataPointer);
Status = gBS->AllocatePool (EfiRuntimeServicesData, Len, (VOID **) &UndiDataPointer); Status = gBS->AllocatePool (EfiRuntimeServicesData, Len, (VOID **) &UndiDataPointer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -949,10 +949,10 @@ InstallConfigTable (
UndiData = (UNDI_CONFIG_TABLE *)UndiDataPointer; UndiData = (UNDI_CONFIG_TABLE *)UndiDataPointer;
UndiData->NumberOfInterfaces = pxe_31->IFcnt; UndiData->NumberOfInterfaces = (pxe_31->IFcnt | pxe_31->IFcntExt << 8);
UndiData->nextlink = NULL; UndiData->nextlink = NULL;
for (Index = 0; Index < pxe_31->IFcnt; Index++) { for (Index = 0; Index < (pxe_31->IFcnt | pxe_31->IFcntExt << 8); Index++) {
UndiData->NII_entry[Index].NII_InterfacePointer = &UNDI32DeviceList[Index]->NIIProtocol_31; UndiData->NII_entry[Index].NII_InterfacePointer = &UNDI32DeviceList[Index]->NIIProtocol_31;
UndiData->NII_entry[Index].DevicePathPointer = UNDI32DeviceList[Index]->Undi32DevPath; UndiData->NII_entry[Index].DevicePathPointer = UNDI32DeviceList[Index]->Undi32DevPath;
} }