Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013, Intel Corporation |
| 3 | * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: Intel |
| 6 | */ |
| 7 | |
| 8 | #ifndef __FSP_API_H__ |
| 9 | #define __FSP_API_H__ |
| 10 | |
Simon Glass | 457191e | 2015-01-27 22:13:37 -0700 | [diff] [blame] | 11 | #include <linux/linkage.h> |
| 12 | |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 13 | /* |
Bin Meng | a0c94dc | 2015-12-10 22:02:59 -0800 | [diff] [blame] | 14 | * FSP common configuration structure. |
| 15 | * This needs to be included in the platform-specific struct fsp_config_data. |
| 16 | */ |
| 17 | struct fsp_cfg_common { |
| 18 | struct fsp_header *fsp_hdr; |
| 19 | u32 stack_top; |
| 20 | u32 boot_mode; |
| 21 | }; |
| 22 | |
| 23 | /* |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 24 | * FspInit continuation function prototype. |
| 25 | * Control will be returned to this callback function after FspInit API call. |
| 26 | */ |
| 27 | typedef void (*fsp_continuation_f)(u32 status, void *hob_list); |
| 28 | |
Bin Meng | db60d86 | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 29 | struct fsp_init_params { |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 30 | /* Non-volatile storage buffer pointer */ |
| 31 | void *nvs_buf; |
| 32 | /* Runtime buffer pointer */ |
| 33 | void *rt_buf; |
| 34 | /* Continuation function address */ |
| 35 | fsp_continuation_f continuation; |
| 36 | }; |
| 37 | |
Bin Meng | db60d86 | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 38 | struct common_buf { |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 39 | /* |
| 40 | * Stack top pointer used by the bootloader. The new stack frame will be |
| 41 | * set up at this location after FspInit API call. |
| 42 | */ |
Bin Meng | 40745a0 | 2015-12-10 22:02:57 -0800 | [diff] [blame] | 43 | u32 stack_top; |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 44 | u32 boot_mode; /* Current system boot mode */ |
| 45 | void *upd_data; /* User platform configuraiton data region */ |
| 46 | u32 reserved[7]; /* Reserved */ |
| 47 | }; |
| 48 | |
Bin Meng | db60d86 | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 49 | enum fsp_phase { |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 50 | /* Notification code for post PCI enuermation */ |
| 51 | INIT_PHASE_PCI = 0x20, |
| 52 | /* Notification code before transfering control to the payload */ |
| 53 | INIT_PHASE_BOOT = 0x40 |
| 54 | }; |
| 55 | |
Bin Meng | db60d86 | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 56 | struct fsp_notify_params { |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 57 | /* Notification phase used for NotifyPhase API */ |
Bin Meng | db60d86 | 2014-12-17 15:50:49 +0800 | [diff] [blame] | 58 | enum fsp_phase phase; |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 59 | }; |
| 60 | |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 61 | /* FspInit API function prototype */ |
Simon Glass | 457191e | 2015-01-27 22:13:37 -0700 | [diff] [blame] | 62 | typedef asmlinkage u32 (*fsp_init_f)(struct fsp_init_params *params); |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 63 | |
| 64 | /* FspNotify API function prototype */ |
Simon Glass | 457191e | 2015-01-27 22:13:37 -0700 | [diff] [blame] | 65 | typedef asmlinkage u32 (*fsp_notify_f)(struct fsp_notify_params *params); |
Bin Meng | 2922b3e | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 66 | |
| 67 | #endif |