From patchwork Thu Mar 1 18:11:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130376 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3117588edc; Thu, 1 Mar 2018 10:12:07 -0800 (PST) X-Google-Smtp-Source: AG47ELuF5Bpa3Qxy3D3MDIKYNDTcy9PvQl6oxmhtubKDIW53trdpHFRRA90wZbqmW1+/Eq9uhGye X-Received: by 10.99.4.66 with SMTP id 63mr2227154pge.93.1519927927130; Thu, 01 Mar 2018 10:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519927927; cv=none; d=google.com; s=arc-20160816; b=mApKj3I/n8FkBrQZrRJAxNjEtgCNW61nReHBG2SjQ5nmMDa7N/aNS/pIEuqr+wfvLF YJWE8LaCyl09t81tRY+nqx+rb8fpWDBQ4qAtnePqj9s33Q47vSEIwzbSR85yHJ7Wc/zU h1w04T/0Z3Ue6hwkmla5foQ3XAe4t/aqnMLOM2JqJj9mzDyHZbreQQAdj4IJX5fd02Vu lk9dDfG1lGg1inZAd1QIORG48Gu6o7/oX3evnJBwpV5jtO6X0ufJFBTf1R7aSiV1V8lm 5C4UDDCu5XlD/jEt2taUZyErX2S9YTjmFaQVDIuU2zEkzXcla3nXNc49jfzkMFwoyCau qBVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=KO/+3FQwxto+yslnsdBMDq2OU1keUwUSv/b7lE+HzFQ=; b=OB+p3S4oMK5q8q/79Sm4rA84u8O2xqZ5fehDezdti5kJSCMwSGpzUlXH8qcl4cF/Qr H+BnTzBNx1VMGdPvF7dxjz6/HwzIly+ELN7hoS0OIEgLfhQ6d0OmGKGZjg9FBQs8VWaO fwReyVM4bhbCy2XwR9o/mwW+jkY7suWdRvg500HLaPJszPHaGd/4DptuhMNPR5z5KOe4 0jNd1KINsEQJvHQhJgW61IeGYdlHr4r+shuG9FUNKAMUG3KpJFGOU/jc0/XKbYNKZGpK haoUVHhI1UMZwfn1yGUi2D2SELF7YwxGjrXAkpC068KyZi9PN9xBeJdqVLnfWWqe4gX9 vsEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UK96FO3M; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id w19-v6si3311687plq.735.2018.03.01.10.12.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 10:12:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UK96FO3M; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DCC71224511A5; Thu, 1 Mar 2018 10:05:57 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: eric.dong@intel.com, Ard Biesheuvel , leif.lindholm@linaro.org, heyi.guo@linaro.org, liming.gao@intel.com, michael.d.kinney@intel.com, lersek@redhat.com, star.zeng@intel.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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.