From patchwork Sat Jan 16 21:53:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1427619 X-Patchwork-Delegate: bmeng.cn@gmail.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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NveE35w3; 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 4DJBhp6wJwz9sWT for ; Sun, 17 Jan 2021 08:56:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 28753829FE; Sat, 16 Jan 2021 22:54:16 +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=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NveE35w3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8AE21829DD; Sat, 16 Jan 2021 22:54:10 +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=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (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 EA5F7829BC for ; Sat, 16 Jan 2021 22:54:05 +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-io1-xd31.google.com with SMTP id e22so1712729iog.6 for ; Sat, 16 Jan 2021 13:54:05 -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=ksFsUbr2VUuYdi+U0bG0gU0feQCuyXMMlznTM1DNvr8=; b=NveE35w3GiMJRsJXqmjJPiFk48c34a4e+C6nc/RlkU541147LCBmEOIYXhyRp8YcgD l6hiIGGcyzKUhvmG9aB8dZGJyekn5QyegLfEdyaJd5TuQxvgpO8gZJFVHkDSvWHMdKKw wIbPnqIoOXtzHqEGdHX9bmHvd9311g8U+c+8c= 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=ksFsUbr2VUuYdi+U0bG0gU0feQCuyXMMlznTM1DNvr8=; b=N4q/S7J9HvxutW5UwOZlY3VNwXs69P4L6zD9bnilnvjFVkSnuSC5ZySgIiIkzelpGO HLIkSVX+u7vhvJKQ6UrBT3I3moSnoiYk7BAPiyYfq/AItopc6exVZMv76WD6+YwP8V9f PK6G2eTGhZKICmkeLdfxoJu0xh3DWe3JSOCnEubEhS+Z59WtkvOM17pIS3IHXH/UPt0I yZGowvZO8ohEu8khzBqDm7Q4nunAQ/7qjSqVOsqzhNgGjcKLiN4pG46OOtm65fm45n5/ HAwdxsYd+MfZahMNsp/S6SEpnUfIJO6+C7Cq64+kfuXqStzgr3xKaClsuRGRmVxostDg PBDg== X-Gm-Message-State: AOAM530Fm6fjB1X/B4tUwdjF1FIb8jKyvO8k/5sZ4GKbyUOZQJNExREX UA1ztdetTkv3Lt0CUnCGVTYM/2zokydyRyEg X-Google-Smtp-Source: ABdhPJw/KnOsiOsaojngZV1RmWcqrcJfkZlHP6EpQXocK3d2lE5KQFMSugERWYakKAej/7JmQsHUnQ== X-Received: by 2002:a92:ca82:: with SMTP id t2mr588898ilo.20.1610834044579; Sat, 16 Jan 2021 13:54:04 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id a17sm7428746ilc.77.2021.01.16.13.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jan 2021 13:54:04 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Bin Meng , Daniel Schwierzeck , Dario Binacchi , Faiz Abbas , Harald Seiler , Heiko Stuebner , Masahiro Yamada , Michael Walle , Otavio Salvador , Samuel Holland , Stefan Roese , Ye Li Subject: [PATCH 02/12] x86: spl: Add a function to find the text base Date: Sat, 16 Jan 2021 14:53:49 -0700 Message-Id: <20210116145343.2.Ida9f8cf3e7473c0f9493dd616e7481a022f3a85a@changeid> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210116215359.1220766-1-sjg@chromium.org> References: <20210116215359.1220766-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean It is useful to know the TEXT_BASE value for the image being loaded in TPL/SPL. Add a new spl_get_image_text_base() function to handle this. Make use of this in the x86 SPL handler, instead of having the logic there. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- common/spl/spl.c | 6 ++++++ include/spl.h | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index d375dcbb2ed..12b00e2a407 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -144,6 +144,12 @@ ulong spl_get_image_size(void) binman_sym(ulong, u_boot_any, size); } +ulong spl_get_image_text_base(void) +{ + return spl_phase() == PHASE_TPL ? CONFIG_SPL_TEXT_BASE : + CONFIG_SYS_TEXT_BASE; +} + /* * Weak default function for board specific cleanup/preparation before * Linux boot. Some boards/platforms might not need it, so just provide diff --git a/include/spl.h b/include/spl.h index faffeb519ac..e172500b5f8 100644 --- a/include/spl.h +++ b/include/spl.h @@ -254,6 +254,16 @@ ulong spl_get_image_pos(void); */ ulong spl_get_image_size(void); +/** + * spl_get_image_text_base() - get the text base of the next phase + * + * This returns the address that the next stage is linked to run at, i.e. + * CONFIG_SPL_TEXT_BASE or CONFIG_SYS_TEXT_BASE + * + * @return text-base address + */ +ulong spl_get_image_text_base(void); + /** * spl_load_simple_fit_skip_processing() - Hook to allow skipping the FIT * image processing during spl_load_simple_fit().