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: 3467171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5FC8CC02DC for ; Fri, 10 Jan 2014 16:33:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 486B2200F0 for ; Fri, 10 Jan 2014 16:33:06 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07B0220122 for ; Fri, 10 Jan 2014 16:33:05 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ezn-000752-CO; Fri, 10 Jan 2014 16:31:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ezY-0005fv-7W; Fri, 10 Jan 2014 16:31:28 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1eyz-0005Zd-3g for linux-arm-kernel@lists.infradead.org; Fri, 10 Jan 2014 16:30:54 +0000 Received: by mail-pa0-f46.google.com with SMTP id kp14so4933577pab.19 for ; Fri, 10 Jan 2014 08:30:31 -0800 (PST) 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=Bp5IgVTj8GwCtfr4hz1mELqH79PiPbOMrtMlGNTey9Q=; b=l5y5f7RP9eQwbhYbcZfLT8S5aQ+VRPWufeb3ysjpnq9Xjtu8OGCwO/NGQ+C7yqixXa R8dGKoMRyefQ8gOeGHcAPP8kvViREJZvbrXzrwloAnv+R1iXz8SYfnkp6UpxE+WqUeY4 iu1M/m+WuQdGUzK4ckpIL6jrNytJ4KKa73/oCNlskxxEQfpH6PREsyF555bqI8OkI6wL C+rIq7NwMQZnOSGtbmo1a97JsVHOmUPmDsJQeTtCY7wM7Os5t6HyGnFiIjiN0DfXcUP9 u739t/sqzWQZronhTfEGJdVw+8pTinHYJxnKU+fOfLpLl/72EqX3ue3h5Bw8VDpdzByH EOAA== X-Gm-Message-State: ALoCoQlp+kUMNZc5ptQanXt+BI65bpt9muwUAE8hmPXjkyDj6xhHZbrBnudPius4w2fu6jMLi9RJ 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140110_113053_280247_21720563 X-CRM114-Status: GOOD ( 12.78 ) X-Spam-Score: -2.6 (--) Cc: patches@linaro.org, leif.lindholm@linaro.org, Roy Franz , msalter@redhat.com, grant.likely@linaro.org, dave.martin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 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); + +}