Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 1 | /* |
| 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 Vollering | fa02e16 | 2014-03-29 13:13:10 +0100 | [diff] [blame] | 20 | #include "agesawrapper.h" |
| 21 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 22 | #include <console/console.h> |
Idwer Vollering | fa02e16 | 2014-03-29 13:13:10 +0100 | [diff] [blame] | 23 | #include <cpu/amd/amdfam15.h> |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 24 | #include <device/pci.h> |
| 25 | #include <device/pci_ids.h> |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 26 | #include <stdint.h> |
| 27 | #include <stdlib.h> |
Idwer Vollering | fa02e16 | 2014-03-29 13:13:10 +0100 | [diff] [blame] | 28 | #include <string.h> |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 29 | |
| 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älkki | 4f9bf7e | 2013-09-09 09:23:19 +0300 | [diff] [blame] | 33 | u8 bus_hudson[6]; |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 34 | u32 apicid_hudson; |
| 35 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 36 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 37 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 38 | void get_bus_conf(void) |
| 39 | { |
| 40 | u32 apicid_base; |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 41 | |
| 42 | device_t dev; |
Kyösti Mälkki | 53584fa | 2014-07-15 14:38:51 +0300 | [diff] [blame] | 43 | int i; |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 44 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 45 | |
Kyösti Mälkki | 4f9bf7e | 2013-09-09 09:23:19 +0300 | [diff] [blame] | 46 | memset(bus_hudson, 0, sizeof(bus_hudson)); |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 47 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 48 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 49 | |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 50 | |
| 51 | /* Hudson */ |
Kyösti Mälkki | 0c797f1 | 2014-07-21 19:35:16 +0300 | [diff] [blame^] | 52 | dev = dev_find_slot(0, PCI_DEVFN(0x14, 4)); |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 53 | |
| 54 | if (dev) { |
| 55 | bus_hudson[1] = pci_read_config8(dev, PCI_SECONDARY_BUS); |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | for (i = 0; i < 4; i++) { |
Kyösti Mälkki | 0c797f1 | 2014-07-21 19:35:16 +0300 | [diff] [blame^] | 59 | dev = dev_find_slot(0, PCI_DEVFN(0x14, i)); |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 60 | if (dev) { |
| 61 | bus_hudson[2 + i] = pci_read_config8(dev, PCI_SECONDARY_BUS); |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 62 | } |
| 63 | } |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 64 | |
| 65 | /* I/O APICs: APIC ID Version State Address */ |
Rudolf Marek | c8eab2c | 2013-03-20 21:43:50 +0100 | [diff] [blame] | 66 | apicid_base = CONFIG_MAX_CPUS; |
| 67 | apicid_hudson = apicid_base; |
| 68 | } |