blob: 2f13080c08ac1d1a47b9b56e254f2972e8040ae3 [file] [log] [blame]
Duncan Lauriec88c54c2014-04-30 16:36:13 -07001/*
2 * This file is part of the coreboot project.
3 *
Duncan Lauriec88c54c2014-04-30 16:36:13 -07004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Duncan Lauriec88c54c2014-04-30 16:36:13 -070013 */
14
Kyösti Mälkkide640782019-12-03 07:30:26 +020015#include <arch/bootblock.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020016#include <device/pci_ops.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070017#include <soc/pci_devs.h>
18#include <soc/systemagent.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070019
Arthur Heymans5bb15f12018-12-22 16:02:25 +010020void bootblock_early_northbridge_init(void)
Duncan Lauriec88c54c2014-04-30 16:36:13 -070021{
22 uint32_t reg;
23
24 /*
25 * The "io" variant of the config access is explicitly used to
Kyösti Mälkki6f66f412016-12-01 22:08:18 +020026 * setup the PCIEXBAR because CONFIG_MMCONF_SUPPORT is set to
Duncan Lauriec88c54c2014-04-30 16:36:13 -070027 * to true. That way all subsequent non-explicit config accesses use
28 * MCFG. This code also assumes that bootblock_northbridge_init() is
29 * the first thing called in the non-asm boot block code. The final
30 * assumption is that no assembly code is using the
Kyösti Mälkki6f66f412016-12-01 22:08:18 +020031 * CONFIG_MMCONF_SUPPORT option to do PCI config accesses.
Duncan Lauriec88c54c2014-04-30 16:36:13 -070032 *
33 * The PCIEXBAR is assumed to live in the memory mapped IO space under
34 * 4GiB.
35 */
36 reg = 0;
37 pci_io_write_config32(SA_DEV_ROOT, PCIEXBAR + 4, reg);
38 reg = CONFIG_MMCONF_BASE_ADDRESS | 4 | 1; /* 64MiB - 0-63 buses. */
39 pci_io_write_config32(SA_DEV_ROOT, PCIEXBAR, reg);
40}