blob: ea3ecd1166c5b450c69334923eed7b0994b6cefa [file] [log] [blame]
Simon Glassb255efc2022-04-24 23:31:24 -06001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Common header file for bootdev, bootflow, bootmeth tests
4 *
5 * Copyright 2021 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
7 */
8
9#ifndef __bootstd_common_h
10#define __bootstd_common_h
11
Simon Glass80253462022-10-11 09:47:13 -060012#include <version_string.h>
13
Simon Glassb255efc2022-04-24 23:31:24 -060014/* Declare a new bootdev test */
Simon Glassb15512c2025-01-20 14:25:32 -070015#define BOOTSTD_TEST(_name, _flags) UNIT_TEST(_name, _flags, bootstd)
Simon Glassb255efc2022-04-24 23:31:24 -060016
Simon Glass80253462022-10-11 09:47:13 -060017#define NVDATA_START_BLK ((0x400 + 0x400) / MMC_MAX_BLOCK_LEN)
18#define VERSION_START_BLK ((0x400 + 0x800) / MMC_MAX_BLOCK_LEN)
19#define TEST_VERSION "U-Boot v2022.04-local2"
20#define TEST_VERNUM 0x00010002
21
Simon Glasse4cf1062023-01-17 10:48:13 -070022enum {
Simon Glassdeffa692023-01-28 15:00:28 -070023 MAX_HUNTER = 9,
Simon Glasse4cf1062023-01-17 10:48:13 -070024 MMC_HUNTER = 3, /* ID of MMC hunter */
25};
26
Simon Glassb255efc2022-04-24 23:31:24 -060027struct unit_test_state;
28
29/**
30 * bootstd_test_drop_bootdev_order() - Remove the existing boot order
31 *
32 * Drop the boot order so that all bootdevs are used in their alias order
33 *
34 * @uts: Unit test state to use for ut_assert...() functions
35 */
36int bootstd_test_drop_bootdev_order(struct unit_test_state *uts);
37
Simon Glass80253462022-10-11 09:47:13 -060038/**
39 * bootstd_setup_for_tests() - Set up MMC data for VBE tests
40 *
41 * Some data is needed for VBE tests to work. This function sets that up.
42 *
43 * @return 0 if OK, -ve on error
44 */
45int bootstd_setup_for_tests(void);
46
Simon Glassde567b12023-01-17 10:48:09 -070047/**
48 * bootstd_test_check_mmc_hunter() - Check that the mmc bootdev hunter was used
49 *
50 * @uts: Unit test state to use for ut_assert...() functions
51 * Returns: 0 if OK (used), other value on error (not used)
52 */
53int bootstd_test_check_mmc_hunter(struct unit_test_state *uts);
54
Simon Glass22c93da2024-09-01 16:26:16 -060055/**
56 * bootstd_reset_usb() - Reset the USB subsystem
57 *
58 * Resets USB so that it can be started (and scanning) again. This is useful in
59 * tests which need to use USB.
60 */
61void bootstd_reset_usb(void);
62
Simon Glassb255efc2022-04-24 23:31:24 -060063#endif