Reactos

[BOOTVID] Reorganize some definitions used in the per-architecture bootvids (#8547)

In addition:
- simplify the no-op `PrepareForSetPixel()` definitions;
- const-ify immutable data arrays for the VGA PC bootvid.

+45 -66
+1 -18
drivers/base/bootvid/arm/arm.h
··· 7 7 8 8 #pragma once 9 9 10 - extern PUSHORT VgaArmBase; 11 - 12 - #define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2) 13 - #define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1) 14 - #define LCDCONTROL_LCDPWR (1 << 11) 15 - #define LCDCONTROL_LCDEN (1) 16 - #define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1) 17 - #define LCDCONTROL_LCDTFT (1 << 5) 18 - 19 - #define PL110_LCDTIMING0 (PVOID)0xE0020000 20 - #define PL110_LCDTIMING1 (PVOID)0xE0020004 21 - #define PL110_LCDTIMING2 (PVOID)0xE0020008 22 - #define PL110_LCDUPBASE (PVOID)0xE0020010 23 - #define PL110_LCDLPBASE (PVOID)0xE0020014 24 - #define PL110_LCDCONTROL (PVOID)0xE0020018 25 - 26 10 #define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r)) 27 11 #define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v)) 28 12 ··· 34 18 _In_reads_(Count) const ULONG* Table, 35 19 _In_ ULONG Count); 36 20 37 - VOID 38 - PrepareForSetPixel(VOID); 21 + #define PrepareForSetPixel() 39 22 40 23 VOID 41 24 SetPixel(
+18 -9
drivers/base/bootvid/arm/bootvid.c
··· 10 10 #define NDEBUG 11 11 #include <debug.h> 12 12 13 - PUSHORT VgaArmBase; 14 - PHYSICAL_ADDRESS VgaPhysical; 13 + /* GLOBALS ********************************************************************/ 14 + 15 + #define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2) 16 + #define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1) 17 + #define LCDCONTROL_LCDPWR (1 << 11) 18 + #define LCDCONTROL_LCDEN (1) 19 + #define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1) 20 + #define LCDCONTROL_LCDTFT (1 << 5) 21 + 22 + #define PL110_LCDTIMING0 (PVOID)0xE0020000 23 + #define PL110_LCDTIMING1 (PVOID)0xE0020004 24 + #define PL110_LCDTIMING2 (PVOID)0xE0020008 25 + #define PL110_LCDUPBASE (PVOID)0xE0020010 26 + #define PL110_LCDLPBASE (PVOID)0xE0020014 27 + #define PL110_LCDCONTROL (PVOID)0xE0020018 28 + 29 + static PUSHORT VgaArmBase; 30 + static PHYSICAL_ADDRESS VgaPhysical; 15 31 16 32 /* PRIVATE FUNCTIONS *********************************************************/ 17 33 ··· 29 45 30 46 /* Build the 16-bit color mask */ 31 47 return ((Red & 0x1F) << 11) | ((Green & 0x1F) << 6) | ((Blue & 0x1F)); 32 - } 33 - 34 - VOID 35 - PrepareForSetPixel(VOID) 36 - { 37 - /* Nothing to prepare */ 38 - NOTHING; 39 48 } 40 49 41 50 FORCEINLINE
+3 -2
drivers/base/bootvid/i386/pc/bootdata.c
··· 7 7 */ 8 8 9 9 #include "precomp.h" 10 + #include "vga.h" 10 11 11 12 // 12 13 // Minimal Attribute Controller Registers initialization command stream. 13 14 // Compatible EGA. 14 15 // 15 - USHORT AT_Initialization[] = 16 + const USHORT AT_Initialization[] = 16 17 { 17 18 /* Reset ATC to index mode */ 18 19 IB, ··· 43 44 // 640x480 256-color 60Hz mode (BIOS mode 12) set command stream for VGA. 44 45 // Adapted from win32ss/drivers/miniport/vga_new/vgadata.c 45 46 // 46 - USHORT VGA_640x480[] = 47 + const USHORT VGA_640x480[] = 47 48 { 48 49 /* Write the Sequencer Registers */ 49 50 OWM,
+4 -3
drivers/base/bootvid/i386/pc/bootvid.c
··· 12 12 13 13 static BOOLEAN 14 14 VgaInterpretCmdStream( 15 - _In_ PUSHORT CmdStream) 15 + _In_ const USHORT* CmdStream) 16 16 { 17 17 USHORT Cmd; 18 18 UCHAR Major, Minor; ··· 23 23 USHORT ShortValue; 24 24 25 25 /* First make sure that we have a Command Stream */ 26 - if (!CmdStream) return TRUE; 26 + if (!CmdStream) 27 + return TRUE; 27 28 28 29 /* Loop as long as we have commands */ 29 30 while (*CmdStream != EOD) ··· 63 64 Count = *CmdStream++; 64 65 65 66 /* Write the USHORT to the port; the buffer is what's in the command stream */ 66 - WRITE_PORT_BUFFER_USHORT((PUSHORT)(VgaRegisterBase + Port), CmdStream, Count); 67 + WRITE_PORT_BUFFER_USHORT((PUSHORT)(VgaRegisterBase + Port), (PUSHORT)CmdStream, Count); 67 68 68 69 /* Move past the buffer in the command stream */ 69 70 CmdStream += Count;
+5 -3
drivers/base/bootvid/i386/pc/pc.h
··· 7 7 8 8 #pragma once 9 9 10 + #include "vga.h" 11 + 10 12 extern ULONG_PTR VgaRegisterBase; 11 13 extern ULONG_PTR VgaBase; 12 - extern USHORT AT_Initialization[]; 13 - extern USHORT VGA_640x480[]; 14 - extern UCHAR PixelMask[8]; 14 + extern const USHORT AT_Initialization[]; 15 + extern const USHORT VGA_640x480[]; 16 + extern const UCHAR PixelMask[8]; 15 17 16 18 #define __inpb(Port) \ 17 19 READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)))
+4 -4
drivers/base/bootvid/i386/pc/vga.c
··· 12 12 13 13 /* GLOBALS *******************************************************************/ 14 14 15 - static UCHAR lMaskTable[8] = 15 + static const UCHAR lMaskTable[8] = 16 16 { 17 17 (1 << 8) - (1 << 0), 18 18 (1 << 7) - (1 << 0), ··· 23 23 (1 << 2) - (1 << 0), 24 24 (1 << 1) - (1 << 0) 25 25 }; 26 - static UCHAR rMaskTable[8] = 26 + static const UCHAR rMaskTable[8] = 27 27 { 28 28 (1 << 7), 29 29 (1 << 7) + (1 << 6), ··· 34 34 (1 << 7) + (1 << 6) + (1 << 5) + (1 << 4) + (1 << 3) + (1 << 2) + (1 << 1), 35 35 (1 << 7) + (1 << 6) + (1 << 5) + (1 << 4) + (1 << 3) + (1 << 2) + (1 << 1) + (1 << 0), 36 36 }; 37 - UCHAR PixelMask[8] = 37 + const UCHAR PixelMask[8] = 38 38 { 39 39 (1 << 7), 40 40 (1 << 6), ··· 45 45 (1 << 1), 46 46 (1 << 0), 47 47 }; 48 - static ULONG lookup[16] = 48 + static const ULONG lookup[16] = 49 49 { 50 50 0x0000, 51 51 0x0100,
+5 -8
drivers/base/bootvid/i386/pc98/bootvid.c
··· 8 8 /* INCLUDES *******************************************************************/ 9 9 10 10 #include "precomp.h" 11 + #include <drivers/pc98/video.h> 11 12 12 13 /* GLOBALS ********************************************************************/ 13 14 15 + #define BYTES_PER_SCANLINE (SCREEN_WIDTH / 8) 16 + 17 + #define PEGC_MAX_COLORS 256 18 + 14 19 static ULONG_PTR PegcControl = 0; 15 20 ULONG_PTR FrameBuffer = 0; 16 - 17 - #define PEGC_MAX_COLORS 256 18 21 19 22 /* PRIVATE FUNCTIONS **********************************************************/ 20 23 ··· 316 319 317 320 while (PixelCount--) 318 321 WRITE_REGISTER_ULONG(NewPosition++, READ_REGISTER_ULONG(OldPosition++)); 319 - } 320 - 321 - VOID 322 - PrepareForSetPixel(VOID) 323 - { 324 - NOTHING; 325 322 } 326 323 327 324 VOID
+1 -7
drivers/base/bootvid/i386/pc98/pc98.h
··· 7 7 8 8 #pragma once 9 9 10 - /* INCLUDES *******************************************************************/ 11 - 12 - #include <drivers/pc98/video.h> 13 - 14 10 /* GLOBALS ********************************************************************/ 15 11 16 - #define BYTES_PER_SCANLINE (SCREEN_WIDTH / 8) 17 12 #define FB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) 18 13 19 14 extern ULONG_PTR FrameBuffer; ··· 25 20 _In_reads_(Count) const ULONG* Table, 26 21 _In_ ULONG Count); 27 22 28 - VOID 29 - PrepareForSetPixel(VOID); 23 + #define PrepareForSetPixel() 30 24 31 25 FORCEINLINE 32 26 VOID
+3 -7
drivers/base/bootvid/i386/xbox/bootvid.c
··· 15 15 16 16 /* GLOBALS ********************************************************************/ 17 17 18 + #define BB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) 19 + #define FB_OFFSET(x, y) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel) 20 + 18 21 static ULONG_PTR FrameBufferStart = 0; 19 22 static ULONG FrameBufferWidth, FrameBufferHeight, PanH, PanV; 20 23 static UCHAR BytesPerPixel; ··· 246 249 CachedPalette[i] = *Entry | 0xFF000000; 247 250 } 248 251 ApplyPalette(); 249 - } 250 - 251 - VOID 252 - PrepareForSetPixel(VOID) 253 - { 254 - /* Nothing to prepare */ 255 - NOTHING; 256 252 } 257 253 258 254 VOID
+1 -5
drivers/base/bootvid/i386/xbox/xbox.h
··· 9 9 10 10 #pragma once 11 11 12 - #define BB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) 13 - #define FB_OFFSET(x, y) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel) 14 - 15 12 VOID 16 13 InitPaletteWithTable( 17 14 _In_reads_(Count) const ULONG* Table, 18 15 _In_ ULONG Count); 19 16 20 - VOID 21 - PrepareForSetPixel(VOID); 17 + #define PrepareForSetPixel() 22 18 23 19 VOID 24 20 SetPixel(