summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2007-03-22 18:16:43 +0000
committerjkim <jkim@FreeBSD.org>2007-03-22 18:16:43 +0000
commitc06098a4065d7be63bd57c45889a91da9bc0f5e4 (patch)
treecdaa579af45ece33bafe9e4fe4c9aef8bd85ed29 /sys/dev
parent07ec417491720a77d28b1083886826f0141b171c (diff)
downloadFreeBSD-src-c06098a4065d7be63bd57c45889a91da9bc0f5e4.zip
FreeBSD-src-c06098a4065d7be63bd57c45889a91da9bc0f5e4.tar.gz
Catch up with ACPI-CA 20070320 import.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi_support/acpi_asus.c5
-rw-r--r--sys/dev/acpi_support/acpi_fujitsu.c2
-rw-r--r--sys/dev/acpi_support/acpi_ibm.c3
-rw-r--r--sys/dev/acpica/Osd/OsdDebug.c8
-rw-r--r--sys/dev/acpica/Osd/OsdMemory.c29
-rw-r--r--sys/dev/acpica/Osd/OsdSchedule.c24
-rw-r--r--sys/dev/acpica/Osd/OsdSynch.c4
-rw-r--r--sys/dev/acpica/Osd/OsdTable.c57
-rw-r--r--sys/dev/acpica/acpi.c161
-rw-r--r--sys/dev/acpica/acpi_acad.c4
-rw-r--r--sys/dev/acpica/acpi_button.c6
-rw-r--r--sys/dev/acpica/acpi_cmbat.c6
-rw-r--r--sys/dev/acpica/acpi_cpu.c45
-rw-r--r--sys/dev/acpica/acpi_dock.c2
-rw-r--r--sys/dev/acpica/acpi_ec.c33
-rw-r--r--sys/dev/acpica/acpi_lid.c4
-rw-r--r--sys/dev/acpica/acpi_pci_link.c8
-rw-r--r--sys/dev/acpica/acpi_perf.c6
-rw-r--r--sys/dev/acpica/acpi_quirk.c36
-rw-r--r--sys/dev/acpica/acpi_resource.c2
-rw-r--r--sys/dev/acpica/acpi_throttle.c10
-rw-r--r--sys/dev/acpica/acpi_timer.c18
-rw-r--r--sys/dev/acpica/acpivar.h2
23 files changed, 233 insertions, 242 deletions
diff --git a/sys/dev/acpi_support/acpi_asus.c b/sys/dev/acpi_support/acpi_asus.c
index 6703bc8..634ab25 100644
--- a/sys/dev/acpi_support/acpi_asus.c
+++ b/sys/dev/acpi_support/acpi_asus.c
@@ -443,7 +443,7 @@ acpi_asus_probe(device_t dev)
ACPI_STATUS status;
ACPI_TABLE_HEADER th;
- status = AcpiGetTableHeader(ACPI_TABLE_DSDT, 1, &th);
+ status = AcpiGetTableHeader(ACPI_SIG_DSDT, 0, &th);
if (ACPI_FAILURE(status)) {
device_printf(dev, "Unsupported (Samsung?) laptop\n");
AcpiOsFree(Buf.Pointer);
@@ -720,8 +720,7 @@ acpi_asus_led(struct acpi_asus_led *led, int state)
led->busy = 1;
led->state = state;
- AcpiOsQueueForExecution(OSD_PRIORITY_LO,
- (void *)acpi_asus_led_task, led);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, (void *)acpi_asus_led_task, led);
}
static int
diff --git a/sys/dev/acpi_support/acpi_fujitsu.c b/sys/dev/acpi_support/acpi_fujitsu.c
index 7bd43e2..7d50909 100644
--- a/sys/dev/acpi_support/acpi_fujitsu.c
+++ b/sys/dev/acpi_support/acpi_fujitsu.c
@@ -320,7 +320,7 @@ acpi_fujitsu_notify_handler(ACPI_HANDLE h, uint32_t notify, void *context)
switch (notify) {
case ACPI_NOTIFY_STATUS_CHANGED:
- AcpiOsQueueForExecution(OSD_PRIORITY_LO,
+ AcpiOsExecute(OSL_NOTIFY_HANDLER,
acpi_fujitsu_notify_status_changed, sc);
break;
default:
diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c
index d8f3cef..fe4ea9b 100644
--- a/sys/dev/acpi_support/acpi_ibm.c
+++ b/sys/dev/acpi_support/acpi_ibm.c
@@ -300,8 +300,7 @@ ibm_led(void *softc, int onoff)
sc->led_busy = 1;
sc->led_state = onoff;
- AcpiOsQueueForExecution(OSD_PRIORITY_LO,
- (void *)ibm_led_task, sc);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, (void *)ibm_led_task, sc);
}
static void
diff --git a/sys/dev/acpica/Osd/OsdDebug.c b/sys/dev/acpica/Osd/OsdDebug.c
index 946e875..b127181 100644
--- a/sys/dev/acpica/Osd/OsdDebug.c
+++ b/sys/dev/acpica/Osd/OsdDebug.c
@@ -62,14 +62,6 @@ AcpiOsGetLine(char *Buffer)
#endif /* DDB */
}
-void
-AcpiOsDbgAssert(void *FailedAssertion, void *FileName, UINT32 LineNumber,
- char *Message)
-{
- printf("ACPI: %s:%d - %s\n", (char *)FileName, LineNumber, Message);
- printf("ACPI: assertion %s\n", (char *)FailedAssertion);
-}
-
ACPI_STATUS
AcpiOsSignal(UINT32 Function, void *Info)
{
diff --git a/sys/dev/acpica/Osd/OsdMemory.c b/sys/dev/acpica/Osd/OsdMemory.c
index b99bd62..3804bb6 100644
--- a/sys/dev/acpica/Osd/OsdMemory.c
+++ b/sys/dev/acpica/Osd/OsdMemory.c
@@ -54,14 +54,10 @@ AcpiOsFree(void *Memory)
free(Memory, M_ACPICA);
}
-ACPI_STATUS
-AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length,
- void **LogicalAddress)
+void *
+AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_NATIVE_UINT Length)
{
- *LogicalAddress = pmap_mapbios((vm_offset_t)PhysicalAddress, Length);
- if (*LogicalAddress == NULL)
- return (AE_BAD_ADDRESS);
- return (AE_OK);
+ return (pmap_mapbios((vm_offset_t)PhysicalAddress, Length));
}
void
@@ -78,10 +74,23 @@ AcpiOsGetPhysicalAddress(void *LogicalAddress,
return (AE_BAD_ADDRESS);
}
+ACPI_STATUS
+AcpiOsValidateInterface (char *Interface)
+{
+ return (AE_SUPPORT);
+}
+
/*
* There is no clean way to do this. We make the charitable assumption
* that callers will not pass garbage to us.
*/
+ACPI_STATUS
+AcpiOsValidateAddress (UINT8 SpaceId, ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_SIZE Length)
+{
+ return (AE_OK);
+}
+
BOOLEAN
AcpiOsReadable (void *Pointer, ACPI_SIZE Length)
{
@@ -99,7 +108,8 @@ AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width)
{
void *LogicalAddress;
- if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK)
+ LogicalAddress = AcpiOsMapMemory(Address, Width / 8);
+ if (LogicalAddress == NULL)
return (AE_NOT_EXIST);
switch (Width) {
@@ -130,7 +140,8 @@ AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width)
{
void *LogicalAddress;
- if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK)
+ LogicalAddress = AcpiOsMapMemory(Address, Width / 8);
+ if (LogicalAddress == NULL)
return (AE_NOT_EXIST);
switch (Width) {
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index ea48266..6872ffa 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -87,7 +87,7 @@ acpi_task_execute(void *context, int pending)
* We allocate and queue a task for one of our taskqueue threads to process.
*/
ACPI_STATUS
-AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function,
+AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function,
void *Context)
{
struct acpi_task_ctx *at;
@@ -104,18 +104,20 @@ AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function,
at->at_function = Function;
at->at_context = Context;
- switch (Priority) {
- case OSD_PRIORITY_GPE:
- pri = 4;
+ switch (Type) {
+ case OSL_GPE_HANDLER:
+ pri = 10;
break;
- case OSD_PRIORITY_HIGH:
- pri = 3;
+ case OSL_GLOBAL_LOCK_HANDLER:
+ case OSL_EC_POLL_HANDLER:
+ case OSL_EC_BURST_HANDLER:
+ pri = 5;
break;
- case OSD_PRIORITY_MED:
- pri = 2;
+ case OSL_NOTIFY_HANDLER:
+ pri = 3;
break;
- case OSD_PRIORITY_LO:
- pri = 1;
+ case OSL_DEBUGGER_THREAD:
+ pri = 0;
break;
default:
free(at, M_ACPITASK);
@@ -178,7 +180,7 @@ AcpiOsStall(UINT32 Microseconds)
return_VOID;
}
-UINT32
+ACPI_THREAD_ID
AcpiOsGetThreadId(void)
{
struct proc *p;
diff --git a/sys/dev/acpica/Osd/OsdSynch.c b/sys/dev/acpica/Osd/OsdSynch.c
index 6cc6bcf..d195201 100644
--- a/sys/dev/acpica/Osd/OsdSynch.c
+++ b/sys/dev/acpica/Osd/OsdSynch.c
@@ -62,10 +62,12 @@ struct acpi_semaphore {
UINT32 as_timeouts;
};
+/* Default number of maximum pending threads. */
#ifndef ACPI_NO_SEMAPHORES
#ifndef ACPI_SEMAPHORES_MAX_PENDING
#define ACPI_SEMAPHORES_MAX_PENDING 4
#endif
+
static int acpi_semaphore_debug = 0;
TUNABLE_INT("debug.acpi_semaphore_debug", &acpi_semaphore_debug);
SYSCTL_DECL(_debug_acpi);
@@ -195,7 +197,7 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout)
break;
}
- /* limit number of pending treads */
+ /* limit number of pending threads */
if (as->as_pendings >= ACPI_SEMAPHORES_MAX_PENDING) {
result = AE_TIME;
break;
diff --git a/sys/dev/acpica/Osd/OsdTable.c b/sys/dev/acpica/Osd/OsdTable.c
index ce33e51..d9b29eb 100644
--- a/sys/dev/acpica/Osd/OsdTable.c
+++ b/sys/dev/acpica/Osd/OsdTable.c
@@ -40,26 +40,22 @@ __FBSDID("$FreeBSD$");
#include <contrib/dev/acpica/actables.h>
#undef _COMPONENT
-#define _COMPONENT ACPI_TABLES
+#define _COMPONENT ACPI_TABLES
static char acpi_osname[128];
TUNABLE_STR("hw.acpi.osname", acpi_osname, sizeof(acpi_osname));
-static struct {
- ACPI_TABLE_HEADER_DEF
- uint32_t no_op;
-} __packed fake_ssdt;
-
ACPI_STATUS
-AcpiOsPredefinedOverride (
- const ACPI_PREDEFINED_NAMES *InitVal,
- ACPI_STRING *NewVal)
+AcpiOsPredefinedOverride(const ACPI_PREDEFINED_NAMES *InitVal,
+ ACPI_STRING *NewVal)
{
+
if (InitVal == NULL || NewVal == NULL)
return (AE_BAD_PARAMETER);
*NewVal = NULL;
- if (strncmp(InitVal->Name, "_OS_", 4) == 0 && strlen(acpi_osname) > 0) {
+ if (strncmp(InitVal->Name, "_OS_", ACPI_NAME_SIZE) == 0 &&
+ strlen(acpi_osname) > 0) {
printf("ACPI: Overriding _OS definition with \"%s\"\n", acpi_osname);
*NewVal = acpi_osname;
}
@@ -68,9 +64,8 @@ AcpiOsPredefinedOverride (
}
ACPI_STATUS
-AcpiOsTableOverride (
- ACPI_TABLE_HEADER *ExistingTable,
- ACPI_TABLE_HEADER **NewTable)
+AcpiOsTableOverride(ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_TABLE_HEADER **NewTable)
{
caddr_t acpi_dsdt, p;
@@ -78,37 +73,11 @@ AcpiOsTableOverride (
return (AE_BAD_PARAMETER);
/* If we're not overriding the DSDT, just return. */
- *NewTable = NULL;
- if ((acpi_dsdt = preload_search_by_type("acpi_dsdt")) == NULL)
- return (AE_OK);
- if ((p = preload_search_info(acpi_dsdt, MODINFO_ADDR)) == NULL)
- return (AE_OK);
-
- /*
- * Override the DSDT with the user's custom version. Override the
- * contents of any SSDTs with a simple no-op table since the user's
- * DSDT is expected to contain their contents as well.
- */
- if (strncmp(ExistingTable->Signature, "DSDT", 4) == 0) {
- printf("ACPI: overriding DSDT/SSDT with custom table\n");
- *NewTable = *(void **)p;
- } else if (strncmp(ExistingTable->Signature, "SSDT", 4) == 0) {
- if (fake_ssdt.Length == 0) {
- sprintf(fake_ssdt.Signature, "%.4s", "SSDT");
- fake_ssdt.Length = htole32(sizeof(fake_ssdt));
- fake_ssdt.Revision = 2;
- fake_ssdt.Checksum = 0;
- sprintf(fake_ssdt.OemId, "%.6s", "FBSD ");
- sprintf(fake_ssdt.OemTableId, "%.8s", "NullSSDT");
- fake_ssdt.OemRevision = htole32(1);
- sprintf(fake_ssdt.AslCompilerId, "%.4s", "FBSD");
- fake_ssdt.AslCompilerRevision = htole32(1);
- fake_ssdt.no_op = htole32(0x005c0310); /* Scope(\) */
- fake_ssdt.Checksum -= AcpiTbGenerateChecksum(&fake_ssdt,
- sizeof(fake_ssdt));
- }
- *NewTable = (void *)&fake_ssdt;
- }
+ if ((acpi_dsdt = preload_search_by_type("acpi_dsdt")) == NULL ||
+ (p = preload_search_info(acpi_dsdt, MODINFO_ADDR)) == NULL) {
+ *NewTable = NULL;
+ } else
+ *NewTable = *(ACPI_TABLE_HEADER **)p;
return (AE_OK);
}
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 8812203..fde3b55 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
#include <dev/pci/pci_private.h>
+#include <vm/vm_param.h>
+
MALLOC_DEFINE(M_ACPIDEV, "acpidev", "ACPI devices");
/* Hooks for the ACPI CA debugging infrastructure */
@@ -273,39 +275,28 @@ ACPI_STATUS
acpi_Startup(void)
{
static int started = 0;
- int error, val;
+ ACPI_STATUS status;
+ int val;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
/* Only run the startup code once. The MADT driver also calls this. */
if (started)
- return_VALUE (0);
+ return_VALUE (AE_OK);
started = 1;
- /* Initialise the ACPI mutex */
- mtx_init(&acpi_mutex, "ACPI global lock", NULL, MTX_DEF);
-
/*
- * Set the globals from our tunables. This is needed because ACPI-CA
- * uses UINT8 for some values and we have no tunable_byte.
+ * Pre-allocate space for RSDT/XSDT and DSDT tables and allow resizing
+ * if more tables exist.
*/
- AcpiGbl_AllMethodsSerialized = acpi_serialize_methods;
- AcpiGbl_EnableInterpreterSlack = TRUE;
-
- /* Start up the ACPI CA subsystem. */
- if (ACPI_FAILURE(error = AcpiInitializeSubsystem())) {
- printf("ACPI: initialisation failed: %s\n", AcpiFormatException(error));
- return_VALUE (error);
- }
-
- if (ACPI_FAILURE(error = AcpiLoadTables())) {
- printf("ACPI: table load failed: %s\n", AcpiFormatException(error));
- AcpiTerminate();
- return_VALUE (error);
+ if (ACPI_FAILURE(status = AcpiInitializeTables(NULL, 2, TRUE))) {
+ printf("ACPI: Table initialisation failed: %s\n",
+ AcpiFormatException(status));
+ return_VALUE (status);
}
/* Set up any quirks we have for this system. */
- if (acpi_quirks == 0)
+ if (acpi_quirks == ACPI_Q_OK)
acpi_table_quirks(&acpi_quirks);
/* If the user manually set the disabled hint to 0, force-enable ACPI. */
@@ -313,11 +304,10 @@ acpi_Startup(void)
acpi_quirks &= ~ACPI_Q_BROKEN;
if (acpi_quirks & ACPI_Q_BROKEN) {
printf("ACPI disabled by blacklist. Contact your BIOS vendor.\n");
- AcpiTerminate();
- return_VALUE (AE_ERROR);
+ status = AE_SUPPORT;
}
- return_VALUE (AE_OK);
+ return_VALUE (status);
}
/*
@@ -341,9 +331,11 @@ acpi_identify(driver_t *driver, device_t parent)
if (device_find_child(parent, "acpi", 0) != NULL)
return_VOID;
- /* Initialize ACPI-CA. */
- if (ACPI_FAILURE(acpi_Startup()))
+ /* Initialize root tables. */
+ if (ACPI_FAILURE(acpi_Startup())) {
+ printf("ACPI: Try disabling either ACPI or apic support.\n");
return_VOID;
+ }
snprintf(acpi_ca_version, sizeof(acpi_ca_version), "%x", ACPI_CA_VERSION);
@@ -360,11 +352,11 @@ acpi_identify(driver_t *driver, device_t parent)
static int
acpi_probe(device_t dev)
{
- ACPI_TABLE_HEADER th;
- char buf[20];
- int error;
+ ACPI_TABLE_RSDP *rsdp;
+ ACPI_TABLE_HEADER *rsdt;
+ ACPI_PHYSICAL_ADDRESS paddr;
+ char buf[ACPI_OEM_ID_SIZE + ACPI_OEM_TABLE_ID_SIZE + 2];
struct sbuf sb;
- ACPI_STATUS status;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -374,30 +366,36 @@ acpi_probe(device_t dev)
return_VALUE (ENXIO);
}
- if (ACPI_FAILURE(status = AcpiGetTableHeader(ACPI_TABLE_XSDT, 1, &th))) {
- device_printf(dev, "couldn't get XSDT header: %s\n",
- AcpiFormatException(status));
- error = ENXIO;
- } else {
- sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
- sbuf_bcat(&sb, th.OemId, 6);
- sbuf_trim(&sb);
- sbuf_putc(&sb, ' ');
- sbuf_bcat(&sb, th.OemTableId, 8);
- sbuf_trim(&sb);
- sbuf_finish(&sb);
- device_set_desc_copy(dev, sbuf_data(&sb));
- sbuf_delete(&sb);
- error = 0;
- }
+ if ((paddr = AcpiOsGetRootPointer()) == 0 ||
+ (rsdp = AcpiOsMapMemory(paddr, sizeof(ACPI_TABLE_RSDP))) == NULL)
+ return_VALUE (ENXIO);
+ if (rsdp->Revision > 1 && rsdp->XsdtPhysicalAddress != 0)
+ paddr = (ACPI_PHYSICAL_ADDRESS)rsdp->XsdtPhysicalAddress;
+ else
+ paddr = (ACPI_PHYSICAL_ADDRESS)rsdp->RsdtPhysicalAddress;
+ AcpiOsUnmapMemory(rsdp, sizeof(ACPI_TABLE_RSDP));
- return_VALUE (error);
+ if ((rsdt = AcpiOsMapMemory(paddr, sizeof(ACPI_TABLE_HEADER))) == NULL)
+ return_VALUE (ENXIO);
+ sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN);
+ sbuf_bcat(&sb, rsdt->OemId, ACPI_OEM_ID_SIZE);
+ sbuf_trim(&sb);
+ sbuf_putc(&sb, ' ');
+ sbuf_bcat(&sb, rsdt->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
+ sbuf_trim(&sb);
+ sbuf_finish(&sb);
+ device_set_desc_copy(dev, sbuf_data(&sb));
+ sbuf_delete(&sb);
+ AcpiOsUnmapMemory(rsdt, sizeof(ACPI_TABLE_HEADER));
+
+ return_VALUE (0);
}
static int
acpi_attach(device_t dev)
{
struct acpi_softc *sc;
+ ACPI_TABLE_FACS *facs;
ACPI_STATUS status;
int error, state;
UINT32 flags;
@@ -409,6 +407,8 @@ acpi_attach(device_t dev)
sc = device_get_softc(dev);
sc->acpi_dev = dev;
+ error = ENXIO;
+
/* Initialize resource manager. */
acpi_rman_io.rm_type = RMAN_ARRAY;
acpi_rman_io.rm_start = 0;
@@ -423,8 +423,33 @@ acpi_attach(device_t dev)
if (rman_init(&acpi_rman_mem) != 0)
panic("acpi rman_init memory failed");
+ /* Initialise the ACPI mutex */
+ mtx_init(&acpi_mutex, "ACPI global lock", NULL, MTX_DEF);
+
+ /*
+ * Set the globals from our tunables. This is needed because ACPI-CA
+ * uses UINT8 for some values and we have no tunable_byte.
+ */
+ AcpiGbl_AllMethodsSerialized = acpi_serialize_methods;
+ AcpiGbl_EnableInterpreterSlack = TRUE;
+
+ /* Start up the ACPI CA subsystem. */
+ status = AcpiInitializeSubsystem();
+ if (ACPI_FAILURE(status)) {
+ device_printf(dev, "Could not initialize Subsystem: %s\n",
+ AcpiFormatException(status));
+ goto out;
+ }
+
+ /* Load ACPI name space. */
+ status = AcpiLoadTables();
+ if (ACPI_FAILURE(status)) {
+ device_printf(dev, "Could not load Namespace: %s\n",
+ AcpiFormatException(status));
+ goto out;
+ }
+
/* Install the default address space handlers. */
- error = ENXIO;
status = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE(status)) {
@@ -541,7 +566,14 @@ acpi_attach(device_t dev)
}
/* Only enable S4BIOS by default if the FACS says it is available. */
- if (AcpiGbl_FACS->S4Bios_f != 0)
+ status = AcpiGetTable(ACPI_SIG_FACS, 0, (ACPI_TABLE_HEADER **)&facs);
+ if (ACPI_FAILURE(status)) {
+ device_printf(dev, "couldn't get FACS: %s\n",
+ AcpiFormatException(status));
+ error = ENXIO;
+ goto out;
+ }
+ if (facs->Flags & ACPI_FACS_S4_BIOS_PRESENT)
sc->acpi_s4bios = 1;
/*
@@ -1103,7 +1135,7 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
return (EINVAL);
/* We only support memory and IO spaces. */
- switch (gas->AddressSpaceId) {
+ switch (gas->SpaceId) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
res_type = SYS_RES_MEMORY;
break;
@@ -1118,15 +1150,15 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
* If the register width is less than 8, assume the BIOS author means
* it is a bit field and just allocate a byte.
*/
- if (gas->RegisterBitWidth && gas->RegisterBitWidth < 8)
- gas->RegisterBitWidth = 8;
+ if (gas->BitWidth && gas->BitWidth < 8)
+ gas->BitWidth = 8;
/* Validate the address after we're sure we support the space. */
- if (!ACPI_VALID_ADDRESS(gas->Address) || gas->RegisterBitWidth == 0)
+ if (gas->Address == 0 || gas->BitWidth == 0)
return (EINVAL);
bus_set_resource(dev, res_type, *rid, gas->Address,
- gas->RegisterBitWidth / 8);
+ gas->BitWidth / 8);
*res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE | flags);
if (*res != NULL) {
*type = res_type;
@@ -1645,12 +1677,13 @@ acpi_shutdown_final(void *arg, int howto)
DELAY(1000000);
printf("ACPI power-off failed - timeout\n");
}
- } else if ((howto & RB_HALT) == 0 && AcpiGbl_FADT->ResetRegSup &&
+ } else if ((howto & RB_HALT) == 0 &&
+ (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) &&
sc->acpi_handle_reboot) {
/* Reboot using the reset register. */
status = AcpiHwLowLevelWrite(
- AcpiGbl_FADT->ResetRegister.RegisterBitWidth,
- AcpiGbl_FADT->ResetValue, &AcpiGbl_FADT->ResetRegister);
+ AcpiGbl_FADT.ResetRegister.BitWidth,
+ AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister);
if (ACPI_FAILURE(status)) {
printf("ACPI reset failed - %s\n", AcpiFormatException(status));
} else {
@@ -1673,14 +1706,14 @@ acpi_enable_fixed_events(struct acpi_softc *sc)
static int first_time = 1;
/* Enable and clear fixed events and install handlers. */
- if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->PwrButton == 0) {
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_POWER_BUTTON) == 0) {
AcpiClearEvent(ACPI_EVENT_POWER_BUTTON);
AcpiInstallFixedEventHandler(ACPI_EVENT_POWER_BUTTON,
acpi_event_power_button_sleep, sc);
if (first_time)
device_printf(sc->acpi_dev, "Power Button (fixed)\n");
}
- if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->SleepButton == 0) {
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_SLEEP_BUTTON) == 0) {
AcpiClearEvent(ACPI_EVENT_SLEEP_BUTTON);
AcpiInstallFixedEventHandler(ACPI_EVENT_SLEEP_BUTTON,
acpi_event_sleep_button_sleep, sc);
@@ -1832,10 +1865,10 @@ acpi_TimerDelta(uint32_t end, uint32_t start)
if (end >= start)
delta = end - start;
- else if (AcpiGbl_FADT->TmrValExt == 0)
- delta = ((0x00FFFFFF - start) + end + 1) & 0x00FFFFFF;
- else
+ else if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER)
delta = ((0xFFFFFFFF - start) + end + 1);
+ else
+ delta = ((0x00FFFFFF - start) + end + 1) & 0x00FFFFFF;
return (delta);
}
@@ -2252,13 +2285,11 @@ int
acpi_wake_set_enable(device_t dev, int enable)
{
struct acpi_prw_data prw;
- ACPI_HANDLE handle;
ACPI_STATUS status;
int flags;
/* Make sure the device supports waking the system and get the GPE. */
- handle = acpi_get_handle(dev);
- if (acpi_parse_prw(handle, &prw) != 0)
+ if (acpi_parse_prw(acpi_get_handle(dev), &prw) != 0)
return (ENXIO);
flags = acpi_get_flags(dev);
diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c
index f257236..0ea69e8 100644
--- a/sys/dev/acpica/acpi_acad.c
+++ b/sys/dev/acpica/acpi_acad.c
@@ -128,7 +128,7 @@ acpi_acad_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
case ACPI_NOTIFY_DEVICE_CHECK:
case ACPI_POWERSOURCE_STAT_CHANGE:
/* Temporarily. It is better to notify policy manager */
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_acad_get_status, context);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_acad_get_status, context);
break;
default:
device_printf(dev, "unknown notify %#x\n", notify);
@@ -181,7 +181,7 @@ acpi_acad_attach(device_t dev)
*/
AcpiInstallNotifyHandler(handle, ACPI_ALL_NOTIFY,
acpi_acad_notify_handler, dev);
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_acad_init_acline, dev);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_acad_init_acline, dev);
return (0);
}
diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c
index aded9a2..197af4f 100644
--- a/sys/dev/acpica/acpi_button.c
+++ b/sys/dev/acpica/acpi_button.c
@@ -248,12 +248,10 @@ acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
sc = (struct acpi_button_softc *)context;
switch (notify) {
case ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP:
- AcpiOsQueueForExecution(OSD_PRIORITY_LO,
- acpi_button_notify_sleep, sc);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_button_notify_sleep, sc);
break;
case ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP:
- AcpiOsQueueForExecution(OSD_PRIORITY_LO,
- acpi_button_notify_wakeup, sc);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_button_notify_wakeup, sc);
break;
default:
device_printf(sc->button_dev, "unknown notify %#x\n", notify);
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index 062926a..24ab5f8 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -149,7 +149,7 @@ acpi_cmbat_attach(device_t dev)
AcpiInstallNotifyHandler(handle, ACPI_ALL_NOTIFY,
acpi_cmbat_notify_handler, dev);
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cmbat_init_battery, dev);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cmbat_init_battery, dev);
return (0);
}
@@ -169,7 +169,7 @@ static int
acpi_cmbat_resume(device_t dev)
{
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cmbat_init_battery, dev);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cmbat_init_battery, dev);
return (0);
}
@@ -197,7 +197,7 @@ acpi_cmbat_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
* Queue a callback to get the current battery info from thread
* context. It's not safe to block in a notify handler.
*/
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cmbat_get_bif_task, dev);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cmbat_get_bif_task, dev);
break;
}
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 57c6cd9..95f71df 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -275,8 +275,8 @@ acpi_cpu_attach(device_t dev)
pcpu_data = pcpu_find(cpu_id);
pcpu_data->pc_device = dev;
sc->cpu_pcpu = pcpu_data;
- cpu_smi_cmd = AcpiGbl_FADT->SmiCmd;
- cpu_cst_cnt = AcpiGbl_FADT->CstCnt;
+ cpu_smi_cmd = AcpiGbl_FADT.SmiCommand;
+ cpu_cst_cnt = AcpiGbl_FADT.CstControl;
buf.Pointer = NULL;
buf.Length = ACPI_ALLOCATE_BUFFER;
@@ -310,7 +310,7 @@ acpi_cpu_attach(device_t dev)
CTLFLAG_RD, 0, "node for CPU children");
/* Queue post cpu-probing task handler */
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cpu_startup, NULL);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cpu_startup, NULL);
}
/*
@@ -518,16 +518,16 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
return;
/* Validate and allocate resources for C2 (P_LVL2). */
- gas.AddressSpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
- gas.RegisterBitWidth = 8;
- if (AcpiGbl_FADT->Plvl2Lat <= 100) {
+ gas.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
+ gas.BitWidth = 8;
+ if (AcpiGbl_FADT.C2Latency <= 100) {
gas.Address = sc->cpu_p_blk + 4;
acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid,
&gas, &cx_ptr->p_lvlx, RF_SHAREABLE);
if (cx_ptr->p_lvlx != NULL) {
sc->cpu_rid++;
cx_ptr->type = ACPI_STATE_C2;
- cx_ptr->trans_lat = AcpiGbl_FADT->Plvl2Lat;
+ cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency;
cx_ptr++;
sc->cpu_cx_count++;
}
@@ -536,14 +536,14 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
return;
/* Validate and allocate resources for C3 (P_LVL3). */
- if (AcpiGbl_FADT->Plvl3Lat <= 1000) {
+ if (AcpiGbl_FADT.C3Latency <= 1000) {
gas.Address = sc->cpu_p_blk + 5;
acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, &gas,
&cx_ptr->p_lvlx, RF_SHAREABLE);
if (cx_ptr->p_lvlx != NULL) {
sc->cpu_rid++;
cx_ptr->type = ACPI_STATE_C3;
- cx_ptr->trans_lat = AcpiGbl_FADT->Plvl3Lat;
+ cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
cx_ptr++;
sc->cpu_cx_count++;
}
@@ -863,11 +863,9 @@ acpi_cpu_idle()
* time if USB is loaded.
*/
if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) {
- AcpiGetRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active,
- ACPI_MTX_DO_NOT_LOCK);
+ AcpiGetRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active);
if (bm_active != 0) {
- AcpiSetRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1,
- ACPI_MTX_DO_NOT_LOCK);
+ AcpiSetRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1);
cx_next_idx = min(cx_next_idx, sc->cpu_non_c3);
}
}
@@ -894,9 +892,8 @@ acpi_cpu_idle()
*/
if (cx_next->type == ACPI_STATE_C3) {
if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) {
- AcpiSetRegister(ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK);
- AcpiSetRegister(ACPI_BITREG_BUS_MASTER_RLD, 1,
- ACPI_MTX_DO_NOT_LOCK);
+ AcpiSetRegister(ACPI_BITREG_ARB_DISABLE, 1);
+ AcpiSetRegister(ACPI_BITREG_BUS_MASTER_RLD, 1);
} else
ACPI_FLUSH_CPU_CACHE();
}
@@ -907,7 +904,7 @@ acpi_cpu_idle()
* get the time very close to the CPU start/stop clock logic, this
* is the only reliable time source.
*/
- AcpiHwLowLevelRead(32, &start_time, &AcpiGbl_FADT->XPmTmrBlk);
+ AcpiHwLowLevelRead(32, &start_time, &AcpiGbl_FADT.XPmTimerBlock);
CPU_GET_REG(cx_next->p_lvlx, 1);
/*
@@ -916,14 +913,14 @@ acpi_cpu_idle()
* the processor has stopped. Doing it again provides enough
* margin that we are certain to have a correct value.
*/
- AcpiHwLowLevelRead(32, &end_time, &AcpiGbl_FADT->XPmTmrBlk);
- AcpiHwLowLevelRead(32, &end_time, &AcpiGbl_FADT->XPmTmrBlk);
+ AcpiHwLowLevelRead(32, &end_time, &AcpiGbl_FADT.XPmTimerBlock);
+ AcpiHwLowLevelRead(32, &end_time, &AcpiGbl_FADT.XPmTimerBlock);
/* Enable bus master arbitration and disable bus master wakeup. */
if (cx_next->type == ACPI_STATE_C3 &&
(cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) {
- AcpiSetRegister(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK);
- AcpiSetRegister(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK);
+ AcpiSetRegister(ACPI_BITREG_ARB_DISABLE, 0);
+ AcpiSetRegister(ACPI_BITREG_BUS_MASTER_RLD, 0);
}
ACPI_ENABLE_IRQS();
@@ -962,8 +959,10 @@ acpi_cpu_quirks(void)
* instruction is present, flush the caches before entering C3 instead.
* Otherwise, just disable C3 completely.
*/
- if (AcpiGbl_FADT->V1_Pm2CntBlk == 0 || AcpiGbl_FADT->Pm2CntLen == 0) {
- if (AcpiGbl_FADT->WbInvd && AcpiGbl_FADT->WbInvdFlush == 0) {
+ if (AcpiGbl_FADT.Pm2ControlBlock == 0 ||
+ AcpiGbl_FADT.Pm2ControlLength == 0) {
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_WBINVD) &&
+ (AcpiGbl_FADT.Flags & ACPI_FADT_WBINVD_FLUSH) == 0) {
cpu_quirks |= CPU_QUIRK_NO_BM_CTRL;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"acpi_cpu: no BM control, using flush cache method\n"));
diff --git a/sys/dev/acpica/acpi_dock.c b/sys/dev/acpica/acpi_dock.c
index 277c1f4..0ddec2f 100644
--- a/sys/dev/acpica/acpi_dock.c
+++ b/sys/dev/acpica/acpi_dock.c
@@ -238,7 +238,7 @@ acpi_dock_insert_child(ACPI_HANDLE handle, UINT32 level, void *context,
goto out;
}
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_dock_attach_later, dev);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_dock_attach_later, dev);
out:
return (AE_OK);
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c
index 8c7b2b9..97d95c9 100644
--- a/sys/dev/acpica/acpi_ec.c
+++ b/sys/dev/acpica/acpi_ec.c
@@ -227,16 +227,6 @@ typedef UINT8 EC_EVENT;
#define EC_SET_CSR(sc, v) \
bus_space_write_1((sc)->ec_csr_tag, (sc)->ec_csr_handle, 0, (v))
-/* Embedded Controller Boot Resources Table (ECDT) */
-typedef struct {
- ACPI_TABLE_HEADER header;
- ACPI_GENERIC_ADDRESS control;
- ACPI_GENERIC_ADDRESS data;
- UINT32 uid;
- UINT8 gpe_bit;
- char ec_id[0];
-} ACPI_TABLE_ECDT;
-
/* Additional params to pass from the probe routine */
struct acpi_ec_params {
int glk;
@@ -408,7 +398,6 @@ void
acpi_ec_ecdt_probe(device_t parent)
{
ACPI_TABLE_ECDT *ecdt;
- ACPI_TABLE_HEADER *hdr;
ACPI_STATUS status;
device_t child;
ACPI_HANDLE h;
@@ -417,23 +406,22 @@ acpi_ec_ecdt_probe(device_t parent)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
/* Find and validate the ECDT. */
- status = AcpiGetFirmwareTable("ECDT", 1, ACPI_LOGICAL_ADDRESSING, &hdr);
- ecdt = (ACPI_TABLE_ECDT *)hdr;
+ status = AcpiGetTable(ACPI_SIG_ECDT, 1, (ACPI_TABLE_HEADER **)&ecdt);
if (ACPI_FAILURE(status) ||
- ecdt->control.RegisterBitWidth != 8 ||
- ecdt->data.RegisterBitWidth != 8) {
+ ecdt->Control.BitWidth != 8 ||
+ ecdt->Data.BitWidth != 8) {
return;
}
/* Create the child device with the given unit number. */
- child = BUS_ADD_CHILD(parent, 0, "acpi_ec", ecdt->uid);
+ child = BUS_ADD_CHILD(parent, 0, "acpi_ec", ecdt->Uid);
if (child == NULL) {
printf("%s: can't add child\n", __func__);
return;
}
/* Find and save the ACPI handle for this device. */
- status = AcpiGetHandle(NULL, ecdt->ec_id, &h);
+ status = AcpiGetHandle(NULL, ecdt->Id, &h);
if (ACPI_FAILURE(status)) {
device_delete_child(parent, child);
printf("%s: can't get handle\n", __func__);
@@ -442,9 +430,9 @@ acpi_ec_ecdt_probe(device_t parent)
acpi_set_handle(child, h);
/* Set the data and CSR register addresses. */
- bus_set_resource(child, SYS_RES_IOPORT, 0, ecdt->data.Address,
+ bus_set_resource(child, SYS_RES_IOPORT, 0, ecdt->Data.Address,
/*count*/1);
- bus_set_resource(child, SYS_RES_IOPORT, 1, ecdt->control.Address,
+ bus_set_resource(child, SYS_RES_IOPORT, 1, ecdt->Control.Address,
/*count*/1);
/*
@@ -456,8 +444,8 @@ acpi_ec_ecdt_probe(device_t parent)
*/
params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO);
params->gpe_handle = NULL;
- params->gpe_bit = ecdt->gpe_bit;
- params->uid = ecdt->uid;
+ params->gpe_bit = ecdt->Gpe;
+ params->uid = ecdt->Uid;
acpi_GetInteger(h, "_GLK", &params->glk);
acpi_set_private(child, params);
acpi_set_magic(child, (int)&acpi_ec_devclass);
@@ -830,8 +818,7 @@ EcGpeHandler(void *Context)
} else if (!sc->ec_sci_pend) {
/* SCI bit set and no pending query handler, so schedule one. */
CTR0(KTR_ACPI, "ec queueing gpe handler");
- Status = AcpiOsQueueForExecution(OSD_PRIORITY_GPE, EcGpeQueryHandler,
- Context);
+ Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
if (ACPI_SUCCESS(Status)) {
sc->ec_sci_pend = TRUE;
query_pend = TRUE;
diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c
index 4a6f63c..0bb4a9f 100644
--- a/sys/dev/acpica/acpi_lid.c
+++ b/sys/dev/acpica/acpi_lid.c
@@ -184,8 +184,8 @@ acpi_lid_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
sc = (struct acpi_lid_softc *)context;
switch (notify) {
case ACPI_NOTIFY_STATUS_CHANGED:
- AcpiOsQueueForExecution(OSD_PRIORITY_LO,
- acpi_lid_notify_status_changed, sc);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER,
+ acpi_lid_notify_status_changed, sc);
break;
default:
device_printf(sc->lid_dev, "unknown notify %#x\n", notify);
diff --git a/sys/dev/acpica/acpi_pci_link.c b/sys/dev/acpica/acpi_pci_link.c
index 1ea9df1..4c3c306 100644
--- a/sys/dev/acpica/acpi_pci_link.c
+++ b/sys/dev/acpica/acpi_pci_link.c
@@ -384,7 +384,7 @@ link_valid_irq(struct link *link, int irq)
* For links routed via an ISA interrupt, if the SCI is routed via
* an ISA interrupt, the SCI is always treated as a valid IRQ.
*/
- if (link->l_isa_irq && AcpiGbl_FADT->SciInt == irq &&
+ if (link->l_isa_irq && AcpiGbl_FADT.SciInterrupt == irq &&
irq < NUM_ISA_INTERRUPTS)
return (TRUE);
@@ -1002,7 +1002,7 @@ acpi_pci_link_choose_irq(device_t dev, struct link *link)
* interrupt as a fallback.
*/
if (link->l_isa_irq) {
- pos_irq = AcpiGbl_FADT->SciInt;
+ pos_irq = AcpiGbl_FADT.SciInterrupt;
pos_weight = pci_link_interrupt_weights[pos_irq];
if (pos_weight < best_weight) {
best_weight = pos_weight;
@@ -1079,8 +1079,8 @@ acpi_pci_link_identify(driver_t *driver, device_t parent)
* if we are using the APIC, we also shouldn't be having any PCI
* interrupts routed via ISA IRQs, so this is probably ok.
*/
- if (AcpiGbl_FADT->SciInt < NUM_ISA_INTERRUPTS)
- pci_link_bios_isa_irqs |= (1 << AcpiGbl_FADT->SciInt);
+ if (AcpiGbl_FADT.SciInterrupt < NUM_ISA_INTERRUPTS)
+ pci_link_bios_isa_irqs |= (1 << AcpiGbl_FADT.SciInterrupt);
}
static device_method_t acpi_pci_link_methods[] = {
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index 7b39fb9..e517ad3 100644
--- a/sys/dev/acpica/acpi_perf.c
+++ b/sys/dev/acpica/acpi_perf.c
@@ -221,7 +221,7 @@ acpi_perf_attach(device_t dev)
sc->px_curr_state = CPUFREQ_VAL_UNKNOWN;
if (acpi_perf_evaluate(dev) != 0)
return (ENXIO);
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_px_startup, NULL);
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_px_startup, NULL);
if (!sc->info_only)
cpufreq_register(dev);
@@ -393,10 +393,10 @@ acpi_px_startup(void *arg)
{
/* Signal to the platform that we are taking over CPU control. */
- if (AcpiGbl_FADT->PstateCnt == 0)
+ if (AcpiGbl_FADT.PstateControl == 0)
return;
ACPI_LOCK(acpi);
- AcpiOsWritePort(AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->PstateCnt, 8);
+ AcpiOsWritePort(AcpiGbl_FADT.SmiCommand, AcpiGbl_FADT.PstateControl, 8);
ACPI_UNLOCK(acpi);
}
diff --git a/sys/dev/acpica/acpi_quirk.c b/sys/dev/acpica/acpi_quirk.c
index ac284e0..f68eb63 100644
--- a/sys/dev/acpica/acpi_quirk.c
+++ b/sys/dev/acpica/acpi_quirk.c
@@ -47,10 +47,8 @@ enum val_t {
CREATOR_REV,
};
-#define ACPI_TABLE_END (ACPI_TABLE_MAX + 1)
-
struct acpi_q_rule {
- int sig; /* Table signature to match */
+ char sig[ACPI_NAME_SIZE]; /* Table signature to match */
enum val_t val;
union {
char *id;
@@ -141,33 +139,35 @@ acpi_table_quirks(int *quirks)
{
const struct acpi_q_entry *entry;
const struct acpi_q_rule *match;
- ACPI_TABLE_HEADER *hdr;
+ ACPI_TABLE_HEADER fadt, dsdt, xsdt, *hdr;
int done;
/* First, allow the machdep system to set its idea of quirks. */
KASSERT(quirks != NULL, ("acpi quirks ptr is NULL"));
acpi_machdep_quirks(quirks);
+ if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_FADT, 0, &fadt)))
+ bzero(&fadt, sizeof(fadt));
+ if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_DSDT, 0, &dsdt)))
+ bzero(&fadt, sizeof(dsdt));
+ if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_XSDT, 0, &xsdt)))
+ bzero(&fadt, sizeof(xsdt));
+
/* Then, override the quirks with any matched from table signatures. */
for (entry = acpi_quirks_table; entry->match; entry++) {
done = TRUE;
- for (match = entry->match; match->sig != ACPI_TABLE_END; match++) {
- switch (match->sig) {
- case ACPI_TABLE_FADT:
- hdr = (ACPI_TABLE_HEADER *)AcpiGbl_FADT;
- break;
- case ACPI_TABLE_DSDT:
- hdr = (ACPI_TABLE_HEADER *)AcpiGbl_DSDT;
- break;
- case ACPI_TABLE_XSDT:
- hdr = (ACPI_TABLE_HEADER *)AcpiGbl_XSDT;
- break;
- default:
+ for (match = entry->match; match->sig[0] != '\0'; match++) {
+ if (!strncmp(match->sig, "FADT", ACPI_NAME_SIZE))
+ hdr = &fadt;
+ else if (!strncmp(match->sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE))
+ hdr = &dsdt;
+ else if (!strncmp(match->sig, ACPI_SIG_XSDT, ACPI_NAME_SIZE))
+ hdr = &xsdt;
+ else
panic("invalid quirk header\n");
- }
/* If we don't match any, skip to the next entry. */
- if (!aq_match_header(hdr, match)) {
+ if (aq_match_header(hdr, match) == FALSE) {
done = FALSE;
break;
}
diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c
index 5785db6..2a81e54 100644
--- a/sys/dev/acpica/acpi_resource.c
+++ b/sys/dev/acpica/acpi_resource.c
@@ -169,7 +169,7 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
/* Fetch the device's current resources. */
buf.Length = ACPI_ALLOCATE_BUFFER;
if (ACPI_FAILURE((status = AcpiGetCurrentResources(handle, &buf)))) {
- if (status != AE_NOT_FOUND)
+ if (status != AE_NOT_FOUND && status != AE_TYPE)
printf("can't fetch resources for %s - %s\n",
acpi_name(handle), AcpiFormatException(status));
return_ACPI_STATUS (status);
diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c
index 9710abb..d79d7ae 100644
--- a/sys/dev/acpica/acpi_throttle.c
+++ b/sys/dev/acpica/acpi_throttle.c
@@ -141,7 +141,7 @@ acpi_throttle_identify(driver_t *driver, device_t parent)
handle = acpi_get_handle(parent);
if (handle == NULL)
return;
- if (AcpiGbl_FADT->DutyWidth == 0 ||
+ if (AcpiGbl_FADT.DutyWidth == 0 ||
acpi_get_type(parent) != ACPI_TYPE_PROCESSOR)
return;
@@ -242,8 +242,8 @@ acpi_throttle_evaluate(struct acpi_throttle_softc *sc)
/* Get throttling parameters from the FADT. 0 means not supported. */
if (device_get_unit(sc->cpu_dev) == 0) {
- cpu_duty_offset = AcpiGbl_FADT->DutyOffset;
- cpu_duty_width = AcpiGbl_FADT->DutyWidth;
+ cpu_duty_offset = AcpiGbl_FADT.DutyOffset;
+ cpu_duty_width = AcpiGbl_FADT.DutyWidth;
}
if (cpu_duty_width == 0 || (thr_quirks & CPU_QUIRK_NO_THROTTLE) != 0)
return (ENXIO);
@@ -295,8 +295,8 @@ acpi_throttle_evaluate(struct acpi_throttle_softc *sc)
if (sc->cpu_p_blk_len < 4)
return (ENXIO);
gas.Address = sc->cpu_p_blk;
- gas.AddressSpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
- gas.RegisterBitWidth = 32;
+ gas.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
+ gas.BitWidth = 32;
acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, &thr_rid,
&gas, &sc->cpu_p_cnt, 0);
if (sc->cpu_p_cnt != NULL) {
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c
index b511a6f..2cc966c 100644
--- a/sys/dev/acpica/acpi_timer.c
+++ b/sys/dev/acpica/acpi_timer.c
@@ -119,7 +119,7 @@ acpi_timer_identify(driver_t *driver, device_t parent)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
if (acpi_disabled("timer") || (acpi_quirks & ACPI_Q_TIMER) ||
- AcpiGbl_FADT == NULL || acpi_timer_dev)
+ acpi_timer_dev)
return_VOID;
if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_timer", 0)) == NULL) {
@@ -129,10 +129,10 @@ acpi_timer_identify(driver_t *driver, device_t parent)
acpi_timer_dev = dev;
rid = 0;
- rtype = AcpiGbl_FADT->XPmTmrBlk.AddressSpaceId ?
+ rtype = AcpiGbl_FADT.XPmTimerBlock.SpaceId ?
SYS_RES_IOPORT : SYS_RES_MEMORY;
- rlen = AcpiGbl_FADT->PmTmLen;
- rstart = AcpiGbl_FADT->XPmTmrBlk.Address;
+ rlen = AcpiGbl_FADT.PmTimerLength;
+ rstart = AcpiGbl_FADT.XPmTimerBlock.Address;
if (bus_set_resource(dev, rtype, rid, rstart, rlen))
device_printf(dev, "couldn't set resource (%s 0x%lx+0x%lx)\n",
(rtype == SYS_RES_IOPORT) ? "port" : "mem", rstart, rlen);
@@ -151,18 +151,18 @@ acpi_timer_probe(device_t dev)
return (ENXIO);
rid = 0;
- rtype = AcpiGbl_FADT->XPmTmrBlk.AddressSpaceId ?
+ rtype = AcpiGbl_FADT.XPmTimerBlock.SpaceId ?
SYS_RES_IOPORT : SYS_RES_MEMORY;
acpi_timer_reg = bus_alloc_resource_any(dev, rtype, &rid, RF_ACTIVE);
if (acpi_timer_reg == NULL) {
device_printf(dev, "couldn't allocate resource (%s 0x%lx)\n",
(rtype == SYS_RES_IOPORT) ? "port" : "mem",
- (u_long)AcpiGbl_FADT->XPmTmrBlk.Address);
+ (u_long)AcpiGbl_FADT.XPmTimerBlock.Address);
return (ENXIO);
}
acpi_timer_bsh = rman_get_bushandle(acpi_timer_reg);
acpi_timer_bst = rman_get_bustag(acpi_timer_reg);
- if (AcpiGbl_FADT->TmrValExt != 0)
+ if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER)
acpi_timer_timecounter.tc_counter_mask = 0xffffffff;
else
acpi_timer_timecounter.tc_counter_mask = 0x00ffffff;
@@ -192,7 +192,7 @@ acpi_timer_probe(device_t dev)
tc_init(&acpi_timer_timecounter);
sprintf(desc, "%d-bit timer at 3.579545MHz",
- AcpiGbl_FADT->TmrValExt ? 32 : 24);
+ (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) ? 32 : 24);
device_set_desc_copy(dev, desc);
/* Release the resource, we'll allocate it again during attach. */
@@ -208,7 +208,7 @@ acpi_timer_attach(device_t dev)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
rid = 0;
- rtype = AcpiGbl_FADT->XPmTmrBlk.AddressSpaceId ?
+ rtype = AcpiGbl_FADT.XPmTimerBlock.SpaceId ?
SYS_RES_IOPORT : SYS_RES_MEMORY;
acpi_timer_reg = bus_alloc_resource_any(dev, rtype, &rid, RF_ACTIVE);
if (acpi_timer_reg == NULL)
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index c1e9812..3867d13 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -423,7 +423,9 @@ int acpi_PkgGas(device_t dev, ACPI_OBJECT *res, int idx, int *type,
ACPI_HANDLE acpi_GetReference(ACPI_HANDLE scope, ACPI_OBJECT *obj);
/* Default number of task queue threads to start. */
+#ifndef ACPI_MAX_THREADS
#define ACPI_MAX_THREADS 3
+#endif
/* Use the device logging level for ktr(4). */
#define KTR_ACPI KTR_DEV
OpenPOWER on IntegriCloud