Commit in reactos/drivers/video/videoprt on videoprt_pnp_14032004
dispatch.c+28-391.1.2.8 -> 1.1.2.9
interrupt.c+8-141.1.2.2 -> 1.1.2.3
services.c+1-31.2.2.1 -> 1.2.2.2
timer.c+11-81.1.2.2 -> 1.1.2.3
videoprt.c+10-61.21.2.4 -> 1.21.2.5
videoprt.h+6-21.6.2.3 -> 1.6.2.4
+64-72
6 modified files
- Bug fixes.

reactos/drivers/video/videoprt
dispatch.c 1.1.2.8 -> 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- dispatch.c	17 Mar 2004 20:16:22 -0000	1.1.2.8
+++ dispatch.c	18 Mar 2004 21:28:21 -0000	1.1.2.9
@@ -18,7 +18,7 @@
  * If not, write to the Free Software Foundation,
  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: dispatch.c,v 1.1.2.8 2004/03/17 20:16:22 navaraf Exp $
+ * $Id: dispatch.c,v 1.1.2.9 2004/03/18 21:28:21 navaraf Exp $
  */
 
 #include "videoprt.h"
@@ -105,8 +105,6 @@
 
    DPRINT("IntVideoPortDispatchOpen\n");
 
-   DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
    if (CsrssInitialized == FALSE)
    {
       /*
@@ -120,40 +118,37 @@
 
       CsrssInitialized = TRUE;
 
-      DeviceExtension->OpenReferenceCount++;
-
       Irp->IoStatus.Information = FILE_OPENED;
       IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
       return STATUS_SUCCESS;
    }
 
-   if (DeviceExtension->OpenReferenceCount++ == 0)
+   DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+
+   DriverExtension = IoGetDriverObjectExtension(
+      DeviceObject->DriverObject,
+      DeviceObject->DriverObject);
+
+   if (DriverExtension->InitializationData.HwInitialize(&DeviceExtension->MiniPortDeviceExtension))
+   {
+      Irp->IoStatus.Status = STATUS_SUCCESS;
+
+      /*
+       * Storing the device extension pointer in a static variable is an
+       * ugly hack. Unfortunately, we need it in VideoPortResetDisplayParameters
+       * and HalAcquireDisplayOwnership doesn't allow us to pass a userdata
+       * parameter. On the bright side, the DISPLAY device is opened
+       * exclusively, so there can be only one device extension active at
+       * any point in time.
+       */
+
+      ResetDisplayParametersDeviceExtension = DeviceExtension;
+      HalAcquireDisplayOwnership(IntVideoPortResetDisplayParameters);
+   }
+   else
    {
-      DriverExtension = IoGetDriverObjectExtension(
-         DeviceObject->DriverObject,
-         DeviceObject->DriverObject);
-
-      if (DriverExtension->InitializationData.HwInitialize(DeviceExtension->MiniPortDeviceExtension))
-      {
-         Irp->IoStatus.Status = STATUS_SUCCESS;
-
-         /*
-          * Storing the device extension pointer in a static variable is an
-          * ugly hack. Unfortunately, we need it in VideoPortResetDisplayParameters
-          * and HalAcquireDisplayOwnership doesn't allow us to pass a userdata
-          * parameter. On the bright side, the DISPLAY device is opened
-          * exclusively, so there can be only one device extension active at
-          * any point in time.
-          */
-
-         ResetDisplayParametersDeviceExtension = DeviceExtension;
-         HalAcquireDisplayOwnership(IntVideoPortResetDisplayParameters);
-      }
-      else
-      {
-         Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
-      }
+      Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
    }
 
    Irp->IoStatus.Information = FILE_OPENED;
@@ -176,16 +171,10 @@
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp)
 {
-   PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
-
    DPRINT("IntVideoPortDispatchClose\n");
 
-   DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-   if (--DeviceExtension->OpenReferenceCount == 0)
-   {
-      if (ResetDisplayParametersDeviceExtension != NULL)
-         HalReleaseDisplayOwnership();
-   }
+   if (ResetDisplayParametersDeviceExtension != NULL)
+      HalReleaseDisplayOwnership();
 
    Irp->IoStatus.Status = STATUS_SUCCESS;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
@@ -241,7 +230,7 @@
 
    /* Call the Miniport Driver with the VRP */
    DriverExtension->InitializationData.HwStartIO(
-      (PVOID)&DeviceExtension->MiniPortDeviceExtension,
+      &DeviceExtension->MiniPortDeviceExtension,
       vrp);
 
    /* Free the VRP */

reactos/drivers/video/videoprt
interrupt.c 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- interrupt.c	17 Mar 2004 20:16:22 -0000	1.1.2.2
+++ interrupt.c	18 Mar 2004 21:28:21 -0000	1.1.2.3
@@ -18,7 +18,7 @@
  * If not, write to the Free Software Foundation,
  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: interrupt.c,v 1.1.2.2 2004/03/17 20:16:22 navaraf Exp $
+ * $Id: interrupt.c,v 1.1.2.3 2004/03/18 21:28:21 navaraf Exp $
  */
 
 #include "videoprt.h"
@@ -40,7 +40,7 @@
    ASSERT(DriverExtension->InitializationData.HwInterrupt != NULL);
 
    return DriverExtension->InitializationData.HwInterrupt(
-      DeviceExtension->MiniPortDeviceExtension);
+      &DeviceExtension->MiniPortDeviceExtension);
 }
 
 BOOLEAN STDCALL
