Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Advanced Micro Devices, Inc. |
| 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. |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <arch/acpi.h> |
| 17 | #include <bootstate.h> |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 18 | |
Kyösti Mälkki | f21c2ac | 2014-10-19 09:35:18 +0300 | [diff] [blame] | 19 | #include <northbridge/amd/agesa/agesawrapper.h> |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 20 | |
Kyösti Mälkki | b6f3da4 | 2014-07-07 15:06:00 +0300 | [diff] [blame] | 21 | #if CONFIG_AMD_SB_CIMX |
| 22 | #include <sb_cimx.h> |
| 23 | #endif |
| 24 | |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 25 | static void agesawrapper_post_device(void *unused) |
| 26 | { |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 27 | if (acpi_is_wakeup_s3()) |
| 28 | return; |
| 29 | |
Kyösti Mälkki | 1aa35c6 | 2014-10-21 14:19:04 +0300 | [diff] [blame] | 30 | agesawrapper_amdinitlate(); |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 31 | |
Kyösti Mälkki | b6f3da4 | 2014-07-07 15:06:00 +0300 | [diff] [blame] | 32 | #if CONFIG_AMD_SB_CIMX |
| 33 | sb_Late_Post(); |
| 34 | #endif |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 35 | if (!acpi_s3_resume_allowed()) |
| 36 | return; |
| 37 | |
Kyösti Mälkki | 1aa35c6 | 2014-10-21 14:19:04 +0300 | [diff] [blame] | 38 | agesawrapper_amdS3Save(); |
Kyösti Mälkki | 005028e | 2014-06-19 23:12:15 +0300 | [diff] [blame] | 39 | } |
| 40 | |
Aaron Durbin | 9ef9d85 | 2015-03-16 17:30:09 -0500 | [diff] [blame] | 41 | BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_EXIT, |
| 42 | agesawrapper_post_device, NULL); |