From patchwork Fri Mar 18 16:47:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 64083 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp66833lbc; Fri, 18 Mar 2016 09:48:29 -0700 (PDT) X-Received: by 10.66.55.102 with SMTP id r6mr24936731pap.67.1458319705330; Fri, 18 Mar 2016 09:48:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qz9si2578663pab.94.2016.03.18.09.48.24; Fri, 18 Mar 2016 09:48:25 -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 S1753988AbcCRQsN (ORCPT + 30 others); Fri, 18 Mar 2016 12:48:13 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:34755 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753589AbcCRQsI (ORCPT ); Fri, 18 Mar 2016 12:48:08 -0400 Received: by mail-wm0-f43.google.com with SMTP id p65so76921349wmp.1 for ; Fri, 18 Mar 2016 09:48:07 -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=hKDyybEvE3W+PzHSvCVukSQRxpyrNZDhoAppyGJy5IY=; b=bRPbvomCeWe295I7b+8gKM7WKFIUHKO78Ixy5jl785ROAY6kS0EtZN0FtHU55BsZY7 Y4ykDd2piJeVSUoRceiDtLTBlzQu//L+fu0y2ww2bm910yFawJEhKnnu6dAaY3un08Bu twnnajI+YGMrEC+nJNk925I6vZ2/gqzoz8quM= 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=hKDyybEvE3W+PzHSvCVukSQRxpyrNZDhoAppyGJy5IY=; b=gE9J11QsNQfY7rfcXnB2+O9laQOKc0F3LIkTDaqKScj2xRNZdq1uzIpnLkto827SKH VyrXtlIWlDw2dfpw0vLCHJVqmtljudHPAF9SRXJyrRCSp5H+iPD9J6f6AtBY/NSVSjKy 0ePQ+tuU0Ia7/9XYnbW3/3Wn/owV5I2oifyYa2F8fdhvg3MifGIb+SnUZA+4s11XS6JW LSuOte83wpWYJm/8ewpwAg4KVZArMYLKcRn8yWWoBGd80+sx5gF5P/1uXpfddFidK4zC Btv+IZjcPKZFxy3VG53aIZIiqMpx+PgrIGe+ZPITMpZzRefnGa/NN5f1kR6gI2a4mqCY gubw== X-Gm-Message-State: AD7BkJJ5/1hA8GYExaihv1rmJtXGI4sJR7IPI2XexqcC1e8TvMNbDvHRQTTZIhrBC7sRRUIZ X-Received: by 10.28.224.212 with SMTP id x203mr318064wmg.75.1458319686758; Fri, 18 Mar 2016 09:48:06 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id c71sm118646wmd.4.2016.03.18.09.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Mar 2016 09:48:06 -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 8/9] efi/arm*: wire up struct screen_info to efi-framebuffer platform device Date: Fri, 18 Mar 2016 17:47:40 +0100 Message-Id: <1458319661-19762-9-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 code to the ARM and arm64 EFI init routines to expose a platform device of type 'efi-framebuffer' if struct screen_info has been populated appropriately from the GOP protocol by the stub. Since the framebuffer may potentially be located in system RAM, make sure that the region is reserved and marked MEMBLOCK_NOMAP. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.5.0 diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index acd44de30504..f5f13b871d42 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,10 @@ static void __init init_screen_info(void) screen_info = *si; early_memunmap(si, sizeof(*si)); } + + if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI && + memblock_is_map_memory(screen_info.lfb_base)) + memblock_mark_nomap(screen_info.lfb_base, screen_info.lfb_size); } static int __init uefi_init(void) @@ -235,3 +240,16 @@ void __init efi_init(void) init_screen_info(); } + +static int __init register_gop_device(void) +{ + void *pd; + + if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) + return 0; + + /* the efifb driver accesses screen_info directly, no need to pass it */ + pd = platform_device_register_simple("efi-framebuffer", 0, NULL, 0); + return PTR_ERR_OR_ZERO(pd); +} +subsys_initcall(register_gop_device);