From patchwork Mon Apr 25 20:06:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 66625 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1235620qge; Mon, 25 Apr 2016 13:13:21 -0700 (PDT) X-Received: by 10.98.67.143 with SMTP id l15mr42768545pfi.114.1461615201420; Mon, 25 Apr 2016 13:13:21 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si8357262pfr.51.2016.04.25.13.13.21; Mon, 25 Apr 2016 13:13:21 -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=@codeblueprint-co-uk.20150623.gappssmtp.com; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965080AbcDYUNS (ORCPT + 29 others); Mon, 25 Apr 2016 16:13:18 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35480 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933491AbcDYUIB (ORCPT ); Mon, 25 Apr 2016 16:08:01 -0400 Received: by mail-wm0-f50.google.com with SMTP id e201so98087673wme.0 for ; Mon, 25 Apr 2016 13:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qteEJS6MWqtCuLPjBmj0GHeOHGKbJw3r99WjGQygT+Y=; b=q5MXFJXXbk/rMwadcj0OYkGqhl1BHjMLsQtpHGdb4KtHWQ90ZnQXA22jdk7tFQAmIH eF6MLa1eFV2OXoh7pkOKGSIZmpbnOsnv9QeMj5B5Kv44PE/fEazor+TywwuH8a4HDDut Qb/ydbKxyfn/HMY+9vXkkkYD9sA2ivdZbcwJz6UaKJbMh7vrZBb5FRyNRBZPUc9+w9Sc FZTW2ByUYT/ef3Qte9dgxQjLXAw5IUv/dsClxGRqh4k4scMzYurFZkHHjadmvd4jwYUH vcM+Hi2G77ZFH+fIJBeviNldyB2HdG1/42oqdO7BA6jH90ZAGqPSHbvx+ZbHZ5LFEqMg 2Keg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qteEJS6MWqtCuLPjBmj0GHeOHGKbJw3r99WjGQygT+Y=; b=mbSr+PZlUErCo1p6txELOgeroWMTJhIIMIaB6x5CLGeGCIN/av4LQXUeYT+EKbcyoL PaBauefcdzCB7hBOJjGEUbjdzk52E1fgkUdOvcqRiscx8EpiH6iXXP3BD4omeUzNCKFH trgqjXzkUt7+sJGBMBQNQO9LTNpNHL5LotKc/GxRo3zArFjRGLuYvcZ70iO4DC0Altxr XQQy2rkoEGH+tkf4AwCYHcNBDeDB/3Kt/NRxJUE9bD9VepGfOuSTm/rd0KG7f+UvztZt ZLJK9hTah9oWv1tAGnJivG3ae9bqr8e4lRjkhSlzs+/Wy0C1LEahwAQnc6sfLk0b3LSI JXlw== X-Gm-Message-State: AOPr4FXFe/C23Fqe5dW3qf7Jvs0CvLh9/q0ATyQJgx5fKFyjVTQ1dFmejVs3WyxztDxA+w== X-Received: by 10.194.227.1 with SMTP id rw1mr35754405wjc.62.1461614879593; Mon, 25 Apr 2016 13:07:59 -0700 (PDT) Received: from localhost (bcdc58e5.skybroadband.com. [188.220.88.229]) by smtp.gmail.com with ESMTPSA id r75sm19771566wme.18.2016.04.25.13.07.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Apr 2016 13:07:59 -0700 (PDT) From: Matt Fleming To: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Matt Fleming , David Herrmann , Mark Rutland , Peter Jones , Will Deacon Subject: [PATCH 22/40] efi/arm*: libstub: Wire up GOP protocol to struct screen_info Date: Mon, 25 Apr 2016 21:06:54 +0100 Message-Id: <1461614832-17633-23-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> References: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel This adds the code to the ARM and arm64 versions of the UEFI stub to populate struct screen_info based on the information received from the firmware via the GOP protocol. Signed-off-by: Ard Biesheuvel Cc: Mark Rutland Cc: Will Deacon Cc: David Herrmann Cc: Peter Jones Signed-off-by: Matt Fleming --- drivers/firmware/efi/libstub/arm-stub.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.7.3 diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 128632508fc6..993aa56755f6 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -169,6 +169,25 @@ void efi_char16_printk(efi_system_table_t *sys_table_arg, out->output_string(out, str); } +static struct screen_info *setup_graphics(efi_system_table_t *sys_table_arg) +{ + efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; + efi_status_t status; + unsigned long size; + void **gop_handle = NULL; + struct screen_info *si = NULL; + + size = 0; + status = efi_call_early(locate_handle, EFI_LOCATE_BY_PROTOCOL, + &gop_proto, NULL, &size, gop_handle); + if (status == EFI_BUFFER_TOO_SMALL) { + si = alloc_screen_info(sys_table_arg); + if (!si) + return NULL; + efi_setup_gop(sys_table_arg, si, &gop_proto, size); + } + return si; +} /* * This function handles the architcture specific differences between arm and @@ -208,6 +227,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, unsigned long reserve_addr = 0; unsigned long reserve_size = 0; int secure_boot = 0; + struct screen_info *si; /* Check if we were booted by the EFI firmware */ if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) @@ -260,6 +280,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, __nokaslr = true; } + si = setup_graphics(sys_table); + status = handle_kernel_image(sys_table, image_addr, &image_size, &reserve_addr, &reserve_size, @@ -341,6 +363,7 @@ fail_free_image: efi_free(sys_table, image_size, *image_addr); efi_free(sys_table, reserve_size, reserve_addr); fail_free_cmdline: + free_screen_info(sys_table, si); efi_free(sys_table, cmdline_size, (unsigned long)cmdline_ptr); fail: return EFI_ERROR;