summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXingyu Wu <xingyu.wu@starfivetech.com>2023-09-06 11:59:49 +0300
committerXingyu Wu <xingyu.wu@starfivetech.com>2023-09-07 04:34:13 +0300
commit92543ed1f3dc9ec0f70767115170719e93f2833f (patch)
tree02f17a458948159a6c40729495004d4f80540b0a /drivers
parent0c23a7095f57bc91df7980f7597f3fb84e223d57 (diff)
downloadu-boot-92543ed1f3dc9ec0f70767115170719e93f2833f.tar.xz
drivers: fastboot: Add logical-block-size in getvar command
Add a new parameter to get "logical-block-size" in getvar command. Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/fastboot/fb_getvar.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index d43f2cfee6..4e5536d611 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -31,6 +31,7 @@ static void getvar_partition_type(char *part_name, char *response);
static void getvar_partition_size(char *part_name, char *response);
#endif
static void getvar_is_userspace(char *var_parameter, char *response);
+static void getvar_logical_block_size(char *var_parameter, char *response);
static const struct {
const char *variable;
@@ -81,6 +82,9 @@ static const struct {
}, {
.variable = "is-userspace",
.dispatch = getvar_is_userspace
+ }, {
+ .variable = "logical-block-size",
+ .dispatch = getvar_logical_block_size
}
};
@@ -251,6 +255,20 @@ static void getvar_is_userspace(char *var_parameter, char *response)
fastboot_okay("no", response);
}
+static void getvar_logical_block_size(char *var_parameter, char *response)
+{
+ struct blk_desc *dev_desc;
+
+ dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+ if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
+ pr_err("invalid mmc device\n");
+ fastboot_fail("invalid mmc device", response);
+ return;
+ }
+
+ fastboot_response("OKAY", response, "0x%08lx", dev_desc->blksz);
+}
+
/**
* fastboot_getvar() - Writes variable indicated by cmd_parameter to response.
*