Skip to content

Commit ee2ce29

Browse files
mibodhitrini
authored andcommitted
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>
1 parent a94a407 commit ee2ce29

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

boot/bootdev-uclass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ static int bootdev_hunt_drv(struct bootdev_hunter *info, uint seq, bool show)
784784
if (info->hunt) {
785785
ret = info->hunt(info, show);
786786
log_debug(" - hunt result %d\n", ret);
787-
if (ret)
787+
if (ret && ret != -ENOENT)
788788
return ret;
789789
}
790790
std->hunters_used |= BIT(seq);

drivers/ata/sata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int sata_rescan(bool verbose)
6565
ret = uclass_find_first_device(UCLASS_AHCI, &dev);
6666
if (ret || !dev) {
6767
printf("Cannot find SATA device (err=%d)\n", ret);
68-
return -ENOSYS;
68+
return -ENOENT;
6969
}
7070

7171
ret = device_remove(dev, DM_REMOVE_NORMAL);

include/bootdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct bootdev_hunter;
6565
*
6666
* @info: Info structure describing this hunter
6767
* @show: true to show information from the hunter
68-
* Returns: 0 if OK, -ve on error
68+
* Returns: 0 if OK, -ENOENT on device not found, otherwise -ve on error
6969
*/
7070
typedef int (*bootdev_hunter_func)(struct bootdev_hunter *info, bool show);
7171

0 commit comments

Comments
 (0)