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