diff options
author | marcel <marcel@FreeBSD.org> | 2010-07-07 20:07:33 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2010-07-07 20:07:33 +0000 |
commit | d729021fb8c50c0ee2ce0b12345ee671779b99e0 (patch) | |
tree | 254c169d384a15743b0908eb18baefdb6b8e201c /sys/ia64 | |
parent | f2502957ba384074e57be3968b2ffebb14eb8c8a (diff) | |
download | FreeBSD-src-d729021fb8c50c0ee2ce0b12345ee671779b99e0.zip FreeBSD-src-d729021fb8c50c0ee2ce0b12345ee671779b99e0.tar.gz |
Add acpi_find_table() -- a convenience function for looking up an
ACPI table given the signature.
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/acpica/acpi_machdep.c | 39 | ||||
-rw-r--r-- | sys/ia64/include/md_var.h | 1 |
2 files changed, 38 insertions, 2 deletions
diff --git a/sys/ia64/acpica/acpi_machdep.c b/sys/ia64/acpica/acpi_machdep.c index e5623fb..b7b612f 100644 --- a/sys/ia64/acpica/acpi_machdep.c +++ b/sys/ia64/acpica/acpi_machdep.c @@ -28,11 +28,12 @@ #include <sys/param.h> #include <sys/bus.h> +#include <machine/md_var.h> +#include <machine/pal.h> #include <contrib/dev/acpica/include/acpi.h> - +#include <contrib/dev/acpica/include/actables.h> #include <dev/acpica/acpivar.h> -#include <machine/pal.h> int acpi_machdep_init(device_t dev) @@ -57,3 +58,37 @@ acpi_cpu_c1() { ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); } + +void * +acpi_find_table(const char *sig) +{ + ACPI_PHYSICAL_ADDRESS rsdp_ptr; + ACPI_TABLE_RSDP *rsdp; + ACPI_TABLE_XSDT *xsdt; + ACPI_TABLE_HEADER *table; + UINT64 addr; + u_int i, count; + + if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) + return (NULL); + + rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr); + xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress); + + count = (UINT64 *)((char *)xsdt + xsdt->Header.Length) - + xsdt->TableOffsetEntry; + + for (i = 0; i < count; i++) { + addr = xsdt->TableOffsetEntry[i]; + table = (ACPI_TABLE_HEADER *)IA64_PHYS_TO_RR7(addr); + + if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) + continue; + if (ACPI_FAILURE(AcpiTbChecksum((void *)table, table->Length))) + continue; + + return (table); + } + + return (NULL); +} diff --git a/sys/ia64/include/md_var.h b/sys/ia64/include/md_var.h index f64e4c9..8286936 100644 --- a/sys/ia64/include/md_var.h +++ b/sys/ia64/include/md_var.h @@ -77,6 +77,7 @@ extern uint64_t ia64_lapic_addr; extern long Maxmem; extern u_int busdma_swi_pending; +void *acpi_find_table(const char *sig); void busdma_swi(void); int copyout_regstack(struct thread *, uint64_t *, uint64_t *); void cpu_mp_add(u_int, u_int, u_int); |