From c0e33314dc27014940fe7a91ef1be677f7f0d795 Mon Sep 17 00:00:00 2001 From: sapthagiri padmanabhan Date: Mon, 16 Feb 2026 08:02:33 +0000 Subject: [PATCH] fix: skip devices with unclassfied class code Skip the pcie testcases for devices with unclassified class code Signed-off-by: sapthagiri padmanabhan Change-Id: I6bb22660b61014c14614c0d3ff99518148273cce --- apps/linux/bsa-acs-app/bsa_app_main.c | 26 +++++++++++++++++++++-- apps/linux/sbsa-acs-app/sbsa_app_main.c | 28 ++++++++++++++++++++++--- apps/uefi/bsa_main.c | 2 +- apps/uefi/mem_test_main.c | 2 +- apps/uefi/sbsa_main.c | 2 +- apps/uefi/vbsa_main.c | 4 ++-- apps/uefi/xbsa_main.c | 4 ++-- test_pool/pcie/p004.c | 5 +++-- test_pool/pcie/p005.c | 5 +++-- test_pool/pcie/p030.c | 6 ++++-- test_pool/pcie/p035.c | 5 +++-- test_pool/pcie/p045.c | 3 ++- test_pool/pcie/p058.c | 6 ++++-- test_pool/pcie/p063.c | 5 +++-- test_pool/pcie/p094.c | 3 ++- test_pool/pcie/p097.c | 6 ++++-- val/include/acs_pcie_spec.h | 1 + 17 files changed, 85 insertions(+), 28 deletions(-) diff --git a/apps/linux/bsa-acs-app/bsa_app_main.c b/apps/linux/bsa-acs-app/bsa_app_main.c index 57f22264..286aee79 100644 --- a/apps/linux/bsa-acs-app/bsa_app_main.c +++ b/apps/linux/bsa-acs-app/bsa_app_main.c @@ -53,12 +53,34 @@ static RULE_ID_e g_skip_rule_buf[BSA_RULE_ID_LIST_MAX]; unsigned int g_skip_rule_count = 0; /* Helpers for rule parsing */ +static int sizeof_char_ptr(const char *tok) +{ + int i = 0; + + if (tok) + { + while (tok[i] != '\0') + i++; + } + return i; + +} + static int rule_id_from_string(const char *tok) { unsigned int rid; + int cmp_len; + if (!tok || !*tok) return -1; for (rid = 0; rid < RULE_ID_SENTINEL; rid++) { - if (rule_id_string[rid] && strcmp((const char *)rule_id_string[rid], tok) == 0) + if (!rule_id_string[rid]) + continue; + + cmp_len = sizeof_char_ptr(rule_id_string[rid]); + if (cmp_len < sizeof_char_ptr(tok)) + cmp_len = sizeof_char_ptr(tok); + + if (strncmp((const char *)rule_id_string[rid], tok, cmp_len) == 0) return (int)rid; } return -1; @@ -100,7 +122,7 @@ void print_help(){ "-r Comma-separated rule IDs to run (overwrites default rule list) [no spaces]\n" "--fr Run future requirement tests (FR); use without -l\n" "--skip Rules to skip as comma-separated RULE IDs. [no spaces]\n" - "--skip-dp-nic-ms Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + "--skip-dp-nic-ms Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" ); } diff --git a/apps/linux/sbsa-acs-app/sbsa_app_main.c b/apps/linux/sbsa-acs-app/sbsa_app_main.c index de064ba5..855e8820 100644 --- a/apps/linux/sbsa-acs-app/sbsa_app_main.c +++ b/apps/linux/sbsa-acs-app/sbsa_app_main.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2016-2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2016-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -53,12 +53,34 @@ static RULE_ID_e g_skip_rule_buf[RULE_ID_LIST_MAX]; unsigned int g_skip_rule_count = 0; /* Helpers for rule parsing */ +static int sizeof_char_ptr(const char *tok) +{ + int i = 0; + + if (tok) + { + while (tok[i] != '\0') + i++; + } + return i; + +} + static int rule_id_from_string(const char *tok) { unsigned int rid; + int cmp_len; + if (!tok || !*tok) return -1; for (rid = 0; rid < RULE_ID_SENTINEL; rid++) { - if (rule_id_string[rid] && strcmp((const char *)rule_id_string[rid], tok) == 0) + if (!rule_id_string[rid]) + continue; + + cmp_len = sizeof_char_ptr(rule_id_string[rid]); + if (cmp_len < sizeof_char_ptr(tok)) + cmp_len = sizeof_char_ptr(tok); + + if (strncmp((const char *)rule_id_string[rid], tok, cmp_len) == 0) return (int)rid; } return -1; @@ -99,7 +121,7 @@ void print_help(){ "-r Comma-separated rule IDs to run (overwrites default rule list) [no spaces]\n" "--fr Run future requirement tests (FR); use without -l\n" "--skip Rules to skip as comma-separated RULE IDs (e.g. B_PE_01,B_PE_02) [no spaces]\n" - "--skip-dp-nic-ms Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + "--skip-dp-nic-ms Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" ); } diff --git a/apps/uefi/bsa_main.c b/apps/uefi/bsa_main.c index 077581f5..89fc4416 100644 --- a/apps/uefi/bsa_main.c +++ b/apps/uefi/bsa_main.c @@ -97,7 +97,7 @@ HelpMsg (VOID) "-skip Rule ID(s) to be skipped (comma-separated, like -r)\n" " Example: -skip B_PE_01,B_GIC_02\n" "-skip-dp-nic-ms \n" - " Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + " Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" "-skipmodule \n" " Skip the specified modules (comma-separated names).\n" " Example: -skipmodule PE,GIC,PCIE\n" diff --git a/apps/uefi/mem_test_main.c b/apps/uefi/mem_test_main.c index 77d21a7f..7297218a 100644 --- a/apps/uefi/mem_test_main.c +++ b/apps/uefi/mem_test_main.c @@ -108,7 +108,7 @@ HelpMsg ( "-dtb Enable the execution of dtb dump\n" "-sbsa Enable sbsa requirements for bsa binary\n" "-el1physkip Skips EL1 register checks\n" - "-skip-dp-nic-ms Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + "-skip-dp-nic-ms Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" ); } diff --git a/apps/uefi/sbsa_main.c b/apps/uefi/sbsa_main.c index 90f88114..ec8084a5 100644 --- a/apps/uefi/sbsa_main.c +++ b/apps/uefi/sbsa_main.c @@ -88,7 +88,7 @@ HelpMsg (VOID) "-skip Rule ID(s) to be skipped (comma-separated, like -r)\n" " Example: -skip B_PE_01,B_GIC_02\n" "-skip-dp-nic-ms \n" - " Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + " Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" "-skipmodule \n" " Skip the specified modules (comma-separated names).\n" " Example: -skipmodule PE,GIC,PCIE\n" diff --git a/apps/uefi/vbsa_main.c b/apps/uefi/vbsa_main.c index 1602f095..409233e2 100644 --- a/apps/uefi/vbsa_main.c +++ b/apps/uefi/vbsa_main.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2025-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -87,7 +87,7 @@ HelpMsg (VOID) "-skip Rule ID(s) to be skipped (comma-separated, like -r)\n" " Example: -skip B_PE_01,B_GIC_02\n" "-skip-dp-nic-ms \n" - " Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + " Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" "-timeout \n" " Set timeout multiple for wakeup tests\n" " 1 - min value 5 - max value, Defaults to 1 \n" diff --git a/apps/uefi/xbsa_main.c b/apps/uefi/xbsa_main.c index cd9368b5..8ea87472 100644 --- a/apps/uefi/xbsa_main.c +++ b/apps/uefi/xbsa_main.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2025-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -117,7 +117,7 @@ HelpMsg (VOID) "-skip Rule ID(s) to be skipped (comma-separated, like -r)\n" " Example: -skip B_PE_01,B_GIC_02\n" "-skip-dp-nic-ms \n" - " Skip PCIe tests for DisplayPort, Network, and Mass Storage devices\n" + " Skip PCIe tests for DisplayPort, Network, Mass Storage devices and Unclassified devices\n" "-skipmodule \n" " Skip the specified modules (comma-separated names).\n" " Example: -skipmodule PE,GIC,PCIE\n" diff --git a/test_pool/pcie/p004.c b/test_pool/pcie/p004.c index c05ce45e..e50889a9 100644 --- a/test_pool/pcie/p004.c +++ b/test_pool/pcie/p004.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2016-2018, 2021-2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2016-2018, 2021-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -78,7 +78,8 @@ check_bdf_under_rp(uint32_t rp_bdf) val_print(ACS_PRINT_DEBUG, "\n Class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) return 1; } } diff --git a/test_pool/pcie/p005.c b/test_pool/pcie/p005.c index 629b6b47..48059fc5 100644 --- a/test_pool/pcie/p005.c +++ b/test_pool/pcie/p005.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2020, 2022-2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2020, 2022-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -78,7 +78,8 @@ check_bdf_under_rp(uint32_t rp_bdf) val_print(ACS_PRINT_DEBUG, "\n Class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) return 1; } } diff --git a/test_pool/pcie/p030.c b/test_pool/pcie/p030.c index 29909536..5244a88f 100644 --- a/test_pool/pcie/p030.c +++ b/test_pool/pcie/p030.c @@ -80,7 +80,8 @@ get_dsf_bdf(uint32_t rp_bdf, uint32_t *target_bdf) val_print(ACS_PRINT_DEBUG, "\n Downstream class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping downstream BDF 0x%x", dev_bdf); continue; } @@ -161,7 +162,8 @@ payload(void) val_print(ACS_PRINT_DEBUG, "\n Class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping for BDF 0x%x", bdf); continue; } diff --git a/test_pool/pcie/p035.c b/test_pool/pcie/p035.c index 60c4b303..86c949d9 100644 --- a/test_pool/pcie/p035.c +++ b/test_pool/pcie/p035.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -95,7 +95,8 @@ payload(void) val_pcie_read_cfg(bdf, TYPE01_RIDR, ®_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == MAS_CC) || (base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC))) + ((base_cc == UNCLAS_CC) || (base_cc == MAS_CC) + || (base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping for BDF - 0x%x ", bdf); val_print(ACS_PRINT_DEBUG, " Classcode is : 0x%x ", base_cc); diff --git a/test_pool/pcie/p045.c b/test_pool/pcie/p045.c index 0f4ffbd7..31fad2e8 100644 --- a/test_pool/pcie/p045.c +++ b/test_pool/pcie/p045.c @@ -141,7 +141,8 @@ payload(void) val_print(ACS_PRINT_DEBUG, "\n Class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping BDF as 0x%x", bdf); tbl_index++; goto next_bdf; diff --git a/test_pool/pcie/p058.c b/test_pool/pcie/p058.c index eb7e4d64..40746795 100644 --- a/test_pool/pcie/p058.c +++ b/test_pool/pcie/p058.c @@ -93,7 +93,8 @@ get_dsf_bdf(uint32_t rp_bdf, uint32_t *target_bdf) val_print(ACS_PRINT_DEBUG, "\n Downstream class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping downstream BDF 0x%x", dev_bdf); continue; } @@ -200,7 +201,8 @@ payload(void *arg) val_print(ACS_PRINT_DEBUG, "\n Class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping for BDF 0x%x", bdf); continue; } diff --git a/test_pool/pcie/p063.c b/test_pool/pcie/p063.c index 56a04dbe..0fcf844d 100644 --- a/test_pool/pcie/p063.c +++ b/test_pool/pcie/p063.c @@ -1,5 +1,5 @@ /** @file - * Copyright (c) 2019-2025, Arm Limited or its affiliates. All rights reserved. + * Copyright (c) 2019-2026, Arm Limited or its affiliates. All rights reserved. * SPDX-License-Identifier : Apache-2.0 * Licensed under the Apache License, Version 2.0 (the "License"); @@ -96,7 +96,8 @@ payload(void) val_pcie_read_cfg(bdf, TYPE01_RIDR, ®_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == MAS_CC) || (base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC))) + ((base_cc == UNCLAS_CC) || (base_cc == MAS_CC) + || (base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping for BDF - 0x%x ", bdf); val_print(ACS_PRINT_DEBUG, " Classcode is : 0x%x ", base_cc); diff --git a/test_pool/pcie/p094.c b/test_pool/pcie/p094.c index bebb21e0..17dca359 100644 --- a/test_pool/pcie/p094.c +++ b/test_pool/pcie/p094.c @@ -142,7 +142,8 @@ payload(void) val_print(ACS_PRINT_DEBUG, "\n Class code is 0x%x", reg_value); base_cc = reg_value >> TYPE01_BCC_SHIFT; if (g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) { val_print(ACS_PRINT_DEBUG, "\n Skipping BDF as 0x%x", bdf); tbl_index++; goto next_bdf; diff --git a/test_pool/pcie/p097.c b/test_pool/pcie/p097.c index 28da9372..e5b9cc62 100644 --- a/test_pool/pcie/p097.c +++ b/test_pool/pcie/p097.c @@ -148,7 +148,8 @@ payload (void) * with base class codes greater than 13h as they * are reserved */ if ((g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) || (base_cc > RES_CC)) { tbl_index++; @@ -193,7 +194,8 @@ payload (void) * with base class codes greater than 13h as they * are reserved */ if ((g_pcie_skip_dp_nic_ms && - ((base_cc == CNTRL_CC) || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) + ((base_cc == UNCLAS_CC) || (base_cc == CNTRL_CC) + || (base_cc == DP_CNTRL_CC) || (base_cc == MAS_CC))) || (base_cc > RES_CC)) { val_print(ACS_PRINT_DEBUG, "\n Skipping DP/NIC/MAS/RES device.", 0); diff --git a/val/include/acs_pcie_spec.h b/val/include/acs_pcie_spec.h index ae231ba3..52413f18 100644 --- a/val/include/acs_pcie_spec.h +++ b/val/include/acs_pcie_spec.h @@ -48,6 +48,7 @@ #define TYPE0_HEADER 0 #define TYPE1_HEADER 1 +#define UNCLAS_CC 0x0 #define MAS_CC 0x1 #define CNTRL_CC 0x2 #define DP_CNTRL_CC 0x3