"Das U-Boot" Source Tree
at master 61 lines 1.1 kB view raw
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Bootdev for SCSI 4 * 5 * Copyright 2021 Google LLC 6 * Written by Simon Glass <sjg@chromium.org> 7 */ 8 9#include <bootdev.h> 10#include <dm.h> 11#include <init.h> 12#include <scsi.h> 13 14static int scsi_bootdev_bind(struct udevice *dev) 15{ 16 struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev); 17 18 ucp->prio = BOOTDEVP_4_SCAN_FAST; 19 20 return 0; 21} 22 23static int scsi_bootdev_hunt(struct bootdev_hunter *info, bool show) 24{ 25 int ret; 26 27 if (IS_ENABLED(CONFIG_PCI)) { 28 ret = pci_init(); 29 if (ret) 30 return log_msg_ret("pci", ret); 31 } 32 33 ret = scsi_scan(true); 34 if (ret) 35 return log_msg_ret("scs", ret); 36 37 return 0; 38} 39 40struct bootdev_ops scsi_bootdev_ops = { 41}; 42 43static const struct udevice_id scsi_bootdev_ids[] = { 44 { .compatible = "u-boot,bootdev-scsi" }, 45 { } 46}; 47 48U_BOOT_DRIVER(scsi_bootdev) = { 49 .name = "scsi_bootdev", 50 .id = UCLASS_BOOTDEV, 51 .ops = &scsi_bootdev_ops, 52 .bind = scsi_bootdev_bind, 53 .of_match = scsi_bootdev_ids, 54}; 55 56BOOTDEV_HUNTER(scsi_bootdev_hunter) = { 57 .prio = BOOTDEVP_4_SCAN_FAST, 58 .uclass = UCLASS_SCSI, 59 .hunt = scsi_bootdev_hunt, 60 .drv = DM_DRIVER_REF(scsi_bootdev), 61};