1. CoreOpenImageFile(): FilePath should be IN OUT.

2. Use offset address to build device path instead of absolute address.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4294 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2007-11-09 07:26:24 +00:00
parent 189575e88b
commit cfe9de5244
4 changed files with 74 additions and 73 deletions

View File

@ -1,6 +1,6 @@
/**@file
Copyright (c) 2006, Intel Corporation
Copyright (c) 2006 - 2007, 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
@ -521,10 +521,10 @@ Returns:
if (!SkipImage) {
//
// Build full device path to the PCI Option ROM Image being loaded
// Build Memory Mapped device path node to record the image offset into the PCI Option ROM
//
mPciOptionRomImageDevicePathNodeTemplate.StartingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)RomBarOffset;
mPciOptionRomImageDevicePathNodeTemplate.EndingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(RomBarOffset + ImageSize - 1);
mPciOptionRomImageDevicePathNodeTemplate.StartingAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) (RomBarOffset - (UINT8 *) RomBar);
mPciOptionRomImageDevicePathNodeTemplate.EndingAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) (RomBarOffset + ImageSize - 1 - (UINT8 *) RomBar);
PciOptionRomImageDevicePath = AppendDevicePathNode (PciDevice->DevicePath, (const EFI_DEVICE_PATH_PROTOCOL *)&mPciOptionRomImageDevicePathNodeTemplate);
ASSERT (PciOptionRomImageDevicePath != NULL);

View File

@ -100,7 +100,7 @@ CoreOpenImageFile (
IN BOOLEAN BootPolicy,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
OUT EFI_HANDLE *DeviceHandle,
IN IMAGE_FILE_HANDLE *ImageFileHandle,
OUT UINT32 *AuthenticationStatus

View File

@ -639,7 +639,7 @@ Returns:
BootPolicy,
SourceBuffer,
SourceSize,
FilePath,
&FilePath,
&DeviceHandle,
&FHand,
&AuthenticationStatus
@ -679,6 +679,7 @@ Returns:
//
// Pull out just the file portion of the DevicePath for the LoadedImage FilePath
//
FilePath = OriginalFilePath;
Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath);
if (!EFI_ERROR (Status)) {
FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);

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
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
@ -30,7 +30,7 @@ CoreOpenImageFile (
IN BOOLEAN BootPolicy,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
OUT EFI_HANDLE *DeviceHandle,
IN IMAGE_FILE_HANDLE *ImageFileHandle,
OUT UINT32 *AuthenticationStatus
@ -95,7 +95,7 @@ Returns:
ImageFileHandle->Source = SourceBuffer;
ImageFileHandle->SourceSize = SourceSize;
*DeviceHandle = NULL;
CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, &FilePath, DeviceHandle);
CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, FilePath, DeviceHandle);
if (SourceSize > 0) {
Status = EFI_SUCCESS;
} else {
@ -107,14 +107,14 @@ Returns:
//
// Make sure FilePath is valid
//
if (FilePath == NULL) {
if (*FilePath == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// Check to see if it's in a Firmware Volume
//
FwVolFilePathNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)FilePath;
FwVolFilePathNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) *FilePath;
Status = CoreDevicePathToInterface (
&gEfiFirmwareVolume2ProtocolGuid,
(EFI_DEVICE_PATH_PROTOCOL **)&FwVolFilePathNode,
@ -174,7 +174,7 @@ Returns:
//
// Attempt to access the file via a file system interface
//
FilePathNode = (FILEPATH_DEVICE_PATH *) FilePath;
FilePathNode = (FILEPATH_DEVICE_PATH *) *FilePath;
Status = CoreDevicePathToInterface (
&gEfiSimpleFileSystemProtocolGuid,
(EFI_DEVICE_PATH_PROTOCOL **)&FilePathNode,
@ -274,7 +274,7 @@ Returns:
// Try LoadFile style
//
TempFilePath = FilePath;
TempFilePath = *FilePath;
Status = CoreDevicePathToInterface (
&gEfiLoadFileProtocolGuid,
&TempFilePath,