]> git.proxmox.com Git - mirror_edk2.git/blob - CorebootModulePkg/Include/Coreboot.h
703c034ca913bae8562e2a3f9d584b52892347d3
[mirror_edk2.git] / CorebootModulePkg / Include / Coreboot.h
1 /** @file
2 Coreboot PEI module include file.
3
4 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 /*
16 * This file is part of the libpayload project.
17 *
18 * Copyright (C) 2008 Advanced Micro Devices, Inc.
19 *
20 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions
22 * are met:
23 * 1. Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in the
27 * documentation and/or other materials provided with the distribution.
28 * 3. The name of the author may not be used to endorse or promote products
29 * derived from this software without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 * SUCH DAMAGE.
42 */
43
44
45 #ifndef _COREBOOT_PEI_H_INCLUDED_
46 #define _COREBOOT_PEI_H_INCLUDED_
47
48 #if defined(_MSC_VER)
49 #pragma warning( disable : 4200 )
50 #endif
51
52 #define DYN_CBMEM_ALIGN_SIZE (4096)
53
54 struct cbmem_entry {
55 UINT32 magic;
56 UINT32 start;
57 UINT32 size;
58 UINT32 id;
59 };
60
61 struct cbmem_root {
62 UINT32 max_entries;
63 UINT32 num_entries;
64 UINT32 locked;
65 UINT32 size;
66 struct cbmem_entry entries[0];
67 };
68
69 struct cbuint64 {
70 UINT32 lo;
71 UINT32 hi;
72 };
73
74 #define CB_HEADER_SIGNATURE 0x4F49424C
75
76 struct cb_header {
77 UINT32 signature;
78 UINT32 header_bytes;
79 UINT32 header_checksum;
80 UINT32 table_bytes;
81 UINT32 table_checksum;
82 UINT32 table_entries;
83 };
84
85 struct cb_record {
86 UINT32 tag;
87 UINT32 size;
88 };
89
90 #define CB_TAG_UNUSED 0x0000
91 #define CB_TAG_MEMORY 0x0001
92
93 struct cb_memory_range {
94 struct cbuint64 start;
95 struct cbuint64 size;
96 UINT32 type;
97 };
98
99 #define CB_MEM_RAM 1
100 #define CB_MEM_RESERVED 2
101 #define CB_MEM_ACPI 3
102 #define CB_MEM_NVS 4
103 #define CB_MEM_UNUSABLE 5
104 #define CB_MEM_VENDOR_RSVD 6
105 #define CB_MEM_TABLE 16
106
107 struct cb_memory {
108 UINT32 tag;
109 UINT32 size;
110 struct cb_memory_range map[0];
111 };
112
113 #define CB_TAG_MAINBOARD 0x0003
114
115 struct cb_mainboard {
116 UINT32 tag;
117 UINT32 size;
118 UINT8 vendor_idx;
119 UINT8 part_number_idx;
120 UINT8 strings[0];
121 };
122 #define CB_TAG_VERSION 0x0004
123 #define CB_TAG_EXTRA_VERSION 0x0005
124 #define CB_TAG_BUILD 0x0006
125 #define CB_TAG_COMPILE_TIME 0x0007
126 #define CB_TAG_COMPILE_BY 0x0008
127 #define CB_TAG_COMPILE_HOST 0x0009
128 #define CB_TAG_COMPILE_DOMAIN 0x000a
129 #define CB_TAG_COMPILER 0x000b
130 #define CB_TAG_LINKER 0x000c
131 #define CB_TAG_ASSEMBLER 0x000d
132
133 struct cb_string {
134 UINT32 tag;
135 UINT32 size;
136 UINT8 string[0];
137 };
138
139 #define CB_TAG_SERIAL 0x000f
140
141 struct cb_serial {
142 UINT32 tag;
143 UINT32 size;
144 #define CB_SERIAL_TYPE_IO_MAPPED 1
145 #define CB_SERIAL_TYPE_MEMORY_MAPPED 2
146 UINT32 type;
147 UINT32 baseaddr;
148 UINT32 baud;
149 };
150
151 #define CB_TAG_CONSOLE 0x00010
152
153 struct cb_console {
154 UINT32 tag;
155 UINT32 size;
156 UINT16 type;
157 };
158
159 #define CB_TAG_CONSOLE_SERIAL8250 0
160 #define CB_TAG_CONSOLE_VGA 1 // OBSOLETE
161 #define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE
162 #define CB_TAG_CONSOLE_LOGBUF 3
163 #define CB_TAG_CONSOLE_SROM 4 // OBSOLETE
164 #define CB_TAG_CONSOLE_EHCI 5
165
166 #define CB_TAG_FORWARD 0x00011
167
168 struct cb_forward {
169 UINT32 tag;
170 UINT32 size;
171 UINT64 forward;
172 };
173
174 #define CB_TAG_FRAMEBUFFER 0x0012
175 struct cb_framebuffer {
176 UINT32 tag;
177 UINT32 size;
178
179 UINT64 physical_address;
180 UINT32 x_resolution;
181 UINT32 y_resolution;
182 UINT32 bytes_per_line;
183 UINT8 bits_per_pixel;
184 UINT8 red_mask_pos;
185 UINT8 red_mask_size;
186 UINT8 green_mask_pos;
187 UINT8 green_mask_size;
188 UINT8 blue_mask_pos;
189 UINT8 blue_mask_size;
190 UINT8 reserved_mask_pos;
191 UINT8 reserved_mask_size;
192 };
193
194 #define CB_TAG_VDAT 0x0015
195 struct cb_vdat {
196 UINT32 tag;
197 UINT32 size; /* size of the entire entry */
198 UINT64 vdat_addr;
199 UINT32 vdat_size;
200 };
201
202 #define CB_TAG_TIMESTAMPS 0x0016
203 #define CB_TAG_CBMEM_CONSOLE 0x0017
204 #define CB_TAG_MRC_CACHE 0x0018
205 struct cb_cbmem_tab {
206 UINT32 tag;
207 UINT32 size;
208 UINT64 cbmem_tab;
209 };
210
211 /* Helpful macros */
212
213 #define MEM_RANGE_COUNT(_rec) \
214 (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))
215
216 #define MEM_RANGE_PTR(_rec, _idx) \
217 (void *)(((UINT8 *) (_rec)) + sizeof(*(_rec)) \
218 + (sizeof((_rec)->map[0]) * (_idx)))
219
220
221 #endif // _COREBOOT_PEI_H_INCLUDED_