From patchwork Thu Dec 12 00:47:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1208058 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OmxaC6dY"; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47YFc30D9Cz9sR7 for ; Thu, 12 Dec 2019 11:51:30 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B3D31816F1; Thu, 12 Dec 2019 01:49:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OmxaC6dY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17BE8816F6; Thu, 12 Dec 2019 01:49:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5DD288149F for ; Thu, 12 Dec 2019 01:49:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id b15so501994ila.7 for ; Wed, 11 Dec 2019 16:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sXncWkVnwhaBWh35gQIrf0E47rj6UO6JxR7zdFzjSbg=; b=OmxaC6dYmTd6vYX0cQD4GtDk/gpYjkmEYq9PGQ5ZfQLlef5QdrGSGzKAeugYBBQKYT vMzBRGSwt7E7brmbljUu9kjaahlxyPgDTrk8OSD7vYJ73GU3eMHc4Tto4A8st3pFYMVD WTzCJs6ZG2/coTBu5GqVK1KlD37F9KV99ejSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sXncWkVnwhaBWh35gQIrf0E47rj6UO6JxR7zdFzjSbg=; b=KOojXTvEKF77DAUBCxWzy8VJo9j8//KU/sZM4cI/0yWzAkmFxLoeVOwQWCusu1ETHG uWOYvgBSnX92w6b48pha+3IgeTL14VjULoGcEElQWAXNxYvh6KhY/geyg3sN6X7wuO5i Mdr/+20+LEzfYLz3NYADTaz1EKzbjS5Rn2szDx3WTEktF7PQDsnpF1lC8rXGk9xYw2NX FHl2Rh1O3RMHG6DNshdwC0dIAf0SxiYUCjZjpe4vctV5lIae4UaRn69i4wZqQOwCNTay bDVRLOKeeonAE314sLeW9n8U1g2VHBNf5OuQvUDJ7ViBydpScWZcgYTp1VDT0E1laMZw EQLQ== X-Gm-Message-State: APjAAAVY7xQw9+GhPRsggbGRTRHi3x+rdF0M+XepUsKVp0iVbJ6IJh9M CFhbv+6Jc+cpFpvB2nUOHDrBC7q85vA= X-Google-Smtp-Source: APXvYqxEOYOH9McAqL/HExHe0JqTInH7FjNCeqqT/TaK+18B0cgUQROkUggz468LozEPCTpjsJS96A== X-Received: by 2002:a92:5ec8:: with SMTP id f69mr6026266ilg.8.1576111738975; Wed, 11 Dec 2019 16:48:58 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id a11sm880194ioc.86.2019.12.11.16.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 16:48:58 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Subject: [PATCH 27/35] common: Rename and move source() Date: Wed, 11 Dec 2019 17:47:46 -0700 Message-Id: <20191211174637.27.Ib2b4120d6b5dd9ad0c5111fb3721c65a1a6568c6@changeid> X-Mailer: git-send-email 2.24.0.525.g8f36a354ae-goog In-Reply-To: <20191212004755.11091-2-sjg@chromium.org> References: <20191212004755.11091-2-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Tom Rini , Eugeniu Rosca , Joe Hershberger , Boris Brezillon , Julius Werner , Chris Packham Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean This function has a very generic name which does not adequately describe its purpose. Rename it and move it to image.h, since it relates to reading a script from an image. Signed-off-by: Simon Glass --- cmd/source.c | 5 ++--- drivers/usb/gadget/f_sdp.c | 2 +- include/common.h | 3 --- include/image.h | 12 ++++++++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cmd/source.c b/cmd/source.c index be1135014f..92f8f77ee6 100644 --- a/cmd/source.c +++ b/cmd/source.c @@ -41,8 +41,7 @@ static const char *get_default_image(const void *fit) } #endif -int -source (ulong addr, const char *fit_uname) +int image_source_script(ulong addr, const char *fit_uname) { ulong len; #if defined(CONFIG_LEGACY_IMAGE_FORMAT) @@ -183,7 +182,7 @@ static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } printf ("## Executing script at %08lx\n", addr); - rcode = source (addr, fit_uname); + rcode = image_source_script(addr, fit_uname); return rcode; } diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index bcd1c5d47c..50836db4a0 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -726,7 +726,7 @@ static void sdp_handle_in_ep(struct spl_image_info *spl_image) jump_to_image_no_args(&spl_image); #else /* In U-Boot, allow jumps to scripts */ - source(sdp_func->jmp_address, "script@1"); + image_source_script(sdp_func->jmp_address, "script@1"); #endif } diff --git a/include/common.h b/include/common.h index 5e38c5fc58..c69bad9771 100644 --- a/include/common.h +++ b/include/common.h @@ -59,9 +59,6 @@ void hang (void) __attribute__ ((noreturn)); #include -/* common/cmd_source.c */ -int source (ulong addr, const char *fit_uname); - /* common/memsize.c */ long get_ram_size (long *, long); phys_size_t get_effective_memsize(void); diff --git a/include/image.h b/include/image.h index cc52de567b..80c0737463 100644 --- a/include/image.h +++ b/include/image.h @@ -673,6 +673,18 @@ int fit_image_load(bootm_headers_t *images, ulong addr, int arch, int image_type, int bootstage_id, enum fit_load_op load_op, ulong *datap, ulong *lenp); +/** + * image_source_script() - Execute a script + * + * Executes a U-Boot script at a particular address in memory. The script should + * have a header (FIT or legacy) with the script type (IH_TYPE_SCRIPT). + * + * @addr: Address of script + * @fit_uname: FIT subimage name + * @return result code (enum command_ret_t) + */ +int image_source_script(ulong addr, const char *fit_uname); + #ifndef USE_HOSTCC /** * fit_get_node_from_config() - Look up an image a FIT by type