From patchwork Fri Jan 10 16:30:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 23096 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F5A2216DB for ; Fri, 10 Jan 2014 16:30:54 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 6sf8114406qea.9 for ; Fri, 10 Jan 2014 08:30:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Bp5IgVTj8GwCtfr4hz1mELqH79PiPbOMrtMlGNTey9Q=; b=mvtD8kXttrcEg+J8skg/myKH/OTe4hIiFvKOKerdhPOJtmh1ZjMvByfitIHRoZ/Ema 7cGoLg1rujThvMN5R8XRw/i7G4MQwUW92f/GpheH4JVexPP8a33+bNUtFjL4nvcCdtkY zmeujdHrc53HV5mb3FjyEMGXtK42xUG3Pp6kiDsS4uA/OCk73qNbUANc1G6VsyhJJv0D 5dkLbQkaFsP7h1ttq5YezLG7Yj4X4HYBxJIwyMtsguwX6oVus0iJZysh0XD9YSVhP7fQ KdJmLWUfPNxR+i/X/K89rbAZ3c6X1dqYlQ0P+29Dlgf2QwIesRzECLuRBoGV3fYiaKFQ 9yLg== X-Gm-Message-State: ALoCoQk6DjUX7AmQ4fkV/4KzHbZqFvqRSGH4LUEd9a0WA5BjkCh5gCOMSLP2V3ThWhR0nUHIOTDd X-Received: by 10.58.242.70 with SMTP id wo6mr3970437vec.16.1389371453526; Fri, 10 Jan 2014 08:30:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.18 with SMTP id d18ls1561688qej.14.gmail; Fri, 10 Jan 2014 08:30:53 -0800 (PST) X-Received: by 10.52.0.107 with SMTP id 11mr7290096vdd.8.1389371453436; Fri, 10 Jan 2014 08:30:53 -0800 (PST) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id in16si5241273vec.118.2014.01.10.08.30.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 08:30:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id w20so3343546vbb.19 for ; Fri, 10 Jan 2014 08:30:53 -0800 (PST) X-Received: by 10.52.26.148 with SMTP id l20mr7350721vdg.28.1389371453314; Fri, 10 Jan 2014 08:30:53 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp100846ved; Fri, 10 Jan 2014 08:30:52 -0800 (PST) X-Received: by 10.66.160.195 with SMTP id xm3mr12423858pab.93.1389371432090; Fri, 10 Jan 2014 08:30:32 -0800 (PST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id dv5si7609253pbb.343.2014.01.10.08.30.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 08:30:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of roy.franz@linaro.org) client-ip=209.85.220.49; Received: by mail-pa0-f49.google.com with SMTP id bj1so1114139pad.8 for ; Fri, 10 Jan 2014 08:30:31 -0800 (PST) X-Received: by 10.69.8.225 with SMTP id dn1mr12666789pbd.54.1389371431400; Fri, 10 Jan 2014 08:30:31 -0800 (PST) Received: from rfranz-i7.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id nw11sm23388124pab.13.2014.01.10.08.30.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jan 2014 08:30:30 -0800 (PST) From: Roy Franz To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt.fleming@intel.com, linux@arm.linux.org.uk Cc: leif.lindholm@linaro.org, grant.likely@linaro.org, dave.martin@arm.com, msalter@redhat.com, patches@linaro.org, Roy Franz Subject: [PATCH V6 3/8] Add helper function to get and convert EFI command line Date: Fri, 10 Jan 2014 08:30:12 -0800 Message-Id: <1389371417-379-4-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389371417-379-1-git-send-email-roy.franz@linaro.org> References: <1389371417-379-1-git-send-email-roy.franz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add an EFI stub helper function to retrieve the EFI command line using the LOADED_IMAGE_PROTOCOL, and convert it to ASCII. This function will be shared by the various EFI stub implementations. Signed-off-by: Roy Franz --- drivers/firmware/efi/efi-stub-helper.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c index eb5d2eb..f657456 100644 --- a/drivers/firmware/efi/efi-stub-helper.c +++ b/drivers/firmware/efi/efi-stub-helper.c @@ -637,3 +637,33 @@ static char *efi_convert_cmdline_to_ascii(efi_system_table_t *sys_table_arg, *cmd_line_len = options_size; return (char *)cmdline_addr; } + +/* + * get the command line from EFI, using the LOADED_IMAGE + * protocol, and convert to ASCII. + * + */ +static void efi_get_cmdline(efi_system_table_t *sys_table, + efi_loaded_image_t **image, + void *handle, char **cmdline_ptr) +{ + efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID; + efi_status_t status; + int cmdline_size; + + status = efi_call_phys3(sys_table->boottime->handle_protocol, + handle, &proto, (void *)image); + if (status != EFI_SUCCESS) { + pr_efi_err(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n"); + *cmdline_ptr = NULL; + return; + } + + /* + * We are going to copy this into device tree, so we don't care where + * in memory it is. + */ + *cmdline_ptr = efi_convert_cmdline_to_ascii(sys_table, *image, + &cmdline_size); + +}