]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h
ARM: Implement non-cached memory support
[karo-tx-uboot.git] / arch / x86 / include / asm / arch-queensbay / 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 "fsp_vpd.h"
20
21 struct shared_data_t {
22         struct fsp_header_t     *fsp_hdr;
23         u32                     *stack_top;
24         struct upd_region_t     fsp_upd;
25 };
26
27 void asm_continuation(void);
28
29 void fsp_init_done(void *hob_list);
30
31 /**
32  * FSP Continuation function
33  *
34  * @shared_data: Shared data base before stack migration
35  * @status:      Always 0
36  * @hob_list:    HOB list pointer
37  *
38  * @retval:      Never returns
39  */
40 void fsp_continue(struct shared_data_t *shared_data, u32 status,
41                   void *hob_list);
42
43 /**
44  * Find FSP header offset in FSP image
45  *
46  * If this function is called before the a stack is established, special care
47  * must be taken. First, it cannot declare any local variable using stack.
48  * Only register variable can be used here. Secondly, some compiler version
49  * will add prolog or epilog code for the C function. If so the function call
50  * may not work before stack is ready. GCC 4.8.1 has been verified to be
51  * working for the following code.
52  *
53  * @retval: the offset of FSP header. If signature is invalid, returns 0.
54  */
55 u32 find_fsp_header(void);
56
57 /**
58  * FSP initialization wrapper function.
59  *
60  * @stack_top: bootloader stack top address
61  * @boot_mode: boot mode defined in fsp_bootmode.h
62  * @nvs_buf:   Non-volatile memory buffer pointer
63  */
64 void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf);
65
66 /**
67  * FSP notification wrapper function
68  *
69  * @fsp_hdr: Pointer to FSP information header
70  * @phase:   FSP initialization phase defined in enum fsp_phase_t
71  *
72  * @retval:  compatible status code with EFI_STATUS defined in PI spec
73  */
74 u32 fsp_notify(struct fsp_header_t *fsp_hdr, u32 phase);
75
76 /**
77  * This function retrieves the top of usable low memory.
78  *
79  * @hob_list: A HOB list pointer.
80  *
81  * @retval:   Usable low memory top.
82  */
83 u32 get_usable_lowmem_top(const void *hob_list);
84
85 /**
86  * This function retrieves the top of usable high memory.
87  *
88  * @hob_list: A HOB list pointer.
89  *
90  * @retval:   Usable high memory top.
91  */
92 u64 get_usable_highmem_top(const void *hob_list);
93
94 /**
95  * This function retrieves a special reserved memory region.
96  *
97  * @hob_list: A HOB list pointer.
98  * @len:      A pointer to the GUID HOB data buffer length.
99  *            If the GUID HOB is located, the length will be updated.
100  * @guid:     A pointer to the owner guild.
101  *
102  * @retval:   Reserved region start address.
103  *            0 if this region does not exist.
104  */
105 u64 get_fsp_reserved_mem_from_guid(const void *hob_list,
106                                    u64 *len, struct efi_guid_t *guid);
107
108 /**
109  * This function retrieves the FSP reserved normal memory.
110  *
111  * @hob_list: A HOB list pointer.
112  * @len:      A pointer to the FSP reserved memory length buffer.
113  *            If the GUID HOB is located, the length will be updated.
114  * @retval:   FSP reserved memory base
115  *            0 if this region does not exist.
116  */
117 u32 get_fsp_reserved_mem(const void *hob_list, u32 *len);
118
119 /**
120  * This function retrieves the TSEG reserved normal memory.
121  *
122  * @hob_list:      A HOB list pointer.
123  * @len:           A pointer to the TSEG reserved memory length buffer.
124  *                 If the GUID HOB is located, the length will be updated.
125  *
126  * @retval NULL:   Failed to find the TSEG reserved memory.
127  * @retval others: TSEG reserved memory base.
128  */
129 u32 get_tseg_reserved_mem(const void *hob_list, u32 *len);
130
131 /**
132  * Returns the next instance of a HOB type from the starting HOB.
133  *
134  * @type:     HOB type to search
135  * @hob_list: A pointer to the HOB list
136  *
137  * @retval:   A HOB object with matching type; Otherwise NULL.
138  */
139 void *get_next_hob(u16 type, const void *hob_list);
140
141 /**
142  * Returns the next instance of the matched GUID HOB from the starting HOB.
143  *
144  * @guid:     GUID to search
145  * @hob_list: A pointer to the HOB list
146  *
147  * @retval:   A HOB object with matching GUID; Otherwise NULL.
148  */
149 void *get_next_guid_hob(const struct efi_guid_t *guid, const void *hob_list);
150
151 /**
152  * This function retrieves a GUID HOB data buffer and size.
153  *
154  * @hob_list:      A HOB list pointer.
155  * @len:           A pointer to the GUID HOB data buffer length.
156  *                 If the GUID HOB is located, the length will be updated.
157  * @guid           A pointer to HOB GUID.
158  *
159  * @retval NULL:   Failed to find the GUID HOB.
160  * @retval others: GUID HOB data buffer pointer.
161  */
162 void *get_guid_hob_data(const void *hob_list, u32 *len,
163                         struct efi_guid_t *guid);
164
165 /**
166  * This function retrieves FSP Non-volatile Storage HOB buffer and size.
167  *
168  * @hob_list:      A HOB list pointer.
169  * @len:           A pointer to the NVS data buffer length.
170  *                 If the HOB is located, the length will be updated.
171  *
172  * @retval NULL:   Failed to find the NVS HOB.
173  * @retval others: FSP NVS data buffer pointer.
174  */
175 void *get_fsp_nvs_data(const void *hob_list, u32 *len);
176
177 /**
178  * This function retrieves Bootloader temporary stack buffer and size.
179  *
180  * @hob_list:      A HOB list pointer.
181  * @len:           A pointer to the bootloader temporary stack length.
182  *                 If the HOB is located, the length will be updated.
183  *
184  * @retval NULL:   Failed to find the bootloader temporary stack HOB.
185  * @retval others: Bootloader temporary stackbuffer pointer.
186  */
187 void *get_bootloader_tmp_mem(const void *hob_list, u32 *len);
188
189 /**
190  * This function overrides the default configurations in the UPD data region.
191  *
192  * @fsp_upd: A pointer to the upd_region_t data strcture
193  *
194  * @return:  None
195  */
196 void update_fsp_upd(struct upd_region_t *fsp_upd);
197
198 #endif