xref: /illumos-gate/usr/src/uts/intel/sys/ucode_amd.h (revision d32f26eec03290baae31e85e7c5840280d5c4292)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  *
25  * Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
26  * Copyright 2022 Joyent, Inc.
27  * Copyright 2023 Oxide Computer Company
28  */
29 
30 #ifndef	_SYS_UCODE_AMD_H
31 #define	_SYS_UCODE_AMD_H
32 
33 #include <sys/types.h>
34 #include <ucode/ucode_errno.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * AMD Microcode file information
42  */
43 typedef struct ucode_header_amd {
44 	uint32_t uh_date;
45 	uint32_t uh_patch_id;
46 	uint32_t uh_internal; /* patch data id & length, init flag */
47 	uint32_t uh_cksum;
48 	uint32_t uh_nb_id;
49 	uint32_t uh_sb_id;
50 	uint16_t uh_cpu_rev;
51 	uint8_t  uh_nb_rev;
52 	uint8_t  uh_sb_rev;
53 	uint32_t uh_bios_rev;
54 	uint32_t uh_match[8];
55 } ucode_header_amd_t;
56 
57 typedef struct ucode_file_amd {
58 	/*
59 	 * The combined size of these fields adds up to 8KiB (8192 bytes).
60 	 * If support is needed for larger update files, increase the size of
61 	 * the uf_encr element.
62 	 */
63 	ucode_header_amd_t uf_header;
64 	uint8_t uf_data[896];
65 	uint8_t uf_resv[896];
66 	uint8_t uf_code_present;
67 	uint8_t uf_code[191];
68 	uint8_t uf_encr[6144];
69 } ucode_file_amd_t;
70 
71 typedef struct ucode_eqtbl_amd {
72 	uint32_t ue_inst_cpu;
73 	uint32_t ue_fixed_mask;
74 	uint32_t ue_fixed_comp;
75 	uint16_t ue_equiv_cpu;
76 	uint16_t ue_reserved;
77 } ucode_eqtbl_amd_t;
78 
79 #define	UCODE_AMD_EQUIVALENCE_TABLE_NAME "equivalence-table"
80 #define	UCODE_MAX_NAME_LEN_AMD (sizeof (UCODE_AMD_EQUIVALENCE_TABLE_NAME))
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif	/* _SYS_UCODE_AMD_H */
87