Remove address from GPLv2 headers
[coreboot.git] / src / drivers / intel / fsp1_1 / fsp_util.h
blob054de1c5a106b22b72cb5e4ea1a95f3278a39330
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2013-2014 Sage Electronic Engineering, LLC.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc.
20 #ifndef FSP_UTIL_H
21 #define FSP_UTIL_H
23 #include <chipset_fsp_util.h>
24 #include "fsp_values.h"
26 #if IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)
27 int save_mrc_data(void *hob_start);
28 void * find_and_set_fastboot_cache(void);
29 #endif
31 volatile u8 * find_fsp (void);
32 void fsp_early_init(FSP_INFO_HEADER *fsp_info);
33 void FspNotify(u32 Phase);
34 void FspNotifyReturnPoint(EFI_STATUS Status, VOID *HobListPtr);
35 void romstage_fsp_rt_buffer_callback(FSP_INIT_RT_BUFFER *FspRtBuffer);
36 void print_fsp_info(void);
37 void chipset_fsp_early_init(FSP_INIT_PARAMS *FspInitParams,
38 FSP_INFO_HEADER *fsp_ptr);
39 void ChipsetFspReturnPoint(EFI_STATUS Status, VOID *HobListPtr);
40 void * find_saved_temp_mem(void *hob_list_ptr);
41 void * find_fsp_reserved_mem(void *hob_list_ptr);
43 /* functions in hob.c */
44 void print_hob_mem_attributes(void *Hobptr);
45 void print_hob_type_structure(u16 Hobtype, void *Hoblistptr);
46 void print_hob_resource_attributes(void *Hobptr);
47 void print_guid_type_attributes(void *Hobptr);
48 const char * get_hob_type_string(void *Hobptr);
49 void * find_hob_by_guid(void *Hoblistptr, EFI_GUID *guid1);
50 uint8_t guids_are_equal(EFI_GUID *guid1, EFI_GUID *guid2);
51 void printguid(EFI_GUID *guid);
53 /* Additional HOB types not included in the FSP:
54 * #define EFI_HOB_TYPE_HANDOFF 0x0001
55 * #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002
56 * #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003
57 * #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004
58 * #define EFI_HOB_TYPE_FV 0x0005
59 * #define EFI_HOB_TYPE_CPU 0x0006
60 * #define EFI_HOB_TYPE_MEMORY_POOL 0x0007
61 * #define EFI_HOB_TYPE_CV 0x0008
62 * #define EFI_HOB_TYPE_UNUSED 0xFFFE
63 * #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xffff
65 #define EFI_HOB_TYPE_HANDOFF 0x0001
66 #define EFI_HOB_TYPE_MEMORY_POOL 0x0007
68 #if IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)
69 #define MRC_DATA_ALIGN 0x1000
70 #define MRC_DATA_SIGNATURE (('M'<<0)|('R'<<8)|('C'<<16)|('D'<<24))
72 struct mrc_data_container {
73 u32 mrc_signature; // "MRCD"
74 u32 mrc_data_size; // Actual total size of this structure
75 u32 mrc_checksum; // IP style checksum
76 u32 reserved; // For header alignment
77 u8 mrc_data[0]; // Variable size, platform/run time dependent.
78 } __attribute__ ((packed));
80 struct mrc_data_container *find_current_mrc_cache(void);
82 #if !defined(__PRE_RAM__)
83 void update_mrc_cache(void *unused);
84 #endif
86 #endif
88 /* The offset in bytes from the start of the info structure */
89 #define FSP_IMAGE_SIG_LOC 0
90 #define FSP_IMAGE_ID_LOC 16
91 #define FSP_IMAGE_BASE_LOC 28
93 #define FSP_SIG 0x48505346 /* 'FSPH' */
95 #define ERROR_NO_FV_SIG 1
96 #define ERROR_NO_FFS_GUID 2
97 #define ERROR_NO_INFO_HEADER 3
98 #define ERROR_IMAGEBASE_MISMATCH 4
99 #define ERROR_INFO_HEAD_SIG_MISMATCH 5
100 #define ERROR_FSP_SIG_MISMATCH 6
102 #ifndef __PRE_RAM__
103 extern void *FspHobListPtr;
104 #endif
106 #define UPD_DEFAULT_CHECK(member) \
107 if (config->member != UPD_DEFAULT) { \
108 UpdData->member = config->member - 1; \
110 printk(FSP_INFO_LEVEL, #member ":\t\t0x%02x %s\n", UpdData->member, \
111 config->member ? "(set)" : "(default)");
113 #define UPD_SPD_CHECK(member) \
114 if (config->member == UPD_SPD_ADDR_DISABLED) { \
115 UpdData->member = 0x00; \
116 } else if (config->member != UPD_SPD_ADDR_DEFAULT) { \
117 UpdData->member = config->member; \
119 printk(FSP_INFO_LEVEL, #member ":\t\t0x%02x %s\n", UpdData->member, \
120 config->member ? "(set)" : "(default)");
122 #define UPD_DEVICE_CHECK(devicename, member, statement) \
123 case devicename: \
124 UpdData->member = dev->enabled; \
125 printk(FSP_INFO_LEVEL, statement "%s\n", \
126 UpdData->member?"Enabled":"Disabled"); \
127 break;
130 #ifndef FSP_BOOTLOADER_TEMPORARY_MEMORY_HOB_GUID
131 #define FSP_BOOTLOADER_TEMPORARY_MEMORY_HOB_GUID \
132 { 0xbbcff46c, 0xc8d3, 0x4113, { 0x89, 0x85, 0xb9, 0xd4, 0xf3, 0xb3, 0xf6, 0x4e } };
133 #endif
135 #endif /* FSP_UTIL_H */