aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Dinh <mibodhi@gmail.com>2023-11-02 11:51:15 -0700
committerTom Rini <trini@konsulko.com>2023-11-10 08:44:03 -0500
commite21461eaa1952f2ec2ab1144a350ca048417809c (patch)
treea158a2588aafc13a72ae05270af06ed23e693002
parent885e9141c4d2f78f207c56b688c2060f3a3a382e (diff)
downloadu-boot-e21461eaa1952f2ec2ab1144a350ca048417809c.zip
u-boot-e21461eaa1952f2ec2ab1144a350ca048417809c.tar.gz
u-boot-e21461eaa1952f2ec2ab1144a350ca048417809c.tar.bz2
bootstd: Skip over bad device during bootflows scanning
During bootstd scanning for bootdevs, if bootdev_hunt_drv() encounters a device not found error (e.g. ENOENT), let it return a successful status so that bootstd will continue scanning the next devices, not stopping prematurely. Background: During scanning for bootflows, it's possible for bootstd to encounter a faulty device controller. Also when the same u-boot is used for another variant of the same board, some device controller such as SATA might not exist. I've found this issue while converting the Marvell Sheevaplug board to use bootstd. This board has 2 variants, the original Sheevaplug has MMC and USB only, but the later variant comes with USB, MMC, and eSATA ports. We have been using the same u-boot (starting with CONFIG_IDE and later with DM CONFIG_SATA) for both variants. This worked well with the old envs-scripting booting scheme. Signed-off-by: Tony Dinh <mibodhi@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--boot/bootdev-uclass.c2
-rw-r--r--drivers/ata/sata.c2
-rw-r--r--include/bootdev.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 44ae98a..4926a50 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -784,7 +784,7 @@ static int bootdev_hunt_drv(struct bootdev_hunter *info, uint seq, bool show)
if (info->hunt) {
ret = info->hunt(info, show);
log_debug(" - hunt result %d\n", ret);
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
}
std->hunters_used |= BIT(seq);
diff --git a/drivers/ata/sata.c b/drivers/ata/sata.c
index dcb5fcf..64fc078 100644
--- a/drivers/ata/sata.c
+++ b/drivers/ata/sata.c
@@ -65,7 +65,7 @@ int sata_rescan(bool verbose)
ret = uclass_find_first_device(UCLASS_AHCI, &dev);
if (ret || !dev) {
printf("Cannot find SATA device (err=%d)\n", ret);
- return -ENOSYS;
+ return -ENOENT;
}
ret = device_remove(dev, DM_REMOVE_NORMAL);
diff --git a/include/bootdev.h b/include/bootdev.h
index b079a91..35fa25a 100644
--- a/include/bootdev.h
+++ b/include/bootdev.h
@@ -65,7 +65,7 @@ struct bootdev_hunter;
*
* @info: Info structure describing this hunter
* @show: true to show information from the hunter
- * Returns: 0 if OK, -ve on error
+ * Returns: 0 if OK, -ENOENT on device not found, otherwise -ve on error
*/
typedef int (*bootdev_hunter_func)(struct bootdev_hunter *info, bool show);