Lee Leahy | e6f2f74 | 2016-07-21 09:48:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2016 Intel Corp. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <arch/cpu.h> |
| 13 | #include <console/console.h> |
| 14 | #include <fsp/util.h> |
| 15 | #include <lib.h> |
| 16 | |
| 17 | void fsp_display_upd_value(const char *name, size_t size, uint64_t old, |
| 18 | uint64_t new) |
| 19 | { |
| 20 | size *= 2; |
| 21 | if (old == new) { |
| 22 | printk(BIOS_SPEW, " 0x%0*llx: %s\n", size, new, name); |
| 23 | } else { |
| 24 | printk(BIOS_SPEW, " 0x%0*llx --> 0x%0*llx: %s\n", size, old, |
| 25 | size, new, name); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | static void fspm_display_arch_params(const struct FSPM_ARCH_UPD *old, |
| 30 | const struct FSPM_ARCH_UPD *new) |
| 31 | { |
| 32 | /* Display the architectural parameters for MemoryInit */ |
| 33 | printk(BIOS_SPEW, "Architectural UPD values for MemoryInit at: 0x%p\n", |
| 34 | new); |
| 35 | fsp_display_upd_value("Revision", sizeof(old->Revision), |
| 36 | old->Revision, new->Revision); |
| 37 | fsp_display_upd_value("NvsBufferPtr", sizeof(old->NvsBufferPtr), |
| 38 | (uintptr_t)old->NvsBufferPtr, |
| 39 | (uintptr_t)new->NvsBufferPtr); |
| 40 | fsp_display_upd_value("StackBase", sizeof(old->StackBase), |
| 41 | (uintptr_t)old->StackBase, |
| 42 | (uintptr_t)new->StackBase); |
| 43 | fsp_display_upd_value("StackSize", sizeof(old->StackSize), |
| 44 | old->StackSize, new->StackSize); |
| 45 | fsp_display_upd_value("BootLoaderTolumSize", |
| 46 | sizeof(old->BootLoaderTolumSize), |
| 47 | old->BootLoaderTolumSize, new->BootLoaderTolumSize); |
| 48 | fsp_display_upd_value("BootMode", sizeof(old->BootMode), |
| 49 | old->BootMode, new->BootMode); |
| 50 | } |
| 51 | |
| 52 | /* Display the UPD parameters for MemoryInit */ |
| 53 | __attribute__((weak)) void soc_display_fspm_upd_params( |
| 54 | const struct FSPM_UPD *fspm_old_upd, |
| 55 | const struct FSPM_UPD *fspm_new_upd) |
| 56 | { |
| 57 | printk(BIOS_SPEW, "UPD values for MemoryInit:\n"); |
| 58 | hexdump(fspm_new_upd, sizeof(*fspm_new_upd)); |
| 59 | } |
| 60 | |
| 61 | void fspm_display_upd_values(const struct FSPM_UPD *old, |
| 62 | const struct FSPM_UPD *new) |
| 63 | { |
| 64 | /* Display the UPD data */ |
| 65 | fspm_display_arch_params(&old->FspmArchUpd, &new->FspmArchUpd); |
| 66 | soc_display_fspm_upd_params(old, new); |
| 67 | } |
| 68 | |
| 69 | /* Display the UPD parameters for SiliconInit */ |
| 70 | __attribute__((weak)) void soc_display_fsps_upd_params( |
| 71 | const struct FSPS_UPD *fsps_old_upd, |
| 72 | const struct FSPS_UPD *fsps_new_upd) |
| 73 | { |
| 74 | printk(BIOS_SPEW, "UPD values for SiliconInit:\n"); |
| 75 | hexdump(fsps_new_upd, sizeof(*fsps_new_upd)); |
| 76 | } |