- Implemented VideoPortQueryPerformanceCounter and all video port spinlock functions.

- Added more debug info to VideoPortGetAccessRanges.

svn path=/trunk/; revision=8611
This commit is contained in:
Filip Navara 2004-03-09 17:28:49 +00:00
parent e4ac5bf4f4
commit daae8270b7
4 changed files with 181 additions and 38 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.2 2004/03/04 18:51:58 navaraf Exp $
# $Id: Makefile,v 1.3 2004/03/09 17:28:49 navaraf Exp $
PATH_TO_TOP = ../../..
@ -12,7 +12,8 @@ TARGET_OBJECTS = \
int10.o \
interrupt.o \
videoprt.o \
services.o
services.o \
spinlock.o
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,109 @@
/*
* VideoPort driver
*
* Copyright (C) 2002, 2003, 2004 ReactOS Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; see the file COPYING.LIB.
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: spinlock.c,v 1.1 2004/03/09 17:28:49 navaraf Exp $
*/
#include "videoprt.h"
/*
* @implemented
*/
VP_STATUS STDCALL
VideoPortCreateSpinLock(
IN PVOID HwDeviceExtension,
OUT PSPIN_LOCK *SpinLock)
{
DPRINT("VideoPortCreateSpinLock\n");
*SpinLock = ExAllocatePool(NonPagedPool, sizeof(KSPIN_LOCK));
if (*SpinLock == NULL)
return STATUS_UNSUCCESSFUL;
KeInitializeSpinLock((PKSPIN_LOCK)*SpinLock);
return STATUS_SUCCESS;
}
/*
* @implemented
*/
VP_STATUS STDCALL
VideoPortDeleteSpinLock(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock)
{
DPRINT("VideoPortDeleteSpinLock\n");
ExFreePool(SpinLock);
return STATUS_SUCCESS;
}
/*
* @implemented
*/
VOID STDCALL
VideoPortAcquireSpinLock(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock,
OUT PUCHAR OldIrql)
{
DPRINT("VideoPortAcquireSpinLock\n");
KeAcquireSpinLock((PKSPIN_LOCK)SpinLock, OldIrql);
}
/*
* @implemented
*/
VOID STDCALL
VideoPortAcquireSpinLockAtDpcLevel(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock)
{
DPRINT("VideoPortAcquireSpinLockAtDpcLevel\n");
KefAcquireSpinLockAtDpcLevel((PKSPIN_LOCK)SpinLock);
}
/*
* @implemented
*/
VOID STDCALL
VideoPortReleaseSpinLock(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock,
IN UCHAR NewIrql)
{
DPRINT("VideoPortReleaseSpinLock\n");
KeReleaseSpinLock((PKSPIN_LOCK)SpinLock, NewIrql);
}
/*
* @implemented
*/
VOID STDCALL
VideoPortReleaseSpinLockFromDpcLevel(
IN PVOID HwDeviceExtension,
IN PSPIN_LOCK SpinLock)
{
DPRINT("VideoPortReleaseSpinLockFromDpcLevel\n");
KefReleaseSpinLockFromDpcLevel((PKSPIN_LOCK)SpinLock);
}

View file

