Author: ekohl Date: Sun Jan 22 15:03:11 2017 New Revision: 73587
URL: http://svn.reactos.org/svn/reactos?rev=73587&view=rev Log: [FREELDR] Add VESA DDC detection and EDID read code. Work in progress.
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c trunk/reactos/boot/freeldr/freeldr/include/video.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Sun Jan 22 15:03:11 2017 @@ -1678,6 +1678,18 @@ TRACE("Created key: DisplayController\0\n");
/* FIXME: Add display peripheral (monitor) data */ + if (VesaVersion != 0) + { + if (BiosIsVesaDdcSupported()) + { + TRACE("VESA/DDC supported!\n"); + if (BiosVesaReadEdid()) + { + TRACE("EDID data read successfully!\n"); + + } + } + } }
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386vid.c [iso-8859-1] Sun Jan 22 15:03:11 2017 @@ -22,7 +22,7 @@ #define NDEBUG #include <debug.h>
-DBG_DEFAULT_CHANNEL(UI); +DBG_DEFAULT_CHANNEL(HWDETECT);
#include <pshpack2.h> typedef struct @@ -237,3 +237,64 @@
return SvgaInfo->VesaVersion; } + + +BOOLEAN +BiosIsVesaDdcSupported(VOID) +{ + REGS Regs; + + TRACE("BiosIsVesaDdcSupported()\n"); + + Regs.w.ax = 0x4F15; + Regs.b.bl = 0; + Regs.w.cx = 0; + Regs.w.es = 0; + Regs.w.di = 0; + Int386(0x10, &Regs, &Regs); + + TRACE("AL = 0x%x\n", Regs.b.al); + TRACE("AH = 0x%x\n", Regs.b.ah); + + TRACE("BL = 0x%x\n", Regs.b.bl); + + if (Regs.w.ax != 0x004F) + { + ERR("VESA/DDC installation check failed\n"); + return FALSE; + } + + return (Regs.b.ah == 0); +} + + +BOOLEAN +BiosVesaReadEdid(VOID) +{ + REGS Regs; + + TRACE("BiosVesaReadEdid()\n"); + + RtlZeroMemory((PVOID)BIOSCALLBUFFER, 128); + + Regs.w.ax = 0x4F15; + Regs.b.bl = 1; + Regs.w.cx = 0; + Regs.w.dx = 0; + Regs.w.es = BIOSCALLBUFSEGMENT; + Regs.w.di = BIOSCALLBUFOFFSET; + Int386(0x10, &Regs, &Regs); + + TRACE("AL = 0x%x\n", Regs.b.al); + TRACE("AH = 0x%x\n", Regs.b.ah); + + if (Regs.w.ax != 0x004F) + { + ERR("Read EDID function not supported!\n"); + return FALSE; + } + + return (Regs.b.ah == 0); +} + +/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/include/video.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/video.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/video.h [iso-8859-1] Sun Jan 22 15:03:11 2017 @@ -30,9 +30,11 @@
extern PVOID VideoOffScreenBuffer;
-USHORT BiosIsVesaSupported(VOID); // Implemented in i386vid.c, returns the VESA version +USHORT BiosIsVesaSupported(VOID); // Implemented in i386vid.c, returns the VESA version +BOOLEAN BiosIsVesaDdcSupported(VOID); +BOOLEAN BiosVesaReadEdid(VOID);
-PVOID VideoAllocateOffScreenBuffer(VOID); // Returns a pointer to an off-screen buffer sufficient for the current video mode +PVOID VideoAllocateOffScreenBuffer(VOID); // Returns a pointer to an off-screen buffer sufficient for the current video mode
VOID VideoCopyOffScreenBufferToVRAM(VOID);