From patchwork Sat Nov 23 22:47:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 1199898 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=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=timesys-com.20150623.gappssmtp.com header.i=@timesys-com.20150623.gappssmtp.com header.b="GVw/saF2"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47L7fl28j7z9sPj for ; Sun, 24 Nov 2019 09:45:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 77BB5C21DFB; Sat, 23 Nov 2019 22:45:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7FB99C21C27; Sat, 23 Nov 2019 22:45:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E0574C21C27; Sat, 23 Nov 2019 22:44:59 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by lists.denx.de (Postfix) with ESMTPS id 6C2C6C21BE5 for ; Sat, 23 Nov 2019 22:44:59 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id b18so12901929wrj.8 for ; Sat, 23 Nov 2019 14:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timesys-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nHjJRYAqMeJZdIHg+Nakp35Bfd6LMgfmZ2s6BBbr108=; b=GVw/saF2ojMnELgmPKANq8xujKvKtHj5oVnlykrugHPMRlcRAoxOyZB2m1A1Mx4QqS 7xYLQZYAKYzJaRn+LP4BAXrg4WzHpiZ3dQNYEGGlaSw2UGVnpz8j12HYOvmMIyo2JZjn GXDtRqG24Z+G4IiEKGqAmd4hHDVGjLZzgzh6qM/FB6Y63ULaCalxgotcdZPbjyHXt16n NLy6xC+2eS96uqcHFz8JUNb8SbVuZR/FRbdBj4kp5ISF2bvaJTsm8EP715fUHAJOE6kd I2grsxeBgjXbXsKrvsHuYiUOxXxyBsEq7oJRYU7uSLUhMHRYn7L6fjb2ctX6INCZqpXJ ufxg== 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:mime-version :content-transfer-encoding; bh=nHjJRYAqMeJZdIHg+Nakp35Bfd6LMgfmZ2s6BBbr108=; b=a7xGCln7vjrFrVgWYROEKk1/+oAea5mK84z2lhI/wirTWMWzsrxywHFwedvBtqnF6g /ukr8Kyal8LKkVTnQCR/PK498NrCZD28t+mz6DvsCxbmp/aE0aGhs82TtMPUcl7aJdKm 0D13pnxqi/0i2Bb0D5toG5fhnFgWLfZjl8PxQcgK48tcwejw20Rz6hqk2bnlOMCmyizQ W4lGzDbPw13BFgDENYRBYWQ10grzPP71qipQwIQDIlOrobYdDZjgR8iAIeD103GZHbrf fZzjy7WVnMAF6iiBbrwJW6nbq9EF3YjXaDahSGq6AosjDsaBUjWJ0Cp4vlJ2CHj/ZL3P Dm0g== X-Gm-Message-State: APjAAAXO9/BoI97OpV2d6R3t4bk4j1QRqyUGtDX3m5uE1CQBXCjXNCy4 Dhkq4AKbc0GuVM+C0qZi2JR2gA== X-Google-Smtp-Source: APXvYqybZUd8awXEJZFubAZ7qTDJTgsYbzW6RI2CY+p2dd3TB9RDhs/9gZHgDYGzLWmydpG8LgsSrQ== X-Received: by 2002:adf:e682:: with SMTP id r2mr24452020wrm.358.1574549098946; Sat, 23 Nov 2019 14:44:58 -0800 (PST) Received: from localhost.localdomain (host196-236-dynamic.21-79-r.retail.telecomitalia.it. [79.21.236.196]) by smtp.gmail.com with ESMTPSA id j67sm3352458wmb.43.2019.11.23.14.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Nov 2019 14:44:58 -0800 (PST) From: Angelo Dureghello To: trini@konsulko.com, eric@nelint.com, mgroeger@sysgo.de, wd@denx.de Date: Sat, 23 Nov 2019 23:47:52 +0100 Message-Id: <20191123224752.384355-1-angelo.dureghello@timesys.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Cc: u-boot@lists.denx.de, Angelo Durgehello Subject: [U-Boot] [PATCH 2/5] common: add blkcache init X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Angelo Durgehello On m68k, block_cache list is relocated, but next and prev list pointers are not adjusted to the relocated struct list_head address, so the first iteration over the block_cache list hangs. This patch initializes the block_cache list after relocation. Signed-off-by: Angelo Durgehello --- common/board_r.c | 12 ++++++++++++ drivers/block/blkcache.c | 7 ++++++- include/blk.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/common/board_r.c b/common/board_r.c index 65720849cd..13e70a5ffb 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -628,6 +628,15 @@ static int initr_bedbug(void) } #endif +#ifdef CONFIG_BLOCK_CACHE +static int initr_blkcache(void) +{ + blkcache_init(); + + return 0; +} +#endif + static int run_main_loop(void) { #ifdef CONFIG_SANDBOX @@ -832,6 +841,9 @@ static init_fnc_t init_sequence_r[] = { #endif #if defined(CONFIG_PRAM) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE + initr_blkcache, #endif run_main_loop, }; diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index 1fa64989d3..bf0fa1ea6f 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -21,13 +21,18 @@ struct block_cache_node { char *cache; }; -static LIST_HEAD(block_cache); +static struct list_head block_cache; static struct block_cache_stats _stats = { .max_blocks_per_entry = 8, .max_entries = 32 }; +void blkcache_init(void) +{ + INIT_LIST_HEAD(&block_cache); +} + static struct block_cache_node *cache_find(int iftype, int devnum, lbaint_t start, lbaint_t blkcnt, unsigned long blksz) diff --git a/include/blk.h b/include/blk.h index d0c033aece..7070fd6af3 100644 --- a/include/blk.h +++ b/include/blk.h @@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz)) #if CONFIG_IS_ENABLED(BLOCK_CACHE) + +/** + * blkcache_init() - initialize the block cache list pointers + */ +void blkcache_init(void); + /** * blkcache_read() - attempt to read a set of blocks from cache *