From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bin Meng Date: Sun, 23 Sep 2018 06:42:22 -0700 Subject: [U-Boot] [PATCH 24/27] test: dm: pci: Add cases for finding next PCI capability APIs In-Reply-To: <1537710145-1888-1-git-send-email-bmeng.cn@gmail.com> References: <1537710145-1888-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1537710145-1888-25-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- test/dm/pci.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/dm/pci.c b/test/dm/pci.c index 8699700..f645b8b 100644 --- a/test/dm/pci.c +++ b/test/dm/pci.c @@ -206,6 +206,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)); @@ -217,6 +227,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); -- 2.7.4