* [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c
@ 2018-05-14 16:38 Tuomas Tynkkynen
2018-05-14 16:38 ` [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources Tuomas Tynkkynen
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Tuomas Tynkkynen @ 2018-05-14 16:38 UTC (permalink / raw)
To: u-boot
All of the debug output from this file is squished to one line. Fix
it.
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
---
drivers/pci/pci_auto_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci_auto_common.c b/drivers/pci/pci_auto_common.c
index 1d202ae2ef..d90dbcf91a 100644
--- a/drivers/pci/pci_auto_common.c
+++ b/drivers/pci/pci_auto_common.c
@@ -37,7 +37,7 @@ int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
pci_addr_t addr;
if (!res) {
- debug("No resource");
+ debug("No resource\n");
goto error;
}
@@ -50,7 +50,7 @@ int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
res->bus_lower = addr + size;
- debug("address=0x%llx bus_lower=0x%llx", (unsigned long long)addr,
+ debug("address=0x%llx bus_lower=0x%llx\n", (unsigned long long)addr,
(unsigned long long)res->bus_lower);
*bar = addr;
--
2.16.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources
2018-05-14 16:38 [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Tuomas Tynkkynen
@ 2018-05-14 16:38 ` Tuomas Tynkkynen
2018-05-14 19:53 ` Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
2018-05-14 19:53 ` [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
2 siblings, 2 replies; 6+ messages in thread
From: Tuomas Tynkkynen @ 2018-05-14 16:38 UTC (permalink / raw)
To: u-boot
Currently, if we happen to allocate an address requiring 64 bits to a
device only supporting 32-bit BARs, the address eventually gets silently
truncated to 32 bits. Avoid this by adding a new flag to
pciauto_region_allocate() to bail out in such situations.
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
---
drivers/pci/pci_auto.c | 6 ++++--
drivers/pci/pci_auto_common.c | 7 ++++++-
drivers/pci/pci_auto_old.c | 5 +++--
include/pci.h | 2 +-
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index d1feb503a0..d7237f6eee 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -98,7 +98,8 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
}
if (!enum_only && pciauto_region_allocate(bar_res, bar_size,
- &bar_value) == 0) {
+ &bar_value,
+ found_mem64) == 0) {
/* Write it out and update our limit */
dm_pci_write_config32(dev, bar, (u32)bar_value);
@@ -140,7 +141,8 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
debug("PCI Autoconfig: ROM, size=%#x, ",
(unsigned int)bar_size);
if (pciauto_region_allocate(mem, bar_size,
- &bar_value) == 0) {
+ &bar_value,
+ false) == 0) {
dm_pci_write_config32(dev, rom_addr,
bar_value);
}
diff --git a/drivers/pci/pci_auto_common.c b/drivers/pci/pci_auto_common.c
index d90dbcf91a..183787333e 100644
--- a/drivers/pci/pci_auto_common.c
+++ b/drivers/pci/pci_auto_common.c
@@ -32,7 +32,7 @@ void pciauto_region_align(struct pci_region *res, pci_size_t size)
}
int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
- pci_addr_t *bar)
+ pci_addr_t *bar, bool supports_64bit)
{
pci_addr_t addr;
@@ -48,6 +48,11 @@ int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
goto error;
}
+ if (upper_32_bits(addr) && !supports_64bit) {
+ debug("Cannot assign 64-bit address to 32-bit-only resource\n");
+ goto error;
+ }
+
res->bus_lower = addr + size;
debug("address=0x%llx bus_lower=0x%llx\n", (unsigned long long)addr,
diff --git a/drivers/pci/pci_auto_old.c b/drivers/pci/pci_auto_old.c
index bc119fba87..e705a3072e 100644
--- a/drivers/pci/pci_auto_old.c
+++ b/drivers/pci/pci_auto_old.c
@@ -108,7 +108,8 @@ void pciauto_setup_device(struct pci_controller *hose,
}
#ifndef CONFIG_PCI_ENUM_ONLY
- if (pciauto_region_allocate(bar_res, bar_size, &bar_value) == 0) {
+ if (pciauto_region_allocate(bar_res, bar_size,
+ &bar_value, found_mem64) == 0) {
/* Write it out and update our limit */
pci_hose_write_config_dword(hose, dev, bar, (u32)bar_value);
@@ -150,7 +151,7 @@ void pciauto_setup_device(struct pci_controller *hose,
debug("PCI Autoconfig: ROM, size=%#x, ",
(unsigned int)bar_size);
if (pciauto_region_allocate(mem, bar_size,
- &bar_value) == 0) {
+ &bar_value, false) == 0) {
pci_hose_write_config_dword(hose, dev, rom_addr,
bar_value);
}
diff --git a/include/pci.h b/include/pci.h
index cda6907688..127d3c6a6f 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -681,7 +681,7 @@ void pciauto_region_init(struct pci_region *res);
void pciauto_region_align(struct pci_region *res, pci_size_t size);
void pciauto_config_init(struct pci_controller *hose);
int pciauto_region_allocate(struct pci_region *res, pci_size_t size,
- pci_addr_t *bar);
+ pci_addr_t *bar, bool supports_64bit);
#if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
extern int pci_hose_read_config_byte_via_dword(struct pci_controller *hose,
--
2.16.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c
2018-05-14 16:38 [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Tuomas Tynkkynen
2018-05-14 16:38 ` [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources Tuomas Tynkkynen
@ 2018-05-14 19:53 ` Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
2 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2018-05-14 19:53 UTC (permalink / raw)
To: u-boot
On 14 May 2018 at 10:38, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> wrote:
> All of the debug output from this file is squished to one line. Fix
> it.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
> drivers/pci/pci_auto_common.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources
2018-05-14 16:38 ` [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources Tuomas Tynkkynen
@ 2018-05-14 19:53 ` Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Simon Glass @ 2018-05-14 19:53 UTC (permalink / raw)
To: u-boot
Hi Tuomas,
On 14 May 2018 at 10:38, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> wrote:
> Currently, if we happen to allocate an address requiring 64 bits to a
> device only supporting 32-bit BARs, the address eventually gets silently
> truncated to 32 bits. Avoid this by adding a new flag to
> pciauto_region_allocate() to bail out in such situations.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
> drivers/pci/pci_auto.c | 6 ++++--
> drivers/pci/pci_auto_common.c | 7 ++++++-
> drivers/pci/pci_auto_old.c | 5 +++--
> include/pci.h | 2 +-
> 4 files changed, 14 insertions(+), 6 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
Please can you add a function comment to pciauto_region_allocate()?
Regards,
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [U-Boot, 1/2] PCI: Add newlines to debug prints in pci_auto_common.c
2018-05-14 16:38 [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Tuomas Tynkkynen
2018-05-14 16:38 ` [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources Tuomas Tynkkynen
2018-05-14 19:53 ` [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Simon Glass
@ 2018-05-28 19:12 ` Tom Rini
2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2018-05-28 19:12 UTC (permalink / raw)
To: u-boot
On Mon, May 14, 2018 at 07:38:12PM +0300, Tuomas Tynkkynen wrote:
> All of the debug output from this file is squished to one line. Fix
> it.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180528/cbc91195/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [U-Boot, 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources
2018-05-14 16:38 ` [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources Tuomas Tynkkynen
2018-05-14 19:53 ` Simon Glass
@ 2018-05-28 19:12 ` Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2018-05-28 19:12 UTC (permalink / raw)
To: u-boot
On Mon, May 14, 2018 at 07:38:13PM +0300, Tuomas Tynkkynen wrote:
> Currently, if we happen to allocate an address requiring 64 bits to a
> device only supporting 32-bit BARs, the address eventually gets silently
> truncated to 32 bits. Avoid this by adding a new flag to
> pciauto_region_allocate() to bail out in such situations.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180528/d75470a9/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-28 19:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 16:38 [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Tuomas Tynkkynen
2018-05-14 16:38 ` [U-Boot] [PATCH 2/2] PCI: autoconfig: Don't allocate 64-bit addresses to 32-bit only resources Tuomas Tynkkynen
2018-05-14 19:53 ` Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
2018-05-14 19:53 ` [U-Boot] [PATCH 1/2] PCI: Add newlines to debug prints in pci_auto_common.c Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
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.