xref: /illumos-gate/usr/src/test/os-tests/tests/imc/imc_test_badaddr.c (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
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 2019 Joyent, Inc.
14  */
15 
16 #include "imc_test.h"
17 
18 /*
19  * This file does a bunch of tests to make sure that we correctly handle cases
20  * where we're asked to decode the following types of addresses:
21  *
22  *   - Legacy Reserved Addresses
23  *   - Between TOLM, TOHM
24  *   - Above TOHM
25  */
26 
27 /*
28  * This IMC represents a basic case where we have a single 8 GiB dual rank DIMM.
29  * We have system memory in the lower 2 GiB and then the remaining 6 GiB starts
30  * at the bottom of high memory (4 GiB).
31  */
32 static const imc_t imc_badaddr = {
33 	.imc_gen = IMC_GEN_SANDY,
34 	.imc_nsockets = 1,
35 	.imc_sockets[0] = {
36 		.isock_valid = IMC_SOCKET_V_VALID,
37 		.isock_sad = {
38 			.isad_flags = 0,
39 			.isad_valid = IMC_SAD_V_VALID,
40 			.isad_tolm = 0x80000000,	/* 2 GiB */
41 			.isad_tohm = 0x280000000ULL,	/* 10 GiB */
42 			.isad_nrules = 10,
43 			.isad_rules[0] = {
44 				.isr_enable = B_TRUE,
45 				.isr_limit = 0x80000000,
46 				.isr_imode = IMC_SAD_IMODE_8t6,
47 				.isr_ntargets = IMC_MAX_SAD_INTERLEAVE,
48 				.isr_targets = { 0, 0, 0, 0, 0, 0, 0, 0 }
49 			},
50 			.isad_rules[1] = {
51 				.isr_enable = B_TRUE,
52 				.isr_limit = 0x280000000ULL,
53 				.isr_imode = IMC_SAD_IMODE_8t6,
54 				.isr_ntargets = IMC_MAX_SAD_INTERLEAVE,
55 				.isr_targets = { 0, 0, 0, 0, 0, 0, 0, 0 }
56 			}
57 		},
58 		.isock_ntad = 1,
59 		.isock_tad[0] = {
60 			.itad_flags = 0,
61 			.itad_nrules = 12,
62 			.itad_rules[0] = {
63 				.itr_base = 0x0,
64 				.itr_limit = 0x80000000,
65 				.itr_sock_way = 1,
66 				.itr_chan_way = 1,
67 				.itr_sock_gran = IMC_TAD_GRAN_64B,
68 				.itr_chan_gran = IMC_TAD_GRAN_64B,
69 				.itr_ntargets = 4,
70 				.itr_targets = { 0, 0, 0, 0 }
71 			},
72 			.itad_rules[1] = {
73 				.itr_base = 0x80000000,
74 				.itr_limit = 0x280000000ULL,
75 				.itr_sock_way = 1,
76 				.itr_chan_way = 1,
77 				.itr_sock_gran = IMC_TAD_GRAN_64B,
78 				.itr_chan_gran = IMC_TAD_GRAN_64B,
79 				.itr_ntargets = 4,
80 				.itr_targets = { 0, 0, 0, 0 }
81 			}
82 		},
83 		.isock_nimc = 1,
84 		.isock_imcs[0] = {
85 			.icn_nchannels = 1,
86 			.icn_dimm_type = IMC_DIMM_DDR3,
87 			.icn_ecc = B_TRUE,
88 			.icn_lockstep = B_FALSE,
89 			.icn_closed = B_FALSE,
90 			.icn_channels[0] = {
91 				.ich_ndimms = 1,
92 				.ich_dimms[0] = {
93 					.idimm_present = B_TRUE,
94 					.idimm_nbanks = 3,
95 					.idimm_width = 8,
96 					.idimm_density = 2,
97 					.idimm_nranks = 2,
98 					.idimm_nrows = 14,
99 					.idimm_ncolumns = 10,
100 					.idimm_size = 0x80000000
101 				},
102 				.ich_ntad_offsets = 12,
103 				.ich_tad_offsets = { 0, 0x80000000, 0, 0, 0, 0,
104 				    0, 0, 0, 0, 0 },
105 				.ich_nrankileaves = 8,
106 				.ich_rankileaves[0] = {
107 					.irle_enabled = B_TRUE,
108 					.irle_nways = 2,
109 					.irle_nwaysbits = 1,
110 					.irle_limit = 0x200000000ULL,
111 					.irle_nentries = 5,
112 					.irle_entries[0] = { 0x0, 0x0 },
113 					.irle_entries[1] = { 0x1, 0x0 }
114 				}
115 			}
116 		}
117 	}
118 };
119 
120 const imc_test_case_t imc_test_badaddr[] = { {
121 	.itc_desc = "Bad Address, legacy VGA (1)",
122 	.itc_imc = &imc_badaddr,
123 	.itc_pa = 0xa0000,
124 	.itc_pass = B_FALSE,
125 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
126 }, {
127 	.itc_desc = "Bad Address, legacy VGA (2)",
128 	.itc_imc = &imc_badaddr,
129 	.itc_pa = 0xbffff,
130 	.itc_pass = B_FALSE,
131 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
132 }, {
133 	.itc_desc = "Bad Address, legacy VGA (3)",
134 	.itc_imc = &imc_badaddr,
135 	.itc_pa = 0xafc89,
136 	.itc_pass = B_FALSE,
137 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
138 }, {
139 	.itc_desc = "Bad Address, legacy PAM (1)",
140 	.itc_imc = &imc_badaddr,
141 	.itc_pa = 0xc0000,
142 	.itc_pass = B_FALSE,
143 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
144 }, {
145 	.itc_desc = "Bad Address, legacy PAM (2)",
146 	.itc_imc = &imc_badaddr,
147 	.itc_pa = 0xfffff,
148 	.itc_pass = B_FALSE,
149 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
150 }, {
151 	.itc_desc = "Bad Address, Reserved (1)",
152 	.itc_imc = &imc_badaddr,
153 	.itc_pa = 0xffffff,
154 	.itc_pass = B_FALSE,
155 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
156 },  {
157 	.itc_desc = "Bad Address, Reserved (1)",
158 	.itc_imc = &imc_badaddr,
159 	.itc_pa = 0xffffff,
160 	.itc_pass = B_FALSE,
161 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
162 }, {
163 	.itc_desc = "Bad Address, System (1)",
164 	.itc_imc = &imc_badaddr,
165 	.itc_pa = 0x00fe000000,
166 	.itc_pass = B_FALSE,
167 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
168 }, {
169 	.itc_desc = "Bad Address, System (2)",
170 	.itc_imc = &imc_badaddr,
171 	.itc_pa = 0x00fe123446,
172 	.itc_pass = B_FALSE,
173 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
174 }, {
175 	.itc_desc = "Bad Address, System (3)",
176 	.itc_imc = &imc_badaddr,
177 	.itc_pa = 0x00ff000000,
178 	.itc_pass = B_FALSE,
179 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
180 }, {
181 	.itc_desc = "Bad Address, System (4)",
182 	.itc_imc = &imc_badaddr,
183 	.itc_pa = 0x00ffffffff,
184 	.itc_pass = B_FALSE,
185 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
186 }, {
187 	.itc_desc = "Bad Address, System (5)",
188 	.itc_imc = &imc_badaddr,
189 	.itc_pa = 0x00ff5abc32,
190 	.itc_pass = B_FALSE,
191 	.itc_fail = IMC_DECODE_F_LEGACY_RANGE
192 }, {
193 	.itc_desc = "Outside TOLM (1)",
194 	.itc_imc = &imc_badaddr,
195 	.itc_pa = 0x80000000,
196 	.itc_pass = B_FALSE,
197 	.itc_fail = IMC_DECODE_F_OUTSIDE_DRAM
198 }, {
199 	.itc_desc = "Outside TOLM (2)",
200 	.itc_imc = &imc_badaddr,
201 	.itc_pa = 0xF0000000,
202 	.itc_pass = B_FALSE,
203 	.itc_fail = IMC_DECODE_F_OUTSIDE_DRAM
204 }, {
205 	.itc_desc = "Outside TOLM (3)",
206 	.itc_imc = &imc_badaddr,
207 	.itc_pa = 0xfdffffffULL,
208 	.itc_pass = B_FALSE,
209 	.itc_fail = IMC_DECODE_F_OUTSIDE_DRAM
210 }, {
211 	.itc_desc = "Outside TOHM (1)",
212 	.itc_imc = &imc_badaddr,
213 	.itc_pa = 0x280000000ULL,
214 	.itc_pass = B_FALSE,
215 	.itc_fail = IMC_DECODE_F_OUTSIDE_DRAM
216 }, {
217 	.itc_desc = "Outside TOHM (2)",
218 	.itc_imc = &imc_badaddr,
219 	.itc_pa = UINT64_MAX,
220 	.itc_pass = B_FALSE,
221 	.itc_fail = IMC_DECODE_F_OUTSIDE_DRAM
222 }, {
223 	.itc_desc = "Outside TOHM (1)",
224 	.itc_imc = &imc_badaddr,
225 	.itc_pa = 0x1280000000ULL,
226 	.itc_pass = B_FALSE,
227 	.itc_fail = IMC_DECODE_F_OUTSIDE_DRAM
228 }, {
229 	.itc_desc = NULL
230 } };
231