mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 00:41:36 +00:00
[VIDEOPRT] Reformat VideoPortVerifyAccessRanges()
Fix indentation, add SAL annotations and Doxygen description.
This commit is contained in:
parent
7eca194709
commit
de6313d89e
|
@ -1251,9 +1251,9 @@ VPAPI
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
VideoPortVerifyAccessRanges(
|
VideoPortVerifyAccessRanges(
|
||||||
IN PVOID HwDeviceExtension,
|
_In_ PVOID HwDeviceExtension,
|
||||||
IN ULONG NumAccessRanges,
|
_In_opt_ ULONG NumAccessRanges,
|
||||||
IN PVIDEO_ACCESS_RANGE AccessRanges);
|
_In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges);
|
||||||
|
|
||||||
VPAPI
|
VPAPI
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -816,84 +816,100 @@ VideoPortGetAccessRanges(
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* @implemented
|
* @brief
|
||||||
*/
|
* Claims or releases a range of hardware resources and checks for conflicts.
|
||||||
|
*
|
||||||
VP_STATUS NTAPI
|
* @param[in] HwDeviceExtension
|
||||||
|
* The miniport device extension.
|
||||||
|
*
|
||||||
|
* @param[in] NumAccessRanges
|
||||||
|
* The number of hardware resource ranges in the @p AccessRanges array.
|
||||||
|
* Specify zero to release the hardware resources held by the miniport.
|
||||||
|
*
|
||||||
|
* @param[in] AccessRanges
|
||||||
|
* The array of hardware resource ranges to claim ownership.
|
||||||
|
* Specify NULL to release the hardware resources held by the miniport.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* NO_ERROR if the resources have been successfully claimed or released.
|
||||||
|
* ERROR_INVALID_PARAMETER if an error or a conflict occurred.
|
||||||
|
**/
|
||||||
|
VP_STATUS
|
||||||
|
NTAPI
|
||||||
VideoPortVerifyAccessRanges(
|
VideoPortVerifyAccessRanges(
|
||||||
IN PVOID HwDeviceExtension,
|
_In_ PVOID HwDeviceExtension,
|
||||||
IN ULONG NumAccessRanges,
|
_In_opt_ ULONG NumAccessRanges,
|
||||||
IN PVIDEO_ACCESS_RANGE AccessRanges)
|
_In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges)
|
||||||
{
|
{
|
||||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
BOOLEAN ConflictDetected;
|
BOOLEAN ConflictDetected;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
ULONG ResourceListSize;
|
ULONG ResourceListSize;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
|
TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
|
||||||
|
|
||||||
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
|
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
|
||||||
|
|
||||||
/* Create the resource list */
|
/* Create the resource list */
|
||||||
ResourceListSize = sizeof(CM_RESOURCE_LIST)
|
ResourceListSize = sizeof(CM_RESOURCE_LIST)
|
||||||
+ (NumAccessRanges - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
+ (NumAccessRanges - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
|
ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
|
||||||
if (!ResourceList)
|
if (!ResourceList)
|
||||||
{
|
{
|
||||||
WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
|
WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill resource list */
|
/* Fill resource list */
|
||||||
ResourceList->Count = 1;
|
ResourceList->Count = 1;
|
||||||
ResourceList->List[0].InterfaceType = DeviceExtension->AdapterInterfaceType;
|
ResourceList->List[0].InterfaceType = DeviceExtension->AdapterInterfaceType;
|
||||||
ResourceList->List[0].BusNumber = DeviceExtension->SystemIoBusNumber;
|
ResourceList->List[0].BusNumber = DeviceExtension->SystemIoBusNumber;
|
||||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||||
ResourceList->List[0].PartialResourceList.Count = NumAccessRanges;
|
ResourceList->List[0].PartialResourceList.Count = NumAccessRanges;
|
||||||
for (i = 0; i < NumAccessRanges; i++, AccessRanges++)
|
for (i = 0; i < NumAccessRanges; i++, AccessRanges++)
|
||||||
{
|
{
|
||||||
PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
|
PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
|
||||||
if (AccessRanges->RangeInIoSpace)
|
if (AccessRanges->RangeInIoSpace)
|
||||||
{
|
{
|
||||||
PartialDescriptor->Type = CmResourceTypePort;
|
PartialDescriptor->Type = CmResourceTypePort;
|
||||||
PartialDescriptor->u.Port.Start = AccessRanges->RangeStart;
|
PartialDescriptor->u.Port.Start = AccessRanges->RangeStart;
|
||||||
PartialDescriptor->u.Port.Length = AccessRanges->RangeLength;
|
PartialDescriptor->u.Port.Length = AccessRanges->RangeLength;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartialDescriptor->Type = CmResourceTypeMemory;
|
PartialDescriptor->Type = CmResourceTypeMemory;
|
||||||
PartialDescriptor->u.Memory.Start = AccessRanges->RangeStart;
|
PartialDescriptor->u.Memory.Start = AccessRanges->RangeStart;
|
||||||
PartialDescriptor->u.Memory.Length = AccessRanges->RangeLength;
|
PartialDescriptor->u.Memory.Length = AccessRanges->RangeLength;
|
||||||
}
|
}
|
||||||
if (AccessRanges->RangeShareable)
|
if (AccessRanges->RangeShareable)
|
||||||
PartialDescriptor->ShareDisposition = CmResourceShareShared;
|
PartialDescriptor->ShareDisposition = CmResourceShareShared;
|
||||||
else
|
else
|
||||||
PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||||
PartialDescriptor->Flags = 0;
|
PartialDescriptor->Flags = 0;
|
||||||
if (AccessRanges->RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
|
if (AccessRanges->RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
|
||||||
PartialDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
|
PartialDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
|
||||||
if (AccessRanges->RangePassive & VIDEO_RANGE_10_BIT_DECODE)
|
if (AccessRanges->RangePassive & VIDEO_RANGE_10_BIT_DECODE)
|
||||||
PartialDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
|
PartialDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to acquire all resource ranges */
|
/* Try to acquire all resource ranges */
|
||||||
Status = IoReportResourceForDetection(
|
Status = IoReportResourceForDetection(
|
||||||
DeviceExtension->DriverObject,
|
DeviceExtension->DriverObject,
|
||||||
NULL, 0, /* Driver List */
|
NULL, 0, /* Driver List */
|
||||||
DeviceExtension->PhysicalDeviceObject,
|
DeviceExtension->PhysicalDeviceObject,
|
||||||
ResourceList, ResourceListSize,
|
ResourceList, ResourceListSize,
|
||||||
&ConflictDetected);
|
&ConflictDetected);
|
||||||
ExFreePool(ResourceList);
|
ExFreePool(ResourceList);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status) || ConflictDetected)
|
if (!NT_SUCCESS(Status) || ConflictDetected)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
else
|
else
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue