X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelFrameworkPkg%2FLibrary%2FDxeSmmDriverEntryPoint%2FDriverEntryPoint.c;h=e6892cbafefd3527b3e20477505a956fdb50d345;hp=38873a0bf9b32edf8a1190adbe0561511c498db9;hb=2b649f74775d0efd1e75c91f77c3045ae6249cb4;hpb=834a2e41fb7e3b3aadd0040e1b684caf01f4f4d2 diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c index 38873a0bf9..e6892cbafe 100644 --- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c +++ b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c @@ -3,8 +3,8 @@ EfiMain() is common driver entry point for all SMM driver who uses DxeSmmDriverEntryPoint library class. -Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials +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 @@ -21,10 +21,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#include +#include #include #include - +#include /** This function returns the size, in bytes, @@ -36,7 +36,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return The size of a device path in bytes. **/ -STATIC UINTN EFIAPI SmmGetDevicePathSize ( @@ -53,8 +52,8 @@ SmmGetDevicePathSize ( // Search for the end of the device path structure // Start = DevicePath; - while (!EfiIsDevicePathEnd (DevicePath)) { - DevicePath = EfiNextDevicePathNode (DevicePath); + while (!IsDevicePathEnd (DevicePath)) { + DevicePath = NextDevicePathNode (DevicePath); } // @@ -175,16 +174,6 @@ _ModuleEntryPoint ( // gBS = SystemTable->BootServices; - // - // Retrieve the Loaded Image Protocol - // - Status = gBS->HandleProtocol ( - ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID*)&LoadedImage - ); - ASSERT_EFI_ERROR (Status); - // // Retrieve SMM Base Protocol // @@ -205,7 +194,16 @@ _ModuleEntryPoint ( // if (!InSmm) { // - // Retrieve the Device Path Protocol from the DeviceHandle tha this driver was loaded from + // Retrieve the Loaded Image Protocol + // + Status = gBS->HandleProtocol ( + ImageHandle, + &gEfiLoadedImageProtocolGuid, + (VOID*)&LoadedImage + ); + ASSERT_EFI_ERROR (Status); + // + // Retrieve the Device Path Protocol from the DeviceHandle from which this driver was loaded // Status = gBS->HandleProtocol ( LoadedImage->DeviceHandle, @@ -223,8 +221,21 @@ _ModuleEntryPoint ( // Load the image in memory to SMRAM; it will automatically generate the // SMI. // - Status = SmmBase->Register (SmmBase, CompleteFilePath, NULL, 0, &Handle, FALSE); + Status = SmmBase->Register (SmmBase, CompleteFilePath, LoadedImage->ImageBase, 0, &Handle, FALSE); ASSERT_EFI_ERROR (Status); + // + // Optionally install the unload handler + // + if (_gDriverUnloadImageCount > 0) { + Status = gBS->HandleProtocol ( + ImageHandle, + &gEfiLoadedImageProtocolGuid, + (VOID **)&LoadedImage + ); + ASSERT_EFI_ERROR (Status); + LoadedImage->Unload = _DriverUnloadHandler; + } + return Status; } @@ -233,19 +244,6 @@ _ModuleEntryPoint ( // ProcessLibraryConstructorList (ImageHandle, SystemTable); - // - // Optionally install the unload handler - // - if (_gDriverUnloadImageCount > 0) { - Status = gBS->HandleProtocol ( - ImageHandle, - &gEfiLoadedImageProtocolGuid, - (VOID **)&LoadedImage - ); - ASSERT_EFI_ERROR (Status); - LoadedImage->Unload = _DriverUnloadHandler; - } - // // Call the list of driver entry points //