Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2004 Stefan Reinauer |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 5 | * Copyright (C) 2018 Patrick Rudolph <siro@das-labor.org> |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 6 | * |
| 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. |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
Kyösti Mälkki | 6e2d0c1 | 2019-06-28 10:08:51 +0300 | [diff] [blame] | 17 | #include <arch/cpu.h> |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 18 | #include <stdint.h> |
Patrick Rudolph | 69d5ef9 | 2018-11-11 12:43:48 +0100 | [diff] [blame] | 19 | #include <cbmem.h> |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 20 | #include <console/console.h> |
Kyösti Mälkki | c6986fa | 2016-06-17 10:35:29 +0300 | [diff] [blame] | 21 | #include <cpu/intel/romstage.h> |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 22 | #include <timestamp.h> |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 23 | #include <southbridge/intel/i82801ix/i82801ix.h> |
| 24 | #include <program_loading.h> |
Patrick Rudolph | fbdeb4a | 2019-02-14 19:47:03 +0100 | [diff] [blame^] | 25 | #include <device/pci_ops.h> |
| 26 | |
| 27 | #define D0F0_PCIEXBAR_LO 0x60 |
| 28 | |
| 29 | static void mainboard_machine_check(void) |
| 30 | { |
| 31 | /* Check that MCFG is active. If it's not qemu was started for machine PC */ |
| 32 | if (!CONFIG(BOOTBLOCK_CONSOLE) && |
| 33 | (pci_read_config32(PCI_DEV(0, 0, 0), D0F0_PCIEXBAR_LO) != |
| 34 | (CONFIG_MMCONF_BASE_ADDRESS | 1))) |
| 35 | die("You must run qemu for machine Q35 (-M q35)"); |
| 36 | } |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 37 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 38 | asmlinkage void car_stage_entry(void) |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 39 | { |
Arthur Heymans | 65200f0 | 2018-12-20 11:23:56 +0100 | [diff] [blame] | 40 | struct postcar_frame pcf; |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 41 | i82801ix_early_init(); |
| 42 | console_init(); |
| 43 | |
Patrick Rudolph | fbdeb4a | 2019-02-14 19:47:03 +0100 | [diff] [blame^] | 44 | mainboard_machine_check(); |
| 45 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 46 | cbmem_recovery(0); |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 47 | |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 48 | timestamp_add_now(TS_START_ROMSTAGE); |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 49 | |
Kyösti Mälkki | 6e2d0c1 | 2019-06-28 10:08:51 +0300 | [diff] [blame] | 50 | if (postcar_frame_init(&pcf, 0)) |
Arthur Heymans | 65200f0 | 2018-12-20 11:23:56 +0100 | [diff] [blame] | 51 | die("Unable to initialize postcar frame.\n"); |
| 52 | |
| 53 | /** |
| 54 | * Run postcar to tear down CAR and load relocatable ramstage. |
| 55 | * There's no CAR on qemu, but for educational purposes and |
| 56 | * testing the postcar stage is used on qemu, too. |
| 57 | */ |
| 58 | |
| 59 | run_postcar_phase(&pcf); |
Gerd Hoffmann | ee941b38 | 2013-06-07 16:03:44 +0200 | [diff] [blame] | 60 | } |