diff mbox series

[U-Boot] x86: Add 'imply SCSI' to boards using AHCI_PCI

Message ID 20171130213546.23847-1-tuomas.tynkkynen@iki.fi
State Changes Requested
Delegated to: Bin Meng
Headers show
Series [U-Boot] x86: Add 'imply SCSI' to boards using AHCI_PCI | expand

Commit Message

Tuomas Tynkkynen Nov. 30, 2017, 9:35 p.m. UTC
The qemu and coreboot boards have 'imply AHCI_PCI' but no 'imply SCSI',
i.e. they are enabling the driver for the Serial ATA controller but
(AFAICT) have no way of accessing those devices from the prompt.

In fact, without this patch I get a silent U-Boot crash when I add a
SATA device to QEMU with the following options:

    -drive if=none,file=mydisk.qcow2,id=root
    -device ich9-ahci,id=ahci
    -device ide-drive,drive=root,bus=ahci.0

With the 'imply SCSI' added, U-Boot doesn't crash and the drive is found
when 'scsi scan' is run.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
---
Hi Bin, Simon

Does this make sense? I was working on converting drivers/ata to
Kconfig, which includes CONFIG_SCSI_AHCI (used by x86) but noticed these
boards that currently have {SCSI=n, AHCI_PCI=y, SCSI_AHCI=y}.
---
 arch/x86/cpu/coreboot/Kconfig | 1 +
 arch/x86/cpu/qemu/Kconfig     | 1 +
 2 files changed, 2 insertions(+)

Comments

Bin Meng Dec. 1, 2017, 5:43 a.m. UTC | #1
Hi Tuomas,

On Fri, Dec 1, 2017 at 5:35 AM, Tuomas Tynkkynen
<tuomas.tynkkynen@iki.fi> wrote:
> The qemu and coreboot boards have 'imply AHCI_PCI' but no 'imply SCSI',
> i.e. they are enabling the driver for the Serial ATA controller but
> (AFAICT) have no way of accessing those devices from the prompt.
>
> In fact, without this patch I get a silent U-Boot crash when I add a
> SATA device to QEMU with the following options:
>
>     -drive if=none,file=mydisk.qcow2,id=root
>     -device ich9-ahci,id=ahci
>     -device ide-drive,drive=root,bus=ahci.0
>
> With the 'imply SCSI' added, U-Boot doesn't crash and the drive is found
> when 'scsi scan' is run.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
> Hi Bin, Simon
>
> Does this make sense? I was working on converting drivers/ata to
> Kconfig, which includes CONFIG_SCSI_AHCI (used by x86) but noticed these
> boards that currently have {SCSI=n, AHCI_PCI=y, SCSI_AHCI=y}.

By default QEMU supports the i440FX chipset via '-M pc'. If we want to
use AHCI, '-M q35' should be specified and DTS should be changed to
qemu-x86_q35.dts.
That's why SCSI is not turned on by default.

However when I try to reproduce the crash issue with QEMU, I cannot
reproduce the crash issue after I added CONFIG_SCSI to the
'menuconfig'.
But I did find another dependency problem. If I turned on the
CONFIG_CMD_SCSI first without turning on CONFIG_SCSI, QEMU x86 does
not build.

cmd/built-in.o: In function `do_scsi':
git/u-boot/cmd/scsi.c:38: undefined reference to `scsi_scan'
git/u-boot/cmd/scsi.c:44: undefined reference to `scsi_scan'
Makefile:1255: recipe for target 'u-boot' failed

I believe we should do:

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5a6afab..8218a2c 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1437,6 +1437,7 @@ config CMD_REISER

 config CMD_SCSI
        bool "scsi - Access to SCSI devices"
+       depends on SCSI
        default y if SCSI
        help
          This provides a 'scsi' command which provides access to SCSI (Small

> ---
>  arch/x86/cpu/coreboot/Kconfig | 1 +
>  arch/x86/cpu/qemu/Kconfig     | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git arch/x86/cpu/coreboot/Kconfig arch/x86/cpu/coreboot/Kconfig
> index 60eb45f9d0..0e83a43d99 100644
> --- arch/x86/cpu/coreboot/Kconfig
> +++ arch/x86/cpu/coreboot/Kconfig
> @@ -10,6 +10,7 @@ config SYS_COREBOOT
>         imply MMC_PCI
>         imply MMC_SDHCI
>         imply MMC_SDHCI_SDMA
> +       imply SCSI
>         imply SPI_FLASH
>         imply SYS_NS16550
>         imply USB
> diff --git arch/x86/cpu/qemu/Kconfig arch/x86/cpu/qemu/Kconfig
> index 81444f3d9e..a0090281b9 100644
> --- arch/x86/cpu/qemu/Kconfig
> +++ arch/x86/cpu/qemu/Kconfig
> @@ -9,6 +9,7 @@ config QEMU
>         select ARCH_EARLY_INIT_R
>         imply AHCI_PCI
>         imply E1000
> +       imply SCSI
>         imply SYS_NS16550
>         imply USB
>         imply USB_EHCI_HCD
> --

Regards,
Bin
diff mbox series

Patch

diff --git arch/x86/cpu/coreboot/Kconfig arch/x86/cpu/coreboot/Kconfig
index 60eb45f9d0..0e83a43d99 100644
--- arch/x86/cpu/coreboot/Kconfig
+++ arch/x86/cpu/coreboot/Kconfig
@@ -10,6 +10,7 @@  config SYS_COREBOOT
 	imply MMC_PCI
 	imply MMC_SDHCI
 	imply MMC_SDHCI_SDMA
+	imply SCSI
 	imply SPI_FLASH
 	imply SYS_NS16550
 	imply USB
diff --git arch/x86/cpu/qemu/Kconfig arch/x86/cpu/qemu/Kconfig
index 81444f3d9e..a0090281b9 100644
--- arch/x86/cpu/qemu/Kconfig
+++ arch/x86/cpu/qemu/Kconfig
@@ -9,6 +9,7 @@  config QEMU
 	select ARCH_EARLY_INIT_R
 	imply AHCI_PCI
 	imply E1000
+	imply SCSI
 	imply SYS_NS16550
 	imply USB
 	imply USB_EHCI_HCD