]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/SataControllerDxe: log informative message at DEBUG_INFO level
authorLaszlo Ersek <lersek@redhat.com>
Mon, 4 Sep 2017 18:48:31 +0000 (20:48 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Mon, 11 Sep 2017 20:39:32 +0000 (22:39 +0200)
When a UEFI_DRIVER attempts to open a protocol interface with BY_DRIVER
attribute that it already has open with BY_DRIVER attribute,
OpenProtocol() returns EFI_ALREADY_STARTED. This is not an error. The
UEFI-2.7 spec currently says,

> EFI_ALREADY_STARTED -- Attributes is BY_DRIVER and there is an item on
>                        the open list with an attribute of BY_DRIVER
>                        whose agent handle is the same as AgentHandle.

(In fact it is so much an expected condition that recent USWG Mantis
ticket <https://mantis.uefi.org/mantis/view.php?id=1815> will codify its
additional edk2-specific behavior, namely to output the protocol interface
at once.)

Downgrade the log mask for this one condition to DEBUG_INFO, in
SataControllerStart(). This will match the log mask of the other two
informative messages in this function, "SataControllerStart START", and
"SataControllerStart END status = %r" (at which point Status can only be
EFI_SUCCESS).

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/SataControllerDxe/SataController.c

index 1f84ad034e5b01fda596d7138a6c826c5b361841..2a5c3ba9f1b2ee4a10e633a8503fb31f7de75b3c 100644 (file)
@@ -388,6 +388,7 @@ SataControllerStart (
   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
   )\r
 {\r
+  UINTN                             BailLogMask;\r
   EFI_STATUS                        Status;\r
   EFI_PCI_IO_PROTOCOL               *PciIo;\r
   UINT64                            OriginalPciAttributes;\r
@@ -398,6 +399,7 @@ SataControllerStart (
 \r
   DEBUG ((EFI_D_INFO, "SataControllerStart START\n"));\r
 \r
+  BailLogMask = DEBUG_ERROR;\r
   SataPrivateData = NULL;\r
 \r
   //\r
@@ -412,6 +414,14 @@ SataControllerStart (
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
                   );\r
   if (EFI_ERROR (Status)) {\r
+    if (Status == EFI_ALREADY_STARTED) {\r
+      //\r
+      // This is an expected condition for OpenProtocol() / BY_DRIVER, in a\r
+      // DriverBindingStart() member function; degrade the log mask to\r
+      // DEBUG_INFO.\r
+      //\r
+      BailLogMask = DEBUG_INFO;\r
+    }\r
     goto Bail;\r
   }\r
 \r
@@ -542,7 +552,8 @@ ClosePciIo:
          );\r
 \r
 Bail:\r
-  DEBUG ((EFI_D_ERROR, "SataControllerStart error return status = %r\n", Status));\r
+  DEBUG ((BailLogMask, "SataControllerStart error return status = %r\n",\r
+    Status));\r
   return Status;\r
 }\r
 \r