Skip to content

Commit 1fe841b

Browse files
Sujana-Mchetan-rathore
authored andcommitted
fix(pcie): align S_PCIe_02 with PCIe-wide P&NP BAR access check
- Update test `p086` and rule metadata description from "RootPort P&NP Memory Access" to "PCIe P&NP Memory Access". - Also remove the Root Port-only header type filtering in the check so the test now evaluates for RP and its downstream devices, that expose an MMIO BAR (instead of skipping Type0 functions). - Improve exception trace print formatting - Add debug logs for BAR base and initial BAR data - Fixes #347 Signed-off-by: Sujana M <sujana.murali@arm.com> Change-Id: Icc366c301a61354db7e5d30c225a5b874f9384bb
1 parent a44fadb commit 1fe841b

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

test_pool/pcie/p086.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "acs_pcie.h"
2222

2323
#define TEST_NUM (ACS_PCIE_TEST_NUM_BASE + 86)
24-
#define TEST_DESC "Check RootPort P&NP Memory Access "
24+
#define TEST_DESC "Check PCIe P&NP Memory Access "
2525
#define TEST_RULE "S_PCIe_02"
2626

2727
static void *branch_to_test;
@@ -41,7 +41,7 @@ esr(uint64_t interrupt_type, void *context)
4141
/* Update the ELR to return to test specified address */
4242
val_pe_update_elr(context, (uint64_t)branch_to_test);
4343

44-
val_print(TRACE, "\n Received exception of type in test 861: %d", interrupt_type);
44+
val_print(TRACE, "\n Received exception of type: %d in test 861", interrupt_type);
4545
val_set_status(pe_index, RESULT_FAIL(01));
4646
}
4747

@@ -100,6 +100,7 @@ void
100100
payload(void)
101101
{
102102
uint32_t pe_index;
103+
uint32_t rp_bdf;
103104
uint32_t bar_data;
104105
uint32_t test_fails;
105106
uint32_t test_skip = 1;
@@ -131,15 +132,16 @@ payload(void)
131132
bdf = bdf_tbl_ptr->device[tbl_index++].bdf;
132133

133134
val_print(DEBUG, "\n BDF - 0x%x", bdf);
135+
134136
/*
135-
* For Function with Type 1 config space header, obtain
136-
* base address of the its own BAR address.
137+
* Restrict test scope to Root Ports and devices downstream of a Root Port.
138+
* This excludes RCiEP/RCEC and any function not mapped under a RP hierarchy.
137139
*/
138-
if (val_pcie_function_header_type(bdf) == TYPE0_HEADER) {
139-
val_print(DEBUG, "\n Skipping not a RP, BDF - 0x%x", bdf);
140-
continue;
140+
if (val_pcie_get_rootport(bdf, &rp_bdf)) {
141+
val_print(DEBUG, "\n Skipping as BDF 0x%x is not RP/downstream of RP", bdf);
142+
continue;
141143
}
142-
144+
143145
val_pcie_get_mmio_bar(bdf, &bar_base);
144146
/* Skip this function if it doesn't have mmio BAR */
145147
if (!bar_base) {
@@ -152,6 +154,8 @@ payload(void)
152154

153155
bar_data = val_mmio_read(bar_base);
154156

157+
val_print(DEBUG, "\n Bar base is - 0x%llx", bar_base);
158+
val_print(DEBUG, "\n Initial bar data is - 0x%llx", bar_data);
155159
if (test_sequence_1B((uint8_t *)bar_base)) {
156160
val_print(ERROR, "\n Failed check for Bdf 0x%x", bdf);
157161
test_fails++;

val/src/rule_metadata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ rule_test_map_t rule_test_map[RULE_ID_SENTINEL] = {
21872187
[S_PCIe_02] = {
21882188
.test_entry_id = P086_ENTRY,
21892189
.module_id = PCIE,
2190-
.rule_desc = "Check RootPort P&NP Memory Access",
2190+
.rule_desc = "Check PCIe P&NP Memory Access",
21912191
.platform_bitmask = PLATFORM_BAREMETAL | PLATFORM_UEFI,
21922192
.flag = BASE_RULE,
21932193
.test_num = ACS_PCIE_TEST_NUM_BASE + 86,

0 commit comments

Comments
 (0)