From patchwork Mon Feb 12 07:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772030 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000557wre; Sun, 11 Feb 2024 23:49:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWw3ZJvwaFAFMbiiR/tzDjJSFjQyYTh90V6jISCMmEFLORswotM+Q+nva54aogEtO4cg97rYcmAQm5YOf5Tox1o X-Google-Smtp-Source: AGHT+IGeeRmPFvBX9Sz5lzZ9NKeDDztDQ8e+d/5N6YiO8+BfsDftWkRC8JV5SwnhOehR84H0sLNv X-Received: by 2002:a2e:9216:0:b0:2d0:b70a:a947 with SMTP id k22-20020a2e9216000000b002d0b70aa947mr3439736ljg.23.1707724143157; Sun, 11 Feb 2024 23:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724143; cv=none; d=google.com; s=arc-20160816; b=WSy2VPnOaARaBxzEqbg25stL1mJY9E0B9Y7jRI5xKG7X4o9CQ0ZXhirly/nUwFHVd2 xNAIVLlK0cMBQSDwEViPvMzTBKiBCZKNvQ1cSrqxf4wARIkroR1uWpoR/F77s1ynqHs4 2jDksr+magmdiiO0fD5mt9P0UJ1tPuimXLplJjERZLKDyql2RG3UexnyqlfX/0jRO1jo RfdNlKEhqtB+zi8e8u2k6EZ9rq1uMteZB18/OXKW5VVbezFu6Pw6nCnURStHrtByW4RC anDMvamgoKTUwJDCltnpSYmlf4V2d/s8m9QLzkYetP8hD3lw6faukaBnlt9znA0yWC4n FW8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=DpbalCHCeg3f3kUfgKHZlSXYMRFGyv8y+AcWHeYj/bc=; fh=t0JPhh+tqCynDEqWdOhrBHUGOxqktxVJOd5jMLpzpgI=; b=ShbXPGgDf8IwpRHAFrhLJwwhK813bxPEJo+TRArNGoa+EQgznSQu7niqC5ALGuHaGe ra6VVXOb/3vKUVUBdsm6MpnyK+Jkhnhceot2WtmjdijLMjIMNScq/0E/pCXDnFGSa77V YR5djI6jUH2rmTEHYiOKGjxShqn2TMUOtLyzNd4A4egiSVJNSM49i8P3JmhA7YIELdKc ofCxEi+JjH/HYxqonoVcuHQkFJUKMt4tsug4T7zU+zpMhkNTSAgfEX2II6/SgL7afX3W kJDfdb4EbBjJffv6AQeroGm/kB8z1v/g3c1VF2syV6XCcW4CZr+K9Uwd1YwW2RV0J499 D1kg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCVp87t9i3B96jBzqSYoXAUuJN1Wnc+eqGiDZGkNyOQzWPi316re8kxeRv6InXdzxzyEDz26s0CkDeeXAXquWkVbRCtLxCQORThpGMCVUJ9WZSEYkbJeVnta1zKmZViKNZepO4I9O5wCp9fUv0ySwq3Ro+lrwoovoIJ603k5NzX1joauydL2lLEOXTDmM0aT/JZqshPDliykZ4qR4WISilCf/CFUEAbaXRKmPHcJ08qkXW/UEwNNhl7WT+l503Q0D0mGqaPIonHLi+bmTUhHjVbWvK8Ng9+Q9CK6wkD64QgQl5V20tFUT5lgMTktxRkiTaUibFhNlmUU6gp0KJODRCnwf2uFeJNtT0qQBKtdGa0MH6A4oAwJiKnFD5DFRl2UkPL40a21cq7zwWAT9ukJtlqqIagkzdM1VbPu//8zc4UiGUW0GlO8K9uu4blt5It60zoMzmdpSPPJMoSYN7WWZpLOImMtWI3W33mNU/c8vbB5+jxhC/RNX+CiFdK74/y0bb0zKdgfHnrfKBuIZ7Qw75F4S3zx8aX9KuBK/FVqADV0Z5qn8tPwkdUcaj/kFGyMs/E8SUaT4nV2KMk+MsjASs0NUtltH6y/1BQkUQEBLe04F/SjqCZhdyD4lg+Qq22c2pdWWJrmXrH/ti324xC13HHIsntIG9dRqxV3IUO9NBgu+TzvErjAmbGhaoU15zOaaCn2ABfxDkayfsab4mRBJOAk//3fH/F3A9SzIHM8JJwitHx1kszac4ex3FsoQ060MKtDFcsGOmDw2AJ+jPIVAuWxd1KVKu8thPYCoF+sl8xFCba7w0C0zezBdBiWojQmPvw+w7+RdVbddKZ8a0oFdNOQZEqkd9SMubtxsGh9Jy4RiOk= Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id k19-20020a17090646d300b00a3bf0da9219si3264915ejs.1020.2024.02.11.23.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:03 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0923D87EDC; Mon, 12 Feb 2024 08:48:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org 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 7C1A787EF0; Mon, 12 Feb 2024 08:48:06 +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=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 87BCE87EE7 for ; Mon, 12 Feb 2024 08:48:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 944DBDA7; Sun, 11 Feb 2024 23:48:45 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C804B3F762; Sun, 11 Feb 2024 23:48:00 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima , Patrice Chotard , Patrick Delaunay , Yann Gautier , Etienne Carriere , Michal Simek , Jassi Brar , Sughosh Ganu Subject: [PATCH v2 08/21] drivers: fwu: allocate memory for metadata copies Date: Mon, 12 Feb 2024 13:16:59 +0530 Message-Id: <20240212074712.3657076-9-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240212074712.3657076-1-sughosh.ganu@linaro.org> References: <20240212074712.3657076-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean With migration of the FWU metadata access code to version 2, the size of the metadata is obtained at runtime. Allocate memory for both the metadata copies from the driver's probe function. Signed-off-by: Sughosh Ganu --- Changes since V1: None drivers/fwu-mdata/gpt_blk.c | 4 ++++ drivers/fwu-mdata/raw_mtd.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/fwu-mdata/gpt_blk.c b/drivers/fwu-mdata/gpt_blk.c index 97eac3611f..c2cb7ef7c3 100644 --- a/drivers/fwu-mdata/gpt_blk.c +++ b/drivers/fwu-mdata/gpt_blk.c @@ -159,6 +159,10 @@ static int fwu_mdata_gpt_blk_probe(struct udevice *dev) priv->blk_dev = mdata_dev; + ret = fwu_mdata_copies_allocate(); + if (ret) + return ret; + return 0; } diff --git a/drivers/fwu-mdata/raw_mtd.c b/drivers/fwu-mdata/raw_mtd.c index da36094644..d91518bf0a 100644 --- a/drivers/fwu-mdata/raw_mtd.c +++ b/drivers/fwu-mdata/raw_mtd.c @@ -260,6 +260,10 @@ static int fwu_mdata_mtd_probe(struct udevice *dev) if (ret) return ret; + ret = fwu_mdata_copies_allocate(); + if (ret) + return ret; + /* Read the metadata to get number of banks and images */ ret = fwu_get_banks_images(&nbanks, &nimages); if (ret)