diff --git a/DasharoPayloadPkg/DasharoColorTheme.dsc.inc b/DasharoPayloadPkg/DasharoColorTheme.dsc.inc new file mode 100644 index 0000000000..5043c1042e --- /dev/null +++ b/DasharoPayloadPkg/DasharoColorTheme.dsc.inc @@ -0,0 +1,75 @@ +# 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.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 \ No newline at end of file diff --git a/DasharoPayloadPkg/DasharoPayloadPkg.dsc b/DasharoPayloadPkg/DasharoPayloadPkg.dsc index 87650bd0c7..6e2f12a632 100644 --- a/DasharoPayloadPkg/DasharoPayloadPkg.dsc +++ b/DasharoPayloadPkg/DasharoPayloadPkg.dsc @@ -680,6 +680,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/Include/Library/CustomizedDisplayLib.h b/MdeModulePkg/Include/Library/CustomizedDisplayLib.h index 1441bf6c10..d1dea1976a 100644 --- a/MdeModulePkg/Include/Library/CustomizedDisplayLib.h +++ b/MdeModulePkg/Include/Library/CustomizedDisplayLib.h @@ -249,6 +249,18 @@ GetPopupColor ( VOID ); +/** + Get OEM/Vendor specific title attribute colors. + + @retval Byte code color setting for title bar color. +**/ +UINT8 +EFIAPI +GetTitleColor ( + VOID + ); + + /** Get OEM/Vendor specific popup attribute colors. @@ -348,6 +360,28 @@ GetSubTitleTextColor ( VOID ); +/** + Get OEM/Vendor specific banner color attribute. + + @retval Byte code color setting for banner text color. +**/ +UINT8 +EFIAPI +GetBannerColor ( + VOID + ); + +/** + Get OEM/Vendor specific key help text color attribute. + + @retval Byte code color setting for key help text color. +**/ +UINT8 +EFIAPI +GetKeyHelpColor ( + VOID + ); + /** Count the storage space of a Unicode string. diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c index 8c984b5025..f83959e792 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c @@ -153,7 +153,7 @@ RefreshKeyHelp ( return; } - gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND); + gST->ConOut->SetAttribute (gST->ConOut, GetKeyHelpColor()); if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) { return; @@ -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, @@ -798,7 +798,21 @@ GetPopupColor ( VOID ) { - return POPUP_TEXT | POPUP_BACKGROUND; + return PcdGet8 (PcdBrowserPopupTextColor) | PcdGet8 (PcdBrowserPopupBackgroundColor); +} + +/** + Get OEM/Vendor specific title colors. + + @retval Byte code color setting for popup color. +**/ +UINT8 +EFIAPI +GetTitleColor ( + VOID + ) +{ + return PcdGet8 (PcdBrowserTitleTextColor) | PcdGet8 (PcdBrowserTitleBackgroundColor); } /** @@ -812,7 +826,7 @@ GetPopupInverseColor ( VOID ) { - return POPUP_INVERSE_TEXT | POPUP_INVERSE_BACKGROUND; + return PcdGet8 (PcdBrowserPopupInverseTextColor) | PcdGet8 (PcdBrowserPopupInverseBackgroundColor); } /** @@ -826,9 +840,8 @@ GetPickListColor ( VOID ) { - return PICKLIST_HIGHLIGHT_TEXT | PICKLIST_HIGHLIGHT_BACKGROUND; + return PcdGet8 (PcdBrowserPickListTextColor) | PcdGet8 (PcdBrowserPickListBackgroundColor); } - /** Get OEM/Vendor specific arrow color attribute. @@ -840,7 +853,7 @@ GetArrowColor ( VOID ) { - return ARROW_TEXT | ARROW_BACKGROUND; + return PcdGet8 (PcdBrowserArrowTextColor) | PcdGet8 (PcdBrowserArrowBackgroundColor); } /** @@ -854,7 +867,7 @@ GetInfoTextColor ( VOID ) { - return INFO_TEXT | FIELD_BACKGROUND; + return PcdGet8 (PcdBrowserInfoTextColor) | PcdGet8 (PcdBrowserInfoBackgroundColor); } /** @@ -868,7 +881,7 @@ GetHelpTextColor ( VOID ) { - return HELP_TEXT | FIELD_BACKGROUND; + return PcdGet8 (PcdBrowserHelpTextColor) | PcdGet8 (PcdBrowserHelpBackgroundColor); } /** @@ -882,7 +895,7 @@ GetGrayedTextColor ( VOID ) { - return FIELD_TEXT_GRAYED | FIELD_BACKGROUND; + return PcdGet8 (PcdBrowserFieldGrayedTestColor) | PcdGet8 (PcdBrowserFieldBackgroundColor); } /** @@ -910,7 +923,7 @@ GetFieldTextColor ( VOID ) { - return PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND; + return PcdGet8 (PcdBrowserFieldTextColor) | PcdGet8 (PcdBrowserFieldBackgroundColor); } /** @@ -924,7 +937,35 @@ GetSubTitleTextColor ( VOID ) { - return PcdGet8 (PcdBrowserSubtitleTextColor) | FIELD_BACKGROUND; + return PcdGet8 (PcdBrowserSubtitleTextColor) | PcdGet8 (PcdBrowserFieldBackgroundColor); +} + +/** + Get OEM/Vendor specific banner text color attribute. + + @retval Byte code color setting for banner text color. +**/ +UINT8 +EFIAPI +GetBannerColor ( + VOID + ) +{ + return PcdGet8 (PcdBrowserBannerTextColor) | PcdGet8 (PcdBrowserBannerBackgroundColor); +} + +/** + Get OEM/Vendor specific key help text color attribute. + + @retval Byte code color setting for key help text color. +**/ +UINT8 +EFIAPI +GetKeyHelpColor ( + VOID + ) +{ + return PcdGet8 (PcdBrowserKeyHelpTextColor) | PcdGet8 (PcdBrowserKeyHelpBackgroundColor); } /** diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf index 45fbdaf864..02f3620d6c 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf @@ -55,6 +55,26 @@ [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 diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c index 9eeea21792..9b15e17d93 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c @@ -63,7 +63,7 @@ PrintBannerInfo ( gScreenDimensions.RightColumn, gScreenDimensions.TopRow, FRONT_PAGE_HEADER_HEIGHT - 1 + gScreenDimensions.TopRow, - BANNER_TEXT | BANNER_BACKGROUND + GetBannerColor() ); // @@ -151,7 +151,7 @@ PrintFramework ( gScreenDimensions.RightColumn, gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight, gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 1, - KEYHELP_TEXT | KEYHELP_BACKGROUND + GetKeyHelpColor() ); return; } @@ -169,7 +169,7 @@ PrintFramework ( // ? ? // +------------------------------------------------------------------------------+ // - gST->ConOut->SetAttribute (gST->ConOut, TITLE_TEXT | TITLE_BACKGROUND); + gST->ConOut->SetAttribute (gST->ConOut, GetTitleColor()); Character = BOXDRAW_DOWN_RIGHT; PrintCharAt (gScreenDimensions.LeftColumn, gScreenDimensions.TopRow, Character); diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 66e46184c7..373ea42681 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2001,6 +2001,46 @@ # @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.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..1aa883356e 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..d4fd615b5f 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.