Simon Glass | 466c785 | 2019-12-06 21:42:18 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Intel */ |
| 2 | /* |
| 3 | * Copyright (C) 2015-2016 Intel Corp. |
| 4 | * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.) |
| 5 | * Mostly taken from coreboot |
| 6 | */ |
| 7 | |
| 8 | #ifndef __ASM_FSP_INTERNAL_H |
| 9 | #define __ASM_FSP_INTERNAL_H |
| 10 | |
| 11 | struct binman_entry; |
| 12 | struct fsp_header; |
| 13 | struct fspm_upd; |
| 14 | struct fsps_upd; |
| 15 | |
| 16 | enum fsp_type_t { |
| 17 | FSP_M, |
| 18 | FSP_S, |
| 19 | }; |
| 20 | |
| 21 | int fsp_get_header(ulong offset, ulong size, bool use_spi_flash, |
| 22 | struct fsp_header **fspp); |
| 23 | |
| 24 | /** |
| 25 | * fsp_locate_fsp() - Locate an FSP component |
| 26 | * |
| 27 | * This finds an FSP component by various methods. It is not as general-purpose |
| 28 | * as it looks, since it expects FSP-M to be requested in SPL (only), and FSP-S |
| 29 | * to be requested in U-Boot proper. |
| 30 | * |
| 31 | * @type: Component to locate |
| 32 | * @entry: Returns location of component |
| 33 | * @use_spi_flash: true to read using the Fast SPI driver, false to use |
| 34 | * memory-mapped SPI flash |
| 35 | * @devp: Returns northbridge device |
| 36 | * @hdrp: Returns FSP header |
| 37 | * @rom_offsetp: If non-NULL, returns the offset to add to any image position to |
| 38 | * find the memory-mapped location of that position. For example, for ROM |
| 39 | * position 0x1000, it will be mapped into 0x1000 + *rom_offsetp. |
| 40 | */ |
| 41 | int fsp_locate_fsp(enum fsp_type_t type, struct binman_entry *entry, |
| 42 | bool use_spi_flash, struct udevice **devp, |
| 43 | struct fsp_header **hdrp, ulong *rom_offsetp); |
| 44 | |
| 45 | /** |
| 46 | * arch_fsps_preinit() - Perform init needed before calling FSP-S |
| 47 | * |
| 48 | * This allows use of probed drivers and PCI so is a convenient place to do any |
| 49 | * init that is needed before FSP-S is called. After this, U-Boot relocates and |
| 50 | * calls arch_fsp_init_r() before PCI is probed, and that function is not |
| 51 | * allowed to probe PCI before calling FSP-S. |
| 52 | */ |
| 53 | int arch_fsps_preinit(void); |
| 54 | |
| 55 | /** |
| 56 | * fspm_update_config() - Set up the config structure for FSP-M |
| 57 | * |
| 58 | * @dev: Hostbridge device containing config |
| 59 | * @upd: Config data to fill in |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 60 | * Return: 0 if OK, -ENOENT if OK but no MRC-cache data was found, other -ve on |
Simon Glass | 1d2a334 | 2020-07-09 18:43:17 -0600 | [diff] [blame] | 61 | * error |
Simon Glass | 466c785 | 2019-12-06 21:42:18 -0700 | [diff] [blame] | 62 | */ |
| 63 | int fspm_update_config(struct udevice *dev, struct fspm_upd *upd); |
| 64 | |
| 65 | /** |
| 66 | * fspm_done() - Indicate that memory init is complete |
| 67 | * |
| 68 | * This allows the board to do whatever post-init it needs before things |
| 69 | * continue. |
| 70 | * |
| 71 | * @dev: Hostbridge device |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 72 | * Return: 0 if OK, -ve on error |
Simon Glass | 466c785 | 2019-12-06 21:42:18 -0700 | [diff] [blame] | 73 | */ |
| 74 | int fspm_done(struct udevice *dev); |
| 75 | |
| 76 | /** |
| 77 | * fsps_update_config() - Set up the config structure for FSP-S |
| 78 | * |
| 79 | * @dev: Hostbridge device containing config |
| 80 | * @rom_offset: Value to add to convert from ROM offset to memory-mapped address |
| 81 | * @upd: Config data to fill in |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 82 | * Return: 0 if OK, -ve on error |
Simon Glass | 466c785 | 2019-12-06 21:42:18 -0700 | [diff] [blame] | 83 | */ |
| 84 | int fsps_update_config(struct udevice *dev, ulong rom_offset, |
| 85 | struct fsps_upd *upd); |
| 86 | |
| 87 | /** |
| 88 | * prepare_mrc_cache() - Read the MRC cache into the product-data struct |
| 89 | * |
| 90 | * This looks for cached Memory-reference code (MRC) data and stores it into |
| 91 | * @upd for use by the FSP-M binary. |
| 92 | * |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 93 | * Return: 0 if OK, -ENOENT if no data (whereupon the caller can continue and |
Simon Glass | 466c785 | 2019-12-06 21:42:18 -0700 | [diff] [blame] | 94 | * expect a slower boot), other -ve value on other error |
| 95 | */ |
| 96 | int prepare_mrc_cache(struct fspm_upd *upd); |
| 97 | |
| 98 | #endif |