Kyösti Mälkki | df7ff31 | 2016-11-25 12:02:00 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2017 Kyösti Mälkki |
| 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; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #include <arch/acpi.h> |
| 17 | #include <arch/cpu.h> |
| 18 | #include <cpu/amd/car.h> |
| 19 | #include <cpu/x86/bist.h> |
| 20 | #include <console/console.h> |
| 21 | #include <smp/node.h> |
| 22 | #include <string.h> |
| 23 | #include <northbridge/amd/agesa/state_machine.h> |
| 24 | |
| 25 | static void fill_sysinfo(struct sysinfo *cb) |
| 26 | { |
| 27 | memset(cb, 0, sizeof(*cb)); |
| 28 | cb->s3resume = acpi_is_wakeup_s3(); |
| 29 | } |
| 30 | |
| 31 | void * asmlinkage romstage_main(unsigned long bist) |
| 32 | { |
| 33 | struct sysinfo romstage_state; |
| 34 | struct sysinfo *cb = &romstage_state; |
| 35 | u8 initial_apic_id = (u8) (cpuid_ebx(1) >> 24); |
| 36 | |
| 37 | fill_sysinfo(cb); |
| 38 | |
| 39 | if ((initial_apic_id == 0) && boot_cpu()) { |
| 40 | |
| 41 | platform_once(cb); |
| 42 | |
| 43 | console_init(); |
| 44 | } |
| 45 | |
| 46 | printk(BIOS_DEBUG, "APIC %02d: CPU Family_Model = %08x\n", |
| 47 | initial_apic_id, cpuid_eax(1)); |
| 48 | |
| 49 | /* Halt if there was a built in self test failure */ |
| 50 | report_bist_failure(bist); |
| 51 | |
| 52 | agesa_main(cb); |
| 53 | |
| 54 | /* Not reached */ |
| 55 | return NULL; |
| 56 | } |