@@ -62,11 +62,11 @@
       KIRQL Irql;
       KAFFINITY Affinity;
 
-      if (ConfigInfo->BusInterruptVector != 0)
-         DeviceExtension->InterruptVector = ConfigInfo->BusInterruptVector;
+      if (ConfigInfo->BusInterruptVector == 0)
+         ConfigInfo->BusInterruptVector = DeviceExtension->InterruptVector;
 
-      if (ConfigInfo->BusInterruptLevel != 0)
-         DeviceExtension->InterruptLevel = ConfigInfo->BusInterruptLevel;
+      if (ConfigInfo->BusInterruptLevel == 0)
+         ConfigInfo->BusInterruptLevel = DeviceExtension->InterruptLevel;
 
       InterruptVector = HalGetInterruptVector(
          ConfigInfo->AdapterInterfaceType,
@@ -120,10 +120,7 @@
 
    DPRINT("VideoPortEnableInterrupt\n");
 
-   DeviceExtension = CONTAINING_RECORD(
-      HwDeviceExtension,
-      VIDEO_PORT_DEVICE_EXTENSION,
-      MiniPortDeviceExtension);
+   DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
 
    Status = HalEnableSystemInterrupt(
       DeviceExtension->InterruptVector,
@@ -145,10 +142,7 @@
 
    DPRINT("VideoPortDisableInterrupt\n");
 
-   DeviceExtension = CONTAINING_RECORD(
-      HwDeviceExtension,
-      VIDEO_PORT_DEVICE_EXTENSION,
-      MiniPortDeviceExtension);
+   DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
 
    Status = HalDisableSystemInterrupt(
       DeviceExtension->InterruptVector,

reactos/drivers/video/videoprt
services.c 1.2.2.1 -> 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- services.c	14 Mar 2004 17:16:28 -0000	1.2.2.1
+++ services.c	18 Mar 2004 21:28:21 -0000	1.2.2.2
@@ -18,7 +18,7 @@
  * If not, write to the Free Software Foundation,
  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: services.c,v 1.2.2.1 2004/03/14 17:16:28 navaraf Exp $
+ * $Id: services.c,v 1.2.2.2 2004/03/18 21:28:21 navaraf Exp $
  */
 
 #include "videoprt.h"
@@ -82,5 +82,3 @@
    UNIMPLEMENTED;
    return FALSE;
 }
-
-

reactos/drivers/video/videoprt
timer.c 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- timer.c	17 Mar 2004 20:16:22 -0000	1.1.2.2
+++ timer.c	18 Mar 2004 21:28:21 -0000	1.1.2.3
@@ -18,7 +18,7 @@
  * If not, write to the Free Software Foundation,
  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: timer.c,v 1.1.2.2 2004/03/17 20:16:22 navaraf Exp $
+ * $Id: timer.c,v 1.1.2.3 2004/03/18 21:28:21 navaraf Exp $
  */
 
 #include "videoprt.h"
@@ -34,13 +34,13 @@
    PVIDEO_PORT_DRIVER_EXTENSION DriverExtension;
 
    DriverExtension = IoGetDriverObjectExtension(
-      DeviceExtension->FunctionalDeviceObject->DriverObject,
-      DeviceExtension->FunctionalDeviceObject->DriverObject);
+      DeviceObject->DriverObject,
+      DeviceObject->DriverObject);
   
    ASSERT(DriverExtension->InitializationData.HwTimer != NULL);
 
    DriverExtension->InitializationData.HwTimer(
-      DeviceExtension->MiniPortDeviceExtension);
+      &DeviceExtension->MiniPortDeviceExtension);
 }
 
 BOOLEAN STDCALL
@@ -64,7 +64,7 @@
 
       if (!NT_SUCCESS(Status))
       {
-         DPRINT("IoInitializeTimer failed with status 0x%08x\n", Status);          
+         DPRINT("IoInitializeTimer failed with status 0x%08x\n", Status);
          return FALSE;
       }
    }
@@ -79,20 +79,23 @@
  */
 
 VOID STDCALL
-VideoPortStartTimer(IN PVOID  HwDeviceExtension)
+VideoPortStartTimer(IN PVOID HwDeviceExtension)
 {
    DPRINT("VideoPortStartTimer\n");
+/*
    IoStartTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
+*/
 }
 
