blob: fe8253ee03b87dfd5c253400249dc0962bf4c2a7 [file] [log] [blame]
Rudolf Marekc8eab2c2013-03-20 21:43:50 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Advanced Micro Devices, 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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
Idwer Volleringfa02e162014-03-29 13:13:10 +010020#include "agesawrapper.h"
21
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010022#include <console/console.h>
Idwer Volleringfa02e162014-03-29 13:13:10 +010023#include <cpu/amd/amdfam15.h>
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010024#include <device/pci.h>
25#include <device/pci_ids.h>
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010026#include <stdint.h>
27#include <stdlib.h>
Idwer Volleringfa02e162014-03-29 13:13:10 +010028#include <string.h>
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010029
30/* Global variables for MB layouts and these will be shared by irqtable mptable
31 * and acpi_tables busnum is default.
32 */
Kyösti Mälkki4f9bf7e2013-09-09 09:23:19 +030033u8 bus_hudson[6];
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010034u32 apicid_hudson;
35
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010036
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010037
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010038void get_bus_conf(void)
39{
40 u32 apicid_base;
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010041
42 device_t dev;
Kyösti Mälkki53584fa2014-07-15 14:38:51 +030043 int i;
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010044
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010045
Kyösti Mälkki4f9bf7e2013-09-09 09:23:19 +030046 memset(bus_hudson, 0, sizeof(bus_hudson));
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010047
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010048
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010049
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010050
51 /* Hudson */
Kyösti Mälkki0c797f12014-07-21 19:35:16 +030052 dev = dev_find_slot(0, PCI_DEVFN(0x14, 4));
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010053
54 if (dev) {
55 bus_hudson[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010056 }
57
58 for (i = 0; i < 4; i++) {
Kyösti Mälkki0c797f12014-07-21 19:35:16 +030059 dev = dev_find_slot(0, PCI_DEVFN(0x14, i));
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010060 if (dev) {
61 bus_hudson[2 + i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010062 }
63 }
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010064
65 /* I/O APICs: APIC ID Version State Address */
Rudolf Marekc8eab2c2013-03-20 21:43:50 +010066 apicid_base = CONFIG_MAX_CPUS;
67 apicid_hudson = apicid_base;
68}