aboutsummaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2018-10-15 02:21:22 -0700
committerSimon Glass <sjg@chromium.org>2018-11-14 09:16:28 -0800
commit7a20614eb292c48b4a42c3b5314b26d975aa84b4 (patch)
treeb4640aef36e084ce1749e3ec72a0ce34c301d3bc /test/dm
parenta8c5f8d3d02807f72d048950d72b0c73d55bd7fb (diff)
downloadu-boot-7a20614eb292c48b4a42c3b5314b26d975aa84b4.zip
u-boot-7a20614eb292c48b4a42c3b5314b26d975aa84b4.tar.gz
u-boot-7a20614eb292c48b4a42c3b5314b26d975aa84b4.tar.bz2
test: dm: pci: Add cases for finding next PCI capability APIs
Add test cases to cover the two newly added PCI APIs: dm_pci_find_next_capability() & dm_pci_find_next_ext_capability(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/pci.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dm/pci.c b/test/dm/pci.c
index a1dedd8..a1febd5 100644
--- a/test/dm/pci.c
+++ b/test/dm/pci.c
@@ -211,6 +211,16 @@ static int dm_test_pci_cap(struct unit_test_state *uts)
cap = dm_pci_find_capability(swap, PCI_CAP_ID_PCIX);
ut_asserteq(0, cap);
+ /* look up PCI_CAP_ID_MSIX starting from PCI_CAP_ID_PM_OFFSET */
+ cap = dm_pci_find_next_capability(swap, PCI_CAP_ID_PM_OFFSET,
+ PCI_CAP_ID_MSIX);
+ ut_asserteq(PCI_CAP_ID_MSIX_OFFSET, cap);
+
+ /* look up PCI_CAP_ID_VNDR starting from PCI_CAP_ID_EXP_OFFSET */
+ cap = dm_pci_find_next_capability(swap, PCI_CAP_ID_EXP_OFFSET,
+ PCI_CAP_ID_VNDR);
+ ut_asserteq(0, cap);
+
ut_assertok(uclass_get_device_by_seq(UCLASS_PCI, 1, &bus));
ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &swap));
@@ -222,6 +232,16 @@ static int dm_test_pci_cap(struct unit_test_state *uts)
cap = dm_pci_find_ext_capability(swap, PCI_EXT_CAP_ID_SRIOV);
ut_asserteq(0, cap);
+ /* look up PCI_EXT_CAP_ID_DSN starting from PCI_EXT_CAP_ID_ERR_OFFSET */
+ cap = dm_pci_find_next_ext_capability(swap, PCI_EXT_CAP_ID_ERR_OFFSET,
+ PCI_EXT_CAP_ID_DSN);
+ ut_asserteq(PCI_EXT_CAP_ID_DSN_OFFSET, cap);
+
+ /* look up PCI_EXT_CAP_ID_RCRB starting from PCI_EXT_CAP_ID_VC_OFFSET */
+ cap = dm_pci_find_next_ext_capability(swap, PCI_EXT_CAP_ID_VC_OFFSET,
+ PCI_EXT_CAP_ID_RCRB);
+ ut_asserteq(0, cap);
+
return 0;
}
DM_TEST(dm_test_pci_cap, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);