[HALACPI]: Implement querying HALACPI resource requirements. If it exists, the SCI Vector is added to the list as a requirement.

svn path=/trunk/; revision=46663
This commit is contained in:
Sir Richard 2010-04-02 06:28:43 +00:00
parent c61b788c62
commit cbc12bf14d
3 changed files with 123 additions and 3 deletions

View file

@ -37,6 +37,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;
PWCHAR HalHardwareIdString = L"acpipic_up";
@ -900,6 +902,98 @@ HalpIs16BitPortDecodeSupported(VOID)
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
*/

View file

@ -341,9 +341,29 @@ NTAPI
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

View file

@ -751,6 +751,12 @@ HalpIs16BitPortDecodeSupported(
VOID
);
NTSTATUS
NTAPI
HalpQueryAcpiResourceRequirements(
OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements
);
VOID
FASTCALL
KeUpdateSystemTime(