aboutsummaryrefslogtreecommitdiff
path: root/test/boot/bootstd_common.h
blob: 4a126e43ff44e412465423a58ce687628d5409fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Common header file for bootdev, bootflow, bootmeth tests
 *
 * Copyright 2021 Google LLC
 * Written by Simon Glass <sjg@chromium.org>
 */

#ifndef __bootstd_common_h
#define __bootstd_common_h

#include <version_string.h>

/* Declare a new bootdev test */
#define BOOTSTD_TEST(_name, _flags) \
		UNIT_TEST(_name, _flags, bootstd_test)

#define NVDATA_START_BLK	((0x400 + 0x400) / MMC_MAX_BLOCK_LEN)
#define VERSION_START_BLK	((0x400 + 0x800) / MMC_MAX_BLOCK_LEN)
#define TEST_VERSION		"U-Boot v2022.04-local2"
#define TEST_VERNUM		0x00010002

enum {
	MAX_HUNTER	= 9,
	MMC_HUNTER	= 3,	/* ID of MMC hunter */
};

struct unit_test_state;

/**
 * bootstd_test_drop_bootdev_order() - Remove the existing boot order
 *
 * Drop the boot order so that all bootdevs are used in their alias order
 *
 * @uts: Unit test state to use for ut_assert...() functions
 */
int bootstd_test_drop_bootdev_order(struct unit_test_state *uts);

/**
 * bootstd_setup_for_tests() - Set up MMC data for VBE tests
 *
 * Some data is needed for VBE tests to work. This function sets that up.
 *
 * @return 0 if OK, -ve on error
 */
int bootstd_setup_for_tests(void);

/**
 * bootstd_test_check_mmc_hunter() - Check that the mmc bootdev hunter was used
 *
 * @uts: Unit test state to use for ut_assert...() functions
 * Returns: 0 if OK (used), other value on error (not used)
 */
int bootstd_test_check_mmc_hunter(struct unit_test_state *uts);

#endif