public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 0/3] OvmfPkg: save on I/O port accesses when the debug port is not in use
@ 2017-11-16 20:30 Paolo Bonzini
  2017-11-16 20:30 ` [PATCH v3 1/3] OvmfPkg: make PlatformDebugLibIoPort a proper BASE library Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Paolo Bonzini @ 2017-11-16 20:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Laszlo Ersek, Ard Biesheuvel, Jordan Justen

This is version 3 of the series to skip debug port I/O port writes
when the debug port device wasn't added to the virtual machine.
The differences from v2 are entirely cosmetic, and I'm including them
at the end of this message for ease of review.

Thanks,

Paolo

Paolo Bonzini (3):
  OvmfPkg: make PlatformDebugLibIoPort a proper BASE library
  OvmfPkg: create a separate PlatformDebugLibIoPort instance for SEC
  OvmfPkg: save on I/O port accesses when the debug port is not in use

 OvmfPkg/OvmfPkgIa32.dsc                                              |  2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                                           |  2 +-
 OvmfPkg/OvmfPkgX64.dsc                                               |  2 +-
 OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf    |  3 ++-
 OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 52 +++++++++++++++++++++++++++++++++++++++++
 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h              | 55 ++++++++++++++++++++++++++++++++++++++++++++
 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c                    | 44 +++++++++++++++++++----------------
 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c              | 55 ++++++++++++++++++++++++++++++++++++++++++++
 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c           | 48 ++++++++++++++++++++++++++++++++++++++
 9 files changed, 241 insertions(+), 24 deletions(-)
 create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
 create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
 create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
 create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c

-- 
2.14.3

diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
index 65d8683f1f..de3c2f542b 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
@@ -21,7 +21,7 @@ [Defines]
   FILE_GUID                      = DF934DA3-CD31-49FE-AF50-B3C87C79325F
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = DebugLib
+  LIBRARY_CLASS                  = DebugLib|PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION
   CONSTRUCTOR                    = PlatformDebugLibIoPortConstructor
 
 #
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
index 93763d47dd..491c0318de 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
@@ -21,7 +21,7 @@ [Defines]
   FILE_GUID                      = CEB0D9D3-328F-4C24-8C02-28FA1986AE1B
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = DebugLib
+  LIBRARY_CLASS                  = DebugLib|SEC
   CONSTRUCTOR                    = PlatformRomDebugLibIoPortConstructor
 
 #
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
index c34ca9c72b..1f739b55d8 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
@@ -17,7 +17,6 @@
 #define __DEBUG_IO_PORT_DETECT_H__
 
 #include <Base.h>
-#include <Uefi.h>
 
 //
 // The constant value that is read from the debug I/O port
@@ -30,7 +29,8 @@
   PlatformDebugLibIoPortFound can call this function directly or cache the
   result.
 
-  @retval BOOLEAN   TRUE if the debug I/O port device was detected.
+  @retval TRUE   if the debug I/O port device was detected.
+  @retval FALSE  otherwise
 
 **/
 BOOLEAN
@@ -44,7 +44,8 @@ PlatformDebugLibIoPortDetect (
   calls this function instead of PlatformDebugLibIoPortDetect, to allow
   caching if possible.
 
-  @retval BOOLEAN   TRUE if the debug I/O port device was detected.
+  @retval TRUE   if the debug I/O port device was detected.
+  @retval FALSE  otherwise
 
 **/
 BOOLEAN
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
index 79486ac8a6..36cde54976 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
@@ -15,7 +15,6 @@
 **/
 
 #include <Base.h>
-#include <Uefi.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseLib.h>
 #include <Library/IoLib.h>
@@ -63,9 +62,10 @@ DebugPrint (
   ASSERT (Format != NULL);
 
   //
-  // Do nothing if the global mask disables this message or the device is inactive
+  // Check if the global mask disables this message or the device is inactive
   //
-  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0 || !PlatformDebugLibIoPortFound ()) {
+  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0 ||
+      !PlatformDebugLibIoPortFound ()) {
     return;
   }
 
@@ -273,7 +273,8 @@ DebugPrintLevelEnabled (
 /**
   Return the result of detecting the debug I/O port device.
 
-  @retval BOOLEAN   TRUE if the debug I/O port device was detected.
+  @retval TRUE   if the debug I/O port device was detected.
+  @retval FALSE  otherwise
 
 **/
 BOOLEAN
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
index 610987aca9..81c44eece9 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
@@ -14,7 +14,6 @@
 **/
 
 #include <Base.h>
-#include <Uefi.h>
 #include "DebugLibDetect.h"
 
 //
@@ -26,7 +25,7 @@ STATIC BOOLEAN mDebugIoPortFound = FALSE;
   This constructor function checks if the debug I/O port device is present,
   caching the result for later use.
 
-  @retval EFI_SUCCESS   The constructor always returns RETURN_SUCCESS.
+  @retval RETURN_SUCCESS   The constructor always returns RETURN_SUCCESS.
 
 **/
 RETURN_STATUS
@@ -36,13 +35,14 @@ PlatformDebugLibIoPortConstructor (
   )
 {
   mDebugIoPortFound = PlatformDebugLibIoPortDetect();
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
 
 /**
   Return the cached result of detecting the debug I/O port device.
 
-  @retval BOOLEAN   TRUE if the debug I/O port device was detected.
+  @retval TRUE   if the debug I/O port device was detected.
+  @retval FALSE  otherwise
 
 **/
 BOOLEAN
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
index f71b6567dc..b950919675 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetectRom.c
@@ -14,13 +14,12 @@
 **/
 
 #include <Base.h>
-#include <Uefi.h>
 #include "DebugLibDetect.h"
 
 /**
-  This constructor function does not have to do anything.
+  This constructor function does not have anything to do.
 
-  @retval EFI_SUCCESS   The constructor always returns RETURN_SUCCESS.
+  @retval RETURN_SUCCESS   The constructor always returns RETURN_SUCCESS.
 
 **/
 RETURN_STATUS
@@ -29,13 +28,14 @@ PlatformRomDebugLibIoPortConstructor (
   VOID
   )
 {
-  return EFI_SUCCESS;
+  return RETURN_SUCCESS;
 }
 
 /**
   Return the result of detecting the debug I/O port device.
 
-  @retval BOOLEAN   TRUE if the debug I/O port device was detected.
+  @retval TRUE   if the debug I/O port device was detected.
+  @retval FALSE  otherwise
 
 **/
 BOOLEAN





^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-11-17 17:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 20:30 [PATCH v3 0/3] OvmfPkg: save on I/O port accesses when the debug port is not in use Paolo Bonzini
2017-11-16 20:30 ` [PATCH v3 1/3] OvmfPkg: make PlatformDebugLibIoPort a proper BASE library Paolo Bonzini
2017-11-17 17:21   ` Laszlo Ersek
2017-11-16 20:30 ` [PATCH v3 2/3] OvmfPkg: create a separate PlatformDebugLibIoPort instance for SEC Paolo Bonzini
2017-11-17 17:25   ` Laszlo Ersek
2017-11-16 20:31 ` [PATCH v3 3/3] OvmfPkg: save on I/O port accesses when the debug port is not in use Paolo Bonzini
2017-11-17 17:32   ` Laszlo Ersek
2017-11-17 17:37   ` Laszlo Ersek
2017-11-17 17:48 ` [PATCH v3 0/3] " Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox