Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 2 | |
Kyösti Mälkki | 2446c1e | 2020-07-09 07:13:37 +0300 | [diff] [blame] | 3 | #include <amdblocks/biosram.h> |
| 4 | |
Elyes HAOUAS | 19f5ba8 | 2018-10-14 14:52:06 +0200 | [diff] [blame] | 5 | #include <Porting.h> |
| 6 | #include <AGESA.h> |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 7 | #include <northbridge/amd/agesa/state_machine.h> |
| 8 | #include <northbridge/amd/agesa/agesa_helper.h> |
| 9 | |
| 10 | void platform_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset) |
| 11 | { |
| 12 | } |
| 13 | |
| 14 | void platform_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *Early) |
| 15 | { |
| 16 | } |
| 17 | |
| 18 | void platform_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *Post) |
| 19 | { |
Kyösti Mälkki | 2b9f5b5 | 2017-03-26 11:56:43 +0300 | [diff] [blame] | 20 | AGESA_STATUS status; |
| 21 | |
Mike Banon | e7f176c | 2020-01-19 21:42:09 +0300 | [diff] [blame] | 22 | Post->MemConfig.BottomIo = (UINT16)(MIN(0xE0000000, |
| 23 | MAX(0x28000000, CONFIG_BOTTOMIO_POSITION)) >> 24) & 0xF8; |
| 24 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 25 | if (CONFIG(ENABLE_MRC_CACHE)) { |
Kyösti Mälkki | 2b9f5b5 | 2017-03-26 11:56:43 +0300 | [diff] [blame] | 26 | status = OemInitResume(&Post->MemConfig.MemContext); |
Elyes HAOUAS | 0f8b8d9 | 2019-01-03 10:23:28 +0100 | [diff] [blame] | 27 | if (status == AGESA_SUCCESS) |
Kyösti Mälkki | 2b9f5b5 | 2017-03-26 11:56:43 +0300 | [diff] [blame] | 28 | Post->MemConfig.MemRestoreCtl = 1; |
| 29 | } |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | void platform_AfterInitPost(struct sysinfo *cb, AMD_POST_PARAMS *Post) |
| 33 | { |
| 34 | backup_top_of_low_cacheable(Post->MemConfig.Sub4GCacheTop); |
| 35 | } |
| 36 | |
| 37 | void platform_BeforeInitResume(struct sysinfo *cb, AMD_RESUME_PARAMS *Resume) |
| 38 | { |
| 39 | OemInitResume(&Resume->S3DataBlock); |
| 40 | } |
| 41 | |
| 42 | void platform_AfterInitResume(struct sysinfo *cb, AMD_RESUME_PARAMS *Resume) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | void platform_BeforeInitEnv(struct sysinfo *cb, AMD_ENV_PARAMS *Env) |
| 47 | { |
| 48 | EmptyHeap(); |
| 49 | } |
| 50 | |
| 51 | void platform_AfterInitEnv(struct sysinfo *cb, AMD_ENV_PARAMS *Env) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | void platform_BeforeS3LateRestore(struct sysinfo *cb, AMD_S3LATE_PARAMS *S3Late) |
| 56 | { |
| 57 | OemS3LateRestore(&S3Late->S3DataBlock); |
| 58 | } |
| 59 | |
| 60 | void platform_AfterS3LateRestore(struct sysinfo *cb, AMD_S3LATE_PARAMS *S3Late) |
| 61 | { |
| 62 | amd_initcpuio(); |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | void platform_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *Mid) |
| 66 | { |
| 67 | amd_initcpuio(); |
| 68 | } |
| 69 | |
Michał Żygowski | 506b9c1 | 2019-12-20 16:57:13 +0100 | [diff] [blame] | 70 | void platform_BeforeInitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late) |
| 71 | { |
| 72 | } |
| 73 | |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 74 | void platform_AfterInitLate(struct sysinfo *cb, AMD_LATE_PARAMS *Late) |
| 75 | { |
Kyösti Mälkki | 28c4d2f | 2016-11-25 11:21:02 +0200 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | void platform_AfterS3Save(struct sysinfo *cb, AMD_S3SAVE_PARAMS *S3Save) |
| 79 | { |
| 80 | OemS3Save(&S3Save->S3DataBlock); |
| 81 | } |