- Add (and fix) more validation and debugging

svn path=/trunk/; revision=53329
This commit is contained in:
Cameron Gutman
2011-08-19 23:11:03 +00:00
parent d0de510428
commit b95c8dcec8
2 changed files with 8 additions and 1 deletions
@@ -948,6 +948,7 @@ HalpBuildAcpiResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceList)
ResourceList->InterfaceType = PNPBus;
ResourceList->List[0].Version = 1;
ResourceList->List[0].Revision = 1;
ResourceList->List[0].Count = 0;
/* Is there a SCI? */
if (HalpFixedAcpiDescTable.sci_int_vector)
@@ -981,10 +982,12 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen
/* Get ACPI resources */
HalpAcpiDetectResourceListSize(&Count);
DPRINT1("Resource count: %d\n", Count);
/* Compute size of the list and allocate it */
ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors) +
((Count - 1) * sizeof(IO_RESOURCE_DESCRIPTOR));
DPRINT1("Resource list size: %d\n", ListSize);
RequirementsList = ExAllocatePoolWithTag(PagedPool, ListSize, ' laH');
if (RequirementsList)
{
@@ -998,6 +1001,9 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen
{
/* It worked, return it */
*Requirements = RequirementsList;
/* Validate the list */
ASSERT(RequirementsList->List[0].Count == Count);
}
else
{
+2 -1
View File
@@ -353,9 +353,10 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
{
/* Query ACPI requirements */
Status = HalpQueryAcpiResourceRequirements(&RequirementsList);
ASSERT(RequirementsList->AlternativeLists == 1);
if (!NT_SUCCESS(Status)) return Status;
ASSERT(RequirementsList->AlternativeLists == 1);
/* Allocate the resourcel ist */
ResourceList = ExAllocatePoolWithTag(PagedPool,
sizeof(CM_RESOURCE_LIST),