Load the FSP component described by fsp_load_descriptor from cbfs. The FSP * header object will be validated and filled in on successful load. */
| 135 | /* Load the FSP component described by fsp_load_descriptor from cbfs. The FSP |
| 136 | * header object will be validated and filled in on successful load. */ |
| 137 | enum cb_err fsp_load_component(struct fsp_load_descriptor *fspld, struct fsp_header *hdr) |
| 138 | { |
| 139 | size_t output_size; |
| 140 | void *dest; |
| 141 | struct prog *fsp_prog = &fspld->fsp_prog; |
| 142 | |
| 143 | dest = cbfs_alloc(prog_name(fsp_prog), fspld->alloc, fspld, &output_size); |
| 144 | if (!dest) |
| 145 | return CB_ERR; |
| 146 | |
| 147 | /* Don't allow FSP-M relocation when XIP. */ |
| 148 | if (!fspm_xip() && fsp_component_relocate((uintptr_t)dest, dest, output_size) < 0) { |
| 149 | printk(BIOS_ERR, "Unable to relocate FSP component!\n"); |
| 150 | return CB_ERR; |
| 151 | } |
| 152 | |
| 153 | prog_set_area(fsp_prog, dest, output_size); |
| 154 | |
| 155 | if (fsp_validate_component(hdr, dest, output_size) != CB_SUCCESS) { |
| 156 | printk(BIOS_ERR, "Invalid FSP header after load!\n"); |
| 157 | return CB_ERR; |
| 158 | } |
| 159 | |
| 160 | /* Signal that FSP component has been loaded. */ |
| 161 | prog_segment_loaded(hdr->image_base, hdr->image_size, SEG_FINAL); |
| 162 | |
| 163 | return CB_SUCCESS; |
| 164 | } |
| 165 | |
| 166 | /* Only call this function when FSP header has been read and validated */ |
| 167 | void fsp_get_version(char *buf) |
no test coverage detected