blob: 5fc890112b4e61f40a37858357f94957eeb20ca7 [file] [log] [blame]
AKASHI Takahiro80bc2762019-01-21 12:13:01 +09001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * This file's test data is derived from UEFI SCT.
4 * The original copyright is attached below.
5 */
6
7/*
8 * Copyright 2006 - 2016 Unified EFI, Inc.<BR>
9 * Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
10 *
11 * This program and the accompanying materials
12 * are licensed and made available under the terms and conditions of the BSD
13 * License which accompanies this distribution. The full text of the license
14 * may be found at
15 * http://opensource.org/licenses/bsd-license.php
16 *
17 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 */
20
21#include <efi.h>
22
23#ifdef NOT_USED
24/*
25 * TODO: These macro's are not used as they appear only in
26 * "#ifdef NOT_USED" clauses. In the future, define them elsewhere.
27 */
28
29/* HII form */
30#define EFI_IFR_AND_OP 0x15
31#define EFI_IFR_END_OP 0x29
32#define EFI_IFR_BITWISE_AND_OP 0x35
33
34/* HII image */
35#define EFI_HII_IIBT_END 0x00
36#define EFI_HII_IIBT_IMAGE_1BIT 0x10
37#endif
38
39/* HII keyboard layout */
40#define EFI_NULL_MODIFIER 0x0000
41
Heinrich Schuchardt8eb52e12024-10-19 11:03:56 +020042static u8 packagelist1[] = {
AKASHI Takahiro80bc2762019-01-21 12:13:01 +090043 // EFI_HII_PACKAGE_LIST_HEADER, length = 20
44 // SimpleFont, Font, GUID, Form, String, Image, DevicePath,
45 // (74) (110) 20 (8) 78 (67) (8)
46 // KeyboardLayout, End
47 // 192 4
48
49 0x89, 0xcd, 0xab, 0x03, 0xf4, 0x03, 0x44, 0x70,
50 0x81, 0xde, 0x99, 0xb1, 0x81, 0x20, 0xf7, 0x68, //16: guid
51 0x3a, 0x01, 0x00, 0x00, // 4: total 314(0x13a)
52#ifdef NOT_USED /* TODO: simple font package not implemented yet */
53 //
54 // Simple Font Package 1, length = 74
55 //
56 0x4A, 0x00, 0x00,
57 EFI_HII_PACKAGE_SIMPLE_FONTS,
58 1, 0,
59 1, 0,
60 0x55, 0x0, 0x1,
61 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
62 0x77, 0x0, 0x2,
63 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
64 3, 4, 5,
65 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0,
66 //
67 // Font Package 1, length = 110
68 //
69 0x6e, 0x00, 0x00, // 3
70 EFI_HII_PACKAGE_FONTS, // 1
71 0x5c, 0x00, 0x00, 0x00, // 4: size of header
72 0x5c, 0x00, 0x00, 0x00, // 4: offset
73 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00,
74 0xf5, 0x00, 0xec, 0xec, //10+2(pads)
75 0xff, 0x33, 0xff, 0x44, // 4: font style
76 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, //64
84 //
85 // Glyph block 1, length = 18
86 //
87 EFI_HII_GIBT_GLYPH_DEFAULT, // 1
88 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x99,
89 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, //16: BitMapData
90 EFI_HII_GIBT_END, // 1
91#endif
92 //
93 // Guid Package 1, length = 20
94 //
95 0x14, 0x00, 0x00, // 3
96 EFI_HII_PACKAGE_TYPE_GUID, // 1
97 0x5a, 0xc9, 0x87, 0x03, 0x3, 0xd7, 0x46, 0x23,
98 0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8, //16: guid
99#ifdef NOT_USED /* TODO: form package not implemented yet */
100 //
101 // EFI_HII_PACKAGE_FORMS, length = 8
102 //
103 0x08, 0x00, 0x00, // 3
104 EFI_HII_PACKAGE_FORMS, // 1
105 //
106 // Opcode 1, length = 4
107 //
108 EFI_IFR_AND_OP,
109 0x82,
110 EFI_IFR_END_OP,
111 0x02,
112 //
113#endif
114 // EFI_HII_PACKAGE_STRINGS, length = 78
115 //
116 0x4e, 0x00, 0x00, // 3: length(header)
117 EFI_HII_PACKAGE_STRINGS, // 1: type(header)
118 0x3c, 0x00, 0x00, 0x00, // 4: header_size
119 0x3c, 0x00, 0x00, 0x00, // 4: string_offset
120 0x00, 0x00, 0x11, 0x22, 0x44, 0x55, 0x77, 0x89, //32: language_window
121 0x11, 0x00, 0x11, 0x22, 0x44, 0x55, 0x87, 0x89,
122 0x22, 0x00, 0x11, 0x22, 0x44, 0x55, 0x77, 0x89,
123 0x33, 0x00, 0x11, 0x22, 0x44, 0x55, 0x77, 0x89,
124 0x01, 0x00, // 2: language name
125 0x65, 0x6e, 0x2d, 0x55, 0x53, 0x3b, 0x7a, 0x68, //14: language
126 0x2d, 0x48, 0x61, 0x6e, 0x74, 0x00, // "en-US;zh-Hant"
127 EFI_HII_SIBT_STRING_UCS2, // 1
128 0x45, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x6C, 0x00,
129 0x69, 0x00, 0x73, 0x00, 0x68, 0x00, 0x00, 0x00, //16: "English"
130 EFI_HII_SIBT_END, // 1
131#ifdef NOT_USED /* TODO: image package not implemented yet */
132 //
133 // EFI_HII_PACKAGE_IMAGES, length = 67
134 //
135 0x43, 0x00, 0x00, // 3
136 EFI_HII_PACKAGE_IMAGES, // 1
137 0x0c, 0x00, 0x00, 0x00, // 4: image info offset
138 0x39, 0x00, 0x00, 0x00, // 4: palette info offset
139 EFI_HII_IIBT_IMAGE_1BIT, // 1
140 0x01,
141 0x0b, 0x00,
142 0x13, 0x00,
143 0x80, 0x00,
144 0xc0, 0x00,
145 0xe0, 0x00,
146 0xf0, 0x00,
147 0xf8, 0x00,
148 0xfc, 0x00,
149 0xfe, 0x00,
150 0xff, 0x00,
151 0xff, 0x80,
152 0xff, 0xc0,
153 0xff, 0xe0,
154 0xfe, 0x00,
155 0xef, 0x00,
156 0xcf, 0x00,
157 0x87, 0x80,
158 0x07, 0x80,
159 0x03, 0xc0,
160 0x03, 0xc0,
161 0x01, 0x80, //43
162 EFI_HII_IIBT_END, // 1
163 0x01, 0x00,
164 0x06, 0x00,
165 0x00, 0x00, 0x00,
166 0xFF, 0xFF, 0xFF, //10
167 //
168 // EFI_HII_PACKAGE_DEVICE_PATH, length = 8
169 //
170 0x08, 0x00, 0x00, // 3
171 EFI_HII_PACKAGE_DEVICE_PATH, // 1
172 0x01, 0x23, 0x45, 0x66, // 4: dummy device path protocol
173 // instance address
174#endif
175 //
176 // Keyboard layout package 1, length = 192
177 0xc0, 0x00, 0x00, // 3: length(header)
178 EFI_HII_PACKAGE_KEYBOARD_LAYOUT, // 1: type(header)
179 0x02, 0x00, // 2: LayoutCount
180 //
181 // Layout 1, length = 93
182 //
183 0x5d, 0x00, // 2: layout_length
184 0x95, 0xe4, 0x40, 0x8d, 0xaa, 0xe2, 0x6f, 0x4c,
185 0x89, 0x70, 0x68, 0x85, 0x09, 0xee, 0xc7, 0xd2, //16: guid
186 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor_
187 // string_offset
188 0x02, // 1: descriptor_count
189 //
190 // Descriptor 1, length = 16
191 //
192 49, 0x00, 0x00, 0x00, // 4: key (EfiKeyD1)
193 'q', 0x00, // 2: unicode
194 'Q', 0x00, // 2: shifted_unicode
195 0x00, 0x00, // 2: alt_gr_unicode
196 0x00, 0x00, // 2: shifted_alt_gr_unicode
197 EFI_NULL_MODIFIER, 0x00, // 2: modifier
198 0x03, 0x00, // 2: affected_attribute
199 //
200 // Descriptor 2, length = 16
201 //
202 50, 0x00, 0x00, 0x00, // 4: key (EfiKeyD2)
203 'w', 0x00, // 2: unicode
204 'W', 0x00, // 2: shifted_unicode
205 0x00, 0x00, // 2: alt_gr_unicode
206 0x00, 0x00, // 2: shifted_alt_gr_unicode
207 EFI_NULL_MODIFIER, 0x00, // 2: modifier
208 0x3, 0x0, // 2: affected_attribute
209 //
210 // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38
211 //
212 0x01, 0x00, // 2: DescriptionCount
213 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0,
214 //10: RFC3066 language code
215 ' ', 0x0, // 2: Space
216 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0,
217 '1', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0,
218 //24: DescriptionString
219 //
220 // Layout 2, length = 93
221 //
222 0x5d, 0x00, // 2: layout_length
223 0x3e, 0x0b, 0xe6, 0x2a, 0xd6, 0xb9, 0xd8, 0x49,
224 0x9a, 0x16, 0xc2, 0x48, 0xf1, 0xeb, 0xa8, 0xdb, //16: guid
225 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor_
226 // string_offset
227 0x02, // 1 Descriptor count
228 //
229 // Descriptor 1, length = 16
230 //
231 51, 0x0, 0x0, 0x0, // 4: key (EfiKeyD3)
232 'e', 0x00, // 2: unicode
233 'E', 0x00, // 2: shifted_unicode
234 0x00, 0x00, // 2: alt_gr_unicode
235 0x00, 0x00, // 2: shifted_alt_gr_unicode
236 EFI_NULL_MODIFIER, 0x0, // 2: modifier
237 0x3, 0x0, // 2: affected_attribute
238 //
239 // Descriptor 2, length = 16
240 //
241 52, 0x0, 0x0, 0x0, // 4: key (EfiKeyD4)
242 'r', 0x00, // 2: unicode
243 'R', 0x00, // 2: shifted_unicode
244 0x00, 0x00, // 2: alt_gr_unicode
245 0x00, 0x00, // 2: shifted_alt_gr_unicode
246 EFI_NULL_MODIFIER, 0x0, // 2: modifier
247 0x3, 0x0, // 2: affected_attribute
248 //
249 // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38
250 //
251 0x01, 0x00, // 2: DescriptionCount
252 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0,
253 //10: RFC3066 language code
254 ' ', 0x0, // 2: Space
255 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0,
256 '2', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0,
257 //24: DescriptionString
258 //
259 // End of package list, length = 4
260 //
261 0x4, 0x00, 0x00,
262 EFI_HII_PACKAGE_END
263};
264
Heinrich Schuchardt8eb52e12024-10-19 11:03:56 +0200265static u8 packagelist2[] = {
AKASHI Takahiro80bc2762019-01-21 12:13:01 +0900266 // EFI_HII_PACKAGE_LIST_HEADER, length = 20
267 // SimpleFont, Font, GUID, KeyboardLayout, Form, End
268 // (74) (122) 20 192 (8) 4
269 0xd3, 0xde, 0x85, 0x86, 0xce, 0x1b, 0xf3, 0x43,
270 0xa2, 0x0c, 0xa3, 0x06, 0xec, 0x69, 0x72, 0xdd, //16
271 0xec, 0x00, 0x00, 0x00, // 4: total 236(0xec)
272
273#ifdef NOT_USED /* TODO: simple font package not implemented yet */
274 //
275 // Simple Font Package 2, length = 74
276 //
277 0x4A, 0x00, 0x00, // 3
278 EFI_HII_PACKAGE_SIMPLE_FONTS, // 1
279 1, 0, // 2
280 1, 0, // 2
281 0x33, 0x0, 0, 1, 2, 3, 4, 5, 0, 7, 8, 9,
282 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, //22
283 0x44, 0x0, 0x2, 2, 3, 4, 5, 6, 0, 8, 9,
284 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, //22
285 3, 4, 5, 6, 7, 8, 9, 10, 11, 9, 13,
286 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, //22
287 //
288 // Font Package 2, length = 122
289 //
290 0x7A, 0x00, 0x00, // 3
291 EFI_HII_PACKAGE_FONTS, // 1
292 0x5C, 0x00, 0x00, 0x00, // 4: size of header
293 0x5C, 0x00, 0x00, 0x00, // 4: dummy offset
294 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00,
295 0xf5, 0x00, 0xec, 0xec, //10+2(pads)
296 0xff, 0x11, 0xff, 0x22, // 4: font style
297 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00,
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, //64
305 //
306 // Glyph block 1, length = 30
307 //
308 EFI_HII_GIBT_GLYPH, // 1
309 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00,
310 0xf5, 0x00, //10
311 0xff, 0x01, // 2
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, //16: BitMapData
314 EFI_HII_GIBT_END, // 1
315#endif
316 //
317 // Guid Package 1, length = 20
318 //
319 0x14, 0x00, 0x00, // 3
320 EFI_HII_PACKAGE_TYPE_GUID, // 1
321 0x5a, 0xc9, 0x87, 0x03, 0x3, 0xd7, 0x46, 0x23,
322 0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8, //16: guid
323 //
324 // Keyboard layout package 2, length = 192
325 0xc0, 0x00, 0x00, // 3
326 EFI_HII_PACKAGE_KEYBOARD_LAYOUT, // 1
327 0x02, 0x00, //0xec, 0xec, // 2: LayoutCount
328 //
329 // Layout 1, length = 93
330 //
331 0x5d, 0x00, // 2: layout_length
332 0x1f, 0x6a, 0xf5, 0xe0, 0x6b, 0xdf, 0x7e, 0x4a,
333 0xa3, 0x9a, 0xe7, 0xa5, 0x19, 0x15, 0x45, 0xd6,//16: guid
334 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor
335 // string offset
336 0x02, // 1: descriptor_count
337 //
338 // Descriptor 1, length = 16
339 //
340 32, 0x00, 0x00, 0x00, // 4: key (EfiKeyC1)
341 'a', 0x00, // 2: unicode
342 'A', 0x00, // 2: shifted_unicode
343 0x00, 0x00, // 2: alt_gr_unicode
344 0x00, 0x00, // 2: shifted_alt_gr_unic
345 EFI_NULL_MODIFIER, 0x00, // 2: modifier
346 0x03, 0x00, // 2: affected_attribute
347 //
348 // Descriptor 2, length = 16
349 //
350 33 /*EfiKeyC2*/, 0x00, 0x00, 0x00,
351 's', 0x00,
352 'S', 0x00,
353 0x00, 0x00,
354 0x00, 0x00,
355 EFI_NULL_MODIFIER, 0x00,
356 0x3, 0x0,
357 //
358 // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38
359 //
360 0x01, 0x00, // 2: DescriptionCount
361 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0,
362 //10: RFC3066 language code
363 ' ', 0x0, // 2: Space
364 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0,
365 '3', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0,
366 //24: DescriptionString
367 //
368 // Layout 2, length = 93
369 //
370 0x5d, 0x00, // 2: layout_length
371 0xc9, 0x6a, 0xbe, 0x47, 0xcc, 0x54, 0xf9, 0x46,
372 0xa2, 0x62, 0xd5, 0x3b, 0x25, 0x6a, 0xc, 0x34, //16: guid
373 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor
374 // string_offset
375 0x02, // 1: descriptor_count
376 //
377 // Descriptor 1, length = 16
378 //
379 34 /*EfiKeyC3*/, 0x0, 0x0, 0x0,
380 'd', 0x00,
381 'D', 0x00,
382 0x00, 0x00,
383 0x00, 0x00,
384 EFI_NULL_MODIFIER, 0x0,
385 0x3, 0x0,
386 //
387 // Descriptor 2, length = 16
388 //
389 35 /*EfiKeyC4*/, 0x0, 0x0, 0x0,
390 'e', 0x00,
391 'E', 0x00,
392 0x00, 0x00,
393 0x00, 0x00,
394 EFI_NULL_MODIFIER, 0x0,
395 0x3, 0x0,
396 //
397 // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38
398 //
399 0x01, 0x00, // 2: DescriptionCount
400 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0,
401 //10: RFC3066 language code
402 ' ', 0x0, // 2: Space
403 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0,
404 '4', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0,
405 //24: DescriptionString
406#ifdef NOT_USED /* TODO: form package not implemented yet */
407 //
408 // EFI_HII_PACKAGE_FORMS, length = 8
409 //
410 0x08, 0x00, 0x00, // 3
411 EFI_HII_PACKAGE_FORMS, // 1
412 //
413 // Opcode 1
414 //
415 EFI_IFR_BITWISE_AND_OP, // 1
416 0x02, // 1
417 EFI_IFR_END_OP, // 1
418 0x02, // 1
419#endif
420 //
421 // End of package list, length = 4
422 //
423 0x4, 0x00, 0x00, // 3
424 EFI_HII_PACKAGE_END // 1
425};
426
Heinrich Schuchardt8eb52e12024-10-19 11:03:56 +0200427static efi_guid_t kb_layout_guid11 =
AKASHI Takahiro80bc2762019-01-21 12:13:01 +0900428 EFI_GUID(0x8d40e495, 0xe2aa, 0x4c6f,
429 0x89, 0x70, 0x68, 0x85, 0x09, 0xee, 0xc7, 0xd2);
430
Heinrich Schuchardt8eb52e12024-10-19 11:03:56 +0200431static efi_guid_t package_guid =
AKASHI Takahiro80bc2762019-01-21 12:13:01 +0900432 EFI_GUID(0x0387c95a, 0xd703, 0x2346,
433 0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8);