]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
Program SD Cards into 4-bit mode (support for this is required in the spec). This...
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / GenericBdsLib / BdsMisc.c
index acf61ebcb6627a371ee3d466a7bd06fb0ad83743..487807b3018f2a394bbdf0c13c91e32d236428cc 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Misc BDS library function\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2010, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -22,42 +22,6 @@ BOOLEAN   mResetRequired  = FALSE;
 \r
 extern UINT16 gPlatformBootTimeOutDefault;\r
 \r
-\r
-/**\r
-  Return the default value for system Timeout variable.\r
-\r
-  @return Timeout value.\r
-\r
-**/\r
-UINT16\r
-EFIAPI\r
-BdsLibGetTimeout (\r
-  VOID\r
-  )\r
-{\r
-  UINT16      Timeout;\r
-  UINTN       Size;\r
-  EFI_STATUS  Status;\r
-\r
-  //\r
-  // Return Timeout variable or 0xffff if no valid\r
-  // Timeout variable exists.\r
-  //\r
-  Size    = sizeof (UINT16);\r
-  Status  = gRT->GetVariable (L"Timeout", &gEfiGlobalVariableGuid, NULL, &Size, &Timeout);\r
-  if (EFI_ERROR (Status)) {\r
-    //\r
-    // According to UEFI 2.0 spec, it should treat the Timeout value as 0xffff\r
-    // (default value PcdPlatformBootTimeOutDefault) when L"Timeout" variable is not present.\r
-    // To make the current EFI Automatic-Test activity possible, platform can choose other value\r
-    // for automatic boot when the variable is not present.\r
-    //\r
-    Timeout = PcdGet16 (PcdPlatformBootTimeOutDefault);\r
-  }\r
-\r
-  return Timeout;\r
-}\r
-\r
 /**\r
   The function will go through the driver option link list, load and start\r
   every driver the driver option device path point to.\r
@@ -608,9 +572,9 @@ BdsLibBuildOptionFromVar (
     }\r
 \r
     Option              = BdsLibVariableToOption (BdsCommonOptionList, OptionName);\r
-    ASSERT (Option != NULL);\r
-    Option->BootCurrent = OptionOrder[Index];\r
-\r
+    if (Option != NULL) {\r
+      Option->BootCurrent = OptionOrder[Index];\r
+    }\r
   }\r
 \r
   FreePool (OptionOrder);\r
@@ -831,7 +795,7 @@ BdsLibOutputStrings (
     // If String is NULL, then it's the end of the list\r
     //\r
     String = VA_ARG (Args, CHAR16 *);\r
-    if (String != NULL) {\r
+    if (String == NULL) {\r
       break;\r
     }\r
 \r
@@ -847,7 +811,7 @@ BdsLibOutputStrings (
 }\r
 \r
 //\r
-//  Following are BDS Lib functions which  contain all the code about setup browser reset reminder feature.\r
+//  Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.\r
 //  Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser  if\r
 //  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.\r
 //\r
@@ -974,7 +938,7 @@ SetupResetReminder (
       // Popup a menu to notice user\r
       //\r
       do {\r
-        IfrLibCreatePopUp (2, &Key, StringBuffer1, StringBuffer2);\r
+        CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);\r
       } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));\r
 \r
       FreePool (StringBuffer1);\r
@@ -1042,11 +1006,12 @@ BdsLibGetImageHeader (
     Root = NULL;\r
     goto Done;\r
   }\r
-\r
+  ASSERT (Root != NULL);\r
   Status = Root->Open (Root, &ThisFile, FileName, EFI_FILE_MODE_READ, 0);\r
   if (EFI_ERROR (Status)) {\r
     goto Done;\r
   }\r
+  ASSERT (ThisFile != NULL);\r
 \r
   //\r
   // Get file size\r
@@ -1270,3 +1235,34 @@ BdsLibSaveMemoryTypeInformation (
 }\r
 \r
 \r
+/**\r
+  Identify a user and, if authenticated, returns the current user profile handle.\r
+\r
+  @param[out]  User           Point to user profile handle.\r
+  \r
+  @retval EFI_SUCCESS         User is successfully identified, or user identification\r
+                              is not supported.\r
+  @retval EFI_ACCESS_DENIED   User is not successfully identified\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BdsLibUserIdentify (\r
+  OUT EFI_USER_PROFILE_HANDLE         *User\r
+  )\r
+{\r
+  EFI_STATUS                          Status;\r
+  EFI_USER_MANAGER_PROTOCOL           *Manager;\r
+  \r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiUserManagerProtocolGuid,\r
+                  NULL,\r
+                  (VOID **) &Manager\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  return Manager->Identify (Manager, User);\r
+}\r
+\r