blob: e618636eb2913320aa842d84afeb847980799f0d [file] [log] [blame]
Duncan Lauriec88c54c2014-04-30 16:36:13 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Duncan Lauriec88c54c2014-04-30 16:36:13 -070014 */
15
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
20static void bootblock_northbridge_init(void)
21{
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}