-
 /*
  * @implemented
  */
 
 VOID STDCALL
-VideoPortStopTimer(IN PVOID  HwDeviceExtension)
+VideoPortStopTimer(IN PVOID HwDeviceExtension)
 {
    DPRINT("VideoPortStopTimer\n");
+/*
    IoStopTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
+*/
 }

reactos/drivers/video/videoprt
videoprt.c 1.21.2.4 -> 1.21.2.5
diff -u -r1.21.2.4 -r1.21.2.5
--- videoprt.c	17 Mar 2004 20:16:22 -0000	1.21.2.4
+++ videoprt.c	18 Mar 2004 21:28:21 -0000	1.21.2.5
@@ -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.21.2.4 2004/03/17 20:16:22 navaraf Exp $
+ * $Id: videoprt.c,v 1.21.2.5 2004/03/18 21:28:21 navaraf Exp $
  */
 
 #include "videoprt.h"
@@ -125,7 +125,7 @@
    IN PVOID SystemArgument2)
 {
    PVOID HwDeviceExtension = 
-      ((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
+      &((PVIDEO_PORT_DEVICE_EXTENSION)DeferredContext)->MiniPortDeviceExtension;
    ((PMINIPORT_DPC_ROUTINE)SystemArgument1)(HwDeviceExtension, SystemArgument2);
 }
 
@@ -238,9 +238,10 @@
 
    DeviceExtension->RegistryPath.Length = 
    DeviceExtension->RegistryPath.MaximumLength = 
-      DriverExtension->RegistryPath.Length + (8 * sizeof(WCHAR));
+      DriverExtension->RegistryPath.Length + (9 * sizeof(WCHAR));
+   DeviceExtension->RegistryPath.Length -= sizeof(WCHAR);
    DeviceExtension->RegistryPath.Buffer = ExAllocatePoolWithTag(
-      PagedPool,
+      NonPagedPool,
       DeviceExtension->RegistryPath.MaximumLength,
       TAG_VIDEO_PORT);      
    swprintf(DeviceExtension->RegistryPath.Buffer, L"%s\\Device0",
@@ -367,6 +368,7 @@
          else
          {
             DPRINT("HwFindAdapter call failed with error %X\n", Status);
+            RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
             IoDeleteDevice(DeviceObject);
 
             return Status;
@@ -387,8 +389,8 @@
    if (Status != NO_ERROR)
    {
       DPRINT("HwFindAdapter call failed with error %X\n", Status);
+      RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
       IoDeleteDevice(DeviceObject);
-
       return Status;
    }
 
@@ -410,7 +412,7 @@
       DeviceVideoBuffer,
       REG_SZ,
       DeviceExtension->RegistryPath.Buffer,
-      DeviceExtension->RegistryPath.Length + sizeof(WCHAR));
+      DeviceExtension->RegistryPath.MaximumLength);
 
    /* FIXME: Allocate hardware resources for device. */
 
@@ -420,6 +422,7 @@
 
    if (!IntVideoPortSetupInterrupt(DeviceObject, DriverExtension, &ConfigInfo))
    {
+      RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
       IoDeleteDevice(DeviceObject);
       return STATUS_INSUFFICIENT_RESOURCES;
    }
@@ -432,6 +435,7 @@
    {
       if (DeviceExtension->InterruptObject != NULL)
          IoDisconnectInterrupt(DeviceExtension->InterruptObject);
+      RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
       IoDeleteDevice(DeviceObject);
       DPRINT("STATUS_INSUFFICIENT_RESOURCES\n");
       return STATUS_INSUFFICIENT_RESOURCES;

reactos/drivers/video/videoprt
videoprt.h 1.6.2.3 -> 1.6.2.4
diff -u -r1.6.2.3 -r1.6.2.4
--- videoprt.h	17 Mar 2004 20:16:22 -0000	1.6.2.3
+++ videoprt.h	18 Mar 2004 21:28:21 -0000	1.6.2.4
@@ -18,7 +18,7 @@
  * If not, write to the Free Software Foundation,
  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: videoprt.h,v 1.6.2.3 2004/03/17 20:16:22 navaraf Exp $
+ * $Id: videoprt.h,v 1.6.2.4 2004/03/18 21:28:21 navaraf Exp $
  */
 
 #ifndef VIDEOPRT_H
@@ -64,7 +64,6 @@
    ULONG SystemIoSlotNumber;
    LIST_ENTRY AddressMappingListHead;
    KDPC DpcObject;
-   ULONG OpenReferenceCount;
    CHAR MiniPortDeviceExtension[1];
 } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
 
@@ -189,4 +188,9 @@
    IN PVOID Context,
    IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
 
+VP_STATUS STDCALL
+VideoPortInt10(
+   IN PVOID HwDeviceExtension,
+   IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
+
 #endif /* VIDEOPRT_H */
CVSspam 0.2.8