Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2132042imm; Sat, 4 Aug 2018 20:24:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeTGlt0Pf2sBBiM/uc6ljSCAraY43JMWlCBFVzSDf60NwDTwOZ6ZQHcoO6gM2umZSv69HW8 X-Received: by 2002:a63:4f63:: with SMTP id p35-v6mr9523250pgl.167.1533439450612; Sat, 04 Aug 2018 20:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533439450; cv=none; d=google.com; s=arc-20160816; b=Tzg7fIaVUdxP6MpwcLMg2+mKHvlKBV3SeGONuk0Kni/9ECYbaElvKd3jqG0nmJ+H05 gfawVWlW6cYaklf8YQaRoLPRYsYq5HliJ+6Ui4c2BGKhwxSf9JK49KAMkK9BCVhzkUH8 0j0CYhsbyO8cLUwX6sZCglRobXPMkaeN6SeP8NSKApFwfsFMAjSqEsgnODPT0ebDl285 gMeOOpyzhsQKl6ouNBbttvUpIshQtmOtE86HKJPmUJG4ag26SK7vXEtqK0xSLGSBbRNG Q1Hd/s/C04Dy94EXvNcQx03nDOV+6GYjrIqZ96iMnoc/PqW6JBqiTuFfIordGPjFbru+ JVrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BuAGMZTZB/GaeZ9hAVW5Hp8cL/O3vjOO5otgQqkjJTg=; b=U67VEBouIkn1a+dXMFVy35L/X9mWTbPHj6vWk7bsK1XlcL6Bwjd4hnqexyqhtVabfp Zcr+y9aHORsNDkr7JpK8w3IZmTMrvhkqjoFriBBHPZzxxR5l8Xqj5aXPh/VeNyY+FVgd LLyz/EkXxKKH3Vtgur9awhnIDwNgERa/vGFRW6e2I56r86gE32sY96yA22zht1BFYvHz KsOXLL4dOt+pBce3PfYVrAs+7QBLwQrDGkbnf4ebVPYcjH+4IAonNw/nRCwzCqMDMJJl kFJ3bfpp24UoGT0+YbZt6DbyfxMo57ME1yyG1BeKLwXAiaSfX7wW0024wb+Ohga8cgW0 WrQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tAQ4GRQx; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q90-v6si9874822pfa.272.2018.08.04.20.23.49; Sat, 04 Aug 2018 20:24:10 -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=@gmail.com header.s=20161025 header.b=tAQ4GRQx; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726774AbeHEFZl (ORCPT + 99 others); Sun, 5 Aug 2018 01:25:41 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35483 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbeHEFZl (ORCPT ); Sun, 5 Aug 2018 01:25:41 -0400 Received: by mail-pf1-f196.google.com with SMTP id p12-v6so5193408pfh.2; Sat, 04 Aug 2018 20:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BuAGMZTZB/GaeZ9hAVW5Hp8cL/O3vjOO5otgQqkjJTg=; b=tAQ4GRQxO3D64fH/A/1Zkmewy+Ov0PaWEkjb9+3rHII4BoHHxHqMpum7zf+7j0Z4ae D7Y3Ew46FxO77EzT3o5IM/Fjx77F5bLExlTuVOjs5D0Vif9Klw4PVeqYXOrVAKEYw33Y vlwxN6rQ51zqqUPSZ6lzI/+fwDgngrNwh0tuOZ6wMXR9FgS/CqDwSSM4ZHi1DxaJJ4d3 NJfoR8CpysUW71NNNpBnzhWAjI3H/tIwsAyGeohnjo81ALX6xBYhcqprjiSjDn/NmuDY lbo1mGjEx2XNAZFwhGoacRKhfZ4PxQpbUcLYlBTZw5qO6/0pRHz5HHsL/4KJkDOfWRWo 9eQQ== 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=BuAGMZTZB/GaeZ9hAVW5Hp8cL/O3vjOO5otgQqkjJTg=; b=N8EWIK30JqC25NFyAvkxPGLd4jMVesXbM+Kk6H2up+wIyxaxmp/wpnDJpNC79rXbBa YrnCD5Zf/PILmbpMMYP9vD+O3DHqvnDXMzpv6tjmt/uk/cZqXsupIQgHNDu4y/Pqxc6+ agNyauFvsZ8uLznHUzuUxD7ZbQ95BpZwYsaT8Co83DqGWlMA50NOErQ95GRlD/2WZF9Y Bcver97qjjv53EhFfrcTh4UO5U1Hcmz7pW1SKOyVYbUgEdDrqxc8S7lGhkeaoTyoW/K5 vkt4/dfoYAkNR/D6PpO+/ddVtJ4aAkOmUVvPLtBB7ZURURdX8W5et4WqJURbzqL34/1v nMPw== X-Gm-Message-State: AOUpUlGziQOMpzJKJvVqoigetS3ZsD6QjYjDmPjCBCfV/eOwnGyHYFNq 8V2LNoSRK0gCgJ5//k6YKozx5kCU X-Received: by 2002:a62:3a9d:: with SMTP id v29-v6mr11271519pfj.215.1533439361801; Sat, 04 Aug 2018 20:22:41 -0700 (PDT) Received: from linux-l9pv.suse ([124.11.22.254]) by smtp.gmail.com with ESMTPSA id x87-v6sm15971922pfa.143.2018.08.04.20.22.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 04 Aug 2018 20:22:41 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, x86@kernel.org, keyrings@vger.kernel.org, linux-integrity@vger.kernel.org, "Lee, Chun-Yi" , Kees Cook , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Pavel Machek , Chen Yu , Oliver Neukum , Ryan Chen , Ard Biesheuvel , David Howells , Mimi Zohar Subject: [PATCH 2/6] efi: the function transfers status to string Date: Sun, 5 Aug 2018 11:21:15 +0800 Message-Id: <20180805032119.20485-3-jlee@suse.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180805032119.20485-1-jlee@suse.com> References: <20180805032119.20485-1-jlee@suse.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" --- 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