From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BF5BE2245119D for ; Thu, 1 Mar 2018 10:05:55 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id l43so7573929wrc.2 for ; Thu, 01 Mar 2018 10:12:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fu8z9X4IjWt97oDD7jGUNSoYqeeX5c2xvxyJzOvpZRE=; b=UK96FO3M0E6DxxRcyGyHXuluOU+Orts2wK1BwgHgY0SS3DUIrFQQe/9GVpkzks66e/ 7eZdJ3WYr+IDK1sieVt2zB29Um3b9PMD9C7YSvrbkey4Zp7tNYBHx5oIYsGqA7HlWXfU eHfN9BAU3pz4imN8sA0gd9ZLU5+QYaxnYY858= 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; bh=fu8z9X4IjWt97oDD7jGUNSoYqeeX5c2xvxyJzOvpZRE=; b=dxIP4ZRDesh6VzuABCmsaUCWdUnHxQpSgvf/C3AvteCAdbF7cX8lQ2Uc/IyoBj47nJ cX01u+IKTv/I3yoybIozpytuUoy8tY7JmlfnfIkmrksBiebNHjJZfBG770zITaAcLfBq Qsrok0754g/v+cAsKPkRZwUGAD8eTeK81zISJoTZgxl7Iva8onXJBkDAnVn5h9fUqBYG /sSUHujT2ITFZ8DiRp6h3Q1/jsc/X6S3O6TDuYjjGX3t4rIQTqQ2tfjDp2cNxwzPGw6Z I42/mmzy4AaEPogjjHVXqJqci3RLb4wc6f8n8HtiwWBdh41j4M3ZaFTWAPw60jgn9bsK Eh0A== X-Gm-Message-State: APf1xPCMpzyPGExxphXbGGBtQYUikJtxXqhAv3QtVFXXgP+RlTSr4a6/ dCmHplIxe7ym3Z8CYpaAZfQ+4Y7nzVE= X-Google-Smtp-Source: AG47ELuCsRmhpinrZg8Lze1zggGYuc/CkiK9LSgCW1r2WUdsMafgLUmYQbwK+K8MdjrSr/YQ4LlMWQ== X-Received: by 10.223.201.11 with SMTP id m11mr2822726wrh.146.1519927922779; Thu, 01 Mar 2018 10:12:02 -0800 (PST) Received: from localhost.localdomain ([196.71.216.221]) by smtp.gmail.com with ESMTPSA id w195sm78568wmw.9.2018.03.01.10.11.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 10:12:02 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: lersek@redhat.com, leif.lindholm@linaro.org, heyi.guo@linaro.org, star.zeng@intel.com, eric.dong@intel.com, michael.d.kinney@intel.com, liming.gao@intel.com, Ard Biesheuvel Date: Thu, 1 Mar 2018 18:11:40 +0000 Message-Id: <20180301181142.16817-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180301181142.16817-1-ard.biesheuvel@linaro.org> References: <20180301181142.16817-1-ard.biesheuvel@linaro.org> Subject: [PATCH 2/4] MdeModulePkg: introduce runtime debug output protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 18:05:56 -0000 Introduce a EDK2 specific protocol that may be invoked to produce debug output at runtime. This may be used, e.g., by DebugLib library class implementations called from DXE_RUNTIME_DRIVER modules, which may only be able to produce debug output at boot time, and will be able to defer to this protocol to produce debug output at runtime as well. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Include/Protocol/RuntimeDebugOutput.h | 58 ++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 4 ++ 2 files changed, 62 insertions(+) diff --git a/MdeModulePkg/Include/Protocol/RuntimeDebugOutput.h b/MdeModulePkg/Include/Protocol/RuntimeDebugOutput.h new file mode 100644 index 000000000000..ac6e0c27d86d --- /dev/null +++ b/MdeModulePkg/Include/Protocol/RuntimeDebugOutput.h @@ -0,0 +1,58 @@ +/** @file + Protocol for emitting debug output at runtime. May be consumed by DebugLib + implementations that can only produce output safely at boot time. + + Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __EDK2_RUNTIME_DEBUG_OUTPUT_H__ +#define __EDK2_RUNTIME_DEBUG_OUTPUT_H__ + +#define EDK2_RUNTIME_DEBUG_OUTPUT_PROTOCOL_GUID \ + { 0x3f4fe308, 0x2284, 0x4ca2, { 0xbe, 0x2c, 0x2d, 0xa8, 0xdf, 0x7a, 0xec, 0xd6 } } + +typedef struct _EDK2_RUNTIME_DEBUG_OUTPUT_PROTOCOL EDK2_RUNTIME_DEBUG_OUTPUT_PROTOCOL; + +/** + Write data from buffer to debug output device + + Writes NumberOfBytes data bytes from Buffer to the debug output device. + The number of bytes actually written to the device is returned. + If the return value is less than NumberOfBytes, then the write operation + failed. + If NumberOfBytes is zero, then return 0. + + @param Buffer Pointer to the data buffer to be written. + @param NumberOfBytes Number of bytes to written to the device. + + @retval 0 NumberOfBytes is 0. + @retval >0 The number of bytes written to the serial device. + If this value is less than NumberOfBytes, then the + write operation failed. + +**/ +typedef +UINTN +(EFIAPI *RUNTIME_DEBUG_OUTPUT_WRITE) ( + IN EDK2_RUNTIME_DEBUG_OUTPUT_PROTOCOL *This, + IN UINT8 *Buffer, + IN UINTN NumberOfBytes + ); + + +struct _EDK2_RUNTIME_DEBUG_OUTPUT_PROTOCOL { + RUNTIME_DEBUG_OUTPUT_WRITE Write; +}; + +extern EFI_GUID gEdkiiRuntimeDebugOutputProtocolGuid; + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index ba0585936b6e..faaf189fe464 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -592,6 +592,10 @@ [Protocols] gEdkiiPlatformSpecificResetFilterProtocolGuid = { 0x695d7835, 0x8d47, 0x4c11, { 0xab, 0x22, 0xfa, 0x8a, 0xcc, 0xe7, 0xae, 0x7a } } ## Include/Protocol/PlatformSpecificResetHandler.h gEdkiiPlatformSpecificResetHandlerProtocolGuid = { 0x2df6ba0b, 0x7092, 0x440d, { 0xbd, 0x4, 0xfb, 0x9, 0x1e, 0xc3, 0xf3, 0xc1 } } + + ## Include/Protocol/RuntimeDebugOutput.h + gEdkiiRuntimeDebugOutputProtocolGuid = { 0x3f4fe308, 0x2284, 0x4ca2, { 0xbe, 0x2c, 0x2d, 0xa8, 0xdf, 0x7a, 0xec, 0xd6 } } + # # [Error.gEfiMdeModulePkgTokenSpaceGuid] # 0x80000001 | Invalid value provided. -- 2.11.0