Andrey Petrov | 9de55cc | 2016-02-25 14:19:07 -0800 | [diff] [blame] | 1 | /* |
| 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 Gagniuc | 010225c | 2016-05-06 08:22:45 -0700 | [diff] [blame^] | 18 | #include <timestamp.h> |
Andrey Petrov | 9de55cc | 2016-02-25 14:19:07 -0800 | [diff] [blame] | 19 | |
| 20 | struct fsp_notify_params { |
| 21 | enum fsp_notify_phase phase; |
| 22 | }; |
| 23 | |
| 24 | typedef asmlinkage enum fsp_status (*fsp_notify_fn) |
| 25 | (struct fsp_notify_params *); |
| 26 | |
| 27 | enum fsp_status fsp_notify(enum fsp_notify_phase phase) |
| 28 | { |
Alexandru Gagniuc | 010225c | 2016-05-06 08:22:45 -0700 | [diff] [blame^] | 29 | enum fsp_status ret; |
Andrey Petrov | 9de55cc | 2016-02-25 14:19:07 -0800 | [diff] [blame] | 30 | 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 Gagniuc | 010225c | 2016-05-06 08:22:45 -0700 | [diff] [blame^] | 41 | 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(¬ify_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 Petrov | 9de55cc | 2016-02-25 14:19:07 -0800 | [diff] [blame] | 54 | } |