X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=OptionRomPkg%2FUndiRuntimeDxe%2FDecode.c;h=cff694269144bce2e8c5b3124dc3a85bb91ac516;hb=bb207f6cda96640d1df0fd573689ca6764e48db4;hp=56a70127872eed1a44f85ba7f5e6783cab0ea97d;hpb=ac1ca10416edf34b6700a31d0bc58d144e35974c;p=mirror_edk2.git diff --git a/OptionRomPkg/UndiRuntimeDxe/Decode.c b/OptionRomPkg/UndiRuntimeDxe/Decode.c index 56a7012787..cff6942691 100644 --- a/OptionRomPkg/UndiRuntimeDxe/Decode.c +++ b/OptionRomPkg/UndiRuntimeDxe/Decode.c @@ -1,7 +1,7 @@ /** @file Provides the basic UNID functions. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials 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 @@ -254,9 +254,9 @@ UNDI_GetInitInfo ( DbPtr->MCastFilterCnt = MAX_MCAST_ADDRESS_CNT; DbPtr->TxBufCnt = TX_BUFFER_COUNT; - DbPtr->TxBufSize = sizeof (TxCB); + DbPtr->TxBufSize = (UINT16) sizeof (TxCB); DbPtr->RxBufCnt = RX_BUFFER_COUNT; - DbPtr->RxBufSize = sizeof (RxFD); + DbPtr->RxBufSize = (UINT16) sizeof (RxFD); DbPtr->IFtype = PXE_IFTYPE_ETHERNET; DbPtr->SupportedDuplexModes = PXE_DUPLEX_ENABLE_FULL_SUPPORTED | @@ -1032,7 +1032,7 @@ UNDI_Status ( // // We already filled in 2 UINT32s. // - CdbPtr->DBsize = sizeof (UINT32) * 2; + CdbPtr->DBsize = (UINT16) (sizeof (UINT32) * 2); // // will claim any hanging free CBs @@ -1042,7 +1042,7 @@ UNDI_Status ( if (AdapterInfo->xmit_done_head == AdapterInfo->xmit_done_tail) { CdbPtr->StatFlags |= PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY; } else { - for (Index = 0; NumEntries >= sizeof (UINT64); Index++, NumEntries -= sizeof (UINT64)) { + for (Index = 0; ((Index < MAX_XMIT_BUFFERS) && (NumEntries >= sizeof (UINT64))); Index++, NumEntries -= sizeof (UINT64)) { if (AdapterInfo->xmit_done_head != AdapterInfo->xmit_done_tail) { DbPtr->TxBuffer[Index] = AdapterInfo->xmit_done[AdapterInfo->xmit_done_head]; AdapterInfo->xmit_done_head = next (AdapterInfo->xmit_done_head); @@ -1276,6 +1276,7 @@ UNDI_Receive ( **/ // TODO: cdb - add argument and description to function comment VOID +EFIAPI UNDI_APIEntry_new ( IN UINT64 cdb ) @@ -1290,7 +1291,7 @@ UNDI_APIEntry_new ( 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->StatCode = PXE_STATCODE_INVALID_CDB; return ; @@ -1336,7 +1337,7 @@ UNDI_APIEntry_Common ( if ((CdbPtr->OpCode > PXE_OPCODE_LAST_VALID) || (CdbPtr->StatCode != PXE_STATCODE_INITIALIZE) || (CdbPtr->StatFlags != PXE_STATFLAGS_INITIALIZE) || - (CdbPtr->IFnum >= pxe_31->IFcnt) ) { + (CdbPtr->IFnum >= (pxe_31->IFcnt | pxe_31->IFcntExt << 8))) { goto badcdb; } @@ -1436,24 +1437,28 @@ PxeUpdate ( IN PXE_SW_UNDI *PxePtr ) { + UINT16 NicNum; + NicNum = (PxePtr->IFcnt | PxePtr->IFcntExt << 8); + if (NicPtr == NULL) { - if (PxePtr->IFcnt > 0) { + if (NicNum > 0) { // // number of NICs this undi supports // - PxePtr->IFcnt--; + NicNum --; } - - PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len)); - return ; + goto done; } // // number of NICs this undi supports // - PxePtr->IFcnt++; + NicNum++; + +done: + PxePtr->IFcnt = (UINT8)(NicNum & 0xFF); + PxePtr->IFcntExt = (UINT8) ((NicNum & 0xFF00) >> 8); PxePtr->Fudge = (UINT8) (PxePtr->Fudge - CalculateSum8 ((VOID *) PxePtr, PxePtr->Len)); - return ; } @@ -1476,7 +1481,7 @@ PxeStructInit ( // Initialize the !PXE structure // PxePtr->Signature = PXE_ROMID_SIGNATURE; - PxePtr->Len = sizeof (PXE_SW_UNDI); + PxePtr->Len = (UINT8) sizeof (PXE_SW_UNDI); // // cksum // @@ -1485,6 +1490,7 @@ PxeStructInit ( // number of NICs this undi supports // PxePtr->IFcnt = 0; + PxePtr->IFcntExt = 0; PxePtr->Rev = PXE_ROMID_REV; PxePtr->MajorVer = PXE_ROMID_MAJORVER; PxePtr->MinorVer = PXE_ROMID_MINORVER;