All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] pci: definition of pci_addr_t and pci_size_t
@ 2020-02-05 19:07 Heinrich Schuchardt
  2020-02-05 20:05 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2020-02-05 19:07 UTC (permalink / raw)
  To: u-boot

Currently the size of pci_addr_t and pci_size_t depends on
CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
to an error

    pci_hose_phys_to_bus: invalid physical address

which is due to the truncation of the bus address in _dm_pci_phys_to_bus.

Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error

   PCI: Failed autoconfig bar 10

So let's use unsigned long for pci_addr_t and pci_size_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 include/pci.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/include/pci.h b/include/pci.h
index 8c761d8da3..d8bce8ab80 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -484,13 +484,8 @@

 #include <dm/pci.h>

-#ifdef CONFIG_SYS_PCI_64BIT
-typedef u64 pci_addr_t;
-typedef u64 pci_size_t;
-#else
-typedef u32 pci_addr_t;
-typedef u32 pci_size_t;
-#endif
+typedef unsigned long pci_addr_t;
+typedef unsigned long pci_size_t;

 struct pci_region {
 	pci_addr_t bus_start;	/* Start on the bus */
--
2.24.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/1] pci: definition of pci_addr_t and pci_size_t
  2020-02-05 19:07 [PATCH 1/1] pci: definition of pci_addr_t and pci_size_t Heinrich Schuchardt
@ 2020-02-05 20:05 ` Simon Glass
  2020-02-05 20:18   ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2020-02-05 20:05 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Wed, 5 Feb 2020 at 12:07, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Currently the size of pci_addr_t and pci_size_t depends on
> CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
> to an error
>
>     pci_hose_phys_to_bus: invalid physical address
>
> which is due to the truncation of the bus address in _dm_pci_phys_to_bus.
>
> Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error
>
>    PCI: Failed autoconfig bar 10
>
> So let's use unsigned long for pci_addr_t and pci_size_t.

But how will this work on x86 where we might have 32-bit U-Boot but
need 64-bit PCI addresses?

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] pci: definition of pci_addr_t and pci_size_t
  2020-02-05 20:05 ` Simon Glass
@ 2020-02-05 20:18   ` Heinrich Schuchardt
  2020-02-05 20:28     ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2020-02-05 20:18 UTC (permalink / raw)
  To: u-boot



On 2/5/20 9:05 PM, Simon Glass wrote:
> Hi Heinrich,
>
> On Wed, 5 Feb 2020 at 12:07, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>
>> Currently the size of pci_addr_t and pci_size_t depends on
>> CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
>> to an error
>>
>>      pci_hose_phys_to_bus: invalid physical address
>>
>> which is due to the truncation of the bus address in _dm_pci_phys_to_bus.
>>
>> Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error
>>
>>     PCI: Failed autoconfig bar 10
>>
>> So let's use unsigned long for pci_addr_t and pci_size_t.
>
> But how will this work on x86 where we might have 32-bit U-Boot but
> need 64-bit PCI addresses?
>
> Regards,
> Simon
>

So would you suggest to only change the code for CONFIG_SYS_PCI_64BIT=n?

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] pci: definition of pci_addr_t and pci_size_t
  2020-02-05 20:18   ` Heinrich Schuchardt
@ 2020-02-05 20:28     ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2020-02-05 20:28 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Wed, 5 Feb 2020 at 13:18, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
>
>
> On 2/5/20 9:05 PM, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Wed, 5 Feb 2020 at 12:07, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >>
> >> Currently the size of pci_addr_t and pci_size_t depends on
> >> CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
> >> to an error
> >>
> >>      pci_hose_phys_to_bus: invalid physical address
> >>
> >> which is due to the truncation of the bus address in _dm_pci_phys_to_bus.
> >>
> >> Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error
> >>
> >>     PCI: Failed autoconfig bar 10
> >>
> >> So let's use unsigned long for pci_addr_t and pci_size_t.
> >
> > But how will this work on x86 where we might have 32-bit U-Boot but
> > need 64-bit PCI addresses?
> >
> > Regards,
> > Simon
> >
>
> So would you suggest to only change the code for CONFIG_SYS_PCI_64BIT=n?

I think that is safe, since nothing has a ulong less than 32 bits.

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-05 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 19:07 [PATCH 1/1] pci: definition of pci_addr_t and pci_size_t Heinrich Schuchardt
2020-02-05 20:05 ` Simon Glass
2020-02-05 20:18   ` Heinrich Schuchardt
2020-02-05 20:28     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.