hpet: common ACPI generation

HPET's min ticks (minimum time between events to avoid
losing interrupts) is chipset specific, so move it to
Kconfig.

Via also has a special base address, so move it as well.

Apart from these (and the base address was already #defined),
the table is very uniform.

Change-Id: I848a2e2b0b16021c7ee5ba99097fa6a5886c3286
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/1562
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
This commit is contained in:
Patrick Georgi
2012-10-05 21:54:38 +02:00
parent ec2c18ee60
commit 9aeb69447d
36 changed files with 82 additions and 566 deletions

View File

@ -111,4 +111,8 @@ config PCI_CONF2
bool bool
default n default n
config HPET_ADDRESS
hex
default 0xfed00000 if !HPET_ADDRESS_OVERRIDE
endmenu endmenu

View File

@ -36,6 +36,11 @@
#include <timestamp.h> #include <timestamp.h>
#endif #endif
/* FIXME: Kconfig doesn't support overridable defaults :-( */
#ifndef CONFIG_HPET_MIN_TICKS
#define CONFIG_HPET_MIN_TICKS 0x1000
#endif
u8 acpi_checksum(u8 *table, u32 length) u8 acpi_checksum(u8 *table, u32 length)
{ {
u8 ret = 0; u8 ret = 0;
@ -356,7 +361,6 @@ void acpi_create_slit(acpi_slit_t *slit)
/* http://www.intel.com/hardwaredesign/hpetspec_1.pdf */ /* http://www.intel.com/hardwaredesign/hpetspec_1.pdf */
void acpi_create_hpet(acpi_hpet_t *hpet) void acpi_create_hpet(acpi_hpet_t *hpet)
{ {
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header); acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr); acpi_addr_t *addr = &(hpet->addr);
@ -375,12 +379,12 @@ void acpi_create_hpet(acpi_hpet_t *hpet)
addr->space_id = 0; /* Memory */ addr->space_id = 0; /* Memory */
addr->bit_width = 64; addr->bit_width = 64;
addr->bit_offset = 0; addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff; addr->addrl = CONFIG_HPET_ADDRESS & 0xffffffff;
addr->addrh = HPET_ADDR >> 32; addr->addrh = ((unsigned long long)CONFIG_HPET_ADDRESS) >> 32;
hpet->id = 0x102282a0; /* AMD! FIXME */ hpet->id = *(unsigned int*)CONFIG_HPET_ADDRESS;
hpet->number = 0; hpet->number = 0;
hpet->min_tick = 4096; hpet->min_tick = CONFIG_HPET_MIN_TICKS;
header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t)); header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
} }

View File

