xref: /illumos-gate/usr/src/test/os-tests/tests/zen_umc/zen_umc_test.h (revision a4955f4fa65e38d70c07d38e657a9aff43fa155f)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2022 Oxide Computer Company
14  */
15 
16 #ifndef _ZEN_UMC_TEST_H
17 #define	_ZEN_UMC_TEST_H
18 
19 /*
20  * Common definitions for testing the pieces of zen_umc(4D).
21  */
22 
23 #include "zen_umc.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /*
30  * Fabric ID Composition / Decomposition tests
31  */
32 typedef struct umc_fabric_test {
33 	const char			*uft_desc;
34 	const df_fabric_decomp_t	*uft_decomp;
35 	/*
36 	 * If uft_compose is true, we will take the socket/die/comp and try to
37 	 * create a fabric id from it (and then round trip through it again). If
38 	 * it is false, we will start with the fabric id, decompose, and then
39 	 * round trip back.
40 	 */
41 	boolean_t			uft_compose;
42 	/*
43 	 * If uft_valid is not set, we expect that either the fabric id or the
44 	 * sock/die/comp is invalid based on uft_compose. This will only perform
45 	 * the initial validity checks instead.
46 	 */
47 	boolean_t			uft_valid;
48 	uint32_t			uft_fabric_id;
49 	uint32_t			uft_sock_id;
50 	uint32_t			uft_die_id;
51 	uint32_t			uft_comp_id;
52 } umc_fabric_test_t;
53 
54 /*
55  * Test cases for actual decoding!
56  */
57 typedef struct umc_decode_test {
58 	const char			*udt_desc;
59 	const zen_umc_t			*udt_umc;
60 	uint64_t			udt_pa;
61 	boolean_t			udt_pass;
62 	/*
63 	 * When udt_pass is set to B_FALSE, then the following member will be
64 	 * checked to ensure that we got the right thing. Otherwise it'll be
65 	 * skipped.
66 	 */
67 	zen_umc_decode_failure_t	udt_fail;
68 	/*
69 	 * When udt_pass is set to true, the following will all be checked. If
70 	 * you wish to skip one, set it to its corresponding UINTXX_MAX.
71 	 */
72 	uint64_t			udt_norm_addr;
73 	uint8_t				udt_sock;
74 	uint8_t				udt_die;
75 	uint8_t				udt_comp;
76 	uint32_t			udt_dimm_no;
77 	uint32_t			udt_dimm_col;
78 	uint32_t			udt_dimm_row;
79 	uint8_t				udt_dimm_bank;
80 	uint8_t				udt_dimm_bank_group;
81 	uint8_t				udt_dimm_subchan;
82 	uint8_t				udt_dimm_rm;
83 	uint8_t				udt_dimm_cs;
84 } umc_decode_test_t;
85 
86 extern const umc_fabric_test_t zen_umc_test_fabric_ids[];
87 
88 extern const umc_decode_test_t zen_umc_test_basics[];
89 extern const umc_decode_test_t zen_umc_test_chans[];
90 extern const umc_decode_test_t zen_umc_test_cod[];
91 extern const umc_decode_test_t zen_umc_test_errors[];
92 extern const umc_decode_test_t zen_umc_test_hole[];
93 extern const umc_decode_test_t zen_umc_test_ilv[];
94 extern const umc_decode_test_t zen_umc_test_multi[];
95 extern const umc_decode_test_t zen_umc_test_nps[];
96 extern const umc_decode_test_t zen_umc_test_remap[];
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* _ZEN_UMC_TEST_H */
103