/*
* FreeLoader
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
- * Portions from Linux video.S - Display adapter & video mode setup, version 2.13 (14-May-99)
- * Copyright (C) 1995 -- 1999 Martin Mares <mj@ucw.cz>
- * Based on the original setup.S code (C) Linus Torvalds and Mats Anderson
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#include <freeldr.h>
-#include <arch.h>
-#include <video.h>
-#include <portio.h>
-#include <rtl.h>
+
+#define NDEBUG
#include <debug.h>
+#include <pshpack2.h>
typedef struct
{
UCHAR Signature[4]; // (ret) signature ("VESA")
// accelerated video modes (list of words terminated with FFFFh)
UCHAR Reserved[216]; // reserved for VBE implementation
UCHAR ScratchPad[256]; // OEM scratchpad (for OEM strings, etc.)
-} PACKED VESA_SVGA_INFO, *PVESA_SVGA_INFO;
+} VESA_SVGA_INFO, *PVESA_SVGA_INFO;
+#include <poppack.h>
// Bitfields for VESA capabilities:
//
// second list. In some cases, only a "stub" VBE may be present, supporting
// only AX=4F00h; this case may be assumed if the list of supported video modes
// is empty (consisting of a single word of FFFFh)
-
-VOID BiosSetVideoFont8x16(VOID)
+#if 0
+static VOID BiosSetVideoFont8x16(VOID)
{
REGS Regs;
Int386(0x10, &Regs, &Regs);
}
-VOID VideoSetTextCursorPosition(ULONG X, ULONG Y)
+static VOID VideoSetTextCursorPosition(ULONG X, ULONG Y)
{
}
-ULONG VideoGetTextCursorPositionX(VOID)
+static ULONG VideoGetTextCursorPositionX(VOID)
{
REGS Regs;
return Regs.b.dl;
}
-ULONG VideoGetTextCursorPositionY(VOID)
+static ULONG VideoGetTextCursorPositionY(VOID)
{
REGS Regs;
return Regs.b.dh;
}
+#endif
USHORT BiosIsVesaSupported(VOID)
{
REGS Regs;
PVESA_SVGA_INFO SvgaInfo = (PVESA_SVGA_INFO)BIOSCALLBUFFER;
-#ifdef DEBUG
//USHORT* VideoModes;
//USHORT Index;
-#endif // defined DEBUG
- DbgPrint((DPRINT_UI, "BiosIsVesaSupported()\n"));
+ DPRINTM(DPRINT_UI, "BiosIsVesaSupported()\n");
RtlZeroMemory(SvgaInfo, sizeof(VESA_SVGA_INFO));
Regs.w.di = BIOSCALLBUFOFFSET;
Int386(0x10, &Regs, &Regs);
- DbgPrint((DPRINT_UI, "AL = 0x%x\n", Regs.b.al));
- DbgPrint((DPRINT_UI, "AH = 0x%x\n", Regs.b.ah));
+ DPRINTM(DPRINT_UI, "AL = 0x%x\n", Regs.b.al);
+ DPRINTM(DPRINT_UI, "AH = 0x%x\n", Regs.b.ah);
if (Regs.w.ax != 0x004F)
{
- DbgPrint((DPRINT_UI, "Failed.\n"));
+ DPRINTM(DPRINT_UI, "Failed.\n");
return 0x0000;
}
-#ifdef DEBUG
- DbgPrint((DPRINT_UI, "Supported.\n"));
- DbgPrint((DPRINT_UI, "SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]));
- DbgPrint((DPRINT_UI, "SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF)));
- DbgPrint((DPRINT_UI, "SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr));
- DbgPrint((DPRINT_UI, "SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities));
- DbgPrint((DPRINT_UI, "SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64));
- DbgPrint((DPRINT_UI, "---VBE v2.0 ---\n"));
- DbgPrint((DPRINT_UI, "SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10)));
- DbgPrint((DPRINT_UI, "SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr));
- DbgPrint((DPRINT_UI, "SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr));
- DbgPrint((DPRINT_UI, "SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr));
- DbgPrint((DPRINT_UI, "SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version));
-
- //DbgPrint((DPRINT_UI, "\nSupported VESA and OEM video modes:\n"));
+ DPRINTM(DPRINT_UI, "Supported.\n");
+ DPRINTM(DPRINT_UI, "SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]);
+ DPRINTM(DPRINT_UI, "SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF));
+ DPRINTM(DPRINT_UI, "SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr);
+ DPRINTM(DPRINT_UI, "SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities);
+ DPRINTM(DPRINT_UI, "SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64);
+ DPRINTM(DPRINT_UI, "---VBE v2.0 ---\n");
+ DPRINTM(DPRINT_UI, "SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10));
+ DPRINTM(DPRINT_UI, "SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr);
+ DPRINTM(DPRINT_UI, "SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr);
+ DPRINTM(DPRINT_UI, "SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr);
+ DPRINTM(DPRINT_UI, "SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version);
+
+ //DPRINTM(DPRINT_UI, "\nSupported VESA and OEM video modes:\n");
//VideoModes = (USHORT*)SvgaInfo->SupportedModeListPtr;
//for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
//{
- // DbgPrint((DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]));
+ // DPRINTM(DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]);
//}
//if (SvgaInfo->VesaVersion >= 0x0200)
//{
- // DbgPrint((DPRINT_UI, "\nSupported accelerated video modes (VESA v2.0):\n"));
+ // DPRINTM(DPRINT_UI, "\nSupported accelerated video modes (VESA v2.0):\n");
// VideoModes = (USHORT*)SvgaInfo->AcceleratedModeListPtr;
// for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
// {
- // DbgPrint((DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]));
+ // DPRINTM(DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]);
// }
//}
- DbgPrint((DPRINT_UI, "\n"));
- //getch();
-#endif // defined DEBUG
-
return SvgaInfo->VesaVersion;
}