@ -53,38 +53,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
static long acpi_create_ecdt(acpi_ecdt_t * ecdt) static long acpi_create_ecdt(acpi_ecdt_t * ecdt)
{ {
/* Attention: Make sure these match the values from /* Attention: Make sure these match the values from
@ -230,7 +198,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -54,38 +54,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -176,7 +144,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -43,38 +43,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->mpen = 1; /* Enable Multi Processing */ gnvs->mpen = 1; /* Enable Multi Processing */
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -162,7 +130,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -51,38 +51,6 @@ unsigned long acpi_fill_mcfg(unsigned long current)
return current; return current;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, "IC ", 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
// XXX factory bios just puts an address here -- who's right?
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x80861234;
hpet->number = 0x00;
hpet->min_tick = 0x0090;
header->checksum = acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
#define IO_APIC0 2 #define IO_APIC0 2
#define IO_APIC1 3 #define IO_APIC1 3
@ -177,7 +145,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -109,38 +109,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -254,7 +222,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -189,7 +189,7 @@ void main(unsigned long bist)
smbusbar: SMBUS_IO_BASE, smbusbar: SMBUS_IO_BASE,
wdbbar: 0x4000000, wdbbar: 0x4000000,
wdbsize: 0x1000, wdbsize: 0x1000,
hpet_address: HPET_ADDR, hpet_address: CONFIG_HPET_ADDRESS,
rcba: DEFAULT_RCBABASE, rcba: DEFAULT_RCBABASE,
pmbase: DEFAULT_PMBASE, pmbase: DEFAULT_PMBASE,
gpiobase: DEFAULT_GPIOBASE, gpiobase: DEFAULT_GPIOBASE,

View File

@ -55,37 +55,6 @@ static void acpi_create_gnvs(global_nvs_t * gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t *hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *)hpet, 0, sizeof(acpi_hpet_t));
/* Fill out header fields. */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* Fill out HPET address. */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -180,7 +149,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -54,38 +54,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -176,7 +144,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -55,38 +55,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -188,7 +156,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -55,38 +55,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -188,7 +156,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -23,76 +23,6 @@
extern const unsigned char AmlCode[]; extern const unsigned char AmlCode[];
static void acpi_create_hpet_new(acpi_hpet_t *);
static int acpi_create_hpet_new_fill(acpi_hpet_t *, u32, u16, u8);
static unsigned long acpi_fill_hpet_new(unsigned long);
void acpi_create_hpet_new(acpi_hpet_t *hpet)
{
acpi_header_t *header=&(hpet->header);
unsigned long current=(unsigned long)hpet;
memset((void *)hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
current = acpi_fill_hpet_new(current);
/* recalculate length */
header->length = current - (unsigned long)hpet;
header->checksum = acpi_checksum((void *)hpet, header->length);
}
int acpi_create_hpet_new_fill(acpi_hpet_t *hpet, u32 base, u16 min, u8 attr)
{
static u8 num = 0;
acpi_addr_t *addr = &(hpet->addr);
hpet->id = read32(base + 0x000);
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 0;
addr->bit_offset = 0;
addr->addrl = base;
addr->addrh = 0;
hpet->number = num++;
hpet->min_tick = min;
hpet->attributes = attr;
return (sizeof(acpi_hpet_t));
}
static unsigned long acpi_fill_hpet_new(unsigned long current)
{
#if 1
device_t dev;
unsigned long hpet_base;
dev = dev_find_slot(0x0, PCI_DEVFN(0x1,0));
if (!dev)
return current;
hpet_base = pci_read_config32(dev, 0x44) & ~0xf;
printk(BIOS_INFO, "hpet_base %lx.\n", hpet_base);
current += acpi_create_hpet_new_fill((acpi_hpet_t *)current, hpet_base, 250, 1);
#endif
return current;
}
unsigned long acpi_fill_mcfg(unsigned long current) unsigned long acpi_fill_mcfg(unsigned long current)
{ {
device_t dev; device_t dev;
@ -239,7 +169,7 @@ unsigned long write_acpi_tables(unsigned long start)
current = ALIGN(current, 16); current = ALIGN(current, 16);
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet);
acpi_create_hpet_new(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
current += hpet->header.length; current += hpet->header.length;

View File

@ -55,38 +55,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005; gnvs->did[4] = 0x00000005;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -188,7 +156,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -106,38 +106,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->chromeos.vbt2 = ec_read(0xcb) ? ACTIVE_ECFW_RW : ACTIVE_ECFW_RO; gnvs->chromeos.vbt2 = ec_read(0xcb) ? ACTIVE_ECFW_RW : ACTIVE_ECFW_RO;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -251,7 +219,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -155,7 +155,7 @@ void main(unsigned long bist)
.smbusbar = SMBUS_IO_BASE, .smbusbar = SMBUS_IO_BASE,
.wdbbar = 0x4000000, .wdbbar = 0x4000000,
.wdbsize = 0x1000, .wdbsize = 0x1000,
.hpet_address = HPET_ADDR, .hpet_address = CONFIG_HPET_ADDRESS,
.rcba = DEFAULT_RCBABASE, .rcba = DEFAULT_RCBABASE,
.pmbase = DEFAULT_PMBASE, .pmbase = DEFAULT_PMBASE,
.gpiobase = DEFAULT_GPIOBASE, .gpiobase = DEFAULT_GPIOBASE,

View File

@ -110,38 +110,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO;
} }
static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x8086a201; /* Intel */
hpet->number = 0x00;
hpet->min_tick = 0x0080;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local APICs */ /* Local APICs */
@ -255,7 +223,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
ALIGN_CURRENT; ALIGN_CURRENT;
acpi_create_intel_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -190,7 +190,7 @@ void main(unsigned long bist)
smbusbar: SMBUS_IO_BASE, smbusbar: SMBUS_IO_BASE,
wdbbar: 0x4000000, wdbbar: 0x4000000,
wdbsize: 0x1000, wdbsize: 0x1000,
hpet_address: HPET_ADDR, hpet_address: CONFIG_HPET_ADDRESS,
rcba: DEFAULT_RCBABASE, rcba: DEFAULT_RCBABASE,
pmbase: DEFAULT_PMBASE, pmbase: DEFAULT_PMBASE,
gpiobase: DEFAULT_GPIOBASE, gpiobase: DEFAULT_GPIOBASE,

View File

@ -76,37 +76,6 @@ static void acpi_write_gvars(global_vars_t *gvars)
gvars->mpen = 1; gvars->mpen = 1;
} }
static void acpi_create_my_hpet(acpi_hpet_t *hpet)
{
#define HPET_ADDR 0xfed00000ULL
acpi_header_t *header=&(hpet->header);
acpi_addr_t *addr=&(hpet->addr);
memset((void *)hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x43538301;
hpet->number = 0;
hpet->min_tick = 20;
header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
}
#if DUMP_ACPI_TABLES == 1 #if DUMP_ACPI_TABLES == 1
static void dump_mem(u32 start, u32 end) static void dump_mem(u32 start, u32 end)
{ {
@ -231,7 +200,7 @@ unsigned long write_acpi_tables(unsigned long start)
/* HPET */ /* HPET */
printk(BIOS_DEBUG, "ACPI: * HPET\n"); printk(BIOS_DEBUG, "ACPI: * HPET\n");
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
acpi_create_my_hpet(hpet); acpi_create_hpet(hpet);
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);

View File

@ -51,40 +51,6 @@ unsigned long acpi_fill_mcfg(unsigned long current)
return current; return current;
} }
static void acpi_create_via_hpet(acpi_hpet_t * hpet)
{
#define HPET_ADDR 0xfe800000ULL
acpi_header_t *header = &(hpet->header);
acpi_addr_t *addr = &(hpet->addr);
memset((void *) hpet, 0, sizeof(acpi_hpet_t));
/* fill out header fields */
memcpy(header->signature, "HPET", 4);
memcpy(header->oem_id, OEM_ID, 6);
memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
memcpy(header->asl_compiler_id, ASLC, 4);
header->length = sizeof(acpi_hpet_t);
header->revision = 1;
/* fill out HPET address */
// XXX factory bios just puts an address here -- who's right?
addr->space_id = 0; /* Memory */
addr->bit_width = 64;
addr->bit_offset = 0;
addr->addrl = HPET_ADDR & 0xffffffff;
addr->addrh = HPET_ADDR >> 32;
hpet->id = 0x11068201; /* VIA */
hpet->number = 0x00;
hpet->min_tick = 0x0090;
header->checksum =
acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
}
unsigned long acpi_fill_madt(unsigned long current) unsigned long acpi_fill_madt(unsigned long current)
{ {
/* Local Apic */ /* Local Apic */
@ -153,7 +119,7 @@ unsigned long write_acpi_tables(unsigned long start)
hpet = (acpi_hpet_t *) current; hpet = (acpi_hpet_t *) current;
current += sizeof(acpi_hpet_t); current += sizeof(acpi_hpet_t);
acpi_create_via_hpet(hpet); acpi_create_hpet(hpet);
acpi_add_table(rsdp, hpet); acpi_add_table(rsdp, hpet);
/* If we want to use HPET Timers Linux wants an MADT */ /* If we want to use HPET Timers Linux wants an MADT */

View File

@ -28,6 +28,8 @@ config CX700_VIDEO_MB_128MB
endchoice endchoice
if NORTHBRIDGE_VIA_CX700
config VIDEO_MB config VIDEO_MB
int int
default 0 if CX700_VIDEO_MB_OFF default 0 if CX700_VIDEO_MB_OFF
@ -36,5 +38,16 @@ config VIDEO_MB
default 32 if CX700_VIDEO_MB_32MB default 32 if CX700_VIDEO_MB_32MB
default 64 if CX700_VIDEO_MB_64MB default 64 if CX700_VIDEO_MB_64MB
default 128 if CX700_VIDEO_MB_128MB default 128 if CX700_VIDEO_MB_128MB
depends on NORTHBRIDGE_VIA_CX700
config HPET_ADDRESS_OVERRIDE
def_bool y
config HPET_ADDRESS
hex
default 0xfe800000
config HPET_MIN_TICKS
hex
default 0x90
endif

View File

@ -32,7 +32,6 @@
#include <stdlib.h> #include <stdlib.h>
#define ACPI_IO_BASE 0x400 #define ACPI_IO_BASE 0x400
#define HPET_ADDR 0xfe800000UL
static const unsigned char pci_irqs[4] = { 11, 11, 10, 10 }; static const unsigned char pci_irqs[4] = { 11, 11, 10, 10 };
@ -229,7 +228,7 @@ static void cx700_set_lpc_registers(struct device *dev)
pci_write_config8(dev, 0x40, 0x54); pci_write_config8(dev, 0x40, 0x54);
/* Enable HPET timer */ /* Enable HPET timer */
pci_write_config32(dev, 0x68, (1 << 31) | (HPET_ADDR >> 8)); pci_write_config32(dev, 0x68, (1 << 31) | (CONFIG_HPET_ADDRESS >> 8));
} }

