Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2316595imm; Sun, 5 Aug 2018 01:19:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpffQU/ioKXG5Dk0gVOkj8d4Q6in0cHhN/5QqiisjkObZTs7J+3pRI9UA0KL4uDq5o6IGeqf X-Received: by 2002:a17:902:bc49:: with SMTP id t9-v6mr9771388plz.116.1533457160639; Sun, 05 Aug 2018 01:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533457160; cv=none; d=google.com; s=arc-20160816; b=EdkRSsBtqi2PLWMAT8nA0IAKlnUYsmO6wuaoZXnKOmLdjh4Gx18OLphfwzZvZGCgDu XBv20uZlzRdXGWM80k75zcF7DOTa0NbZDCgt4jN8L6GTol9I6C7LglnsLijpQiDiIRcs PHCWyZ9GNVoO3br7u3qVy9YmAUG6Il8C+W1PUkD2fIhv+D9at81s3oG8ZqeO8wmXcHhA HVj+lsrTZD7XG6c+5L2oXQEPIf/o2eLY63ewwG8j8kGqvgQWa/t0RRBSTbdZvDUmgRz3 7SLFUCZYUdkslTYc3SppdxKaUVJ880yxnMFtPlCRBHudf7f2QGAk5piCSa6ZZyntN+qD HQ3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=yT6owx9DHj0U08psBNj/nXo0h3fpKNs+e7+vxhr2q2Q=; b=jLS6fw0flX8z8lFiMz1xo2kX2s9R6tb5P9HUHbD2SKIrkm5b/J+fin5MqEL/0NBbcN T4VBxEmgix5nYfiqpfsQPIVXlRfC0Sefhv75p+5Y1Af4NZi5aCr6bzWK9muiJfbGL4kk X23rvUBxn6wOAhhaPAp7SVH9JDSWDiRjJHt3g5fIKuzOU/OW13Rmy1kigkHd89gj6pJF aIXzr/Y+J3nkhVhcHzaW7utuZVFvODsf6hGEUbz5+2pL4IkjBvXgjp4Fmq8u8vQbQyMm rWdOCWoxMXuYFrWXzdOe3O8AzqriTlIbn+KTD6GemiblTmeK5+CeQGOMUG/e6uBG7955 z3dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a0Q+K3CA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si9721943pgk.344.2018.08.05.01.19.06; Sun, 05 Aug 2018 01:19:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a0Q+K3CA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726233AbeHEKVV (ORCPT + 99 others); Sun, 5 Aug 2018 06:21:21 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:37027 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbeHEKVV (ORCPT ); Sun, 5 Aug 2018 06:21:21 -0400 Received: by mail-io0-f195.google.com with SMTP id z19-v6so8498327ioh.4 for ; Sun, 05 Aug 2018 01:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yT6owx9DHj0U08psBNj/nXo0h3fpKNs+e7+vxhr2q2Q=; b=a0Q+K3CAb2USl39VuC84XQeq7G0dkce1rUOsy5S6O7ZVu0TVEdXDrHsz108UI+mqgN cUdQ16OuP3YTCp/tiTdC+cHNcRB2tZaDHuduHzlngYK6w6EDOnPfxizuXu5aOhqoDmRL ghcaYWIz8AoCLidlvlVmlmhK74fC5Qi65eXxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yT6owx9DHj0U08psBNj/nXo0h3fpKNs+e7+vxhr2q2Q=; b=tz4BsT/Zrjo69hc9X+ZKevZsqsIYnkCxJhb5wQHxBDiGvRG9gpGcqWJeQo7uXs6m7v 9X8kCcSz5jqUPJOhK2WyVXl7I2YBOt2Fw0sLyHp8QehAcexDBplQZSPktS3vk5N9X66c HM30L53LiYAU4vDLNrUWQfNH9Hvt5PVOWdgqR9420xYSt6BxJIojvElriMpB35Z32fJG 8B7b2fhYMpnJmxg0DxXRQRrObKP65Wk08FTkR5e6h0q3lVw9Pa+d5SwwufNeqXpcBHBE v6/hyDirARwncZLRaLWnWM3DfUOZxTUYTQuNBsL3osdlbpUJcpr1Z+eNBz37nwYf2yk2 f0OA== X-Gm-Message-State: AOUpUlHMKYd1rePAtHf+DWDnvMxpJfx444Sb7uan8zKJlMbfWXwXGkFK LOV/kdPbYEj9RI3E/uemuKX3W0Uj77wtUJ7h/0hygQ== X-Received: by 2002:a6b:be83:: with SMTP id o125-v6mr11416460iof.173.1533457057156; Sun, 05 Aug 2018 01:17:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ac05:0:0:0:0:0 with HTTP; Sun, 5 Aug 2018 01:17:36 -0700 (PDT) In-Reply-To: <20180805032119.20485-3-jlee@suse.com> References: <20180805032119.20485-1-jlee@suse.com> <20180805032119.20485-3-jlee@suse.com> From: Ard Biesheuvel Date: Sun, 5 Aug 2018 10:17:36 +0200 Message-ID: Subject: Re: [PATCH 2/6] efi: the function transfers status to string To: "Lee, Chun-Yi" Cc: Linux Kernel Mailing List , linux-efi , "the arch/x86 maintainers" , keyrings@vger.kernel.org, linux-integrity , "Lee, Chun-Yi" , Kees Cook , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Pavel Machek , Chen Yu , Oliver Neukum , Ryan Chen , David Howells , Mimi Zohar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5 August 2018 at 05:21, Lee, Chun-Yi wrote: > This function can be used to transfer EFI status code to string > for printing out debug message. > > Cc: Kees Cook > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: "Rafael J. Wysocki" > Cc: Pavel Machek > Cc: Chen Yu > Cc: Oliver Neukum > Cc: Ryan Chen > Cc: Ard Biesheuvel > Cc: David Howells > Cc: Mimi Zohar > Signed-off-by: "Lee, Chun-Yi" Very useful. Acked-by: Ard Biesheuvel > --- > include/linux/efi.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/include/linux/efi.h b/include/linux/efi.h > index 56add823f190..744cf92fe18e 100644 > --- a/include/linux/efi.h > +++ b/include/linux/efi.h > @@ -1651,4 +1651,30 @@ struct linux_efi_tpm_eventlog { > > extern int efi_tpm_eventlog_init(void); > > +#define EFI_STATUS_STR(_status) \ > +case EFI_##_status: \ > + return "EFI_" __stringify(_status); > + > +static inline char * > +efi_status_to_str(efi_status_t status) > +{ > + switch (status) { > + EFI_STATUS_STR(SUCCESS) > + EFI_STATUS_STR(LOAD_ERROR) > + EFI_STATUS_STR(INVALID_PARAMETER) > + EFI_STATUS_STR(UNSUPPORTED) > + EFI_STATUS_STR(BAD_BUFFER_SIZE) > + EFI_STATUS_STR(BUFFER_TOO_SMALL) > + EFI_STATUS_STR(NOT_READY) > + EFI_STATUS_STR(DEVICE_ERROR) > + EFI_STATUS_STR(WRITE_PROTECTED) > + EFI_STATUS_STR(OUT_OF_RESOURCES) > + EFI_STATUS_STR(NOT_FOUND) > + EFI_STATUS_STR(ABORTED) > + EFI_STATUS_STR(SECURITY_VIOLATION) > + } > + > + return ""; > +} > + > #endif /* _LINUX_EFI_H */ > -- > 2.13.6 >