diff --git a/sys/ia64/acpica/acpi_machdep.c b/sys/ia64/acpica/acpi_machdep.c index e5623fb82260..b7b612fd220e 100644 --- a/sys/ia64/acpica/acpi_machdep.c +++ b/sys/ia64/acpica/acpi_machdep.c @@ -28,11 +28,12 @@ #include #include +#include +#include #include - +#include #include -#include 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 f64e4c9b8563..82869362b8c5 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);