amdk8: Move to per-device ACPI

Change-Id: I485791015aa7eaabba53813945c216f5725554b1
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/6948
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Vladimir Serbinenko 2014-09-21 14:31:19 +02:00
parent 822bc65b0e
commit 6985d4ee07
59 changed files with 420 additions and 2848 deletions

View file

@ -28,28 +28,11 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
extern u16 pm_base;
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -72,90 +55,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16byte */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -28,34 +28,12 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <southbridge/amd/sb700/sb700.h>
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
#if CONFIG_ACPI_SSDTX_NUM >= 1
extern const unsigned char AmlCode_ssdt2[];
extern const unsigned char AmlCode_ssdt3[];
extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -78,136 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(ACPI_CPU_CONTROL, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
#if CONFIG_ACPI_SSDTX_NUM >= 1
acpi_header_t *ssdtx;
void *p;
int i;
#endif
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16 bytes */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table */
for (i = 1; i < sysconf.hc_possible_num; i++) { /* 0: is hc sblink */
if ((sysconf.pci1234[i] & 1) != 1)
continue;
u8 c;
if (i < 7) {
c = (u8) ('4' + i - 1);
} else {
c = (u8) ('A' + i - 1 - 6);
}
printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); /* pci0 and pci1 are in dsdt */
current = ALIGN(current, 8);
ssdtx = (acpi_header_t *) current;
switch (sysconf.hcid[i]) {
case 1: /* 8132 */
p = &AmlCode_ssdt2;
break;
case 2: /* 8151 */
p = &AmlCode_ssdt3;
break;
case 3: /* 8131 */
p = &AmlCode_ssdt4;
break;
default:
/* HTX no io apic */
p = &AmlCode_ssdt5;
break;
}
memcpy(ssdtx, p, sizeof(acpi_header_t));
current += ssdtx->length;
memcpy(ssdtx, p, ssdtx->length);
update_ssdtx((void *)ssdtx, i);
ssdtx->checksum = 0;
ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length);
acpi_add_table(rsdp, ssdtx);
}
#endif
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -60,12 +60,6 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta
return (unsigned long) (acpigen_get_current());
}
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -30,26 +30,10 @@
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
extern u16 pm_base;
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -73,90 +57,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16byte */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -19,19 +19,11 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.h"
#include "mainboard.h"
extern const unsigned char AmlCode[];
#if CONFIG_ACPI_SSDTX_NUM >= 1
extern const unsigned char AmlCode_ssdt2[];
extern const unsigned char AmlCode_ssdt3[];
extern const unsigned char AmlCode_ssdt4[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
@ -130,24 +122,9 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_srat_t *srat;
acpi_slit_t *slit;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
acpi_header_t *ssdtx;
void *p;
@ -159,80 +136,6 @@ unsigned long write_acpi_tables(unsigned long start)
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT at %lx\n", current);
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/*
* We explicitly add these tables later on:
*/
printk(BIOS_DEBUG, "ACPI: * HPET at %lx\n", current);
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * MADT at %lx\n", current);
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current+=madt->header.length;
acpi_add_table(rsdp, madt);
/* SRAT */
printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current);
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current+=srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current);
slit = (acpi_slit_t *) current;
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp, slit);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
#if CONFIG_ACPI_SSDTX_NUM >= 1
//same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
@ -272,6 +175,5 @@ unsigned long write_acpi_tables(unsigned long start)
}
#endif
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -0,0 +1,15 @@
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include "mainboard.h"
static void mainboard_enable(device_t dev)
{
dev->ops->write_acpi_tables = mainboard_write_acpi_tables;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -0,0 +1 @@
unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp);

View file

@ -39,12 +39,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -31,31 +31,10 @@
#include <cpu/amd/model_fxx_powernow.h>
#include <southbridge/amd/sb700/sb700.h>
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
#if CONFIG_ACPI_SSDTX_NUM >= 1
extern const unsigned char AmlCode_ssdt2[];
extern const unsigned char AmlCode_ssdt3[];
extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -78,137 +57,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(ACPI_CPU_CONTROL, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
#if CONFIG_ACPI_SSDTX_NUM >= 1
acpi_header_t *ssdtx;
void *p;
int i;
#endif
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16 bytes */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table */
for (i = 1; i < sysconf.hc_possible_num; i++) { /* 0: is hc sblink */
if ((sysconf.pci1234[i] & 1) != 1)
continue;
u8 c;
if (i < 7) {
c = (u8) ('4' + i - 1);
} else {
c = (u8) ('A' + i - 1 - 6);
}
printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); /* pci0 and pci1 are in dsdt */
current = ALIGN(current, 8);
ssdtx = (acpi_header_t *) current;
switch (sysconf.hcid[i]) {
case 1: /* 8132 */
p = &AmlCode_ssdt2;
break;
case 2: /* 8151 */
p = &AmlCode_ssdt3;
break;
case 3: /* 8131 */
p = &AmlCode_ssdt4;
break;
default:
/* HTX no io apic */
p = &AmlCode_ssdt5;
break;
}
memcpy(ssdtx, p, sizeof(acpi_header_t));
current += ssdtx->length;
memcpy(ssdtx, p, ssdtx->length);
update_ssdtx((void *)ssdtx, i);
ssdtx->checksum = 0;
ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length);
acpi_add_table(rsdp, ssdtx);
}
#endif
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -21,30 +21,6 @@
#include "../../../northbridge/amd/amdk8/acpi.h"
//#include <cpu/amd/model_fxx_powernow.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
device_t dev;
unsigned long mcfg_base;
dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0));
if (!dev)
return current;
mcfg_base = pci_read_config16(dev, 0x90);
if ((mcfg_base & 0x1000) == 0)
return current;
mcfg_base = (mcfg_base & 0xf) << 28;
printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base);
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, mcfg_base, 0x0, 0x0, 0xff);
return current;
}
/* APIC */
unsigned long acpi_fill_madt(unsigned long current)
{
@ -86,116 +62,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
//amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_mcfg_t *mcfg;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
current = ALIGN(current, 16);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs);
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
current = ALIGN(current, 16);
dsdt = (acpi_header_t *) current;
printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt);
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
current = ALIGN(current, 16);
fadt = (acpi_fadt_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt);
current += sizeof(acpi_fadt_t);
/* Add FADT now that we have facs and dsdt. */
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
current = ALIGN(current, 16);
mcfg = (acpi_mcfg_t *) current;
printk(BIOS_DEBUG, "ACPI: * MCFG @ %p\n", mcfg);
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
current += hpet->header.length;
current = ALIGN(current, 16);
madt = (acpi_madt_t *) current;
printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt);
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
current = ALIGN(current, 16);
ssdt = (acpi_header_t *)current;
printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt);
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current);
return current;
}

