diff --git a/drivers/base/bootvid/arm/arm.h b/drivers/base/bootvid/arm/arm.h index 621f77bd6cf..678936a519f 100644 --- a/drivers/base/bootvid/arm/arm.h +++ b/drivers/base/bootvid/arm/arm.h @@ -7,22 +7,6 @@ #pragma once -extern PUSHORT VgaArmBase; - -#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2) -#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1) -#define LCDCONTROL_LCDPWR (1 << 11) -#define LCDCONTROL_LCDEN (1) -#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1) -#define LCDCONTROL_LCDTFT (1 << 5) - -#define PL110_LCDTIMING0 (PVOID)0xE0020000 -#define PL110_LCDTIMING1 (PVOID)0xE0020004 -#define PL110_LCDTIMING2 (PVOID)0xE0020008 -#define PL110_LCDUPBASE (PVOID)0xE0020010 -#define PL110_LCDLPBASE (PVOID)0xE0020014 -#define PL110_LCDCONTROL (PVOID)0xE0020018 - #define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r)) #define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v)) @@ -34,8 +18,7 @@ InitPaletteWithTable( _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); -VOID -PrepareForSetPixel(VOID); +#define PrepareForSetPixel() VOID SetPixel( diff --git a/drivers/base/bootvid/arm/bootvid.c b/drivers/base/bootvid/arm/bootvid.c index 178696e9fe7..2d2cbd0c5d8 100644 --- a/drivers/base/bootvid/arm/bootvid.c +++ b/drivers/base/bootvid/arm/bootvid.c @@ -10,8 +10,24 @@ #define NDEBUG #include -PUSHORT VgaArmBase; -PHYSICAL_ADDRESS VgaPhysical; +/* GLOBALS ********************************************************************/ + +#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2) +#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1) +#define LCDCONTROL_LCDPWR (1 << 11) +#define LCDCONTROL_LCDEN (1) +#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1) +#define LCDCONTROL_LCDTFT (1 << 5) + +#define PL110_LCDTIMING0 (PVOID)0xE0020000 +#define PL110_LCDTIMING1 (PVOID)0xE0020004 +#define PL110_LCDTIMING2 (PVOID)0xE0020008 +#define PL110_LCDUPBASE (PVOID)0xE0020010 +#define PL110_LCDLPBASE (PVOID)0xE0020014 +#define PL110_LCDCONTROL (PVOID)0xE0020018 + +static PUSHORT VgaArmBase; +static PHYSICAL_ADDRESS VgaPhysical; /* PRIVATE FUNCTIONS *********************************************************/ @@ -31,13 +47,6 @@ VidpBuildColor( return ((Red & 0x1F) << 11) | ((Green & 0x1F) << 6) | ((Blue & 0x1F)); } -VOID -PrepareForSetPixel(VOID) -{ - /* Nothing to prepare */ - NOTHING; -} - FORCEINLINE VOID SetPixel( diff --git a/drivers/base/bootvid/i386/pc/bootdata.c b/drivers/base/bootvid/i386/pc/bootdata.c index 8ab4a05235d..057b63ddadd 100644 --- a/drivers/base/bootvid/i386/pc/bootdata.c +++ b/drivers/base/bootvid/i386/pc/bootdata.c @@ -7,12 +7,13 @@ */ #include "precomp.h" +#include "vga.h" // // Minimal Attribute Controller Registers initialization command stream. // Compatible EGA. // -USHORT AT_Initialization[] = +const USHORT AT_Initialization[] = { /* Reset ATC to index mode */ IB, @@ -43,7 +44,7 @@ USHORT AT_Initialization[] = // 640x480 256-color 60Hz mode (BIOS mode 12) set command stream for VGA. // Adapted from win32ss/drivers/miniport/vga_new/vgadata.c // -USHORT VGA_640x480[] = +const USHORT VGA_640x480[] = { /* Write the Sequencer Registers */ OWM, diff --git a/drivers/base/bootvid/i386/pc/bootvid.c b/drivers/base/bootvid/i386/pc/bootvid.c index aab53ee3308..01972eaaec6 100644 --- a/drivers/base/bootvid/i386/pc/bootvid.c +++ b/drivers/base/bootvid/i386/pc/bootvid.c @@ -12,7 +12,7 @@ static BOOLEAN VgaInterpretCmdStream( - _In_ PUSHORT CmdStream) + _In_ const USHORT* CmdStream) { USHORT Cmd; UCHAR Major, Minor; @@ -23,7 +23,8 @@ VgaInterpretCmdStream( USHORT ShortValue; /* First make sure that we have a Command Stream */ - if (!CmdStream) return TRUE; + if (!CmdStream) + return TRUE; /* Loop as long as we have commands */ while (*CmdStream != EOD) @@ -63,7 +64,7 @@ VgaInterpretCmdStream( Count = *CmdStream++; /* Write the USHORT to the port; the buffer is what's in the command stream */ - WRITE_PORT_BUFFER_USHORT((PUSHORT)(VgaRegisterBase + Port), CmdStream, Count); + WRITE_PORT_BUFFER_USHORT((PUSHORT)(VgaRegisterBase + Port), (PUSHORT)CmdStream, Count); /* Move past the buffer in the command stream */ CmdStream += Count; diff --git a/drivers/base/bootvid/i386/pc/pc.h b/drivers/base/bootvid/i386/pc/pc.h index 0576511eb24..9858be4308f 100644 --- a/drivers/base/bootvid/i386/pc/pc.h +++ b/drivers/base/bootvid/i386/pc/pc.h @@ -7,11 +7,13 @@ #pragma once +#include "vga.h" + extern ULONG_PTR VgaRegisterBase; extern ULONG_PTR VgaBase; -extern USHORT AT_Initialization[]; -extern USHORT VGA_640x480[]; -extern UCHAR PixelMask[8]; +extern const USHORT AT_Initialization[]; +extern const USHORT VGA_640x480[]; +extern const UCHAR PixelMask[8]; #define __inpb(Port) \ READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port))) diff --git a/drivers/base/bootvid/i386/pc/vga.c b/drivers/base/bootvid/i386/pc/vga.c index 658870d7443..25102a94869 100644 --- a/drivers/base/bootvid/i386/pc/vga.c +++ b/drivers/base/bootvid/i386/pc/vga.c @@ -12,7 +12,7 @@ /* GLOBALS *******************************************************************/ -static UCHAR lMaskTable[8] = +static const UCHAR lMaskTable[8] = { (1 << 8) - (1 << 0), (1 << 7) - (1 << 0), @@ -23,7 +23,7 @@ static UCHAR lMaskTable[8] = (1 << 2) - (1 << 0), (1 << 1) - (1 << 0) }; -static UCHAR rMaskTable[8] = +static const UCHAR rMaskTable[8] = { (1 << 7), (1 << 7) + (1 << 6), @@ -34,7 +34,7 @@ static UCHAR rMaskTable[8] = (1 << 7) + (1 << 6) + (1 << 5) + (1 << 4) + (1 << 3) + (1 << 2) + (1 << 1), (1 << 7) + (1 << 6) + (1 << 5) + (1 << 4) + (1 << 3) + (1 << 2) + (1 << 1) + (1 << 0), }; -UCHAR PixelMask[8] = +const UCHAR PixelMask[8] = { (1 << 7), (1 << 6), @@ -45,7 +45,7 @@ UCHAR PixelMask[8] = (1 << 1), (1 << 0), }; -static ULONG lookup[16] = +static const ULONG lookup[16] = { 0x0000, 0x0100, diff --git a/drivers/base/bootvid/i386/pc98/bootvid.c b/drivers/base/bootvid/i386/pc98/bootvid.c index 68f6c9fb419..edc8ce67d1d 100644 --- a/drivers/base/bootvid/i386/pc98/bootvid.c +++ b/drivers/base/bootvid/i386/pc98/bootvid.c @@ -8,14 +8,17 @@ /* INCLUDES *******************************************************************/ #include "precomp.h" +#include /* GLOBALS ********************************************************************/ -static ULONG_PTR PegcControl = 0; -ULONG_PTR FrameBuffer = 0; +#define BYTES_PER_SCANLINE (SCREEN_WIDTH / 8) #define PEGC_MAX_COLORS 256 +static ULONG_PTR PegcControl = 0; +ULONG_PTR FrameBuffer = 0; + /* PRIVATE FUNCTIONS **********************************************************/ static BOOLEAN @@ -318,12 +321,6 @@ PreserveRow( WRITE_REGISTER_ULONG(NewPosition++, READ_REGISTER_ULONG(OldPosition++)); } -VOID -PrepareForSetPixel(VOID) -{ - NOTHING; -} - VOID DoScroll( _In_ ULONG Scroll) diff --git a/drivers/base/bootvid/i386/pc98/pc98.h b/drivers/base/bootvid/i386/pc98/pc98.h index a4091cdd2cc..77edc1cbb7e 100644 --- a/drivers/base/bootvid/i386/pc98/pc98.h +++ b/drivers/base/bootvid/i386/pc98/pc98.h @@ -7,13 +7,8 @@ #pragma once -/* INCLUDES *******************************************************************/ - -#include - /* GLOBALS ********************************************************************/ -#define BYTES_PER_SCANLINE (SCREEN_WIDTH / 8) #define FB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) extern ULONG_PTR FrameBuffer; @@ -25,8 +20,7 @@ InitPaletteWithTable( _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); -VOID -PrepareForSetPixel(VOID); +#define PrepareForSetPixel() FORCEINLINE VOID diff --git a/drivers/base/bootvid/i386/xbox/bootvid.c b/drivers/base/bootvid/i386/xbox/bootvid.c index 089c7d0fec1..105959f5945 100644 --- a/drivers/base/bootvid/i386/xbox/bootvid.c +++ b/drivers/base/bootvid/i386/xbox/bootvid.c @@ -15,6 +15,9 @@ /* GLOBALS ********************************************************************/ +#define BB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) +#define FB_OFFSET(x, y) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel) + static ULONG_PTR FrameBufferStart = 0; static ULONG FrameBufferWidth, FrameBufferHeight, PanH, PanV; static UCHAR BytesPerPixel; @@ -248,13 +251,6 @@ InitPaletteWithTable( ApplyPalette(); } -VOID -PrepareForSetPixel(VOID) -{ - /* Nothing to prepare */ - NOTHING; -} - VOID SetPixel( _In_ ULONG Left, diff --git a/drivers/base/bootvid/i386/xbox/xbox.h b/drivers/base/bootvid/i386/xbox/xbox.h index f2dcc282acc..ba2a1523621 100644 --- a/drivers/base/bootvid/i386/xbox/xbox.h +++ b/drivers/base/bootvid/i386/xbox/xbox.h @@ -9,16 +9,12 @@ #pragma once -#define BB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) -#define FB_OFFSET(x, y) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel) - VOID InitPaletteWithTable( _In_reads_(Count) const ULONG* Table, _In_ ULONG Count); -VOID -PrepareForSetPixel(VOID); +#define PrepareForSetPixel() VOID SetPixel(