summaryrefslogtreecommitdiff
path: root/source/os_specific/service_layers/oswinxf.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2010-09-24 14:32:44 -0700
committerRobert Moore <Robert.Moore@intel.com>2010-09-24 14:32:44 -0700
commitecc57b86d9f2cb90dffad6b471aaa52dd9d6437a (patch)
tree04190ed5acf48877e2e63ac1b812830c9353560a /source/os_specific/service_layers/oswinxf.c
parent32f46843f9211195fd0ba5fdfdf477e0a23abf6f (diff)
Replace _MULTI_THREADED with ACPI_SINGLE_THREADED and cleanup.
Cleanup the optional multi/single threaded code for semaphores.
Diffstat (limited to 'source/os_specific/service_layers/oswinxf.c')
-rw-r--r--source/os_specific/service_layers/oswinxf.c121
1 files changed, 80 insertions, 41 deletions
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index cf19603ec..45e6738c0 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -137,24 +137,17 @@
ACPI_MODULE_NAME ("oswinxf")
-/* Semaphore information structure */
-
-typedef struct acpi_os_semaphore_info
-{
- UINT16 MaxUnits;
- UINT16 CurrentUnits;
- void *OsHandle;
-
-} ACPI_OS_SEMAPHORE_INFO;
-
-/* Need enough semaphores to run the large aslts suite */
+extern FILE *AcpiGbl_DebugFile;
+extern BOOLEAN AcpiGbl_DebugTimeout;
-#define ACPI_OS_MAX_SEMAPHORES 256
+FILE *AcpiGbl_OutputFile;
+UINT64 TimerFrequency;
+char TableName[ACPI_NAME_SIZE + 1];
-ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES];
+#define ACPI_OS_DEBUG_TIMEOUT 30000 /* 30 seconds */
-/* Upcalls to AcpiExec */
+/* Upcalls to application */
ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
@@ -170,14 +163,28 @@ OsGetTable (
char *Signature);
-extern FILE *AcpiGbl_DebugFile;
-extern BOOLEAN AcpiGbl_DebugTimeout;
+/*
+ * Real semaphores are only used for a multi-threaded application
+ */
+#ifndef ACPI_SINGLE_THREADED
-FILE *AcpiGbl_OutputFile;
-UINT64 TimerFrequency;
-char TableName[ACPI_NAME_SIZE + 1];
+/* Semaphore information structure */
-#define ACPI_OS_DEBUG_TIMEOUT 30000 /* 30 seconds */
+typedef struct acpi_os_semaphore_info
+{
+ UINT16 MaxUnits;
+ UINT16 CurrentUnits;
+ void *OsHandle;
+
+} ACPI_OS_SEMAPHORE_INFO;
+
+/* Need enough semaphores to run the large aslts suite */
+
+#define ACPI_OS_MAX_SEMAPHORES 256
+
+ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES];
+
+#endif /* ACPI_SINGLE_THREADED */
/******************************************************************************
@@ -217,11 +224,13 @@ AcpiOsInitialize (void)
LARGE_INTEGER LocalTimerFrequency;
- AcpiGbl_OutputFile = stdout;
-
+#ifndef ACPI_SINGLE_THREADED
/* Clear the semaphore info array */
memset (AcpiGbl_Semaphores, 0x00, sizeof (AcpiGbl_Semaphores));
+#endif
+
+ AcpiGbl_OutputFile = stdout;
/* Get the timer frequency for use in AcpiOsGetTimer */
@@ -670,6 +679,52 @@ AcpiOsFree (
}
+#ifdef ACPI_SINGLE_THREADED
+/******************************************************************************
+ *
+ * FUNCTION: Semaphore stub functions
+ *
+ * DESCRIPTION: Stub functions used for single-thread applications that do
+ * not require semaphore synchronization. Full implementations
+ * of these functions appear after the stubs.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsCreateSemaphore (
+ UINT32 MaxUnits,
+ UINT32 InitialUnits,
+ ACPI_HANDLE *OutHandle)
+{
+ *OutHandle = (ACPI_HANDLE) 1;
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiOsDeleteSemaphore (
+ ACPI_HANDLE Handle)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiOsWaitSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units,
+ UINT16 Timeout)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
+AcpiOsSignalSemaphore (
+ ACPI_HANDLE Handle,
+ UINT32 Units)
+{
+ return (AE_OK);
+}
+
+#else
/******************************************************************************
*
* FUNCTION: AcpiOsCreateSemaphore
@@ -690,12 +745,10 @@ AcpiOsCreateSemaphore (
UINT32 InitialUnits,
ACPI_SEMAPHORE *OutHandle)
{
-#ifdef _MULTI_THREADED
void *Mutex;
UINT32 i;
ACPI_FUNCTION_NAME (OsCreateSemaphore);
-#endif
if (MaxUnits == ACPI_UINT32_MAX)
@@ -713,8 +766,6 @@ AcpiOsCreateSemaphore (
return AE_BAD_PARAMETER;
}
-#ifdef _MULTI_THREADED
-
/* Find an empty slot */
for (i = 0; i < ACPI_OS_MAX_SEMAPHORES; i++)
@@ -748,8 +799,6 @@ AcpiOsCreateSemaphore (
i, MaxUnits, InitialUnits, Mutex));
*OutHandle = (void *) i;
-#endif
-
return AE_OK;
}
@@ -779,13 +828,8 @@ AcpiOsDeleteSemaphore (
return AE_BAD_PARAMETER;
}
-
-#ifdef _MULTI_THREADED
-
CloseHandle (AcpiGbl_Semaphores[Index].OsHandle);
AcpiGbl_Semaphores[Index].OsHandle = NULL;
-#endif
-
return AE_OK;
}
@@ -810,7 +854,6 @@ AcpiOsWaitSemaphore (
UINT32 Units,
UINT16 Timeout)
{
-#ifdef _MULTI_THREADED
UINT32 Index = (UINT32) Handle;
UINT32 WaitStatus;
UINT32 OsTimeout = Timeout;
@@ -869,8 +912,6 @@ AcpiOsWaitSemaphore (
}
AcpiGbl_Semaphores[Index].CurrentUnits--;
-#endif
-
return AE_OK;
}
@@ -893,8 +934,6 @@ AcpiOsSignalSemaphore (
ACPI_SEMAPHORE Handle,
UINT32 Units)
{
-#ifdef _MULTI_THREADED
-
UINT32 Index = (UINT32) Handle;
@@ -933,11 +972,11 @@ AcpiOsSignalSemaphore (
AcpiGbl_Semaphores[Index].CurrentUnits++;
ReleaseSemaphore (AcpiGbl_Semaphores[Index].OsHandle, Units, NULL);
-#endif
-
return (AE_OK);
}
+#endif /* ACPI_SINGLE_THREADED */
+
/* Spinlock interfaces, just implement with a semaphore */
@@ -1102,7 +1141,7 @@ AcpiOsExecute (
void *Context)
{
-#ifdef _MULTI_THREADED
+#ifndef ACPI_SINGLE_THREADED
_beginthread (Function, (unsigned) 0, Context);
#endif