[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/OsdSchedule.c , 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.

svn path=/trunk/; revision=62608
This commit is contained in:
Hermès Bélusca-Maïto 2014-04-03 23:44:20 +00:00
parent 97ab12262b
commit 1f753ef84f
4 changed files with 97 additions and 58 deletions

View file

@ -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 */

View file

@ -827,7 +827,7 @@ acpi_bus_match (
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_bus_add (
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];

View file

@ -175,7 +175,7 @@ struct acpi_device_pnp {
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_trim(struct acpi_device *start, int rmdevice);
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);

View file

@ -46,7 +46,7 @@ AcpiOsGetRootPointer (
ACPI_PHYSICAL_ADDRESS pa = 0;
DPRINT("AcpiOsGetRootPointer\n");
AcpiFindRootPointer(&pa);
return pa;
}
@ -64,7 +64,7 @@ AcpiOsPredefinedOverride(
/* No override */
*NewValue = NULL;
return AE_OK;
}
@ -81,7 +81,26 @@ AcpiOsTableOverride(
/* 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 @@ AcpiOsMapMemory (
{
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 @@ AcpiOsMapMemory (
{
DPRINT1("Mapping failed\n");
}
return Ptr;
}
@ -150,7 +169,7 @@ void
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 @@ AcpiOsReadable(
_SEH2_TRY
{
ProbeForRead(Memory, Length, sizeof(UCHAR));
Ret = TRUE;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
@ -172,7 +190,7 @@ AcpiOsReadable(
Ret = FALSE;
}
_SEH2_END;
return Ret;
}
@ -186,7 +204,6 @@ AcpiOsWritable(
_SEH2_TRY
{
ProbeForWrite(Memory, Length, sizeof(UCHAR));
Ret = TRUE;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
@ -194,7 +211,7 @@ AcpiOsWritable(
Ret = FALSE;
}
_SEH2_END;
return Ret;
}
@ -215,14 +232,14 @@ AcpiOsExecute (
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
DPRINT("AcpiOsExecute\n");
DPRINT("AcpiOsExecute\n");
InitializeObjectAttributes(&ObjectAttributes,
InitializeObjectAttributes(&ObjectAttributes,
NULL,
OBJ_KERNEL_HANDLE,
NULL,
NULL);
Status = PsCreateSystemThread(&ThreadHandle,
THREAD_ALL_ACCESS,
&ObjectAttributes,
@ -234,7 +251,7 @@ AcpiOsExecute (
return AE_ERROR;
ZwClose(ThreadHandle);
return AE_OK;
}
@ -242,7 +259,7 @@ void
AcpiOsSleep (UINT64 milliseconds)
{
DPRINT("AcpiOsSleep %d\n", milliseconds);
KeStallExecutionProcessor(milliseconds*1000);
KeStallExecutionProcessor(milliseconds*1000);
}
void
@ -263,14 +280,14 @@ AcpiOsCreateMutex(
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 @@ AcpiOsDeleteMutex(
DPRINT1("Bad parameter\n");
return;
}
ExFreePool(Handle);
}
@ -323,7 +340,7 @@ AcpiOsReleaseMutex(
DPRINT1("Bad parameter\n");
return;
}
ExReleaseFastMutex((PFAST_MUTEX)Handle);
}
@ -346,16 +363,16 @@ AcpiOsCreateSemaphore(
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 @@ AcpiOsDeleteSemaphore(
DPRINT1("Bad parameter\n");
return AE_BAD_PARAMETER;
}
ExFreePool(Handle);
return AE_OK;
}
@ -410,13 +427,13 @@ AcpiOsWaitSemaphore(
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 @@ AcpiOsSignalSemaphore(
}
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 @@ AcpiOsCreateLock(
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 @@ AcpiOsDeleteLock(
DPRINT1("Bad parameter\n");
return;
}
ExFreePool(Handle);
}
@ -484,7 +501,7 @@ AcpiOsAcquireLock(
ACPI_SPINLOCK Handle)
{
KIRQL OldIrql;
if ((OldIrql = KeGetCurrentIrql()) >= DISPATCH_LEVEL)
{
KeAcquireSpinLockAtDpcLevel((PKSPIN_LOCK)Handle);
@ -493,7 +510,7 @@ AcpiOsAcquireLock(
{
KeAcquireSpinLock((PKSPIN_LOCK)Handle, &OldIrql);
}
return (ACPI_CPU_FLAGS)OldIrql;
}
@ -503,7 +520,7 @@ AcpiOsReleaseLock(
ACPI_CPU_FLAGS Flags)
{
KIRQL OldIrql = (KIRQL)Flags;
if (OldIrql >= DISPATCH_LEVEL)
{
KeReleaseSpinLockFromDpcLevel((PKSPIN_LOCK)Handle);
@ -539,13 +556,13 @@ AcpiOsInstallInterruptHandler (
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 @@ AcpiOsRemoveInterruptHandler (
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 @@ AcpiOsRemoveInterruptHandler (
ACPI_STATUS
AcpiOsReadMemory (
ACPI_PHYSICAL_ADDRESS Address,
UINT32 *Value,
UINT64 *Value,
UINT32 Width)
{
DPRINT("AcpiOsReadMemory %p\n", Address);
@ -627,13 +644,19 @@ AcpiOsReadMemory (
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:
DPRINT1("AcpiOsReadMemory got bad width: %d\n",Width);
return (AE_BAD_PARAMETER);
@ -645,7 +668,7 @@ AcpiOsReadMemory (
ACPI_STATUS
AcpiOsWriteMemory (
ACPI_PHYSICAL_ADDRESS Address,
UINT32 Value,
UINT64 Value,
UINT32 Width)
{
DPRINT("AcpiOsWriteMemory %p\n", Address);
@ -654,13 +677,19 @@ AcpiOsWriteMemory (
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:
DPRINT1("AcpiOsWriteMemory got bad width: %d\n",Width);
return (AE_BAD_PARAMETER);
@ -691,6 +720,7 @@ AcpiOsReadPort (
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 @@ AcpiOsWritePort (
case 32:
WRITE_PORT_ULONG((PULONG)Address, Value);
break;
default:
DPRINT1("AcpiOsWritePort got bad width: %d\n",Width);
return (AE_BAD_PARAMETER);
@ -857,19 +887,28 @@ AcpiOsGetTimer(
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
AcpiOsSignal (
UINT32 Function,
void *Info)
{
ACPI_SIGNAL_FATAL_INFO *FatalInfo = Info;
switch (Function)
{
case ACPI_SIGNAL_FATAL:
@ -885,7 +924,7 @@ AcpiOsSignal (
DPRINT1 ("AcpiOsBreakpoint ****\n");
break;
}
ASSERT(FALSE);
return (AE_OK);