public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH 5/5] OvmfPkg/SataControllerDxe: log informative message at DEBUG_INFO level
Date: Mon,  4 Sep 2017 22:14:03 +0200	[thread overview]
Message-ID: <20170904201403.6445-6-lersek@redhat.com> (raw)
In-Reply-To: <20170904201403.6445-1-lersek@redhat.com>

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 | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

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



  parent reply	other threads:[~2017-09-04 20:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 20:13 [PATCH 0/5] MdeModulePkg, UefiCpuPkg, OvmfPkg: lower some DEBUGs from ERROR level Laszlo Ersek
2017-09-04 20:13 ` [PATCH 1/5] MdeModulePkg/UsbBusDxe: log warning message at DEBUG_WARN level Laszlo Ersek
2017-09-05  2:00   ` Zeng, Star
2017-09-04 20:14 ` [PATCH 2/5] UefiCpuPkg/CpuDxe: log informative message at DEBUG_INFO level Laszlo Ersek
2017-09-05  0:16   ` Dong, Eric
2017-09-04 20:14 ` [PATCH 3/5] OvmfPkg/PlatformPei: " Laszlo Ersek
2017-09-04 20:14 ` [PATCH 4/5] OvmfPkg/PlatformBootManagerLib: log informative message at DEBUG_INFO lvl Laszlo Ersek
2017-09-04 20:14 ` Laszlo Ersek [this message]
2017-09-11 20:42 ` [PATCH 0/5] MdeModulePkg, UefiCpuPkg, OvmfPkg: lower some DEBUGs from ERROR level Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170904201403.6445-6-lersek@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox