Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Lee Leahy | 47bd2d9 | 2016-07-24 18:12:16 -0700 | [diff] [blame] | 4 | * Copyright (C) 2015-2016 Intel Corp. |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 5 | * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.) |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _FSP2_0_API_H_ |
| 14 | #define _FSP2_0_API_H_ |
| 15 | |
| 16 | #include <stddef.h> |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 17 | #include <fsp/info_header.h> |
Andrey Petrov | 465fc13 | 2016-02-25 14:16:33 -0800 | [diff] [blame] | 18 | #include <soc/fsp/FspmUpd.h> |
| 19 | #include <soc/fsp/FspsUpd.h> |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 20 | |
| 21 | enum fsp_status { |
| 22 | FSP_SUCCESS = 0x00000000, |
Andrey Petrov | 82a6122 | 2016-06-14 12:03:15 -0700 | [diff] [blame] | 23 | FSP_STATUS_RESET_REQUIRED_COLD = 0x40000001, |
| 24 | FSP_STATUS_RESET_REQUIRED_WARM = 0x40000002, |
Andrey Petrov | 3a94a3b | 2016-07-18 00:15:41 -0700 | [diff] [blame] | 25 | FSP_STATUS_RESET_REQUIRED_3 = 0x40000003, |
| 26 | FSP_STATUS_RESET_REQUIRED_4 = 0x40000004, |
| 27 | FSP_STATUS_RESET_REQUIRED_5 = 0x40000005, |
| 28 | FSP_STATUS_RESET_REQUIRED_6 = 0x40000006, |
| 29 | FSP_STATUS_RESET_REQUIRED_7 = 0x40000007, |
| 30 | FSP_STATUS_RESET_REQUIRED_8 = 0x40000008, |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 31 | FSP_INVALID_PARAMETER = 0x80000002, |
| 32 | FSP_UNSUPPORTED = 0x80000003, |
| 33 | FSP_NOT_READY = 0x80000006, |
| 34 | FSP_DEVICE_ERROR = 0x80000007, |
| 35 | FSP_OUT_OF_RESOURCES = 0x80000009, |
| 36 | FSP_VOLUME_CORRUPTED = 0x8000000a, |
| 37 | FSP_NOT_FOUND = 0x8000000a, |
| 38 | FSP_TIMEOUT = 0x80000012, |
| 39 | FSP_ABORTED = 0x80000015, |
| 40 | FSP_INCOMPATIBLE_VERSION = 0x80000010, |
| 41 | FSP_SECURITY_VIOLATION = 0x8000001a, |
| 42 | FSP_CRC_ERROR = 0x8000001b, |
| 43 | }; |
| 44 | |
Andrey Petrov | a6dd535 | 2016-03-17 16:42:41 -0700 | [diff] [blame] | 45 | enum fsp_boot_mode { |
| 46 | FSP_BOOT_WITH_FULL_CONFIGURATION = 0x00, |
| 47 | FSP_BOOT_WITH_MINIMAL_CONFIGURATION = 0x01, |
| 48 | FSP_BOOT_ASSUMING_NO_CONFIGURATION_CHANGES = 0x02, |
| 49 | FSP_BOOT_ON_S4_RESUME = 0x05, |
| 50 | FSP_BOOT_ON_S3_RESUME = 0x11, |
| 51 | FSP_BOOT_ON_FLASH_UPDATE = 0x12, |
| 52 | FSP_BOOT_IN_RECOVERY_MODE = 0x20 |
| 53 | }; |
| 54 | |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 55 | enum fsp_notify_phase { |
| 56 | AFTER_PCI_ENUM = 0x20, |
Hannah Williams | 16f3d3d | 2016-04-29 14:40:40 -0700 | [diff] [blame] | 57 | READY_TO_BOOT = 0x40, |
| 58 | END_OF_FIRMWARE = 0xF0 |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 62 | /* Main FSP stages */ |
Aaron Durbin | d04639b | 2016-07-17 23:23:59 -0500 | [diff] [blame] | 63 | enum fsp_status fsp_memory_init(bool s3wake); |
Aaron Durbin | 32ac018 | 2016-07-18 00:35:42 -0500 | [diff] [blame] | 64 | enum fsp_status fsp_silicon_init(void); |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 65 | enum fsp_status fsp_notify(enum fsp_notify_phase phase); |
| 66 | |
| 67 | /* Callbacks for updating stage-specific parameters */ |
Andrey Petrov | 465fc13 | 2016-02-25 14:16:33 -0800 | [diff] [blame] | 68 | void platform_fsp_memory_init_params_cb(struct FSPM_UPD *mupd); |
| 69 | void platform_fsp_silicon_init_params_cb(struct FSPS_UPD *supd); |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 70 | |
| 71 | /* |
| 72 | * # DOCUMENTATION: |
| 73 | * |
| 74 | * This file defines the interface between coreboot and the FSP 2.0 wrapper |
| 75 | * fsp_memory_init(), fsp_silicon_init(), and fsp_notify() are the main entry |
| 76 | * points and map 1:1 to the FSP entry points of the same name. |
| 77 | * |
| 78 | * ### fsp_memory_init(): |
Aaron Durbin | b430250 | 2016-07-17 17:04:37 -0500 | [diff] [blame] | 79 | * - s3wake: boolean indicating if the system is waking from resume |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 80 | * |
| 81 | * This function is responsible for loading and executing the memory |
| 82 | * initialization code from the FSP-M binary. It expects this binary to reside |
| 83 | * in cbfs as FSP_M_FILE. |
| 84 | * |
Aaron Durbin | d04639b | 2016-07-17 23:23:59 -0500 | [diff] [blame] | 85 | * The function takes one parameter, which is described above, but does not |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 86 | * take in memory parameters as an argument. The memory parameters can be filled |
| 87 | * in with platform_fsp_memory_init_params_cb(). This is a callback symbol |
| 88 | * that fsp_memory_init() will call. The platform must provide this symbol. |
| 89 | * |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 90 | * |
| 91 | * ### fsp_silicon_init(): |
Andrey Petrov | b37fd67 | 2016-03-01 16:25:38 -0800 | [diff] [blame] | 92 | * |
| 93 | * This function is responsible for loading and executing the silicon |
| 94 | * initialization code from the FSP-S binary. It expects this binary to reside |
| 95 | * in cbfs as FSP_S_FILE. |
| 96 | * |
| 97 | * Like fsp_memory_init(), it provides a callback to fill in FSP-specific |
| 98 | * parameters, via platform_fsp_silicon_init_params_cb(). The platform must |
| 99 | * also provide this symbol. |
| 100 | * |
| 101 | * |
| 102 | * ### fsp_notify(): |
| 103 | * - phase: Which FSP notification phase |
| 104 | * |
| 105 | * This function is responsible for loading and executing the notify code from |
| 106 | * the FSP-S binary. It expects that fsp_silicon_init() has already been called |
| 107 | * succesfully, and that the FSP-S binary is still loaded into memory. |
| 108 | */ |
| 109 | |
| 110 | #endif /* _FSP2_0_API_H_ */ |