From patchwork Mon Mar 17 08:34:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 874152 Delivered-To: patch@linaro.org Received: by 2002:a5d:4308:0:b0:38f:210b:807b with SMTP id h8csp1869957wrq; Mon, 17 Mar 2025 01:35:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2f5Ka4ojfAxm2MA375/z/OISOXBWzX/BrlmLXKz+W/XxoAFHhNmEi0A6oV2p8pr/Cmso2Zg==@linaro.org X-Google-Smtp-Source: AGHT+IFbKC0/DOUyv+kp7+lpjT0Djfu4WTJYYIOLmnrSNmI05kAv2fG0A59Z/J0mS6/FBqHscc8x X-Received: by 2002:a17:907:970f:b0:ac3:45b8:968c with SMTP id a640c23a62f3a-ac345b8aef5mr811560966b.1.1742200525789; Mon, 17 Mar 2025 01:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742200525; cv=none; d=google.com; s=arc-20240605; b=jIrrLC0/6xL+MreiirjNcJTk/U1qwxzfoWRVT/H5royt8Ai4hmt7dufyPY9/tD5+6C r1Hu2DZJiovvJbfvk6aryYlwxS1hh/66UMSlqY67j0EMfA1Y6294eJRCbtD03u2ISNhl qc22cSZymmm1PFtspSiho1VLASrYoEi8Z6AlVFkFAQR5anMZLBu0MgMqdnry6qzfECkm VYFEklNQZKdhhraJ6kBmM2tpKt8QeLZvihUwa6BjPbgkznsl6wVSMzY/sgUBEUJcw71r 4//yo7Q/3jlWyplwEL5xE6dd8FI0BhEiMQeJnUaF8SZlQXwiZGOuwS+W8xDl+mwpnIqt A0WA== 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=FQvCj/z4bqU1zjDlBaQwx07eBbdrUouo9dQW4ZUNVp4=; fh=Evn5eBx2ytD/hj+tB8Xv1T61prWYrP0E59LRKWAPORI=; b=Q4IPECSIKJ8DsFNnAR08e/+fDVEpqcqgvGt3FabhsoyPvfq1pF6H9AHhjvycN+hOTR 6EpSHeAQ/InjDWF/66qhmHHkj7kzByp61nyl2ty2IXIJocXVx6r0QFVjcvq6bO9UfJn8 MlmbkWaJV0n7c+7KgpYDUr8HjK+8gDSd5sws4dcr8EEEyvluaKPBSNz/yxCbdRhkgA2F Qsn6j1AO+lVwqnHMXS2o6MrGOcIMScQ83jum9aqoflg0oFyt5q9Fm0Z/5Qn2HBaG/ggM QX84PgQXyx84+Y+pqj+5gpfztwgaqVgxavqjoluJQUKrFq80qOP3zlYN4UFLcH0CM8is mtAg==; dara=google.com 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 a640c23a62f3a-ac314a46c37si708178366b.268.2025.03.17.01.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Mar 2025 01:35:25 -0700 (PDT) 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 DC3BB817EC; Mon, 17 Mar 2025 09:34:48 +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 DBFFB8058A; Mon, 17 Mar 2025 09:34:47 +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_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_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 32AFB811B2 for ; Mon, 17 Mar 2025 09:34:45 +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 610ED169E; Mon, 17 Mar 2025 01:34:53 -0700 (PDT) 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 F28E53F7B4; Mon, 17 Mar 2025 01:34:41 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Tom Rini , Heinrich Schuchardt , Anton Antonov , Tobias Waldekranz , Sughosh Ganu Subject: [PATCH v9 6/8] blkmap: store type of blkmap slice in corresponding structure Date: Mon, 17 Mar 2025 14:04:00 +0530 Message-Id: <20250317083402.412310-7-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317083402.412310-1-sughosh.ganu@linaro.org> References: <20250317083402.412310-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 slices as an attribute in the corresponding slice structure. Put information in the blkmap slice 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 the blkmap slice. Signed-off-by: Sughosh Ganu Reviewed-by: Tobias Waldekranz Reviewed-by: Ilias Apalodimas --- Changes since V8: * s/blkmap slice/blkmap slices/ in the commit message * Add comments to the macros added in the patch drivers/block/blkmap.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c index 34eed1380dc..08f68570224 100644 --- a/drivers/block/blkmap.c +++ b/drivers/block/blkmap.c @@ -16,6 +16,22 @@ struct blkmap; +/** + * define BLKMAP_SLICE_LINEAR - Linear mapping to another block device + * + * This blkmap slice type is used for mapping to other existing block + * devices. + */ +#define BLKMAP_SLICE_LINEAR BIT(0) + +/** + * define BLKMAP_SLICE_MEM - Linear mapping to memory based block device + * + * This blkmap slice type is used for mapping to memory based block + * devices, like ramdisks. + */ +#define BLKMAP_SLICE_MEM BIT(1) + /** * struct blkmap_slice - Region mapped to a blkmap * @@ -25,12 +41,14 @@ struct blkmap; * @node: List node used to associate this slice with a blkmap * @blknr: Start block number of the mapping * @blkcnt: Number of blocks covered by this mapping + * @attr: Attributes of blkmap slice */ struct blkmap_slice { struct list_head node; lbaint_t blknr; lbaint_t blkcnt; + uint attr; /** * @read: - Read from slice @@ -169,6 +187,7 @@ int blkmap_map_linear(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, .slice = { .blknr = blknr, .blkcnt = blkcnt, + .attr = BLKMAP_SLICE_LINEAR, .read = blkmap_linear_read, .write = blkmap_linear_write, @@ -248,6 +267,7 @@ int __blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, .slice = { .blknr = blknr, .blkcnt = blkcnt, + .attr = BLKMAP_SLICE_MEM, .read = blkmap_mem_read, .write = blkmap_mem_write,