From patchwork Fri Mar 18 16:47:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 64086 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp67650lbc; Fri, 18 Mar 2016 09:50:12 -0700 (PDT) X-Received: by 10.67.21.144 with SMTP id hk16mr17826560pad.96.1458319812486; Fri, 18 Mar 2016 09:50:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m22si1388531pfi.43.2016.03.18.09.50.12; Fri, 18 Mar 2016 09:50:12 -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; 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; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932111AbcCRQuJ (ORCPT + 30 others); Fri, 18 Mar 2016 12:50:09 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36273 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751819AbcCRQsG (ORCPT ); Fri, 18 Mar 2016 12:48:06 -0400 Received: by mail-wm0-f53.google.com with SMTP id l124so38076104wmf.1 for ; Fri, 18 Mar 2016 09:48:05 -0700 (PDT) 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=W4Zaax/9g6LcejNbGGfhOuDJ44jBPpoUwiXeeWk1hNw=; b=kTLsZugQWmPHGslXEJyAN3N/Y6xZSNkc9JwndQchXRvVBt4VdEx8LyXcxQAvPl+jo3 /rZEjXxvj3x0Tt8LstOaGtBV7lYs4Z0eBDvTvEtFGnCTBmtGQOheCX4sozlsTwaR+u1f EleS5c8YzSwj8O9NV8cWPX//4J6CnRappJj7I= 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=W4Zaax/9g6LcejNbGGfhOuDJ44jBPpoUwiXeeWk1hNw=; b=S9ICga/vtENEbCB+xtrJhzf975rEWCoVXam+9Ol554qaiuwDXL9kWKynrxVrHaivM7 24YbTKLRSyhJPRS9N5ikUOxc5YDr9i84etZ/+2aL2BpkrZ7xSg4Hw0eRQzVrvKrpebSI Z3v5dAl1beu6tn8FK/OqyYdSNuxZCzyGqM2efBZgEzpKalHESOCPSIaQ9zOXDRVJCL46 L9DtukDHgTwkvGJ3Mbycd9A8YA1tPChNPaPQ0iq7mRjiilp1lqRzpNp6hZUWnIq31ByK +XtvBA68ocAGONBF3fRWdo2Rjnz8D5pCFUKpaPlWxxTKTByZuUN4V0ik7vTYQJhMZHIl PZXQ== X-Gm-Message-State: AD7BkJJ7907I35faW+3hA8QUo7fTiFZk1L2WBjYhmCGxQnEV37DJkIKu/GrLf1INS8fbQN6D X-Received: by 10.28.17.141 with SMTP id 135mr392996wmr.48.1458319684874; Fri, 18 Mar 2016 09:48:04 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id c71sm118646wmd.4.2016.03.18.09.48.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Mar 2016 09:48:04 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt@codeblueprint.co.uk, catalin.marinas@arm.com, will.deacon@arm.com, linux@arm.linux.org.uk, pjones@redhat.com, dh.herrmann@gmail.com Cc: leif.lindholm@linaro.org, mark.rutland@arm.com, x86@kernel.org, Ard Biesheuvel Subject: [PATCH v2 7/9] efi/arm*: libstub: wire up GOP protocol to struct screen_info Date: Fri, 18 Mar 2016 17:47:39 +0100 Message-Id: <1458319661-19762-8-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458319661-19762-1-git-send-email-ard.biesheuvel@linaro.org> References: <1458319661-19762-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/firmware/efi/libstub/arm-stub.c | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.5.0 diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 4deb3e7faa0e..94bd51cfb71e 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -147,6 +147,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 @@ -185,6 +204,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, efi_guid_t loaded_image_proto = LOADED_IMAGE_PROTOCOL_GUID; unsigned long reserve_addr = 0; unsigned long reserve_size = 0; + struct screen_info *si; /* Check if we were booted by the EFI firmware */ if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) @@ -233,6 +253,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, @@ -305,6 +327,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;