[U-Boot,1/1] dm: scsi: Scan the actual number of ports
diff mbox series

Message ID A1484485FD99714DB2AB2C5EF81E7AC2AA78CF96@ORSMSX116.amr.corp.intel.com
State Accepted
Commit bd98e6ae7160d5a4fc013266183506068227dd79
Delegated to: Tom Rini
Headers show
Series
  • [U-Boot,1/1] dm: scsi: Scan the actual number of ports
Related show

Commit Message

Park, Aiden Aug. 20, 2019, 4:47 p.m. UTC
The scsi_scan_dev() is looping over the number of uc_plat->max_id.
The number of actual ports a AHCI controller has can be greater than
max_id. Update uc_plat->max_id to make SCSI scan all detected ports.

Signed-off-by: Aiden Park <aiden.park@intel.com>
---
 drivers/ata/ahci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Bin Meng Aug. 21, 2019, 9:41 a.m. UTC | #1
On Wed, Aug 21, 2019 at 12:47 AM Park, Aiden <aiden.park@intel.com> wrote:
>
> The scsi_scan_dev() is looping over the number of uc_plat->max_id.
> The number of actual ports a AHCI controller has can be greater than
> max_id. Update uc_plat->max_id to make SCSI scan all detected ports.
>
> Signed-off-by: Aiden Park <aiden.park@intel.com>
> ---
>  drivers/ata/ahci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tom Rini Aug. 27, 2019, 12:18 a.m. UTC | #2
On Tue, Aug 20, 2019 at 04:47:42PM +0000, Park, Aiden wrote:

> The scsi_scan_dev() is looping over the number of uc_plat->max_id.
> The number of actual ports a AHCI controller has can be greater than
> max_id. Update uc_plat->max_id to make SCSI scan all detected ports.
> 
> Signed-off-by: Aiden Park <aiden.park@intel.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot/master, thanks!

Patch
diff mbox series

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e3135bb75f..9a08575053 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1167,6 +1167,14 @@  int ahci_probe_scsi(struct udevice *ahci_dev, ulong base)
 	if (ret)
 		return ret;
 
+	/*
+	 * scsi_scan_dev() scans devices up-to the number of max_id.
+	 * Update max_id if the number of detected ports exceeds max_id.
+	 * This allows SCSI to scan all detected ports.
+	 */
+	uc_plat->max_id = max_t(unsigned long, uc_priv->n_ports,
+				uc_plat->max_id);
+
 	return 0;
 }