summaryrefslogtreecommitdiff
path: root/env/scsi.c
diff options
context:
space:
mode:
authorDavid Lechner <[email protected]>2026-03-26 17:59:27 -0500
committerTom Rini <[email protected]>2026-04-08 11:07:07 -0600
commit83223d4f86980f09fdf341b64f69e03313cac14b (patch)
treea975d792accdfdeb6a0378ada6f9f3ff31fc4dad /env/scsi.c
parentb382cd0973521a5197a097d4e190f47aadb79757 (diff)
env: scsi: add CONFIG_ENV_SCSI_HW_PARTITION
Add CONFIG_ENV_SCSI_HW_PARTITION and supporting code to allow loading the environment directly from a SCSI device without a partition table. Some platforms store the environment directly on the SCSI device without a way to look it up by partition UUID. Signed-off-by: David Lechner <[email protected]>
Diffstat (limited to 'env/scsi.c')
-rw-r--r--env/scsi.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/env/scsi.c b/env/scsi.c
index 1787dcca92a..f4986353da5 100644
--- a/env/scsi.c
+++ b/env/scsi.c
@@ -41,8 +41,14 @@ static inline struct env_scsi_info *env_scsi_get_part(void)
is_scsi_scanned = true;
}
- if (scsi_get_blk_by_uuid(CONFIG_ENV_SCSI_PART_UUID, &ep->blk, &ep->part))
- return NULL;
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0') {
+ if (blk_get_device_part_str("scsi", CONFIG_ENV_SCSI_HW_PARTITION,
+ &ep->blk, &ep->part, true))
+ return NULL;
+ } else {
+ if (scsi_get_blk_by_uuid(CONFIG_ENV_SCSI_PART_UUID, &ep->blk, &ep->part))
+ return NULL;
+ }
ep->count = CONFIG_ENV_SIZE / ep->part.blksz;
@@ -89,12 +95,20 @@ static int env_scsi_load(void)
int ret;
if (!ep) {
- env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition not found", 0);
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0')
+ env_set_default("SCSI partition " CONFIG_ENV_SCSI_HW_PARTITION " not found", 0);
+ else
+ env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition not found", 0);
+
return -ENOENT;
}
if (blk_dread(ep->blk, ep->part.start, ep->count, &envbuf) != ep->count) {
- env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition read failed", 0);
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0')
+ env_set_default("SCSI partition " CONFIG_ENV_SCSI_HW_PARTITION " read failed", 0);
+ else
+ env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition read failed", 0);
+
return -EIO;
}