Author: sir_richard
Date: Fri Apr 2 08:28:43 2010
New Revision: 46663
URL:
http://svn.reactos.org/svn/reactos?rev=46663&view=rev
Log:
[HALACPI]: Implement querying HALACPI resource requirements. If it exists, the SCI Vector
is added to the list as a requirement.
Modified:
trunk/reactos/hal/halx86/generic/acpi/halacpi.c
trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
trunk/reactos/hal/halx86/include/halp.h
Modified: trunk/reactos/hal/halx86/generic/acpi/halacpi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] Fri Apr 2 08:28:43 2010
@@ -36,6 +36,8 @@
LIST_ENTRY HalpAcpiTableMatchList;
ULONG HalpInvalidAcpiTable;
+
+ULONG HalpPicVectorRedirect[] = {0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15};
/* This determines the HAL type */
BOOLEAN HalDisableFirmwareMapper = TRUE;
@@ -900,6 +902,98 @@
return CM_RESOURCE_PORT_16_BIT_DECODE;
}
+VOID
+NTAPI
+HalpAcpiDetectResourceListSize(OUT PULONG ListSize)
+{
+ PAGED_CODE();
+
+ /* One element if there is a SCI */
+ *ListSize = HalpFixedAcpiDescTable.sci_int_vector ? 1: 0;
+}
+
+NTSTATUS
+NTAPI
+HalpBuildAcpiResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceList)
+{
+ ULONG Interrupt;
+ PAGED_CODE();
+ ASSERT(ResourceList != NULL);
+
+ /* Initialize the list */
+ ResourceList->BusNumber = -1;
+ ResourceList->AlternativeLists = 1;
+ ResourceList->InterfaceType = PNPBus;
+ ResourceList->List[0].Version = 1;
+ ResourceList->List[0].Revision = 1;
+
+ /* Is there a SCI? */
+ if (HalpFixedAcpiDescTable.sci_int_vector)
+ {
+ /* Fill out the entry for it */
+ ResourceList->List[0].Descriptors[0].Flags =
CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
+ ResourceList->List[0].Descriptors[0].Type = CmResourceTypeInterrupt;
+ ResourceList->List[0].Descriptors[0].ShareDisposition =
CmResourceShareShared;
+
+ /* Get the interrupt number */
+ Interrupt = HalpPicVectorRedirect[HalpFixedAcpiDescTable.sci_int_vector];
+ ResourceList->List[0].Descriptors[0].u.Interrupt.MinimumVector = Interrupt;
+ ResourceList->List[0].Descriptors[0].u.Interrupt.MaximumVector = Interrupt;
+
+ /* One more */
+ ++ResourceList->List[0].Count;
+ }
+
+ /* All good */
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
+{
+ PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
+ ULONG Count = 0, ListSize;
+ NTSTATUS Status;
+ PAGED_CODE();
+
+ /* Get ACPI resources */
+ HalpAcpiDetectResourceListSize(&Count);
+
+ /* Compute size of the list and allocate it */
+ ListSize = sizeof(IO_RESOURCE_LIST) * (Count - 1) +
+ sizeof(IO_RESOURCE_REQUIREMENTS_LIST);
+ RequirementsList = ExAllocatePoolWithTag(PagedPool, ListSize, ' laH');
+ if (RequirementsList)
+ {
+ /* Initialize it */
+ RtlZeroMemory(RequirementsList, ListSize);
+ RequirementsList->ListSize = ListSize;
+
+ /* Build it */
+ Status = HalpBuildAcpiResourceList(RequirementsList);
+ if (NT_SUCCESS(Status))
+ {
+ /* It worked, return it */
+ *Requirements = RequirementsList;
+ }
+ else
+ {
+ /* Fail */
+ ExFreePoolWithTag(RequirementsList, 0);
+ Status = STATUS_NO_SUCH_DEVICE;
+ }
+ }
+ else
+ {
+ /* Not enough memory */
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /* Return the status */
+ return Status;
+}
+
/*
* @implemented
*/
Modified: trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] Fri Apr 2 08:28:43
2010
@@ -341,9 +341,29 @@
HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject,
OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
{
- UNIMPLEMENTED;
- while (TRUE);
- return STATUS_NO_SUCH_DEVICE;
+ PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
+ NTSTATUS Status;
+ PAGED_CODE();
+
+ /* Only the ACPI PDO has requirements */
+ if (DeviceExtension->PdoType == AcpiPdo)
+ {
+ /* Query ACPI requirements */
+ Status = HalpQueryAcpiResourceRequirements(Requirements);
+ }
+ else if (DeviceExtension->PdoType == WdPdo)
+ {
+ /* Watchdog doesn't */
+ return STATUS_NOT_SUPPORTED;
+ }
+ else
+ {
+ /* This shouldn't happen */
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Return the status */
+ return Status;
}
NTSTATUS
Modified: trunk/reactos/hal/halx86/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] Fri Apr 2 08:28:43 2010
@@ -751,6 +751,12 @@
VOID
);
+NTSTATUS
+NTAPI
+HalpQueryAcpiResourceRequirements(
+ OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements
+);
+
VOID
FASTCALL
KeUpdateSystemTime(