diff --git a/DasharoPayloadPkg/DasharoColorTheme.dsc.inc b/DasharoPayloadPkg/DasharoColorTheme.dsc.inc new file mode 100644 index 0000000000..23392a75ed --- /dev/null +++ b/DasharoPayloadPkg/DasharoColorTheme.dsc.inc @@ -0,0 +1,76 @@ +# Color codes defined at MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +# Foregrounds: +# 0x00 (EFI_BLACK) +# 0x01 (EFI_BLUE) +# 0x02 (EFI_GREEN) +# 0x03 (EFI_CYAN) +# 0x04 (EFI_RED) +# 0x05 (EFI_MAGENTA) +# 0x06 (EFI_BROWN) +# 0x07 (EFI_LIGHTGRAY) +# 0x08 (EFI_DARKGRAY) +# 0x09 (EFI_LIGHTBLUE) +# 0x0A (EFI_LIGHTGREEN) +# 0x0B (EFI_LIGHTCYAN) +# 0x0C (EFI_LIGHTRED) +# 0x0D (EFI_LIGHTMAGENTA) +# 0x0E (EFI_YELLOW) +# 0x0F (EFI_WHITE) +# +# Backgrounds: +# 0x00 (EFI_BACKGROUND_BLACK) +# 0x10 (EFI_BACKGROUND_BLUE) +# 0x20 (EFI_BACKGROUND_GREEN) +# 0x30 (EFI_BACKGROUND_CYAN) +# 0x40 (EFI_BACKGROUND_RED) +# 0x50 (EFI_BACKGROUND_MAGENTA) +# 0x60 (EFI_BACKGROUND_BROWN) +# 0x70 (EFI_BACKGROUND_LIGHTGRAY) +# +# Because the background color in EDK2 does not support the bright bit, only +# colors 0-7 are available for backgrounds. To use colors like WHITE, some of +# the colors 0-7 need to be remapped to RGB value of white. + +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextHighlightColor|0x0F # White text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserTitleBackgroundColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserTitleTextColor|0x0F # White text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupBackgroundColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupTextColor|0x0F # White text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupInverseTextColor|0x06 # Grey text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupInverseBackgroundColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserHelpTextColor|0x07 # Light grey text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserHelpBackgroundColor|0x30 # White bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserInfoTextColor|0x06 # Grey text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserInfoBackgroundColor|0x30 # White bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextColor|0x06 # Grey text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundColor|0x30 # White bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor|0x02 # Green text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserBannerBackgroundColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserBannerTextColor|0x0F # White text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserKeyHelpTextColor|0x02 # Green text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserKeyHelpBackgroundColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPickListTextColor|0x06 # Grey text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPickListBackgroundColor|0x30 # White bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserArrowTextColor|0x0F # White text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserArrowBackgroundColor|0x60 # Grey bg +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldGrayedTestColor|0x07 # Light grey text +gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserErrorTextColor|0x0C # Bright Red text + +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlack | { 0x00, 0x00, 0x00, 0x00 } # 0 Plain black +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlue | { 0x00, 0x00, 0x00, 0x98 } # 1 Dark green +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteGreen | { 0x00, 0x38, 0xD4, 0x30 } # 2 Dasharo green +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteCyan | { 0x00, 0xFF, 0xFF, 0xFF } # 3 cyan remapped to White for backgrounds +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteRed | { 0x00, 0x98, 0x00, 0x00 } # 4 Red +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightMagenta | { 0x00, 0x98, 0x00, 0x98 } # 5 Magenta +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBrown | { 0x00, 0x29, 0x36, 0x3b } # 6 Dasharo grey +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGray | { 0x00, 0x80, 0x80, 0x80 } # 7 Light grey + +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteDarkGray | { 0x00, 0x30, 0x30, 0x30 } # 8 Dark grey +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightBlue | { 0x00, 0x00, 0x00, 0xFF } # 9 Blue +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGreen | { 0x00, 0x00, 0xFF, 0x00 } # A Green +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightCyan | { 0x00, 0xFF, 0xFF, 0x00 } # B Cyan +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightRed | { 0x00, 0xFF, 0x00, 0x00 } # C Red +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteMagenta | { 0x00, 0xFF, 0x00, 0xFF } # D Fuchsia +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteYellow | { 0x00, 0xFF, 0xFF, 0x00 } # E Yellow +gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteWhite | { 0x00, 0xFF, 0xFF, 0xFF } # F White diff --git a/DasharoPayloadPkg/DasharoPayloadPkg.dsc b/DasharoPayloadPkg/DasharoPayloadPkg.dsc index c57028e111..202903f261 100644 --- a/DasharoPayloadPkg/DasharoPayloadPkg.dsc +++ b/DasharoPayloadPkg/DasharoPayloadPkg.dsc @@ -694,6 +694,8 @@ OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrd gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000 !endif +!include DasharoPayloadPkg/DasharoColorTheme.dsc.inc + [PcdsDynamicHii] !if $(TPM_ENABLE) == TRUE gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/Colors.h b/MdeModulePkg/Library/CustomizedDisplayLib/Colors.h index 487c6d4f2d..340b07b96d 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/Colors.h +++ b/MdeModulePkg/Library/CustomizedDisplayLib/Colors.h @@ -14,25 +14,30 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // Screen Color Settings // -#define PICKLIST_HIGHLIGHT_TEXT EFI_WHITE -#define PICKLIST_HIGHLIGHT_BACKGROUND EFI_BACKGROUND_CYAN -#define TITLE_TEXT EFI_WHITE -#define TITLE_BACKGROUND EFI_BACKGROUND_BLUE -#define KEYHELP_TEXT EFI_LIGHTGRAY -#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK -#define SUBTITLE_BACKGROUND EFI_BACKGROUND_LIGHTGRAY -#define BANNER_TEXT EFI_BLUE -#define BANNER_BACKGROUND EFI_BACKGROUND_LIGHTGRAY -#define FIELD_TEXT_GRAYED EFI_DARKGRAY -#define FIELD_BACKGROUND EFI_BACKGROUND_LIGHTGRAY -#define POPUP_TEXT EFI_LIGHTGRAY -#define POPUP_BACKGROUND EFI_BACKGROUND_BLUE -#define POPUP_INVERSE_TEXT EFI_LIGHTGRAY -#define POPUP_INVERSE_BACKGROUND EFI_BACKGROUND_BLACK -#define HELP_TEXT EFI_BLUE -#define ERROR_TEXT EFI_RED | EFI_BRIGHT -#define INFO_TEXT EFI_YELLOW | EFI_BRIGHT -#define ARROW_TEXT EFI_RED | EFI_BRIGHT -#define ARROW_BACKGROUND EFI_BACKGROUND_LIGHTGRAY +#define PICKLIST_HIGHLIGHT_TEXT PcdGet8 (PcdBrowserPickListTextColor) +#define PICKLIST_HIGHLIGHT_BACKGROUND PcdGet8 (PcdBrowserPickListBackgroundColor) +#define TITLE_TEXT PcdGet8 (PcdBrowserTitleTextColor) +#define TITLE_BACKGROUND PcdGet8 (PcdBrowserTitleBackgroundColor) +#define KEYHELP_TEXT PcdGet8 (PcdBrowserKeyHelpTextColor) +#define KEYHELP_BACKGROUND PcdGet8 (PcdBrowserKeyHelpBackgroundColor) +#define SUBTITLE_TEXT PcdGet8 (PcdBrowserSubtitleTextColor) +#define BANNER_TEXT PcdGet8 (PcdBrowserBannerTextColor) +#define BANNER_BACKGROUND PcdGet8 (PcdBrowserBannerBackgroundColor) +#define FIELD_TEXT PcdGet8 (PcdBrowserFieldTextColor) +#define FIELD_TEXT_GRAYED PcdGet8 (PcdBrowserFieldGrayedTextColor) +#define FIELD_BACKGROUND PcdGet8 (PcdBrowserFieldBackgroundColor) +#define FIELD_TEXT_HIGHLIGHT PcdGet8 (PcdBrowserFieldTextHighlightColor) +#define FIELD_BACKGROUND_HIGHLIGHT PcdGet8 (PcdBrowserFieldBackgroundHighlightColor) +#define POPUP_TEXT PcdGet8 (PcdBrowserPopupTextColor) +#define POPUP_BACKGROUND PcdGet8 (PcdBrowserPopupBackgroundColor) +#define POPUP_INVERSE_TEXT PcdGet8 (PcdBrowserPopupInverseTextColor) +#define POPUP_INVERSE_BACKGROUND PcdGet8 (PcdBrowserPopupInverseBackgroundColor) +#define HELP_TEXT PcdGet8 (PcdBrowserHelpTextColor) +#define HELP_BACKGROUND PcdGet8 (PcdBrowserHelpBackgroundColor) +#define ERROR_TEXT PcdGet8 (PcdBrowserErrorTextColor) +#define INFO_TEXT PcdGet8 (PcdBrowserInfoTextColor) +#define INFO_BACKGROUND PcdGet8 (PcdBrowserInfoBackgroundColor) +#define ARROW_TEXT PcdGet8 (PcdBrowserArrowTextColor) +#define ARROW_BACKGROUND PcdGet8 (PcdBrowserArrowBackgroundColor) #endif diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c index 8c984b5025..4ce43efb46 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c @@ -534,7 +534,7 @@ CreateDialog ( // // Passing in a space results in the assumption that this is where typing will occur // - ClearLines (Start + 1, End - 1, Index + 1, Index + 1, POPUP_INVERSE_TEXT | POPUP_INVERSE_BACKGROUND); + ClearLines (Start + 1, End - 1, Index + 1, Index + 1, GetPopupInverseColor()); PrintStringAt ( ((DimensionsWidth - LibGetStringWidth (String) / 2) / 2) + gScreenDimensions.LeftColumn + 1, Index + 1, @@ -854,7 +854,7 @@ GetInfoTextColor ( VOID ) { - return INFO_TEXT | FIELD_BACKGROUND; + return INFO_TEXT | INFO_BACKGROUND; } /** @@ -868,7 +868,7 @@ GetHelpTextColor ( VOID ) { - return HELP_TEXT | FIELD_BACKGROUND; + return HELP_TEXT | HELP_BACKGROUND; } /** @@ -896,7 +896,7 @@ GetHighlightTextColor ( VOID ) { - return PcdGet8 (PcdBrowserFieldTextHighlightColor) | PcdGet8 (PcdBrowserFieldBackgroundHighlightColor); + return FIELD_TEXT_HIGHLIGHT | FIELD_BACKGROUND_HIGHLIGHT; } /** @@ -910,7 +910,7 @@ GetFieldTextColor ( VOID ) { - return PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND; + return FIELD_TEXT | FIELD_BACKGROUND; } /** @@ -924,7 +924,7 @@ GetSubTitleTextColor ( VOID ) { - return PcdGet8 (PcdBrowserSubtitleTextColor) | FIELD_BACKGROUND; + return SUBTITLE_TEXT | FIELD_BACKGROUND; } /** diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf index 45fbdaf864..07d6450af0 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf @@ -55,6 +55,27 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundColor ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldTextHighlightColor ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFrontPageFormSetGuid ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserTitleBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserTitleTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupInverseTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupInverseBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserHelpTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserHelpBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserInfoTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserInfoBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserBannerTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserBannerBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserKeyHelpTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserKeyHelpBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPickListTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPickListBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserArrowTextColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserArrowBackgroundColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldGrayedTestColor ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserErrorTextColor ## CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 66e46184c7..c35bd95c48 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2001,6 +2001,48 @@ # @ValidList 0x80000005 | 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70 gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundHighlightColor|0x00|UINT8|0x0001005A + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserTitleBackgroundColor|0x10|UINT8|0x00010300 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserTitleTextColor|0x07|UINT8|0x00010301 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupBackgroundColor|0x10|UINT8|0x00010302 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupTextColor|0x07|UINT8|0x00010303 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupInverseBackgroundColor|0x00|UINT8|0x00010304 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPopupInverseTextColor|0x07|UINT8|0x00010305 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserHelpTextColor|0x01|UINT8|0x00010306 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserHelpBackgroundColor|0x70|UINT8|0x00010307 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserInfoTextColor|0x0F|UINT8|0x00010308 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserInfoBackgroundColor|0x70|UINT8|0x00010309 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldBackgroundColor|0x70|UINT8|0x0001030A + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserBannerBackgroundColor|0x70|UINT8|0x0001030B + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserBannerTextColor|0x01|UINT8|0x0001030C + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserKeyHelpTextColor|0x00|UINT8|0x0001030D + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserKeyHelpBackgroundColor|0x07|UINT8|0x0001030E + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPickListTextColor|0x0F|UINT8|0x0001030F + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserPickListBackgroundColor|0x30|UINT8|0x00010310 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserArrowTextColor|0x0C|UINT8|0x00010311 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserArrowBackgroundColor|0x70|UINT8|0x00010312 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserFieldGrayedTestColor|0x70|UINT8|0x00010313 + gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserErrorTextColor|0x0C|UINT8|0x00010314 + + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlack | { 0x00, 0x00, 0x00, 0x00 } | VOID* | 0x00010400 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlue | { 0x00, 0x00, 0x00, 0x98 } | VOID* | 0x00010401 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteGreen | { 0x00, 0x00, 0x98, 0x00 } | VOID* | 0x00010402 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteCyan | { 0x00, 0x00, 0x98, 0x98 } | VOID* | 0x00010403 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteRed | { 0x00, 0x98, 0x00, 0x00 } | VOID* | 0x00010404 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightMagenta | { 0x00, 0x98, 0x00, 0x98 } | VOID* | 0x00010405 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBrown | { 0x00, 0x98, 0x98, 0x00 } | VOID* | 0x00010406 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGray | { 0x00, 0x98, 0x98, 0x98 } | VOID* | 0x00010407 + + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteDarkGray | { 0x00, 0x30, 0x30, 0x30 } | VOID* | 0x00010408 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightBlue | { 0x00, 0x00, 0x00, 0xFF } | VOID* | 0x00010409 + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGreen | { 0x00, 0x00, 0xFF, 0x00 } | VOID* | 0x0001040A + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightCyan | { 0x00, 0xFF, 0xFF, 0x00 } | VOID* | 0x0001040B + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightRed | { 0x00, 0xFF, 0x00, 0x00 } | VOID* | 0x0001040C + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteMagenta | { 0x00, 0xFF, 0x00, 0xFF } | VOID* | 0x0001040D + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteYellow | { 0x00, 0xFF, 0xFF, 0x00 } | VOID* | 0x0001040E + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteWhite | { 0x00, 0xFF, 0xFF, 0xFF } | VOID* | 0x0001040F + + + ## Time in second to delay for SATA devices to spin-up for recovery. # @Prompt SATA spin-up delay time in second for recovery path. gEfiMdeModulePkgTokenSpaceGuid.PcdSataSpinUpDelayInSecForRecoveryPath|15|UINT16|0x0001005B diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index b895dafede..7ea54cfe42 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -60,29 +60,53 @@ EFI_GUID mFontPackageListGuid = { 0xf5f219d3, 0x7006, 0x4648, { 0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad } }; + CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL }; -EFI_GRAPHICS_OUTPUT_BLT_PIXEL mGraphicsEfiColors[16] = { - // - // B G R reserved - // - { 0x00, 0x00, 0x00, 0x00 }, // BLACK - { 0x98, 0x00, 0x00, 0x00 }, // LIGHTBLUE - { 0x00, 0x98, 0x00, 0x00 }, // LIGHGREEN - { 0x98, 0x98, 0x00, 0x00 }, // LIGHCYAN - { 0x00, 0x00, 0x98, 0x00 }, // LIGHRED - { 0x98, 0x00, 0x98, 0x00 }, // MAGENTA - { 0x00, 0x98, 0x98, 0x00 }, // BROWN - { 0x98, 0x98, 0x98, 0x00 }, // LIGHTGRAY - { 0x30, 0x30, 0x30, 0x00 }, // DARKGRAY - BRIGHT BLACK - { 0xff, 0x00, 0x00, 0x00 }, // BLUE - { 0x00, 0xff, 0x00, 0x00 }, // LIME - { 0xff, 0xff, 0x00, 0x00 }, // CYAN - { 0x00, 0x00, 0xff, 0x00 }, // RED - { 0xff, 0x00, 0xff, 0x00 }, // FUCHSIA - { 0x00, 0xff, 0xff, 0x00 }, // YELLOW - { 0xff, 0xff, 0xff, 0x00 } // WHITE -}; +EFI_GRAPHICS_OUTPUT_BLT_PIXEL mGraphicsEfiColors[16]; + +/** + test + @param dest Protocol instance pointer. + @param source Handle of device to test. +**/ +VOID +CopyGraphicsPaletteColor( + OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL* dest, + IN VOID* source +) { + dest->Reserved = ((UINT8*)source)[0]; + dest->Red = ((UINT8*)source)[1]; + dest->Green = ((UINT8*)source)[2]; + dest->Blue = ((UINT8*)source)[3]; +} + +/** + test +**/ +VOID +InitGraphicsColors ( + VOID + ) +{ + CopyGraphicsPaletteColor(&mGraphicsEfiColors[0], PcdGetPtr(PcdGraphicsConsoleColorPaletteBlack)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[1], PcdGetPtr(PcdGraphicsConsoleColorPaletteBlue)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[2], PcdGetPtr(PcdGraphicsConsoleColorPaletteGreen)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[3], PcdGetPtr(PcdGraphicsConsoleColorPaletteCyan)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[4], PcdGetPtr(PcdGraphicsConsoleColorPaletteRed)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[5], PcdGetPtr(PcdGraphicsConsoleColorPaletteLightMagenta)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[6], PcdGetPtr(PcdGraphicsConsoleColorPaletteBrown)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[7], PcdGetPtr(PcdGraphicsConsoleColorPaletteLightGray)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[8], PcdGetPtr(PcdGraphicsConsoleColorPaletteDarkGray)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[9], PcdGetPtr(PcdGraphicsConsoleColorPaletteLightBlue)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[10], PcdGetPtr(PcdGraphicsConsoleColorPaletteLightGreen)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[11], PcdGetPtr(PcdGraphicsConsoleColorPaletteLightCyan)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[12], PcdGetPtr(PcdGraphicsConsoleColorPaletteLightRed)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[13], PcdGetPtr(PcdGraphicsConsoleColorPaletteMagenta)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[14], PcdGetPtr(PcdGraphicsConsoleColorPaletteYellow)); + CopyGraphicsPaletteColor(&mGraphicsEfiColors[15], PcdGetPtr(PcdGraphicsConsoleColorPaletteWhite)); +} + EFI_NARROW_GLYPH mCursorGlyph = { 0x0000, @@ -365,6 +389,8 @@ InitializeGraphicsConsoleTextMode ( // *TextModeCount = ValidCount; *TextModeData = NewModeBuffer; + + InitGraphicsColors(); return EFI_SUCCESS; } diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf index bcfd306eee..b379d1a265 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf @@ -68,5 +68,23 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlack ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlue ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteGreen ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteCyan ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteRed ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightMagenta ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBrown ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGray ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteDarkGray ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightBlue ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGreen ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightCyan ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightRed ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteMagenta ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteYellow ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteWhite ## CONSUMES + + [UserExtensions.TianoCore."ExtraFiles"] GraphicsConsoleDxeExtra.uni diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index adb14a7568..1251b6c925 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -327,6 +327,8 @@ InitializeTerminalConsoleTextMode ( *TextModeCount = ARRAY_SIZE (mTerminalConsoleModeData); + InitSerialColors(); + DEBUG_CODE_BEGIN (); INT32 Index; @@ -1409,3 +1411,33 @@ IsHotPlugDevice ( return FALSE; } + +TerminalEfiColor mTerminalEfiColors[16]; + +VOID CopyTerminalPaletteColor(IN UINT8* Src, OUT TerminalEfiColor* Dest) { + Dest->r = Src[1]; + Dest->g = Src[2]; + Dest->b = Src[3]; + //target->a = color[0]; +} + +VOID +InitSerialColors (VOID) +{ + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteBlack), &mTerminalEfiColors[0]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteBlue), &mTerminalEfiColors[1]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteGreen), &mTerminalEfiColors[2]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteCyan), &mTerminalEfiColors[3]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteRed), &mTerminalEfiColors[4]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteLightMagenta), &mTerminalEfiColors[5]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteBrown), &mTerminalEfiColors[6]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteLightGray), &mTerminalEfiColors[7]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteDarkGray), &mTerminalEfiColors[8]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteLightBlue), &mTerminalEfiColors[9]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteLightGreen), &mTerminalEfiColors[10]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteLightCyan), &mTerminalEfiColors[11]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteLightRed), &mTerminalEfiColors[12]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteMagenta), &mTerminalEfiColors[13]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteYellow), &mTerminalEfiColors[14]); + CopyTerminalPaletteColor((UINT8*)PcdGetPtr(PcdGraphicsConsoleColorPaletteWhite), &mTerminalEfiColors[15]); +} diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 61fbd808ae..ea283ef008 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -169,12 +169,21 @@ typedef struct { CHAR8 Ascii; } UNICODE_TO_CHAR; +typedef struct { + UINT8 r; + UINT8 g; + UINT8 b; +} TerminalEfiColor; +VOID CopyTerminalPaletteColor(IN UINT8* Src, OUT TerminalEfiColor* Dest); +VOID InitSerialColors (VOID); + // // Global Variables // extern EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gTerminalComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gTerminalComponentName2; +extern TerminalEfiColor mTerminalEfiColors[16]; /** The user Entry Point for module Terminal. The user code starts with this function. diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c index 7809869e7d..48c79adb0b 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c @@ -8,6 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "Terminal.h" +#include // // This list is used to define the valid extend chars. @@ -74,7 +75,6 @@ UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = { }; CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 }; -CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 }; CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 }; CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 }; CHAR16 mCursorForwardString[] = { ESC, '[', '0', '0', 'C', 0 }; @@ -527,13 +527,12 @@ TerminalConOutSetAttribute ( IN UINTN Attribute ) { - UINT8 ForegroundControl; - UINT8 BackgroundControl; - UINT8 BrightControl; - INT32 SavedColumn; - INT32 SavedRow; - EFI_STATUS Status; - TERMINAL_DEV *TerminalDevice; + TerminalEfiColor ForegroundControl; + TerminalEfiColor BackgroundControl; + INT32 SavedColumn; + INT32 SavedRow; + EFI_STATUS Status; + TERMINAL_DEV *TerminalDevice; SavedColumn = 0; SavedRow = 0; @@ -562,96 +561,17 @@ TerminalConOutSetAttribute ( // convert Attribute value to terminal emulator // understandable foreground color // - switch (Attribute & 0x07) { - case EFI_BLACK: - ForegroundControl = 30; - break; - - case EFI_BLUE: - ForegroundControl = 34; - break; - - case EFI_GREEN: - ForegroundControl = 32; - break; - - case EFI_CYAN: - ForegroundControl = 36; - break; - - case EFI_RED: - ForegroundControl = 31; - break; - - case EFI_MAGENTA: - ForegroundControl = 35; - break; - - case EFI_BROWN: - ForegroundControl = 33; - break; - - default: - - case EFI_LIGHTGRAY: - ForegroundControl = 37; - break; - } - - // - // bit4 of the Attribute indicates bright control - // of terminal emulator. - // - BrightControl = (UINT8)((Attribute >> 3) & 1); - - // - // convert Attribute value to terminal emulator - // understandable background color. - // - switch ((Attribute >> 4) & 0x07) { - case EFI_BLACK: - BackgroundControl = 40; - break; - - case EFI_BLUE: - BackgroundControl = 44; - break; - - case EFI_GREEN: - BackgroundControl = 42; - break; - - case EFI_CYAN: - BackgroundControl = 46; - break; - - case EFI_RED: - BackgroundControl = 41; - break; - - case EFI_MAGENTA: - BackgroundControl = 45; - break; - - case EFI_BROWN: - BackgroundControl = 43; - break; - - default: - - case EFI_LIGHTGRAY: - BackgroundControl = 47; - break; - } + ForegroundControl = mTerminalEfiColors[Attribute & 0x0F]; + BackgroundControl = mTerminalEfiColors[(Attribute >> 4) & 0x07]; // // terminal emulator's control sequence to set attributes // - mSetAttributeString[BRIGHT_CONTROL_OFFSET] = (CHAR16)('0' + BrightControl); - mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 0] = (CHAR16)('0' + (ForegroundControl / 10)); - mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 1] = (CHAR16)('0' + (ForegroundControl % 10)); - mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 0] = (CHAR16)('0' + (BackgroundControl / 10)); - mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 1] = (CHAR16)('0' + (BackgroundControl % 10)); + CHAR16 mSetTerminalColorString[64]; + UnicodeSPrint(mSetTerminalColorString, sizeof(mSetTerminalColorString), + L"%c[38;2;%u;%u;%um%c[48;2;%u;%u;%um", + ESC, ForegroundControl.r, ForegroundControl.g, ForegroundControl.b, + ESC, BackgroundControl.r, BackgroundControl.g, BackgroundControl.b); // // save current column and row @@ -661,7 +581,7 @@ TerminalConOutSetAttribute ( SavedRow = This->Mode->CursorRow; TerminalDevice->OutputEscChar = TRUE; - Status = This->OutputString (This, mSetAttributeString); + Status = This->OutputString (This, mSetTerminalColorString); TerminalDevice->OutputEscChar = FALSE; if (EFI_ERROR (Status)) { diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf index fe7fce636f..1cbb45d3da 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf @@ -56,6 +56,7 @@ DebugLib PcdLib BaseLib + PrintLib [Guids] ## SOMETIMES_PRODUCES ## Variable:L"ConInDev" @@ -88,6 +89,23 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlack ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBlue ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteGreen ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteCyan ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteRed ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightMagenta ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteBrown ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGray ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteDarkGray ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightBlue ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightGreen ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightCyan ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteLightRed ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteMagenta ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteYellow ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdGraphicsConsoleColorPaletteWhite ## CONSUMES + # [Event] # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds input timeout.