View file

@ -31,24 +31,11 @@
#include <device/pci_ids.h>
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
#include <cpu/amd/amdk8_sysconf.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
void get_bus_conf(void)
{
device_t dev;
struct resource *res;
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0);
if (!dev)
return current;
res = find_resource(dev, K8T890_MMCONFIG_MBAR);
if (res) {
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, res->base, 0x0, 0x0, 0xff);
}
return current;
/* FIXME: implement this. */
}
unsigned long acpi_fill_madt(unsigned long current)
@ -80,77 +67,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_madt_t *madt;
acpi_mcfg_t *mcfg;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT table. */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* We explicitly add these tables later on: */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
dsdt->length);
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/* If we want to use HPET timers Linux wants it in MADT. */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -24,13 +24,6 @@
DefinitionBlock ("DSDT.aml", "DSDT", 1, "CORE ", "COREBOOT", 1)
{
/* Define the main processor.*/
Scope (\_PR)
{
Processor (\_PR.CPU0, 0x00, 0x000000, 0x00) {}
Processor (\_PR.CPU1, 0x01, 0x000000, 0x00) {}
}
/* For now only define 2 power states:
* - S0 which is fully on
* - S5 which is soft off

View file

@ -33,24 +33,11 @@
#include "southbridge/via/k8t890/k8t890.h"
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
#include <cpu/amd/amdk8_sysconf.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
void get_bus_conf(void)
{
device_t dev;
struct resource *res;
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0);
if (!dev)
return current;
res = find_resource(dev, K8T890_MMCONFIG_MBAR);
if (res) {
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, res->base, 0x0, 0x0, 0xff);
}
return current;
/* FIXME: implement this. */
}
unsigned long acpi_fill_madt(unsigned long current)
@ -82,94 +69,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
{
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_madt_t *madt;
acpi_mcfg_t *mcfg;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT table. */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* We explicitly add these tables later on: */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
dsdt->length);
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/* If we want to use HPET timers Linux wants it in MADT. */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -33,24 +33,11 @@
#include "southbridge/via/k8t890/k8x8xx.h"
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
#include <cpu/amd/amdk8_sysconf.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
void get_bus_conf(void)
{
device_t dev;
struct resource *res;
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0);
if (!dev)
return current;
res = find_resource(dev, K8T890_MMCONFIG_MBAR);
if (res) {
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, res->base, 0x0, 0x0, 0xff);
}
return current;
/* FIXME: implement this. */
}
unsigned long acpi_fill_madt(unsigned long current)
@ -82,94 +69,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
{
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_madt_t *madt;
acpi_mcfg_t *mcfg;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT table. */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* We explicitly add these tables later on: */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
dsdt->length);
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/* If we want to use HPET timers Linux wants it in MADT. */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -34,24 +34,11 @@
#include "southbridge/via/k8t890/k8t890.h"
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
#include <cpu/amd/amdk8_sysconf.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
void get_bus_conf(void)
{
device_t dev;
struct resource *res;
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8M890CE_5, 0);
if (!dev)
return current;
res = find_resource(dev, K8T890_MMCONFIG_MBAR);
if (res) {
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, res->base, 0x0, 0x0, 0xff);
}
return current;
/* FIXME: implement this. */
}
unsigned long acpi_fill_madt(unsigned long current)
@ -83,114 +70,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
{
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_mcfg_t *mcfg;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT table. */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* We explicitly add these tables later on: */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
/* we should align FACS to 64B as per ACPI specs */
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
dsdt->length);
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
/* If we want to use HPET timers Linux wants an MADT. */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
printk(BIOS_DEBUG, "ACPI: * SLIT\n");
slit = (acpi_slit_t *) current;
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -35,24 +35,11 @@
#include "southbridge/via/k8t890/k8t890.h"
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
#include <cpu/amd/amdk8_sysconf.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
void get_bus_conf(void)
{
device_t dev;
struct resource *res;
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CF_5, 0);
if (!dev)
return current;
res = find_resource(dev, K8T890_MMCONFIG_MBAR);
if (res) {
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, res->base, 0x0, 0x0, 0xff);
}
return current;
/* FIXME: implement this. */
}
unsigned long acpi_fill_madt(unsigned long current)
@ -84,115 +71,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
{
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_mcfg_t *mcfg;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT table. */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* We explicitly add these tables later on: */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
/* we should align FACS to 64B as per ACPI specs */
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
dsdt->length);
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
/* If we want to use HPET timers Linux wants an MADT. */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
printk(BIOS_DEBUG, "ACPI: * SLIT\n");
slit = (acpi_slit_t *) current;
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -38,12 +38,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -60,14 +60,6 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta
return (unsigned long) (acpigen_get_current());
}
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -34,14 +34,6 @@
#include <device/pci.h>
#include <cpu/amd/amdk8_sysconf.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Not implemented */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@ -92,112 +84,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
{
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_mcfg_t *mcfg;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT table. */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/* We explicitly add these tables later on: */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
/* we should align FACS to 64B as per ACPI specs */
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
dsdt->checksum = 0; /* Don't trust iasl to get this right. */
dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
dsdt->length);
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
/* If we want to use HPET timers Linux wants an MADT. */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
printk(BIOS_DEBUG, "ACPI: * SLIT\n");
slit = (acpi_slit_t *) current;
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp, slit);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -39,12 +39,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -37,12 +37,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -37,12 +37,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -23,30 +23,14 @@
#include "mb_sysconf.h"
#include <cpu/amd/model_fxx_powernow.h>
extern unsigned pm_base;
extern const unsigned char AmlCode[];
#if CONFIG_ACPI_SSDTX_NUM >= 1
extern const unsigned char AmlCode_ssdt2[];
extern const unsigned char AmlCode_ssdt3[];
extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base=0x18;
struct mb_sysconf_t *m;
get_bus_conf();
m = sysconf.mb;
/* create all subtables for processors */
@ -144,156 +128,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
#if CONFIG_SET_FIDVID
amd_model_fxx_generate_powernow(pm_base + 0x10, 6, 1);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
#endif
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_xsdt_t *xsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_srat_t *srat;
acpi_slit_t *slit;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn
/* Align ACPI tables to 16byte */
start = ( start + 0x0f ) & -0x10;
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
xsdt = (acpi_xsdt_t *) current;
current += sizeof(acpi_xsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, xsdt);
acpi_write_rsdt(rsdt);
acpi_write_xsdt(xsdt);
/*
* We explicitly add these tables later on:
*/
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp,hpet);
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current+=madt->header.length;
acpi_add_table(rsdp,madt);
/* SRAT */
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current+=srat->header.length;
acpi_add_table(rsdp,srat);
/* SLIT */
printk(BIOS_DEBUG, "ACPI: * SLIT\n");
slit = (acpi_slit_t *) current;
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, "DYNADATA");
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
#if CONFIG_ACPI_SSDTX_NUM >= 1
int i;
void *p;
acpi_header_t *ssdtx;
//same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
if((sysconf.pci1234[i] & 1) != 1 ) continue;
uint8_t c;
if(i<7) {
c = (uint8_t) ('4' + i - 1);
}
else {
c = (uint8_t) ('A' + i - 1 - 6);
}
printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); //pci0 and pci1 are in dsdt
current = ( current + 0x07) & -0x08;
ssdtx = (acpi_header_t *)current;
switch(sysconf.hcid[i]) {
case 1: //8132
p = &AmlCode_ssdt2;
break;
case 2: //8151
p = &AmlCode_ssdt3;
break;
case 3: //8131
p = &AmlCode_ssdt4;
break;
default:
//HTX no io apic
p = &AmlCode_ssdt5;
break;
}
memcpy(ssdtx, p, sizeof(acpi_header_t));
current += ssdtx->length;
memcpy(ssdtx, p, ssdtx->length);
update_ssdtx((void *)ssdtx, i);
ssdtx->checksum = 0;
ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length);
acpi_add_table(rsdp,ssdtx);
}
#endif
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
acpi_fadt_t *fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt,facs,dsdt);
acpi_add_table(rsdp,fadt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -60,12 +60,6 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta
return (unsigned long) (acpigen_get_current());
}
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -19,22 +19,12 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.h"
#include "mainboard.h"
extern const unsigned char AmlCode[];
#if CONFIG_ACPI_SSDTX_NUM >= 1
extern const unsigned char AmlCode_ssdt2[];
extern const unsigned char AmlCode_ssdt3[];
extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
@ -42,6 +32,8 @@ unsigned long acpi_fill_madt(unsigned long current)
struct mb_sysconf_t *m;
get_bus_conf();
m = sysconf.mb;
/* create all subtables for processors */
@ -137,24 +129,9 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_srat_t *srat;
acpi_slit_t *slit;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
acpi_header_t *ssdtx;
void *p;
@ -166,61 +143,6 @@ unsigned long write_acpi_tables(unsigned long start)
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/*
* We explicitly add these tables later on:
*/
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp,hpet);
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current+=madt->header.length;
acpi_add_table(rsdp,madt);
/* SRAT */
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
current+=srat->header.length;
acpi_add_table(rsdp,srat);
/* SLIT */
printk(BIOS_DEBUG, "ACPI: * SLIT\n");
slit = (acpi_slit_t *) current;
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
#if CONFIG_ACPI_SSDTX_NUM >= 1
//same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
@ -258,30 +180,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length);
acpi_add_table(rsdp,ssdtx);
}
#endif
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt,facs,dsdt);
acpi_add_table(rsdp,fadt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -0,0 +1,17 @@
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/amdk8_sysconf.h>
#include "mainboard.h"
static void mainboard_enable(device_t dev)
{
dev->ops->write_acpi_tables = mainboard_write_acpi_tables;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -0,0 +1 @@
unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp);

View file

@ -38,12 +38,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */

View file

@ -30,26 +30,10 @@
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
extern u16 pm_base;
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -72,90 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16byte */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -19,31 +19,6 @@
#include <cpu/amd/mtrr.h>
#include <cpu/amd/amdk8_sysconf.h>
#include "../../../northbridge/amd/amdk8/acpi.h"
//#include <cpu/amd/model_fxx_powernow.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
device_t dev;
unsigned long mcfg_base;
dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0));
if (!dev)
return current;
mcfg_base = pci_read_config16(dev, 0x90);
if ((mcfg_base & 0x1000) == 0)
return current;
mcfg_base = (mcfg_base & 0xf) << 28;
printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base);
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, mcfg_base, 0x0, 0x0, 0xff);
return current;
}
/* APIC */
unsigned long acpi_fill_madt(unsigned long current)
@ -86,116 +61,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
//amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_mcfg_t *mcfg;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
current = ALIGN(current, 16);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs);
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
current = ALIGN(current, 16);
dsdt = (acpi_header_t *) current;
printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt);
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
current = ALIGN(current, 16);
fadt = (acpi_fadt_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt);
current += sizeof(acpi_fadt_t);
/* Add FADT now that we have facs and dsdt. */
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
current = ALIGN(current, 16);
mcfg = (acpi_mcfg_t *) current;
printk(BIOS_DEBUG, "ACPI: * MCFG @ %p\n", mcfg);
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
current += hpet->header.length;
current = ALIGN(current, 16);
madt = (acpi_madt_t *) current;
printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt);
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
current = ALIGN(current, 16);
ssdt = (acpi_header_t *)current;
printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt);
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current);
return current;
}

