}\r
}\r
\r
- if (PciPtr >= (EFI_LEGACY_EXPANSION_ROM_HEADER *) ((UINTN) 0xc8000)) {\r
- while (TRUE) {\r
- Status = FindNextPnpExpansionHeader (Private, Instance, &PnpPtr);\r
- Instance = NOT_FIRST_INSTANCE;\r
- if (EFI_ERROR (Status)) {\r
- break;\r
- }\r
- //\r
- // There can be additional $PnP headers within the OPROM.\r
- // Example: SCSI can have one per drive.\r
- //\r
- BbsTable[BbsIndex].BootPriority = BBS_UNPRIORITIZED_ENTRY;\r
- BbsTable[BbsIndex].DeviceType = DeviceType;\r
- BbsTable[BbsIndex].Bus = (UINT32) Bus;\r
- BbsTable[BbsIndex].Device = (UINT32) Device;\r
- BbsTable[BbsIndex].Function = (UINT32) Function;\r
- BbsTable[BbsIndex].StatusFlags.OldPosition = 0;\r
- BbsTable[BbsIndex].StatusFlags.Reserved1 = 0;\r
- BbsTable[BbsIndex].StatusFlags.Enabled = 0;\r
- BbsTable[BbsIndex].StatusFlags.Failed = 0;\r
- BbsTable[BbsIndex].StatusFlags.MediaPresent = 0;\r
- BbsTable[BbsIndex].StatusFlags.Reserved2 = 0;\r
- BbsTable[BbsIndex].Class = PnpPtr->Class;\r
- BbsTable[BbsIndex].SubClass = PnpPtr->SubClass;\r
- BbsTable[BbsIndex].DescStringOffset = PnpPtr->ProductNamePointer;\r
- BbsTable[BbsIndex].DescStringSegment = mBbsRomSegment;\r
- BbsTable[BbsIndex].MfgStringOffset = PnpPtr->MfgPointer;\r
- BbsTable[BbsIndex].MfgStringSegment = mBbsRomSegment;\r
- BbsTable[BbsIndex].BootHandlerSegment = mBbsRomSegment;\r
-\r
- //\r
- // Have seen case where PXE base code have PnP expansion ROM\r
- // header but no Bcv or Bev vectors.\r
- //\r
- if (PnpPtr->Bcv != 0) {\r
- BbsTable[BbsIndex].BootHandlerOffset = PnpPtr->Bcv;\r
- ++BbsIndex;\r
- }\r
+ while (TRUE) {\r
+ Status = FindNextPnpExpansionHeader (Private, Instance, &PnpPtr);\r
+ Instance = NOT_FIRST_INSTANCE;\r
+ if (EFI_ERROR (Status)) {\r
+ break;\r
+ }\r
+ //\r
+ // There can be additional $PnP headers within the OPROM.\r
+ // Example: SCSI can have one per drive.\r
+ //\r
+ BbsTable[BbsIndex].BootPriority = BBS_UNPRIORITIZED_ENTRY;\r
+ BbsTable[BbsIndex].DeviceType = DeviceType;\r
+ BbsTable[BbsIndex].Bus = (UINT32) Bus;\r
+ BbsTable[BbsIndex].Device = (UINT32) Device;\r
+ BbsTable[BbsIndex].Function = (UINT32) Function;\r
+ BbsTable[BbsIndex].StatusFlags.OldPosition = 0;\r
+ BbsTable[BbsIndex].StatusFlags.Reserved1 = 0;\r
+ BbsTable[BbsIndex].StatusFlags.Enabled = 0;\r
+ BbsTable[BbsIndex].StatusFlags.Failed = 0;\r
+ BbsTable[BbsIndex].StatusFlags.MediaPresent = 0;\r
+ BbsTable[BbsIndex].StatusFlags.Reserved2 = 0;\r
+ BbsTable[BbsIndex].Class = PnpPtr->Class;\r
+ BbsTable[BbsIndex].SubClass = PnpPtr->SubClass;\r
+ BbsTable[BbsIndex].DescStringOffset = PnpPtr->ProductNamePointer;\r
+ BbsTable[BbsIndex].DescStringSegment = mBbsRomSegment;\r
+ BbsTable[BbsIndex].MfgStringOffset = PnpPtr->MfgPointer;\r
+ BbsTable[BbsIndex].MfgStringSegment = mBbsRomSegment;\r
+ BbsTable[BbsIndex].BootHandlerSegment = mBbsRomSegment;\r
+\r
+ //\r
+ // Have seen case where PXE base code have PnP expansion ROM\r
+ // header but no Bcv or Bev vectors.\r
+ //\r
+ if (PnpPtr->Bcv != 0) {\r
+ BbsTable[BbsIndex].BootHandlerOffset = PnpPtr->Bcv;\r
+ ++BbsIndex;\r
+ }\r
\r
- if (PnpPtr->Bev != 0) {\r
- BbsTable[BbsIndex].BootHandlerOffset = PnpPtr->Bev;\r
- BbsTable[BbsIndex].DeviceType = BBS_BEV_DEVICE;\r
- ++BbsIndex;\r
- }\r
+ if (PnpPtr->Bev != 0) {\r
+ BbsTable[BbsIndex].BootHandlerOffset = PnpPtr->Bev;\r
+ BbsTable[BbsIndex].DeviceType = BBS_BEV_DEVICE;\r
+ ++BbsIndex;\r
+ }\r
\r
- if ((PnpPtr == (LEGACY_PNP_EXPANSION_HEADER *) PciPtr) || (PnpPtr > (LEGACY_PNP_EXPANSION_HEADER *) RomEnd)) {\r
- break;\r
- }\r
+ if ((PnpPtr == (LEGACY_PNP_EXPANSION_HEADER *) PciPtr) || (PnpPtr > (LEGACY_PNP_EXPANSION_HEADER *) RomEnd)) {\r
+ break;\r
}\r
}\r
\r
//\r
// The ROM could have updated it's size so we need to read again.\r
//\r
- if ((((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) &&\r
- (((EFI_LEGACY_EXPANSION_ROM_HEADER *) InitAddress)->Size512 == 0)) {\r
+ if (((EFI_LEGACY_EXPANSION_ROM_HEADER *) RuntimeAddress)->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {\r
//\r
- // The INIT function didn't copy the RUNTIME code to RuntimeAddress\r
+ // Now we check the signature (0xaa55) to judge whether the run-time code is truly generated by INIT function.\r
+ // If signature is not valid, that means the INIT function didn't copy the run-time code to RuntimeAddress.\r
//\r
*RuntimeImageLength = 0;\r
} else {\r