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