blob: c68879102286ad6f62395bb5f89def419357dcda [file] [log] [blame]
Frank Vibrans69da1b62011-02-14 19:04:45 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 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
Paul Menzela46a7122013-02-23 18:37:27 +010017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Frank Vibrans69da1b62011-02-14 19:04:45 +000018 */
19
20#include <console/console.h>
21#include <device/pci.h>
22#include <device/pci_ids.h>
23#include <string.h>
24#include <stdint.h>
25#include <stdlib.h>
26#include <cpu/amd/amdfam14.h>
Kerry Sheh01f7ab92012-01-19 13:18:36 +080027#include "agesawrapper.h"
Frank Vibrans69da1b62011-02-14 19:04:45 +000028
29
30/* Global variables for MB layouts and these will be shared by irqtable mptable
Kerry Shehf03360f2012-01-19 13:25:55 +080031 * and acpi_tables busnum is default.
32 */
Kyösti Mälkki9c7d73c2013-09-09 09:23:19 +030033u8 bus_sb800[6];
Kerry Sheh01f7ab92012-01-19 13:18:36 +080034u32 apicid_sb800;
Frank Vibrans69da1b62011-02-14 19:04:45 +000035
36/*
Kerry Shehf03360f2012-01-19 13:25:55 +080037 * Here you only need to set value in pci1234 for HT-IO that could be installed or not
38 * You may need to preset pci1234 for HTIO board,
39 * please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
40 */
Frank Vibrans69da1b62011-02-14 19:04:45 +000041u32 pci1234x[] = {
Kerry Shehf03360f2012-01-19 13:25:55 +080042 0x0000ff0,
Frank Vibrans69da1b62011-02-14 19:04:45 +000043};
44
Frank Vibrans69da1b62011-02-14 19:04:45 +000045u32 sbdn_sb800;
46
Frank Vibrans69da1b62011-02-14 19:04:45 +000047void get_bus_conf(void)
48{
Kerry Sheh01f7ab92012-01-19 13:18:36 +080049 u32 apicid_base;
Frank Vibrans69da1b62011-02-14 19:04:45 +000050
Kerry Shehf03360f2012-01-19 13:25:55 +080051 device_t dev;
Kyösti Mälkki53584fa2014-07-15 14:38:51 +030052 int i;
Frank Vibrans69da1b62011-02-14 19:04:45 +000053
Frank Vibrans69da1b62011-02-14 19:04:45 +000054
Kerry Shehf03360f2012-01-19 13:25:55 +080055 sbdn_sb800 = 0;
Frank Vibrans69da1b62011-02-14 19:04:45 +000056
Kyösti Mälkki9c7d73c2013-09-09 09:23:19 +030057 memset(bus_sb800, 0, sizeof(bus_sb800));
Frank Vibrans69da1b62011-02-14 19:04:45 +000058
Frank Vibrans69da1b62011-02-14 19:04:45 +000059
Kerry Shehf03360f2012-01-19 13:25:55 +080060 // bus_sb800[0] = (sysconf.pci1234[0] >> 16) & 0xff;
61 bus_sb800[0] = (pci1234x[0] >> 16) & 0xff;
Frank Vibrans69da1b62011-02-14 19:04:45 +000062
Kerry Shehf03360f2012-01-19 13:25:55 +080063 /* sb800 */
64 dev = dev_find_slot(bus_sb800[0], PCI_DEVFN(sbdn_sb800 + 0x14, 4));
Frank Vibrans69da1b62011-02-14 19:04:45 +000065
Kerry Shehf03360f2012-01-19 13:25:55 +080066 if (dev) {
67 bus_sb800[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
Kerry Shehf03360f2012-01-19 13:25:55 +080068 }
Frank Vibrans69da1b62011-02-14 19:04:45 +000069
Kerry Shehf03360f2012-01-19 13:25:55 +080070 for (i = 0; i < 4; i++) {
71 dev = dev_find_slot(bus_sb800[0], PCI_DEVFN(sbdn_sb800 + 0x14, i));
72 if (dev) {
73 bus_sb800[2 + i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
Kerry Shehf03360f2012-01-19 13:25:55 +080074 }
75 }
Kerry Sheh01f7ab92012-01-19 13:18:36 +080076
Kerry Shehf03360f2012-01-19 13:25:55 +080077 /* I/O APICs: APIC ID Version State Address */
Kerry Sheh01f7ab92012-01-19 13:18:36 +080078 apicid_base = CONFIG_MAX_CPUS;
79 apicid_sb800 = apicid_base;
Kerry Shefeed3292011-08-18 18:03:44 +080080
Frank Vibrans69da1b62011-02-14 19:04:45 +000081}