Author: cgutman
Date: Thu Mar 11 23:36:22 2010
New Revision: 46121
URL:
http://svn.reactos.org/svn/reactos?rev=46121&view=rev
Log:
- Use the possible resources not the current resources for
IRP_MN_QUERY_RESOURCE_REQUIREMENTS
- Initialize MaximumVector for IRQs, MaximumChannel for DMA, and Alignment for Port
Modified:
trunk/reactos/drivers/bus/acpi/buspdo.c
Modified: trunk/reactos/drivers/bus/acpi/buspdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/buspdo.c?…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] Thu Mar 11 23:36:22 2010
@@ -695,25 +695,25 @@
{
ResourceDescriptor->Type = CmResourceTypeDma;
ResourceDescriptor->Flags = 0;
- switch (dma_data->Type)
- {
- case ACPI_TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
- case ACPI_TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
- case ACPI_TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
+ switch (dma_data->Type)
+ {
+ case ACPI_TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
+ case ACPI_TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
+ case ACPI_TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
+ }
+ if (dma_data->BusMaster == ACPI_BUS_MASTER)
+ ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
+ switch (dma_data->Transfer)
+ {
+ case ACPI_TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
+ case ACPI_TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
+ case ACPI_TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16;
break;
+ }
+ ResourceDescriptor->u.Dma.Channel = dma_data->Channels[i];
+
+ ResourceDescriptor++;
}
- if (dma_data->BusMaster == ACPI_BUS_MASTER)
- ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
- switch (dma_data->Transfer)
- {
- case ACPI_TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
- case ACPI_TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
- case ACPI_TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16;
break;
- }
- ResourceDescriptor->u.Dma.Channel = dma_data->Channels[i];
-
- ResourceDescriptor++;
- }
- break;
+ break;
}
case ACPI_RESOURCE_TYPE_IO:
{
@@ -757,24 +757,39 @@
ULONG i, RequirementsListSize;
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
+ BOOLEAN CurrentRes = FALSE;
PAGED_CODE ();
/* Get current resources */
- Buffer.Length = 0;
- AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
- if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
- Buffer.Length == 0)
+ while (TRUE)
{
- return Irp->IoStatus.Status;
+ Buffer.Length = 0;
+ if (CurrentRes)
+ AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
+ else
+ AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle,
&Buffer);
+ if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
+ Buffer.Length == 0)
+ {
+ if (!CurrentRes)
+ CurrentRes = TRUE;
+ else
+ return Irp->IoStatus.Status;
+ }
+ else
+ break;
}
Buffer.Pointer = ExAllocatePool(PagedPool, Buffer.Length);
if (!Buffer.Pointer)
return STATUS_INSUFFICIENT_RESOURCES;
- AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
+ if (CurrentRes)
+ AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
+ else
+ AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
if (!ACPI_SUCCESS(AcpiStatus))
{
DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
@@ -841,11 +856,12 @@
ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
for (i = 0; i < irq_data->InterruptCount; i++)
{
- RequirementDescriptor->Option = 0; /* Required */
+ RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
RequirementDescriptor->Type = CmResourceTypeInterrupt;
RequirementDescriptor->ShareDisposition = (irq_data->Sharable == ACPI_SHARED ?
CmResourceShareShared : CmResourceShareDeviceExclusive);
RequirementDescriptor->Flags =(irq_data->Triggering == ACPI_LEVEL_SENSITIVE ?
CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE : CM_RESOURCE_INTERRUPT_LATCHED);
- RequirementDescriptor->u.Interrupt.MinimumVector = irq_data->Interrupts[i];
+ RequirementDescriptor->u.Interrupt.MinimumVector =
+ RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
RequirementDescriptor++;
}
@@ -858,27 +874,28 @@
{
RequirementDescriptor->Type = CmResourceTypeDma;
RequirementDescriptor->Flags = 0;
- switch (dma_data->Type)
- {
- case ACPI_TYPE_A: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
- case ACPI_TYPE_B: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
- case ACPI_TYPE_F: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
+ switch (dma_data->Type)
+ {
+ case ACPI_TYPE_A: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A;
break;
+ case ACPI_TYPE_B: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B;
break;
+ case ACPI_TYPE_F: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F;
break;
+ }
+ if (dma_data->BusMaster == ACPI_BUS_MASTER)
+ RequirementDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
+ switch (dma_data->Transfer)
+ {
+ case ACPI_TRANSFER_8: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
+ case ACPI_TRANSFER_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_16;
break;
+ case ACPI_TRANSFER_8_16: RequirementDescriptor->Flags |=
CM_RESOURCE_DMA_8_AND_16; break;
+ }
+
+ RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
+ RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
+ RequirementDescriptor->u.Dma.MinimumChannel =
+ RequirementDescriptor->u.Dma.MaximumChannel = dma_data->Channels[i];
+ RequirementDescriptor++;
}
- if (dma_data->BusMaster == ACPI_BUS_MASTER)
- RequirementDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
- switch (dma_data->Transfer)
- {
- case ACPI_TRANSFER_8: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
- case ACPI_TRANSFER_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_16;
break;
- case ACPI_TRANSFER_8_16: RequirementDescriptor->Flags |=
CM_RESOURCE_DMA_8_AND_16; break;
- }
-
- RequirementDescriptor->Option = 0; /* Required */
- RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
- RequirementDescriptor->u.Dma.MinimumChannel = dma_data->Channels[i];
- RequirementDescriptor++;
- }
- break;
+ break;
}
case ACPI_RESOURCE_TYPE_IO:
{
@@ -891,10 +908,10 @@
RequirementDescriptor->u.Port.Length = io_data->AddressLength;
- RequirementDescriptor->Option = 0; /* Required */
+ RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
RequirementDescriptor->Type = CmResourceTypePort;
RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
- RequirementDescriptor->u.Port.Alignment = 1; /* Start address is specified, so it
doesn't matter */
+ RequirementDescriptor->u.Port.Alignment = io_data->Alignment;
RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Minimum;
RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Maximum;