Skip to contentSkip to conversation

ahci-pci: Update call to ahci_scsi_probe()

PATCH New Tom Rini 2 participants 4 messages Aug 3, 2017 libata

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 ahci-pci: Update call to ahci_scsi_probe()

The function now takes a 'base' argument, and we can provide that by having dev_read_addr() get it from the struct uclass dev that we have been given.

---
 drivers/ata/ahci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci-pci.c +1 -1
index f46fad899e5a..beec14f46d66 100644
@@ -18,7 +18,7 @@ static int ahci_pci_bind(struct udevice *dev)
 
 static int ahci_pci_probe(struct udevice *dev)
 {
-	return ahci_probe_scsi(dev);
+	return ahci_probe_scsi(dev, dev_read_addr(dev));
 }
 
 static const struct udevice_id ahci_pci_ids[] = {
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ahci-pci: Update call to ahci_scsi_probe()

Hi Tom,

Quoted 4 lines · Tom Rini

The function now takes a 'base' argument, and we can provide that by having dev_read_addr() get it from the struct uclass dev that we have been given.

Oops. Thanks for catching this!

Quoted 11 lines
---
 drivers/ata/ahci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci-pci.c +0 -0
index f46fad899e5a..beec14f46d66 100644

drivers/ata/ahci-pci.c static int ahci_pci_bind(struct udevice *dev) · line 21

Quoted 5 lines
drivers/ata/ahci-pci.c +1 -1
@@ -18,7 +18,7 @@ static int ahci_pci_bind(struct udevice *dev)
 
 static int ahci_pci_probe(struct udevice *dev)
 {
-       return ahci_probe_scsi(dev);
+       return ahci_probe_scsi(dev, dev_read_addr(dev));

But dev_read_addr(dev) does not work here as the AHCI device is on PCI bus. The base address should be read from PCI configuration space. There is already an API that does this, see ahci_probe_scsi_pci().

drivers/ata/ahci-pci.c static int ahci_pci_bind(struct udevice *dev)

Quoted 4 lines
drivers/ata/ahci-pci.c +0 -1
 }
 
 static const struct udevice_id ahci_pci_ids[] = {
--

Regards,
Bin

author
#2 lore raw

PATCH 1/1 ahci-pci: Update call to ahci_scsi_probe()

Quoted 22 lines · Bin Meng

Hi Tom,

Quoted 4 lines · Tom Rini

The function now takes a 'base' argument, and we can provide that by having dev_read_addr() get it from the struct uclass dev that we have been given.

Oops. Thanks for catching this!

Quoted 12 lines
---
 drivers/ata/ahci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci-pci.c +0 -0
index f46fad899e5a..beec14f46d66 100644
@@ -18,7 +18,7 @@ static int ahci_pci_bind(struct udevice *dev)
 
Quoted 8 lines

drivers/ata/ahci-pci.c static int ahci_pci_bind(struct udevice *dev) · line 21

Quoted 4 lines
drivers/ata/ahci-pci.c +1 -1
 static int ahci_pci_probe(struct udevice *dev)
 {
-       return ahci_probe_scsi(dev);
+       return ahci_probe_scsi(dev, dev_read_addr(dev));

But dev_read_addr(dev) does not work here as the AHCI device is on PCI bus. The base address should be read from PCI configuration space. There is already an API that does this, see ahci_probe_scsi_pci().

OK, so that calls dm_pci_map_bar for PCI_BASE_ADDRESS_5, which at first glance, I would have to ask why we're hard-coding that value in. And then, I wonder why we have this code in ahci-pci.c but then ahci_probe_scsi_pci() as you note in drivers/ata/ahci.c. Wouldn't both of these calls be the same code? Can you please provide a patch that fixes ahci-pci.c? It's breaking qemu-x86 and I let travis-ci (and then my lab, sigh, funky power issues) be broken long enough that some problems have slipped in to master :(, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170802/383aaa7f/attachment.sig>
#3 lore raw

PATCH 1/1 ahci-pci: Update call to ahci_scsi_probe()

Hi Tom,

Quoted 32 lines · Tom Rini
Quoted 22 lines · Bin Meng

Hi Tom,

Quoted 4 lines · Tom Rini

The function now takes a 'base' argument, and we can provide that by having dev_read_addr() get it from the struct uclass dev that we have been given.

Oops. Thanks for catching this!

Quoted 12 lines
---
 drivers/ata/ahci-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci-pci.c +0 -0
index f46fad899e5a..beec14f46d66 100644
@@ -18,7 +18,7 @@ static int ahci_pci_bind(struct udevice *dev)
 
Quoted 8 lines

drivers/ata/ahci-pci.c static int ahci_pci_bind(struct udevice *dev) · line 21

Quoted 4 lines
drivers/ata/ahci-pci.c +1 -1
 static int ahci_pci_probe(struct udevice *dev)
 {
-       return ahci_probe_scsi(dev);
+       return ahci_probe_scsi(dev, dev_read_addr(dev));

But dev_read_addr(dev) does not work here as the AHCI device is on PCI bus. The base address should be read from PCI configuration space. There is already an API that does this, see ahci_probe_scsi_pci().

Quoted 9 lines

OK, so that calls dm_pci_map_bar for PCI_BASE_ADDRESS_5, which at first glance, I would have to ask why we're hard-coding that value in. And then, I wonder why we have this code in ahci-pci.c but then ahci_probe_scsi_pci() as you note in drivers/ata/ahci.c. Wouldn't both of these calls be the same code? Can you please provide a patch that fixes ahci-pci.c? It's breaking qemu-x86 and I let travis-ci (and then my lab, sigh, funky power issues) be broken long enough that some problems have slipped in to master :(, thanks!

PCI_BASE_ADDRESS_5 is hardcoded because that's defined by the AHCI controller spec. ahci_probe_scsi_pci() is put in drivers/ata/ahci.c because arch/x86/cpu/ivybridge/sata.c calls it too. The broken was not that long enough, as it was just exposed when
http://patchwork.ozlabs.org/patch/796095/ and
http://patchwork.ozlabs.org/patch/796209/ were merged altogether at the same day :)

I will prepare a patch ASAP. Thanks!

Regards,
Bin