From patchwork Mon Feb 3 10:59:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 861549 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp1955937wrr; Mon, 3 Feb 2025 03:00:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUyqwGr94UJNTB2rW3oqdmZZorDWhdpYkWQPw0hNxihTRjxWJ2Z3/uUu4j1k2J3NQhAoVEMbw==@linaro.org X-Google-Smtp-Source: AGHT+IGAoS8lT4gamlwbh/OBpsxYi99PjDrRA87HWNpaFgfTgQkok5ipZvkGDqaTQQCBChXZD1ey X-Received: by 2002:a17:907:da8:b0:ab3:61e2:8aaf with SMTP id a640c23a62f3a-ab6f760e28fmr1432990766b.25.1738580413990; Mon, 03 Feb 2025 03:00:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738580413; cv=none; d=google.com; s=arc-20240605; b=Qn97AJpHUa2R3rBmRa53GxPMWhpOostyGC2vk200ZEdwrWvV2410qRiBItuFd7by9Q km2CTaXrUpnAMsko+VaJ2QKdcy0he8ZDRph1YkaL6Omn9jcZlbjscPY5lXvoouaLzinK n1SQdTXEBkYC7Aw9KttQX+6sOFW9iN5IjV9Xh/ipvbPU2e0h/2xIqCfnUeJt/2D5JWHn iEwA2RWpVc1KZ6N/1f+E0AXhxeIq26hYuUddnznfiNgEWKSMP0HdNiuOQvlwFfTd5xKw TVqtILeP0GZEbH6eO8LW+vO00xuNNLMBCwfOkQr6aaz/TA2LBSo3KISGe181bf8BwudO voGw== 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=ABXe8h+xOL7GZLupgJFaUOTDveHecxHqaY0JHqoTisM=; fh=YztAvNK/sr+8F45uFKQI49AUhmfh/leUUwFnn5QUXFw=; b=A1FxlkTM08vzXfCim/wRNIKdSNXs9LVxQ9jw4f9ufWiPYkCZQCfbSC7kOwEypUcGxw 6WaLde/BvLp3+B6I7rg1qw9etPsqgjzqDWjQ8PyVeDyVfyKuwhlfCiGLlOqmY4WVlsyV NqdkliYXKYNb0pO7+mnBvwG2SnoLcciHCNrPwonVf6UDFyuTDbs7mcvW3Fz8kWBxbJGi wkN2dhRJIxwonTP3Bp9IUw/bma7U3zfsLXoM1IKfhUZib+66UoKmej4EwPM093rBzfdk DbsQ+mkV4yKm7xcGINGrWXfI3mPcNxMeYPInucCFvapIqnMroeafxNqEMyubcsNo9slp C/ww==; 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 a640c23a62f3a-ab6e4806b08si865932466b.206.2025.02.03.03.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 03:00:13 -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 24D10805D7; Mon, 3 Feb 2025 11:59:50 +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 7139E806C9; Mon, 3 Feb 2025 11:59:48 +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 65F7C80087 for ; Mon, 3 Feb 2025 11:59:46 +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 366AC11FB; Mon, 3 Feb 2025 03:00:10 -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 822E03F5A1; Mon, 3 Feb 2025 02:59:42 -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 v4 4/5] blkmap: store type of blkmap slice in corresponding structure Date: Mon, 3 Feb 2025 16:29:11 +0530 Message-Id: <20250203105912.196654-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250203105912.196654-1-sughosh.ganu@linaro.org> References: <20250203105912.196654-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 slice 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 --- Changes since V3: * Add the map type to the blkmap slice instead of the entire blkmap device drivers/block/blkmap.c | 4 ++++ include/blkmap.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c index 34eed1380dc..4c71ec784e0 100644 --- a/drivers/block/blkmap.c +++ b/drivers/block/blkmap.c @@ -25,12 +25,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 + * @type: Type of blkmap slice */ struct blkmap_slice { struct list_head node; lbaint_t blknr; lbaint_t blkcnt; + enum blkmap_slice_type type; /** * @read: - Read from slice @@ -169,6 +171,7 @@ int blkmap_map_linear(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, .slice = { .blknr = blknr, .blkcnt = blkcnt, + .type = BLKMAP_SLICE_LINEAR, .read = blkmap_linear_read, .write = blkmap_linear_write, @@ -248,6 +251,7 @@ int __blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, .slice = { .blknr = blknr, .blkcnt = blkcnt, + .type = BLKMAP_SLICE_MEM, .read = blkmap_mem_read, .write = blkmap_mem_write, diff --git a/include/blkmap.h b/include/blkmap.h index d53095437fa..c7b4bf13c4e 100644 --- a/include/blkmap.h +++ b/include/blkmap.h @@ -9,6 +9,12 @@ #include +/* Type of blkmap slice, Linear or Memory */ +enum blkmap_slice_type { + BLKMAP_SLICE_LINEAR = 1, + BLKMAP_SLICE_MEM, +}; + /** * struct blkmap - Block map *