Rename __attribute__((packed)) --> __packed
[coreboot.git] / src / drivers / intel / fsp1_0 / fsp_util.h
blobbadd254f8078ad388c655c85c4ed93e3ab330f8e
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.
16 #ifndef FSP_UTIL_H
17 #define FSP_UTIL_H
19 #include <compiler.h>
20 #include <chipset_fsp_util.h>
21 #include "fsp_values.h"
23 #if IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)
24 int save_mrc_data(void *hob_start);
25 void * find_and_set_fastboot_cache(void);
26 #endif
28 volatile u8 * find_fsp (void);
29 void fsp_early_init(FSP_INFO_HEADER *fsp_info);
30 void FspNotify(u32 Phase);
31 void FspNotifyReturnPoint(EFI_STATUS Status, VOID *HobListPtr);
32 void romstage_fsp_rt_buffer_callback(FSP_INIT_RT_BUFFER *FspRtBuffer);
33 void print_fsp_info(void);
34 void chipset_fsp_early_init(FSP_INIT_PARAMS *FspInitParams,
35 FSP_INFO_HEADER *fsp_ptr);
36 void ChipsetFspReturnPoint(EFI_STATUS Status, VOID *HobListPtr);
37 void * find_saved_temp_mem(void *hob_list_ptr);
38 void * find_fsp_reserved_mem(void *hob_list_ptr);
40 /* functions in hob.c */
41 void print_hob_mem_attributes(void *Hobptr);
42 void print_hob_type_structure(u16 Hobtype, void *Hoblistptr);
43 void print_hob_resource_attributes(void *Hobptr);
44 void print_guid_type_attributes(void *Hobptr);
45 const char * get_hob_type_string(void *Hobptr);
46 void * find_hob_by_guid(void *Hoblistptr, EFI_GUID *guid1);
47 uint8_t guids_are_equal(EFI_GUID *guid1, EFI_GUID *guid2);
48 void printguid(EFI_GUID *guid);
50 /* Additional HOB types not included in the FSP:
51 * #define EFI_HOB_TYPE_HANDOFF 0x0001
52 * #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002
53 * #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003
54 * #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004
55 * #define EFI_HOB_TYPE_FV 0x0005
56 * #define EFI_HOB_TYPE_CPU 0x0006
57 * #define EFI_HOB_TYPE_MEMORY_POOL 0x0007
58 * #define EFI_HOB_TYPE_CV 0x0008
59 * #define EFI_HOB_TYPE_UNUSED 0xFFFE
60 * #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xffff
62 #define EFI_HOB_TYPE_HANDOFF 0x0001
63 #define EFI_HOB_TYPE_MEMORY_POOL 0x0007
65 #if IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)
66 #define MRC_DATA_ALIGN 0x1000
67 #define MRC_DATA_SIGNATURE (('M'<<0)|('R'<<8)|('C'<<16)|('D'<<24))
69 struct mrc_data_container {
70 u32 mrc_signature; // "MRCD"
71 u32 mrc_data_size; // Actual total size of this structure
72 u32 mrc_checksum; // IP style checksum
73 u32 reserved; // For header alignment
74 u8 mrc_data[0]; // Variable size, platform/run time dependent.
75 } __packed;
77 struct mrc_data_container *find_current_mrc_cache(void);
79 #if !defined(__PRE_RAM__)
80 void update_mrc_cache(void *unused);
81 #endif
83 #endif
85 /* The offset in bytes from the start of the info structure */
86 #define FSP_IMAGE_SIG_LOC 0
87 #define FSP_IMAGE_ID_LOC 16
88 #define FSP_IMAGE_BASE_LOC 28
90 #define FSP_SIG 0x48505346 /* 'FSPH' */
92 #define ERROR_NO_FV_SIG 1
93 #define ERROR_NO_FFS_GUID 2
94 #define ERROR_NO_INFO_HEADER 3
95 #define ERROR_IMAGEBASE_MISMATCH 4
96 #define ERROR_INFO_HEAD_SIG_MISMATCH 5
97 #define ERROR_FSP_SIG_MISMATCH 6
99 #ifndef __PRE_RAM__
100 extern void *FspHobListPtr;
101 #endif
103 #define UPD_DEFAULT_CHECK(member) \
104 if (config->member != UPD_DEFAULT) { \
105 UpdData->member = config->member - 1; \
107 printk(FSP_INFO_LEVEL, #member ":\t\t0x%02x %s\n", UpdData->member, \
108 config->member ? "(set)" : "(default)");
110 #define UPD_SPD_CHECK(member) \
111 if (config->member == UPD_SPD_ADDR_DISABLED) { \
112 UpdData->member = 0x00; \
113 } else if (config->member != UPD_SPD_ADDR_DEFAULT) { \
114 UpdData->member = config->member; \
116 printk(FSP_INFO_LEVEL, #member ":\t\t0x%02x %s\n", UpdData->member, \
117 config->member ? "(set)" : "(default)");
119 #define UPD_DEVICE_CHECK(devicename, member, statement) \
120 case devicename: \
121 UpdData->member = dev->enabled; \
122 printk(FSP_INFO_LEVEL, statement "%s\n", \
123 UpdData->member?"Enabled":"Disabled"); \
124 break;
127 #ifndef FSP_BOOTLOADER_TEMPORARY_MEMORY_HOB_GUID
128 #define FSP_BOOTLOADER_TEMPORARY_MEMORY_HOB_GUID \
129 { 0xbbcff46c, 0xc8d3, 0x4113, { 0x89, 0x85, 0xb9, 0xd4, 0xf3, 0xb3, 0xf6, 0x4e } };
130 #endif
132 #endif /* FSP_UTIL_H */