]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Library/Nt32BdsLib/BdsPlatform.c
Patch from open source community for CryptoPkg to allow it to build for ARM using...
[mirror_edk2.git] / Nt32Pkg / Library / Nt32BdsLib / BdsPlatform.c
index 24322088c4f264c868b773d3125442e77342b14e..0055223d8310d0d70d417981b6fa5be20ee9a6a7 100644 (file)
@@ -1,7 +1,7 @@
 /**@file\r
 \r
-Copyright (c) 2004 - 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2004 - 2006, 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,48 +22,70 @@ Abstract:
 \r
 #include "BdsPlatform.h"\r
 \r
-CHAR16  mFirmwareVendor[] = L"TianoCore.org";\r
+WIN_NT_SYSTEM_CONFIGURATION mSystemConfigData;\r
+\r
+VOID\r
+SetupVariableInit (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS                      Status;\r
+  UINTN                           Size;\r
+\r
+  Size = sizeof (mSystemConfigData);\r
+  Status = gRT->GetVariable (\r
+                  L"Setup",\r
+                  &gEfiWinNtSystemConfigGuid,\r
+                  NULL,\r
+                  &Size,\r
+                  (VOID *) &mSystemConfigData\r
+                  );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // SetupVariable is corrupt\r
+    //\r
+    mSystemConfigData.ConOutRow = PcdGet32 (PcdConOutColumn);\r
+    mSystemConfigData.ConOutColumn = PcdGet32 (PcdConOutRow);\r
+\r
+    Status = gRT->SetVariable (\r
+                    L"Setup",\r
+                    &gEfiWinNtSystemConfigGuid,\r
+                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                    sizeof (mSystemConfigData),\r
+                    (VOID *) &mSystemConfigData\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status));\r
+    }\r
+  }\r
+}\r
 \r
 //\r
 // BDS Platform Functions\r
 //\r
 VOID\r
+EFIAPI\r
 PlatformBdsInit (\r
-  IN EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData\r
+  VOID\r
   )\r
 /*++\r
 \r
 Routine Description:\r
 \r
-  Platform Bds init. Incude the platform firmware vendor, revision\r
+  Platform Bds init. Include the platform firmware vendor, revision\r
   and so crc check.\r
 \r
 Arguments:\r
 \r
-  PrivateData  - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance\r
-\r
 Returns:\r
 \r
   None.\r
 \r
 --*/\r
 {\r
-  //\r
-  // set firmwarevendor, here can be IBV/OEM customize\r
-  //\r
-  gST->FirmwareVendor = AllocateRuntimeCopyPool (\r
-                          sizeof (mFirmwareVendor),\r
-                          &mFirmwareVendor\r
-                          );\r
-  ASSERT (gST->FirmwareVendor != NULL);\r
-\r
-  gST->FirmwareRevision = 0;\r
-\r
-  //\r
-  // Fixup Tasble CRC after we updated Firmware Vendor and Revision\r
-  //\r
-  gBS->CalculateCrc32 ((VOID *) gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);\r
-\r
+  BdsLibSaveMemoryTypeInformation ();\r
+  SetupVariableInit ();\r
 }\r
 \r
 EFI_STATUS\r
