blob: cdca27ab143e28b7c78e8cf8df5421892937ce17 [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>
Patrick Rudolphfbdeb4a2019-02-14 19:47:03 +01007#include <console/console.h>
Kyösti Mälkkib9646a22013-07-03 08:06:32 +03008
Angel Pons899525d2021-01-28 10:57:13 +01009#include "q35.h"
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030010
11static void bootblock_northbridge_init(void)
12{
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030013 /*
14 * The "io" variant of the config access is explicitly used to
Martin Rothf48acbd2020-07-24 12:24:27 -060015 * setup the PCIEXBAR because CONFIG(MMCONF_SUPPORT) is set to
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030016 * to true. That way all subsequent non-explicit config accesses use
17 * MCFG. This code also assumes that bootblock_northbridge_init() is
18 * the first thing called in the non-asm boot block code. The final
19 * assumption is that no assembly code is using the
Martin Rothf48acbd2020-07-24 12:24:27 -060020 * CONFIG(MMCONF_SUPPORT) option to do PCI config acceses.
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030021 *
22 * The PCIEXBAR is assumed to live in the memory mapped IO space under
23 * 4GiB.
24 */
Angel Ponscba669c2021-01-28 11:56:45 +010025 const uint32_t pciexbar = make_pciexbar();
26 pci_io_write_config32(HOST_BRIDGE, D0F0_PCIEXBAR_HI, 0);
27 pci_io_write_config32(HOST_BRIDGE, D0F0_PCIEXBAR_LO, pciexbar);
Patrick Rudolphfbdeb4a2019-02-14 19:47:03 +010028
Angel Ponscba669c2021-01-28 11:56:45 +010029 if (CONFIG(BOOTBLOCK_CONSOLE))
30 mainboard_machine_check();
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030031}
32
Patrick Rudolph1af89232018-11-11 12:50:51 +010033static void bootblock_southbridge_init(void)
34{
Angel Pons22a6d112020-06-21 18:50:22 +020035 enable_spi_prefetching_and_caching();
Patrick Rudolph1af89232018-11-11 12:50:51 +010036
37 /* Enable RCBA */
Peter Lemenkov7b428112018-10-23 11:12:46 +020038 pci_write_config32(PCI_DEV(0, 0x1f, 0), RCBA,
Patrick Rudolph1af89232018-11-11 12:50:51 +010039 (uintptr_t)DEFAULT_RCBA | 1);
40}
41
42void bootblock_soc_init(void)
Kyösti Mälkkib9646a22013-07-03 08:06:32 +030043{
44 bootblock_northbridge_init();
45 bootblock_southbridge_init();
46}