From patchwork Fri Jul 24 11:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 1335642 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=none (p=none dis=none) header.from=windriver.com 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 4BCmvh0s08z9sRN for ; Fri, 24 Jul 2020 21:20:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C19E82262; Fri, 24 Jul 2020 13:20:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=windriver.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id CF01C8225D; Fri, 24 Jul 2020 13:19:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3AF8482265 for ; Fri, 24 Jul 2020 13:19:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=windriver.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Ovidiu.Panait@windriver.com Received: from ALA-HCB.corp.ad.wrs.com (ala-hcb.corp.ad.wrs.com [147.11.189.41]) by mail1.windriver.com (8.15.2/8.15.2) with ESMTPS id 06OBJn30024419 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 24 Jul 2020 04:19:49 -0700 (PDT) Received: from otp-linux01.wrs.com (128.224.126.17) by ALA-HCB.corp.ad.wrs.com (147.11.189.41) with Microsoft SMTP Server id 14.3.487.0; Fri, 24 Jul 2020 04:19:48 -0700 From: Ovidiu Panait To: CC: Angelo Durgehello , Bin Meng , Eric Nelson , Joe Hershberger , Pankit Garg , Simon Glass Subject: [PATCH v4 16/17] blkcache: Extend blkcache_init to cover CONFIG_NEEDS_MANUAL_RELOC Date: Fri, 24 Jul 2020 14:12:24 +0300 Message-ID: <20200724111225.12513-16-ovidiu.panait@windriver.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200724111225.12513-1-ovidiu.panait@windriver.com> References: <20200724111225.12513-1-ovidiu.panait@windriver.com> 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 Extend manual relocation of block_cache list pointers to all platforms that enable CONFIG_NEEDS_MANUAL_RELOC. Remove m68k-specific checks and provide a single implementation that adds gd->reloc_off to the pre-relocation pointers. Acked-by: Angelo Dureghello Tested-by: Angelo Dureghello Reviewed-by: Simon Glass Reviewed-by: Eric Nelson Signed-off-by: Ovidiu Panait --- common/board_r.c | 2 +- drivers/block/blkcache.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 79772135a4..63c53b7b96 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -836,7 +836,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_PRAM) initr_mem, #endif -#if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE) +#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE) blkcache_init, #endif run_main_loop, diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index b6fc72fe98..d97ee99cf4 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -12,6 +12,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + struct block_cache_node { struct list_head lh; int iftype; @@ -22,21 +24,20 @@ struct block_cache_node { char *cache; }; -#ifndef CONFIG_M68K static LIST_HEAD(block_cache); -#else -static struct list_head block_cache; -#endif static struct block_cache_stats _stats = { .max_blocks_per_entry = 8, .max_entries = 32 }; -#ifdef CONFIG_M68K +#ifdef CONFIG_NEEDS_MANUAL_RELOC int blkcache_init(void) { - INIT_LIST_HEAD(&block_cache); + struct list_head *head = &block_cache; + + head->next = (uintptr_t)head->next + gd->reloc_off; + head->prev = (uintptr_t)head->prev + gd->reloc_off; return 0; }