From patchwork Wed Mar 26 17:56:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 334033 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 458AB14007E for ; Thu, 27 Mar 2014 04:58:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3D3D24B60F; Wed, 26 Mar 2014 18:58:14 +0100 (CET) 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 W8KWk1GWU1tR; Wed, 26 Mar 2014 18:58:14 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 37BD64B650; Wed, 26 Mar 2014 18:57:21 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 56C9C4B610 for ; Wed, 26 Mar 2014 18:57:17 +0100 (CET) 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 hS01O7S0QWq7 for ; Wed, 26 Mar 2014 18:57:14 +0100 (CET) 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-qc0-f201.google.com (mail-qc0-f201.google.com [209.85.216.201]) by theia.denx.de (Postfix) with ESMTPS id 2B7F44B60F for ; Wed, 26 Mar 2014 18:57:02 +0100 (CET) Received: by mail-qc0-f201.google.com with SMTP id c9so309606qcz.2 for ; Wed, 26 Mar 2014 10:56:59 -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; bh=N3zhcy1nuJp+ckhe19h3DN87StgPxUl9Oqyb2vR0EQs=; b=Qb3lcQjvGDVtt7ONZXixj1PILxkr2QOFGo/sbR6l1VYgaGL8V2TDYJl8QzAx0DQgoD p92MSR3hfCRhrd17i6QAeEWle9QcdoC6vxhW3W6y6Cy6NIdiKeXGNQlefMT616cWmIPR /d+o/xZU8BQy/aHrc2m2OWnOgnvpbaaHRxInRhIX+E1wOkz3ODxrL1C1s7cXa8N91Dw5 jccJ2P8/lWWKJj8AUGGGepAvWcxzMxzOSGLY1SK+b+bg5I48GSIKXpZbjRk7BdVcKEKa f2sk3DYdvyB1/WKgjcl0xX4qlHmWToUpgoWG1EQlERNPPdS1r8LBOWKgG1NIh9gGx2k9 j0vw== X-Gm-Message-State: ALoCoQkj+qP8YVnLwkMIRVp9jZTStDyrSK6W0Llep8OLoJpF1mRMGSHHLP+sAexraQelgSQ2bzLgOMJIP9q0x8kRrEVQHbkYVwRKnWl8kh8K6PGBwa+eXeJkfqvPvybvLJPTEZUXnkP3e1wLPA3WBIqG7NqzbO+NmB8nNuE4jUsZFG/RqBSGC2bxxflLW74DflwNQOZYpnpD X-Received: by 10.236.144.136 with SMTP id n8mr8907521yhj.22.1395856619847; Wed, 26 Mar 2014 10:56:59 -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 i30si2161746yhc.0.2014.03.26.10.56.59 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Mar 2014 10:56:59 -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 B64985A4217; Wed, 26 Mar 2014 10:56:59 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 7D256221C9A; Wed, 26 Mar 2014 11:56:59 -0600 (MDT) From: Simon Glass To: =?UTF-8?q?=C5=81ukasz=20Majewski?= , U-Boot Mailing List Date: Wed, 26 Mar 2014 11:56:30 -0600 Message-Id: <1395856590-21917-11-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1395856590-21917-1-git-send-email-sjg@chromium.org> References: <1395856590-21917-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , u-boot-review@google.com, Rajeshwari Shinde Subject: [U-Boot] [PATCH 10/10] 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: , MIME-Version: 1.0 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 --- 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; } }