blob: 98fcb629fe0ae4ede527ba6eab49022fee149a2e [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
10static void bootblock_northbridge_init(void)
11{
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030012 /*
13 * The "io" variant of the config access is explicitly used to
Shelley Chen4e9bb332021-10-20 15:43:45 -070014 * setup the PCIEXBAR because CONFIG(ECAM_MMCONF_SUPPORT) is set to
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);
Patrick Rudolphfbdeb4a2019-02-14 19:47:03 +010027
Angel Ponscba669c2021-01-28 11:56:45 +010028 if (CONFIG(BOOTBLOCK_CONSOLE))
29 mainboard_machine_check();
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030030}
31
Patrick Rudolph1af89232018-11-11 12:50:51 +010032static void bootblock_southbridge_init(void)
33{
Angel Pons22a6d112020-06-21 18:50:22 +020034 enable_spi_prefetching_and_caching();
Patrick Rudolph1af89232018-11-11 12:50:51 +010035
36 /* Enable RCBA */
Peter Lemenkov7b428112018-10-23 11:12:46 +020037 pci_write_config32(PCI_DEV(0, 0x1f, 0), RCBA,
Angel Pons6e732d32021-01-28 13:56:18 +010038 CONFIG_FIXED_RCBA_MMIO_BASE | 1);
Patrick Rudolph1af89232018-11-11 12:50:51 +010039}
40
41void bootblock_soc_init(void)
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030042{
43 bootblock_northbridge_init();
44 bootblock_southbridge_init();
45}