From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.web12.386.1596212373674432623 for ; Fri, 31 Jul 2020 09:19:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=LyW7pHpt; spf=pass (domain: nuviainc.com, ip: 209.85.128.50, mailfrom: tomas@nuviainc.com) Received: by mail-wm1-f50.google.com with SMTP id g10so6716311wmc.1 for ; Fri, 31 Jul 2020 09:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i2sqstkKa1Zcjc8fPQfIE4TCNIxCcsWZAUa8ji+qfr8=; b=LyW7pHpt5VAGGKyyk1ArsK56yyBDhRHHc4+GVgMOuFCJxug0GTeqYrT4G1JkouEuSU gP7uTpW9krH+3sfSZnPHP7zaa1OXOS3jdZ5wU/X8spCgyPNSX5kxtAr5r4pOUvnRntEZ qXoiII6hu3NxdEX4mlIAI8G8uvLLhgPWz5qjW+iuF6l82qPxuVr8jWMRfLXg3+2nEJ45 V/FVaJNL8gMlvxwvN3aGzTo7f7CsAGLTp/xmUnGFc20gxbi+A4YC78kdjWxSdTw+bj+I /3o4X9p3ogL2erdYSVAnUtGb1P0KwZw5+YCvX2Z7ZDhgDkR0lSdORfvgxHKA2ZWwJkbp w8JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i2sqstkKa1Zcjc8fPQfIE4TCNIxCcsWZAUa8ji+qfr8=; b=UMMeIGnBrPWZxi053bjMR57hZLw+lV9ec3YXV/UU+ZDJ4wssUMj0/DdclnCcx+Kn1f F6rZXPrdNIipbyho+iZ2lCmGEgJcJE0oMeWXXoa0v4V5zmN7yaimNzZ6lxRVoHknASLM ePUbSBy1zE72GLq+oasizCzkDAjIUNVdqr4H1O6skmXErlVdx/oNsL7sFQs8y+aJpmJj LR7jm5cnyDYm6QI8InblnGqKOJ2HXICN3tWLbTuMW93qvROaSWzOWnQIq4Vn/CrFIxBg ruOf3WPeCQlKC/a/AjvWpgcZDQFsXutKlKnYl2s2BUzXAr03ZxJY2P0Nque5F1/72191 w6TA== X-Gm-Message-State: AOAM530br3hA6MeB6yzW6z+3QspJKebEjqz7wayQQ20HMCcb6qwQ6aAa pFIiGmHYgVHmVHUWsEbyHKC8Y6n1QvV7yKS1BCA+bzR2VVhKG5SXVJedrJX+tZu0BRgPSCTGk+V 1WchsMlfvhslfhGEZ+Ud5gdwXviQ0VSQ3yhCix8FMTjijYENzjE2mJLxG92bkQh1eRj8= X-Google-Smtp-Source: ABdhPJwJVwgLIpgvkgEiwtX/7OYk1TQwiqLDlDALbqD3UYAbw81ONIqV+YahVabKrWZkxk/7rdxIeQ== X-Received: by 2002:a1c:7f17:: with SMTP id a23mr4345034wmd.28.1596212371605; Fri, 31 Jul 2020 09:19:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain (cpc159317-cmbg20-2-0-cust162.5-4.cable.virginm.net. [81.111.29.163]) by smtp.gmail.com with ESMTPSA id v11sm14149739wrr.10.2020.07.31.09.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 09:19:30 -0700 (PDT) From: "Tomas Pilar (tpilar)" To: devel@edk2.groups.io Cc: Sami Mujawar , Alexei Fedorov Subject: [PATCH 3/8] DynamicTablesPkg: Add ConfigurationManagerDumpApp Date: Fri, 31 Jul 2020 17:19:21 +0100 Message-Id: <20200731161926.341330-4-tomas@nuviainc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200731161926.341330-1-tomas@nuviainc.com> References: <20200731161926.341330-1-tomas@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Simple application to dump the contents of the configuration manager loaded in the platform to the screen. There is no provision in the ConfigurationManagerProtocol for informing consumers of the contents of the database, so the app scans through the known namespaces using the GetObject method. Cc: Sami Mujawar Cc: Alexei Fedorov Signed-off-by: Tomas Pilar --- .../ConfigurationManagerDumpApp.c | 76 +++++++++++++++++++ .../ConfigurationManagerDumpApp.h | 8 ++ .../ConfigurationManagerDumpApp.inf | 42 ++++++++++ .../ConfigurationObjectStrings.c | 50 ++++++++++++ DynamicTablesPkg/DynamicTablesPkg.dsc | 6 ++ 5 files changed, 182 insertions(+) create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf create mode 100644 DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c new file mode 100644 index 0000000000..15936c78c1 --- /dev/null +++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.c @@ -0,0 +1,76 @@ +#include +#include +#include +#include + +#include "ConfigurationManagerDumpApp.h" + +EDKII_CONFIGURATION_MANAGER_PROTOCOL *mCfgMgr; + +EFI_STATUS +EFIAPI +UefiMain( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE * SystemTable + ) +{ + EFI_STATUS Status = gBS->LocateProtocol ( + &gEdkiiConfigurationManagerProtocolGuid, NULL, (VOID **)&mCfgMgr); + + UINTN ObjectId; + CM_OBJ_DESCRIPTOR CmObject; + UINTN Count = 0; + + + if (EFI_ERROR(Status)) { + Print(L"No Configuration Manager installed!\n"); + return EFI_UNSUPPORTED; + } + + for (ObjectId = EObjNameSpaceStandard; ObjectId < EStdObjMax; ObjectId++) { + Status = mCfgMgr->GetObject (mCfgMgr, ObjectId, CM_NULL_TOKEN, &CmObject); + if (EFI_ERROR(Status)) { + continue; + } + + Print ( + L"<%s>::<%s>\n", + ObjectNameSpaceString[EObjNameSpaceStandard], + StdObjectString[ObjectId - EObjNameSpaceStandard]); + + Print ( + L"Id=%x Size=0x%x at=%p count=%d\n", + CmObject.ObjectId, + CmObject.Size, + CmObject.Count, + CmObject.Count); + + Count++; + } + + for (ObjectId = EObjNameSpaceArm; ObjectId < EArmObjMax; ObjectId++) { + Status = mCfgMgr->GetObject (mCfgMgr, ObjectId, CM_NULL_TOKEN, &CmObject); + if (EFI_ERROR(Status)) { + continue; + } + + Print ( + L"<%s>::<%s>\n", + ObjectNameSpaceString[EObjNameSpaceArm], + ArmObjectString[ObjectId - EObjNameSpaceArm]); + + Print ( + L"Id=%x Size=0x%x at=%p count=%d\n", + CmObject.ObjectId, + CmObject.Size, + CmObject.Count, + CmObject.Count); + + Count++; + } + + Print(L"Found %d objects\n", Count); + return EFI_SUCCESS; +} + + diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h new file mode 100644 index 0000000000..5017d55b4a --- /dev/null +++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.h @@ -0,0 +1,8 @@ +#ifndef CONFIGURATION_MANAGER_DUMP_APP_H_ +#define CONFIGURATION_MANAGER_DUMP_APP_H_ + +extern CHAR16 *ArmObjectString[]; +extern CHAR16 *ObjectNameSpaceString[]; +extern CHAR16 *StdObjectString[]; + +#endif diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf new file mode 100644 index 0000000000..9f8beb916d --- /dev/null +++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf @@ -0,0 +1,42 @@ +## @file +# Application that will dump the contents of the configuration +# manager. +# +# Copyright (c) 2020, ARM Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = ConfigurationManagerDumpApp + FILE_GUID = 1E12FA81-8465-4D78-918F-735DB8CB828B + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + ConfigurationManagerDumpApp.c + ConfigurationManagerDumpApp.h + ConfigurationObjectStrings.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + DynamicTablesPkg/DynamicTablesPkg.dec + +[LibraryClasses] + UefiLib + UefiBootServicesTableLib + UefiApplicationEntryPoint + +[Protocols] + gEdkiiConfigurationManagerProtocolGuid # PROTOCOL PRODUCES + + diff --git a/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c new file mode 100644 index 0000000000..ad8dbb6354 --- /dev/null +++ b/DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationObjectStrings.c @@ -0,0 +1,50 @@ + +CHAR16 *ArmObjectString[] = { + L"Reserved", + L"Boot Architecture Info", + L"CPU Info", + L"Power Management Profile Info", + L"GIC CPU Interface Info", + L"GIC Distributor Info", + L"GIC MSI Frame Info", + L"GIC Redistributor Info", + L"GIC ITS Info", + L"Serial Console Port Info", + L"Serial Debug Port Info", + L"Generic Timer Info", + L"Platform GT Block Info", + L"Generic Timer Block Frame Info", + L"Platform Generic Watchdog", + L"PCI Configuration Space Info", + L"Hypervisor Vendor Id", + L"Fixed feature flags for FADT", + L"ITS Group", + L"Named Component", + L"Root Complex", + L"SMMUv1 or SMMUv2", + L"SMMUv3", + L"PMCG", + L"GIC ITS Identifier Array", + L"ID Mapping Array", + L"SMMU Interrupt Array", + L"Processor Hierarchy Info", + L"Cache Info", + L"Processor Node ID Info", + L"CM Object Reference", + L"Memory Affinity Info", + L"Device Handle Acpi", + L"Device Handle Pci", + L"Generic Initiator Affinity" +}; + +CHAR16 *ObjectNameSpaceString[] = { + L"Standard Objects Namespace", + L"ARM Objects Namespace", + L"OEM Objects Namespace" +}; + +CHAR16 *StdObjectString[] = { + L"Configuration Manager Info", + L"ACPI table Info List", + L"SMBIOS table Info List" +}; diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc index 346fa8ccdd..367e06a855 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dsc +++ b/DynamicTablesPkg/DynamicTablesPkg.dsc @@ -30,6 +30,11 @@ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + [LibraryClasses.ARM, LibraryClasses.AARCH64] NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf @@ -38,6 +43,7 @@ [Components.common] DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf + DynamicTablesPkg/Applications/ConfigurationManagerDumpApp/ConfigurationManagerDumpApp.inf [BuildOptions] *_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES -- 2.25.1