blob: 677cd36545ed047379d7f02e5a1e71a612afdda0 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +00002
3/**
4 * @file post_codes.h
Martin Roth25078202015-01-06 21:05:23 -07005 */
6
7/*
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +00008 * This aims to be a central point for POST codes used throughout coreboot.
9 * All POST codes should be declared here as macros, and post_code() should
10 * be used with the macros instead of hardcoded values. This allows us to
Martin Roth0cb07e32013-07-09 21:46:01 -060011 * quickly reference POST codes when nothing is working
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070012 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000013 * The format for a POST code macro is
14 * #define POST_WHAT_WE_COMMUNICATE_IS_HAPPENING_WHEN_THIS_CODE_IS_POSTED
15 * Lets's keep it at POST_* instead of POST_CODE_*
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070016 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000017 * This file is also included by early assembly files. Only use #define s;
18 * no function prototypes allowed here
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070019 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000020 * DOCUMENTATION:
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070021 * Please document any and all post codes using Doxygen style comments. We
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000022 * want to be able to generate a verbose enough documentation that is useful
23 * during debugging. Failure to do so will result in your patch being rejected
24 * without any explanation or effort on part of the maintainers.
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070025 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000026 */
Martin Roth25078202015-01-06 21:05:23 -070027
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000028#ifndef POST_CODES_H
29#define POST_CODES_H
30
31/**
32 * \brief Entry into 'crt0.s'. reset code jumps to here
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070033 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000034 * First instruction that gets executed after the reset vector jumps.
35 * This indicates that the reset vector points to the correct code segment.
36 */
37#define POST_RESET_VECTOR_CORRECT 0x01
38
39/**
40 * \brief Entry into protected mode
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070041 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000042 * Preparing to enter protected mode. This is POSTed right before changing to
43 * protected mode.
44 */
45#define POST_ENTER_PROTECTED_MODE 0x10
46
47/**
48 * \brief Start copying coreboot to RAM with decompression if compressed
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070049 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000050 * POSTed before ramstage is about to be loaded into memory
51 */
Lee Leahy84d20d02017-03-07 15:00:18 -080052#define POST_PREPARE_RAMSTAGE 0x11
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000053
54/**
55 * \brief Copy/decompression finished; jumping to RAM
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070056 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000057 * This is called after ramstage is loaded in memory, and before
58 * the code jumps there. This represents the end of romstage.
59 */
60#define POST_RAMSTAGE_IS_PREPARED 0x12
61
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000062/**
63 * \brief Entry into c_start
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070064 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000065 * c_start.S is the first code executing in ramstage.
66 */
67#define POST_ENTRY_C_START 0x13
68
69/**
Furquan Shaikh97063592018-10-16 11:49:16 -070070 * \brief Pre-memory init preparation start
71 *
72 * Post code emitted in romstage before making callbacks to allow SoC/mainboard
73 * to prepare params for FSP memory init.
74 */
75#define POST_MEM_PREINIT_PREP_START 0x34
76
77/**
78 * \brief Pre-memory init preparation end
79 *
80 * Post code emitted in romstage after returning from SoC/mainboard callbacks
81 * to prepare params for FSP memory init.
82 */
83#define POST_MEM_PREINIT_PREP_END 0x36
84
85/**
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000086 * \brief Console is initialized
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070087 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000088 * The console is initialized and is ready for usage
89 */
90#define POST_CONSOLE_READY 0x39
91
92/**
93 * \brief Console boot message succeeded
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070094 *
Martin Roth0cb07e32013-07-09 21:46:01 -060095 * First console message has been successfully sent through the console backend
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +000096 * driver.
97 */
98#define POST_CONSOLE_BOOT_MSG 0x40
99
100/**
Vikram Narayanan0713ca32012-01-23 01:44:44 +0530101 * \brief Before enabling the cache
102 *
103 * Going to enable the cache
104 */
105#define POST_ENABLING_CACHE 0x60
106
107/**
Duncan Lauriecb73a842013-06-10 10:41:04 -0700108 * \brief Before Device Probe
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700109 *
Duncan Lauriecb73a842013-06-10 10:41:04 -0700110 * Boot State Machine: bs_pre_device()
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000111 */
Duncan Lauriecb73a842013-06-10 10:41:04 -0700112#define POST_BS_PRE_DEVICE 0x70
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000113
114/**
Duncan Lauriecb73a842013-06-10 10:41:04 -0700115 * \brief Initializing Chips
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700116 *
Duncan Lauriecb73a842013-06-10 10:41:04 -0700117 * Boot State Machine: bs_dev_init_chips()
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000118 */
Duncan Lauriecb73a842013-06-10 10:41:04 -0700119#define POST_BS_DEV_INIT_CHIPS 0x71
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000120
121/**
Duncan Lauriecb73a842013-06-10 10:41:04 -0700122 * \brief Starting Device Enumeration
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700123 *
Duncan Lauriecb73a842013-06-10 10:41:04 -0700124 * Boot State Machine: bs_dev_enumerate()
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000125 */
Duncan Lauriecb73a842013-06-10 10:41:04 -0700126#define POST_BS_DEV_ENUMERATE 0x72
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000127
128/**
Elyes HAOUAS5f73e222020-01-15 21:13:45 +0100129 * \brief Device Resource Allocation
Stefan Reinauer52095f52012-08-07 13:14:20 -0700130 *
Duncan Lauriecb73a842013-06-10 10:41:04 -0700131 * Boot State Machine: bs_dev_resources()
Stefan Reinauer52095f52012-08-07 13:14:20 -0700132 */
Duncan Lauriecb73a842013-06-10 10:41:04 -0700133#define POST_BS_DEV_RESOURCES 0x73
134
135/**
136 * \brief Device Enable
137 *
138 * Boot State Machine: bs_dev_enable()
139 */
140#define POST_BS_DEV_ENABLE 0x74
141
142/**
143 * \brief Device Initialization
144 *
145 * Boot State Machine: bs_dev_init()
146 */
147#define POST_BS_DEV_INIT 0x75
148
149/**
150 * \brief After Device Probe
151 *
152 * Boot State Machine: bs_post_device()
153 */
154#define POST_BS_POST_DEVICE 0x76
155
156/**
157 * \brief OS Resume Check
158 *
159 * Boot State Machine: bs_os_resume_check()
160 */
161#define POST_BS_OS_RESUME_CHECK 0x77
162
163/**
164 * \brief OS Resume
165 *
166 * Boot State Machine: bs_os_resume()
167 */
168#define POST_BS_OS_RESUME 0x78
169
170/**
171 * \brief Write Tables
172 *
173 * Boot State Machine: bs_write_tables()
174 */
175#define POST_BS_WRITE_TABLES 0x79
176
177/**
Sindhoor Tilake5f25ce2020-06-19 20:46:40 -0400178 * \brief Pre call to RAM stage main()
179 *
180 * POSTed right before RAM stage main() is called from c_start.S
181 */
182#define POST_PRE_HARDWAREMAIN 0x79
183
184/**
Duncan Lauriecb73a842013-06-10 10:41:04 -0700185 * \brief Load Payload
186 *
187 * Boot State Machine: bs_payload_load()
188 */
189#define POST_BS_PAYLOAD_LOAD 0x7a
190
191/**
192 * \brief Boot Payload
193 *
194 * Boot State Machine: bs_payload_boot()
195 */
196#define POST_BS_PAYLOAD_BOOT 0x7b
Stefan Reinauer52095f52012-08-07 13:14:20 -0700197
198/**
Subrata Banika2cf3412021-05-04 23:36:36 +0530199 * \brief Entry into coreboot in RAM stage main()
200 *
201 * This is the first call in hardwaremain.c. If this code is POSTed, then
202 * ramstage has successfully loaded and started executing.
203 */
204#define POST_ENTRY_RAMSTAGE 0x80
205
206/**
Aaron Durbin96b3c6f2016-11-10 21:09:25 -0600207 * \brief Before calling FSP Notify before End of Firmware
208 *
209 * Going to call into FSP binary for Notify phase
210 */
211#define POST_FSP_NOTIFY_BEFORE_END_OF_FIRMWARE 0x88
212
213/**
214 * \brief Before calling FSP Notify after End of Firmware
215 *
216 * Going to call into FSP binary for Notify phase
217 */
218#define POST_FSP_NOTIFY_AFTER_END_OF_FIRMWARE 0x89
219
220/**
Duncan Lauriefb509832015-11-22 14:53:57 -0800221 * \brief Before calling FSP TempRamInit
222 *
223 * Going to call into FSP binary for TempRamInit phase
224 */
225#define POST_FSP_TEMP_RAM_INIT 0x90
226
227/**
228 * \brief Before calling FSP TempRamExit
229 *
230 * Going to call into FSP binary for TempRamExit phase
231 */
232#define POST_FSP_TEMP_RAM_EXIT 0x91
233
234/**
235 * \brief Before calling FSP MemoryInit
236 *
237 * Going to call into FSP binary for MemoryInit phase
238 */
239#define POST_FSP_MEMORY_INIT 0x92
240
241/**
242 * \brief Before calling FSP SiliconInit
243 *
244 * Going to call into FSP binary for SiliconInit phase
245 */
246#define POST_FSP_SILICON_INIT 0x93
247
248/**
249 * \brief Before calling FSP Notify before resource allocation
250 *
251 * Going to call into FSP binary for Notify phase
252 */
253#define POST_FSP_NOTIFY_BEFORE_ENUMERATE 0x94
254
255/**
256 * \brief Before calling FSP Notify before finalize
257 *
258 * Going to call into FSP binary for Notify phase
259 */
260#define POST_FSP_NOTIFY_BEFORE_FINALIZE 0x95
261
262/**
Hannah Williams4cff1d52016-06-08 14:29:47 -0700263 * \brief Indicate OS _PTS entry
264 *
265 * Called from _PTS asl method
266 */
267#define POST_OS_ENTER_PTS 0x96
268
269/**
270 * \brief Indicate OS _WAK entry
271 *
272 * Called from within _WAK method
273 */
274#define POST_OS_ENTER_WAKE 0x97
275
276/**
Subrata Banik0755ab92017-07-12 15:31:06 +0530277 * \brief After calling FSP MemoryInit
278 *
279 * FSP binary returned from MemoryInit phase
280 */
281#define POST_FSP_MEMORY_EXIT 0x98
282
283/**
284 * \brief After calling FSP SiliconInit
285 *
286 * FSP binary returned from SiliconInit phase
287 */
288#define POST_FSP_SILICON_EXIT 0x99
289
290/**
Subrata Banik33d9c4a2020-05-26 18:26:54 +0530291 * \brief Before calling FSP Multiphase SiliconInit
292 *
293 * Going to call into FSP binary for Multiple phase SI Init
294 */
295#define POST_FSP_MULTI_PHASE_SI_INIT_ENTRY 0xa0
296
297/**
298 * \brief After calling FSP Multiphase SiliconInit
299 *
300 * FSP binary returned from Multiple phase SI Init
301 */
302#define POST_FSP_MULTI_PHASE_SI_INIT_EXIT 0xa1
303
304/**
Keith Short70064582019-05-06 16:12:57 -0600305 * \brief Invalid or corrupt ROM
306 *
307 * Set if firmware failed to find or validate a resource that is stored in ROM.
308 */
309#define POST_INVALID_ROM 0xe0
310
311/**
Keith Short1835bf02019-05-16 11:46:27 -0600312 * \brief Invalid or corrupt CBFS
313 *
314 * Set if firmware failed to find or validate a resource that is stored in CBFS.
315 */
316#define POST_INVALID_CBFS 0xe1
317
318/**
Keith Shortbb41aba2019-05-16 14:07:43 -0600319 * \brief Vendor binary error
320 *
321 * Set if firmware failed to find or validate a vendor binary, or the binary
322 * generated a fatal error.
323 */
324#define POST_INVALID_VENDOR_BINARY 0xe2
325
326/**
Keith Short24302632019-05-16 14:08:31 -0600327 * \brief RAM failure
328 *
329 * Set if RAM could not be initialized. This includes RAM is missing,
330 * unsupported RAM configuration, or RAM failure.
331 */
332#define POST_RAM_FAILURE 0xe3
333
334/**
Keith Short15588b02019-05-09 11:40:34 -0600335 * \brief Hardware initialization failure
336 *
337 * Set when a required hardware component was not found or is unsupported.
338 */
339#define POST_HW_INIT_FAILURE 0xe4
340
341/**
Keith Shortc58e3bd2019-05-10 11:14:31 -0600342 * \brief Video failure
343 *
344 * Video subsystem failed to initialize.
345 */
346#define POST_VIDEO_FAILURE 0xe5
347
348/**
Duncan Laurie4397aa12014-05-12 10:22:01 -0700349 * \brief TPM failure
350 *
Elyes HAOUAS5f73e222020-01-15 21:13:45 +0100351 * An error with the TPM, either unexpected state or communications failure.
Duncan Laurie4397aa12014-05-12 10:22:01 -0700352 */
353#define POST_TPM_FAILURE 0xed
354
355/**
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000356 * \brief Not supposed to get here
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700357 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000358 * A function that should not have returned, returned
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700359 *
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000360 * Check the console output for details.
361 */
362#define POST_DEAD_CODE 0xee
363
364/**
Duncan Laurie727b5452013-08-08 16:28:41 -0700365 * \brief Resume from suspend failed
366 *
367 * This post code is sent when the firmware is expected to resume it is
368 * unable to do so.
369 */
370#define POST_RESUME_FAILURE 0xef
371
372/**
Sindhoor Tilake5f25ce2020-06-19 20:46:40 -0400373 * \brief Jumping to payload
374 *
375 * Called right before jumping to a payload. If the boot sequence stops with
376 * this code, chances are the payload freezes.
377 */
378#define POST_JUMPING_TO_PAYLOAD 0xf3
379
380/**
381 * \brief Entry into elf boot
382 *
383 * This POST code is called right before invoking jmp_to_elf_entry()
384 * jmp_to_elf_entry() invokes the payload, and should never return
385 */
386#define POST_ENTER_ELF_BOOT 0xf8
387
388/**
Duncan Laurie04c5bae2012-08-13 09:37:42 -0700389 * \brief Final code before OS resumes
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700390 *
Duncan Laurie04c5bae2012-08-13 09:37:42 -0700391 * Called right before jumping to the OS resume vector.
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000392 */
Duncan Laurie04c5bae2012-08-13 09:37:42 -0700393#define POST_OS_RESUME 0xfd
394
395/**
396 * \brief Final code before OS boots
397 *
398 * This may not be called depending on the payload used.
399 */
400#define POST_OS_BOOT 0xfe
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000401
402/**
403 * \brief Elfload fail or die() called
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700404 *
Martin Rothe18e6422017-06-03 20:03:18 -0600405 * coreboot was not able to load the payload, no payload was detected
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700406 * or die() was called.
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000407 * \n
408 * If this code appears before entering ramstage, then most likely
409 * ramstage is corrupted, and reflashing of the ROM chip is needed.
410 * \n
411 * If this code appears after ramstage, there is a problem with the payload
412 * If the payload was built out-of-tree, check that it was compiled as
413 * a coreboot payload
414 * \n
Martin Roth2ed0aa22016-01-05 20:58:58 -0700415 * Check the console output to see exactly where the failure occurred.
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000416 */
Lee Leahy84d20d02017-03-07 15:00:18 -0800417#define POST_DIE 0xff
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000418
Martin Rothfd277d82016-01-11 12:47:30 -0700419#endif /* POST_CODES_H */