blob: d9de02235e7b7ead273d92164478e84f422cdaf3 [file] [log] [blame]
Andrey Petrov9de55cc2016-02-25 14:19:07 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Intel Corp.
5 * (Written by Andrey Petrov <andrey.petrov@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#include <arch/cpu.h>
14#include <console/console.h>
15#include <fsp/api.h>
16#include <fsp/util.h>
17#include <string.h>
Alexandru Gagniuc010225c2016-05-06 08:22:45 -070018#include <timestamp.h>
Andrey Petrov9de55cc2016-02-25 14:19:07 -080019
20struct fsp_notify_params {
21 enum fsp_notify_phase phase;
22};
23
24typedef asmlinkage enum fsp_status (*fsp_notify_fn)
25 (struct fsp_notify_params *);
26
27enum fsp_status fsp_notify(enum fsp_notify_phase phase)
28{
Alexandru Gagniuc010225c2016-05-06 08:22:45 -070029 enum fsp_status ret;
Andrey Petrov9de55cc2016-02-25 14:19:07 -080030 fsp_notify_fn fspnotify;
31 struct fsp_notify_params notify_params = { .phase = phase };
32
33 if (!fsps_hdr.silicon_init_entry_offset)
34 return FSP_NOT_FOUND;
35
36 fspnotify = (void*) (fsps_hdr.image_base +
37 fsps_hdr.notify_phase_entry_offset);
38
39 printk(BIOS_DEBUG, "FspNotify %x\n", (uint32_t) phase);
40
Alexandru Gagniuc010225c2016-05-06 08:22:45 -070041 if (phase == AFTER_PCI_ENUM)
42 timestamp_add_now(TS_FSP_BEFORE_ENUMERATE);
43 else if (phase == READY_TO_BOOT)
44 timestamp_add_now(TS_FSP_BEFORE_FINALIZE);
45
46 ret = fspnotify(&notify_params);
47
48 if (phase == AFTER_PCI_ENUM)
49 timestamp_add_now(TS_FSP_AFTER_ENUMERATE);
50 else if (phase == READY_TO_BOOT)
51 timestamp_add_now(TS_FSP_AFTER_FINALIZE);
52
53 return ret;
Andrey Petrov9de55cc2016-02-25 14:19:07 -080054}