Detect display controller. Distinguish VGA and VBE display devices.
authorEric Kohl <eric.kohl@reactos.org>
Sun, 20 Jun 2004 09:12:10 +0000 (09:12 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 20 Jun 2004 09:12:10 +0000 (09:12 +0000)
svn path=/trunk/; revision=9742

freeldr/freeldr/arch/i386/hardware.c

index 2e5b37f..7b37551 100644 (file)
@@ -25,6 +25,7 @@
 #include <disk.h>
 #include <mm.h>
 #include <portio.h>
 #include <disk.h>
 #include <mm.h>
 #include <portio.h>
+#include <video.h>
 
 #include "../../reactos/registry.h"
 #include "hardware.h"
 
 #include "../../reactos/registry.h"
 #include "hardware.h"
@@ -1930,6 +1931,75 @@ DetectPS2Mouse(HKEY BusKey)
 }
 
 
 }
 
 
+static VOID
+DetectDisplayController(HKEY BusKey)
+{
+  CHAR Buffer[80];
+  HKEY ControllerKey;
+  U16 VesaVersion;
+  S32 Error;
+
+  Error = RegCreateKey(BusKey,
+                      "DisplayController\\0",
+                      &ControllerKey);
+  if (Error != ERROR_SUCCESS)
+    {
+      DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
+      return;
+    }
+  DbgPrint((DPRINT_HWDETECT, "Created key: PointerController\\0\n"));
+
+  /* Set 'ComponentInformation' value */
+  SetComponentInformation(ControllerKey,
+                         0x00,
+                         0,
+                         0xFFFFFFFF);
+
+  /* FIXME: Set 'ComponentInformation' value */
+
+  VesaVersion = BiosIsVesaSupported();
+  if (VesaVersion != 0)
+    {
+      DbgPrint((DPRINT_HWDETECT,
+               "VESA version %c.%c\n",
+               (VesaVersion >> 8) + '0',
+               (VesaVersion & 0xFF) + '0'));
+    }
+  else
+    {
+      DbgPrint((DPRINT_HWDETECT,
+               "VESA not supported\n"));
+    }
+
+  if (VesaVersion >= 0x0200)
+    {
+      strcpy(Buffer,
+             "VBE Display");
+    }
+  else
+    {
+      strcpy(Buffer,
+             "VGA Display");
+    }
+
+  /* Set 'Identifier' value */
+  Error = RegSetValue(ControllerKey,
+                     "Identifier",
+                     REG_SZ,
+                     (PU8)Buffer,
+                     strlen(Buffer) + 1);
+  if (Error != ERROR_SUCCESS)
+    {
+      DbgPrint((DPRINT_HWDETECT,
+               "RegSetValue() failed (Error %u)\n",
+               (int)Error));
+      return;
+    }
+
+  /* FIXME: Add display peripheral (monitor) data */
+}
+
+
 static VOID
 DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
 {
 static VOID
 DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
 {
@@ -2019,6 +2089,8 @@ DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
 
   DetectPS2Mouse(BusKey);
 
 
   DetectPS2Mouse(BusKey);
 
+  DetectDisplayController(BusKey);
+
   /* FIXME: Detect more ISA devices */
 }
 
   /* FIXME: Detect more ISA devices */
 }