blob: faed40b07a1382026dd17cfa7830be9cfaf40d12 [file] [log] [blame]
Rudolf Marek05839972008-09-23 20:36:03 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Written by Stefan Reinauer <stepan@openbios.org>.
Stefan Reinauer14e22772010-04-27 06:56:47 +00005 * ACPI FADT, FACS, and DSDT table support added by
Rudolf Marek05839972008-09-23 20:36:03 +00006 *
7 * Copyright (C) 2004 Stefan Reinauer <stepan@openbios.org>
8 * Copyright (C) 2005 Nick Barker <nick.barker9@btinternet.com>
Rudolf Marek79e53252008-12-23 17:34:15 +00009 * Copyright (C) 2007, 2008 Rudolf Marek <r.marek@assembler.cz>
Rudolf Marek05839972008-09-23 20:36:03 +000010 *
11 * This program is free software; you can redistribute it and/or modify
Uwe Hermannc70e9fc2010-02-15 23:10:19 +000012 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
Rudolf Marek05839972008-09-23 20:36:03 +000014 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010022 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Rudolf Marek05839972008-09-23 20:36:03 +000023 */
24
25#include <console/console.h>
26#include <string.h>
27#include <arch/acpi.h>
Tobias Diedrich0fe6e9a2010-11-17 16:27:06 +000028#include <arch/acpigen.h>
Rudolf Marek05839972008-09-23 20:36:03 +000029#include <arch/smp/mpspec.h>
Uwe Hermann74d1a6e2010-10-12 17:34:08 +000030#include <arch/ioapic.h>
Rudolf Marek05839972008-09-23 20:36:03 +000031#include <device/device.h>
32#include <device/pci_ids.h>
Uwe Hermann5df41682010-09-25 16:17:20 +000033#include "southbridge/via/vt8237r/vt8237r.h"
34#include "southbridge/via/k8t890/k8t890.h"
stepan8301d832010-12-08 07:07:33 +000035#include "northbridge/amd/amdk8/acpi.h"
Rudolf Marekf997b552009-02-14 15:40:23 +000036#include <cpu/amd/model_fxx_powernow.h>
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020037#include <cpu/amd/amdk8_sysconf.h>
Rudolf Marek05839972008-09-23 20:36:03 +000038
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020039void get_bus_conf(void)
Rudolf Marek05839972008-09-23 20:36:03 +000040{
Vladimir Serbinenko6985d4e2014-09-21 14:31:19 +020041 /* FIXME: implement this. */
Rudolf Marek05839972008-09-23 20:36:03 +000042}
43
44unsigned long acpi_fill_madt(unsigned long current)
45{
46 unsigned int gsi_base = 0x18;
47
48 /* Create all subtables for processors. */
49 current = acpi_create_madt_lapics(current);
50
51 /* Write SB IOAPIC. */
52 current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
Uwe Hermann74d1a6e2010-10-12 17:34:08 +000053 VT8237R_APIC_ID, IO_APIC_ADDR, 0);
Rudolf Marek05839972008-09-23 20:36:03 +000054
55 /* Write NB IOAPIC. */
56 current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
57 K8T890_APIC_ID, K8T890_APIC_BASE, gsi_base);
58
59 /* IRQ9 ACPI active low. */
60 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
61 current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW);
62
63 /* IRQ0 -> APIC IRQ2. */
64 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
Stefan Reinauer14e22772010-04-27 06:56:47 +000065 current, 0, 0, 2, 0x0);
Rudolf Marek05839972008-09-23 20:36:03 +000066
67 /* Create all subtables for processors. */
68 current = acpi_create_madt_lapic_nmis(current,
69 MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1);
70
71 return current;
72}