From patchwork Tue Aug 11 06:13:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 6988471 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0516C9F373 for ; Tue, 11 Aug 2015 06:15:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 222DD2063B for ; Tue, 11 Aug 2015 06:15:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BBCF2060B for ; Tue, 11 Aug 2015 06:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755206AbbHKGPA (ORCPT ); Tue, 11 Aug 2015 02:15:00 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33788 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755107AbbHKGO6 (ORCPT ); Tue, 11 Aug 2015 02:14:58 -0400 Received: by pabyb7 with SMTP id yb7so122948463pab.0; Mon, 10 Aug 2015 23:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TaHg4S6xBO1ThTrXe101rBA5+DufpTZUnvn/Gy6w1yQ=; b=KtJgje0Xb9MhG9NID6SIiTMH/DL+2EAuoGNiaPR1torJ5nHacL3T9CejqszBULnN4H LHLUxysDQKrX4IXshKoaexnR/iiKfbWyKioy6Z2pMaWJyvGxqbfwFyw9vNzgfVsZ5rtZ 9lg2ByxhOWSNlSVY+okMQFiqat25msQXZUBLhi/D+GwdTOjiKH/XheusYO0QkBPIdBQU bzMtVVjJb0r7q1vTa4DYCgStsKt8yfUHhjSxMHvkkhG5BMsp700WDIQPU6yK1qS2E+i6 rrsDvGaAVCJYWh/wD8H33MFG2ahU0mucex+t4RPGS+l53qOtmK3spwKjt1WEoI9e9mfw iV4A== X-Received: by 10.68.166.97 with SMTP id zf1mr52983299pbb.72.1439273698070; Mon, 10 Aug 2015 23:14:58 -0700 (PDT) Received: from linux-rxt1.site ([130.57.30.250]) by smtp.gmail.com with ESMTPSA id oq7sm1083157pbb.31.2015.08.10.23.14.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 23:14:57 -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, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Matthew Garrett , Len Brown , Pavel Machek , Josh Boyer , Vojtech Pavlik , Matt Fleming , Jiri Kosina , "H. Peter Anvin" , Ingo Molnar , "Lee, Chun-Yi" Subject: [PATCH v2 02/16] x86/efi: Add get and set variable to EFI services pointer table Date: Tue, 11 Aug 2015 14:13:33 +0800 Message-Id: <1439273627-25111-3-git-send-email-jlee@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1439273627-25111-1-git-send-email-jlee@suse.com> References: <1439273627-25111-1-git-send-email-jlee@suse.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add get variable and set variable function to EFI services pointer table for supporting later functions of hibernate signature verification to keep the HMAC key in efi boot service variable. EFI boot stub needs get/set_variable functions for accessing key. Reviewed-by: Jiri Kosina Tested-by: Jiri Kosina Signed-off-by: Lee, Chun-Yi --- arch/x86/boot/compressed/eboot.c | 4 ++++ arch/x86/boot/compressed/head_32.S | 6 +++--- arch/x86/boot/compressed/head_64.S | 8 ++++---- arch/x86/include/asm/efi.h | 2 ++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 2c82bd1..0ffb6db 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -30,12 +30,14 @@ static void setup_boot_services##bits(struct efi_config *c) \ { \ efi_system_table_##bits##_t *table; \ efi_boot_services_##bits##_t *bt; \ + efi_runtime_services_##bits##_t *rt; \ \ table = (typeof(table))sys_table; \ \ c->text_output = table->con_out; \ \ bt = (typeof(bt))(unsigned long)(table->boottime); \ + rt = (typeof(rt))(unsigned long)(table->runtime); \ \ c->allocate_pool = bt->allocate_pool; \ c->allocate_pages = bt->allocate_pages; \ @@ -45,6 +47,8 @@ static void setup_boot_services##bits(struct efi_config *c) \ c->locate_handle = bt->locate_handle; \ c->handle_protocol = bt->handle_protocol; \ c->exit_boot_services = bt->exit_boot_services; \ + c->get_variable = rt->get_variable; \ + c->set_variable = rt->set_variable; \ } BOOT_SERVICES(32); BOOT_SERVICES(64); diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index 8ef964d..a7db5e3 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S @@ -54,7 +54,7 @@ ENTRY(efi_pe_entry) /* Relocate efi_config->call() */ leal efi32_config(%esi), %eax - add %esi, 88(%eax) + add %esi, 104(%eax) pushl %eax call make_boot_params @@ -80,7 +80,7 @@ ENTRY(efi32_stub_entry) /* Relocate efi_config->call() */ leal efi32_config(%esi), %eax - add %esi, 88(%eax) + add %esi, 104(%eax) pushl %eax 2: call efi_main @@ -230,7 +230,7 @@ relocated: #ifdef CONFIG_EFI_STUB .data efi32_config: - .fill 11,8,0 + .fill 13,8,0 .long efi_call_phys .long 0 .byte 0 diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index b0c0d16..471b1c1 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -255,7 +255,7 @@ ENTRY(efi_pe_entry) /* * Relocate efi_config->call(). */ - addq %rbp, efi64_config+88(%rip) + addq %rbp, efi64_config+104(%rip) movq %rax, %rdi call make_boot_params @@ -275,7 +275,7 @@ handover_entry: * Relocate efi_config->call(). */ movq efi_config(%rip), %rax - addq %rbp, 88(%rax) + addq %rbp, 104(%rax) 2: movq efi_config(%rip), %rdi call efi_main @@ -448,14 +448,14 @@ efi_config: #ifdef CONFIG_EFI_MIXED .global efi32_config efi32_config: - .fill 11,8,0 + .fill 13,8,0 .quad efi64_thunk .byte 0 #endif .global efi64_config efi64_config: - .fill 11,8,0 + .fill 13,8,0 .quad efi_call .byte 1 #endif /* CONFIG_EFI_STUB */ diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 155162e..a274aa8 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -175,6 +175,8 @@ struct efi_config { u64 handle_protocol; u64 exit_boot_services; u64 text_output; + u64 get_variable; + u64 set_variable; efi_status_t (*call)(unsigned long, ...); bool is64; } __packed;