]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: dm: pci: Test more than one PCI host controller
authorBin Meng <bmeng.cn@gmail.com>
Fri, 3 Aug 2018 08:14:41 +0000 (01:14 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 8 Aug 2018 11:49:31 +0000 (12:49 +0100)
So far there is only one PCI host controller in the sandbox test
configuration. This is normally the case for x86, but it can be
common on other architectures like ARM/PPC to have more than one
PCI host controller in the system.

This updates the case to cover such scenario.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/dts/test.dts
test/dm/pci.c

index 237266d4baa3e52df910e0760f94bed498fad8a3..0bce6d01af7564aa51c7910ead74d79b6f8512e5 100644 (file)
@@ -14,7 +14,8 @@
                i2c0 = "/i2c@0";
                mmc0 = "/mmc0";
                mmc1 = "/mmc1";
-               pci0 = &pci;
+               pci0 = &pci0;
+               pci1 = &pci1;
                remoteproc1 = &rproc_1;
                remoteproc2 = &rproc_2;
                rtc0 = &rtc_0;
                compatible = "sandbox,mmc";
        };
 
-       pci: pci-controller {
+       pci0: pci-controller0 {
                compatible = "sandbox,pci";
                device_type = "pci";
                #address-cells = <3>;
                };
        };
 
+       pci1: pci-controller1 {
+               compatible = "sandbox,pci";
+               device_type = "pci";
+               #address-cells = <3>;
+               #size-cells = <2>;
+               ranges = <0x02000000 0 0x30000000 0x30000000 0 0x2000
+                               0x01000000 0 0x40000000 0x40000000 0 0x2000>;
+               pci@8,0 {
+                       compatible = "pci-generic";
+                       reg = <0x4000 0 0 0 0>;
+                       emul@8,0 {
+                               compatible = "sandbox,swap-case";
+                       };
+               };
+               pci@c,0 {
+                       compatible = "pci-generic";
+                       reg = <0x6000 0 0 0 0>;
+                       emul@c,0 {
+                               compatible = "sandbox,swap-case";
+                       };
+               };
+       };
+
        probing {
                compatible = "simple-bus";
                test1 {
index f2bd52a0b0f4ca1daa4b0a0e21c0b96b4a8b3e13..727ec342e2376a3aaed169e721a4a9c7106a186d 100644 (file)
@@ -26,6 +26,7 @@ static int dm_test_pci_busdev(struct unit_test_state *uts)
        struct udevice *bus;
        struct udevice *emul, *swap;
 
+       /* Test bus#0 and its devices */
        ut_assertok(uclass_get_device_by_seq(UCLASS_PCI, 0, &bus));
 
        ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 0, &emul));
@@ -35,6 +36,16 @@ static int dm_test_pci_busdev(struct unit_test_state *uts)
        ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap));
        ut_assert(device_active(swap));
 
+       /* Test bus#1 and its devices */
+       ut_assertok(uclass_get_device_by_seq(UCLASS_PCI, 1, &bus));
+
+       ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 2, &emul));
+       ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &swap));
+       ut_assert(device_active(swap));
+       ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 3, &emul));
+       ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x0c, 0), &swap));
+       ut_assert(device_active(swap));
+
        return 0;
 }
 DM_TEST(dm_test_pci_busdev, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);