epia-m support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1655 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
* written by Stefan Reinauer <stepan@openbios.org>
|
||||
* (C) 2004 SUSE LINUX AG
|
||||
*/
|
||||
/* ACPI FADT, FACS, and DSDT table support added by
|
||||
* Nick Barker <nick.barker9@btinternet.com>, and those portions
|
||||
* (C) Copyright 2004 Nick Barker
|
||||
*/
|
||||
|
||||
#include <console/console.h>
|
||||
#include <string.h>
|
||||
@@ -22,7 +26,15 @@
|
||||
#define OEM_ID "LXBIOS"
|
||||
#define ASLC "NONE"
|
||||
|
||||
static u8 acpi_checksum(u8 *table, u32 length)
|
||||
|
||||
// FIX ME - define needs declaring / setting in Config files
|
||||
#define HAVE_ACPI_FADT
|
||||
|
||||
#ifdef HAVE_ACPI_FADT
|
||||
extern unsigned char AmlCode[];
|
||||
#endif
|
||||
|
||||
u8 acpi_checksum(u8 *table, u32 length)
|
||||
{
|
||||
u8 ret=0;
|
||||
while (length--) {
|
||||
@@ -43,13 +55,15 @@ static void acpi_add_table(acpi_rsdt_t *rsdt, void *table)
|
||||
for (i=0; i<8; i++) {
|
||||
if(rsdt->entry[i]==0) {
|
||||
rsdt->entry[i]=(u32)table;
|
||||
/* fix length to stop kernel winging about invalid entries */
|
||||
rsdt->header.length = sizeof(acpi_header_t) + (sizeof(u32) * (i+1));
|
||||
/* fix checksum */
|
||||
/* hope this won't get optimized away */
|
||||
rsdt->header.checksum=0;
|
||||
rsdt->header.checksum=acpi_checksum((u8 *)rsdt,
|
||||
rsdt->header.length);
|
||||
|
||||
printk_debug("ACPI: added table %d/8\n",i+1);
|
||||
printk_debug("ACPI: added table %d/8 Length now %d\n",i+1,rsdt->header.length);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -181,6 +195,22 @@ static void acpi_create_hpet(acpi_hpet_t *hpet)
|
||||
header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
|
||||
}
|
||||
|
||||
static void acpi_create_facs(acpi_facs_t *facs)
|
||||
{
|
||||
|
||||
memset( (void *)facs,0, sizeof(acpi_facs_t));
|
||||
|
||||
memcpy(facs->signature,"FACS",4);
|
||||
facs->length = sizeof(acpi_facs_t);
|
||||
facs->hardware_signature = 0;
|
||||
facs->firmware_waking_vector = 0;
|
||||
facs->global_lock = 0;
|
||||
facs->flags = 0;
|
||||
facs->x_firmware_waking_vector_l = 0;
|
||||
facs->x_firmware_waking_vector_h = 0;
|
||||
facs->version = 1;
|
||||
|
||||
}
|
||||
static void acpi_write_rsdt(acpi_rsdt_t *rsdt)
|
||||
{
|
||||
acpi_header_t *header=&(rsdt->header);
|
||||
@@ -222,6 +252,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||
acpi_rsdt_t *rsdt;
|
||||
acpi_hpet_t *hpet;
|
||||
acpi_madt_t *madt;
|
||||
acpi_fadt_t *fadt;
|
||||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
|
||||
/* Align ACPI tables to 16byte */
|
||||
start = ( start + 0x0f ) & -0x10;
|
||||
@@ -244,7 +277,6 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||
/*
|
||||
* We explicitly add these tables later on:
|
||||
*/
|
||||
#define HAVE_ACPI_HPET
|
||||
#ifdef HAVE_ACPI_HPET
|
||||
printk_debug("ACPI: * HPET\n");
|
||||
|
||||
@@ -263,6 +295,35 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ACPI_FADT
|
||||
|
||||
|
||||
printk_debug("ACPI: * FACS\n");
|
||||
facs = (acpi_facs_t *) current;
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
|
||||
dsdt = (acpi_header_t *)current;
|
||||
current += ((acpi_header_t *)AmlCode)->length;
|
||||
memcpy((void *)dsdt,(void *)AmlCode, ((acpi_header_t *)AmlCode)->length);
|
||||
dsdt->checksum = 0; // don't trust intel iasl compiler to get this right
|
||||
dsdt->checksum = acpi_checksum(dsdt,dsdt->length);
|
||||
printk_debug("ACPI: * DSDT @ %08x Length %x\n",dsdt,dsdt->length);
|
||||
printk_debug("ACPI: * FADT\n");
|
||||
|
||||
fadt = (acpi_fadt_t *) current;
|
||||
current += sizeof(acpi_fadt_t);
|
||||
|
||||
acpi_create_fadt(fadt,facs,dsdt);
|
||||
acpi_add_table(rsdt,fadt);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
printk_info("ACPI: done.\n");
|
||||
return current;
|
||||
}
|
||||
|
@@ -60,8 +60,13 @@ struct lb_memory *write_tables(struct mem_range *mem, unsigned long *processor_m
|
||||
low_table_end = write_smp_table(low_table_end, processor_map);
|
||||
|
||||
/* Write ACPI tables */
|
||||
low_table_end = write_acpi_tables(low_table_end);
|
||||
|
||||
/* write them in the rom area because DSDT can be large (8K on epia-m) which
|
||||
* pushes linuxbios table out of first 4K if set up in low table area
|
||||
*/
|
||||
|
||||
rom_table_end = write_acpi_tables(rom_table_end);
|
||||
rom_table_end = (rom_table_end+1023) & ~1023;
|
||||
|
||||
/* Don't write anything in the traditional x86 BIOS data segment */
|
||||
if (low_table_end < 0x500) {
|
||||
low_table_end = 0x500;
|
||||
|
@@ -7,6 +7,9 @@
|
||||
* The ACPI table structs are based on the Linux kernel sources.
|
||||
*
|
||||
*/
|
||||
/* ACPI FADT & FACS added by Nick Barker <nick.barker9@btinternet.com>
|
||||
* those parts (C) 2004 Nick Barker
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ASM_ACPI_H
|
||||
@@ -134,7 +137,77 @@ typedef struct acpi_madt_irqoverride {
|
||||
} __attribute__ ((packed)) acpi_madt_irqoverride_t;
|
||||
|
||||
|
||||
typedef struct acpi_fadt {
|
||||
struct acpi_table_header header;
|
||||
u32 firmware_ctrl;
|
||||
u32 dsdt;
|
||||
u8 res1;
|
||||
u8 preferred_pm_profile;
|
||||
u16 sci_int;
|
||||
u32 smi_cmd;
|
||||
u8 acpi_enable;
|
||||
u8 acpi_disable;
|
||||
u8 s4bios_req;
|
||||
u8 pstate_cnt;
|
||||
u32 pm1a_evt_blk;
|
||||
u32 pm1b_evt_blk;
|
||||
u32 pm1a_cnt_blk;
|
||||
u32 pm1b_cnt_blk;
|
||||
u32 pm2_cnt_blk;
|
||||
u32 pm_tmr_blk;
|
||||
u32 gpe0_blk;
|
||||
u32 gpe1_blk;
|
||||
u8 pm1_evt_len;
|
||||
u8 pm1_cnt_len;
|
||||
u8 pm2_cnt_len;
|
||||
u8 pm_tmr_len;
|
||||
u8 gpe0_blk_len;
|
||||
u8 gpe1_blk_len;
|
||||
u8 gpe1_base;
|
||||
u8 cst_cnt;
|
||||
u16 p_lvl2_lat;
|
||||
u16 p_lvl3_lat;
|
||||
u16 flush_size;
|
||||
u16 flush_stride;
|
||||
u8 duty_offset;
|
||||
u8 duty_width;
|
||||
u8 day_alrm;
|
||||
u8 mon_alrm;
|
||||
u8 century;
|
||||
u16 iapc_boot_arch;
|
||||
u8 res2;
|
||||
u32 flags;
|
||||
struct acpi_gen_regaddr reset_reg;
|
||||
u8 reset_value;
|
||||
u8 res3;
|
||||
u8 res4;
|
||||
u8 res5;
|
||||
u32 x_firmware_ctl_l;
|
||||
u32 x_firmware_ctl_h;
|
||||
u32 x_dsdt_l;
|
||||
u32 x_dsdt_h;
|
||||
struct acpi_gen_regaddr x_pm1a_evt_blk;
|
||||
struct acpi_gen_regaddr x_pm1b_evt_blk;
|
||||
struct acpi_gen_regaddr x_pm1a_cnt_blk;
|
||||
struct acpi_gen_regaddr x_pm1b_cnt_blk;
|
||||
struct acpi_gen_regaddr x_pm2_cnt_blk;
|
||||
struct acpi_gen_regaddr x_pm_tmr_blk;
|
||||
struct acpi_gen_regaddr x_gpe0_blk;
|
||||
struct acpi_gen_regaddr x_gpe1_blk;
|
||||
} __attribute__ ((packed)) acpi_fadt_t;
|
||||
|
||||
typedef struct acpi_facs {
|
||||
char signature[4];
|
||||
u32 length;
|
||||
u32 hardware_signature;
|
||||
u32 firmware_waking_vector;
|
||||
u32 global_lock;
|
||||
u32 flags;
|
||||
u32 x_firmware_waking_vector_l;
|
||||
u32 x_firmware_waking_vector_h;
|
||||
u8 version;
|
||||
u8 resv[33];
|
||||
} __attribute__ ((packed)) acpi_facs_t;
|
||||
|
||||
|
||||
unsigned long write_acpi_tables(unsigned long addr);
|
||||
|
@@ -116,7 +116,7 @@ gdt:
|
||||
.word 0x0000, 0x0000 /* dummy */
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
#if defined(CONFIG_VGABIOS) && (CONFIG_VGABIOS == 1)
|
||||
#if defined(CONFIG_LEGACY_VGABIOS) && (CONFIG_LEGACY_VGABIOS == 1)
|
||||
// from monty:
|
||||
/* 0x00009a00,0000ffffULL, 20h: 16-bit 64k code at 0x00000000 */
|
||||
/* 0x00009200,0000ffffULL 28h: 16-bit 64k data at 0x00000000 */
|
||||
|
Reference in New Issue
Block a user