From 7f2a7492a3584de3cc9634a36fb327669e73cc41 Mon Sep 17 00:00:00 2001 From: Jeshua Smith Date: Mon, 3 Jun 2024 08:55:32 -0700 Subject: [PATCH] chore: print DeviceDiscoverDriver's caller This prepends DEBUG print messages in the DeviceDiscoverDriver library with the calling driver's name, to enable distinguishing where the messages are coming from. Example output: TegraPwmDxe:DeviceDiscoveryStart, Failed supported check QspiControllerDxe:DeviceDiscoveryStart, Failed supported check TegraControllerEnableDxe:DeviceDiscoveryStart, failed to enable clocks Device Error TegraControllerEnableDxe:DeviceDiscoveryStart, failed to deassert Pg 21: Device Error TegraUartDxe:DeviceDiscoveryStart, Failed supported check Signed-off-by: Jeshua Smith Reviewed-by: Ashish Singhal --- .../DeviceDiscoveryDriverLibPrivate.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Silicon/NVIDIA/Library/DeviceDiscoveryDriverLib/DeviceDiscoveryDriverLibPrivate.h b/Silicon/NVIDIA/Library/DeviceDiscoveryDriverLib/DeviceDiscoveryDriverLibPrivate.h index c82acfece6..a5a52f6258 100644 --- a/Silicon/NVIDIA/Library/DeviceDiscoveryDriverLib/DeviceDiscoveryDriverLibPrivate.h +++ b/Silicon/NVIDIA/Library/DeviceDiscoveryDriverLib/DeviceDiscoveryDriverLibPrivate.h @@ -2,7 +2,7 @@ Device Discovery Driver Library private structures - Copyright (c) 2018-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -33,4 +33,16 @@ typedef struct { IN NVIDIA_DEVICE_TREE_NODE_PROTOCOL *Node; } NVIDIA_DEVICE_DISCOVERY_THREAD_CONTEXT; +// Make the DEBUG prints in this Library print the name of the Driver that called them +#ifdef _DEBUG_PRINT + #undef _DEBUG_PRINT +#define _DEBUG_PRINT(PrintLevel, ...) \ + do { \ + if (DebugPrintLevelEnabled (PrintLevel)) { \ + DebugPrint (PrintLevel, "%a:", gEfiCallerBaseName); \ + DebugPrint (PrintLevel, ##__VA_ARGS__); \ + } \ + } while (FALSE) +#endif + #endif