View file

@ -37,12 +37,6 @@
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Not implemented */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;

View file

@ -33,16 +33,9 @@
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <southbridge/amd/rs690/rs690.h>
#include "mainboard.h"
#include <cbmem.h>
extern u16 pm_base;
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
#define GLOBAL_VARS_SIZE 0x100
typedef struct {
@ -70,24 +63,6 @@ static void acpi_write_gvars(global_vars_t *gvars)
gvars->mpen = 1;
}
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
struct resource *res;
resource_t mmconf_base = EXT_CONF_BASE_ADDRESS; // default
device_t dev = dev_find_slot(0,PCI_DEVFN(0,0));
// we report mmconf base
res = probe_resource(dev, 0x1C);
if( res )
mmconf_base = res->base;
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)current, mmconf_base, 0x0, 0x0, 0x1f); // Fix me: should i reserve 255 busses ?
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
@ -116,133 +91,19 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
return (unsigned long) (acpigen_get_current());
}
#define ALIGN_CURRENT current = (ALIGN(current, 16))
unsigned long write_acpi_tables(unsigned long start)
void mainboard_inject_dsdt(void)
{
unsigned long current;
int i;
global_vars_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, GLOBAL_VARS_SIZE);
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_srat_t *srat;
acpi_xsdt_t *xsdt;
acpi_mcfg_t *mcfg;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
if (gnvs) {
int scopelen;
memset(gnvs, 0, sizeof(*gnvs));
acpi_write_gvars(gnvs);
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16byte */
current = start;
ALIGN_CURRENT;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
ALIGN_CURRENT;
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
ALIGN_CURRENT;
xsdt = (acpi_xsdt_t *) current;
current += sizeof(acpi_xsdt_t);
ALIGN_CURRENT;
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, xsdt);
acpi_write_rsdt(rsdt);
acpi_write_xsdt(xsdt);
/*
* We explicitly add these tables later on:
*/
current = ALIGN(current, 64);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
acpi_create_facs(facs);
current += sizeof(acpi_facs_t);
/* HPET */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
acpi_create_hpet(hpet);
current += sizeof(acpi_hpet_t);
acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* MCFG */
printk(BIOS_DEBUG, "ACPI: * MCFG\n");
mcfg = (acpi_mcfg_t *) current;
acpi_create_mcfg(mcfg);
current += mcfg->header.length;
acpi_add_table(rsdp, mcfg);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *)current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
/* Pack gvars into the ACPI table area */
for (i=0; i < dsdt->length; i++) {
if (*(u32*)(((u32)dsdt) + i) == 0xBADEAFFE) {
printk(BIOS_DEBUG, "ACPI: Patching up globals in DSDT at offset 0x%04x -> 0x%08lx\n", i, current);
*(u32*)(((u32)dsdt) + i) = current;
break;
}
/* Add it to SSDT. */
scopelen = acpigen_write_scope("\\");
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
/* And fill it */
acpi_write_gvars((global_vars_t *)current);
current += GLOBAL_VARS_SIZE;
/* We patched up the DSDT, so we need to recalculate the checksum */
dsdt->checksum = 0;
dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
/* SRAT */
printk(BIOS_DEBUG, "ACPI: * SRAT\n");
srat = (acpi_srat_t *) current;
acpi_create_srat(srat);
acpi_add_table(rsdp, srat);
printk(BIOS_DEBUG, "current = %lx\n", current);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -245,7 +245,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "SIEMENS", "SITEMP ", 0x20101005)
PWDA, 1,
}
OperationRegion (GVAR, SystemMemory, 0xBADEAFFE, 0x100)
External(\NVSA)
OperationRegion (GVAR, SystemMemory, \NVSA, 0x100)
Field (GVAR, ByteAcc, NoLock, Preserve)
{
Offset (0x00),

View file

@ -38,6 +38,7 @@
#include <x86emu/x86emu.h>
#endif
#include "int15_func.h"
#include "mainboard.h"
// ****LCD panel ID support: *****
// Callback Sub-Function 00h - Get LCD Panel ID
@ -846,6 +847,7 @@ static void mainboard_enable(device_t dev)
update_subsystemid(dev);
dev->ops->init = mainboard_init; // rest of mainboard init later
dev->ops->acpi_inject_dsdt_generator = mainboard_inject_dsdt;
}
struct chip_operations mainboard_ops = {

View file

@ -0,0 +1 @@
void mainboard_inject_dsdt(void);

View file

@ -39,12 +39,6 @@ extern const unsigned char AmlCode_ssdt4[];
extern const unsigned char AmlCode_ssdt5[];
#endif
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
device_t dev;

View file

@ -30,26 +30,10 @@
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
extern u16 pm_base;
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -72,90 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16byte */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -30,26 +30,10 @@
#include <arch/cpu.h>
#include <cpu/amd/model_fxx_powernow.h>
extern u16 pm_base;
/*
* Assume the max pstate number is 8
* 0x21(33 bytes) is one package length of _PSS package
*/
#define Maxpstate 8
#define Defpkglength 0x21
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
unsigned long acpi_fill_madt(unsigned long current)
{
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -72,90 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_header_t *dsdt;
acpi_header_t *ssdt;
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
/* Align ACPI tables to 16byte */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx...\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* clear all table memory */
memset((void *)start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
/*
* We explicitly add these tables later on:
*/
/* If we want to use HPET Timers Linux wants an MADT */
printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
printk(BIOS_DEBUG, "ACPI: * MADT\n");
madt = (acpi_madt_t *) current;
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
/* SSDT */
printk(BIOS_DEBUG, "ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
/* FACS */
printk(BIOS_DEBUG, "ACPI: * FACS\n");
facs = (acpi_facs_t *) current;
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length);
/* FADT */
printk(BIOS_DEBUG, "ACPI: * FADT\n");
fadt = (acpi_fadt_t *) current;
current += sizeof(acpi_fadt_t);
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
printk(BIOS_INFO, "ACPI: done.\n");
return current;
}

View file

@ -20,13 +20,6 @@
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
return current;
}
/* APIC */
unsigned long acpi_fill_madt(unsigned long current)
{
@ -34,6 +27,8 @@ unsigned long acpi_fill_madt(unsigned long current)
device_t dev;
struct resource *res;
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -83,108 +78,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
current = ALIGN(current, 16);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs);
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
current = ALIGN(current, 16);
dsdt = (acpi_header_t *) current;
printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt);
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
current = ALIGN(current, 16);
fadt = (acpi_fadt_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt);
current += sizeof(acpi_fadt_t);
/* Add FADT now that we have facs and dsdt. */
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
current = ALIGN(current, 16);
madt = (acpi_madt_t *) current;
printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt);
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
current = ALIGN(current, 16);
ssdt = (acpi_header_t *)current;
printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt);
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current);
return current;
}

