]> git.sur5r.net Git - u-boot/blobdiff - drivers/scsi/scsi.c
dm: core: Add logging of some common errors
[u-boot] / drivers / scsi / scsi.c
index 2b87548bd3153b577891863a5b932b03117e5a2d..16246bec2b3152b3c3f8228a23b70e88a21cae6c 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2001
  * Denis Peter, MPL AG Switzerland
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -29,7 +28,8 @@
 # endif
 #endif
 
-#if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT)
+#if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) && \
+       !defined(CONFIG_DM_SCSI)
 const struct pci_device_id scsi_device_list[] = { SCSI_DEV_LIST };
 #endif
 static struct scsi_cmd tempccb;        /* temporary scsi command buffer */
@@ -274,7 +274,8 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr,
        return blkcnt;
 }
 
-#if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT)
+#if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) && \
+       !defined(CONFIG_DM_SCSI)
 void scsi_init(void)
 {
        int busdevfunc = -1;
@@ -449,7 +450,7 @@ static void scsi_init_dev_desc_priv(struct blk_desc *dev_desc)
        dev_desc->product[0] = 0;
        dev_desc->revision[0] = 0;
        dev_desc->removable = false;
-#ifndef CONFIG_BLK
+#if !CONFIG_IS_ENABLED(BLK)
        dev_desc->block_read = scsi_read;
        dev_desc->block_write = scsi_write;
 #endif
@@ -578,7 +579,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
        */
        snprintf(str, sizeof(str), "id%dlun%d", id, lun);
        ret = blk_create_devicef(dev, "scsi_blk", str, IF_TYPE_SCSI, -1,
-                       bd.blksz, bd.blksz * bd.lba, &bdev);
+                       bd.blksz, bd.lba, &bdev);
        if (ret) {
                debug("Can't create device\n");
                return ret;
@@ -680,7 +681,7 @@ int scsi_scan(bool verbose)
 
        printf("Found %d device(s).\n", scsi_max_devs);
 #ifndef CONFIG_SPL_BUILD
-       setenv_ulong("scsidevs", scsi_max_devs);
+       env_set_ulong("scsidevs", scsi_max_devs);
 #endif
        return 0;
 }