@@ -214,7 +236,8 @@ Returns:
 VOID\r
 PlatformBdsDiagnostics (\r
   IN EXTENDMEM_COVERAGE_LEVEL    MemoryTestLevel,\r
-  IN BOOLEAN                     QuietBoot\r
+  IN BOOLEAN                     QuietBoot,\r
+  IN BASEM_MEMORY_TEST           BaseMemoryTest  \r
   )\r
 /*++\r
 \r
@@ -228,7 +251,9 @@ Arguments:
   MemoryTestLevel  - The memory test intensive level\r
   \r
   QuietBoot        - Indicate if need to enable the quiet boot\r
\r
+\r
+  BaseMemoryTest   - A pointer to BdsMemoryTest() \r
+\r
 Returns:\r
 \r
   None.\r
@@ -244,11 +269,11 @@ Returns:
   // from the graphic lib\r
   //\r
   if (QuietBoot) {\r
-    EnableQuietBootEx (&gEfiDefaultBmpLogoGuid, mBdsImageHandle);\r
+    EnableQuietBoot (PcdGetPtr(PcdLogoFile));\r
     //\r
     // Perform system diagnostic\r
     //\r
-    Status = BdsMemoryTest (MemoryTestLevel);\r
+    Status = BaseMemoryTest (MemoryTestLevel);\r
     if (EFI_ERROR (Status)) {\r
       DisableQuietBoot ();\r
     }\r
@@ -258,44 +283,37 @@ Returns:
   //\r
   // Perform system diagnostic\r
   //\r
-  Status = BdsMemoryTest (MemoryTestLevel);\r
+  Status = BaseMemoryTest (MemoryTestLevel);\r
 }\r
 \r
-VOID\r
-PlatformBdsPolicyBehavior (\r
-  IN EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData,\r
-  IN OUT LIST_ENTRY                  *DriverOptionList,\r
-  IN OUT LIST_ENTRY                  *BootOptionList\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   The function will excute with as the platform policy, current policy\r
   is driven by boot mode. IBV/OEM can customize this code for their specific\r
   policy action.\r
-  \r
-Arguments:\r
 \r
-  PrivateData      - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance\r
-  \r
-  DriverOptionList - The header of the driver option link list\r
-  \r
-  BootOptionList   - The header of the boot option link list\r
\r
-Returns:\r
+  @param  DriverOptionList        The header of the driver option link list\r
+  @param  BootOptionList          The header of the boot option link list\r
+  @param  ProcessCapsules         A pointer to ProcessCapsules()\r
+  @param  BaseMemoryTest          A pointer to BaseMemoryTest()\r
 \r
-  None.\r
-  \r
---*/\r
+**/\r
+VOID\r
+EFIAPI\r
+PlatformBdsPolicyBehavior (\r
+  IN OUT LIST_ENTRY                  *DriverOptionList,\r
+  IN OUT LIST_ENTRY                  *BootOptionList,\r
+  IN PROCESS_CAPSULES                ProcessCapsules,\r
+  IN BASEM_MEMORY_TEST               BaseMemoryTest\r
+  )\r
 {\r
-  EFI_STATUS  Status;\r
-  UINT16      Timeout;\r
+  EFI_STATUS     Status;\r
+  UINT16         Timeout;\r
+  EFI_BOOT_MODE  BootMode;\r
 \r
   //\r
   // Init the time out value\r
   //\r
-  Timeout = BdsLibGetTimeout ();\r
+  Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
 \r
   //\r
   // Load the driver option as the driver option list\r
@@ -305,13 +323,13 @@ Returns:
   //\r
   // Get current Boot Mode\r
   //\r
-  Status = BdsLibGetBootMode (&PrivateData->BootMode);\r
+  Status = BdsLibGetBootMode (&BootMode);\r
 \r
   //\r
   // Go the different platform policy with different boot mode\r
   // Notes: this part code can be change with the table policy\r
   //\r
-  switch (PrivateData->BootMode) {\r
+  switch (BootMode) {\r
 \r
   case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:\r
   case BOOT_WITH_MINIMAL_CONFIGURATION:\r
@@ -320,7 +338,7 @@ Returns:
     // console directly.\r
     //\r
     BdsLibConnectAllDefaultConsoles ();\r
-    PlatformBdsDiagnostics (IGNORE, TRUE);\r
+    PlatformBdsDiagnostics ((EXTENDMEM_COVERAGE_LEVEL)IGNORE, TRUE, BaseMemoryTest);\r
 \r
     //\r
     // Perform some platform specific connect sequence\r
@@ -344,7 +362,7 @@ Returns:
     // Boot with the specific configuration\r
     //\r
     PlatformBdsConnectConsole (gPlatformConsole);\r
-    PlatformBdsDiagnostics (EXTENSIVE, FALSE);\r
+    PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);\r
     BdsLibConnectAll ();\r
     ProcessCapsules (BOOT_ON_FLASH_UPDATE);\r
     break;\r
@@ -355,7 +373,7 @@ Returns:
     // and show up the front page\r
     //\r
     PlatformBdsConnectConsole (gPlatformConsole);\r
-    PlatformBdsDiagnostics (EXTENSIVE, FALSE);\r
+    PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);\r
 \r
     //\r
     // In recovery boot mode, we still enter to the\r
@@ -379,7 +397,7 @@ Returns:
       PlatformBdsNoConsoleAction ();\r
     }\r
 \r
-    PlatformBdsDiagnostics (IGNORE, TRUE);\r
+    PlatformBdsDiagnostics ((EXTENDMEM_COVERAGE_LEVEL)IGNORE, TRUE, BaseMemoryTest);\r
 \r
     //\r
     // Perform some platform specific connect sequence\r
@@ -404,6 +422,7 @@ Returns:
 }\r
 \r
 VOID\r
+EFIAPI\r
 PlatformBdsBootSuccess (\r
   IN  BDS_COMMON_OPTION   *Option\r
   )\r
@@ -440,6 +459,7 @@ Returns:
 }\r
 \r
 VOID\r
+EFIAPI\r
 PlatformBdsBootFail (\r
   IN  BDS_COMMON_OPTION  *Option,\r
   IN  EFI_STATUS         Status,\r
@@ -506,11 +526,36 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
+/**\r
+  This function locks platform flash that is not allowed to be updated during normal boot path.\r
+  The flash layout is platform specific.\r
+\r
+  **/\r
+VOID\r
 EFIAPI\r
 PlatformBdsLockNonUpdatableFlash (\r
   VOID\r
   )\r
 {\r
-  return EFI_SUCCESS;\r
+  return;\r
+}\r
+\r
+/**\r
+  Lock the ConsoleIn device in system table. All key\r
+  presses will be ignored until the Password is typed in. The only way to\r
+  disable the password is to type it in to a ConIn device.\r
+\r
+  @param  Password        Password used to lock ConIn device.\r
+\r
+  @retval EFI_SUCCESS     lock the Console In Spliter virtual handle successfully.\r
+  @retval EFI_UNSUPPORTED Password not found\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LockKeyboards (\r
+  IN  CHAR16    *Password\r
+  )\r
+{\r
+    return EFI_UNSUPPORTED;\r
 }\r