blob: 8b3ea4a6134a79e63b084392f2f04b78e993e796 [file] [log] [blame]
Stephen Carlsone5c05ae2023-03-10 11:07:15 -08001// 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
Stephen Carlsone5c05ae2023-03-10 11:07:15 -080010#include <console.h>
11#include <test/suites.h>
12#include <test/ut.h>
13
Simon Glassb15512c2025-01-20 14:25:32 -070014#define PCI_MPS_TEST(_name, _flags) UNIT_TEST(_name, _flags, pci_mps)
Stephen Carlsone5c05ae2023-03-10 11:07:15 -080015
16/* Test "pci_mps" command in safe "s" mode */
17static int test_pci_mps_safe(struct unit_test_state *uts)
18{
19 /* Enumerate PCI Express first */
20 ut_assertok(run_command("pci e", 0));
21 ut_assert_console_end();
22
23 /* Test pci_mps s */
24 ut_assertok(run_command("pci_mps s", 0));
25 ut_assert_nextline("Setting MPS of all devices to 256B");
26 ut_assert_console_end();
27
28 return 0;
29}
Simon Glass11fcfa32024-08-22 07:57:50 -060030PCI_MPS_TEST(test_pci_mps_safe, UTF_CONSOLE);