From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=45.249.212.191; helo=huawei.com; envelope-from=guoheyi@huawei.com; receiver=edk2-devel@lists.01.org Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9DAC0211CFBD5 for ; Thu, 28 Feb 2019 00:06:43 -0800 (PST) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D0E181167057ECE71270; Thu, 28 Feb 2019 16:06:37 +0800 (CST) Received: from linux-fhAnjn.huawei.com (10.175.104.222) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.408.0; Thu, 28 Feb 2019 16:06:30 +0800 From: Heyi Guo To: CC: , Laszlo Ersek , "Ard Biesheuvel" , Julien Grall , Heyi Guo Date: Thu, 28 Feb 2019 16:05:12 +0800 Message-ID: <1551341112-21645-4-git-send-email-guoheyi@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551341112-21645-1-git-send-email-guoheyi@huawei.com> References: <1551341112-21645-1-git-send-email-guoheyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.222] X-CFilter-Loop: Reflected Subject: [RFC 3/3] ArmVirtQemu: enable runtime debug by build flag X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 X-List-Received-Date: Thu, 28 Feb 2019 08:06:44 -0000 Content-Type: text/plain Introduce a build definition "RT_DEBUG" to enable runtime debug, so that we can have a handy method for UEFI runtime services debug. This build flag only applies to DEBUG build; the reason for not enabling it for DEBUG build by default is the related modules have some dependencies, so "DEBUG(())" won't print any anything until the status code handler driver has run. User needs to specify "-D RT_DEBUG=TRUE"; "-D RT_DEBUG" is not enough for we use !if $(RT_DEBUG)==TRUE in the code. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Julien Grall Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo Signed-off-by: Heyi Guo --- ArmVirtPkg/ArmVirt.dsc.inc | 6 ++++++ ArmVirtPkg/ArmVirtQemu.dsc | 13 +++++++++++++ ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index d172a08..26984d6 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -240,8 +240,14 @@ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf !if $(TARGET) != RELEASE +!if $(RT_DEBUG) == TRUE + SerialPortLib|ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLibRuntime.inf + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf + DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf +!else DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf !endif +!endif !if $(SECURE_BOOT_ENABLE) == TRUE BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index d703317..6309903 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -37,6 +37,7 @@ DEFINE SECURE_BOOT_ENABLE = FALSE DEFINE NETWORK_IP6_ENABLE = FALSE DEFINE HTTP_BOOT_ENABLE = FALSE + DEFINE RT_DEBUG = FALSE !include ArmVirtPkg/ArmVirt.dsc.inc @@ -93,6 +94,10 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE +!if $(TARGET) != RELEASE && $(RT_DEBUG) == TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerialRuntime|TRUE +!endif + [PcdsFixedAtBuild.common] !if $(ARCH) == AARCH64 gArmTokenSpaceGuid.PcdVFPEnabled|1 @@ -159,7 +164,11 @@ gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04 !endif +!if $(TARGET) != RELEASE && $(RT_DEBUG) == TRUE + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|7 +!else gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3 +!endif [PcdsFixedAtBuild.AARCH64] # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry point, @@ -263,6 +272,10 @@ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf } +!if $(TARGET) != RELEASE && $(RT_DEBUG) == TRUE + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf +!endif + # # Architectural Protocols # diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc index 098d40b..bf86e61 100644 --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc @@ -46,6 +46,11 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Core/Dxe/DxeMain.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + +!if $(TARGET) != RELEASE && $(RT_DEBUG) == TRUE + INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf +!endif + INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf -- 1.8.3.1