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 2025 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 /* 58 * This is the maximum size of a microcode blob that we are prepared to load 59 * in the kernel. AMD Turin microcode files are 14KiB and the size has been 60 * increasing with each generation. This value provides some margin for the 61 * future. 62 */ 63 #define UCODE_AMD_MAXSIZE (256 * 1024) 64 65 typedef struct ucode_file_amd { 66 ucode_header_amd_t uf_header; 67 uint8_t uf_data[896]; 68 uint8_t uf_resv[896]; 69 uint8_t uf_code_present; 70 uint8_t uf_code[191]; 71 uint8_t uf_encr[]; 72 } ucode_file_amd_t; 73 74 typedef struct ucode_eqtbl_amd { 75 uint32_t ue_inst_cpu; 76 uint32_t ue_fixed_mask; 77 uint32_t ue_fixed_comp; 78 uint16_t ue_equiv_cpu; 79 uint16_t ue_reserved; 80 } ucode_eqtbl_amd_t; 81 82 #define UCODE_AMD_EQUIVALENCE_TABLE_NAME "equivalence-table" 83 #define UCODE_MAX_NAME_LEN_AMD (sizeof (UCODE_AMD_EQUIVALENCE_TABLE_NAME)) 84 85 #ifdef __cplusplus 86 } 87 #endif 88 89 #endif /* _SYS_UCODE_AMD_H */ 90