]>
Commit | Line | Data |
---|---|---|
fce4ecd9 MM |
1 | /** @file\r |
2 | Coreboot PEI module include file.\r | |
3 | \r | |
165c0059 | 4 | Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r |
fce4ecd9 MM |
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 | |
165c0059 GD |
54 | #define IMD_ENTRY_MAGIC (~0xC0389481)\r |
55 | #define CBMEM_ENTRY_MAGIC (~0xC0389479)\r | |
56 | \r | |
fce4ecd9 MM |
57 | struct cbmem_entry {\r |
58 | UINT32 magic;\r | |
59 | UINT32 start;\r | |
60 | UINT32 size;\r | |
61 | UINT32 id;\r | |
62 | };\r | |
63 | \r | |
64 | struct cbmem_root {\r | |
65 | UINT32 max_entries;\r | |
66 | UINT32 num_entries;\r | |
67 | UINT32 locked;\r | |
68 | UINT32 size;\r | |
69 | struct cbmem_entry entries[0];\r | |
70 | };\r | |
71 | \r | |
165c0059 GD |
72 | struct imd_entry {\r |
73 | UINT32 magic;\r | |
74 | UINT32 start_offset;\r | |
75 | UINT32 size;\r | |
76 | UINT32 id;\r | |
77 | };\r | |
78 | \r | |
79 | struct imd_root {\r | |
80 | UINT32 max_entries;\r | |
81 | UINT32 num_entries;\r | |
82 | UINT32 flags;\r | |
24ca2f35 | 83 | UINT32 entry_align; |
165c0059 GD |
84 | UINT32 max_offset;\r |
85 | struct imd_entry entries[0];\r | |
86 | };\r | |
87 | \r | |
fce4ecd9 MM |
88 | struct cbuint64 {\r |
89 | UINT32 lo;\r | |
90 | UINT32 hi;\r | |
91 | };\r | |
92 | \r | |
93 | #define CB_HEADER_SIGNATURE 0x4F49424C\r | |
94 | \r | |
95 | struct cb_header {\r | |
96 | UINT32 signature;\r | |
97 | UINT32 header_bytes;\r | |
98 | UINT32 header_checksum;\r | |
99 | UINT32 table_bytes;\r | |
100 | UINT32 table_checksum;\r | |
101 | UINT32 table_entries;\r | |
102 | };\r | |
103 | \r | |
104 | struct cb_record {\r | |
105 | UINT32 tag;\r | |
106 | UINT32 size;\r | |
107 | };\r | |
108 | \r | |
109 | #define CB_TAG_UNUSED 0x0000\r | |
110 | #define CB_TAG_MEMORY 0x0001\r | |
111 | \r | |
112 | struct cb_memory_range {\r | |
113 | struct cbuint64 start;\r | |
114 | struct cbuint64 size;\r | |
115 | UINT32 type;\r | |
116 | };\r | |
117 | \r | |
118 | #define CB_MEM_RAM 1\r | |
119 | #define CB_MEM_RESERVED 2\r | |
120 | #define CB_MEM_ACPI 3\r | |
121 | #define CB_MEM_NVS 4\r | |
122 | #define CB_MEM_UNUSABLE 5\r | |
123 | #define CB_MEM_VENDOR_RSVD 6\r | |
124 | #define CB_MEM_TABLE 16\r | |
125 | \r | |
126 | struct cb_memory {\r | |
127 | UINT32 tag;\r | |
128 | UINT32 size;\r | |
129 | struct cb_memory_range map[0];\r | |
130 | };\r | |
131 | \r | |
132 | #define CB_TAG_MAINBOARD 0x0003\r | |
133 | \r | |
134 | struct cb_mainboard {\r | |
135 | UINT32 tag;\r | |
136 | UINT32 size;\r | |
137 | UINT8 vendor_idx;\r | |
138 | UINT8 part_number_idx;\r | |
139 | UINT8 strings[0];\r | |
140 | };\r | |
141 | #define CB_TAG_VERSION 0x0004\r | |
142 | #define CB_TAG_EXTRA_VERSION 0x0005\r | |
143 | #define CB_TAG_BUILD 0x0006\r | |
144 | #define CB_TAG_COMPILE_TIME 0x0007\r | |
145 | #define CB_TAG_COMPILE_BY 0x0008\r | |
146 | #define CB_TAG_COMPILE_HOST 0x0009\r | |
147 | #define CB_TAG_COMPILE_DOMAIN 0x000a\r | |
148 | #define CB_TAG_COMPILER 0x000b\r | |
149 | #define CB_TAG_LINKER 0x000c\r | |
150 | #define CB_TAG_ASSEMBLER 0x000d\r | |
151 | \r | |
152 | struct cb_string {\r | |
153 | UINT32 tag;\r | |
154 | UINT32 size;\r | |
155 | UINT8 string[0];\r | |
156 | };\r | |
157 | \r | |
158 | #define CB_TAG_SERIAL 0x000f\r | |
159 | \r | |
160 | struct cb_serial {\r | |
161 | UINT32 tag;\r | |
162 | UINT32 size;\r | |
163 | #define CB_SERIAL_TYPE_IO_MAPPED 1\r | |
164 | #define CB_SERIAL_TYPE_MEMORY_MAPPED 2\r | |
165 | UINT32 type;\r | |
166 | UINT32 baseaddr;\r | |
167 | UINT32 baud;\r | |
24ca2f35 LL |
168 | UINT32 regwidth; |
169 | ||
170 | // Crystal or input frequency to the chip containing the UART. | |
171 | // Provide the board specific details to allow the payload to | |
172 | // initialize the chip containing the UART and make independent | |
173 | // decisions as to which dividers to select and their values | |
174 | // to eventually arrive at the desired console baud-rate. | |
175 | UINT32 input_hertz; | |
176 | ||
177 | // UART PCI address: bus, device, function | |
178 | // 1 << 31 - Valid bit, PCI UART in use | |
179 | // Bus << 20 | |
180 | // Device << 15 | |
181 | // Function << 12 | |
182 | UINT32 uart_pci_addr; | |
fce4ecd9 MM |
183 | };\r |
184 | \r | |
185 | #define CB_TAG_CONSOLE 0x00010\r | |
186 | \r | |
187 | struct cb_console {\r | |
188 | UINT32 tag;\r | |
189 | UINT32 size;\r | |
190 | UINT16 type;\r | |
191 | };\r | |
192 | \r | |
193 | #define CB_TAG_CONSOLE_SERIAL8250 0\r | |
194 | #define CB_TAG_CONSOLE_VGA 1 // OBSOLETE\r | |
195 | #define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE\r | |
196 | #define CB_TAG_CONSOLE_LOGBUF 3\r | |
197 | #define CB_TAG_CONSOLE_SROM 4 // OBSOLETE\r | |
198 | #define CB_TAG_CONSOLE_EHCI 5\r | |
199 | \r | |
200 | #define CB_TAG_FORWARD 0x00011\r | |
201 | \r | |
202 | struct cb_forward {\r | |
203 | UINT32 tag;\r | |
204 | UINT32 size;\r | |
205 | UINT64 forward;\r | |
206 | };\r | |
207 | \r | |
208 | #define CB_TAG_FRAMEBUFFER 0x0012\r | |
209 | struct cb_framebuffer {\r | |
210 | UINT32 tag;\r | |
211 | UINT32 size;\r | |
212 | \r | |
213 | UINT64 physical_address;\r | |
214 | UINT32 x_resolution;\r | |
215 | UINT32 y_resolution;\r | |
216 | UINT32 bytes_per_line;\r | |
217 | UINT8 bits_per_pixel;\r | |
218 | UINT8 red_mask_pos;\r | |
219 | UINT8 red_mask_size;\r | |
220 | UINT8 green_mask_pos;\r | |
221 | UINT8 green_mask_size;\r | |
222 | UINT8 blue_mask_pos;\r | |
223 | UINT8 blue_mask_size;\r | |
224 | UINT8 reserved_mask_pos;\r | |
225 | UINT8 reserved_mask_size;\r | |
226 | };\r | |
227 | \r | |
228 | #define CB_TAG_VDAT 0x0015\r | |
229 | struct cb_vdat {\r | |
230 | UINT32 tag;\r | |
231 | UINT32 size; /* size of the entire entry */\r | |
232 | UINT64 vdat_addr;\r | |
233 | UINT32 vdat_size;\r | |
234 | };\r | |
235 | \r | |
236 | #define CB_TAG_TIMESTAMPS 0x0016\r | |
237 | #define CB_TAG_CBMEM_CONSOLE 0x0017\r | |
238 | #define CB_TAG_MRC_CACHE 0x0018\r | |
239 | struct cb_cbmem_tab {\r | |
240 | UINT32 tag;\r | |
241 | UINT32 size;\r | |
242 | UINT64 cbmem_tab;\r | |
243 | };\r | |
244 | \r | |
245 | /* Helpful macros */\r | |
246 | \r | |
247 | #define MEM_RANGE_COUNT(_rec) \\r | |
248 | (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))\r | |
249 | \r | |
250 | #define MEM_RANGE_PTR(_rec, _idx) \\r | |
251 | (void *)(((UINT8 *) (_rec)) + sizeof(*(_rec)) \\r | |
252 | + (sizeof((_rec)->map[0]) * (_idx)))\r | |
253 | \r | |
254 | \r | |
255 | #endif // _COREBOOT_PEI_H_INCLUDED_\r |