Author: hbelusca
Date: Thu Apr 3 23:44:20 2014
New Revision: 62608
URL:
http://svn.reactos.org/svn/reactos?rev=62608&view=rev
Log:
[ACPICA][ACPI]
Finally...
- Specify that we use MUTEXes instead of binary semaphores,
- Change two interface names in our code: ACPI_DEVICE_ID_LIST -->
ACPI_PNP_DEVICE_ID_LIST and acpi_device_id --> acpi_pnp_device_id (only those names
were changed in ACPICA).
- Implement AcpiOsPhysicalTableOverride which doesn't any table override (same
behaviour as AcpiOsTableOverride).
- Latest ACPICA versions introduce the AcpiOsWaitEventsComplete API, which is used to wait
for all asynchronous events to complete. But we do nothing at the moment
("inspired" from the behaviour from
http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/dev/acpi/acpica/Osd… ,
but I'm sure ReactOS ACPI specialists know better than me whether or not it is
judicious to do so !!!)
- Extend AcpiOsRead/WriteMemory to be able to read/write 64-bit values, as required by the
ACPICA implementation.
Fix the build. Now, only warnings from our code (not ACPICA) need to be fixed.
Real HW testers, please retest your real HW with this revision (or above) !!
CORE-8044 #comment Everything updated in revisions 62604 to 62608.
Modified:
trunk/reactos/drivers/bus/acpi/acpica/include/platform/acenv.h
trunk/reactos/drivers/bus/acpi/busmgr/bus.c
trunk/reactos/drivers/bus/acpi/include/acpi_bus.h
trunk/reactos/drivers/bus/acpi/osl.c
Modified: trunk/reactos/drivers/bus/acpi/acpica/include/platform/acenv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/acpica/in…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/acpica/include/platform/acenv.h [iso-8859-1]
(original)
+++ trunk/reactos/drivers/bus/acpi/acpica/include/platform/acenv.h [iso-8859-1] Thu Apr 3
23:44:20 2014
@@ -290,7 +290,7 @@
/* Type of mutex supported by host. Default is binary semaphores. */
#ifndef ACPI_MUTEX_TYPE
-#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
+#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
#endif
/* Global Lock acquire/release */
Modified: trunk/reactos/drivers/bus/acpi/busmgr/bus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/busmgr/bu…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/busmgr/bus.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/busmgr/bus.c [iso-8859-1] Thu Apr 3 23:44:20 2014
@@ -827,7 +827,7 @@
goto Done;
if (device->flags.compatible_ids) {
- ACPI_DEVICE_ID_LIST *cid_list = device->pnp.cid_list;
+ ACPI_PNP_DEVICE_ID_LIST *cid_list = device->pnp.cid_list;
int i;
/* compare multiple _CID entries against driver ids */
@@ -1140,7 +1140,7 @@
ACPI_DEVICE_INFO *info;
char *hid = NULL;
char *uid = NULL;
- ACPI_DEVICE_ID_LIST *cid_list = NULL;
+ ACPI_PNP_DEVICE_ID_LIST *cid_list = NULL;
int i = 0;
char static_uid_buffer[5];
Modified: trunk/reactos/drivers/bus/acpi/include/acpi_bus.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/include/a…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/include/acpi_bus.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/include/acpi_bus.h [iso-8859-1] Thu Apr 3 23:44:20
2014
@@ -175,7 +175,7 @@
acpi_bus_id bus_id; /* Object name */
acpi_bus_address bus_address; /* _ADR */
acpi_hardware_id hardware_id; /* _HID */
- ACPI_DEVICE_ID_LIST *cid_list; /* _CIDs */
+ ACPI_PNP_DEVICE_ID_LIST *cid_list; /* _CIDs */
acpi_unique_id unique_id; /* _UID */
acpi_device_name device_name; /* Driver-determined */
acpi_device_class device_class; /* " */
@@ -330,7 +330,7 @@
int acpi_bus_start(struct acpi_device *device);
ACPI_STATUS acpi_bus_get_ejd(ACPI_HANDLE handle, ACPI_HANDLE * ejd);
int acpi_match_device_ids(struct acpi_device *device,
- const struct acpi_device_id *ids);
+ const struct acpi_pnp_device_id *ids);
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device);
int acpi_init(void);
ACPI_STATUS acpi_suspend (UINT32 state);
Modified: trunk/reactos/drivers/bus/acpi/osl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/osl.c?rev…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/osl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/osl.c [iso-8859-1] Thu Apr 3 23:44:20 2014
@@ -46,7 +46,7 @@
ACPI_PHYSICAL_ADDRESS pa = 0;
DPRINT("AcpiOsGetRootPointer\n");
-
+
AcpiFindRootPointer(&pa);
return pa;
}
@@ -64,7 +64,7 @@
/* No override */
*NewValue = NULL;
-
+
return AE_OK;
}
@@ -81,7 +81,26 @@
/* No override */
*NewTable = NULL;
-
+
+ return AE_OK;
+}
+
+ACPI_STATUS
+AcpiOsPhysicalTableOverride(
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_PHYSICAL_ADDRESS *NewAddress,
+ UINT32 *NewTableLength)
+{
+ if (!ExistingTable || !NewAddress || !NewTableLength)
+ {
+ DPRINT1("Invalid parameter\n");
+ return AE_BAD_PARAMETER;
+ }
+
+ /* No override */
+ *NewAddress = 0;
+ *NewTableLength = 0;
+
return AE_OK;
}
@@ -92,9 +111,9 @@
{
PHYSICAL_ADDRESS Address;
PVOID Ptr;
-
+
DPRINT("AcpiOsMapMemory(phys 0x%p size 0x%X)\n", phys, length);
-
+
ASSERT(phys);
Address.QuadPart = (ULONG)phys;
@@ -103,7 +122,7 @@
{
DPRINT1("Mapping failed\n");
}
-
+
return Ptr;
}
@@ -150,7 +169,7 @@
AcpiOsFree(void *ptr)
{
if (!ptr)
- DPRINT1("Attempt to free null pointer!!!\n");
+ DPRINT1("Attempt to free null pointer!!!\n");
ExFreePoolWithTag(ptr, 'IPCA');
}
@@ -164,7 +183,6 @@
_SEH2_TRY
{
ProbeForRead(Memory, Length, sizeof(UCHAR));
-
Ret = TRUE;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
@@ -172,7 +190,7 @@
Ret = FALSE;
}
_SEH2_END;
-
+
return Ret;
}
@@ -186,7 +204,6 @@
_SEH2_TRY
{
ProbeForWrite(Memory, Length, sizeof(UCHAR));
-
Ret = TRUE;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
@@ -194,7 +211,7 @@
Ret = FALSE;
}
_SEH2_END;
-
+
return Ret;
}
@@ -215,14 +232,14 @@
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
- DPRINT("AcpiOsExecute\n");
-
- InitializeObjectAttributes(&ObjectAttributes,
+ DPRINT("AcpiOsExecute\n");
+
+ InitializeObjectAttributes(&ObjectAttributes,
NULL,
OBJ_KERNEL_HANDLE,
NULL,
NULL);
-
+
Status = PsCreateSystemThread(&ThreadHandle,
THREAD_ALL_ACCESS,
&ObjectAttributes,
@@ -234,7 +251,7 @@
return AE_ERROR;
ZwClose(ThreadHandle);
-
+
return AE_OK;
}
@@ -242,7 +259,7 @@
AcpiOsSleep (UINT64 milliseconds)
{
DPRINT("AcpiOsSleep %d\n", milliseconds);
- KeStallExecutionProcessor(milliseconds*1000);
+ KeStallExecutionProcessor(milliseconds*1000);
}
void
@@ -263,14 +280,14 @@
DPRINT1("Bad parameter\n");
return AE_BAD_PARAMETER;
}
-
+
Mutex = ExAllocatePool(NonPagedPool, sizeof(FAST_MUTEX));
if (!Mutex) return AE_NO_MEMORY;
-
+
ExInitializeFastMutex(Mutex);
-
+
*OutHandle = (ACPI_MUTEX)Mutex;
-
+
return AE_OK;
}
@@ -283,7 +300,7 @@
DPRINT1("Bad parameter\n");
return;
}
-
+
ExFreePool(Handle);
}
@@ -323,7 +340,7 @@
DPRINT1("Bad parameter\n");
return;
}
-
+
ExReleaseFastMutex((PFAST_MUTEX)Handle);
}
@@ -346,16 +363,16 @@
DPRINT1("Bad parameter\n");
return AE_BAD_PARAMETER;
}
-
+
Sem = ExAllocatePool(NonPagedPool, sizeof(ACPI_SEM));
if (!Sem) return AE_NO_MEMORY;
Sem->CurrentUnits = InitialUnits;
KeInitializeEvent(&Sem->Event, SynchronizationEvent, Sem->CurrentUnits !=
0);
KeInitializeSpinLock(&Sem->Lock);
-
+
*OutHandle = (ACPI_SEMAPHORE)Sem;
-
+
return AE_OK;
}
@@ -368,9 +385,9 @@
DPRINT1("Bad parameter\n");
return AE_BAD_PARAMETER;
}
-
+
ExFreePool(Handle);
-
+
return AE_OK;
}
@@ -410,13 +427,13 @@
NULL);
KeAcquireSpinLock(&Sem->Lock, &OldIrql);
}
-
+
Sem->CurrentUnits -= Units;
-
+
if (Sem->CurrentUnits != 0) KeSetEvent(&Sem->Event, IO_NO_INCREMENT,
FALSE);
-
+
KeReleaseSpinLock(&Sem->Lock, OldIrql);
-
+
return AE_OK;
}
@@ -435,12 +452,12 @@
}
KeAcquireSpinLock(&Sem->Lock, &OldIrql);
-
+
Sem->CurrentUnits += Units;
KeSetEvent(&Sem->Event, IO_NO_INCREMENT, FALSE);
-
+
KeReleaseSpinLock(&Sem->Lock, OldIrql);
-
+
return AE_OK;
}
@@ -455,14 +472,14 @@
DPRINT1("Bad parameter\n");
return AE_BAD_PARAMETER;
}
-
+
SpinLock = ExAllocatePool(NonPagedPool, sizeof(KSPIN_LOCK));
if (!SpinLock) return AE_NO_MEMORY;
-
+
KeInitializeSpinLock(SpinLock);
-
+
*OutHandle = (ACPI_SPINLOCK)SpinLock;
-
+
return AE_OK;
}
@@ -475,7 +492,7 @@
DPRINT1("Bad parameter\n");
return;
}
-
+
ExFreePool(Handle);
}
@@ -484,7 +501,7 @@
ACPI_SPINLOCK Handle)
{
KIRQL OldIrql;
-
+
if ((OldIrql = KeGetCurrentIrql()) >= DISPATCH_LEVEL)
{
KeAcquireSpinLockAtDpcLevel((PKSPIN_LOCK)Handle);
@@ -493,7 +510,7 @@
{
KeAcquireSpinLock((PKSPIN_LOCK)Handle, &OldIrql);
}
-
+
return (ACPI_CPU_FLAGS)OldIrql;
}
@@ -503,7 +520,7 @@
ACPI_CPU_FLAGS Flags)
{
KIRQL OldIrql = (KIRQL)Flags;
-
+
if (OldIrql >= DISPATCH_LEVEL)
{
KeReleaseSpinLockFromDpcLevel((PKSPIN_LOCK)Handle);
@@ -539,13 +556,13 @@
KIRQL DIrql;
KAFFINITY Affinity;
NTSTATUS Status;
-
+
if (AcpiInterruptHandlerRegistered)
{
DPRINT1("Reregister interrupt attempt failed\n");
return AE_ALREADY_EXISTS;
}
-
+
if (!ServiceRoutine)
{
DPRINT1("Bad parameter\n");
@@ -593,13 +610,13 @@
ACPI_OSD_HANDLER ServiceRoutine)
{
DPRINT("AcpiOsRemoveInterruptHandler()\n");
-
+
if (!ServiceRoutine)
{
DPRINT1("Bad parameter\n");
return AE_BAD_PARAMETER;
}
-
+
if (AcpiInterruptHandlerRegistered)
{
IoDisconnectInterrupt(AcpiInterrupt);
@@ -618,7 +635,7 @@
ACPI_STATUS
AcpiOsReadMemory (
ACPI_PHYSICAL_ADDRESS Address,
- UINT32 *Value,
+ UINT64 *Value,
UINT32 Width)
{
DPRINT("AcpiOsReadMemory %p\n", Address);
@@ -627,11 +644,17 @@
case 8:
*Value = (*(PUCHAR)(ULONG_PTR)Address);
break;
+
case 16:
*Value = (*(PUSHORT)(ULONG_PTR)Address);
break;
+
case 32:
*Value = (*(PULONG)(ULONG_PTR)Address);
+ break;
+
+ case 64:
+ *Value = (*(PULONGLONG)(ULONG_PTR)Address);
break;
default:
@@ -645,7 +668,7 @@
ACPI_STATUS
AcpiOsWriteMemory (
ACPI_PHYSICAL_ADDRESS Address,
- UINT32 Value,
+ UINT64 Value,
UINT32 Width)
{
DPRINT("AcpiOsWriteMemory %p\n", Address);
@@ -654,11 +677,17 @@
case 8:
*(PUCHAR)(ULONG_PTR)Address = Value;
break;
+
case 16:
*(PUSHORT)(ULONG_PTR)Address = Value;
break;
+
case 32:
*(PULONG)(ULONG_PTR)Address = Value;
+ break;
+
+ case 64:
+ *(PULONGLONG)(ULONG_PTR)Address = Value;
break;
default:
@@ -691,6 +720,7 @@
case 32:
*Value = READ_PORT_ULONG((PULONG)Address);
break;
+
default:
DPRINT1("AcpiOsReadPort got bad width: %d\n",Width);
return (AE_BAD_PARAMETER);
@@ -719,7 +749,7 @@
case 32:
WRITE_PORT_ULONG((PULONG)Address, Value);
break;
-
+
default:
DPRINT1("AcpiOsWritePort got bad width: %d\n",Width);
return (AE_BAD_PARAMETER);
@@ -857,10 +887,19 @@
void)
{
LARGE_INTEGER CurrentTime;
-
+
KeQuerySystemTime(&CurrentTime);
-
return CurrentTime.QuadPart;
+}
+
+void
+AcpiOsWaitEventsComplete(void)
+{
+ /*
+ * Wait for all asynchronous events to complete.
+ * This implementation does nothing.
+ */
+ return;
}
ACPI_STATUS
@@ -869,7 +908,7 @@
void *Info)
{
ACPI_SIGNAL_FATAL_INFO *FatalInfo = Info;
-
+
switch (Function)
{
case ACPI_SIGNAL_FATAL:
@@ -885,7 +924,7 @@
DPRINT1 ("AcpiOsBreakpoint ****\n");
break;
}
-
+
ASSERT(FALSE);
return (AE_OK);