dm: pci: Check board information pointer in decode_regions()
PATCH 1/2 dm: pci: Check board information pointer in decode_regions()
PCI enumeration may happen very early on an x86 board. The board information pointer should have been checked in decode_regions() as its space may not be allocated yet.
With this commit, Intel Galileo board boots again.
---
drivers/pci/pci-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/pci-uclass.c +3 -0
@@ -876,6 +876,9 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,#ifdef CONFIG_NR_DRAM_BANKS bd_t *bd = gd->bd; +if (!bd) +return 0 ; +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; ++i) {if (bd->bi_dram[i].size) { pci_set_region(hose->regions + hose->region_count++,
Signature · 1 line
2.7.4
PATCH 2/2 dm: pci: Avoid setting a PCI region that has 0 size
It makes no sense to set a PCI region that has 0 size.
---
drivers/pci/pci-uclass.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/pci-uclass.c +3 -2
@@ -897,8 +897,9 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,#endif if (gd->pci_ram_top && gd->pci_ram_top < base + size) size = gd->pci_ram_top - base; -pci_set_region (hose->regions + hose->region_count++, base, base, - size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); +if (size) +pci_set_region (hose->regions + hose->region_count++, base, + base, size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );#endif return 0 ;
Signature · 1 line
2.7.4
PATCH 2/2 dm: pci: Avoid setting a PCI region that has 0 size
Quoted 7 lines · Bin Meng
It makes no sense to set a PCI region that has 0 size.
Signed-off-by Bin Meng <[email protected]>---
drivers/pci/pci-uclass.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
PATCH 2/2 dm: pci: Avoid setting a PCI region that has 0 size
Quoted 10 lines · Simon Glass
Quoted 7 lines · Bin Meng
It makes no sense to set a PCI region that has 0 size.
Signed-off-by Bin Meng <[email protected]>---
drivers/pci/pci-uclass.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>
applied to u-boot-x86, thanks!
PATCH 1/2 dm: pci: Check board information pointer in decode_regions()
In reply to Bin MengQuoted 4 lines · Bin Meng
PCI enumeration may happen very early on an x86 board. The board information pointer should have been checked in
decode_regions()as its space may not be allocated yet.
Quoted 8 lines
With this commit, Intel Galileo board boots again.
Fixes 664758c ("pci: Fix decode regions for memory banks")Signed-off-by Bin Meng <[email protected]>---
drivers/pci/pci-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
PATCH 1/2 dm: pci: Check board information pointer in decode_regions()
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
PCI enumeration may happen very early on an x86 board. The board information pointer should have been checked in
decode_regions()as its space may not be allocated yet.With this commit, Intel Galileo board boots again.
Quoted 8 lines
Quoted 6 lines
Fixes 664758c ("pci: Fix decode regions for memory banks")Signed-off-by Bin Meng <[email protected]>---
drivers/pci/pci-uclass.c | 3 +++ 1 file changed, 3 insertions(+)Reviewed-by Simon Glass <[email protected]>
applied to u-boot-x86, thanks!