View File

@ -59,4 +59,8 @@ config SATA_MODE
default 1 if SATA_MODE_IDE default 1 if SATA_MODE_IDE
default 0 if SATA_MODE_AHCI default 0 if SATA_MODE_AHCI
config HPET_MIN_TICKS
hex
default 0x14
endif endif

View File

@ -55,4 +55,8 @@ config SERIRQ_CONTINUOUS_MODE
If you set this option to y, the serial IRQ machine will be If you set this option to y, the serial IRQ machine will be
operated in continuous mode. operated in continuous mode.
config HPET_MIN_TICKS
hex
default 0x80
endif endif

View File

@ -47,7 +47,6 @@
#define DEFAULT_GPIOBASE 0x0480 #define DEFAULT_GPIOBASE 0x0480
#define DEFAULT_PMBASE 0x0500 #define DEFAULT_PMBASE 0x0500
#define HPET_ADDR 0xfed00000
#define DEFAULT_RCBA 0xfed1c000 #define DEFAULT_RCBA 0xfed1c000
#ifndef __ACPI__ #ifndef __ACPI__

View File

@ -2,3 +2,12 @@ config SOUTHBRIDGE_INTEL_I3100
bool bool
select IOAPIC select IOAPIC
select HAVE_HARD_RESET select HAVE_HARD_RESET
if SOUTHBRIDGE_INTEL_I3100
config HPET_MIN_TICKS
hex
default 0x90
endif

