1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2019 Intel Corporation <www.intel.com>
4  */
5 
6 #ifndef __SLIMBOOTLOADER_ARCH_H__
7 #define __SLIMBOOTLOADER_ARCH_H__
8 
9 #include <asm/hob.h>
10 
11 /**
12  * A GUID to get MemoryMap info hob which is provided by Slim Bootloader
13  */
14 #define SBL_MEMORY_MAP_INFO_GUID \
15 	EFI_GUID(0xa1ff7424, 0x7a1a, 0x478e, \
16 		0xa9, 0xe4, 0x92, 0xf3, 0x57, 0xd1, 0x28, 0x32)
17 
18 /**
19  * A GUID to get SerialPort info hob which is provided by Slim Bootloader
20  */
21 #define SBL_SERIAL_PORT_INFO_GUID \
22 	EFI_GUID(0x6c6872fe, 0x56a9, 0x4403, \
23 		0xbb, 0x98, 0x95, 0x8d, 0x62, 0xde, 0x87, 0xf1)
24 
25 /**
26  * A GUID to get boot performance info hob which is provided by Slim Bootloader
27  */
28 #define SBL_PERFORMANCE_INFO_GUID \
29 	EFI_GUID(0x868204be, 0x23d0, 0x4ff9, \
30 		0xac, 0x34, 0xb9, 0x95, 0xac, 0x04, 0xb1, 0xb9)
31 
32 /**
33  * A single entry of memory map information
34  *
35  * @addr: start address of a memory map entry
36  * @size: size of a memory map entry
37  * @type: usable:1, reserved:2, acpi:3, nvs:4, unusable:5
38  * @flag: only used in Slim Bootloader
39  * @rsvd: padding for alignment
40  */
41 struct sbl_memory_map_entry {
42 	u64	addr;
43 	u64	size;
44 	u8	type;
45 	u8	flag;
46 	u8	rsvd[6];
47 };
48 
49 /**
50  * This includes all memory map entries which is sorted based on physical start
51  * address, from low to high, and carved out reserved, acpi nvs, acpi reclaim
52  * and usable memory.
53  *
54  * @rev  : revision of memory_map_info structure. currently 1.
55  * @rsvd : padding for alignment
56  * @count: the number of memory map entries
57  * @entry: array of all memory map entries
58  */
59 struct sbl_memory_map_info {
60 	u8	rev;
61 	u8	rsvd[3];
62 	u32	count;
63 	struct sbl_memory_map_entry	entry[0];
64 };
65 
66 /**
67  * This includes serial port info which has already been initialized in previous
68  * Slim Bootloader stage.
69  * The Slim Bootloader initializes serial port regardless of debug/release build
70  * modes, and it passes the information to a payload thru hob. So, a payload can
71  * re-use the serial information without re-initializing serial port.
72  *
73  * @rev   : revision of serial_port_info structure. currently 1.
74  * @rsvd  : padding for alignment
75  * @type  : port io: 1, mmio: 2
76  * @base  : io base address. ex) 0x3f8, 0x80001000
77  * @baud  : uart baud rate
78  * @stride: register stride in Bytes
79  * @clk   : uart frequency in Hz
80  * @rsvd1 : reserved
81  */
82 struct sbl_serial_port_info {
83 	u8      rev;
84 	u8      rsvd[3];
85 	u32     type;
86 	u32     base;
87 	u32     baud;
88 	u32     stride;
89 	u32     clk;
90 	u32     rsvd1;
91 };
92 
93 /**
94  * This includes timestamp data which has been collected in Slim Bootloader
95  * stages from the reset vector. In addition, this has TSC frequency in KHz to
96  * calculate each timestamp.
97  *
98  * @rev   : revision of performance_info structure. currently 1.
99  * @rsvd  : padding for alignment
100  * @count : the number of collected timestamp data
101  * @flags : only used in Slim Bootloader
102  * @frequency: tsc frequency in KHz
103  * @timestamp: the array of timestamp data which has 64-bit tsc value
104  */
105 struct sbl_performance_info {
106 	u8      rev;
107 	u8      rsvd[3];
108 	u16     count;
109 	u16     flags;
110 	u32     frequency;
111 	u64     timestamp[0];
112 };
113 
114 #endif /* __SLIMBOOTLOADER_ARCH_H__ */
115