View file

@ -0,0 +1,22 @@
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/amdk8_sysconf.h>
extern u16 pm_base;
static void mainboard_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(0, 0, 0);
}
static void mainboard_enable(device_t dev)
{
dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -20,13 +20,6 @@
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
return current;
}
/* APIC */
unsigned long acpi_fill_madt(unsigned long current)
{
@ -34,6 +27,8 @@ unsigned long acpi_fill_madt(unsigned long current)
device_t dev;
struct resource *res;
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -83,108 +78,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
current = ALIGN(current, 16);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs);
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
current = ALIGN(current, 16);
dsdt = (acpi_header_t *) current;
printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt);
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
current = ALIGN(current, 16);
fadt = (acpi_fadt_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt);
current += sizeof(acpi_fadt_t);
/* Add FADT now that we have facs and dsdt. */
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
current = ALIGN(current, 16);
madt = (acpi_madt_t *) current;
printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt);
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
current = ALIGN(current, 16);
ssdt = (acpi_header_t *)current;
printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt);
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current);
return current;
}

View file

@ -0,0 +1,22 @@
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/amdk8_sysconf.h>
extern u16 pm_base;
static void mainboard_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(0, 0, 0);
}
static void mainboard_enable(device_t dev)
{
dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -20,13 +20,6 @@
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
return current;
}
/* APIC */
unsigned long acpi_fill_madt(unsigned long current)
{
@ -34,6 +27,8 @@ unsigned long acpi_fill_madt(unsigned long current)
device_t dev;
struct resource *res;
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -102,108 +97,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
current = ALIGN(current, 16);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs);
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
current = ALIGN(current, 16);
dsdt = (acpi_header_t *) current;
printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt);
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
current = ALIGN(current, 16);
fadt = (acpi_fadt_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt);
current += sizeof(acpi_fadt_t);
/* Add FADT now that we have facs and dsdt. */
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
current = ALIGN(current, 16);
madt = (acpi_madt_t *) current;
printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt);
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
current = ALIGN(current, 16);
ssdt = (acpi_header_t *)current;
printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt);
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current);
return current;
}