@ -18,7 +18,7 @@
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: videoprt.c,v 1.16 2004/03/09 14:16:39 navaraf Exp $
* $Id: videoprt.c,v 1.17 2004/03/09 17:28:49 navaraf Exp $
*/
#include "videoprt.h"
@ -211,26 +211,10 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
USHORT VendorIdToFind;
USHORT DeviceIdToFind;
ULONG SlotIdToFind;
DPRINT("VideoPortGetAccessRanges\n");
if (VendorId != NULL)
{
VendorIdToFind = *(PUSHORT)VendorId;
}
else
{
VendorIdToFind = 0;
}
if (DeviceId != NULL)
{
DeviceIdToFind = *(PUSHORT)DeviceId;
}
else
{
DeviceIdToFind = 0;
}
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
VIDEO_PORT_DEVICE_EXTENSION,
MiniPortDeviceExtension);
@ -238,10 +222,14 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
if (0 == NumRequestedResources &&
PCIBus == DeviceExtension->AdapterInterfaceType)
{
DPRINT("Looking for VendorId 0x%04x DeviceId 0x%04x\n",
VendorIdToFind, DeviceIdToFind);
VendorIdToFind = VendorId != NULL ? *(PUSHORT)VendorId : 0;
DeviceIdToFind = DeviceId != NULL ? *(PUSHORT)DeviceId : 0;
SlotIdToFind = Slot != NULL ? *Slot : 0;
PciSlotNumber.u.AsULONG = *Slot;
DPRINT("Looking for VendorId 0x%04x DeviceId 0x%04x SlotId 0x%04x\n",
VendorIdToFind, DeviceIdToFind, SlotIdToFind);
PciSlotNumber.u.AsULONG = SlotIdToFind;
/*
Search for the device id and vendor id on this bus.
@ -249,23 +237,23 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
for (FunctionNumber = 0; FunctionNumber < 8; FunctionNumber++)
{
ULONG ReturnedLength;
DPRINT("- Function number: %d\n", FunctionNumber);
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
ReturnedLength = HalGetBusData(PCIConfiguration,
DeviceExtension->SystemIoBusNumber,
PciSlotNumber.u.AsULONG,
&Config,
sizeof(PCI_COMMON_CONFIG));
if (sizeof(PCI_COMMON_CONFIG) == ReturnedLength)
DPRINT("- Length of data: %x\n", ReturnedLength);
if (sizeof(PCI_COMMON_CONFIG) == ReturnedLength)
{
if (DeviceId != NULL && VendorId != NULL)
{
DPRINT("Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
"DeviceId 0x%04x\n",
PciSlotNumber.u.AsULONG,
PciSlotNumber.u.bits.DeviceNumber,
PciSlotNumber.u.bits.FunctionNumber, Config.VendorID,
Config.DeviceID);
}
DPRINT("- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
"DeviceId 0x%04x\n",
PciSlotNumber.u.AsULONG,
PciSlotNumber.u.bits.DeviceNumber,
PciSlotNumber.u.bits.FunctionNumber,
Config.VendorID,
Config.DeviceID);
if ((VendorIdToFind == 0 || Config.VendorID == VendorIdToFind) &&
(DeviceIdToFind == 0 || Config.DeviceID == DeviceIdToFind))
@ -1857,3 +1845,16 @@ VideoPortGetProcAddress(IN PVOID HwDeviceExtension,
DPRINT("VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
return(NULL);
}
LONGLONG STDCALL
VideoPortQueryPerformanceCounter(
IN PVOID HwDeviceExtension,
OUT PLONGLONG PerformanceFrequency OPTIONAL)
{
LARGE_INTEGER Result;
DPRINT("VideoPortQueryPerformanceCounter\n");
Result = KeQueryPerformanceCounter((PLARGE_INTEGER)PerformanceFrequency);
return Result.QuadPart;
}

View file

@ -1,45 +1,66 @@
; $Id: videoprt.edf,v 1.7 2004/03/08 20:27:33 dwelch Exp $
; $Id: videoprt.edf,v 1.8 2004/03/09 17:28:49 navaraf Exp $
;
; vidport.def - export definition file for ReactOS
; videoprt.def - export definition file for ReactOS
;
EXPORTS
;VideoPortAcquireDeviceLock
VideoPortAcquireSpinLock=VideoPortAcquireSpinLock@12
VideoPortAcquireSpinLockAtDpcLevel=VideoPortAcquireSpinLockAtDpcLevel@8
VideoPortAllocateBuffer=VideoPortAllocateBuffer@12
VideoPortAllocateCommonBuffer=VideoPortAllocateCommonBuffer@24
;VideoPortAllocateContiguousMemory
VideoPortAllocatePool=VideoPortAllocatePool@16
;VideoPortAssociateEventsWithDmaHandle
VideoPortCheckForDeviceExistence=VideoPortCheckForDeviceExistence@28
VideoPortCompareMemory=NTOSKRNL.RtlCompareMemory
VideoPortClearEvent=VideoPortClearEvent@8
VideoPortCompareMemory=NTOSKRNL.RtlCompareMemory
;VideoPortCompleteDma
VideoPortCreateEvent=VideoPortCreateEvent@16
VideoPortCreateSecondaryDisplay=VideoPortCreateSecondaryDisplay@12
VideoPortCreateSpinLock=VideoPortCreateSpinLock@8
VideoPortDDCMonitorHelper=VideoPortDDCMonitorHelper@16
VideoPortDebugPrint
VideoPortDeleteEvent=VideoPortDeleteEvent@8
VideoPortDeleteSpinLock=VideoPortDeleteSpinLock@8
VideoPortDisableInterrupt=VideoPortDisableInterrupt@4
;VideoPortDoDma
VideoPortEnableInterrupt=VideoPortEnableInterrupt@4
VideoPortEnumerateChildren=VideoPortEnumerateChildren@8
;VideoPortFlushRegistry
;VideoPortFreeCommonBuffer
VideoPortFreeDeviceBase=VideoPortFreeDeviceBase@8
VideoPortFreePool=VideoPortFreePool@8
VideoPortGetBusData=VideoPortGetBusData@24
VideoPortGetAccessRanges=VideoPortGetAccessRanges@32
VideoPortGetAgpServices=VideoPortGetAgpServices@8
VideoPortGetAssociatedDeviceExtension=VideoPortGetAssociatedDeviceExtension@4
;VideoPortGetAssociatedDeviceID
VideoPortGetBusData=VideoPortGetBusData@24
;VideoPortGetBytesUsed
;VideoPortGetCommonBuffer
VideoPortGetCurrentIrql=VideoPortGetCurrentIrql@0
VideoPortGetDeviceBase=VideoPortGetDeviceBase@20
VideoPortGetDeviceData=VideoPortGetDeviceData@16
VideoPortGetDmaAdapter=VideoPortGetDmaAdapter@8
VideoPortGetAccessRanges=VideoPortGetAccessRanges@32
;VideoPortGetDmaContext
;VideoPortGetMdl
VideoPortGetRegistryParameters=VideoPortGetRegistryParameters@20
VideoPortGetRomImage=VideoPortGetRomImage@16
VideoPortGetVersion=VideoPortGetVersion@8
VideoPortGetVgaStatus=VideoPortGetVgaStatus@8
VideoPortInitialize=VideoPortInitialize@16
VideoPortInt10=VideoPortInt10@8
VideoPortInterlockedDecrement=NTOSKRNL.InterlockedDecrement
VideoPortInterlockedExchange=NTOSKRNL.InterlockedExchange
VideoPortInterlockedIncrement=NTOSKRNL.InterlockedIncrement
VideoPortLockBuffer=VideoPortLockBuffer@16
;VideoPortLockPages
VideoPortLogError=VideoPortLogError@16
VideoPortMapBankedMemory=VideoPortMapBankedMemory@40
;VideoPortMapDmaMemory
VideoPortMapMemory=VideoPortMapMemory@24
VideoPortMoveMemory=NTOSKRNL.RtlMoveMemory
VideoPortPutDmaAdapter=VideoPortPutDmaAdapter@8
VideoPortQueryPerformanceCounter=VideoPortQueryPerformanceCounter@8
VideoPortQueryServices=VideoPortQueryServices@12
VideoPortQuerySystemTime=NTOSKRNL.KeQuerySystemTime
VideoPortQueueDpc=VideoPortQueueDpc@12
@ -55,19 +76,29 @@ VideoPortReadRegisterUlong=NTOSKRNL.READ_REGISTER_ULONG
VideoPortReadRegisterBufferUchar=NTOSKRNL.READ_REGISTER_BUFFER_UCHAR
VideoPortReadRegisterBufferUshort=NTOSKRNL.READ_REGISTER_BUFFER_USHORT
VideoPortReadRegisterBufferUlong=NTOSKRNL.READ_REGISTER_BUFFER_ULONG
;VideoPortReadStateEvent
VideoPortRegisterBugcheckCallBack=VideoPortRegisterBugcheckCallback@16
VideoPortReleaseBuffer=VideoPortReleaseBuffer@8
VideoPortReleaseCommonBuffer=VideoPortReleaseCommonBuffer@28
;VideoPortReleaseDeviceLock
VideoPortReleaseSpinLock@12
VideoPortReleaseSpinLockFromDpcLevel@8
VideoPortScanRom=VideoPortScanRom@16
VideoPortSetBusData=VideoPortSetBusData@24
;VideoPortSetBytesUsed
;VideoPortSetDmaContext
VideoPortSetEvent=VideoPortSetEvent@8
VideoPortSetRegistryParameters=VideoPortSetRegistryParameters@16
VideoPortSetTrappedEmulatorPorts=VideoPortSetTrappedEmulatorPorts@12
;VideoPortSignalDmaComplete
VideoPortStallExecution=HAL.KeStallExecutionProcessor
;VideoPortStartDma
VideoPortStartTimer=VideoPortStartTimer@4
VideoPortStopTimer=VideoPortStopTimer@4
VideoPortSynchronizeExecution=VideoPortSynchronizeExecution@16
VideoPortUnlockBuffer=VideoPortUnlockBuffer@8
;VideoPortUnlockPages
;VideoPortUnmapDmaMemory
VideoPortUnmapMemory=VideoPortUnmapMemory@12
VideoPortVerifyAccessRanges=VideoPortVerifyAccessRanges@12
VideoPortWaitForSingleObject=VideoPortWaitForSingleObject@12
@ -85,3 +116,4 @@ VideoPortWriteRegisterBufferUshort=NTOSKRNL.WRITE_REGISTER_BUFFER_USHORT
VideoPortWriteRegisterBufferUlong=NTOSKRNL.WRITE_REGISTER_BUFFER_ULONG
VideoPortZeroMemory=NTOSKRNL.RtlZeroMemory
VideoPortZeroDeviceMemory=NTOSKRNL.RtlZeroMemory
;VpNotifyEaData