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