diff mbox series

[U-Boot,06/18] dm: pci: Make ranges dt property optional

Message ID 1528637118-32739-7-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit f2825f6ec0bb50e7bd9376828a32212f1961f979
Delegated to: Bin Meng
Headers show
Series x86: efi: Fixes and enhancements to application and payload support | expand

Commit Message

Bin Meng June 10, 2018, 1:25 p.m. UTC
From: Christian Gmeiner <christian.gmeiner@gmail.com>

If we use U-Boot as coreboot payload with a generic dts without
any ranges specified we fail in pci pre_probe and our pci bus
is not usable.

So convert decode_regions(..) into a void function and do the simple
error handling there.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fixed 'u-boot' in the commit message and checkpatch warning]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

 drivers/pci/pci-uclass.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

Comments

Simon Glass June 11, 2018, 2:53 p.m. UTC | #1
On 10 June 2018 at 05:25, Bin Meng <bmeng.cn@gmail.com> wrote:
> From: Christian Gmeiner <christian.gmeiner@gmail.com>
>
> If we use U-Boot as coreboot payload with a generic dts without
> any ranges specified we fail in pci pre_probe and our pci bus
> is not usable.
>
> So convert decode_regions(..) into a void function and do the simple
> error handling there.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> [bmeng: fixed 'u-boot' in the commit message and checkpatch warning]
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
>  drivers/pci/pci-uclass.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng June 12, 2018, 1:07 p.m. UTC | #2
On Mon, Jun 11, 2018 at 10:53 PM, Simon Glass <sjg@chromium.org> wrote:
> On 10 June 2018 at 05:25, Bin Meng <bmeng.cn@gmail.com> wrote:
>> From: Christian Gmeiner <christian.gmeiner@gmail.com>
>>
>> If we use U-Boot as coreboot payload with a generic dts without
>> any ranges specified we fail in pci pre_probe and our pci bus
>> is not usable.
>>
>> So convert decode_regions(..) into a void function and do the simple
>> error handling there.
>>
>> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>> [bmeng: fixed 'u-boot' in the commit message and checkpatch warning]
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>>  drivers/pci/pci-uclass.c | 23 ++++++++++-------------
>>  1 file changed, 10 insertions(+), 13 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86, thanks!
diff mbox series

Patch

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 1cd1e40..de4c71b 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -810,8 +810,8 @@  error:
 	return ret;
 }
 
-static int decode_regions(struct pci_controller *hose, ofnode parent_node,
-			  ofnode node)
+static void decode_regions(struct pci_controller *hose, ofnode parent_node,
+			   ofnode node)
 {
 	int pci_addr_cells, addr_cells, size_cells;
 	int cells_per_record;
@@ -820,8 +820,11 @@  static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 	int i;
 
 	prop = ofnode_get_property(node, "ranges", &len);
-	if (!prop)
-		return -EINVAL;
+	if (!prop) {
+		debug("%s: Cannot decode regions\n", __func__);
+		return;
+	}
+
 	pci_addr_cells = ofnode_read_simple_addr_cells(node);
 	addr_cells = ofnode_read_simple_addr_cells(parent_node);
 	size_cells = ofnode_read_simple_size_cells(node);
@@ -883,7 +886,7 @@  static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 	bd_t *bd = gd->bd;
 
 	if (!bd)
-		return 0;
+		return;
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
 		if (bd->bi_dram[i].size) {
@@ -908,13 +911,12 @@  static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 			base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
 #endif
 
-	return 0;
+	return;
 }
 
 static int pci_uclass_pre_probe(struct udevice *bus)
 {
 	struct pci_controller *hose;
-	int ret;
 
 	debug("%s, bus=%d/%s, parent=%s\n", __func__, bus->seq, bus->name,
 	      bus->parent->name);
@@ -923,12 +925,7 @@  static int pci_uclass_pre_probe(struct udevice *bus)
 	/* For bridges, use the top-level PCI controller */
 	if (!device_is_on_pci_bus(bus)) {
 		hose->ctlr = bus;
-		ret = decode_regions(hose, dev_ofnode(bus->parent),
-				     dev_ofnode(bus));
-		if (ret) {
-			debug("%s: Cannot decode regions\n", __func__);
-			return ret;
-		}
+		decode_regions(hose, dev_ofnode(bus->parent), dev_ofnode(bus));
 	} else {
 		struct pci_controller *parent_hose;