]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update the code of processing device path info in browser to follow UEFI spec.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Jan 2013 09:49:44 +0000 (09:49 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Jan 2013 09:49:44 +0000 (09:49 +0000)
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14076 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni
MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
MdeModulePkg/Universal/SetupBrowserDxe/Ui.h

index 1a47f2b0a901c063f46e6dc3a9edc829113b02ab..4a431f0dec5124c472bafd06361d7042a4affa47 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Utility functions for expression evaluation.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -2470,22 +2470,21 @@ EvaluateExpression (
       }\r
 \r
       if (OpCode->DevicePath != 0) {\r
-        StrPtr = GetToken (OpCode->DevicePath, FormSet->HiiHandle);\r
-        if (StrPtr == NULL) {\r
-          Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
-          break;\r
-        }\r
-\r
-        DevicePath = ConvertDevicePathFromText(StrPtr);\r
+        Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
 \r
-        if (!GetQuestionValueFromForm(DevicePath, NULL, &OpCode->Guid, Value->Value.u16, &QuestionVal)){\r
-          Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
-        } else {\r
-          Value = &QuestionVal;\r
+        StrPtr = GetToken (OpCode->DevicePath, FormSet->HiiHandle);\r
+        if (StrPtr != NULL && mPathFromText != NULL) {\r
+          DevicePath = mPathFromText->ConvertTextToDevicePath(StrPtr);\r
+          if (DevicePath != NULL && GetQuestionValueFromForm(DevicePath, NULL, &OpCode->Guid, Value->Value.u16, &QuestionVal)) {\r
+            Value = &QuestionVal;\r
+          }\r
+          if (DevicePath != NULL) {\r
+            FreePool (DevicePath);\r
+          }\r
         }\r
 \r
-        if (DevicePath != NULL) {\r
-          FreePool (DevicePath);\r
+        if (StrPtr != NULL) {\r
+          FreePool (StrPtr);\r
         }\r
       } else if (CompareGuid (&OpCode->Guid, &gZeroGuid) != 0) {\r
         if (!GetQuestionValueFromForm(NULL, FormSet->HiiHandle, &OpCode->Guid, Value->Value.u16, &QuestionVal)){\r
index 62811c751a1e1d56601f6975df794c0874eb7077..ee8ab75a28880694b83475f9265929269dc4c976 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Utility functions for UI presentation.\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -602,6 +602,7 @@ InitializeBrowserStrings (
   gSaveChanges          = GetToken (STRING_TOKEN (SAVE_CHANGES), gHiiHandle);\r
   gOptionMismatch       = GetToken (STRING_TOKEN (OPTION_MISMATCH), gHiiHandle);\r
   gFormSuppress         = GetToken (STRING_TOKEN (FORM_SUPPRESSED), gHiiHandle);\r
+  gProtocolNotFound     = GetToken (STRING_TOKEN (PROTOCOL_NOT_FOUND), gHiiHandle);\r
   return ;\r
 }\r
 \r
@@ -642,6 +643,7 @@ FreeBrowserStrings (
   FreePool (gSaveChanges);\r
   FreePool (gOptionMismatch);\r
   FreePool (gFormSuppress);\r
+  FreePool (gProtocolNotFound);\r
   return ;\r
 }\r
 \r
index bcc8e020fdb2b8339fc60c4c6fb647e96aaaaeb9..33b3a8eec570d820aa7fb1b1391f4a3eeaf9e04c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Entry and initialization module for the browser.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -32,6 +32,7 @@ SETUP_DRIVER_PRIVATE_DATA  mPrivateData = {
 EFI_HII_DATABASE_PROTOCOL         *mHiiDatabase;\r
 EFI_HII_STRING_PROTOCOL           *mHiiString;\r
 EFI_HII_CONFIG_ROUTING_PROTOCOL   *mHiiConfigRouting;\r
+EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;\r
 \r
 UINTN           gBrowserContextCount = 0;\r
 LIST_ENTRY      gBrowserContextList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserContextList);\r
@@ -84,6 +85,7 @@ CHAR16            *gAdjustNumber;
 CHAR16            *gSaveChanges;\r
 CHAR16            *gOptionMismatch;\r
 CHAR16            *gFormSuppress;\r
+CHAR16            *gProtocolNotFound;\r
 \r
 CHAR16            *mUnknownString = L"!";\r
 \r
@@ -662,6 +664,12 @@ InitializeSetup (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiDevicePathFromTextProtocolGuid,\r
+                  NULL,\r
+                  (VOID **) &mPathFromText\r
+                  );\r
+\r
   //\r
   // Publish our HII data\r
   //\r
@@ -4184,6 +4192,7 @@ RestoreBrowserContext (
   gHelpBlockWidth       = Context->HelpBlockWidth;\r
   gOldFormSet           = Context->OldFormSet;\r
   gMenuRefreshHead      = Context->MenuRefreshHead;\r
+  gProtocolNotFound     = Context->ProtocolNotFound;\r
 \r
   CopyMem (&gScreenDimensions, &Context->ScreenDimensions, sizeof (gScreenDimensions));\r
   CopyMem (&gMenuOption, &Context->MenuOption, sizeof (gMenuOption));\r
index e11cdc16d76b5c217d9a0ccbe5fdc259cb126aca..8e32cb4e4a992bc47b7bfb54852298979e4af2f1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private MACRO, structure and function definitions for Setup Browser module.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/HiiDatabase.h>\r
 #include <Protocol/HiiString.h>\r
 #include <Protocol/UserManager.h>\r
+#include <Protocol/DevicePathFromText.h>\r
 \r
 #include <Guid/MdeModuleHii.h>\r
 #include <Guid/HiiPlatformSetupFormset.h>\r
@@ -546,6 +547,7 @@ typedef struct {
   CHAR16                *SaveChanges;\r
   CHAR16                *OptionMismatch;\r
   CHAR16                *FormSuppress;\r
+  CHAR16                *ProtocolNotFound;\r
   CHAR16                PromptBlockWidth;\r
   CHAR16                OptionBlockWidth;\r
   CHAR16                HelpBlockWidth;\r
@@ -597,6 +599,7 @@ typedef enum {
 extern EFI_HII_DATABASE_PROTOCOL         *mHiiDatabase;\r
 extern EFI_HII_STRING_PROTOCOL           *mHiiString;\r
 extern EFI_HII_CONFIG_ROUTING_PROTOCOL   *mHiiConfigRouting;\r
+extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;\r
 \r
 extern BANNER_DATA           *gBannerData;\r
 extern EFI_HII_HANDLE        gFrontPageHandle;\r
@@ -647,6 +650,7 @@ extern CHAR16            *gAdjustNumber;
 extern CHAR16            *gSaveChanges;\r
 extern CHAR16            *gOptionMismatch;\r
 extern CHAR16            *gFormSuppress;\r
+extern CHAR16            *gProtocolNotFound;\r
 \r
 extern CHAR16            gPromptBlockWidth;\r
 extern CHAR16            gOptionBlockWidth;\r
index 2edbd3ad1bab18dcb6ae092c2eab24d9b47bb857..2a4cda41e3aa998d447bc8e8f10f687603b8c85c 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # The DXE driver produces FORM BROWSER protocols defined in UEFI HII 2.1 specificatin.\r
 #\r
-# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -75,6 +75,7 @@
   gEfiHiiDatabaseProtocolGuid                   ## CONSUMES\r
   gEfiUnicodeCollation2ProtocolGuid             ## CONSUMES\r
   gEfiUserManagerProtocolGuid                   ## SOMETIMES_CONSUMES\r
+  gEfiDevicePathFromTextProtocolGuid            ## SOMETIMES_CONSUMES\r
 \r
 [FeaturePcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport          ## CONSUMES\r
index b155a5577ca691dd6deb28e8f3336f29ad594601..bb6414d2063253f2bca5bfb00c999f37eada585c 100644 (file)
Binary files a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni and b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni differ
index 4e83c8fae50ba1b6654978febbbd76bae8cffc2a..8ff90e144069102bcaf3966517ada72ce827e5e0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Utility functions for User Interface functions.\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -1970,55 +1970,6 @@ FormSetGuidToHiiHandle (
   return HiiHandle;\r
 }\r
 \r
-/**\r
-  Transfer the device path string to binary format.\r
-\r
-  @param   StringPtr     The device path string info.\r
-\r
-  @retval  Device path binary info.\r
-\r
-**/\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-ConvertDevicePathFromText (\r
-  IN CHAR16  *StringPtr\r
-  )\r
-{\r
-  UINTN                           BufferSize;\r
-  EFI_DEVICE_PATH_PROTOCOL        *DevicePath;\r
-  CHAR16                          TemStr[2];\r
-  UINT8                           *DevicePathBuffer;\r
-  UINTN                           Index;\r
-  UINT8                           DigitUint8;\r
-\r
-  ASSERT (StringPtr != NULL);\r
-\r
-  BufferSize = StrLen (StringPtr) / 2;\r
-  DevicePath = AllocatePool (BufferSize);\r
-  ASSERT (DevicePath != NULL);\r
-  \r
-  //\r
-  // Convert from Device Path String to DevicePath Buffer in the reverse order.\r
-  //\r
-  DevicePathBuffer = (UINT8 *) DevicePath;\r
-  for (Index = 0; StringPtr[Index] != L'\0'; Index ++) {\r
-    TemStr[0] = StringPtr[Index];\r
-    DigitUint8 = (UINT8) StrHexToUint64 (TemStr);\r
-    if (DigitUint8 == 0 && TemStr[0] != L'0') {\r
-      //\r
-      // Invalid Hex Char as the tail.\r
-      //\r
-      break;\r
-    }\r
-    if ((Index & 1) == 0) {\r
-      DevicePathBuffer [Index/2] = DigitUint8;\r
-    } else {\r
-      DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);\r
-    }\r
-  }\r
-\r
-  return DevicePath;\r
-}\r
-\r
 /**\r
   Process the goto op code, update the info in the selection structure.\r
 \r
@@ -2064,16 +2015,32 @@ ProcessGotoOpCode (
     if (Selection->Form->ModalForm) {\r
       return Status;\r
     }\r
+\r
     //\r
     // Goto another Hii Package list\r
     //\r
-    Selection->Action = UI_ACTION_REFRESH_FORMSET;\r
-    DevicePath = ConvertDevicePathFromText (StringPtr);\r
-\r
-    Selection->Handle = DevicePathToHiiHandle (DevicePath);\r
-    FreePool (DevicePath);\r
-    FreePool (StringPtr);\r
+    if (mPathFromText != NULL) {\r
+      DevicePath = mPathFromText->ConvertTextToDevicePath(StringPtr);\r
+      if (DevicePath != NULL) {\r
+        Selection->Handle = DevicePathToHiiHandle (DevicePath);\r
+        FreePool (DevicePath);\r
+      }\r
+      FreePool (StringPtr);\r
+    } else {\r
+      //\r
+      // Not found the EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL protocol.\r
+      //\r
+      do {\r
+        CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gProtocolNotFound, gPressEnter, gEmptyString);\r
+      } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+      if (Repaint != NULL) {\r
+        *Repaint = TRUE;\r
+      }\r
+      FreePool (StringPtr);\r
+      return Status;\r
+    }\r
 \r
+    Selection->Action = UI_ACTION_REFRESH_FORMSET;\r
     if (Selection->Handle == NULL) {\r
       //\r
       // If target Hii Handle not found, exit\r
index ac016bbed828dc39bce8a316d36364b153dbc882..4c3b314f0eee35511891e888b0eb8816d45206b8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private structure, MACRO and function definitions for User Interface related functionalities.\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -1048,17 +1048,4 @@ EvaluateExpressionList (
   IN FORM_BROWSER_FORM    *Form OPTIONAL\r
   );\r
 \r
-/**\r
-  Transfer the device path string to binary format.\r
-\r
-  @param   StringPtr     The device path string info.\r
-\r
-  @retval  Device path binary info.\r
-\r
-**/\r
-EFI_DEVICE_PATH_PROTOCOL *\r
-ConvertDevicePathFromText (\r
-  IN CHAR16  *StringPtr\r
-  );\r
-\r
 #endif // _UI_H\r