summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-11-09 07:26:24 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-11-09 07:26:24 +0000
commitcfe9de52447337bd470bd831080f5671ed979fe6 (patch)
tree2ddccdf22e0ac37e9308d4a87bca04623c01c7f2 /MdeModulePkg
parent189575e88b25f8b4debd08f03a0a30243faac3df (diff)
downloadedk2-platforms-cfe9de52447337bd470bd831080f5671ed979fe6.tar.xz
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Image.h2
-rw-r--r--MdeModulePkg/Core/Dxe/Image/Image.c3
-rw-r--r--MdeModulePkg/Core/Dxe/Image/ImageFile.c102
3 files changed, 54 insertions, 53 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image.h b/MdeModulePkg/Core/Dxe/Image.h
index 8d57de0111..13936a518e 100644
--- a/MdeModulePkg/Core/Dxe/Image.h
+++ b/MdeModulePkg/Core/Dxe/Image.h
@@ -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
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 99170dca90..e38dfaed7b 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -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);
diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c
index 31b1443697..5d8293a734 100644
--- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c
+++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c
@@ -1,22 +1,22 @@
/*++
-Copyright (c) 2006, 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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
-
+
ImageFile.c
Abstract:
-
+
Revision History
@@ -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
@@ -52,16 +52,16 @@ Arguments:
FilePath - The specific file path from which the image is loaded
DeviceHandle - Pointer to the return device handle.
ImageFileHandle - Pointer to the image file handle.
- AuthenticationStatus - Pointer to a caller-allocated UINT32 in which the authentication status is returned.
-
+ AuthenticationStatus - Pointer to a caller-allocated UINT32 in which the authentication status is returned.
+
Returns:
EFI_SUCCESS - Image file successfully opened.
-
+
EFI_LOAD_ERROR - If the caller passed a copy of the file, and SourceSize is 0.
-
+
EFI_INVALID_PARAMETER - File path is not valid.
-
+
EFI_NOT_FOUND - File not found.
--*/
@@ -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,18 +107,18 @@ 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,
- (VOID*)&FwVol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ (EFI_DEVICE_PATH_PROTOCOL **)&FwVolFilePathNode,
+ (VOID*)&FwVol,
DeviceHandle
);
if (!EFI_ERROR (Status)) {
@@ -131,9 +131,9 @@ Returns:
SectionType = EFI_SECTION_PE32;
Pe32Buffer = NULL;
Status = FwVol->ReadSection (
- FwVol,
- NameGuid,
- SectionType,
+ FwVol,
+ NameGuid,
+ SectionType,
0,
(VOID **)&Pe32Buffer,
&Pe32BufferSize,
@@ -149,8 +149,8 @@ Returns:
}
Pe32Buffer = NULL;
Status = FwVol->ReadFile (
- FwVol,
- NameGuid,
+ FwVol,
+ NameGuid,
(VOID **)&Pe32Buffer,
&Pe32BufferSize,
&Type,
@@ -158,7 +158,7 @@ Returns:
AuthenticationStatus
);
}
-
+
if (!EFI_ERROR (Status)) {
//
// One of the reads passed so we are done
@@ -174,11 +174,11 @@ 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,
- (VOID*)&Volume,
+ &gEfiSimpleFileSystemProtocolGuid,
+ (EFI_DEVICE_PATH_PROTOCOL **)&FilePathNode,
+ (VOID*)&Volume,
DeviceHandle
);
if (!EFI_ERROR (Status)) {
@@ -187,7 +187,7 @@ Returns:
//
Status = Volume->OpenVolume (Volume, &FileHandle);
if (!EFI_ERROR (Status)) {
-
+
//
// Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the
// directory information and filename can be seperate. The goal is to inch
@@ -239,7 +239,7 @@ Returns:
FileHandle,
&gEfiFileInfoGuid,
&FileInfoSize,
- FileInfo
+ FileInfo
);
}
if (!EFI_ERROR (Status)) {
@@ -267,14 +267,14 @@ Returns:
}
}
}
- }
+ }
//
// Try LoadFile style
//
- TempFilePath = FilePath;
+ TempFilePath = *FilePath;
Status = CoreDevicePathToInterface (
&gEfiLoadFileProtocolGuid,
&TempFilePath,
@@ -350,12 +350,12 @@ Routine Description:
Arguments:
UserHandle - Image file handle
-
+
Offset - Offset to the source file
-
+
ReadSize - For input, pointer of size to read;
For output, pointer of size actually read.
-
+
Buffer - Buffer to write into
Returns:
@@ -376,7 +376,7 @@ Returns:
EndPosition = Offset + *ReadSize;
if (EndPosition > FHand->SourceSize) {
*ReadSize = (UINT32)(FHand->SourceSize - Offset);
- }
+ }
if (Offset >= FHand->SourceSize) {
*ReadSize = 0;
}
@@ -402,13 +402,13 @@ Routine Description:
Arguments:
Protocol - The protocol to search for
-
+
FilePath - The specified device path
-
+
Interface - Interface of the protocol on the handle
-
+
Handle - The handle to the device on the specified device path that supports the protocol.
-
+
Returns:
Status code.
@@ -435,7 +435,7 @@ CoreGrowBuffer (
Routine Description:
Helper function called as part of the code needed
- to allocate the proper sized buffer for various
+ to allocate the proper sized buffer for various
EFI interfaces.
Arguments:
@@ -445,10 +445,10 @@ Arguments:
Buffer - Current allocated buffer, or NULL
BufferSize - Current buffer size needed
-
+
Returns:
-
- TRUE - if the buffer was reallocated and the caller
+
+ TRUE - if the buffer was reallocated and the caller
should try the API again.
FALSE - buffer could not be allocated and the caller
@@ -473,7 +473,7 @@ Returns:
//
// If the status code is "buffer too small", resize the buffer
//
-
+
if (*Status == EFI_BUFFER_TOO_SMALL) {
if (*Buffer != NULL) {
CoreFreePool (*Buffer);
@@ -482,9 +482,9 @@ Returns:
*Buffer = CoreAllocateBootServicesPool (BufferSize);
if (*Buffer != NULL) {
TryAgain = TRUE;
- } else {
+ } else {
*Status = EFI_OUT_OF_RESOURCES;
- }
+ }
}
//