Skip to content

Commit

Permalink
OvmfPkg/SataControllerDxe: log informative message at DEBUG_INFO level
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lersek committed Sep 11, 2017
1 parent 837d9ee commit 5dfba97
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion OvmfPkg/SataControllerDxe/SataController.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ SataControllerStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
UINTN BailLogMask;
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 OriginalPciAttributes;
Expand All @@ -398,6 +399,7 @@ SataControllerStart (

DEBUG ((EFI_D_INFO, "SataControllerStart START\n"));

BailLogMask = DEBUG_ERROR;
SataPrivateData = NULL;

//
Expand All @@ -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;
}

Expand Down Expand Up @@ -542,7 +552,8 @@ SataControllerStart (
);

Bail:
DEBUG ((EFI_D_ERROR, "SataControllerStart error return status = %r\n", Status));
DEBUG ((BailLogMask, "SataControllerStart error return status = %r\n",
Status));
return Status;
}

Expand Down

0 comments on commit 5dfba97

Please sign in to comment.