Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Written by Stefan Reinauer <stepan@openbios.org>. |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 5 | * ACPI FADT, FACS, and DSDT table support added by |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 6 | * |
| 7 | * Copyright (C) 2004 Stefan Reinauer <stepan@openbios.org> |
| 8 | * Copyright (C) 2005 Nick Barker <nick.barker9@btinternet.com> |
| 9 | * Copyright (C) 2007, 2008 Rudolf Marek <r.marek@assembler.cz> |
| 10 | * Copyright (C) 2009 Harald Gutmann <harald.gutmann@gmx.net> |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
Uwe Hermann | c70e9fc | 2010-02-15 23:10:19 +0000 | [diff] [blame] | 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; version 2 of the License. |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include <console/console.h> |
| 23 | #include <string.h> |
| 24 | #include <arch/acpi.h> |
| 25 | #include <arch/smp/mpspec.h> |
| 26 | #include <device/device.h> |
| 27 | #include <device/pci_ids.h> |
stepan | 8301d83 | 2010-12-08 07:07:33 +0000 | [diff] [blame] | 28 | #include "northbridge/amd/amdk8/acpi.h" |
Vladimir Serbinenko | 4743254 | 2014-10-05 14:54:26 +0200 | [diff] [blame] | 29 | #include <cpu/amd/powernow.h> |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 30 | #include <device/pci.h> |
| 31 | #include <cpu/amd/amdk8_sysconf.h> |
| 32 | |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 33 | unsigned long acpi_fill_madt(unsigned long current) |
| 34 | { |
| 35 | unsigned int gsi_base = 0x18; |
| 36 | extern unsigned char bus_mcp55[8]; |
| 37 | extern unsigned apicid_mcp55; |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 38 | |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 39 | unsigned sbdn; |
| 40 | struct resource *res; |
| 41 | device_t dev; |
| 42 | |
| 43 | get_bus_conf(); |
| 44 | sbdn = sysconf.sbdn; |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 45 | |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 46 | /* Create all subtables for processors. */ |
| 47 | current = acpi_create_madt_lapics(current); |
| 48 | |
| 49 | /* Write SB IOAPIC. */ |
| 50 | dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn+ 0x1,0)); |
| 51 | if (dev) { |
| 52 | res = find_resource(dev, PCI_BASE_ADDRESS_1); |
| 53 | if (res) { |
| 54 | current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, |
| 55 | apicid_mcp55, res->base, 0); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /* Write NB IOAPIC. */ |
| 60 | dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn+ 0x12,1)); |
| 61 | if (dev) { |
| 62 | res = find_resource(dev, PCI_BASE_ADDRESS_1); |
| 63 | if (res) { |
| 64 | current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, |
| 65 | apicid_mcp55++, res->base, gsi_base); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /* IRQ9 ACPI active low. */ |
| 70 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) |
| 71 | current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); |
| 72 | |
| 73 | /* IRQ0 -> APIC IRQ2. */ |
| 74 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 75 | current, 0, 0, 2, 0x0); |
Harald Gutmann | 62cfe16 | 2009-06-19 12:03:40 +0000 | [diff] [blame] | 76 | |
| 77 | /* Create all subtables for processors. */ |
| 78 | current = acpi_create_madt_lapic_nmis(current, |
| 79 | MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); |
| 80 | |
| 81 | return current; |
| 82 | } |