From 293b5f52253ec0e5edb38e9f7113afc7e8f8ba6e Mon Sep 17 00:00:00 2001 From: Rudolf Marek Date: Sun, 1 Feb 2009 18:35:15 +0000 Subject: Following patch adds dynamic ACPI AML code generator which can be used to generate run-time ACPI ASL code. Moreover it demonstrates its use on Asus M2V-MX SE where the SSDT table is generated by new function k8acpi_write_vars (technically similar to update_ssdt). But lot of nicer. x Signed-off-by: Rudolf Marek Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3925 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/northbridge/amd/amdk8/amdk8_acpi.c | 75 +++++++++++++++++++++++++++++++++- src/northbridge/amd/amdk8/amdk8_acpi.h | 25 ++++++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/northbridge/amd/amdk8/amdk8_acpi.h (limited to 'src/northbridge') diff --git a/src/northbridge/amd/amdk8/amdk8_acpi.c b/src/northbridge/amd/amdk8/amdk8_acpi.c index e3709c4753..16739c4751 100644 --- a/src/northbridge/amd/amdk8/amdk8_acpi.c +++ b/src/northbridge/amd/amdk8/amdk8_acpi.c @@ -226,7 +226,6 @@ unsigned long acpi_fill_slit(unsigned long current) p[i*nodes+j] = hops_8[i*nodes+j] * 2 + 10; #endif - } } } @@ -236,6 +235,80 @@ unsigned long acpi_fill_slit(unsigned long current) return current; } +static int k8acpi_write_HT(void) { + device_t dev; + uint32_t dword; + int len, lenp, i; + + len = acpigen_write_name("HCLK"); + lenp = acpigen_write_package(HC_POSSIBLE_NUM); + + for(i=0;i> 12) & 0xff) ? 0xf : 0x0); + lens += acpigen_write_name_dword("SBDN", sysconf.sbdn); + msr = rdmsr(TOP_MEM); + lens += acpigen_write_name_dword("TOM1", msr.lo); + + lens += k8acpi_write_HT(); + //minus opcode + acpigen_patch_len(lens - 1); + return lens; +} + // moved from mb acpi_tables.c static void intx_to_stream(u32 val, u32 len, u8 *dest) { diff --git a/src/northbridge/amd/amdk8/amdk8_acpi.h b/src/northbridge/amd/amdk8/amdk8_acpi.h new file mode 100644 index 0000000000..faf0474e65 --- /dev/null +++ b/src/northbridge/amd/amdk8/amdk8_acpi.h @@ -0,0 +1,25 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2009 Rudolf Marek + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License v2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AMDK8_ACPI_H +#define AMDK8_ACPI_H +#include + +int k8acpi_write_vars(void); + +#endif -- cgit v1.2.3