diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2013-02-03 23:41:41 +0100 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-02-08 21:28:49 -0500 |
commit | 3219dfa8ec9c62e409d7e740c48ecd78770072c3 (patch) | |
tree | 4c24b4c8542f1f7d53057cb72fa9102d1d654244 | |
parent | c0a2284d858d463ec11597815d542d11fceac768 (diff) | |
download | seabios-3219dfa8ec9c62e409d7e740c48ecd78770072c3.tar.gz |
Add find_pmtimer() function
With CSM (and maybe coreboot) we'll want to find the pmtimer from the ACPI
tables, instead of knowing where it is and *putting* it into the ACPI
tables.
Extract the first part of the existing find_resume_vector() function into
a find_fadt() function, and use it from both find_resume_vector() and our
new find_pmtimer().
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | src/acpi.c | 48 | ||||
-rw-r--r-- | src/acpi.h | 1 |
2 files changed, 37 insertions, 12 deletions
@@ -889,16 +889,16 @@ acpi_setup(void) dprintf(1, "ACPI tables: RSDP=%p RSDT=%p\n", rsdp, rsdt); } -u32 -find_resume_vector(void) +static struct fadt_descriptor_rev1 * +find_fadt(void) { dprintf(4, "rsdp=%p\n", RsdpAddr); if (!RsdpAddr || RsdpAddr->signature != RSDP_SIGNATURE) - return 0; + return NULL; struct rsdt_descriptor_rev1 *rsdt = (void*)RsdpAddr->rsdt_physical_address; dprintf(4, "rsdt=%p\n", rsdt); if (!rsdt || rsdt->signature != RSDT_SIGNATURE) - return 0; + return NULL; void *end = (void*)rsdt + rsdt->length; int i; for (i=0; (void*)&rsdt->table_offset_entry[i] < end; i++) { @@ -906,13 +906,37 @@ find_resume_vector(void) if (!fadt || fadt->signature != FACP_SIGNATURE) continue; dprintf(4, "fadt=%p\n", fadt); - struct facs_descriptor_rev1 *facs = (void*)fadt->firmware_ctrl; - dprintf(4, "facs=%p\n", facs); - if (! facs || facs->signature != FACS_SIGNATURE) - return 0; - // Found it. - dprintf(4, "resume addr=%d\n", facs->firmware_waking_vector); - return facs->firmware_waking_vector; + return fadt; } - return 0; + dprintf(4, "no fadt found\n"); + return NULL; +} + +u32 +find_resume_vector(void) +{ + struct fadt_descriptor_rev1 *fadt = find_fadt(); + if (!fadt) + return 0; + struct facs_descriptor_rev1 *facs = (void*)fadt->firmware_ctrl; + dprintf(4, "facs=%p\n", facs); + if (! facs || facs->signature != FACS_SIGNATURE) + return 0; + // Found it. + dprintf(4, "resume addr=%d\n", facs->firmware_waking_vector); + return facs->firmware_waking_vector; +} + +void +find_pmtimer(void) +{ + struct fadt_descriptor_rev1 *fadt = find_fadt(); + if (!fadt) + return; + u32 pm_tmr = fadt->pm_tmr_blk; + dprintf(4, "pm_tmr_blk=%x\n", pm_tmr); + if (!pm_tmr) + return; + + pmtimer_setup(pm_tmr, 3579); } @@ -5,6 +5,7 @@ void acpi_setup(void); u32 find_resume_vector(void); +void find_pmtimer(void); #define RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR " |