blob: 59c31aa67232bdea897f1df57e86d7e8a03e6853 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Martin Roth5474eb12018-05-26 19:22:33 -06002
Kyösti Mälkkide640782019-12-03 07:30:26 +02003#include <arch/bootblock.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02004#include <device/pci_ops.h>
Arthur Heymans8e646e72018-06-05 11:19:22 +02005#include "haswell.h"
Aaron Durbin6d04f0f2012-10-31 22:57:16 -05006
Arthur Heymans8e646e72018-06-05 11:19:22 +02007void bootblock_early_northbridge_init(void)
Aaron Durbin6d04f0f2012-10-31 22:57:16 -05008{
9 uint32_t reg;
10
11 /*
Angel Pons1db5bc72020-01-15 00:49:03 +010012 * The "io" variant of the config access is explicitly used to setup the PCIEXBAR
Martin Rothf48acbd2020-07-24 12:24:27 -060013 * because CONFIG(MMCONF_SUPPORT) is set to true. That way, all subsequent
Angel Pons1db5bc72020-01-15 00:49:03 +010014 * non-explicit config accesses use MCFG. This code also assumes that
15 * bootblock_northbridge_init() is the first thing called in the non-asm
16 * boot block code. The final assumption is that no assembly code is using
Martin Rothf48acbd2020-07-24 12:24:27 -060017 * the CONFIG(MMCONF_SUPPORT) option to do PCI config acceses.
Aaron Durbin6d04f0f2012-10-31 22:57:16 -050018 *
Angel Pons1db5bc72020-01-15 00:49:03 +010019 * The PCIEXBAR is assumed to live in the memory mapped IO space under 4GiB.
Aaron Durbin6d04f0f2012-10-31 22:57:16 -050020 */
21 reg = 0;
Angel Pons1db5bc72020-01-15 00:49:03 +010022 pci_io_write_config32(HOST_BRIDGE, PCIEXBAR + 4, reg);
Aaron Durbin6d04f0f2012-10-31 22:57:16 -050023 reg = CONFIG_MMCONF_BASE_ADDRESS | 4 | 1; /* 64MiB - 0-63 buses. */
Angel Pons1db5bc72020-01-15 00:49:03 +010024 pci_io_write_config32(HOST_BRIDGE, PCIEXBAR, reg);
Aaron Durbin6d04f0f2012-10-31 22:57:16 -050025}