summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-01-26 19:29:04 +0000
committerjhb <jhb@FreeBSD.org>2004-01-26 19:29:04 +0000
commit217fb330c26cc6bc733ebc468bcfee39aa6860ea (patch)
tree4ed8b04cfefba8ee10a369d6bef9051c5e623bb5 /sys/dev
parent2549da444c26a02cfd246f858cad2bc971e94c21 (diff)
downloadFreeBSD-src-217fb330c26cc6bc733ebc468bcfee39aa6860ea.zip
FreeBSD-src-217fb330c26cc6bc733ebc468bcfee39aa6860ea.tar.gz
Move the code to initialize ACPI-CA into a separate acpi_Startup() function
that other modules can call to initialize ACPI-CA before the new-bus probe and change acpi_identify() to call it. Reviewed by: njl
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c65
-rw-r--r--sys/dev/acpica/acpivar.h1
2 files changed, 42 insertions, 24 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index b42c186..d045ed9 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -194,32 +194,19 @@ acpi_modevent(struct module *mod, int event, void *junk)
}
/*
- * Detect ACPI, perform early initialisation
+ * Perform early initialization.
*/
-static void
-acpi_identify(driver_t *driver, device_t parent)
+ACPI_STATUS
+acpi_Startup(void)
{
- device_t child;
- int error;
#ifdef ACPI_DEBUGGER
- char *debugpoint;
+ char *debugpoint;
#endif
+ static int error, started = 0;
- ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
-
- if (!cold)
- return_VOID;
-
- /* Check that we haven't been disabled with a hint. */
- if (resource_disabled("acpi", 0))
- return_VOID;
-
- snprintf(acpi_ca_version, sizeof(acpi_ca_version), "0x%x",
- ACPI_CA_VERSION);
-
- /* Make sure we're not being doubly invoked. */
- if (device_find_child(parent, "acpi", 0) != NULL)
- return_VOID;
+ if (started)
+ return_VALUE(error);
+ started = 1;
#if __FreeBSD_version >= 500000
/* Initialise the ACPI mutex */
@@ -237,7 +224,7 @@ acpi_identify(driver_t *driver, device_t parent)
#endif
if (ACPI_FAILURE(error = AcpiInitializeSubsystem())) {
printf("ACPI: initialisation failed: %s\n", AcpiFormatException(error));
- return_VOID;
+ return_VALUE(error);
}
#ifdef ACPI_DEBUGGER
debugpoint = getenv("debug.acpi.debugger");
@@ -250,9 +237,39 @@ acpi_identify(driver_t *driver, device_t parent)
if (ACPI_FAILURE(error = AcpiLoadTables())) {
printf("ACPI: table load failed: %s\n", AcpiFormatException(error));
- return_VOID;
+ return_VALUE(error);
}
-
+ return_VALUE(AE_OK);
+}
+
+/*
+ * Detect ACPI, perform early initialisation
+ */
+static void
+acpi_identify(driver_t *driver, device_t parent)
+{
+ device_t child;
+
+ ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
+
+ if (!cold)
+ return_VOID;
+
+ /* Check that we haven't been disabled with a hint. */
+ if (resource_disabled("acpi", 0))
+ return_VOID;
+
+ snprintf(acpi_ca_version, sizeof(acpi_ca_version), "0x%x",
+ ACPI_CA_VERSION);
+
+ /* Make sure we're not being doubly invoked. */
+ if (device_find_child(parent, "acpi", 0) != NULL)
+ return_VOID;
+
+ /* Initialize ACPI-CA. */
+ if (ACPI_FAILURE(acpi_Startup()))
+ return_VOID;
+
/* Attach the actual ACPI device. */
if ((child = BUS_ADD_CHILD(parent, 0, "acpi", 0)) == NULL) {
device_printf(parent, "ACPI: could not attach\n");
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 99c2f9d..ac6dd72 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -190,6 +190,7 @@ extern ACPI_STATUS acpi_AppendBufferResource(ACPI_BUFFER *buf,
extern ACPI_STATUS acpi_OverrideInterruptLevel(UINT32 InterruptNumber);
extern ACPI_STATUS acpi_SetIntrModel(int model);
extern ACPI_STATUS acpi_SetSleepState(struct acpi_softc *sc, int state);
+extern ACPI_STATUS acpi_Startup(void);
extern ACPI_STATUS acpi_Enable(struct acpi_softc *sc);
extern ACPI_STATUS acpi_Disable(struct acpi_softc *sc);
extern void acpi_UserNotify(const char *subsystem, ACPI_HANDLE h,
OpenPOWER on IntegriCloud