From patchwork Mon Jan 22 11:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 764625 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1059184wrx; Mon, 22 Jan 2024 03:56:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3z7DbRucsFsQLJiJ0NNR3Zn8LEUTNScCyhamNWbXiiiIb0LUvzTifZELvhKgXSkC77ihT X-Received: by 2002:a05:600c:1910:b0:40e:6238:e9e8 with SMTP id j16-20020a05600c191000b0040e6238e9e8mr2057679wmq.1.1705924587022; Mon, 22 Jan 2024 03:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705924587; cv=none; d=google.com; s=arc-20160816; b=qbYn8YIYxwTupPy5ch824Fi7qYViAOeUzjCtX9iMotOl+IOTZjsfa2LzvuaZmLTteG vVdGzXVx5VQnMIRez89OFM0yg/rekplyw08lpDwdljau3kUBAHbZFEGe5b5NVXV2PF73 TlCpl/MMOTSi94spCpr0cuHHCnZ5XukD6pPZbNfpRD1xPVz4wIqz92HUewjf0NXJAxQJ tEUv0FCJxRuhmBwysadAS9fpbT4Czb2kxMMOB+8EOZiZv/WZuzZ0b8pXXi5xnpP3zHwD YKCVhBY5z6N8sh9LpxP16Hz8HTHSFafNAw0+ZBeXZYUyu2aIlnafWPyvhIiWnY52L4rq ut/g== 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=pnkvwoq63DJs+33rLHuzVTw6WfRxsCzrHcP57Kk+tNA=; fh=rhmJ78R78zNUSUA9Nt0a5TbZO4CVsI4vi5GcqSIe+nI=; b=Ejc4i21w/bo0XwJalHiNV2bxqE0QkkJnY1j6DjlsmLqD8YjAqFUMVp2+urL0ze9lR+ f1kp4BcK0H4ltcMzMhnMLtUIUtjHFfYk2H1vN5niG9svqW9pXgSmEquk5AX7m8+EjnAk yFdgdVrT5mjw10K1fgePEaFXpoyOrEk5VIlDy98YYrJduX5LNf3+CQqll42AUChZTrx2 dRr6jBhHehqLfQNEFN5vIHkniy3BAMrh+xYjbWSlDtNvbueyLliXk7L65uaslBNYnPIc IaiqECi43ce0sRsfjP+5/v5uB0d0b5Tlcsx9bnQh7dSk+MHr7RQkwa+l55gJOukhVGit TVSg== 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 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 w3-20020a05600c474300b0040e8bfdb77fsi6136829wmo.99.2024.01.22.03.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:56:27 -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 721B987B41; Mon, 22 Jan 2024 12:55:43 +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 7722B87BC9; Mon, 22 Jan 2024 12:55:42 +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 84B6D87B1A for ; Mon, 22 Jan 2024 12:55:34 +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 11DDB1FB; Mon, 22 Jan 2024 03:56:20 -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 6088F3F73F; Mon, 22 Jan 2024 03:55:31 -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 , Sughosh Ganu Subject: [PATCH 07/18] drivers: fwu: Allocate memory for metadata copies Date: Mon, 22 Jan 2024 17:24:28 +0530 Message-Id: <20240122115439.653871-8-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122115439.653871-1-sughosh.ganu@linaro.org> References: <20240122115439.653871-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 --- 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)