blob: 7aaed789ac41b76c6fc856a7d6e190c8218971ab [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>
Arthur Heymans5bb15f12018-12-22 16:02:25 +010019#include <cpu/intel/car/bootblock.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070020
Arthur Heymans5bb15f12018-12-22 16:02:25 +010021void bootblock_early_northbridge_init(void)
Duncan Lauriec88c54c2014-04-30 16:36:13 -070022{
23 uint32_t reg;
24
25 /*
26 * The "io" variant of the config access is explicitly used to
Kyösti Mälkki6f66f412016-12-01 22:08:18 +020027 * setup the PCIEXBAR because CONFIG_MMCONF_SUPPORT is set to
Duncan Lauriec88c54c2014-04-30 16:36:13 -070028 * to true. That way all subsequent non-explicit config accesses use
29 * MCFG. This code also assumes that bootblock_northbridge_init() is
30 * the first thing called in the non-asm boot block code. The final
31 * assumption is that no assembly code is using the
Kyösti Mälkki6f66f412016-12-01 22:08:18 +020032 * CONFIG_MMCONF_SUPPORT option to do PCI config accesses.
Duncan Lauriec88c54c2014-04-30 16:36:13 -070033 *
34 * The PCIEXBAR is assumed to live in the memory mapped IO space under
35 * 4GiB.
36 */
37 reg = 0;
38 pci_io_write_config32(SA_DEV_ROOT, PCIEXBAR + 4, reg);
39 reg = CONFIG_MMCONF_BASE_ADDRESS | 4 | 1; /* 64MiB - 0-63 buses. */
40 pci_io_write_config32(SA_DEV_ROOT, PCIEXBAR, reg);
41}