Add a basic functional test for the AST2700 PCIe Root Complex.
The test runs "lspci" to verify that the internal host bridge is
enumerated at BDF 0002:00:00.0.

Note: the ASPEED PCIe driver only supports bus 0 with a single
device at slot 0, which is reserved for the internal bridge.
All endpoint devices must reside on bus 1 to be discovered.
As a result, this test only checks that the internal bridge
is visible. Attaching pcie-root-port and e1000e devices is
not possible without driver changes.

This is a temporary solution. See the ASPEED PCIe driver
implementation for details:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/drivers/pci/controller/pcie-aspeed.c#L512

Additionally, the ASPEED SDK by default enables only PCIe RC2,
so the test covers RC2 only.

Signed-off-by: Jamin Lin <jamin_...@aspeedtech.com>
---
 tests/functional/test_aarch64_aspeed_ast2700.py   | 7 +++++++
 tests/functional/test_aarch64_aspeed_ast2700fc.py | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/tests/functional/test_aarch64_aspeed_ast2700.py 
b/tests/functional/test_aarch64_aspeed_ast2700.py
index d02dc7991c..49f81db86c 100755
--- a/tests/functional/test_aarch64_aspeed_ast2700.py
+++ b/tests/functional/test_aarch64_aspeed_ast2700.py
@@ -65,6 +65,11 @@ def do_ast2700_i2c_test(self):
         exec_command_and_wait_for_pattern(self,
             'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', 
'18000')
 
+    def do_ast2700_pcie_test(self):
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 0002:00:00.0',
+            '0002:00:00.0 Host bridge: ASPEED Technology, Inc. AST1150 
PCI-to-PCI Bridge')
+
     def start_ast2700_test(self, name):
         num_cpu = 4
         uboot_size = os.path.getsize(self.scratch_file(name,
@@ -126,6 +131,7 @@ def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
         self.start_ast2700_test('ast2700-default')
         self.verify_openbmc_boot_and_login('ast2700-default')
         self.do_ast2700_i2c_test()
+        self.do_ast2700_pcie_test()
 
     def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_06(self):
         self.set_machine('ast2700a1-evb')
@@ -135,6 +141,7 @@ def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_06(self):
         self.verify_vbootrom_firmware_flow()
         self.verify_openbmc_boot_and_login('ast2700-default')
         self.do_ast2700_i2c_test()
+        self.do_ast2700_pcie_test()
 
 if __name__ == '__main__':
     QemuSystemTest.main()
diff --git a/tests/functional/test_aarch64_aspeed_ast2700fc.py 
b/tests/functional/test_aarch64_aspeed_ast2700fc.py
index b85370e182..b52ced345f 100755
--- a/tests/functional/test_aarch64_aspeed_ast2700fc.py
+++ b/tests/functional/test_aarch64_aspeed_ast2700fc.py
@@ -49,6 +49,11 @@ def do_ast2700_i2c_test(self):
         exec_command_and_wait_for_pattern(self,
             'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', 
'18000')
 
+    def do_ast2700_pcie_test(self):
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 0002:00:00.0',
+            '0002:00:00.0 Host bridge: ASPEED Technology, Inc. AST1150 
PCI-to-PCI Bridge')
+
     def do_ast2700fc_ssp_test(self):
         self.vm.shutdown()
         self.vm.set_console(console_index=1)
@@ -128,6 +133,7 @@ def test_aarch64_ast2700fc_sdk_v09_06(self):
         self.start_ast2700fc_test('ast2700-default')
         self.verify_openbmc_boot_and_login('ast2700-default')
         self.do_ast2700_i2c_test()
+        self.do_ast2700_pcie_test()
         self.do_ast2700fc_ssp_test()
         self.do_ast2700fc_tsp_test()
 
-- 
2.43.0


Reply via email to