/**@file\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
// Module global for a template of the PCI option ROM Image Device Path Node\r
//\r
MEMMAP_DEVICE_PATH mPciOptionRomImageDevicePathNodeTemplate = {\r
- { \r
+ {\r
HARDWARE_DEVICE_PATH,\r
HW_MEMMAP_DP,\r
sizeof (MEMMAP_DEVICE_PATH)\r
/*++\r
\r
Routine Description:\r
- \r
+\r
Load option rom image for specified PCI device\r
\r
Arguments:\r
gBS->FreePool (RomPcir);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- \r
+\r
//\r
// Copy Rom image into memory\r
//\r
for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {\r
PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllZero);\r
}\r
- \r
+\r
//\r
// set the Rom base address: now is hardcode\r
// enable its decoder\r
PciEnableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);\r
\r
} else {\r
- \r
+\r
//\r
// disable command register decode to memory\r
//\r
Routine Description:\r
\r
Process the oprom image.\r
- \r
+\r
Arguments:\r
PciDevice A pointer to a pci device.\r
\r
Returns:\r
\r
EFI Status.\r
- \r
+\r
--*/\r
{\r
UINT8 Indicator;\r
ImageSize = (UINT32) (Pcir->ImageLength * 512);\r
Indicator = Pcir->Indicator;\r
\r
- if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) && \r
+ if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&\r
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE)) {\r
\r
if ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||\r
}\r
\r
if (!SkipImage) {\r
- // \r
- // Build full device path to the PCI Option ROM Image being loaded\r
//\r
- mPciOptionRomImageDevicePathNodeTemplate.StartingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)RomBarOffset;\r
- mPciOptionRomImageDevicePathNodeTemplate.EndingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(RomBarOffset + ImageSize - 1);\r
+ // Build Memory Mapped device path node to record the image offset into the PCI Option ROM\r
+ //\r
+ mPciOptionRomImageDevicePathNodeTemplate.StartingAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) (RomBarOffset - (UINT8 *) RomBar);\r
+ mPciOptionRomImageDevicePathNodeTemplate.EndingAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) (RomBarOffset + ImageSize - 1 - (UINT8 *) RomBar);\r
PciOptionRomImageDevicePath = AppendDevicePathNode (PciDevice->DevicePath, (const EFI_DEVICE_PATH_PROTOCOL *)&mPciOptionRomImageDevicePathNodeTemplate);\r
ASSERT (PciOptionRomImageDevicePath != NULL);\r
\r