Files
system76-coreboot/src/drivers/intel/fsp2_0/notify.c
Brandon Breitenstein c31ba0ef52 drivers/intel/fsp2_0: Make FSP Headers Consumable out of Box
The following patch is based off of the UEFI 2.6 patch. The FSP header files
are temporarily staying in soc/intel/apollolake and FspUpd.h has been relocated
since the other headers expect it to be in the root of an includable directory.
Any struct defines were removed since they are defined in the headers and no
longer need to be explicity declared as struct with the UEFI 2.6 includes.

BUG=chrome-os-partner:54100
BRANCH=none
TEST=confirmed coreboot builds successfully

Change-Id: I10739dca1b6da3f15bd850adf06238f7c51508f7
Signed-off-by: Brandon Breitenstein <brandon.breitenstein@intel.com>#
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://review.coreboot.org/16308
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-09-02 18:12:24 +02:00

88 lines
2.5 KiB
C

/*
* This file is part of the coreboot project.
*
* Copyright (C) 2015-2016 Intel Corp.
* (Written by Andrey Petrov <andrey.petrov@intel.com> for Intel Corp.)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <arch/cpu.h>
#include <bootstate.h>
#include <console/console.h>
#include <fsp/util.h>
#include <soc/intel/common/util.h>
#include <string.h>
#include <timestamp.h>
static void fsp_notify(enum fsp_notify_phase phase)
{
uint32_t ret;
fsp_notify_fn fspnotify;
struct fsp_notify_params notify_params = { .phase = phase };
if (!fsps_hdr.notify_phase_entry_offset)
die("Notify_phase_entry_offset is zero!\n");
fspnotify = (void*) (fsps_hdr.image_base +
fsps_hdr.notify_phase_entry_offset);
fsp_before_debug_notify(fspnotify, &notify_params);
if (phase == AFTER_PCI_ENUM) {
timestamp_add_now(TS_FSP_BEFORE_ENUMERATE);
post_code(POST_FSP_NOTIFY_BEFORE_ENUMERATE);
} else if (phase == READY_TO_BOOT) {
timestamp_add_now(TS_FSP_BEFORE_FINALIZE);
post_code(POST_FSP_NOTIFY_BEFORE_FINALIZE);
}
ret = fspnotify(&notify_params);
if (phase == AFTER_PCI_ENUM) {
timestamp_add_now(TS_FSP_AFTER_ENUMERATE);
post_code(POST_FSP_NOTIFY_BEFORE_ENUMERATE);
} else if (phase == READY_TO_BOOT) {
timestamp_add_now(TS_FSP_AFTER_FINALIZE);
post_code(POST_FSP_NOTIFY_BEFORE_FINALIZE);
}
fsp_debug_after_notify(ret);
/* Handle any errors returned by FspNotify */
fsp_handle_reset(ret);
if (ret != FSP_SUCCESS) {
printk(BIOS_SPEW, "FspNotify returned 0x%08x\n", ret);
die("FspNotify returned an error!\n");
}
/* Allow the platform to run something after FspNotify */
platform_fsp_notify_status(phase);
}
static void fsp_notify_dummy(void *arg)
{
enum fsp_notify_phase phase = (uint32_t)arg;
/* Display the MTRRs */
if (IS_ENABLED(CONFIG_DISPLAY_MTRRS))
soc_display_mtrrs();
fsp_notify(phase);
if (phase == READY_TO_BOOT)
fsp_notify(END_OF_FIRMWARE);
}
BOOT_STATE_INIT_ENTRY(BS_DEV_RESOURCES, BS_ON_EXIT, fsp_notify_dummy,
(void *) AFTER_PCI_ENUM);
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, fsp_notify_dummy,
(void *) READY_TO_BOOT);
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, fsp_notify_dummy,
(void *) READY_TO_BOOT);
__attribute__((weak)) void platform_fsp_notify_status(
enum fsp_notify_phase phase)
{
}