[VIDEOPRT]

FORMATTING, no code change.

svn path=/trunk/; revision=60962
This commit is contained in:
Timo Kreuzer 2013-11-12 16:36:12 +00:00
parent 49a2c38305
commit 3e75f29597

View file

@ -30,8 +30,8 @@ PVIDEO_PORT_DEVICE_EXTENSION ResetDisplayParametersDeviceExtension = NULL;
/* /*
* Reset display to blue screen * Reset display to blue screen
*/ */
BOOLEAN
BOOLEAN NTAPI NTAPI
IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows) IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows)
{ {
PVIDEO_PORT_DRIVER_EXTENSION DriverExtension; PVIDEO_PORT_DRIVER_EXTENSION DriverExtension;
@ -56,7 +56,8 @@ IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows)
return FALSE; return FALSE;
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortAddDevice( IntVideoPortAddDevice(
IN PDRIVER_OBJECT DriverObject, IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject) IN PDEVICE_OBJECT PhysicalDeviceObject)
@ -65,18 +66,11 @@ IntVideoPortAddDevice(
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
NTSTATUS Status; NTSTATUS Status;
/* /* Get the initialization data we saved in VideoPortInitialize. */
* Get the initialization data we saved in VideoPortInitialize.
*/
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
/* /* Create adapter device object. */
* Create adapter device object. Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
*/
Status = IntVideoPortCreateAdapterDeviceObject(
DriverObject,
DriverExtension, DriverExtension,
PhysicalDeviceObject, PhysicalDeviceObject,
&DeviceObject); &DeviceObject);
@ -94,8 +88,8 @@ IntVideoPortAddDevice(
* Run Level * Run Level
* PASSIVE_LEVEL * PASSIVE_LEVEL
*/ */
NTSTATUS
NTSTATUS NTAPI NTAPI
IntVideoPortDispatchOpen( IntVideoPortDispatchOpen(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -130,7 +124,6 @@ IntVideoPortDispatchOpen(
if (DriverExtension->InitializationData.HwInitialize(&DeviceExtension->MiniPortDeviceExtension)) if (DriverExtension->InitializationData.HwInitialize(&DeviceExtension->MiniPortDeviceExtension))
{ {
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
InterlockedIncrement((PLONG)&DeviceExtension->DeviceOpened); InterlockedIncrement((PLONG)&DeviceExtension->DeviceOpened);
} }
else else
@ -152,8 +145,8 @@ IntVideoPortDispatchOpen(
* Run Level * Run Level
* PASSIVE_LEVEL * PASSIVE_LEVEL
*/ */
NTSTATUS
NTSTATUS NTAPI NTAPI
IntVideoPortDispatchClose( IntVideoPortDispatchClose(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -163,8 +156,8 @@ IntVideoPortDispatchClose(
TRACE_(VIDEOPRT, "IntVideoPortDispatchClose\n"); TRACE_(VIDEOPRT, "IntVideoPortDispatchClose\n");
DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if (DeviceExtension->DeviceOpened >= 1 && if ((DeviceExtension->DeviceOpened >= 1) &&
InterlockedDecrement((PLONG)&DeviceExtension->DeviceOpened) == 0) (InterlockedDecrement((PLONG)&DeviceExtension->DeviceOpened) == 0))
{ {
ResetDisplayParametersDeviceExtension = NULL; ResetDisplayParametersDeviceExtension = NULL;
InbvNotifyDisplayOwnershipLost(NULL); InbvNotifyDisplayOwnershipLost(NULL);
@ -186,8 +179,8 @@ IntVideoPortDispatchClose(
* Run Level * Run Level
* PASSIVE_LEVEL * PASSIVE_LEVEL
*/ */
NTSTATUS
NTSTATUS NTAPI NTAPI
IntVideoPortDispatchDeviceControl( IntVideoPortDispatchDeviceControl(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -208,7 +201,7 @@ IntVideoPortDispatchDeviceControl(
vrp = ExAllocatePoolWithTag(NonPagedPool, vrp = ExAllocatePoolWithTag(NonPagedPool,
sizeof(VIDEO_REQUEST_PACKET), sizeof(VIDEO_REQUEST_PACKET),
TAG_REQUEST_PACKET); TAG_REQUEST_PACKET);
if (NULL == vrp) if (vrp == NULL)
{ {
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
} }
@ -236,16 +229,29 @@ IntVideoPortDispatchDeviceControl(
if (Irp->IoStatus.Status != STATUS_SUCCESS) if (Irp->IoStatus.Status != STATUS_SUCCESS)
{ {
/* Map from win32 error codes to NT status values. */
switch (Irp->IoStatus.Status) switch (Irp->IoStatus.Status)
{ {
case ERROR_NOT_ENOUGH_MEMORY: Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; break; case ERROR_NOT_ENOUGH_MEMORY:
case ERROR_MORE_DATA: Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; break; Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
case ERROR_INVALID_FUNCTION: Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; break; break;
case ERROR_INVALID_PARAMETER: Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; break; case ERROR_MORE_DATA:
case ERROR_INSUFFICIENT_BUFFER: Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; break; Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
case ERROR_DEV_NOT_EXIST: Irp->IoStatus.Status = STATUS_DEVICE_DOES_NOT_EXIST; break; break;
case ERROR_IO_PENDING: Irp->IoStatus.Status = STATUS_PENDING; break; case ERROR_INVALID_FUNCTION:
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
break;
case ERROR_INVALID_PARAMETER:
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
case ERROR_INSUFFICIENT_BUFFER:
Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
break;
case ERROR_DEV_NOT_EXIST:
Irp->IoStatus.Status = STATUS_DEVICE_DOES_NOT_EXIST;
break;
case ERROR_IO_PENDING:
Irp->IoStatus.Status = STATUS_PENDING;
break;
} }
} }
@ -273,7 +279,8 @@ IntVideoPortDispatchDeviceControl(
* PASSIVE_LEVEL * PASSIVE_LEVEL
*/ */
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortDispatchWrite( IntVideoPortDispatchWrite(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -295,7 +302,6 @@ IntVideoPortDispatchWrite(
* FIXME: We should process all opened display devices in * FIXME: We should process all opened display devices in
* IntVideoPortResetDisplayParameters. * IntVideoPortResetDisplayParameters.
*/ */
ResetDisplayParametersDeviceExtension = DeviceExtension; ResetDisplayParametersDeviceExtension = DeviceExtension;
InbvNotifyDisplayOwnershipLost(IntVideoPortResetDisplayParameters); InbvNotifyDisplayOwnershipLost(IntVideoPortResetDisplayParameters);
@ -307,7 +313,8 @@ IntVideoPortDispatchWrite(
return nErrCode; return nErrCode;
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortPnPStartDevice( IntVideoPortPnPStartDevice(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -318,18 +325,12 @@ IntVideoPortPnPStartDevice(
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
PCM_RESOURCE_LIST AllocatedResources; PCM_RESOURCE_LIST AllocatedResources;
/* /* Get the initialization data we saved in VideoPortInitialize.*/
* Get the initialization data we saved in VideoPortInitialize.
*/
DriverObject = DeviceObject->DriverObject; DriverObject = DeviceObject->DriverObject;
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* /* Store some resources in the DeviceExtension. */
* Store some resources in the DeviceExtension.
*/
AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources; AllocatedResources = Stack->Parameters.StartDevice.AllocatedResources;
if (AllocatedResources != NULL) if (AllocatedResources != NULL)
{ {
@ -382,16 +383,13 @@ IntVideoPortPnPStartDevice(
} }
} }
} }
INFO_(VIDEOPRT, "Interrupt level: 0x%x Interrupt Vector: 0x%x\n", INFO_(VIDEOPRT, "Interrupt level: 0x%x Interrupt Vector: 0x%x\n",
DeviceExtension->InterruptLevel, DeviceExtension->InterruptLevel,
DeviceExtension->InterruptVector); DeviceExtension->InterruptVector);
/* /* Create adapter device object. */
* Create adapter device object. return IntVideoPortFindAdapter(DriverObject,
*/
return IntVideoPortFindAdapter(
DriverObject,
DriverExtension, DriverExtension,
DeviceObject); DeviceObject);
} }
@ -434,7 +432,8 @@ IntVideoPortQueryBusRelations(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if (i == 0) if (i == 0)
return Irp->IoStatus.Status; return Irp->IoStatus.Status;
DeviceRelations = ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS) + ((i - 1) * sizeof(PVOID))); DeviceRelations = ExAllocatePool(PagedPool,
sizeof(DEVICE_RELATIONS) + ((i - 1) * sizeof(PVOID)));
if (!DeviceRelations) return STATUS_NO_MEMORY; if (!DeviceRelations) return STATUS_NO_MEMORY;
DeviceRelations->Count = i; DeviceRelations->Count = i;
@ -470,18 +469,25 @@ IntVideoPortForwardIrpAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp)
KeInitializeEvent(&Event, NotificationEvent, FALSE); KeInitializeEvent(&Event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp); IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp, IntVideoPortForwardIrpAndWaitCompletionRoutine, IoSetCompletionRoutine(Irp,
&Event, TRUE, TRUE, TRUE); IntVideoPortForwardIrpAndWaitCompletionRoutine,
&Event,
TRUE,
TRUE,
TRUE);
Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp); Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = Irp->IoStatus.Status; Status = Irp->IoStatus.Status;
} }
return Status; return Status;
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortDispatchFdoPnp( IntVideoPortDispatchFdoPnp(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -557,7 +563,8 @@ IntVideoPortDispatchFdoPnp(
return Status; return Status;
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortDispatchPnp( IntVideoPortDispatchPnp(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -570,7 +577,8 @@ IntVideoPortDispatchPnp(
return IntVideoPortDispatchPdoPnp(DeviceObject, Irp); return IntVideoPortDispatchPdoPnp(DeviceObject, Irp);
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortDispatchCleanup( IntVideoPortDispatchCleanup(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -587,7 +595,8 @@ IntVideoPortDispatchCleanup(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortDispatchPower( IntVideoPortDispatchPower(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -595,7 +604,8 @@ IntVideoPortDispatchPower(
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
NTSTATUS NTAPI NTSTATUS
NTAPI
IntVideoPortDispatchSystemControl( IntVideoPortDispatchSystemControl(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
@ -603,7 +613,8 @@ IntVideoPortDispatchSystemControl(
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
VOID NTAPI VOID
NTAPI
IntVideoPortUnload(PDRIVER_OBJECT DriverObject) IntVideoPortUnload(PDRIVER_OBJECT DriverObject)
{ {
} }