blob: 23fa008ecf9c4ff24c5bf9d98a1f0f40270f9d78 [file] [log] [blame]
Kyösti Mälkki967d94d2016-11-22 11:52:14 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +02005 * Copyright (C) 2017 Kyösti Mälkki
Kyösti Mälkki967d94d2016-11-22 11:52:14 +02006 *
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; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020017#include <console/console.h>
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020018#include <cpu/amd/car.h>
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020019
20#include <northbridge/amd/agesa/agesawrapper.h>
21#include <northbridge/amd/agesa/state_machine.h>
22#include <northbridge/amd/agesa/agesa_helper.h>
23
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020024#include <sb_cimx.h>
25
Kyösti Mälkki13cf1352016-11-21 07:37:13 +020026void asmlinkage early_all_cores(void)
27{
28 amd_initmmio();
29}
30
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020031void platform_once(struct sysinfo *cb)
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020032{
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020033 sb_Poweron_Init();
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020034
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020035 board_BeforeAgesa(cb);
36}
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020037
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020038void agesa_main(struct sysinfo *cb)
39{
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020040 post_code(0x37);
41 agesawrapper_amdinitreset();
42
43 post_code(0x39);
44 agesawrapper_amdinitearly();
45
Kyösti Mälkkidf7ff312016-11-25 12:02:00 +020046 if (!cb->s3resume) {
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020047 printk(BIOS_INFO, "Normal boot\n");
48
49 post_code(0x40);
50 agesawrapper_amdinitpost();
Kyösti Mälkkiba22e152016-11-23 06:47:15 +020051 } else {
52 printk(BIOS_INFO, "S3 detected\n");
53
54 post_code(0x60);
55 agesawrapper_amdinitresume();
56 }
57}
58
59void agesa_postcar(struct sysinfo *cb)
60{
61 if (!cb->s3resume) {
62 printk(BIOS_INFO, "Normal boot postcar\n");
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020063
64 post_code(0x41);
65 agesawrapper_amdinitenv();
66
67 post_code(0x42);
68 amd_initenv();
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020069 } else {
Kyösti Mälkkiba22e152016-11-23 06:47:15 +020070 printk(BIOS_INFO, "S3 resume postcar\n");
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020071
72 post_code(0x61);
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020073 agesawrapper_amds3laterestore();
74
75 post_code(0x62);
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020076 }
Kyösti Mälkki967d94d2016-11-22 11:52:14 +020077}