blob: d40ff0f98d478f0acc58105d0030407bd3254f0b [file] [log] [blame]
Angel Pons585495e2020-04-03 01:21:38 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Martin Rothb28f4662018-05-26 17:58:47 -06002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Patrick Rudolph1af89232018-11-11 12:50:51 +01004#include <bootblock_common.h>
Angel Pons22a6d112020-06-21 18:50:22 +02005#include <southbridge/intel/common/early_spi.h>
Patrick Rudolph1af89232018-11-11 12:50:51 +01006#include <southbridge/intel/i82801ix/i82801ix.h>
Kyösti Mälkkib9646a22013-07-03 08:06:32 +03007
Angel Pons899525d2021-01-28 10:57:13 +01008#include "q35.h"
Kyösti Mälkkib9646a22013-07-03 08:06:32 +03009
Kyösti Mälkki6aaa4f92023-07-04 09:22:39 +030010void bootblock_soc_early_init(void)
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030011{
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030012 /*
13 * The "io" variant of the config access is explicitly used to
Alexander Goncharov893c3ae82023-02-04 15:20:37 +040014 * setup the PCIEXBAR because CONFIG(ECAM_MMCONF_SUPPORT) is set
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030015 * to true. That way all subsequent non-explicit config accesses use
16 * MCFG. This code also assumes that bootblock_northbridge_init() is
17 * the first thing called in the non-asm boot block code. The final
18 * assumption is that no assembly code is using the
Shelley Chen4e9bb332021-10-20 15:43:45 -070019 * CONFIG(ECAM_MMCONF_SUPPORT) option to do PCI config accesses.
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030020 *
21 * The PCIEXBAR is assumed to live in the memory mapped IO space under
22 * 4GiB.
23 */
Angel Ponscba669c2021-01-28 11:56:45 +010024 const uint32_t pciexbar = make_pciexbar();
25 pci_io_write_config32(HOST_BRIDGE, D0F0_PCIEXBAR_HI, 0);
26 pci_io_write_config32(HOST_BRIDGE, D0F0_PCIEXBAR_LO, pciexbar);
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030027}
28
Patrick Rudolph1af89232018-11-11 12:50:51 +010029static void bootblock_southbridge_init(void)
30{
Angel Pons22a6d112020-06-21 18:50:22 +020031 enable_spi_prefetching_and_caching();
Patrick Rudolph1af89232018-11-11 12:50:51 +010032
33 /* Enable RCBA */
Peter Lemenkov7b428112018-10-23 11:12:46 +020034 pci_write_config32(PCI_DEV(0, 0x1f, 0), RCBA,
Angel Pons6e732d32021-01-28 13:56:18 +010035 CONFIG_FIXED_RCBA_MMIO_BASE | 1);
Patrick Rudolph1af89232018-11-11 12:50:51 +010036}
37
38void bootblock_soc_init(void)
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030039{
Kyösti Mälkki6aaa4f92023-07-04 09:22:39 +030040 if (CONFIG(BOOTBLOCK_CONSOLE))
41 mainboard_machine_check();
42
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030043 bootblock_southbridge_init();
44}