]> git.sur5r.net Git - u-boot/blob - arch/x86/include/asm/fsp/fsp_support.h
x86: fsp: Add boot_mode as a member of struct shared_data
[u-boot] / arch / x86 / include / asm / fsp / fsp_support.h
1 /*
2  * Copyright (C) 2013, Intel Corporation
3  * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
4  *
5  * SPDX-License-Identifier:     Intel
6  */
7
8 #ifndef __FSP_SUPPORT_H__
9 #define __FSP_SUPPORT_H__
10
11 #include "fsp_types.h"
12 #include "fsp_fv.h"
13 #include "fsp_ffs.h"
14 #include "fsp_api.h"
15 #include "fsp_hob.h"
16 #include "fsp_platform.h"
17 #include "fsp_infoheader.h"
18 #include "fsp_bootmode.h"
19 #include <asm/arch/fsp/fsp_vpd.h>
20
21 struct shared_data {
22         struct fsp_header       *fsp_hdr;
23         u32                     stack_top;
24         u32                     boot_mode;
25         struct upd_region       fsp_upd;
26 };
27
28 #define FSP_LOWMEM_BASE         0x100000UL
29 #define FSP_HIGHMEM_BASE        0x100000000ULL
30 #define UPD_TERMINATOR          0x55AA
31
32
33 /**
34  * FSP Continuation assembly helper routine
35  *
36  * This routine jumps to the C version of FSP continuation function
37  */
38 void asm_continuation(void);
39
40 /**
41  * FSP initialization complete
42  *
43  * This is the function that indicates FSP initialization is complete and jumps
44  * back to the bootloader with HOB list pointer as the parameter.
45  *
46  * @hob_list:    HOB list pointer
47  */
48 void fsp_init_done(void *hob_list);
49
50 /**
51  * FSP Continuation function
52  *
53  * @status:      Always 0
54  * @hob_list:    HOB list pointer
55  *
56  * @retval:      Never returns
57  */
58 void fsp_continue(u32 status, void *hob_list);
59
60 /**
61  * Find FSP header offset in FSP image
62  *
63  * @retval: the offset of FSP header. If signature is invalid, returns 0.
64  */
65 struct fsp_header *find_fsp_header(void);
66
67 /**
68  * FSP initialization wrapper function.
69  *
70  * @stack_top: bootloader stack top address
71  * @boot_mode: boot mode defined in fsp_bootmode.h
72  * @nvs_buf:   Non-volatile memory buffer pointer
73  */
74 void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf);
75
76 /**
77  * FSP notification wrapper function
78  *
79  * @fsp_hdr: Pointer to FSP information header
80  * @phase:   FSP initialization phase defined in enum fsp_phase
81  *
82  * @retval:  compatible status code with EFI_STATUS defined in PI spec
83  */
84 u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase);
85
86 /**
87  * This function retrieves the top of usable low memory.
88  *
89  * @hob_list: A HOB list pointer.
90  *
91  * @retval:   Usable low memory top.
92  */
93 u32 fsp_get_usable_lowmem_top(const void *hob_list);
94
95 /**
96  * This function retrieves the top of usable high memory.
97  *
98  * @hob_list: A HOB list pointer.
99  *
100  * @retval:   Usable high memory top.
101  */
102 u64 fsp_get_usable_highmem_top(const void *hob_list);
103
104 /**
105  * This function retrieves a special reserved memory region.
106  *
107  * @hob_list: A HOB list pointer.
108  * @len:      A pointer to the GUID HOB data buffer length.
109  *            If the GUID HOB is located, the length will be updated.
110  * @guid:     A pointer to the owner guild.
111  *
112  * @retval:   Reserved region start address.
113  *            0 if this region does not exist.
114  */
115 u64 fsp_get_reserved_mem_from_guid(const void *hob_list,
116                                    u64 *len, struct efi_guid *guid);
117
118 /**
119  * This function retrieves the FSP reserved normal memory.
120  *
121  * @hob_list: A HOB list pointer.
122  * @len:      A pointer to the FSP reserved memory length buffer.
123  *            If the GUID HOB is located, the length will be updated.
124  * @retval:   FSP reserved memory base
125  *            0 if this region does not exist.
126  */
127 u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len);
128
129 /**
130  * This function retrieves the TSEG reserved normal memory.
131  *
132  * @hob_list:      A HOB list pointer.
133  * @len:           A pointer to the TSEG reserved memory length buffer.
134  *                 If the GUID HOB is located, the length will be updated.
135  *
136  * @retval NULL:   Failed to find the TSEG reserved memory.
137  * @retval others: TSEG reserved memory base.
138  */
139 u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len);
140
141 /**
142  * Returns the next instance of a HOB type from the starting HOB.
143  *
144  * @type:     HOB type to search
145  * @hob_list: A pointer to the HOB list
146  *
147  * @retval:   A HOB object with matching type; Otherwise NULL.
148  */
149 const struct hob_header *fsp_get_next_hob(uint type, const void *hob_list);
150
151 /**
152  * Returns the next instance of the matched GUID HOB from the starting HOB.
153  *
154  * @guid:     GUID to search
155  * @hob_list: A pointer to the HOB list
156  *
157  * @retval:   A HOB object with matching GUID; Otherwise NULL.
158  */
159 const struct hob_header *fsp_get_next_guid_hob(const struct efi_guid *guid,
160                                                const void *hob_list);
161
162 /**
163  * This function retrieves a GUID HOB data buffer and size.
164  *
165  * @hob_list:      A HOB list pointer.
166  * @len:           A pointer to the GUID HOB data buffer length.
167  *                 If the GUID HOB is located, the length will be updated.
168  * @guid           A pointer to HOB GUID.
169  *
170  * @retval NULL:   Failed to find the GUID HOB.
171  * @retval others: GUID HOB data buffer pointer.
172  */
173 void *fsp_get_guid_hob_data(const void *hob_list, u32 *len,
174                             struct efi_guid *guid);
175
176 /**
177  * This function retrieves FSP Non-volatile Storage HOB buffer and size.
178  *
179  * @hob_list:      A HOB list pointer.
180  * @len:           A pointer to the NVS data buffer length.
181  *                 If the HOB is located, the length will be updated.
182  *
183  * @retval NULL:   Failed to find the NVS HOB.
184  * @retval others: FSP NVS data buffer pointer.
185  */
186 void *fsp_get_nvs_data(const void *hob_list, u32 *len);
187
188 /**
189  * This function retrieves Bootloader temporary stack buffer and size.
190  *
191  * @hob_list:      A HOB list pointer.
192  * @len:           A pointer to the bootloader temporary stack length.
193  *                 If the HOB is located, the length will be updated.
194  *
195  * @retval NULL:   Failed to find the bootloader temporary stack HOB.
196  * @retval others: Bootloader temporary stackbuffer pointer.
197  */
198 void *fsp_get_bootloader_tmp_mem(const void *hob_list, u32 *len);
199
200 /**
201  * This function overrides the default configurations in the UPD data region.
202  *
203  * @fsp_upd: A pointer to the upd_region data strcture
204  *
205  * @return:  None
206  */
207 void update_fsp_upd(struct upd_region *fsp_upd);
208
209 /**
210  * fsp_init_phase_pci() - Tell the FSP that we have completed PCI init
211  *
212  * @return 0 if OK, -EPERM if the FSP gave an error.
213  */
214 int fsp_init_phase_pci(void);
215
216 #endif