1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2019 Intel Corporation
6 #ifndef _INTEL_UC_FW_ABI_H
7 #define _INTEL_UC_FW_ABI_H
9 #include <linux/types.h>
10 #include <linux/build_bug.h>
13 * DOC: Firmware Layout
15 * The GuC/HuC firmware layout looks like this::
17 * +======================================================================+
19 * +===============+===============+============+============+============+
20 * | CSS header | uCode | RSA key | modulus | exponent |
21 * +===============+===============+============+============+============+
22 * <-header size-> <---header size continued ----------->
23 * <--- size ----------------------------------------------------------->
28 * The firmware may or may not have modulus key and exponent data. The header,
29 * uCode and RSA signature are must-have components that will be used by driver.
30 * Length of each components, which is all in dwords, can be found in header.
31 * In the case that modulus and exponent are not present in fw, a.k.a truncated
32 * image, the length value still appears in header.
34 * Driver will do some basic fw size validation based on the following rules:
36 * 1. Header, uCode and RSA are must-have components.
37 * 2. All firmware components, if they present, are in the sequence illustrated
38 * in the layout table above.
39 * 3. Length info of each component can be found in header, in dwords.
40 * 4. Modulus and exponent key are not required by driver. They may not appear
41 * in fw. So driver will load a truncated firmware in this case.
44 struct uc_css_header
{
47 * header_size includes all non-uCode bits, including css_header, rsa
48 * key, modulus key and exponent data.
55 #define CSS_DATE_DAY (0xFF << 0)
56 #define CSS_DATE_MONTH (0xFF << 8)
57 #define CSS_DATE_YEAR (0xFFFF << 16)
58 u32 size_dw
; /* uCode plus header_size_dw */
63 #define CSS_TIME_HOUR (0xFF << 0)
64 #define CSS_DATE_MIN (0xFF << 8)
65 #define CSS_DATE_SEC (0xFFFF << 16)
69 #define CSS_SW_VERSION_UC_MAJOR (0xFF << 16)
70 #define CSS_SW_VERSION_UC_MINOR (0xFF << 8)
71 #define CSS_SW_VERSION_UC_PATCH (0xFF << 0)
75 static_assert(sizeof(struct uc_css_header
) == 128);
77 #endif /* _INTEL_UC_FW_ABI_H */