View File

@ -33,7 +33,6 @@ int smbus_read_byte(u8 device, u8 address);
#define SMBUS_IO_BASE 0x0f00 #define SMBUS_IO_BASE 0x0f00
#define PMBASE_ADDR 0x0400 #define PMBASE_ADDR 0x0400
#define HPET_ADDR 0xfed00000
#define PCI_DMA_CFG 0x90 #define PCI_DMA_CFG 0x90
#define SERIRQ_CNTL 0x64 #define SERIRQ_CNTL 0x64

View File

@ -34,7 +34,6 @@ int smbus_read_byte(u8 device, u8 address);
#define SMBUS_IO_BASE 0x0f00 #define SMBUS_IO_BASE 0x0f00
#define PMBASE_ADDR 0x0400 #define PMBASE_ADDR 0x0400
#define GPIO_BASE_ADDR 0x0500 #define GPIO_BASE_ADDR 0x0500
#define HPET_ADDR 0xfed00000
#define SECSTS 0x1e #define SECSTS 0x1e

View File

@ -41,15 +41,6 @@ int smbus_read_byte(unsigned device, unsigned address);
#endif #endif
#endif #endif
/*
* HPET Memory Address Range. Possible values:
* 0xfed00000 for FED0_0000h - FED0_03FFh
* 0xfed01000 for FED0_1000h - FED0_13FFh
* 0xfed02000 for FED0_2000h - FED0_23FFh
* 0xfed03000 for FED0_3000h - FED0_33FFh
*/
#define HPET_ADDR 0xfed00000
#define DEBUG_PERIODIC_SMIS 0 #define DEBUG_PERIODIC_SMIS 0
#define MAINBOARD_POWER_OFF 0 #define MAINBOARD_POWER_OFF 0

View File

