Angel Pons | 585495e | 2020-04-03 01:21:38 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 2 | |
Kyösti Mälkki | a963acd | 2019-08-16 20:34:25 +0300 | [diff] [blame] | 3 | #include <arch/romstage.h> |
Patrick Rudolph | 69d5ef9 | 2018-11-11 12:43:48 +0100 | [diff] [blame] | 4 | #include <cbmem.h> |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 5 | #include <southbridge/intel/i82801ix/i82801ix.h> |
Patrick Rudolph | fbdeb4a | 2019-02-14 19:47:03 +0100 | [diff] [blame] | 6 | #include <device/pci_ops.h> |
| 7 | |
Angel Pons | 899525d | 2021-01-28 10:57:13 +0100 | [diff] [blame] | 8 | #include "q35.h" |
Patrick Rudolph | fbdeb4a | 2019-02-14 19:47:03 +0100 | [diff] [blame] | 9 | |
Patrick Rudolph | 0395b4b | 2024-06-14 17:07:29 +0200 | [diff] [blame^] | 10 | #define TSEG_SZ_MASK (3 << 1) |
| 11 | |
Kyösti Mälkki | f0a3d44 | 2019-08-18 08:02:23 +0300 | [diff] [blame] | 12 | void mainboard_romstage_entry(void) |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 13 | { |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 14 | i82801ix_early_init(); |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 15 | |
Angel Pons | cba669c | 2021-01-28 11:56:45 +0100 | [diff] [blame] | 16 | if (!CONFIG(BOOTBLOCK_CONSOLE)) |
| 17 | mainboard_machine_check(); |
Patrick Rudolph | fbdeb4a | 2019-02-14 19:47:03 +0100 | [diff] [blame] | 18 | |
Patrick Rudolph | 0395b4b | 2024-06-14 17:07:29 +0200 | [diff] [blame^] | 19 | /* Configure requested TSEG size */ |
| 20 | switch (CONFIG_SMM_TSEG_SIZE) { |
| 21 | case 1 * MiB: |
| 22 | pci_update_config8(HOST_BRIDGE, ESMRAMC, ~TSEG_SZ_MASK, 0 << 1); |
| 23 | break; |
| 24 | case 2 * MiB: |
| 25 | pci_update_config8(HOST_BRIDGE, ESMRAMC, ~TSEG_SZ_MASK, 1 << 1); |
| 26 | break; |
| 27 | case 8 * MiB: |
| 28 | pci_update_config8(HOST_BRIDGE, ESMRAMC, ~TSEG_SZ_MASK, 2 << 1); |
| 29 | break; |
| 30 | default: |
| 31 | printk(BIOS_WARNING, "%s: Unsupported TSEG size: 0x%x\n", __func__, CONFIG_SMM_TSEG_SIZE); |
| 32 | } |
| 33 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 34 | cbmem_recovery(0); |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 35 | } |