]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: create a separate PlatformDebugLibIoPort instance for SEC
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 16 Nov 2017 20:30:59 +0000 (21:30 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 17 Nov 2017 17:35:08 +0000 (18:35 +0100)
The next patch will want to add a global variable to
PlatformDebugLibIoPort, but this is not suitable for the SEC
phase, because SEC runs from read-only flash.  The solution is
to have two library instances, one for SEC and another
for all other firmware phases.  This patch adds the "plumbing"
for the SEC library instance, separating the INF files and
moving the constructor to a separate C source file.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen (Intel address) <jordan.l.justen@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c [new file with mode: 0644]
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c [new file with mode: 0644]
OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf [new file with mode: 0644]
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc

index 74f4d9c2d6314542f501e6a135bbed14577fb099..5a1c86f2c3fda554ff66ba5f3ad847787d511745 100644 (file)
 //\r
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100\r
 \r
-/**\r
-  This constructor function does not have to do anything.\r
-\r
-  @retval RETURN_SUCCESS   The constructor always returns RETURN_SUCCESS.\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-PlatformDebugLibIoPortConstructor (\r
-  VOID\r
-  )\r
-{\r
-  return RETURN_SUCCESS;\r
-}\r
-\r
 /**\r
   Prints a debug message to the debug output device if the specified error level is enabled.\r
 \r
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
new file mode 100644 (file)
index 0000000..bad054f
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file\r
+  Constructor code for QEMU debug port library.\r
+  Non-SEC instance.\r
+\r
+  Copyright (c) 2017, Red Hat, Inc.<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
+\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
+#include <Base.h>\r
+\r
+/**\r
+  This constructor function does not have anything to do.\r
+\r
+  @retval RETURN_SUCCESS   The constructor always returns RETURN_SUCCESS.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PlatformDebugLibIoPortConstructor (\r
+  VOID\r
+  )\r
+{\r
+  return RETURN_SUCCESS;\r
+}\r
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
new file mode 100644 (file)
index 0000000..83a118a
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file\r
+  Constructor code for QEMU debug port library.\r
+  SEC instance.\r
+\r
+  Copyright (c) 2017, Red Hat, Inc.<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
+\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
+#include <Base.h>\r
+\r
+/**\r
+  This constructor function does not have anything to do.\r
+\r
+  @retval RETURN_SUCCESS   The constructor always returns RETURN_SUCCESS.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+PlatformRomDebugLibIoPortConstructor (\r
+  VOID\r
+  )\r
+{\r
+  return RETURN_SUCCESS;\r
+}\r
index 0e74fe94cbc00d516adef8be38f8db649c3dfe15..de3c2f542bfe609a747b9cd62d61515c702d8807 100644 (file)
@@ -21,7 +21,7 @@
   FILE_GUID                      = DF934DA3-CD31-49FE-AF50-B3C87C79325F\r
   MODULE_TYPE                    = BASE\r
   VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = DebugLib\r
+  LIBRARY_CLASS                  = DebugLib|PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION\r
   CONSTRUCTOR                    = PlatformDebugLibIoPortConstructor\r
 \r
 #\r
@@ -30,6 +30,7 @@
 \r
 [Sources]\r
   DebugLib.c\r
+  DebugLibDetect.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
new file mode 100644 (file)
index 0000000..491c031
--- /dev/null
@@ -0,0 +1,52 @@
+## @file\r
+#  Instance of Debug Library for the QEMU debug console port.\r
+#  It uses Print Library to produce formatted output strings.\r
+#\r
+#  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2017, Red Hat, Inc.<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
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php.\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
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PlatformRomDebugLibIoPort\r
+  FILE_GUID                      = CEB0D9D3-328F-4C24-8C02-28FA1986AE1B\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = DebugLib|SEC\r
+  CONSTRUCTOR                    = PlatformRomDebugLibIoPortConstructor\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  DebugLib.c\r
+  DebugLibDetectRom.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  OvmfPkg/OvmfPkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseMemoryLib\r
+  IoLib\r
+  PcdLib\r
+  PrintLib\r
+  BaseLib\r
+  DebugPrintErrorLevelLib\r
+\r
+[Pcd]\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort                ## CONSUMES\r
+  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue        ## CONSUMES\r
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask            ## CONSUMES\r
+  gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel    ## CONSUMES\r
+\r
index c2f534fdbf3bc6e1841f8733e8353c76321efe85..7ccb61147f2766aba9529e2bcc43645e281a2fee 100644 (file)
 !ifdef $(DEBUG_ON_SERIAL_PORT)\r
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf\r
 !else\r
-  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf\r
+  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf\r
 !endif\r
   ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
   ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf\r
index 9f300a2e6f32dc0fb2683cbb42dd0c3038a30216..237ec71b5ec0a09c31be5e323922e5164407448c 100644 (file)
 !ifdef $(DEBUG_ON_SERIAL_PORT)\r
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf\r
 !else\r
-  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf\r
+  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf\r
 !endif\r
   ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
   ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf\r
index 1ffcf37f8b920123624023b8b8c626b8525b09c7..a5047fa38e614cf039781eb8ef5fc4e1def63cee 100644 (file)
 !ifdef $(DEBUG_ON_SERIAL_PORT)\r
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf\r
 !else\r
-  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf\r
+  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf\r
 !endif\r
   ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
   ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf\r