summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h
blob: 3296a2b389624a72de3d1676c0c2737083a1364a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*
 * Copyright (C) 2013, Intel Corporation
 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
 *
 * SPDX-License-Identifier:	Intel
 */

#ifndef __FSP_SUPPORT_H__
#define __FSP_SUPPORT_H__

#include "fsp_types.h"
#include "fsp_fv.h"
#include "fsp_ffs.h"
#include "fsp_api.h"
#include "fsp_hob.h"
#include "fsp_platform.h"
#include "fsp_infoheader.h"
#include "fsp_bootmode.h"
#include "fsp_vpd.h"

struct shared_data_t {
	struct fsp_header_t	*fsp_hdr;
	u32			*stack_top;
	struct upd_region_t	fsp_upd;
};

void asm_continuation(void);

void fsp_init_done(void *hob_list);

/**
 * FSP Continuation function
 *
 * @shared_data: Shared data base before stack migration
 * @status:      Always 0
 * @hob_list:    HOB list pointer
 *
 * @retval:      Never returns
 */
void fsp_continue(struct shared_data_t *shared_data, u32 status,
		  void *hob_list);

/**
 * Find FSP header offset in FSP image
 *
 * If this function is called before the a stack is established, special care
 * must be taken. First, it cannot declare any local variable using stack.
 * Only register variable can be used here. Secondly, some compiler version
 * will add prolog or epilog code for the C function. If so the function call
 * may not work before stack is ready. GCC 4.8.1 has been verified to be
 * working for the following code.
 *
 * @retval: the offset of FSP header. If signature is invalid, returns 0.
 */
u32 find_fsp_header(void);

/**
 * FSP initialization wrapper function.
 *
 * @stack_top: bootloader stack top address
 * @boot_mode: boot mode defined in fsp_bootmode.h
 * @nvs_buf:   Non-volatile memory buffer pointer
 */
void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf);

/**
 * FSP notification wrapper function
 *
 * @fsp_hdr: Pointer to FSP information header
 * @phase:   FSP initialization phase defined in enum fsp_phase_t
 *
 * @retval:  compatible status code with EFI_STATUS defined in PI spec
 */
u32 fsp_notify(struct fsp_header_t *fsp_hdr, u32 phase);

/**
 * This function retrieves the top of usable low memory.
 *
 * @hob_list: A HOB list pointer.
 *
 * @retval:   Usable low memory top.
 */
u32 get_usable_lowmem_top(const void *hob_list);

/**
 * This function retrieves the top of usable high memory.
 *
 * @hob_list: A HOB list pointer.
 *
 * @retval:   Usable high memory top.
 */
u64 get_usable_highmem_top(const void *hob_list);

/**
 * This function retrieves a special reserved memory region.
 *
 * @hob_list: A HOB list pointer.
 * @len:      A pointer to the GUID HOB data buffer length.
 *            If the GUID HOB is located, the length will be updated.
 * @guid:     A pointer to the owner guild.
 *
 * @retval:   Reserved region start address.
 *            0 if this region does not exist.
 */
u64 get_fsp_reserved_mem_from_guid(const void *hob_list,
				   u64 *len, struct efi_guid_t *guid);

/**
 * This function retrieves the FSP reserved normal memory.
 *
 * @hob_list: A HOB list pointer.
 * @len:      A pointer to the FSP reserved memory length buffer.
 *            If the GUID HOB is located, the length will be updated.
 * @retval:   FSP reserved memory base
 *            0 if this region does not exist.
 */
u32 get_fsp_reserved_mem(const void *hob_list, u32 *len);

/**
 * This function retrieves the TSEG reserved normal memory.
 *
 * @hob_list:      A HOB list pointer.
 * @len:           A pointer to the TSEG reserved memory length buffer.
 *                 If the GUID HOB is located, the length will be updated.
 *
 * @retval NULL:   Failed to find the TSEG reserved memory.
 * @retval others: TSEG reserved memory base.
 */
u32 get_tseg_reserved_mem(const void *hob_list, u32 *len);

/**
 * Returns the next instance of a HOB type from the starting HOB.
 *
 * @type:     HOB type to search
 * @hob_list: A pointer to the HOB list
 *
 * @retval:   A HOB object with matching type; Otherwise NULL.
 */
void *get_next_hob(u16 type, const void *hob_list);

/**
 * Returns the next instance of the matched GUID HOB from the starting HOB.
 *
 * @guid:     GUID to search
 * @hob_list: A pointer to the HOB list
 *
 * @retval:   A HOB object with matching GUID; Otherwise NULL.
 */
void *get_next_guid_hob(const struct efi_guid_t *guid, const void *hob_list);

/**
 * This function retrieves a GUID HOB data buffer and size.
 *
 * @hob_list:      A HOB list pointer.
 * @len:           A pointer to the GUID HOB data buffer length.
 *                 If the GUID HOB is located, the length will be updated.
 * @guid           A pointer to HOB GUID.
 *
 * @retval NULL:   Failed to find the GUID HOB.
 * @retval others: GUID HOB data buffer pointer.
 */
void *get_guid_hob_data(const void *hob_list, u32 *len,
			struct efi_guid_t *guid);

/**
 * This function retrieves FSP Non-volatile Storage HOB buffer and size.
 *
 * @hob_list:      A HOB list pointer.
 * @len:           A pointer to the NVS data buffer length.
 *                 If the HOB is located, the length will be updated.
 *
 * @retval NULL:   Failed to find the NVS HOB.
 * @retval others: FSP NVS data buffer pointer.
 */
void *get_fsp_nvs_data(const void *hob_list, u32 *len);

/**
 * This function retrieves Bootloader temporary stack buffer and size.
 *
 * @hob_list:      A HOB list pointer.
 * @len:           A pointer to the bootloader temporary stack length.
 *                 If the HOB is located, the length will be updated.
 *
 * @retval NULL:   Failed to find the bootloader temporary stack HOB.
 * @retval others: Bootloader temporary stackbuffer pointer.
 */
void *get_bootloader_tmp_mem(const void *hob_list, u32 *len);

/**
 * This function overrides the default configurations in the UPD data region.
 *
 * @fsp_upd: A pointer to the upd_region_t data strcture
 *
 * @return:  None
 */
void update_fsp_upd(struct upd_region_t *fsp_upd);

#endif
OpenPOWER on IntegriCloud