]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1.Change the behavior of BdsBoot, to enumerate Boot Options by EfiLoadFileProtocol...
authortye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Jan 2010 03:05:41 +0000 (03:05 +0000)
committertye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Jan 2010 03:05:41 +0000 (03:05 +0000)
2.Add MSG_IPv4_DP and MSG_IPv6_DP into boot type of BDS_EFI_MESSAGE_MAC_BOOT.

3.Change the file header format of inf file and remove the MNP dependency.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9799 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h

index e6b2fe4d17cf6539a042ac9cc5f8fe4f8115a535..e9e3435abda50f8b3c64ffddb23fe3f7609bfd33 100644 (file)
@@ -991,8 +991,8 @@ BdsLibEnumerateAllBootOption (
   EFI_HANDLE                    *BlockIoHandles;\r
   EFI_BLOCK_IO_PROTOCOL         *BlkIo;\r
   UINTN                         Index;\r
-  UINTN                         NumberNetworkHandles;\r
-  EFI_HANDLE                    *NetworkHandles;\r
+  UINTN                         NumOfLoadFileHandles;\r
+  EFI_HANDLE                    *LoadFileHandles;\r
   UINTN                         FvHandleCount;\r
   EFI_HANDLE                    *FvHandleBuffer;\r
   EFI_FV_FILETYPE               Type;\r
@@ -1171,37 +1171,25 @@ BdsLibEnumerateAllBootOption (
   //\r
   // Parse Network Boot Device\r
   //\r
-  NumberNetworkHandles = 0;\r
+  NumOfLoadFileHandles = 0;\r
   //\r
-  // Search MNP Service Binding protocol for UEFI network stack\r
+  // Search Load File protocol for PXE boot option.\r
   //\r
   gBS->LocateHandleBuffer (\r
         ByProtocol,\r
-        &gEfiManagedNetworkServiceBindingProtocolGuid,\r
+        &gEfiLoadFileProtocolGuid,\r
         NULL,\r
-        &NumberNetworkHandles,\r
-        &NetworkHandles\r
+        &NumOfLoadFileHandles,\r
+        &LoadFileHandles\r
         );\r
-  if (NumberNetworkHandles == 0) {\r
-    //\r
-    // MNP Service Binding protocol not found, search SNP for EFI network stack\r
-    //\r
-    gBS->LocateHandleBuffer (\r
-          ByProtocol,\r
-          &gEfiSimpleNetworkProtocolGuid,\r
-          NULL,\r
-          &NumberNetworkHandles,\r
-          &NetworkHandles\r
-          );\r
-  }\r
 \r
-  for (Index = 0; Index < NumberNetworkHandles; Index++) {\r
+  for (Index = 0; Index < NumOfLoadFileHandles; Index++) {\r
     UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", Index);\r
-    BdsLibBuildOptionFromHandle (NetworkHandles[Index], BdsBootOptionList, Buffer);\r
+    BdsLibBuildOptionFromHandle (LoadFileHandles[Index], BdsBootOptionList, Buffer);\r
   }\r
 \r
-  if (NumberNetworkHandles != 0) {\r
-    FreePool (NetworkHandles);\r
+  if (NumOfLoadFileHandles != 0) {\r
+    FreePool (LoadFileHandles);\r
   }\r
 \r
   //\r
@@ -1556,16 +1544,9 @@ BdsLibNetworkBootWithMediaPresent (
 \r
   UpdatedDevicePath = DevicePath;\r
   //\r
-  // Locate MNP Service Binding protocol for UEFI network stack first\r
+  // Locate Load File Protocol for PXE boot option first\r
   //\r
-  Status = gBS->LocateDevicePath (&gEfiManagedNetworkServiceBindingProtocolGuid, &UpdatedDevicePath, &Handle);\r
-  if (EFI_ERROR (Status)) {\r
-    //\r
-    // MNP Service Binding protocol not found, search SNP for EFI network stack\r
-    //\r
-    UpdatedDevicePath = DevicePath;\r
-    Status = gBS->LocateDevicePath (&gEfiSimpleNetworkProtocolGuid, &UpdatedDevicePath, &Handle);\r
-  }\r
+  Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &UpdatedDevicePath, &Handle);\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // Device not present so see if we need to connect it\r
@@ -1575,11 +1556,7 @@ BdsLibNetworkBootWithMediaPresent (
       //\r
       // This one should work after we did the connect\r
       //\r
-      Status = gBS->LocateDevicePath (&gEfiManagedNetworkServiceBindingProtocolGuid, &UpdatedDevicePath, &Handle);\r
-      if (EFI_ERROR (Status)) {\r
-        UpdatedDevicePath = DevicePath;\r
-        Status = gBS->LocateDevicePath (&gEfiSimpleNetworkProtocolGuid, &UpdatedDevicePath, &Handle);\r
-      }\r
+      Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &UpdatedDevicePath, &Handle);\r
     }\r
   }\r
 \r
@@ -1727,6 +1704,8 @@ BdsGetBootTypeFromDevicePath (
 \r
         case MSG_MAC_ADDR_DP:\r
         case MSG_VLAN_DP:\r
+        case MSG_IPv4_DP:\r
+        case MSG_IPv6_DP:\r
           BootType = BDS_EFI_MESSAGE_MAC_BOOT;\r
           break;\r
 \r
@@ -1794,29 +1773,20 @@ BdsLibIsValidEFIBootOptDevicePathExt (
   EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL  *LastDeviceNode;\r
   EFI_BLOCK_IO_PROTOCOL     *BlockIo;\r
-  EFI_LOAD_FILE_PROTOCOL    *LoadFile;\r
 \r
   TempDevicePath = DevPath;\r
   LastDeviceNode = DevPath;\r
 \r
   //\r
-  // Check if it's a valid boot option for network boot device\r
-  // Check if there is MNP Service Binding Protocol or SimpleNetworkProtocol\r
-  // installed. If yes, that means there is the network card there.\r
+  // Check if it's a valid boot option for network boot device.\r
+  // Check if there is EfiLoadFileProtocol installed. \r
+  // If yes, that means there is a boot option for network.\r
   //\r
   Status = gBS->LocateDevicePath (\r
-                  &gEfiManagedNetworkServiceBindingProtocolGuid,\r
+                  &gEfiLoadFileProtocolGuid,\r
                   &TempDevicePath,\r
                   &Handle\r
                   );\r
-  if (EFI_ERROR (Status)) {\r
-    TempDevicePath = DevPath;\r
-    Status = gBS->LocateDevicePath (\r
-                    &gEfiSimpleNetworkProtocolGuid,\r
-                    &TempDevicePath,\r
-                    &Handle\r
-                    );\r
-  }\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // Device not present so see if we need to connect it\r
@@ -1824,44 +1794,30 @@ BdsLibIsValidEFIBootOptDevicePathExt (
     TempDevicePath = DevPath;\r
     BdsLibConnectDevicePath (TempDevicePath);\r
     Status = gBS->LocateDevicePath (\r
-                    &gEfiManagedNetworkServiceBindingProtocolGuid,\r
+                    &gEfiLoadFileProtocolGuid,\r
                     &TempDevicePath,\r
                     &Handle\r
                     );\r
-    if (EFI_ERROR (Status)) {\r
-      TempDevicePath = DevPath;\r
-      Status = gBS->LocateDevicePath (\r
-                      &gEfiSimpleNetworkProtocolGuid,\r
-                      &TempDevicePath,\r
-                      &Handle\r
-                      );\r
-    }\r
   }\r
 \r
   if (!EFI_ERROR (Status)) {\r
-    //\r
-    // Check whether LoadFile protocol is installed\r
-    //\r
-    Status = gBS->HandleProtocol (Handle, &gEfiLoadFileProtocolGuid, (VOID **)&LoadFile);\r
-    if (!EFI_ERROR (Status)) {\r
-      if (!IsDevicePathEnd (TempDevicePath)) {\r
-        //\r
-        // LoadFile protocol is not installed on handle with exactly the same DevPath\r
-        //\r
-        return FALSE;\r
-      }\r
+    if (!IsDevicePathEnd (TempDevicePath)) {\r
+      //\r
+      // LoadFile protocol is not installed on handle with exactly the same DevPath\r
+      //\r
+      return FALSE;\r
+    }\r
 \r
-      if (CheckMedia) {\r
-        //\r
-        // Test if it is ready to boot now\r
-        //\r
-        if (BdsLibNetworkBootWithMediaPresent(DevPath)) {\r
-          return TRUE;\r
-        }\r
-      } else {\r
+    if (CheckMedia) {\r
+      //\r
+      // Test if it is ready to boot now\r
+      //\r
+      if (BdsLibNetworkBootWithMediaPresent(DevPath)) {\r
         return TRUE;\r
       }\r
-    }\r
+    } else {\r
+      return TRUE;\r
+    }    \r
   }\r
 \r
   //\r
index 4aa9f124ddd620e4d74ead3cf78c00a83eebf0d1..c5ba83c4a08b9e408797756c53b5d239a682c39e 100644 (file)
@@ -1,11 +1,11 @@
-#/** @file\r
+## @file\r
 #  \r
 #  General BDS defines and produce general interfaces for platform BDS driver including:\r
 #  1) BDS boot policy interface;\r
 #  2) BDS boot device connect interface;\r
 #  3) BDS Misc interfaces for mainting boot variable, ouput string, etc.\r
 #  \r
-#  Copyright (c) 2007 - 2009, Intel Corporation. <BR>\r
+#  Copyright (c) 2007 - 2010, Intel Corporation. <BR>\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
@@ -14,7 +14,7 @@
 #  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
 \r
 [Defines]\r
   INF_VERSION                    = 0x00010005\r
@@ -90,7 +90,6 @@
 \r
 [Protocols]\r
   gEfiSimpleFileSystemProtocolGuid              # PROTOCOL CONSUMES\r
-  gEfiManagedNetworkServiceBindingProtocolGuid  # PROTOCOL CONSUMES\r
   gEfiLoadFileProtocolGuid                      # PROTOCOL CONSUMES\r
   gEfiSimpleTextOutProtocolGuid                 # PROTOCOL CONSUMES\r
   gEfiPciIoProtocolGuid                         # PROTOCOL CONSUMES\r
index c119523edd68171530f1048c8366322463f1e86c..7b4a69494de4626ce17912167d34a5afcf6986f9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   BDS library definition, include the file and data structure\r
 \r
-Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2010, Intel Corporation. <BR>\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
@@ -24,7 +24,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/Cpu.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
-#include <Protocol/ManagedNetwork.h>\r
 #include <Protocol/LoadFile.h>\r
 #include <Protocol/DebugPort.h>\r
 #include <Protocol/DevicePath.h>\r