View file

@ -0,0 +1,22 @@
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/amdk8_sysconf.h>
extern u16 pm_base;
static void mainboard_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(0, 0, 0);
}
static void mainboard_enable(device_t dev)
{
dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -20,19 +20,14 @@
#include "northbridge/amd/amdk8/acpi.h"
#include <cpu/amd/model_fxx_powernow.h>
extern const unsigned char AmlCode[];
unsigned long acpi_fill_mcfg(unsigned long current)
{
return current;
}
/* APIC */
unsigned long acpi_fill_madt(unsigned long current)
{
device_t dev;
struct resource *res;
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@ -67,108 +62,3 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) {
k8acpi_write_vars();
amd_model_fxx_generate_powernow(0, 0, 0);
return (unsigned long) (acpigen_get_current());
}
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
acpi_rsdp_t *rsdp;
acpi_srat_t *srat;
acpi_rsdt_t *rsdt;
acpi_hpet_t *hpet;
acpi_madt_t *madt;
acpi_fadt_t *fadt;
acpi_facs_t *facs;
acpi_slit_t *slit;
acpi_header_t *ssdt;
acpi_header_t *dsdt;
/* Align ACPI tables to 16 byte. */
start = ALIGN(start, 16);
current = start;
printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
/* We need at least an RSDP and an RSDT Table */
rsdp = (acpi_rsdp_t *) current;
current += sizeof(acpi_rsdp_t);
current = ALIGN(current, 16);
rsdt = (acpi_rsdt_t *) current;
current += sizeof(acpi_rsdt_t);
/* Clear all table memory. */
memset((void *) start, 0, current - start);
acpi_write_rsdp(rsdp, rsdt, NULL);
acpi_write_rsdt(rsdt);
current = ALIGN(current, 64);
facs = (acpi_facs_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs);
current += sizeof(acpi_facs_t);
acpi_create_facs(facs);
/* DSDT */
current = ALIGN(current, 16);
dsdt = (acpi_header_t *) current;
printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt);
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
current += dsdt->length;
memcpy(dsdt, &AmlCode, dsdt->length);
printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length);
current = ALIGN(current, 16);
fadt = (acpi_fadt_t *) current;
printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt);
current += sizeof(acpi_fadt_t);
/* Add FADT now that we have facs and dsdt. */
acpi_create_fadt(fadt, facs, dsdt);
acpi_add_table(rsdp, fadt);
current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
current += sizeof(acpi_hpet_t);
acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet);
current = ALIGN(current, 16);
madt = (acpi_madt_t *) current;
printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt);
acpi_create_madt(madt);
current += madt->header.length;
acpi_add_table(rsdp, madt);
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
/* SSDT */
current = ALIGN(current, 16);
ssdt = (acpi_header_t *)current;
printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt);
acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
current += ssdt->length;
acpi_add_table(rsdp, ssdt);
printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current);
return current;
}

