From b23ea08f8ad1f7d922ab15a3f6bfff8c41310a5f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 20 Jun 2004 09:12:10 +0000 Subject: [PATCH] Detect display controller. Distinguish VGA and VBE display devices. svn path=/trunk/; revision=9742 --- freeldr/freeldr/arch/i386/hardware.c | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/freeldr/freeldr/arch/i386/hardware.c b/freeldr/freeldr/arch/i386/hardware.c index 2e5b37f070a..7b375519cdf 100644 --- a/freeldr/freeldr/arch/i386/hardware.c +++ b/freeldr/freeldr/arch/i386/hardware.c @@ -25,6 +25,7 @@ #include #include #include +#include #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) { @@ -2019,6 +2089,8 @@ DetectIsaBios(HKEY SystemKey, U32 *BusNumber) DetectPS2Mouse(BusKey); + DetectDisplayController(BusKey); + /* FIXME: Detect more ISA devices */ }