xref: /qemu/include/hw/i386/tdvf.h (revision 9761ad5f65d23f080b5a3479e52196fbce2e1506)
1 /*
2  * Copyright (c) 2025 Intel Corporation
3  * Author: Isaku Yamahata <isaku.yamahata at gmail.com>
4  *                        <isaku.yamahata at intel.com>
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef HW_I386_TDVF_H
10 #define HW_I386_TDVF_H
11 
12 #include "qemu/osdep.h"
13 
14 #define TDVF_SECTION_TYPE_BFV               0
15 #define TDVF_SECTION_TYPE_CFV               1
16 #define TDVF_SECTION_TYPE_TD_HOB            2
17 #define TDVF_SECTION_TYPE_TEMP_MEM          3
18 
19 #define TDVF_SECTION_ATTRIBUTES_MR_EXTEND   (1U << 0)
20 #define TDVF_SECTION_ATTRIBUTES_PAGE_AUG    (1U << 1)
21 
22 typedef struct TdxFirmwareEntry {
23     uint32_t data_offset;
24     uint32_t data_len;
25     uint64_t address;
26     uint64_t size;
27     uint32_t type;
28     uint32_t attributes;
29 
30     void *mem_ptr;
31 } TdxFirmwareEntry;
32 
33 typedef struct TdxFirmware {
34     void *mem_ptr;
35 
36     uint32_t nr_entries;
37     TdxFirmwareEntry *entries;
38 } TdxFirmware;
39 
40 #define for_each_tdx_fw_entry(fw, e)    \
41     for (e = (fw)->entries; e != (fw)->entries + (fw)->nr_entries; e++)
42 
43 int tdvf_parse_metadata(TdxFirmware *fw, void *flash_ptr, int size);
44 
45 #endif /* HW_I386_TDVF_H */
46