@ -233,7 +233,7 @@ static void enable_hpet(struct device *dev)
u32 reg32, hpet, val; u32 reg32, hpet, val;
/* Set HPET base address and enable it */ /* Set HPET base address and enable it */
printk(BIOS_DEBUG, "Enabling HPET at 0x%x\n", HPET_ADDR); printk(BIOS_DEBUG, "Enabling HPET at 0x%x\n", CONFIG_HPET_ADDRESS);
reg32 = pci_read_config32(dev, GEN_CNTL); reg32 = pci_read_config32(dev, GEN_CNTL);
/* /*
* Bit 17 is HPET enable bit. * Bit 17 is HPET enable bit.
@ -241,7 +241,7 @@ static void enable_hpet(struct device *dev)
*/ */
reg32 &= ~(3 << 15); /* Clear it */ reg32 &= ~(3 << 15); /* Clear it */
hpet = HPET_ADDR >> 12; hpet = CONFIG_HPET_ADDRESS >> 12;
hpet &= 0x3; hpet &= 0x3;
reg32 |= (hpet << 15); reg32 |= (hpet << 15);
@ -254,7 +254,7 @@ static void enable_hpet(struct device *dev)
val &= 0x7; val &= 0x7;
if ((val & 0x4) && (hpet == (val & 0x3))) { if ((val & 0x4) && (hpet == (val & 0x3))) {
printk(BIOS_INFO, "HPET enabled at 0x%x\n", HPET_ADDR); printk(BIOS_INFO, "HPET enabled at 0x%x\n", CONFIG_HPET_ADDRESS);
} else { } else {
printk(BIOS_WARNING, "HPET was not enabled correctly\n"); printk(BIOS_WARNING, "HPET was not enabled correctly\n");
reg32 &= ~(1 << 17); /* Clear Enable */ reg32 &= ~(1 << 17); /* Clear Enable */

View File

@ -41,7 +41,10 @@ config USBDEBUG_DEFAULT_PORT
config BOOTBLOCK_SOUTHBRIDGE_INIT config BOOTBLOCK_SOUTHBRIDGE_INIT
string string
default "southbridge/intel/i82801gx/bootblock.c" default "southbridge/intel/i82801gx/bootblock.c"
depends on SOUTHBRIDGE_INTEL_I82801GX
config HPET_MIN_TICKS
hex
default 0x80
endif endif

View File

@ -32,7 +32,6 @@
#define DEFAULT_GPIOBASE 0x0480 #define DEFAULT_GPIOBASE 0x0480
#define DEFAULT_PMBASE 0x0500 #define DEFAULT_PMBASE 0x0500
#define HPET_ADDR 0xfed00000
#define DEFAULT_RCBA 0xfed1c000 #define DEFAULT_RCBA 0xfed1c000
#ifndef __ACPI__ #ifndef __ACPI__

View File

@ -48,5 +48,9 @@ config CMC_FILE
The path and filename of the file to use as CMC state machine The path and filename of the file to use as CMC state machine
binary. binary.
config HPET_MIN_TICKS
hex
default 0x80
endif endif

View File

@ -38,4 +38,8 @@ config CK804_NUM
int int
default 1 default 1
config HPET_MIN_TICKS
hex
default 0xfa
endif endif

View File

@ -387,8 +387,8 @@ static void vt8237a_init(struct device *dev)
/* Host Bus Power Management Control, maybe not needed */ /* Host Bus Power Management Control, maybe not needed */
pci_write_config8(dev, 0x8c, 0x5); pci_write_config8(dev, 0x8c, 0x5);
/* Enable HPET at VT8237R_HPET_ADDR. */ /* Enable HPET */
pci_write_config32(dev, 0x68, (VT8237R_HPET_ADDR | 0x80)); pci_write_config32(dev, 0x68, (CONFIG_HPET_ADDRESS | 0x80));
southbridge_init_common(dev); southbridge_init_common(dev);
@ -426,8 +426,8 @@ static void vt8237s_init(struct device *dev)
/* Host Bus Power Management Control, maybe not needed */ /* Host Bus Power Management Control, maybe not needed */
pci_write_config8(dev, 0x8c, 0x5); pci_write_config8(dev, 0x8c, 0x5);
/* Enable HPET at VT8237R_HPET_ADDR., does not work correctly on R. */ /* Enable HPET, does not work correctly on R. */
pci_write_config32(dev, 0x68, (VT8237R_HPET_ADDR | 0x80)); pci_write_config32(dev, 0x68, (CONFIG_HPET_ADDRESS | 0x80));
southbridge_init_common(dev); southbridge_init_common(dev);

View File

@ -33,7 +33,6 @@
#else #else
#define VT8237S_SPI_MEM_BASE 0xfed02000UL #define VT8237S_SPI_MEM_BASE 0xfed02000UL
#endif #endif
#define VT8237R_HPET_ADDR 0xfed00000ULL
/* PMBASE FIXME mostly taken from ich7 */ /* PMBASE FIXME mostly taken from ich7 */
#define PM1_STS 0x00 #define PM1_STS 0x00