View file

@ -0,0 +1,22 @@
#include <console/console.h>
#include <device/device.h>
#include <arch/acpi.h>
#include <cpu/amd/model_fxx_powernow.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/amdk8_sysconf.h>
extern u16 pm_base;
static void mainboard_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(0, 0, 0);
}
static void mainboard_enable(device_t dev)
{
dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator;
}
struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};

View file

@ -23,6 +23,7 @@ config NORTHBRIDGE_AMD_AMDK8
select HAVE_DEBUG_SMBUS
select HAVE_DEBUG_CAR
select HYPERTRANSPORT_PLUGIN_SUPPORT
select PER_DEVICE_ACPI_TABLES
if NORTHBRIDGE_AMD_AMDK8
config AGP_APERTURE_SIZE

View file

@ -118,6 +118,8 @@ unsigned long acpi_fill_srat(unsigned long current)
{
struct acpi_srat_mem_state srat_mem_state;
get_bus_conf();
/* create all subtables for processors */
current = acpi_create_srat_lapics(current);
@ -141,6 +143,8 @@ unsigned long acpi_fill_slit(unsigned long current)
/* fill the first 8 byte with that num */
/* fill the next num*num byte with distance, local is 10, 1 hop mean 20, and 2 hop with 30.... */
get_bus_conf();
/* because We has assume that we know the topology of the HT connection, So we can have set if we know the node_num */
static u8 hops_8[] = { 0, 1, 1, 2, 2, 3, 3, 4,
1, 0, 2, 1, 3, 2, 4, 3,
@ -253,7 +257,7 @@ static int k8acpi_write_pci_data(int dlen, const char *name, int offset) {
return len + lenp;
}
int k8acpi_write_vars(void)
void k8acpi_write_vars(void)
{
int lens;
msr_t msr;
@ -283,7 +287,6 @@ int k8acpi_write_vars(void)
lens += k8acpi_write_HT();
//minus opcode
acpigen_patch_len(lens - 1);
return lens;
}
void update_ssdtx(void *ssdtx, int i)

View file

@ -21,6 +21,6 @@
#define AMDK8_ACPI_H
#include <arch/acpigen.h>
int k8acpi_write_vars(void);
void k8acpi_write_vars(void);
#endif

View file

@ -16,6 +16,10 @@
#include <string.h>
#include <lib.h>
#include <cpu/cpu.h>
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
#include <arch/acpi.h>
#include "acpi.h"
#endif
#include <cpu/x86/lapic.h>
#include <cpu/amd/mtrr.h>
@ -580,10 +584,42 @@ static void mcf0_control_init(struct device *dev)
#endif
}
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
static unsigned long northbridge_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp)
{
unsigned long current;
acpi_srat_t *srat;
acpi_slit_t *slit;
current = start;
current = ALIGN(current, 16);
srat = (acpi_srat_t *) current;
printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat);
acpi_create_srat(srat);
current += srat->header.length;
acpi_add_table(rsdp, srat);
/* SLIT */
current = ALIGN(current, 16);
slit = (acpi_slit_t *) current;
printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit);
acpi_create_slit(slit);
current+=slit->header.length;
acpi_add_table(rsdp,slit);
return current;
}
#endif
static struct device_operations northbridge_operations = {
.read_resources = amdk8_read_resources,
.set_resources = amdk8_set_resources,
.enable_resources = pci_dev_enable_resources,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
.acpi_fill_ssdt_generator = k8acpi_write_vars,
.write_acpi_tables = northbridge_write_acpi_tables,
#endif
.init = mcf0_control_init,
.scan_bus = amdk8_scan_chains,
.enable = 0,

View file

@ -11,7 +11,13 @@
#include <pc80/isa-dma.h>
#include <cpu/x86/lapic.h>
#include <arch/ioapic.h>
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/model_fxx_powernow.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "amd8111.h"
#define NMI_OFF 0
@ -112,6 +118,26 @@ static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
((device & 0xffff) << 16) | (vendor & 0xffff));
}
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
extern u16 pm_base;
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
static void southbridge_acpi_fill_ssdt_generator(void) {
#if CONFIG_SET_FIDVID
amd_model_fxx_generate_powernow(pm_base + 0x10, 6, 1);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
#endif
}
#endif
static struct pci_operations lops_pci = {
.set_subsystem = lpci_set_subsystem,
};
@ -121,6 +147,10 @@ static struct device_operations lpc_ops = {
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = lpc_init,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
.acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator,
#endif
.scan_bus = scan_static_bus,
.enable = amd8111_enable,
.ops_pci = &lops_pci,

View file

@ -23,6 +23,7 @@
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <lib.h>
#include <arch/acpi.h>
#include "rs690.h"
static void ht_dev_set_resources(device_t dev)
@ -84,6 +85,23 @@ static void ht_dev_set_resources(device_t dev)
pci_dev_set_resources(dev);
}
unsigned long acpi_fill_mcfg(unsigned long current)
{
#if CONFIG_EXT_CONF_SUPPORT
struct resource *res;
resource_t mmconf_base = EXT_CONF_BASE_ADDRESS; // default
device_t dev = dev_find_slot(0,PCI_DEVFN(0,0));
// we report mmconf base
res = probe_resource(dev, 0x1C);
if( res )
mmconf_base = res->base;
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)current, mmconf_base, 0x0, 0x0, 0x1f); // Fix me: should i reserve 255 busses ?
#endif
return current;
}
static void ht_dev_read_resources(device_t dev)
{
#if CONFIG_EXT_CONF_SUPPORT

View file

@ -24,9 +24,13 @@
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <pc80/mc146818rtc.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <pc80/isa-dma.h>
#include <arch/io.h>
#include <arch/ioapic.h>
#include <arch/acpi.h>
#include <cpu/amd/model_fxx_powernow.h>
#include "sb600.h"
static void lpc_init(device_t dev)
@ -215,6 +219,16 @@ static void sb600_lpc_enable_resources(device_t dev)
sb600_lpc_enable_childrens_resources(dev);
}
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
extern u16 pm_base;
static void southbridge_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(pm_base + 8, 6, 1);
}
#endif
static struct pci_operations lops_pci = {
.set_subsystem = pci_dev_set_subsystem,
};
@ -223,6 +237,10 @@ static struct device_operations lpc_ops = {
.read_resources = sb600_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = sb600_lpc_enable_resources,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
.acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator,
#endif
.init = lpc_init,
.scan_bus = scan_static_bus,
/* .enable = sb600_enable, */

View file

@ -24,12 +24,22 @@
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <pc80/mc146818rtc.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <pc80/isa-dma.h>
#include <arch/io.h>
#include <arch/ioapic.h>
#include <arch/acpi.h>
#include <cbmem.h>
#include <cpu/amd/model_fxx_powernow.h>
#include "sb700.h"
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Just a dummy */
return current;
}
static void lpc_init(device_t dev)
{
u8 byte;
@ -74,7 +84,6 @@ static void lpc_init(device_t dev)
is doing the acpi init */
#if CONFIG_HAVE_ACPI_RESUME
{
extern u8 acpi_slp_type;
u16 tmp = inw(ACPI_PM1_CNT_BLK);
acpi_slp_type = ((tmp & (7 << 10)) >> 10);
printk(BIOS_DEBUG, "SLP_TYP type was %x\n", acpi_slp_type);
@ -259,6 +268,15 @@ static void sb700_lpc_enable_resources(device_t dev)
sb700_lpc_enable_childrens_resources(dev);
}
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
static void southbridge_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(ACPI_CPU_CONTROL, 6, 1);
}
#endif
static struct pci_operations lops_pci = {
.set_subsystem = pci_dev_set_subsystem,
};
@ -267,6 +285,10 @@ static struct device_operations lpc_ops = {
.read_resources = sb700_lpc_read_resources,
.set_resources = sb700_lpc_set_resources,
.enable_resources = sb700_lpc_enable_resources,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
.acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator,
#endif
.init = lpc_init,
.scan_bus = scan_static_bus,
.ops_pci = &lops_pci,

View file

@ -24,6 +24,33 @@
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include "ck804.h"
#include <arch/acpi.h>
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
unsigned long acpi_fill_mcfg(unsigned long current)
{
device_t dev;
unsigned long mcfg_base;
dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0));
if (!dev)
return current;
mcfg_base = pci_read_config16(dev, 0x90);
if ((mcfg_base & 0x1000) == 0)
return current;
mcfg_base = (mcfg_base & 0xf) << 28;
printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base);
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, mcfg_base, 0x0, 0x0, 0xff);
return current;
}
#endif
static struct device_operations ht_ops = {
.read_resources = pci_dev_read_resources,

View file

@ -30,6 +30,7 @@
#include <pc80/isa-dma.h>
#include <arch/io.h>
#include <arch/ioapic.h>
#include <arch/acpi.h>
#include <cpu/x86/lapic.h>
#include <stdlib.h>
#include <assert.h>
@ -316,6 +317,9 @@ static struct device_operations lpc_ops = {
.read_resources = ck804_lpc_read_resources,
.set_resources = ck804_lpc_set_resources,
.enable_resources = ck804_lpc_enable_resources,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
#endif
.init = lpc_init,
.scan_bus = scan_static_bus,
// .enable = ck804_enable,
@ -345,6 +349,9 @@ static struct device_operations lpc_slave_ops = {
.read_resources = ck804_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
#endif
.init = lpc_slave_init,
// .enable = ck804_enable,
.ops_pci = &ck804_pci_ops,

View file

@ -26,8 +26,17 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <arch/acpi.h>
#include "mcp55.h"
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
unsigned long acpi_fill_mcfg(unsigned long current)
{
/* Not implemented */
return current;
}
#endif
static struct device_operations ht_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,

View file

@ -34,7 +34,13 @@
#include <arch/io.h>
#include <arch/ioapic.h>
#include <cpu/x86/lapic.h>
#include <arch/acpi.h>
#include <stdlib.h>
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
#include <arch/acpi.h>
#include <arch/acpigen.h>
#endif
#include <cpu/amd/model_fxx_powernow.h>
#include "mcp55.h"
#define NMI_OFF 0
@ -275,10 +281,23 @@ static const struct pci_driver lpc_driver __pci_driver = {
.devices = lpc_ids,
};
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
static void southbridge_acpi_fill_ssdt_generator(void)
{
amd_model_fxx_generate_powernow(0, 0, 0);
}
#endif
static struct device_operations lpc_slave_ops = {
.read_resources = mcp55_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
.acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator,
.write_acpi_tables = acpi_write_hpet,
#endif
.init = lpc_slave_init,
// .enable = mcp55_enable,
.ops_pci = &mcp55_pci_ops,

View file

@ -21,6 +21,9 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <console/console.h>
#include <arch/acpi.h>
#include <arch/acpigen.h>
#include <cpu/amd/model_fxx_powernow.h>
#include "k8t890.h"
extern unsigned long log2(unsigned long x);
@ -122,11 +125,24 @@ static void traf_ctrl_enable_k8t890(struct device *dev)
pci_write_config8(dev, 0x60, 0x80 | reg);
}
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
static void southbridge_acpi_fill_ssdt_generator(void) {
amd_model_fxx_generate_powernow(0, 0, 0);
acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS");
}
#endif
static const struct device_operations traf_ctrl_ops_m = {
.read_resources = apic_mmconfig_read_resources,
.set_resources = mmconfig_set_resources,
.enable_resources = pci_dev_enable_resources,
.enable = traf_ctrl_enable_k8m890,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
.acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator,
#endif
.ops_pci = 0,
};
@ -135,11 +151,35 @@ static const struct device_operations traf_ctrl_ops_t = {
.set_resources = mmconfig_set_resources,
.enable_resources = pci_dev_enable_resources,
.enable = traf_ctrl_enable_k8t890,
#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES)
.write_acpi_tables = acpi_write_hpet,
#endif
.ops_pci = 0,
};
/* K8X800 chipsets have no APIC; no 800 PCI ids here */
unsigned long acpi_fill_mcfg(unsigned long current)
{
device_t dev;
struct resource *res;
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0);
if (!dev)
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CF_5, 0);
if (!dev)
dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8M890CE_5, 0);
if (!dev)
return current;
res = find_resource(dev, K8T890_MMCONFIG_MBAR);
if (res) {
current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)
current, res->base, 0x0, 0x0, 0xff);
}
return current;
}
static const struct pci_driver northbridge_driver_t __pci_driver = {
.ops = &traf_ctrl_ops_t,