From patchwork Wed Apr 2 23:24:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 336485 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4C27014010B for ; Thu, 3 Apr 2014 10:26:59 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2889B4BAE3; Thu, 3 Apr 2014 01:26:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XpmtIwUvC4uu; Thu, 3 Apr 2014 01:26:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 344854BAD2; Thu, 3 Apr 2014 01:25:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54B3F4BAD2 for ; Thu, 3 Apr 2014 01:25:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o-h2XBHiO+qv for ; Thu, 3 Apr 2014 01:25:43 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pd0-f201.google.com (mail-pd0-f201.google.com [209.85.192.201]) by theia.denx.de (Postfix) with ESMTPS id 330F44BAA0 for ; Thu, 3 Apr 2014 01:25:26 +0200 (CEST) Received: by mail-pd0-f201.google.com with SMTP id x10so167290pdj.2 for ; Wed, 02 Apr 2014 16:25:25 -0700 (PDT) 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:mime-version:content-type:content-transfer-encoding; bh=OLAlLI9JJ1DW6hy7sU6g4jVmKbfGFp1sJAINcfPg5vM=; b=lgk+Wbqd9XMrQKrBwXjeTHHw8uD1HpxTlSFJXo+VdMmoupCyV6dHz9i7xGLoEGj1ZN Lvi5SYw11FwSnBztZZWg8kPPk/sc1tbOJWuH8N6yumcOreGfvuxh1N9QBrIbHz9TIUWf 3Xvor1z55B1HbRAdyA11JXPQAbXqn//q1hr7y6Kv1SGcasdBCdwgk+ChgR1JPxiJGr4I NBWBJr8ofKEEYEQXyNARiTNqq9k7hD8wpHzM+J/PtsQJB7c4rK0Jm2U3Y58DL1HizrcY 8TGZMcvTIu6gecj6cOD4fOFkHmP1oOJzlv7k5qQLb0/ezNnIMMtEIpwJDeWwBHncKGwS W6Ww== X-Gm-Message-State: ALoCoQm5arpoeFGztakiJRcq7F5CdBYKCje17vaQ9KoZY1k0nK1OiAhlfQ1l8FIRVmKrpwaJRfyiEAZun9cvh0zfeTjVc4VBGKFiI83m+TkkcA78bPeVokC3Pda64b/DhG97Q8RVqjWYZrgkLUsDscSDzSE9ySNomJKQu0wPKYER4nmDdhPdk6kJGKCEotLeHblXfaKzjCM3 X-Received: by 10.68.253.66 with SMTP id zy2mr1806927pbc.1.1396481125166; Wed, 02 Apr 2014 16:25:25 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id s65si642930yhc.2.2014.04.02.16.25.25 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Apr 2014 16:25:25 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 04A2D5A41FF; Wed, 2 Apr 2014 16:25:25 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id BFC63220D48; Wed, 2 Apr 2014 17:25:24 -0600 (MDT) From: Simon Glass To: =?UTF-8?q?=C5=81ukasz=20Majewski?= , U-Boot Mailing List Date: Wed, 2 Apr 2014 17:24:29 -0600 Message-Id: <1396481069-24950-13-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1396481069-24950-1-git-send-email-sjg@chromium.org> References: <1396481069-24950-1-git-send-email-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini , u-boot-review@google.com, Rajeshwari Shinde Subject: [U-Boot] [PATCH v2 12/12] initcall: Improve debugging support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add the ability to display the code offset of an initcall even after it is relocated. This makes it much easier to relate initcalls back to the U-Boot System.map file. Signed-off-by: Simon Glass --- Changes in v2: - Rebase to samsung/master include/initcall.h | 2 +- lib/initcall.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/initcall.h b/include/initcall.h index 2378077..65f67dc 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -6,4 +6,4 @@ typedef int (*init_fnc_t)(void); -int initcall_run_list(init_fnc_t init_sequence[]); +int initcall_run_list(const init_fnc_t init_sequence[]); diff --git a/lib/initcall.c b/lib/initcall.c index fa76dd7..7597bad 100644 --- a/lib/initcall.c +++ b/lib/initcall.c @@ -7,15 +7,22 @@ #include #include -int initcall_run_list(init_fnc_t init_sequence[]) +DECLARE_GLOBAL_DATA_PTR; + +int initcall_run_list(const init_fnc_t init_sequence[]) { - init_fnc_t *init_fnc_ptr; + const init_fnc_t *init_fnc_ptr; for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { - debug("initcall: %p\n", *init_fnc_ptr); + unsigned long reloc_ofs = 0; + + if (gd->flags & GD_FLG_RELOC) + reloc_ofs = gd->reloc_off; + debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs); if ((*init_fnc_ptr)()) { - debug("initcall sequence %p failed at call %p\n", - init_sequence, *init_fnc_ptr); + printf("initcall sequence %p failed at call %p\n", + init_sequence, + (char *)*init_fnc_ptr - reloc_ofs); return -1; } }