1. Add EFI LOADED IMAGE DEVICE PATH Protocol in LoadImage() service, per UEFI 2.1b.
authorvanjeff <vanjeff@de2fecce-e211-0410-80a6-f3fac2684e05>
Tue, 26 Feb 2008 08:38:29 +0000 (08:38 +0000)
committervanjeff <vanjeff@de2fecce-e211-0410-80a6-f3fac2684e05>
Tue, 26 Feb 2008 08:38:29 +0000 (08:38 +0000)
2. Update comments for DHCP.transmitreceive().
2. Update UefiPxeBcDxe.inf and PxeBcDxe.inf to assign correct protocol usages.

git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@4758 de2fecce-e211-0410-80a6-f3fac2684e05

edk2/MdeModulePkg/Core/Dxe/DxeMain.inf
edk2/MdeModulePkg/Core/Dxe/Image.h
edk2/MdeModulePkg/Core/Dxe/Image/Image.c
edk2/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
edk2/MdeModulePkg/Universal/Network/PxeBcDxe/PxeBcDxe.inf
edk2/MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf

index 8f8a22f..595c3d2 100644 (file)
   gEfiLoadedImageProtocolGuid                   # PROTOCOL ALWAYS_PRODUCED\r
   gEfiEbcProtocolGuid                           # PROTOCOL SOMETIMES_CONSUMED\r
   gEfiTcgPlatformProtocolGuid\r
+  gEfiLoadedImageDevicePathProtocolGuid         # PROTOCOL ALWAYS_PRODUCED\r
 \r
 [FixedPcd.common]\r
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeCoreEntry | 0x3041000          # EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT\r
index 8ad1f9b..eeeb3ab 100644 (file)
@@ -55,7 +55,7 @@ typedef struct {
 \r
     EFI_RUNTIME_IMAGE_ENTRY     *RuntimeData;   // Runtime image list\r
 \r
-    EFI_DEVICE_PATH_PROTOCOL      *DeviceHandleDevicePath;\r
+    EFI_DEVICE_PATH_PROTOCOL    *LoadedImageDevicePath;  // Pointer to Loaded Image Device Path Protocl\r
 \r
     PE_COFF_LOADER_IMAGE_CONTEXT  ImageContext; // PeCoffLoader ImageContext\r
 \r
index 56c5fe5..125134d 100644 (file)
@@ -74,7 +74,7 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage  = {
   0,                          // Machine\r
   NULL,                       // Ebc\r
   NULL,                       // RuntimeData\r
-  NULL,                       // DeviceHandleDevicePath\r
+  NULL                        // LoadedImageDevicePath\r
 };\r
 \r
 \r
@@ -714,7 +714,6 @@ Returns:
   if (!EFI_ERROR (Status)) {\r
     FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
     FilePath = (EFI_DEVICE_PATH_PROTOCOL *) ( ((UINT8 *)FilePath) + FilePathSize );\r
-    Image->DeviceHandleDevicePath = CoreDuplicateDevicePath (HandleFilePath);\r
   }\r
 \r
   //\r
@@ -782,6 +781,26 @@ Returns:
     goto Done;\r
   }\r
 \r
+  //\r
+  // If DevicePath parameter to the LoadImage() is not NULL, then make a copy of DevicePath,\r
+  // otherwise Loaded Image Device Path Protocol is installed with a NULL interface pointer.\r
+  //\r
+  if (OriginalFilePath != NULL) {\r
+    Image->LoadedImageDevicePath = CoreDuplicateDevicePath (OriginalFilePath);\r
+  }\r
+\r
+  //\r
+  // Install Loaded Image Device Path Protocol onto the image handle of a PE/COFE image\r
+  //\r
+  Status = CoreInstallProtocolInterface (\r
+            &Image->Handle,\r
+            &gEfiLoadedImageDevicePathProtocolGuid,\r
+            EFI_NATIVE_INTERFACE,\r
+            Image->LoadedImageDevicePath\r
+            );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Done;\r
+  }\r
 \r
   //\r
   // Success.  Return the image handle\r
@@ -1208,11 +1227,18 @@ Returns:
 \r
     CoreRemoveDebugImageInfoEntry (Image->Handle);\r
 \r
+    Status = CoreUninstallProtocolInterface (\r
+               Image->Handle,\r
+               &gEfiLoadedImageDevicePathProtocolGuid,\r
+               Image->LoadedImageDevicePath\r
+               );\r
+\r
     Status = CoreUninstallProtocolInterface (\r
                Image->Handle,\r
                &gEfiLoadedImageProtocolGuid,\r
                &Image->Info\r
                );\r
+\r
   }\r
 \r
   if (Image->RuntimeData != NULL) {\r
@@ -1239,8 +1265,8 @@ Returns:
     CoreFreePool (Image->Info.FilePath);\r
   }\r
 \r
-  if (Image->DeviceHandleDevicePath != NULL) {\r
-    CoreFreePool (Image->DeviceHandleDevicePath);\r
+  if (Image->LoadedImageDevicePath != NULL) {\r
+    CoreFreePool (Image->LoadedImageDevicePath);\r
   }\r
 \r
   if (Image->FixupData != NULL) {\r
index 09de4cd..514e33e 100644 (file)
@@ -984,13 +984,18 @@ SIGNAL_USER:
 \r
 \r
 /**\r
-  Transmit and receive a packet through this DHCP service.\r
-  This is unsupported.\r
-\r
-  @param  This                   The DHCP protocol instance\r
-  @param  Token                  The transmit and receive instance\r
-\r
-  @retval EFI_UNSUPPORTED        It always returns unsupported.\r
+  Transmits a DHCP formatted packet and optionally waits for responses.\r
+\r
+  @param  This    Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  Token   Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
+\r
+  @retval EFI_SUCCESS           The packet was successfully queued for transmission.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+  @retval EFI_NOT_READY         The previous call to this function has not finished yet. Try to call\r
+                                this function after collection process completes.\r
+  @retval EFI_NO_MAPPING        The default station address is not available yet.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval Others                Some other unexpected error occurred.\r
 \r
 **/\r
 STATIC\r
index 99c5363..1971731 100644 (file)
@@ -81,8 +81,8 @@
 \r
 [Protocols]\r
   gEfiBisProtocolGuid                             # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiPxeBaseCodeCallbackProtocolGuid             # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiPxeBaseCodeProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiPxeBaseCodeCallbackProtocolGuid             # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiPxeBaseCodeProtocolGuid                     # PROTOCOL ALWAYS_PRODUCED\r
   gEfiLoadFileProtocolGuid                        # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSimpleNetworkProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDevicePathProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
index bc1bafb..fd4ab6b 100644 (file)
@@ -83,9 +83,9 @@
   gEfiMtftp4ProtocolGuid                           # PROTOCOL ALWAYS_CONSUMED\r
   gEfiUdp4ServiceBindingProtocolGuid               # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDhcp4ServiceBindingProtocolGuid              # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiPxeBaseCodeCallbackProtocolGuid              # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiPxeBaseCodeProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiLoadFileProtocolGuid                         # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiPxeBaseCodeCallbackProtocolGuid              # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiPxeBaseCodeProtocolGuid                      # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiLoadFileProtocolGuid                         # PROTOCOL ALWAYS_PRODUCED\r
   gEfiDhcp4ProtocolGuid                            # PROTOCOL ALWAYS_CONSUMED\r
   gEfiUdp4ProtocolGuid                             # PROTOCOL ALWAYS_CONSUMED\r
   gEfiNetworkInterfaceIdentifierProtocolGuid_31    # PROTOCOL ALWAYS_CONSUMED\r