#include <common.h>
#include <ata.h>
#include <blk.h>
+#include <bootdev.h>
#include <dm.h>
#include <ide.h>
#include <log.h>
.probe = ide_blk_probe,
};
+static int ide_bootdev_bind(struct udevice *dev)
+{
+ struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev);
+
+ ucp->prio = BOOTDEVP_3_SCAN_SLOW;
+
+ return 0;
+}
+
+static int ide_bootdev_hunt(struct bootdev_hunter *info, bool show)
+{
+ ide_init();
+
+ return 0;
+}
+
+struct bootdev_ops ide_bootdev_ops = {
+};
+
+static const struct udevice_id ide_bootdev_ids[] = {
+ { .compatible = "u-boot,bootdev-ide" },
+ { }
+};
+
+U_BOOT_DRIVER(ide_bootdev) = {
+ .name = "ide_bootdev",
+ .id = UCLASS_BOOTDEV,
+ .ops = &ide_bootdev_ops,
+ .bind = ide_bootdev_bind,
+ .of_match = ide_bootdev_ids,
+};
+
+BOOTDEV_HUNTER(ide_bootdev_hunter) = {
+ .prio = BOOTDEVP_3_SCAN_SLOW,
+ .uclass = UCLASS_IDE,
+ .hunt = ide_bootdev_hunt,
+ .drv = DM_DRIVER_REF(ide_bootdev),
+};
+
static int ide_probe(struct udevice *udev)
{
struct udevice *blk_dev;
ret = blk_probe_or_unbind(blk_dev);
if (ret)
return ret;
+
+ ret = bootdev_setup_for_dev(udev, "ide_bootdev");
+ if (ret)
+ return log_msg_ret("bootdev", ret);
}
}
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
ut_assert_nextline(" 50 ethernet eth_bootdev");
+ ut_assert_nextline(" 40 ide ide_bootdev");
ut_assert_nextline(" 10 mmc mmc_bootdev");
ut_assert_nextline(" 30 scsi scsi_bootdev");
ut_assert_nextline(" 40 usb usb_bootdev");
- ut_assert_nextline("(total hunters: 4)");
+ ut_assert_nextline("(total hunters: 5)");
ut_assert_console_end();
ut_assertok(bootdev_hunt("usb1", false));
"Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found");
ut_assert_console_end();
- /* USB is fourth in the list, so bit 3 */
- ut_asserteq(BIT(3), std->hunters_used);
+ /* USB is fifth in the list, so bit 4 */
+ ut_asserteq(BIT(4), std->hunters_used);
return 0;
}
ut_assertok(run_command("bootdev hunt -l", 0));
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
- ut_assert_skip_to_line("(total hunters: 4)");
+ ut_assert_skip_to_line("(total hunters: 5)");
ut_assert_console_end();
/* Scan all hunters */
ut_assertok(run_command("bootdev hunt", 0));
ut_assert_nextline("Hunting with: ethernet");
+ ut_assert_nextline("Hunting with: ide");
+ ut_assert_nextline("Bus 0: not available ");
ut_assert_nextline("Hunting with: mmc");
ut_assert_nextline("Hunting with: scsi");
ut_assert_nextline("scanning bus for devices...");
ut_assert_nextlinen("Prio");
ut_assert_nextlinen("----");
ut_assert_nextline(" 50 * ethernet eth_bootdev");
+ ut_assert_nextline(" 40 * ide ide_bootdev");
ut_assert_nextline(" 10 * mmc mmc_bootdev");
ut_assert_nextline(" 30 * scsi scsi_bootdev");
ut_assert_nextline(" 40 * usb usb_bootdev");
- ut_assert_nextline("(total hunters: 4)");
+ ut_assert_nextline("(total hunters: 5)");
ut_assert_console_end();
- ut_asserteq(GENMASK(3, 0), std->hunters_used);
+ ut_asserteq(GENMASK(4, 0), std->hunters_used);
return 0;
}