mirror of
https://github.com/reactos/reactos.git
synced 2024-07-29 23:58:44 +00:00
- Add -Wall and -Werror flags, fix resulting problems
- Add dependency tracking - Fix interrupt and timer handling svn path=/trunk/; revision=6533
This commit is contained in:
parent
7bee3f3c72
commit
310f723526
|
@ -3,3 +3,4 @@ videoprt.coff
|
||||||
*.sym
|
*.sym
|
||||||
*.sys
|
*.sys
|
||||||
*.map
|
*.map
|
||||||
|
.*.d
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.1 2003/02/15 19:50:28 gvg Exp $
|
# $Id: Makefile,v 1.2 2003/11/05 22:31:50 gvg Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -6,10 +6,14 @@ TARGET_TYPE = export_driver
|
||||||
|
|
||||||
TARGET_NAME = videoprt
|
TARGET_NAME = videoprt
|
||||||
|
|
||||||
TARGET_CFLAGS =
|
TARGET_CFLAGS += -Wall -Werror
|
||||||
|
|
||||||
TARGET_OBJECTS = videoprt.o
|
TARGET_OBJECTS = videoprt.o
|
||||||
|
|
||||||
include $(PATH_TO_TOP)/rules.mak
|
include $(PATH_TO_TOP)/rules.mak
|
||||||
|
|
||||||
include $(TOOLS_PATH)/helper.mk
|
include $(TOOLS_PATH)/helper.mk
|
||||||
|
|
||||||
|
# Automatic dependency tracking
|
||||||
|
DEP_OBJECTS := $(TARGET_OBJECTS)
|
||||||
|
include $(PATH_TO_TOP)/tools/depend.mk
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: videoprt.c,v 1.11 2003/10/24 21:39:59 gvg Exp $
|
/* $Id: videoprt.c,v 1.12 2003/11/05 22:31:50 gvg Exp $
|
||||||
*
|
*
|
||||||
* VideoPort driver
|
* VideoPort driver
|
||||||
* Written by Rex Jolliff
|
* Written by Rex Jolliff
|
||||||
|
@ -34,11 +34,12 @@ typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PKINTERRUPT InterruptObject;
|
PKINTERRUPT InterruptObject;
|
||||||
KSPIN_LOCK InterruptSpinLock;
|
KSPIN_LOCK InterruptSpinLock;
|
||||||
|
ULONG InterruptVector;
|
||||||
ULONG InterruptLevel;
|
ULONG InterruptLevel;
|
||||||
KIRQL IRQL;
|
|
||||||
KAFFINITY Affinity;
|
|
||||||
PVIDEO_HW_INITIALIZE HwInitialize;
|
PVIDEO_HW_INITIALIZE HwInitialize;
|
||||||
PVIDEO_HW_RESET_HW HwResetHw;
|
PVIDEO_HW_RESET_HW HwResetHw;
|
||||||
|
PVIDEO_HW_TIMER HwTimer;
|
||||||
|
PVIDEO_HW_INTERRUPT HwInterrupt;
|
||||||
LIST_ENTRY AddressMappingListHead;
|
LIST_ENTRY AddressMappingListHead;
|
||||||
INTERFACE_TYPE AdapterInterfaceType;
|
INTERFACE_TYPE AdapterInterfaceType;
|
||||||
ULONG SystemIoBusNumber;
|
ULONG SystemIoBusNumber;
|
||||||
|
@ -48,7 +49,6 @@ typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
|
||||||
} VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
|
} VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
|
||||||
|
|
||||||
|
|
||||||
static VOID STDCALL VidStartIo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
|
||||||
static NTSTATUS STDCALL VidDispatchOpen(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchOpen(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
||||||
static NTSTATUS STDCALL VidDispatchClose(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchClose(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
||||||
static NTSTATUS STDCALL VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
||||||
|
@ -127,6 +127,7 @@ VideoPortDisableInterrupt(IN PVOID HwDeviceExtension)
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortDisableInterrupt\n");
|
DPRINT("VideoPortDisableInterrupt\n");
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +140,7 @@ VideoPortEnableInterrupt(IN PVOID HwDeviceExtension)
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortEnableInterrupt\n");
|
DPRINT("VideoPortEnableInterrupt\n");
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,6 +239,7 @@ VideoPortGetDeviceData(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortGetDeviceData\n");
|
DPRINT("VideoPortGetDeviceData\n");
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -306,8 +309,7 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
}
|
}
|
||||||
AssignedCount = 0;
|
AssignedCount = 0;
|
||||||
for (FullList = AllocatedResources->List;
|
for (FullList = AllocatedResources->List;
|
||||||
FullList < AllocatedResources->List + AllocatedResources->Count &&
|
FullList < AllocatedResources->List + AllocatedResources->Count;
|
||||||
AssignedCount < NumAccessRanges;
|
|
||||||
FullList++)
|
FullList++)
|
||||||
{
|
{
|
||||||
assert(FullList->InterfaceType == PCIBus &&
|
assert(FullList->InterfaceType == PCIBus &&
|
||||||
|
@ -315,12 +317,25 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
1 == FullList->PartialResourceList.Version &&
|
1 == FullList->PartialResourceList.Version &&
|
||||||
1 == FullList->PartialResourceList.Revision);
|
1 == FullList->PartialResourceList.Revision);
|
||||||
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
||||||
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count &&
|
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
|
||||||
AssignedCount < NumAccessRanges;
|
|
||||||
Descriptor++)
|
Descriptor++)
|
||||||
{
|
{
|
||||||
|
if ((CmResourceTypeMemory == Descriptor->Type
|
||||||
|
|| CmResourceTypePort == Descriptor->Type)
|
||||||
|
&& NumAccessRanges <= AssignedCount)
|
||||||
|
{
|
||||||
|
DPRINT1("Too many access ranges found\n");
|
||||||
|
ExFreePool(AllocatedResources);
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
if (CmResourceTypeMemory == Descriptor->Type)
|
if (CmResourceTypeMemory == Descriptor->Type)
|
||||||
{
|
{
|
||||||
|
if (NumAccessRanges <= AssignedCount)
|
||||||
|
{
|
||||||
|
DPRINT1("Too many access ranges found\n");
|
||||||
|
ExFreePool(AllocatedResources);
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
DPRINT("Memory range starting at 0x%08x length 0x%08x\n",
|
DPRINT("Memory range starting at 0x%08x length 0x%08x\n",
|
||||||
Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length);
|
Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length);
|
||||||
AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start;
|
AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start;
|
||||||
|
@ -329,6 +344,7 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
|
AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
|
||||||
AccessRanges[AssignedCount].RangeShareable =
|
AccessRanges[AssignedCount].RangeShareable =
|
||||||
(CmResourceShareShared == Descriptor->ShareDisposition);
|
(CmResourceShareShared == Descriptor->ShareDisposition);
|
||||||
|
AssignedCount++;
|
||||||
}
|
}
|
||||||
else if (CmResourceTypePort == Descriptor->Type)
|
else if (CmResourceTypePort == Descriptor->Type)
|
||||||
{
|
{
|
||||||
|
@ -339,14 +355,14 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
AccessRanges[AssignedCount].RangeInIoSpace = 1;
|
AccessRanges[AssignedCount].RangeInIoSpace = 1;
|
||||||
AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
|
AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
|
||||||
AccessRanges[AssignedCount].RangeShareable = 0;
|
AccessRanges[AssignedCount].RangeShareable = 0;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ExFreePool(AllocatedResources);
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
AssignedCount++;
|
AssignedCount++;
|
||||||
}
|
}
|
||||||
|
else if (CmResourceTypeInterrupt == Descriptor->Type)
|
||||||
|
{
|
||||||
|
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
|
||||||
|
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ExFreePool(AllocatedResources);
|
ExFreePool(AllocatedResources);
|
||||||
}
|
}
|
||||||
|
@ -433,6 +449,30 @@ VideoPortGetRegistryParameters(IN PVOID HwDeviceExtension,
|
||||||
? ERROR_SUCCESS : ERROR_INVALID_PARAMETER;
|
? ERROR_SUCCESS : ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOLEAN
|
||||||
|
VPInterruptRoutine(IN struct _KINTERRUPT *Interrupt,
|
||||||
|
IN PVOID ServiceContext)
|
||||||
|
{
|
||||||
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DeviceExtension = ServiceContext;
|
||||||
|
assert(NULL != DeviceExtension->HwInterrupt);
|
||||||
|
|
||||||
|
return DeviceExtension->HwInterrupt(&DeviceExtension->MiniPortDeviceExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID STDCALL
|
||||||
|
VPTimerRoutine(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PVOID Context)
|
||||||
|
{
|
||||||
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DeviceExtension = Context;
|
||||||
|
assert(DeviceExtension == DeviceObject->DeviceExtension
|
||||||
|
&& NULL != DeviceExtension->HwTimer);
|
||||||
|
|
||||||
|
DeviceExtension->HwTimer(&DeviceExtension->MiniPortDeviceExtension);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -458,6 +498,9 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
UNICODE_STRING SymlinkName;
|
UNICODE_STRING SymlinkName;
|
||||||
ULONG MaxBus;
|
ULONG MaxBus;
|
||||||
ULONG MaxLen;
|
ULONG MaxLen;
|
||||||
|
KIRQL IRQL;
|
||||||
|
KAFFINITY Affinity;
|
||||||
|
ULONG InterruptVector;
|
||||||
|
|
||||||
DPRINT("VideoPortInitialize\n");
|
DPRINT("VideoPortInitialize\n");
|
||||||
|
|
||||||
|
@ -577,52 +620,62 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
/* FIXME: Allocate hardware resources for device */
|
/* FIXME: Allocate hardware resources for device */
|
||||||
|
|
||||||
/* Allocate interrupt for device */
|
/* Allocate interrupt for device */
|
||||||
if (HwInitializationData->HwInterrupt != NULL &&
|
DeviceExtension->HwInterrupt = HwInitializationData->HwInterrupt;
|
||||||
!(ConfigInfo.BusInterruptLevel == 0 &&
|
if (0 == ConfigInfo.BusInterruptVector)
|
||||||
ConfigInfo.BusInterruptVector == 0))
|
|
||||||
{
|
{
|
||||||
#if 0
|
ConfigInfo.BusInterruptVector = DeviceExtension->InterruptVector;
|
||||||
DeviceExtension->IRQL = ConfigInfo.BusInterruptLevel;
|
}
|
||||||
DeviceExtension->InterruptLevel =
|
if (0 == ConfigInfo.BusInterruptLevel)
|
||||||
|
{
|
||||||
|
ConfigInfo.BusInterruptLevel = DeviceExtension->InterruptLevel;
|
||||||
|
}
|
||||||
|
if (NULL != HwInitializationData->HwInterrupt)
|
||||||
|
{
|
||||||
|
InterruptVector =
|
||||||
HalGetInterruptVector(ConfigInfo.AdapterInterfaceType,
|
HalGetInterruptVector(ConfigInfo.AdapterInterfaceType,
|
||||||
ConfigInfo.SystemIoBusNumber,
|
ConfigInfo.SystemIoBusNumber,
|
||||||
ConfigInfo.BusInterruptLevel,
|
ConfigInfo.BusInterruptLevel,
|
||||||
ConfigInfo.BusInterruptVector,
|
ConfigInfo.BusInterruptVector,
|
||||||
&DeviceExtension->IRQL,
|
&IRQL,
|
||||||
&DeviceExtension->Affinity);
|
&Affinity);
|
||||||
|
if (0 == InterruptVector)
|
||||||
|
{
|
||||||
|
DPRINT1("HalGetInterruptVector failed\n");
|
||||||
|
IoDeleteDevice(MPDeviceObject);
|
||||||
|
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
KeInitializeSpinLock(&DeviceExtension->InterruptSpinLock);
|
KeInitializeSpinLock(&DeviceExtension->InterruptSpinLock);
|
||||||
Status = IoConnectInterrupt(&DeviceExtension->InterruptObject,
|
Status = IoConnectInterrupt(&DeviceExtension->InterruptObject,
|
||||||
(PKSERVICE_ROUTINE)
|
VPInterruptRoutine,
|
||||||
HwInitializationData->HwInterrupt,
|
DeviceExtension,
|
||||||
&DeviceExtension->MiniPortDeviceExtension,
|
|
||||||
&DeviceExtension->InterruptSpinLock,
|
&DeviceExtension->InterruptSpinLock,
|
||||||
DeviceExtension->InterruptLevel,
|
InterruptVector,
|
||||||
DeviceExtension->IRQL,
|
IRQL,
|
||||||
DeviceExtension->IRQL,
|
IRQL,
|
||||||
ConfigInfo.InterruptMode,
|
ConfigInfo.InterruptMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
DeviceExtension->Affinity,
|
Affinity,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IoConnectInterrupt failed with status 0x%08x\n", Status);
|
DPRINT1("IoConnectInterrupt failed with status 0x%08x\n", Status);
|
||||||
IoDeleteDevice(MPDeviceObject);
|
IoDeleteDevice(MPDeviceObject);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
DeviceNumber++;
|
DeviceNumber++;
|
||||||
}
|
}
|
||||||
while (Again);
|
while (Again);
|
||||||
|
|
||||||
/* FIXME: initialize timer routine for MP Driver */
|
DeviceExtension->HwTimer = HwInitializationData->HwTimer;
|
||||||
if (HwInitializationData->HwTimer != NULL)
|
if (HwInitializationData->HwTimer != NULL)
|
||||||
{
|
{
|
||||||
|
DPRINT("Initializing timer\n");
|
||||||
Status = IoInitializeTimer(MPDeviceObject,
|
Status = IoInitializeTimer(MPDeviceObject,
|
||||||
(PIO_TIMER_ROUTINE)
|
VPTimerRoutine,
|
||||||
HwInitializationData->HwTimer,
|
DeviceExtension);
|
||||||
&DeviceExtension->MiniPortDeviceExtension);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IoInitializeTimer failed with status 0x%08x\n", Status);
|
DPRINT("IoInitializeTimer failed with status 0x%08x\n", Status);
|
||||||
|
@ -715,6 +768,7 @@ VideoPortMapBankedMemory(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortMapBankedMemory\n");
|
DPRINT("VideoPortMapBankedMemory\n");
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -730,8 +784,6 @@ VideoPortMapMemory(IN PVOID HwDeviceExtension,
|
||||||
OUT PVOID *VirtualAddress)
|
OUT PVOID *VirtualAddress)
|
||||||
{
|
{
|
||||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
|
|
||||||
PLIST_ENTRY Entry;
|
|
||||||
|
|
||||||
DPRINT("VideoPortMapMemory\n");
|
DPRINT("VideoPortMapMemory\n");
|
||||||
|
|
||||||
|
@ -996,6 +1048,7 @@ VideoPortSetTrappedEmulatorPorts(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortSetTrappedEmulatorPorts\n");
|
DPRINT("VideoPortSetTrappedEmulatorPorts\n");
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1404,7 +1457,6 @@ VidDispatchClose(IN PDEVICE_OBJECT pDO,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IrpStack;
|
PIO_STACK_LOCATION IrpStack;
|
||||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
|
||||||
|
|
||||||
DPRINT("VidDispatchClose() called\n");
|
DPRINT("VidDispatchClose() called\n");
|
||||||
|
|
||||||
|
@ -1425,29 +1477,6 @@ VidDispatchClose(IN PDEVICE_OBJECT pDO,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// VidStartIo
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// Get the next requested I/O packet started
|
|
||||||
//
|
|
||||||
// RUN LEVEL:
|
|
||||||
// DISPATCH_LEVEL
|
|
||||||
//
|
|
||||||
// ARGUMENTS:
|
|
||||||
// Dispatch routine standard arguments
|
|
||||||
//
|
|
||||||
// RETURNS:
|
|
||||||
// NTSTATUS
|
|
||||||
//
|
|
||||||
|
|
||||||
static VOID STDCALL
|
|
||||||
VidStartIo(IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp)
|
|
||||||
{
|
|
||||||
DPRINT("VidStartIo\n");
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// VidDispatchDeviceControl
|
// VidDispatchDeviceControl
|
||||||
//
|
//
|
||||||
// DESCRIPTION:
|
// DESCRIPTION:
|
||||||
|
|
Loading…
Reference in a new issue