]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update Unix platform to use dynamic HII pcd to save console output mode.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 03:20:54 +0000 (03:20 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 03:20:54 +0000 (03:20 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7580 6f19259b-4bc3-4df7-8a09-765794883524

UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c
UnixPkg/Include/Guid/UnixSystemConfig.h [new file with mode: 0644]
UnixPkg/Library/UnixBdsLib/BdsPlatform.c
UnixPkg/Library/UnixBdsLib/BdsPlatform.h
UnixPkg/Library/UnixBdsLib/PlatformBds.inf
UnixPkg/UnixPkg.dec
UnixPkg/UnixPkg.dsc
UnixPkg/UnixPkg.fdf

index 79f6be6ae5b4deca737a223033293ac7d3bf7ad4..21ae8f8501db54ab1ded6b1ad0e68494ee352cce 100644 (file)
@@ -19,7 +19,7 @@ Revision History
 \r
 --*/\r
 \r
-#include "PiDxe.h"\r
+#include <PiDxe.h>\r
 #include <Guid/EventGroup.h>\r
 #include <Protocol/FvbExtension.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
@@ -846,7 +846,7 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolGetPhysicalAddress (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
   OUT EFI_PHYSICAL_ADDRESS                        *Address\r
   )\r
 /*++\r
@@ -877,8 +877,8 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolGetBlockSize (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
-  IN  EFI_LBA                                     Lba,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
+  IN CONST EFI_LBA                                     Lba,\r
   OUT UINTN                                       *BlockSize,\r
   OUT UINTN                                       *NumOfBlocks\r
   )\r
@@ -921,7 +921,7 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolGetAttributes (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
   OUT EFI_FVB_ATTRIBUTES_2                          *Attributes\r
   )\r
 /*++\r
@@ -948,7 +948,7 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolSetAttributes (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
   IN OUT EFI_FVB_ATTRIBUTES_2                       *Attributes\r
   )\r
 /*++\r
@@ -975,7 +975,7 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolEraseBlocks (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,\r
   ...  \r
   )\r
 /*++\r
@@ -1073,7 +1073,7 @@ Returns:
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolWrite (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
   IN EFI_LBA                                      Lba,\r
   IN UINTN                                        Offset,\r
   IN OUT UINTN                                    *NumBytes,\r
@@ -1115,15 +1115,15 @@ Returns:
 \r
   FvbDevice = FVB_DEVICE_FROM_THIS (This);\r
 \r
-  return FvbWriteBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());\r
+  return FvbWriteBlock (FvbDevice->Instance, (EFI_LBA)Lba, (UINTN)Offset, NumBytes, (UINT8 *)Buffer, mFvbModuleGlobal, EfiGoneVirtual ());\r
 }\r
 \r
 EFI_STATUS\r
 EFIAPI\r
 FvbProtocolRead (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
-  IN EFI_LBA                                      Lba,\r
-  IN UINTN                                        Offset,\r
+  IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,\r
+  IN CONST EFI_LBA                                      Lba,\r
+  IN CONST UINTN                                        Offset,\r
   IN OUT UINTN                                    *NumBytes,\r
   IN UINT8                                        *Buffer\r
   )\r
@@ -1256,7 +1256,7 @@ Returns:
   Ptr           = (UINT16 *) FwVolHeader;\r
   Checksum      = 0;\r
   while (HeaderLength > 0) {\r
-    Checksum = Checksum + (*Ptr);\r
+    Checksum = (UINT16)(Checksum + (*Ptr));\r
     HeaderLength--;\r
     Ptr++;\r
   }\r
@@ -1312,12 +1312,8 @@ Returns:
   // Allocate runtime services data for global variable, which contains\r
   // the private data of all firmware volume block instances\r
   //\r
-  Status = gBS->AllocatePool (\r
-                  EfiRuntimeServicesData,\r
-                  sizeof (ESAL_FWB_GLOBAL),\r
-                  (VOID**) &mFvbModuleGlobal\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
+  mFvbModuleGlobal = AllocateRuntimePool (sizeof (ESAL_FWB_GLOBAL));\r
+  ASSERT (mFvbModuleGlobal != NULL);\r
 \r
   //\r
   // Calculate the total size for all firmware volume block instances\r
@@ -1366,12 +1362,8 @@ Returns:
   // the private data of each FV instance. But in virtual mode or in physical\r
   // mode, the address of the the physical memory may be different.\r
   //\r
-  Status = gBS->AllocatePool (\r
-                  EfiRuntimeServicesData,\r
-                  BufferSize,\r
-                  (VOID**) &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
+  mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] = AllocateRuntimePool (BufferSize);\r
+  ASSERT (mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] != NULL);\r
 \r
   //\r
   // Make a virtual copy of the FvInstance pointer.\r
@@ -1452,12 +1444,8 @@ Returns:
     //\r
     // Add a FVB Protocol Instance\r
     //\r
-    Status = gBS->AllocatePool (\r
-                    EfiRuntimeServicesData,\r
-                    sizeof (EFI_FW_VOL_BLOCK_DEVICE),\r
-                    (VOID**) &FvbDevice\r
-                    );\r
-    ASSERT_EFI_ERROR (Status);\r
+    FvbDevice = AllocateRuntimePool (sizeof (EFI_FW_VOL_BLOCK_DEVICE));\r
+    ASSERT (FvbDevice != NULL);\r
 \r
     CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE));\r
 \r
@@ -1541,12 +1529,8 @@ Returns:
   //\r
   // Allocate for scratch space, an intermediate buffer for FVB extention\r
   //\r
-  Status = gBS->AllocatePool (\r
-                  EfiRuntimeServicesData,\r
-                  MaxLbaSize,\r
-                  (VOID**)&mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL]\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
+  mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] = AllocateRuntimePool (MaxLbaSize);\r
+  ASSERT (mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] != NULL);\r
 \r
   mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL];\r
 \r
diff --git a/UnixPkg/Include/Guid/UnixSystemConfig.h b/UnixPkg/Include/Guid/UnixSystemConfig.h
new file mode 100644 (file)
index 0000000..a81f08a
--- /dev/null
@@ -0,0 +1,36 @@
+/**@file\r
+  Setup Variable data structure for Unix platform.\r
+\r
+Copyright (c) 2009, Intel Corporation                                                         \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
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+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
+#ifndef __UNIX_SYSTEM_CONFIGUE_H__\r
+#define __UNIX_SYSTEM_CONFIGUE_H__\r
+\r
+#define EFI_UXIX_SYSTEM_CONFIG_GUID  \\r
+  {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+  //\r
+  // Console output mode\r
+  //\r
+  UINT32        ConOutColumn;\r
+  UINT32        ConOutRow;\r
+} WIN_NT_SYSTEM_CONFIGURATION;\r
+#pragma pack()\r
+\r
+\r
+extern EFI_GUID   gEfiUnixSystemConfigGuid;\r
+\r
+#endif\r
index 42882ca1f30fd175e7813a4aa96679d0d6dc9c0e..f4d32f1a57bc990a5d689d3fa5f3ce316819e961 100644 (file)
@@ -23,6 +23,44 @@ Abstract:
 #include "BdsPlatform.h"\r
 \r
 CHAR16  mFirmwareVendor[] = L"TianoCore.org";\r
+UNIX_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
+                  &gEfiUnixSystemConfigGuid,\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
+                    &gEfiUnixSystemConfigGuid,\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
@@ -35,7 +73,7 @@ PlatformBdsInit (
 \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
index 6d5df84de5a758fded429f9548b64a9dd054043b..f7b15556bf434397ceb99fa2c6be4a8d302de40b 100644 (file)
@@ -27,6 +27,7 @@ Abstract:
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/PcdLib.h>\r
@@ -37,6 +38,7 @@ Abstract:
 #include <Protocol/UnixThunk.h>\r
 #include <Protocol/UnixIo.h>\r
 #include <Guid/Bmp.h>\r
+#include <Guid/WinNtSystemConfig.h>\r
 \r
 extern BDS_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];\r
 extern EFI_DEVICE_PATH_PROTOCOL   *gPlatformConnectSequence[];\r
index ffdec8a2eedd9f9b39468942ceb318c91eb11573..c296fe8c6118ed640f78241f2ca8dc64c545b2bd 100644 (file)
@@ -24,7 +24,6 @@
   EDK_RELEASE_VERSION            = 0x00020000\r
   EFI_SPECIFICATION_VERSION      = 0x00020000\r
 \r
-  ENTRY_POINT                    = BdsInitialize\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
@@ -34,9 +33,8 @@
 \r
 [Sources.common]\r
   BdsPlatform.c\r
-  BdsPlatform.h\r
   PlatformData.c\r
-\r
+  BdsPlatform.h\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
@@ -69,6 +67,7 @@
   BaseLib\r
   MemoryAllocationLib\r
   UefiBootServicesTableLib\r
+  UefiRuntimeServicesTableLib\r
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
 \r
 [Guids]\r
   gEfiDefaultBmpLogoGuid                        # ALWAYS_CONSUMED
+  gEfiUnixSystemConfigGuid\r
+\r
+[Pcd.common]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn\r
+\r
+[Depex]\r
+  gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid\r
index f351e94954330730c8990cd4e8b68cd72469d97b..573c4308662b3b733aa442b8e973a96c7ab8762b 100644 (file)
@@ -54,7 +54,7 @@
   gEfiUnixCPUSpeedGuid           = {0xf2d74e5a, 0x8985, 0x11db, {0x97, 0x05, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}\r
   gEfiUnixSerialPortGuid         = {0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x02, 0x15, 0x86, 0x14, 0x90, 0xf3}}\r
   gEfiFlashMapHobGuid            = {0xb091e7d2, 0x05a0, 0x4198, {0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59}}\r
-\r
+  gEfiUnixSystemConfigGuid       = {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}\r
 \r
 [PcdsFixedAtBuild.common]\r
   gEfiUnixPkgTokenSpaceGuid.PcdUnixBootMode|1|UINT32|0x00001006\r
index c827c3c2a90c21ab091a36249de15e4392153364..9443e8739edc3be3f780a6ecb342653ccb94cd21 100644 (file)
   UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf\r
   OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf\r
   DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
-  PrintLib|MdeModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.inf\r
+  PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf\r
 \r
 ################################################################################\r
 #\r
   gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"64!64"|VOID*|10\r
   gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1"|VOID*|20\r
 \r
+[PcdsDynamicHii.common.DEFAULT]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0x0053 0x0065 0x0074 0x0075 0x0070|gEfiWinNtSystemConfigGuid|0x0|80 # Variable: L"Setup"\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0x0053 0x0065 0x0074 0x0075 0x0070|gEfiWinNtSystemConfigGuid|0x4|25 # Variable: L"Setup"\r
+\r
 ###################################################################################################\r
 #\r
 # Components Section - list of the modules and components that will be processed by compilation\r
 \r
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf\r
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf\r
+  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf\r
   MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {\r
     <LibraryClasses>\r
       PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
index 4ca51be0c4eb7b19740380f3b5febc5defc2e801..956895697a9bf3bf3c7c54c3602a598b04b1c8fb 100644 (file)
@@ -211,7 +211,8 @@ INF  UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
 INF  UnixPkg/UnixUgaDxe/UnixUga.inf\r
 #INF  UnixPkg/UnixConsoleDxe/UnixConsole.inf\r
 INF  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf\r
-INF  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf  \r
+INF  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf\r
+INF  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf\r
 INF  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf \r
 INF  UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf\r
 INF  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf\r