From patchwork Mon Jan 20 10:50:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 858761 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp1859600wrb; Mon, 20 Jan 2025 02:51:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWBnSqu2sLUA6JtKFKBxn2dU/L42ClZ0F4YzJp5cxK4JOHMCtv5toyyFjbPYziQR/186YEQPQ==@linaro.org X-Google-Smtp-Source: AGHT+IHkTLGS0wDvbz8WgWtcciS6PihQ3WKdtEm2HIHWBMQXbdypETN+3iyb2x5Mb4Notu0qQUqQ X-Received: by 2002:a5d:6d82:0:b0:388:c61d:43e0 with SMTP id ffacd0b85a97d-38bf59ef478mr13113634f8f.48.1737370304688; Mon, 20 Jan 2025 02:51:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737370304; cv=none; d=google.com; s=arc-20240605; b=dXrr/xXBSpEDjDzPkwDG7wWX1M/URknGk+kqw3DB5Pe4Lyf257kprz8o1ctszjFhAH xfJK+oljqj+wDB2Mn12A/U8wZ/0pUgRWPZsTWdWizQfcFeXCwB7o2ujiPTJy6w0IGF62 4d+QjWWibQ08kmxHikkXsriCqAzsHQWVVKsXhxjIYgimMR7Z04kE9Clrw+wzW/xaoD/I jRgxcXNpFYp8QMYV8HtRT2mtoJ3YxVDDhgX3PmHWIjFsaowKxoxt9ZTlWNLhxnDNkyxX KEuPWtqF/8/2MZFdWc3kR7xe9+7yavUYJG24VexxAZwPE+P7WJEF+A10gRPls7OWU07W czvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=QtOBzODdm1B0HWb2mxzBczaWkA2838Mhn8LmbNLsxhA=; fh=YztAvNK/sr+8F45uFKQI49AUhmfh/leUUwFnn5QUXFw=; b=Yid9d8jk2N1B6PjwUlDOZAF9twakWsirnboFI3tL9tVWvlk1b4PT01fJ7R98V/3v1C uRiQRo+zrr4VlDDmq+O+iC91gPKZTBeuy4k+zJM+S/OgOYEm3ZCk8gbReVI2pKgVQC+Z q7JjldtOm9E6RS0tK0NYWdHPcmWN+G7ohpnnmQQZyVQO1xQnHc8ZhHw0ga1vow35HON+ EXYRqO0TSLVRKL9FT7QLndMgf7YkXtqhCBqmgyD5Pr/ri3z523qx8OB0+0VuQC3Gk3hs jB5FyeT/ypMRMaCyiKHzVyVPUWCkap25/3SI8JaDBBFRhRHRgMwo9tmtUguYFFMfR4CD rEow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id ffacd0b85a97d-38bf329915csi6415623f8f.800.2025.01.20.02.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 02:51:44 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 4D754807B3; Mon, 20 Jan 2025 11:51:23 +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 A8F1A80792; Mon, 20 Jan 2025 11:51:22 +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, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL 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 5B67280077 for ; Mon, 20 Jan 2025 11:51:20 +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 45CD31063; Mon, 20 Jan 2025 02:51:48 -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 DDE1A3F740; Mon, 20 Jan 2025 02:51:16 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Tom Rini , Anton Antonov , Tobias Waldekranz , Bin Meng , Sughosh Ganu Subject: [PATCH v3 4/5] blkmap: store type of blkmap device in corresponding structure Date: Mon, 20 Jan 2025 16:20:44 +0530 Message-Id: <20250120105045.1281262-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250120105045.1281262-1-sughosh.ganu@linaro.org> References: <20250120105045.1281262-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 Add information about the type of blkmap device in the blkmap structure. Currently, the blkmap device is used for mapping to either a memory based block device, or another block device (linear mapping). Put information in the blkmap structure to identify if it is associated with a memory or linear mapped device. Which can then be used to take specific action based on the type of blkmap device. Signed-off-by: Sughosh Ganu --- Changes since V2: New patch cmd/blkmap.c | 16 ++++++++++++---- drivers/block/blkmap.c | 10 +++++++++- drivers/block/blkmap_helper.c | 2 +- include/blkmap.h | 12 +++++++++++- test/dm/blkmap.c | 16 ++++++++-------- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/cmd/blkmap.c b/cmd/blkmap.c index 164f80f1387..1bf0747ab16 100644 --- a/cmd/blkmap.c +++ b/cmd/blkmap.c @@ -119,15 +119,23 @@ static int do_blkmap_map(struct cmd_tbl *cmdtp, int flag, static int do_blkmap_create(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + enum blkmap_type type; const char *label; int err; - if (argc != 2) + if (argc != 3) return CMD_RET_USAGE; label = argv[1]; - err = blkmap_create(label, NULL); + if (!strcmp(argv[2], "linear")) + type = BLKMAP_LINEAR; + else if (!strcmp(argv[2], "mem")) + type = BLKMAP_MEM; + else + return CMD_RET_USAGE; + + err = blkmap_create(label, NULL, type); if (err) { printf("Unable to create \"%s\": %d\n", label, err); return CMD_RET_FAILURE; @@ -218,7 +226,7 @@ U_BOOT_CMD_WITH_SUBCMDS( "blkmap read \n" "blkmap write \n" "blkmap get