1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Tests that the PCI Maximum Payload Size (MPS) command can set the sandbox 4 * PCI Express device to safe mode and determine the correct payload size. 5 * 6 * Copyright 2023 Microsoft 7 * Written by Stephen Carlson <stcarlso@linux.microsoft.com> 8 */ 9 10#include <common.h> 11#include <console.h> 12#include <test/suites.h> 13#include <test/ut.h> 14 15#define PCI_MPS_TEST(_name, _flags) UNIT_TEST(_name, _flags, pci_mps_test) 16 17/* Test "pci_mps" command in safe "s" mode */ 18static int test_pci_mps_safe(struct unit_test_state *uts) 19{ 20 /* Enumerate PCI Express first */ 21 ut_assertok(run_command("pci e", 0)); 22 ut_assert_console_end(); 23 24 /* Test pci_mps s */ 25 ut_assertok(run_command("pci_mps s", 0)); 26 ut_assert_nextline("Setting MPS of all devices to 256B"); 27 ut_assert_console_end(); 28 29 return 0; 30} 31 32PCI_MPS_TEST(test_pci_mps_safe, UT_TESTF_CONSOLE_REC); 33 34int do_ut_pci_mps(struct cmd_tbl *cmdtp, int flag, int argc, 35 char * const argv[]) 36{ 37 struct unit_test *tests = UNIT_TEST_SUITE_START(pci_mps_test); 38 const int n = UNIT_TEST_SUITE_COUNT(pci_mps_test); 39 40 return cmd_ut_category("cmd_pci_mps", "pci_mps_test_", tests, n, 41 argc, argv); 42} 43