[{"id":1780064,"web_url":"http://patchwork.ozlabs.org/comment/1780064/","msgid":"<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>","list_archive_url":null,"date":"2017-10-04T18:53:00","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"content":"On 09/10/2017 03:22 PM, Rob Clark wrote:\n> Shell.efi uses this, and supporting color attributes makes things look\n> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n> Not all colors have a perfect match, but spec just says \"Devices\n> supporting a different number of text colors are required to emulate the\n> above colors to the best of the device’s capabilities\".\n> \n> Signed-off-by: Rob Clark <robdclark@gmail.com>\n> ---\n>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>  2 files changed, 59 insertions(+)\n> \n> diff --git a/include/efi_api.h b/include/efi_api.h\n> index 87c8ffe68e..3cc1dbac2e 100644\n> --- a/include/efi_api.h\n> +++ b/include/efi_api.h\n> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>  \tEFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>  \t\t 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>  \n> +#define EFI_BLACK                0x00\n> +#define EFI_BLUE                 0x01\n> +#define EFI_GREEN                0x02\n> +#define EFI_CYAN                 0x03\n> +#define EFI_RED                  0x04\n> +#define EFI_MAGENTA              0x05\n> +#define EFI_BROWN                0x06\n> +#define EFI_LIGHTGRAY            0x07\n> +#define EFI_BRIGHT               0x08\n> +#define EFI_DARKGRAY             0x08\n> +#define EFI_LIGHTBLUE            0x09\n> +#define EFI_LIGHTGREEN           0x0a\n> +#define EFI_LIGHTCYAN            0x0b\n> +#define EFI_LIGHTRED             0x0c\n> +#define EFI_LIGHTMAGENTA         0x0d\n> +#define EFI_YELLOW               0x0e\n> +#define EFI_WHITE                0x0f\n> +#define EFI_BACKGROUND_BLACK     0x00\n> +#define EFI_BACKGROUND_BLUE      0x10\n> +#define EFI_BACKGROUND_GREEN     0x20\n> +#define EFI_BACKGROUND_CYAN      0x30\n> +#define EFI_BACKGROUND_RED       0x40\n> +#define EFI_BACKGROUND_MAGENTA   0x50\n> +#define EFI_BACKGROUND_BROWN     0x60\n> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n\nWill we ever use these constants?\n\n\nWhere are the comments explaining the defines below?\n\n> +\n> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n\nThis saves 8 entries in the table below.\n+#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n\n> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n\nAdd\n#define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n\n> +\n>  struct efi_simple_text_output_protocol {\n>  \tvoid *reset;\n>  \tefi_status_t (EFIAPI *output_string)(\n> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n> index 2e13fdc096..fcd65ca488 100644\n> --- a/lib/efi_loader/efi_console.c\n> +++ b/lib/efi_loader/efi_console.c\n> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>  \treturn EFI_EXIT(EFI_SUCCESS);\n>  }\n>  \n> +static const struct {\n> +\tunsigned fg;\n> +\tunsigned bg;\n> +} color[] = {\n> +\t{ 30, 40 },     /* 0: black */\n> +\t{ 34, 44 },     /* 1: blue */\n> +\t{ 32, 42 },     /* 2: green */\n> +\t{ 36, 46 },     /* 3: cyan */\n> +\t{ 31, 41 },     /* 4: red */\n> +\t{ 35, 45 },     /* 5: magenta */\n> +\t{ 30, 40 },     /* 6: brown, map to black */\n\nThis should be { 33, 43 }\n\n> +\t{ 37, 47 },     /* 7: light grey, map to white */\n\nThe entries below are redundant.\n\n> +\t{ 37, 47 },     /* 8: bright, map to white */\n> +\t{ 34, 44 },     /* 9: light blue, map to blue */\n> +\t{ 32, 42 },     /* A: light green, map to green */\n> +\t{ 36, 46 },     /* B: light cyan, map to cyan */\n> +\t{ 31, 41 },     /* C: light red, map to red */\n> +\t{ 35, 45 },     /* D: light magenta, map to magenta */\n> +\t{ 33, 43 },     /* E: yellow */\n> +\t{ 37, 47 },     /* F: white */\n> +};\n> +\n\nNo function without a comment explaining the parameters.\n\n>  static efi_status_t EFIAPI efi_cout_set_attribute(\n>  \t\t\tstruct efi_simple_text_output_protocol *this,\n>  \t\t\tunsigned long attribute)\n>  {\n> +\tunsigned fg = EFI_ATTR_FG(attribute);\n> +\tunsigned bg = EFI_ATTR_BG(attribute);\n\nUse unsigned int.\n\n> +\n>  \tEFI_ENTRY(\"%p, %lx\", this, attribute);\n>  \n> +\tif (attribute)\n\nAttribute 0 should be black on black. No need for any if here.\n\n> +\t\tprintf(ESC\"[%u;%um\", color[fg].fg, color[bg].bg);\n\nUse bold for light colors.\n\nunsigned int bold;\nif (EFI_ATTRIB_BOLD(attr))\n\tbold = 1;\nelse\n\tbold = 22;\n\n\nprintf(ESC\"[%u;%u;%um\", bold, color[fg].fg, color[bg].bg)\n\nBest regards\n\nHeinrich\n\n> +\telse\n> +\t\tprintf(ESC\"[37;40m\");\n\n\n> +\n>  \t/* Just ignore attributes (colors) for now */\n>  \treturn EFI_EXIT(EFI_UNSUPPORTED);\n>  }\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6lSY1v9Pz9t2x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 05:54:37 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid 6DD43C21F9C; Wed,  4 Oct 2017 18:54:32 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 2568AC21DA6;\n\tWed,  4 Oct 2017 18:54:30 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid E20ABC21DA6; Wed,  4 Oct 2017 18:54:28 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.15.19])\n\tby lists.denx.de (Postfix) with ESMTPS id 988CBC21DA0\n\tfor <u-boot@lists.denx.de>; Wed,  4 Oct 2017 18:54:28 +0000 (UTC)","from [192.168.123.82] ([94.114.42.150]) by mail.gmx.com (mrgmx001\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t0MEGIi-1e6OO10ywy-00FWQx; Wed, 04 Oct 2017 20:54:17 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=FREEMAIL_FROM\n\tautolearn=unavailable autolearn_force=no version=3.4.0","To":"Rob Clark <robdclark@gmail.com>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Message-ID":"<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>","Date":"Wed, 4 Oct 2017 20:53:00 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170910132236.14318-9-robdclark@gmail.com>","Content-Language":"en-US","X-Provags-ID":"V03:K0:CfTc8GDcS0mL60qI5U6OeOVBTJqGszk8oDTU2b/a0xr82t11GIk\n\tmbWijJ/LwVbk0n6okhvBOisRFxkxzSjoQNj64Ew+F0wc0uI+nDzrJzFDR4fN+Fe4yDNeXqu\n\tsxyQpzoup/vzSp6ju/0jRQ/5g4XZQeLabHkoQafq9RHwXYzqVCMI/FFJspVlWXqCWIk+xvo\n\thD+b6usojbXryT+29XEAg==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:t5wDltF1nPo=:pv8TJFkUFAiov3ATu9HDiP\n\tSFh6gExAQACMQJxeItjvYLHmtCtL1rbmuSY2/RYVL5r2H/AZMmJWmjF17RZsaV9X5rQfOELRj\n\tidY2MyG4aAWFtH2kWYMfmI49ptvHhfCoTAnTwkt8SAwMQpOm1doTLGRwKKkN7FKTaz1UffKgB\n\tOJG3qdCqBob1Nqmk9xtqEehLrhbyAUW/oaEdIn5o1H0nPo3J2UxR+rpYTS3Gt1PmT8qqPnCOI\n\tUiJwREWwlvDb3ZFi/1TtSdpGCLXCHyS1CPSqx3xF4XCrBP2m8iqlYtng3WWVTLeodNNZNgtaF\n\tbEYDFZ4vanTOu/0FuzgEdD2C5i0LoOTpW4S2Xc1ERXsUs7v9XAxynVZjy6MnF+MHvNzdhLQbR\n\tmmm+TNEE6N2Zz6dTrpVqHF8HKWXejKURDOQTQWn1fAakBdK0wMBI4EOwQaaQcdKCTz9dORudT\n\tr9E4AfPRZ58pqObx8PqQ39M3C3a4IitUV3qXnqcstXz0Sjfx6EgCH5VrKeJAZbTUkUIC0mn3c\n\t0kAgDfWVZK6PpChKEvTrqHbNLUfFgfLlOqwpWJlkH8fHmGLcyXkz/gTEU9I9U5beLXPajtpBt\n\ts+ro4ERsjeiCZgq+oQpzHoAGGQVJ3uEnVHYszsD3JmryzrwPvKGXfCvX5IkkvMG+MamdTfSC3\n\tAKdsIMk2nK6sn4jamYv59H3vnjjllKYjoeMX5WoQslIFPw72QegqjJPf/1omSOns0vouyT8Pf\n\tnTLdTUgULbue/4yKxp5pQm9BAe6wTYus8YIxE/OoJYa5VvDv0aWF5cW/1bTd4tQraChWa9YYv\n\trfERwWHATgp2c156VSeNeBRlN3safKMPPWYuoCcY8Q8v6Oct/M=","Cc":"Peter Jones <pjones@redhat.com>, Leif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780114,"web_url":"http://patchwork.ozlabs.org/comment/1780114/","msgid":"<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>","list_archive_url":null,"date":"2017-10-04T20:54:31","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>> Shell.efi uses this, and supporting color attributes makes things look\n>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>> Not all colors have a perfect match, but spec just says \"Devices\n>> supporting a different number of text colors are required to emulate the\n>> above colors to the best of the device’s capabilities\".\n>>\n>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>> ---\n>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>  2 files changed, 59 insertions(+)\n>>\n>> diff --git a/include/efi_api.h b/include/efi_api.h\n>> index 87c8ffe68e..3cc1dbac2e 100644\n>> --- a/include/efi_api.h\n>> +++ b/include/efi_api.h\n>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>\n>> +#define EFI_BLACK                0x00\n>> +#define EFI_BLUE                 0x01\n>> +#define EFI_GREEN                0x02\n>> +#define EFI_CYAN                 0x03\n>> +#define EFI_RED                  0x04\n>> +#define EFI_MAGENTA              0x05\n>> +#define EFI_BROWN                0x06\n>> +#define EFI_LIGHTGRAY            0x07\n>> +#define EFI_BRIGHT               0x08\n>> +#define EFI_DARKGRAY             0x08\n>> +#define EFI_LIGHTBLUE            0x09\n>> +#define EFI_LIGHTGREEN           0x0a\n>> +#define EFI_LIGHTCYAN            0x0b\n>> +#define EFI_LIGHTRED             0x0c\n>> +#define EFI_LIGHTMAGENTA         0x0d\n>> +#define EFI_YELLOW               0x0e\n>> +#define EFI_WHITE                0x0f\n>> +#define EFI_BACKGROUND_BLACK     0x00\n>> +#define EFI_BACKGROUND_BLUE      0x10\n>> +#define EFI_BACKGROUND_GREEN     0x20\n>> +#define EFI_BACKGROUND_CYAN      0x30\n>> +#define EFI_BACKGROUND_RED       0x40\n>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>> +#define EFI_BACKGROUND_BROWN     0x60\n>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>\n> Will we ever use these constants?\n>\n\npossibly not, but it is useful to understand what is going on with\nefi->ansi mapping, so I would prefer to keep them.\n\n>\n> Where are the comments explaining the defines below?\n>\n>> +\n>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>\n> This saves 8 entries in the table below.\n> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>\n>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>\n> Add\n> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>\n>> +\n>>  struct efi_simple_text_output_protocol {\n>>       void *reset;\n>>       efi_status_t (EFIAPI *output_string)(\n>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>> index 2e13fdc096..fcd65ca488 100644\n>> --- a/lib/efi_loader/efi_console.c\n>> +++ b/lib/efi_loader/efi_console.c\n>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>       return EFI_EXIT(EFI_SUCCESS);\n>>  }\n>>\n>> +static const struct {\n>> +     unsigned fg;\n>> +     unsigned bg;\n>> +} color[] = {\n>> +     { 30, 40 },     /* 0: black */\n>> +     { 34, 44 },     /* 1: blue */\n>> +     { 32, 42 },     /* 2: green */\n>> +     { 36, 46 },     /* 3: cyan */\n>> +     { 31, 41 },     /* 4: red */\n>> +     { 35, 45 },     /* 5: magenta */\n>> +     { 30, 40 },     /* 6: brown, map to black */\n>\n> This should be { 33, 43 }\n>\n>> +     { 37, 47 },     /* 7: light grey, map to white */\n>\n> The entries below are redundant.\n>\n>> +     { 37, 47 },     /* 8: bright, map to white */\n>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>> +     { 32, 42 },     /* A: light green, map to green */\n>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>> +     { 31, 41 },     /* C: light red, map to red */\n>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>> +     { 33, 43 },     /* E: yellow */\n>> +     { 37, 47 },     /* F: white */\n>> +};\n>> +\n\nI'm not totally convinced about mapping extra colors that UEFI defines\nto bold.. unless you have some example of prior-art for this on other\nplatforms.\n\nThere are ansi extensions that allow for more colors, we could perhaps\nmap the extra EFI colors to the base sequence (presumably more widely\nsupported) followed by the extended sequence (which presumably not all\nterminal emulators support)..  I'm not sure if it is worth the effort.\nThe current patch implements something that is at least fairly\nreasonable and within the bounds of what the spec says (ie. \"Devices\nsupporting a different number of text colors are required to emulate\nthe above colors to the best of the device’s capabilities.\")\n\nBR,\n-R\n\n>\n> No function without a comment explaining the parameters.\n>\n>>  static efi_status_t EFIAPI efi_cout_set_attribute(\n>>                       struct efi_simple_text_output_protocol *this,\n>>                       unsigned long attribute)\n>>  {\n>> +     unsigned fg = EFI_ATTR_FG(attribute);\n>> +     unsigned bg = EFI_ATTR_BG(attribute);\n>\n> Use unsigned int.\n>\n>> +\n>>       EFI_ENTRY(\"%p, %lx\", this, attribute);\n>>\n>> +     if (attribute)\n>\n> Attribute 0 should be black on black. No need for any if here.\n\nyeah, except in practice this results in unreadable black on black\ndisplay.. I debugged my way through this the hard way.  The spec\ndoesn't make it clean, but in practice attribute==0 means to go back\nto white on black.\n\nBR,\n-R\n\n>> +             printf(ESC\"[%u;%um\", color[fg].fg, color[bg].bg);\n>\n> Use bold for light colors.\n>\n> unsigned int bold;\n> if (EFI_ATTRIB_BOLD(attr))\n>         bold = 1;\n> else\n>         bold = 22;\n>\n>\n> printf(ESC\"[%u;%u;%um\", bold, color[fg].fg, color[bg].bg)\n>\n> Best regards\n>\n> Heinrich\n>\n>> +     else\n>> +             printf(ESC\"[37;40m\");\n>\n>\n>> +\n>>       /* Just ignore attributes (colors) for now */\n>>       return EFI_EXIT(EFI_UNSUPPORTED);\n>>  }\n>>\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"u2aQLain\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6p7C4qypz9t5q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 07:54:46 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid BF222C21DCA; Wed,  4 Oct 2017 20:54:37 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 5D358C21DA0;\n\tWed,  4 Oct 2017 20:54:34 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 8168AC21DA0; Wed,  4 Oct 2017 20:54:33 +0000 (UTC)","from mail-lf0-f65.google.com (mail-lf0-f65.google.com\n\t[209.85.215.65])\n\tby lists.denx.de (Postfix) with ESMTPS id 21081C21DAB\n\tfor <u-boot@lists.denx.de>; Wed,  4 Oct 2017 20:54:33 +0000 (UTC)","by mail-lf0-f65.google.com with SMTP id l196so5149941lfl.3\n\tfor <u-boot@lists.denx.de>; Wed, 04 Oct 2017 13:54:33 -0700 (PDT)","by 10.46.34.134 with HTTP; Wed, 4 Oct 2017 13:54:31 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=H0gO7gBYGfcX3Idp7VDcm2Xt2oCbe0tf5GTNYoScUvs=;\n\tb=u2aQLain0nVt64WQvVT/uWrepLQd419ph0Fzd52FR/1NgcpvBDRmLyu0CGZseezfN6\n\tZ61A9j7oyVsaNsNj5nT2lXLt+ql/ZVt0PQn4JJZupzhSzGFVRK++B8Y08dQ7CJ4SHUE/\n\t7wlWk2gjpKzQujxzyLGz9G7huRkv2jmNLd98FCvZR2t8r1cMSHlkbxGySCl+2/jJo6O5\n\t+BdSx3Vkox6k+a2yhd/nxy/04uX6i1NH6I4o6pJXxygXqE5CrCX4zp9WdXcrV0lzTjOQ\n\tI83Uh7zdR2KSI6Zp97joHrqikODbQxmvXgxEaJR2knmUIZbV/+TNVgF00lc9XcdLrZ6l\n\tyVGw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=H0gO7gBYGfcX3Idp7VDcm2Xt2oCbe0tf5GTNYoScUvs=;\n\tb=oVhEVRE2gn+GugW1W1oTVWwysUHqocTt/kjufoWOls/A8CV1iyEvrrszc+7UCJ7Y+P\n\tBUcVqhTTIMWfgUdHkkKTmb9j1Z9eSawUT2Jn94M+iGeWsDsR5cOQr5/JO/X2L0uLfDKJ\n\tjbR5nfm3LPCO/A15TQRG3qki4BPUyvNHZq6JxSVumR38qvYC3+c8cckgH3jNtnGeEuUF\n\t2tpikiyIbczyqDldF9pqwi+8AtjOWw0O+jsFTEkrbFZutJzSVQ8lUoY7Jc/AOa5LbSjU\n\t////j5tDOrCfYlJ75OhPALlQ+lLfxHVu+kIJnVYQBJOVng3r1w4AeSlQ7Ug5DWj1pJsC\n\tWovQ==","X-Gm-Message-State":"AMCzsaX5lwZ2tnAmqOJBB0WEzm+aaCnkN7dgDL7S4wFJgCOrZHvMWz4b\n\tw85j8piVrE43u0DtGraR6uAa+NJ+inJ4JXIQHVQ=","X-Google-Smtp-Source":"AOwi7QC7YfjeSK1MNKRQHOI6KRNgyFkWGRnXx2B7QMrB60p2uyW9scmo9uq4G0qKMVfNdwjfvcQ5zTkfEXPSHPCEkbM=","X-Received":"by 10.46.81.18 with SMTP id f18mr147482ljb.52.1507150472456; Wed,\n\t04 Oct 2017 13:54:32 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>","From":"Rob Clark <robdclark@gmail.com>","Date":"Wed, 4 Oct 2017 16:54:31 -0400","Message-ID":"<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>","To":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780144,"web_url":"http://patchwork.ozlabs.org/comment/1780144/","msgid":"<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>","list_archive_url":null,"date":"2017-10-04T22:01:15","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"content":"On 10/04/2017 10:54 PM, Rob Clark wrote:\n> On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>>> Shell.efi uses this, and supporting color attributes makes things look\n>>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>>> Not all colors have a perfect match, but spec just says \"Devices\n>>> supporting a different number of text colors are required to emulate the\n>>> above colors to the best of the device’s capabilities\".\n>>>\n>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>> ---\n>>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>>  2 files changed, 59 insertions(+)\n>>>\n>>> diff --git a/include/efi_api.h b/include/efi_api.h\n>>> index 87c8ffe68e..3cc1dbac2e 100644\n>>> --- a/include/efi_api.h\n>>> +++ b/include/efi_api.h\n>>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>>\n>>> +#define EFI_BLACK                0x00\n>>> +#define EFI_BLUE                 0x01\n>>> +#define EFI_GREEN                0x02\n>>> +#define EFI_CYAN                 0x03\n>>> +#define EFI_RED                  0x04\n>>> +#define EFI_MAGENTA              0x05\n>>> +#define EFI_BROWN                0x06\n>>> +#define EFI_LIGHTGRAY            0x07\n>>> +#define EFI_BRIGHT               0x08\n>>> +#define EFI_DARKGRAY             0x08\n>>> +#define EFI_LIGHTBLUE            0x09\n>>> +#define EFI_LIGHTGREEN           0x0a\n>>> +#define EFI_LIGHTCYAN            0x0b\n>>> +#define EFI_LIGHTRED             0x0c\n>>> +#define EFI_LIGHTMAGENTA         0x0d\n>>> +#define EFI_YELLOW               0x0e\n>>> +#define EFI_WHITE                0x0f\n>>> +#define EFI_BACKGROUND_BLACK     0x00\n>>> +#define EFI_BACKGROUND_BLUE      0x10\n>>> +#define EFI_BACKGROUND_GREEN     0x20\n>>> +#define EFI_BACKGROUND_CYAN      0x30\n>>> +#define EFI_BACKGROUND_RED       0x40\n>>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>>> +#define EFI_BACKGROUND_BROWN     0x60\n>>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>>\n>> Will we ever use these constants?\n>>\n> \n> possibly not, but it is useful to understand what is going on with\n> efi->ansi mapping, so I would prefer to keep them.\n> \n>>\n>> Where are the comments explaining the defines below?\n>>\n>>> +\n>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>>\n>> This saves 8 entries in the table below.\n>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>>\n>>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>>\n>> Add\n>> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>>\n>>> +\n>>>  struct efi_simple_text_output_protocol {\n>>>       void *reset;\n>>>       efi_status_t (EFIAPI *output_string)(\n>>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>>> index 2e13fdc096..fcd65ca488 100644\n>>> --- a/lib/efi_loader/efi_console.c\n>>> +++ b/lib/efi_loader/efi_console.c\n>>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>>       return EFI_EXIT(EFI_SUCCESS);\n>>>  }\n>>>\n>>> +static const struct {\n>>> +     unsigned fg;\n>>> +     unsigned bg;\n>>> +} color[] = {\n>>> +     { 30, 40 },     /* 0: black */\n>>> +     { 34, 44 },     /* 1: blue */\n>>> +     { 32, 42 },     /* 2: green */\n>>> +     { 36, 46 },     /* 3: cyan */\n>>> +     { 31, 41 },     /* 4: red */\n>>> +     { 35, 45 },     /* 5: magenta */\n>>> +     { 30, 40 },     /* 6: brown, map to black */\n>>\n>> This should be { 33, 43 }\n>>\n>>> +     { 37, 47 },     /* 7: light grey, map to white */\n>>\n>> The entries below are redundant.\n>>\n>>> +     { 37, 47 },     /* 8: bright, map to white */\n>>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>>> +     { 32, 42 },     /* A: light green, map to green */\n>>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>>> +     { 31, 41 },     /* C: light red, map to red */\n>>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>>> +     { 33, 43 },     /* E: yellow */\n>>> +     { 37, 47 },     /* F: white */\n>>> +};\n>>> +\n> \n> I'm not totally convinced about mapping extra colors that UEFI defines\n> to bold.. unless you have some example of prior-art for this on other\n> platforms.\n\nSee\nStandard ECMA-48 - Control Functions for Coded Character Sets\nchapter 8.3.117 SGR - SELECT GRAPHIC RENDITION\n\n1 - bold or increased intensity\n22 - normal colour or normal intensity (neither bold nor faint)\n\nYou can easily experiment in your bash shell like this:\n\nprintf \"\\x1b[1;32;40m bold \\x1b[22;32;40m normal\\x1b[22;39;49m\\n\";\n\nYou will find that \"bold\" prints bold and bright in the KDE konsole and\nxterm.\n\nUsing colors 90-97 as foreground colors produces only bright but not\nbold in the KDE konsole and xterm:\n\nprintf \"\\x1b[92;40m bold \\x1b[32;40m normal\\x1b[22;39;49m\\n\";\n\nBut these codes are not defined in ECMA-48.\n\nBest regards\n\nHeinrich","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6qfP1772z9t3R\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 09:03:23 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid F1A5CC21E1E; Wed,  4 Oct 2017 22:03:14 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 45378C21DA0;\n\tWed,  4 Oct 2017 22:03:12 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 19C80C21DA0; Wed,  4 Oct 2017 22:03:11 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.17.20])\n\tby lists.denx.de (Postfix) with ESMTPS id B9DA1C21C54\n\tfor <u-boot@lists.denx.de>; Wed,  4 Oct 2017 22:03:10 +0000 (UTC)","from [192.168.123.82] ([94.114.42.150]) by mail.gmx.com (mrgmx102\n\t[212.227.17.168]) with ESMTPSA (Nemesis) id\n\t0MgYGJ-1dcxa0025P-00Nw9s; Thu, 05 Oct 2017 00:02:59 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=FREEMAIL_FROM\n\tautolearn=unavailable autolearn_force=no version=3.4.0","To":"Rob Clark <robdclark@gmail.com>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>\n\t<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Message-ID":"<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>","Date":"Thu, 5 Oct 2017 00:01:15 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>","Content-Language":"en-US","X-Provags-ID":"V03:K0:yKh7pydladzv1ymbA6lRevJikiGZg1bQEjFSq3+fJRLzbeURpYz\n\tW5TRD4COGQtN+kHBFFcLE7uA3ZmTQF7nmK3GQv9WnDUveRlUQAQ7ujXrgse/HBGfGFv12ZL\n\tXBMvqZGYenLDYwFR+W+L8qRy0RhTIwd8vB70qXN04MSCe7rKkCZHgifSZO3Gxd58D+PqitX\n\tbD5cUBC/G0pPrjM2Y4YJQ==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:URLp5kCQoZs=:/BIXfhGO5HPNiSmlaTWMQj\n\t8i/ZgEAttznbV0YwdQeIRpHQzxuhbxS86PEpXdq02136+NtB4vfGm/tmoghRhOMUSUvnWVj4o\n\tLfhSqdZoKsCyMKz0wT51sf+iB2kCX1QV8xSA4Xp9/m+K2M5GUsod0HfAOvzD35ZuwGVeDCwdH\n\td+WdSSfZG226iIHSvTshaLDa0AjsffZbVtwKuYFXKb8WLIdMMAU16GruaHnbxQFeqGqM4gKxa\n\tTpNKIJhnnEXhjeccqkr36rHu6dxXfBZ77YZ9+U+cixywgpimlbKrt2IM2+PnmgELIy+TUXrPf\n\t/CBed3o6Cey04t/l6tdAZyw61hqEJ/dGKUeFJnJ0VOTvLNmHzxKk88LZZdVCJRJtWeKjdotNk\n\t7Go+xEaHeTfJipnw964l9gGLJzZC/rv8zgC2Wsmla6FiyNfY1IbZDAbPBKJTrLqbinGcFPb8g\n\tAhp/7r31uD5VDACmXRC+YADAX42fa8tFQskyfgBCtYDUPmSQrMog1N1d68AALiqP9bdSdib21\n\tGXVxVN+UHSPTbXIQgKWxscG9g5T+XYAIrLA7OmYFv5sfep9OQ3XYGbxSQHmsSZP0vMhpEhI5+\n\tN101lKJ6B05lOUec34kEZmQC3XHXDQhBnGCanpt8fErVtiC7z5jes+kaxSNan6jzEZGOmr7m0\n\tsV0cckjTAVc7gvkjPEf+9idAdrkWvDugdp9E0k9CE0CcBV2RLxEmOOuerwLHlRXzQLn9h5xzM\n\tf97/NzjIqFJ8m+F0dNg7FTmDctTYUoLbAxqgXhUOjXXHWzMJf6S5k6Afjxf9oVwG8qgZw3Ozd\n\t/8HH0YrIcFqXEDf6T0B2h6h2QHAmWqzV8gx5QpiyyS0wtIxExE=","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780174,"web_url":"http://patchwork.ozlabs.org/comment/1780174/","msgid":"<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>","list_archive_url":null,"date":"2017-10-04T23:19:58","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Wed, Oct 4, 2017 at 6:01 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n> On 10/04/2017 10:54 PM, Rob Clark wrote:\n>> On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>>>> Shell.efi uses this, and supporting color attributes makes things look\n>>>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>>>> Not all colors have a perfect match, but spec just says \"Devices\n>>>> supporting a different number of text colors are required to emulate the\n>>>> above colors to the best of the device’s capabilities\".\n>>>>\n>>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>>> ---\n>>>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>>>  2 files changed, 59 insertions(+)\n>>>>\n>>>> diff --git a/include/efi_api.h b/include/efi_api.h\n>>>> index 87c8ffe68e..3cc1dbac2e 100644\n>>>> --- a/include/efi_api.h\n>>>> +++ b/include/efi_api.h\n>>>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>>>\n>>>> +#define EFI_BLACK                0x00\n>>>> +#define EFI_BLUE                 0x01\n>>>> +#define EFI_GREEN                0x02\n>>>> +#define EFI_CYAN                 0x03\n>>>> +#define EFI_RED                  0x04\n>>>> +#define EFI_MAGENTA              0x05\n>>>> +#define EFI_BROWN                0x06\n>>>> +#define EFI_LIGHTGRAY            0x07\n>>>> +#define EFI_BRIGHT               0x08\n>>>> +#define EFI_DARKGRAY             0x08\n>>>> +#define EFI_LIGHTBLUE            0x09\n>>>> +#define EFI_LIGHTGREEN           0x0a\n>>>> +#define EFI_LIGHTCYAN            0x0b\n>>>> +#define EFI_LIGHTRED             0x0c\n>>>> +#define EFI_LIGHTMAGENTA         0x0d\n>>>> +#define EFI_YELLOW               0x0e\n>>>> +#define EFI_WHITE                0x0f\n>>>> +#define EFI_BACKGROUND_BLACK     0x00\n>>>> +#define EFI_BACKGROUND_BLUE      0x10\n>>>> +#define EFI_BACKGROUND_GREEN     0x20\n>>>> +#define EFI_BACKGROUND_CYAN      0x30\n>>>> +#define EFI_BACKGROUND_RED       0x40\n>>>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>>>> +#define EFI_BACKGROUND_BROWN     0x60\n>>>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>>>\n>>> Will we ever use these constants?\n>>>\n>>\n>> possibly not, but it is useful to understand what is going on with\n>> efi->ansi mapping, so I would prefer to keep them.\n>>\n>>>\n>>> Where are the comments explaining the defines below?\n>>>\n>>>> +\n>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>>>\n>>> This saves 8 entries in the table below.\n>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>>>\n>>>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>>>\n>>> Add\n>>> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>>>\n>>>> +\n>>>>  struct efi_simple_text_output_protocol {\n>>>>       void *reset;\n>>>>       efi_status_t (EFIAPI *output_string)(\n>>>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>>>> index 2e13fdc096..fcd65ca488 100644\n>>>> --- a/lib/efi_loader/efi_console.c\n>>>> +++ b/lib/efi_loader/efi_console.c\n>>>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>>>       return EFI_EXIT(EFI_SUCCESS);\n>>>>  }\n>>>>\n>>>> +static const struct {\n>>>> +     unsigned fg;\n>>>> +     unsigned bg;\n>>>> +} color[] = {\n>>>> +     { 30, 40 },     /* 0: black */\n>>>> +     { 34, 44 },     /* 1: blue */\n>>>> +     { 32, 42 },     /* 2: green */\n>>>> +     { 36, 46 },     /* 3: cyan */\n>>>> +     { 31, 41 },     /* 4: red */\n>>>> +     { 35, 45 },     /* 5: magenta */\n>>>> +     { 30, 40 },     /* 6: brown, map to black */\n>>>\n>>> This should be { 33, 43 }\n>>>\n>>>> +     { 37, 47 },     /* 7: light grey, map to white */\n>>>\n>>> The entries below are redundant.\n>>>\n>>>> +     { 37, 47 },     /* 8: bright, map to white */\n>>>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>>>> +     { 32, 42 },     /* A: light green, map to green */\n>>>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>>>> +     { 31, 41 },     /* C: light red, map to red */\n>>>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>>>> +     { 33, 43 },     /* E: yellow */\n>>>> +     { 37, 47 },     /* F: white */\n>>>> +};\n>>>> +\n>>\n>> I'm not totally convinced about mapping extra colors that UEFI defines\n>> to bold.. unless you have some example of prior-art for this on other\n>> platforms.\n>\n> See\n> Standard ECMA-48 - Control Functions for Coded Character Sets\n> chapter 8.3.117 SGR - SELECT GRAPHIC RENDITION\n>\n> 1 - bold or increased intensity\n> 22 - normal colour or normal intensity (neither bold nor faint)\n>\n> You can easily experiment in your bash shell like this:\n>\n> printf \"\\x1b[1;32;40m bold \\x1b[22;32;40m normal\\x1b[22;39;49m\\n\";\n>\n> You will find that \"bold\" prints bold and bright in the KDE konsole and\n> xterm.\n\nbut I think we don't want (potential) font changes, just color changes..\n\nif you can find the code in edk2 that does this, I guess it would be a\nreasonable precedent to follow.. but if not I wanted to avoid things\nthat might be specific to particular terminal emulators, since I\nwasn't really looking forward to testing them all.  Otherwise I'd just\nrely on the extension that allowed 256 colors..\n\nBR,\n-R\n\n> Using colors 90-97 as foreground colors produces only bright but not\n> bold in the KDE konsole and xterm:\n>\n> printf \"\\x1b[92;40m bold \\x1b[32;40m normal\\x1b[22;39;49m\\n\";\n>\n> But these codes are not defined in ECMA-48.\n>\n> Best regards\n>\n> Heinrich\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"k5ADcXmd\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6sLz2rGHz9t2S\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 10:20:10 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid BBEF9C21E5A; Wed,  4 Oct 2017 23:20:04 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 8B3CCC21D8D;\n\tWed,  4 Oct 2017 23:20:01 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 003B6C21D8D; Wed,  4 Oct 2017 23:19:59 +0000 (UTC)","from mail-lf0-f43.google.com (mail-lf0-f43.google.com\n\t[209.85.215.43])\n\tby lists.denx.de (Postfix) with ESMTPS id 95B71C21C54\n\tfor <u-boot@lists.denx.de>; Wed,  4 Oct 2017 23:19:59 +0000 (UTC)","by mail-lf0-f43.google.com with SMTP id l23so8224267lfk.10\n\tfor <u-boot@lists.denx.de>; Wed, 04 Oct 2017 16:19:59 -0700 (PDT)","by 10.46.34.134 with HTTP; Wed, 4 Oct 2017 16:19:58 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=SaLWw5cdmVmgYWAigGFsDZSTmyQbxsH7mD1dq03OXLo=;\n\tb=k5ADcXmdBTTB6LM+JTq0p5Xj2mV3BvdjunwRdVRZMjFL3a2gSLRpXfLJZV07gwXZOD\n\tUu76yn94pZn8eITsSshHcG1WDJpfLj54lM9gvkAxZbZCd7c1nGoBQebRaEZL3ytU70UZ\n\tnjOtSAoalAwrLVrDG9EO2zH56Q/42yNk+dBlUQoHnIfF6aXvUpkvVQ++xIMcyYvyohaD\n\tzbxo7+Mj8EnaG/jJxBCzNg016SYLt/bV5T+xypuYtk/hopr0gG64Cdk/gX3p62iuSSgP\n\t2n6m1LdEjpiMtSG7tFIRO3oUtR07VS0enSOVf62X0pOYJP1GHjCgVcix7FEqHry4P64r\n\tVXkw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=SaLWw5cdmVmgYWAigGFsDZSTmyQbxsH7mD1dq03OXLo=;\n\tb=qEqy58d16wHqXddnlHtAhlz+0vFGSGVOrm1mjnSeaGto3QwgI1src3NKVwesZ9STq7\n\tVB1ZDyZZDh4wuDCj4J+U6FuBKKN3pWYwFcNUJFiAloglfwgxuBaRIRWQ7pewHEaE+k+9\n\tIDla8Fnxldq+OXICn0gONfzEauSnuZ6F46ehrTmVyfYTDmqLkb85BkF/qR3Qn42bHb+k\n\tZyZTVNsW4uT8z4GHSU7BqnrZ9GPwVUl8KRDeZToTa8+9dziLX41bAsH9g1fCTOfG+Mgh\n\tRvEK1gaapzlW0qxWanFTMq80mwHKuPjAAZ6p7Fua12YpDU8ERkazuTWn3ynqDDf/TLfk\n\teqew==","X-Gm-Message-State":"AMCzsaXdub+VYzlnytyiJGkyueQZjV75k1IPP3lq7TkJDEkLp8bodH+G\n\t+9vShK4pqaaPDOOgl8BKLXJhZ6O/Bdf8v72YaVc=","X-Google-Smtp-Source":"AOwi7QAiA9YEPzaQSMx51WZi0NnWs2y1xdZrZ0jc6CDmrwRgYPfSrnHmF44XeyhFJvujCsHQKiHnPkn2xR1ecWF8Ug4=","X-Received":"by 10.46.81.18 with SMTP id f18mr259856ljb.52.1507159198902; Wed,\n\t04 Oct 2017 16:19:58 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>\n\t<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>\n\t<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>","From":"Rob Clark <robdclark@gmail.com>","Date":"Wed, 4 Oct 2017 19:19:58 -0400","Message-ID":"<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>","To":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780198,"web_url":"http://patchwork.ozlabs.org/comment/1780198/","msgid":"<fd00ccb0-51ad-2c0c-8a83-06c47c0a190e@gmx.de>","list_archive_url":null,"date":"2017-10-04T23:53:04","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"content":"On 10/05/2017 01:19 AM, Rob Clark wrote:\n> On Wed, Oct 4, 2017 at 6:01 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>> On 10/04/2017 10:54 PM, Rob Clark wrote:\n>>> On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>>> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>>>>> Shell.efi uses this, and supporting color attributes makes things look\n>>>>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>>>>> Not all colors have a perfect match, but spec just says \"Devices\n>>>>> supporting a different number of text colors are required to emulate the\n>>>>> above colors to the best of the device’s capabilities\".\n>>>>>\n>>>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>>>> ---\n>>>>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>>>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>>>>  2 files changed, 59 insertions(+)\n>>>>>\n>>>>> diff --git a/include/efi_api.h b/include/efi_api.h\n>>>>> index 87c8ffe68e..3cc1dbac2e 100644\n>>>>> --- a/include/efi_api.h\n>>>>> +++ b/include/efi_api.h\n>>>>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>>>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>>>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>>>>\n>>>>> +#define EFI_BLACK                0x00\n>>>>> +#define EFI_BLUE                 0x01\n>>>>> +#define EFI_GREEN                0x02\n>>>>> +#define EFI_CYAN                 0x03\n>>>>> +#define EFI_RED                  0x04\n>>>>> +#define EFI_MAGENTA              0x05\n>>>>> +#define EFI_BROWN                0x06\n>>>>> +#define EFI_LIGHTGRAY            0x07\n>>>>> +#define EFI_BRIGHT               0x08\n>>>>> +#define EFI_DARKGRAY             0x08\n>>>>> +#define EFI_LIGHTBLUE            0x09\n>>>>> +#define EFI_LIGHTGREEN           0x0a\n>>>>> +#define EFI_LIGHTCYAN            0x0b\n>>>>> +#define EFI_LIGHTRED             0x0c\n>>>>> +#define EFI_LIGHTMAGENTA         0x0d\n>>>>> +#define EFI_YELLOW               0x0e\n>>>>> +#define EFI_WHITE                0x0f\n>>>>> +#define EFI_BACKGROUND_BLACK     0x00\n>>>>> +#define EFI_BACKGROUND_BLUE      0x10\n>>>>> +#define EFI_BACKGROUND_GREEN     0x20\n>>>>> +#define EFI_BACKGROUND_CYAN      0x30\n>>>>> +#define EFI_BACKGROUND_RED       0x40\n>>>>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>>>>> +#define EFI_BACKGROUND_BROWN     0x60\n>>>>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>>>>\n>>>> Will we ever use these constants?\n>>>>\n>>>\n>>> possibly not, but it is useful to understand what is going on with\n>>> efi->ansi mapping, so I would prefer to keep them.\n>>>\n>>>>\n>>>> Where are the comments explaining the defines below?\n>>>>\n>>>>> +\n>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>>>>\n>>>> This saves 8 entries in the table below.\n>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>>>>\n>>>>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>>>>\n>>>> Add\n>>>> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>>>>\n>>>>> +\n>>>>>  struct efi_simple_text_output_protocol {\n>>>>>       void *reset;\n>>>>>       efi_status_t (EFIAPI *output_string)(\n>>>>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>>>>> index 2e13fdc096..fcd65ca488 100644\n>>>>> --- a/lib/efi_loader/efi_console.c\n>>>>> +++ b/lib/efi_loader/efi_console.c\n>>>>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>>>>       return EFI_EXIT(EFI_SUCCESS);\n>>>>>  }\n>>>>>\n>>>>> +static const struct {\n>>>>> +     unsigned fg;\n>>>>> +     unsigned bg;\n>>>>> +} color[] = {\n>>>>> +     { 30, 40 },     /* 0: black */\n>>>>> +     { 34, 44 },     /* 1: blue */\n>>>>> +     { 32, 42 },     /* 2: green */\n>>>>> +     { 36, 46 },     /* 3: cyan */\n>>>>> +     { 31, 41 },     /* 4: red */\n>>>>> +     { 35, 45 },     /* 5: magenta */\n>>>>> +     { 30, 40 },     /* 6: brown, map to black */\n>>>>\n>>>> This should be { 33, 43 }\n>>>>\n>>>>> +     { 37, 47 },     /* 7: light grey, map to white */\n>>>>\n>>>> The entries below are redundant.\n>>>>\n>>>>> +     { 37, 47 },     /* 8: bright, map to white */\n>>>>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>>>>> +     { 32, 42 },     /* A: light green, map to green */\n>>>>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>>>>> +     { 31, 41 },     /* C: light red, map to red */\n>>>>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>>>>> +     { 33, 43 },     /* E: yellow */\n>>>>> +     { 37, 47 },     /* F: white */\n>>>>> +};\n>>>>> +\n>>>\n>>> I'm not totally convinced about mapping extra colors that UEFI defines\n>>> to bold.. unless you have some example of prior-art for this on other\n>>> platforms.\n>>\n>> See\n>> Standard ECMA-48 - Control Functions for Coded Character Sets\n>> chapter 8.3.117 SGR - SELECT GRAPHIC RENDITION\n>>\n>> 1 - bold or increased intensity\n>> 22 - normal colour or normal intensity (neither bold nor faint)\n>>\n>> You can easily experiment in your bash shell like this:\n>>\n>> printf \"\\x1b[1;32;40m bold \\x1b[22;32;40m normal\\x1b[22;39;49m\\n\";\n>>\n>> You will find that \"bold\" prints bold and bright in the KDE konsole and\n>> xterm.\n> \n> but I think we don't want (potential) font changes, just color changes..\n> \n> if you can find the code in edk2 that does this, I guess it would be a\n> reasonable precedent to follow.. but if not I wanted to avoid things\n> that might be specific to particular terminal emulators, since I\n> wasn't really looking forward to testing them all.  Otherwise I'd just\n> rely on the extension that allowed 256 colors..\n> \n> BR,\n> -R\n\nThe same problem seems has led the EDK folks to a similar solution.\n\nSee\nMdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c\n\nEverything starts with this array:\n\n{ ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };\n\nThe first '0' is replaced by either 0 or 1 depending on brightness.\n\nmSetAttributeString[BRIGHT_CONTROL_OFFSET] =\n  (CHAR16) ('0' + BrightControl);\n\nThe first '4', '0' is replaced by the foreground color.\nThe second '4', '0' is replaced by the background color.\n\nECMA 48 says:\n\n0 - default rendition, cancels the effect of any preceding SGR\n\nSo you can use this instead of 22.\n\nBest regards\n\nHeinrich\n\n\n> \n>> Using colors 90-97 as foreground colors produces only bright but not\n>> bold in the KDE konsole and xterm:\n>>\n>> printf \"\\x1b[92;40m bold \\x1b[32;40m normal\\x1b[22;39;49m\\n\";\n>>\n>> But these codes are not defined in ECMA-48.\n>>\n>> Best regards\n>>\n>> Heinrich\n>>\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6t7g6FsGz9t2Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 10:55:26 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid 4CAC4C21E45; Wed,  4 Oct 2017 23:55:23 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id AEC09C21D8D;\n\tWed,  4 Oct 2017 23:55:18 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid DA785C21D8D; Wed,  4 Oct 2017 23:55:16 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.15.19])\n\tby lists.denx.de (Postfix) with ESMTPS id 8EECAC21C54\n\tfor <u-boot@lists.denx.de>; Wed,  4 Oct 2017 23:55:16 +0000 (UTC)","from [192.168.123.82] ([94.114.42.150]) by mail.gmx.com (mrgmx002\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t0MTTKZ-1dqAKE0POp-00SNP1; Thu, 05 Oct 2017 01:55:05 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=FREEMAIL_FROM\n\tautolearn=unavailable autolearn_force=no version=3.4.0","To":"Rob Clark <robdclark@gmail.com>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>\n\t<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>\n\t<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>\n\t<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Message-ID":"<fd00ccb0-51ad-2c0c-8a83-06c47c0a190e@gmx.de>","Date":"Thu, 5 Oct 2017 01:53:04 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>","Content-Language":"en-US","X-Provags-ID":"V03:K0:TFoXTxAUW7cTBXtpnGK8fBgZJ2a5/JH2R6Ff57t8X3UYWKk/VkP\n\tVbHZrB9KjkToedF5kwTlRR7kb/vgjcImbITnH7Hos7rzDsNs12vesImwACqxXd8PtHtbhqj\n\t6KnECScMNGkyYwYX9+rD0cSNkRLvZCE9V+P/SEIcK4ibIfeXBtfZj7N1rSuW422HUl+Xsb0\n\tQ8Fl3p5fSZ8r4Z4vExgPQ==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:ahv0+r35I8U=:fgsiA/cH95hUZb2XwFS8/0\n\thHxiZqg4rski9VPM+lqgOMccNiKa46GMdqsCLOtJjMJxD0NUcQAJthQjrPup4mleJk6ZhBt+/\n\tfGM6rHHExCIzI2vzJukJVfctiQl3kCiGY64dx72VT9Vy02N+Syn+Zqv2/ck1JYV0yC/B+4VEL\n\taoCAwbNmSE9eFJ8drWBAXX9izO8mairm99tXQ/mpLOoeFQnFALTmExdsYme4Unt1MtBkgre23\n\tl+9WAcVuwl8vXrC7uPqv+cbXwNdUTueTylU1JOXaCsmz0dIpXOn6OB708ZSbAjExty3GRP9Vh\n\tOqUqO+/qSjtAW7t7MEPdEtLUdHU5wZaHP33won5l4b6QsWZmg4QGOLUrncB2JqaE6bNqXNVQN\n\tGd7tHYEMBNKP3qcSoHCupOXXkTK89p5bWPoX29bfL+mIOsoLfRTTlJ27wiJozwv03Q/mH1piF\n\tLNGs8gwGmkM5/G7CweiFhwGbibuO4A4FNzRSM6DPwyG5mz4r1N4yHPDcOjRwrR8tPJMnoMYW7\n\tEEaP6MPTAzc9n1zZrfNR5koqyDhXCfIMzfc95yk4+YYPemSuROfHxLN7x54JgGqfnz6elsSKy\n\tEIkUq+W/ZujZn3XtZa4SPV6mXR2YVKO8tLpKdYHjCXJdoYy26HoVGDGjKOmm67+Oi7k8ROXYh\n\tA7ylor4Aovxv0uWaNFW8FHwHszno+UMAZLbZzIVKqj4ENa1/dm688VOV/VyOGtLXNKBycATPD\n\tx+HKJpCO34losjxdfF+EVAiIRa9W5Gi1lH7vTYgEdNBhmpdFKQfmD/8lpUanUx4mOyKbWNytH\n\txzt40bQxQyvYUZVkBFyTKqM5NqfP1QINraVF6C5gOi4N/GtOIM=","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780207,"web_url":"http://patchwork.ozlabs.org/comment/1780207/","msgid":"<CAF6AEGszcdU8+5S=uxtt7JUOrBeaU6hTznHoMkz66fJE+HORrA@mail.gmail.com>","list_archive_url":null,"date":"2017-10-05T00:00:14","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Wed, Oct 4, 2017 at 7:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n> On 10/05/2017 01:19 AM, Rob Clark wrote:\n>> On Wed, Oct 4, 2017 at 6:01 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>> On 10/04/2017 10:54 PM, Rob Clark wrote:\n>>>> On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>>>> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>>>>>> Shell.efi uses this, and supporting color attributes makes things look\n>>>>>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>>>>>> Not all colors have a perfect match, but spec just says \"Devices\n>>>>>> supporting a different number of text colors are required to emulate the\n>>>>>> above colors to the best of the device’s capabilities\".\n>>>>>>\n>>>>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>>>>> ---\n>>>>>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>>>>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>>>>>  2 files changed, 59 insertions(+)\n>>>>>>\n>>>>>> diff --git a/include/efi_api.h b/include/efi_api.h\n>>>>>> index 87c8ffe68e..3cc1dbac2e 100644\n>>>>>> --- a/include/efi_api.h\n>>>>>> +++ b/include/efi_api.h\n>>>>>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>>>>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>>>>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>>>>>\n>>>>>> +#define EFI_BLACK                0x00\n>>>>>> +#define EFI_BLUE                 0x01\n>>>>>> +#define EFI_GREEN                0x02\n>>>>>> +#define EFI_CYAN                 0x03\n>>>>>> +#define EFI_RED                  0x04\n>>>>>> +#define EFI_MAGENTA              0x05\n>>>>>> +#define EFI_BROWN                0x06\n>>>>>> +#define EFI_LIGHTGRAY            0x07\n>>>>>> +#define EFI_BRIGHT               0x08\n>>>>>> +#define EFI_DARKGRAY             0x08\n>>>>>> +#define EFI_LIGHTBLUE            0x09\n>>>>>> +#define EFI_LIGHTGREEN           0x0a\n>>>>>> +#define EFI_LIGHTCYAN            0x0b\n>>>>>> +#define EFI_LIGHTRED             0x0c\n>>>>>> +#define EFI_LIGHTMAGENTA         0x0d\n>>>>>> +#define EFI_YELLOW               0x0e\n>>>>>> +#define EFI_WHITE                0x0f\n>>>>>> +#define EFI_BACKGROUND_BLACK     0x00\n>>>>>> +#define EFI_BACKGROUND_BLUE      0x10\n>>>>>> +#define EFI_BACKGROUND_GREEN     0x20\n>>>>>> +#define EFI_BACKGROUND_CYAN      0x30\n>>>>>> +#define EFI_BACKGROUND_RED       0x40\n>>>>>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>>>>>> +#define EFI_BACKGROUND_BROWN     0x60\n>>>>>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>>>>>\n>>>>> Will we ever use these constants?\n>>>>>\n>>>>\n>>>> possibly not, but it is useful to understand what is going on with\n>>>> efi->ansi mapping, so I would prefer to keep them.\n>>>>\n>>>>>\n>>>>> Where are the comments explaining the defines below?\n>>>>>\n>>>>>> +\n>>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>>>>>\n>>>>> This saves 8 entries in the table below.\n>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>>>>>\n>>>>>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>>>>>\n>>>>> Add\n>>>>> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>>>>>\n>>>>>> +\n>>>>>>  struct efi_simple_text_output_protocol {\n>>>>>>       void *reset;\n>>>>>>       efi_status_t (EFIAPI *output_string)(\n>>>>>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>>>>>> index 2e13fdc096..fcd65ca488 100644\n>>>>>> --- a/lib/efi_loader/efi_console.c\n>>>>>> +++ b/lib/efi_loader/efi_console.c\n>>>>>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>>>>>       return EFI_EXIT(EFI_SUCCESS);\n>>>>>>  }\n>>>>>>\n>>>>>> +static const struct {\n>>>>>> +     unsigned fg;\n>>>>>> +     unsigned bg;\n>>>>>> +} color[] = {\n>>>>>> +     { 30, 40 },     /* 0: black */\n>>>>>> +     { 34, 44 },     /* 1: blue */\n>>>>>> +     { 32, 42 },     /* 2: green */\n>>>>>> +     { 36, 46 },     /* 3: cyan */\n>>>>>> +     { 31, 41 },     /* 4: red */\n>>>>>> +     { 35, 45 },     /* 5: magenta */\n>>>>>> +     { 30, 40 },     /* 6: brown, map to black */\n>>>>>\n>>>>> This should be { 33, 43 }\n>>>>>\n>>>>>> +     { 37, 47 },     /* 7: light grey, map to white */\n>>>>>\n>>>>> The entries below are redundant.\n>>>>>\n>>>>>> +     { 37, 47 },     /* 8: bright, map to white */\n>>>>>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>>>>>> +     { 32, 42 },     /* A: light green, map to green */\n>>>>>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>>>>>> +     { 31, 41 },     /* C: light red, map to red */\n>>>>>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>>>>>> +     { 33, 43 },     /* E: yellow */\n>>>>>> +     { 37, 47 },     /* F: white */\n>>>>>> +};\n>>>>>> +\n>>>>\n>>>> I'm not totally convinced about mapping extra colors that UEFI defines\n>>>> to bold.. unless you have some example of prior-art for this on other\n>>>> platforms.\n>>>\n>>> See\n>>> Standard ECMA-48 - Control Functions for Coded Character Sets\n>>> chapter 8.3.117 SGR - SELECT GRAPHIC RENDITION\n>>>\n>>> 1 - bold or increased intensity\n>>> 22 - normal colour or normal intensity (neither bold nor faint)\n>>>\n>>> You can easily experiment in your bash shell like this:\n>>>\n>>> printf \"\\x1b[1;32;40m bold \\x1b[22;32;40m normal\\x1b[22;39;49m\\n\";\n>>>\n>>> You will find that \"bold\" prints bold and bright in the KDE konsole and\n>>> xterm.\n>>\n>> but I think we don't want (potential) font changes, just color changes..\n>>\n>> if you can find the code in edk2 that does this, I guess it would be a\n>> reasonable precedent to follow.. but if not I wanted to avoid things\n>> that might be specific to particular terminal emulators, since I\n>> wasn't really looking forward to testing them all.  Otherwise I'd just\n>> rely on the extension that allowed 256 colors..\n>>\n>> BR,\n>> -R\n>\n> The same problem seems has led the EDK folks to a similar solution.\n>\n> See\n> MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c\n\nok, I'll have a closer look at that.. I don't feel badly about doing\nthe same thing that edk2 does when there is doubt ;-)\n\nBR,\n-R\n\n\n> Everything starts with this array:\n>\n> { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };\n>\n> The first '0' is replaced by either 0 or 1 depending on brightness.\n>\n> mSetAttributeString[BRIGHT_CONTROL_OFFSET] =\n>   (CHAR16) ('0' + BrightControl);\n>\n> The first '4', '0' is replaced by the foreground color.\n> The second '4', '0' is replaced by the background color.\n>\n> ECMA 48 says:\n>\n> 0 - default rendition, cancels the effect of any preceding SGR\n>\n> So you can use this instead of 22.\n>\n> Best regards\n>\n> Heinrich\n>\n>\n>>\n>>> Using colors 90-97 as foreground colors produces only bright but not\n>>> bold in the KDE konsole and xterm:\n>>>\n>>> printf \"\\x1b[92;40m bold \\x1b[32;40m normal\\x1b[22;39;49m\\n\";\n>>>\n>>> But these codes are not defined in ECMA-48.\n>>>\n>>> Best regards\n>>>\n>>> Heinrich\n>>>\n>>\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Go2YBgXK\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6tFQ0wb3z9t39\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 11:00:25 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid C0D3FC21DE9; Thu,  5 Oct 2017 00:00:20 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A8A0EC21D8D;\n\tThu,  5 Oct 2017 00:00:17 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 2592EC21D8D; Thu,  5 Oct 2017 00:00:16 +0000 (UTC)","from mail-lf0-f67.google.com (mail-lf0-f67.google.com\n\t[209.85.215.67])\n\tby lists.denx.de (Postfix) with ESMTPS id B514FC21C54\n\tfor <u-boot@lists.denx.de>; Thu,  5 Oct 2017 00:00:15 +0000 (UTC)","by mail-lf0-f67.google.com with SMTP id p184so14889872lfe.12\n\tfor <u-boot@lists.denx.de>; Wed, 04 Oct 2017 17:00:15 -0700 (PDT)","by 10.46.34.134 with HTTP; Wed, 4 Oct 2017 17:00:14 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=sJlJrglnrhgx5qX0vlS2TyNWpVPPZvTEX7qDtSEmgck=;\n\tb=Go2YBgXKg2d8fUMg55fl052+K8mr5Rl5MRpo1eBwnkZqxiGeuSIWZUFOpNddGX0ST5\n\tV2u4fSAvFko/135rjy/SWr8cE/vHKF/3piJN4Ac5U01xtYoNC6kLqbRvMyRtwmVmwW1m\n\t195leD2znRaXDpSmKdFpYdpIjHHwi1qV3tYksjQhcbSIZvuUQ5lTeClcF487wT3He3A3\n\tvZtADpfDpDChkTQdc93+ja1idabgVw/jO2ToDQQEIoGlJ4nb3gMBR849zjz+JsHTBFA0\n\tD8ceVSaAVFzo+mtIH+Wj49xHfATr5iwZIJ6tk1h68bWGyVhA+BlnZvbBiDZR08d9lQcH\n\tVofg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=sJlJrglnrhgx5qX0vlS2TyNWpVPPZvTEX7qDtSEmgck=;\n\tb=KpINUgFhN8fB1Rk91LN7mTIU3Yz56o12ikIhAutEiJkp+SRDcIAwQImiWkUtuF7RKK\n\t8H8zY6LXgNOsA2BpM8etlYc1gG81zge/dM1Lh0MF4u1XQ5IuzkH79lQsjjS88NXW49xj\n\t4PQtE3uk+GFGzfZ/7YkMKY6dX3u53Ex7JjS6MBwo5TaOZilnZOisTMBoSneAGD8Kai9W\n\tawxSlmsvAcPc4SzNNJ9E8olX+hJTuFVhb/2TxVVUnJWr6R7b8mFd+XonLJyvH7qIvuBR\n\tFJlIlXv70PTGnTa3suU5OHUjxl3lBex+Qeh4bv+2+PsFwO2jTwjwgQbAjrWczCrNrCWt\n\tVMUg==","X-Gm-Message-State":"AMCzsaUunHgBo3Pe1vQF7Sz6/IT0rENspdyJieZc0WlmCJEe5X4na/kN\n\tm7A7u4BpIjsFUZ75jthhfsECpnLtp+NNjY487NI=","X-Google-Smtp-Source":"AOwi7QDxn28uzc81qGUKuFSEWtLjG80BiopYbg5G7XFM5q3UTQmXO5H/UEc5Nl2CzJ9llvxpO+xUL/OXPpOctxxTi5U=","X-Received":"by 10.25.41.147 with SMTP id p141mr7012291lfp.56.1507161615062; \n\tWed, 04 Oct 2017 17:00:15 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<fd00ccb0-51ad-2c0c-8a83-06c47c0a190e@gmx.de>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>\n\t<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>\n\t<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>\n\t<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>\n\t<fd00ccb0-51ad-2c0c-8a83-06c47c0a190e@gmx.de>","From":"Rob Clark <robdclark@gmail.com>","Date":"Wed, 4 Oct 2017 20:00:14 -0400","Message-ID":"<CAF6AEGszcdU8+5S=uxtt7JUOrBeaU6hTznHoMkz66fJE+HORrA@mail.gmail.com>","To":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780209,"web_url":"http://patchwork.ozlabs.org/comment/1780209/","msgid":"<CAF6AEGvRfNZOMGwd0OXPGNZ58c1n2hy1Kexo7rV=5+iHCZF6MQ@mail.gmail.com>","list_archive_url":null,"date":"2017-10-05T00:12:46","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Wed, Oct 4, 2017 at 8:00 PM, Rob Clark <robdclark@gmail.com> wrote:\n> On Wed, Oct 4, 2017 at 7:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>> On 10/05/2017 01:19 AM, Rob Clark wrote:\n>>> On Wed, Oct 4, 2017 at 6:01 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>>> On 10/04/2017 10:54 PM, Rob Clark wrote:\n>>>>> On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>>>>> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>>>>>>> Shell.efi uses this, and supporting color attributes makes things look\n>>>>>>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>>>>>>> Not all colors have a perfect match, but spec just says \"Devices\n>>>>>>> supporting a different number of text colors are required to emulate the\n>>>>>>> above colors to the best of the device’s capabilities\".\n>>>>>>>\n>>>>>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>>>>>> ---\n>>>>>>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>>>>>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>>>>>>  2 files changed, 59 insertions(+)\n>>>>>>>\n>>>>>>> diff --git a/include/efi_api.h b/include/efi_api.h\n>>>>>>> index 87c8ffe68e..3cc1dbac2e 100644\n>>>>>>> --- a/include/efi_api.h\n>>>>>>> +++ b/include/efi_api.h\n>>>>>>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>>>>>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>>>>>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>>>>>>\n>>>>>>> +#define EFI_BLACK                0x00\n>>>>>>> +#define EFI_BLUE                 0x01\n>>>>>>> +#define EFI_GREEN                0x02\n>>>>>>> +#define EFI_CYAN                 0x03\n>>>>>>> +#define EFI_RED                  0x04\n>>>>>>> +#define EFI_MAGENTA              0x05\n>>>>>>> +#define EFI_BROWN                0x06\n>>>>>>> +#define EFI_LIGHTGRAY            0x07\n>>>>>>> +#define EFI_BRIGHT               0x08\n>>>>>>> +#define EFI_DARKGRAY             0x08\n>>>>>>> +#define EFI_LIGHTBLUE            0x09\n>>>>>>> +#define EFI_LIGHTGREEN           0x0a\n>>>>>>> +#define EFI_LIGHTCYAN            0x0b\n>>>>>>> +#define EFI_LIGHTRED             0x0c\n>>>>>>> +#define EFI_LIGHTMAGENTA         0x0d\n>>>>>>> +#define EFI_YELLOW               0x0e\n>>>>>>> +#define EFI_WHITE                0x0f\n>>>>>>> +#define EFI_BACKGROUND_BLACK     0x00\n>>>>>>> +#define EFI_BACKGROUND_BLUE      0x10\n>>>>>>> +#define EFI_BACKGROUND_GREEN     0x20\n>>>>>>> +#define EFI_BACKGROUND_CYAN      0x30\n>>>>>>> +#define EFI_BACKGROUND_RED       0x40\n>>>>>>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>>>>>>> +#define EFI_BACKGROUND_BROWN     0x60\n>>>>>>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>>>>>>\n>>>>>> Will we ever use these constants?\n>>>>>>\n>>>>>\n>>>>> possibly not, but it is useful to understand what is going on with\n>>>>> efi->ansi mapping, so I would prefer to keep them.\n>>>>>\n>>>>>>\n>>>>>> Where are the comments explaining the defines below?\n>>>>>>\n>>>>>>> +\n>>>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>>>>>>\n>>>>>> This saves 8 entries in the table below.\n>>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>>>>>>\n>>>>>>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>>>>>>\n>>>>>> Add\n>>>>>> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>>>>>>\n>>>>>>> +\n>>>>>>>  struct efi_simple_text_output_protocol {\n>>>>>>>       void *reset;\n>>>>>>>       efi_status_t (EFIAPI *output_string)(\n>>>>>>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>>>>>>> index 2e13fdc096..fcd65ca488 100644\n>>>>>>> --- a/lib/efi_loader/efi_console.c\n>>>>>>> +++ b/lib/efi_loader/efi_console.c\n>>>>>>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>>>>>>       return EFI_EXIT(EFI_SUCCESS);\n>>>>>>>  }\n>>>>>>>\n>>>>>>> +static const struct {\n>>>>>>> +     unsigned fg;\n>>>>>>> +     unsigned bg;\n>>>>>>> +} color[] = {\n>>>>>>> +     { 30, 40 },     /* 0: black */\n>>>>>>> +     { 34, 44 },     /* 1: blue */\n>>>>>>> +     { 32, 42 },     /* 2: green */\n>>>>>>> +     { 36, 46 },     /* 3: cyan */\n>>>>>>> +     { 31, 41 },     /* 4: red */\n>>>>>>> +     { 35, 45 },     /* 5: magenta */\n>>>>>>> +     { 30, 40 },     /* 6: brown, map to black */\n>>>>>>\n>>>>>> This should be { 33, 43 }\n>>>>>>\n>>>>>>> +     { 37, 47 },     /* 7: light grey, map to white */\n>>>>>>\n>>>>>> The entries below are redundant.\n>>>>>>\n>>>>>>> +     { 37, 47 },     /* 8: bright, map to white */\n>>>>>>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>>>>>>> +     { 32, 42 },     /* A: light green, map to green */\n>>>>>>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>>>>>>> +     { 31, 41 },     /* C: light red, map to red */\n>>>>>>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>>>>>>> +     { 33, 43 },     /* E: yellow */\n>>>>>>> +     { 37, 47 },     /* F: white */\n>>>>>>> +};\n>>>>>>> +\n>>>>>\n>>>>> I'm not totally convinced about mapping extra colors that UEFI defines\n>>>>> to bold.. unless you have some example of prior-art for this on other\n>>>>> platforms.\n>>>>\n>>>> See\n>>>> Standard ECMA-48 - Control Functions for Coded Character Sets\n>>>> chapter 8.3.117 SGR - SELECT GRAPHIC RENDITION\n>>>>\n>>>> 1 - bold or increased intensity\n>>>> 22 - normal colour or normal intensity (neither bold nor faint)\n>>>>\n>>>> You can easily experiment in your bash shell like this:\n>>>>\n>>>> printf \"\\x1b[1;32;40m bold \\x1b[22;32;40m normal\\x1b[22;39;49m\\n\";\n>>>>\n>>>> You will find that \"bold\" prints bold and bright in the KDE konsole and\n>>>> xterm.\n>>>\n>>> but I think we don't want (potential) font changes, just color changes..\n>>>\n>>> if you can find the code in edk2 that does this, I guess it would be a\n>>> reasonable precedent to follow.. but if not I wanted to avoid things\n>>> that might be specific to particular terminal emulators, since I\n>>> wasn't really looking forward to testing them all.  Otherwise I'd just\n>>> rely on the extension that allowed 256 colors..\n>>>\n>>> BR,\n>>> -R\n>>\n>> The same problem seems has led the EDK folks to a similar solution.\n>>\n>> See\n>> MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c\n>\n> ok, I'll have a closer look at that.. I don't feel badly about doing\n> the same thing that edk2 does when there is doubt ;-)\n\nhmm, the semi-annoying thing will be to have to implement the\nvidconsole-uclass side of this.. I suppose I could ignore anything\nother than 0 (normal) and 1 (bold).  Reverse wouldn't be too hard, but\nblink would be hard I think without timer interrupts (same reason that\nI didn't implement cursor yet)\n\n> BR,\n> -R\n>\n>\n>> Everything starts with this array:\n>>\n>> { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };\n>>\n>> The first '0' is replaced by either 0 or 1 depending on brightness.\n>>\n>> mSetAttributeString[BRIGHT_CONTROL_OFFSET] =\n>>   (CHAR16) ('0' + BrightControl);\n>>\n>> The first '4', '0' is replaced by the foreground color.\n>> The second '4', '0' is replaced by the background color.\n>>\n>> ECMA 48 says:\n>>\n>> 0 - default rendition, cancels the effect of any preceding SGR\n>>\n>> So you can use this instead of 22.\n>>\n>> Best regards\n>>\n>> Heinrich\n>>\n>>\n>>>\n>>>> Using colors 90-97 as foreground colors produces only bright but not\n>>>> bold in the KDE konsole and xterm:\n>>>>\n>>>> printf \"\\x1b[92;40m bold \\x1b[32;40m normal\\x1b[22;39;49m\\n\";\n>>>>\n>>>> But these codes are not defined in ECMA-48.\n>>>>\n>>>> Best regards\n>>>>\n>>>> Heinrich\n>>>>\n>>>\n>>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"jezg68OU\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6tWx5kPdz9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 11:13:01 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid 83382C21EC3; Thu,  5 Oct 2017 00:12:57 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 5F22EC21D8D;\n\tThu,  5 Oct 2017 00:12:52 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 2FC94C21C26; Thu,  5 Oct 2017 00:12:51 +0000 (UTC)","from mail-lf0-f65.google.com (mail-lf0-f65.google.com\n\t[209.85.215.65])\n\tby lists.denx.de (Postfix) with ESMTPS id ABBF3C21C54\n\tfor <u-boot@lists.denx.de>; Thu,  5 Oct 2017 00:12:47 +0000 (UTC)","by mail-lf0-f65.google.com with SMTP id o125so10581794lfe.0\n\tfor <u-boot@lists.denx.de>; Wed, 04 Oct 2017 17:12:47 -0700 (PDT)","by 10.46.34.134 with HTTP; Wed, 4 Oct 2017 17:12:46 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=2PYq0mXtUBO/rRde66cpwdMzvX5FIUawh+/c0yanlQI=;\n\tb=jezg68OURppSu3BaWBHRxscWOv2zTqh4WK59JLHn+QcpRCVXEqB/hbbAlSP6ayS4Ub\n\tN2dARgtWdqk6VaDmf3uW8NJ98V1NOpa7+GhgF49BtnFz2RviF09LOI4qyxnOHJQtgA7g\n\t41LwTKQ2amW6NdGxMd96tmGQGwhtyhoqa3eS4YmZtE1xpo4FNvfVTPyzibYap1qQ+aSu\n\t1xbhMizTW/d/vbCWC/2Y8uJsvvDF8JWxK7Ec4YBs5C7YbxPl0IuZcVT3IEaS02ZwjwDm\n\tkgtpHmyvCFvPZYcV0+N9YP+8e5RlW6KAWA3rWY1HIazKZkusIbGrUGZu0YNmuBcqAzzW\n\tIT2g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=2PYq0mXtUBO/rRde66cpwdMzvX5FIUawh+/c0yanlQI=;\n\tb=KC+KWdpQSBeCCvFMuIhJFSOjfOGYZD1U7BDBBoUqjYUq3qDiatq8p1H4QXfdZFCRv6\n\thXLymtS09gJBXIkI8oLmOgFxmtXYFZsm4Ne3tWyVfY9mq0kcjr5MZarbGYCqmodPUAg4\n\tggK8p2oSRNOa56ogtx/WlbMtzyrPT0nXQUYK1cmI7HBLj1hjPYBB/JY01/zr/a9mv9dC\n\tkCn4dDW9JDBpTlZxBSbG6oOGzxyRTOmxq74qWmqvtKqW9zGJYsAIwPmO1pwDd0D+eiZx\n\tCcn9QoGB8KYmKn5+I2Ajq63xWJ8jNVpOLS1DnRzyK7mwdfZyFGIYq+HZGheTugwayFVN\n\tDU2Q==","X-Gm-Message-State":"AMCzsaXsdSpYEC3PhDC7hkegNfT/EqTMx+fNFZDNMEtxtgc+OPyqhOTf\n\tIM0cf6od3l7gPCU9ACZbWeRSO22pX6dvjgWQnMc=","X-Google-Smtp-Source":"AOwi7QDM4LiJTUqAwRYx8Qji2M5sHv4TIrZjAt4Xxj2gpqxQiNCN15QRRKmN/L5NL156pBkfiXkazDCasDfH5TQ7CR4=","X-Received":"by 10.25.21.233 with SMTP id 102mr4681560lfv.252.1507162367078; \n\tWed, 04 Oct 2017 17:12:47 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAF6AEGszcdU8+5S=uxtt7JUOrBeaU6hTznHoMkz66fJE+HORrA@mail.gmail.com>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>\n\t<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>\n\t<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>\n\t<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>\n\t<fd00ccb0-51ad-2c0c-8a83-06c47c0a190e@gmx.de>\n\t<CAF6AEGszcdU8+5S=uxtt7JUOrBeaU6hTznHoMkz66fJE+HORrA@mail.gmail.com>","From":"Rob Clark <robdclark@gmail.com>","Date":"Wed, 4 Oct 2017 20:12:46 -0400","Message-ID":"<CAF6AEGvRfNZOMGwd0OXPGNZ58c1n2hy1Kexo7rV=5+iHCZF6MQ@mail.gmail.com>","To":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1780222,"web_url":"http://patchwork.ozlabs.org/comment/1780222/","msgid":"<26f6a158-f379-0102-36d9-9712a0339cbb@gmx.de>","list_archive_url":null,"date":"2017-10-05T00:33:00","subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"content":"On 10/05/2017 02:12 AM, Rob Clark wrote:\n> On Wed, Oct 4, 2017 at 8:00 PM, Rob Clark <robdclark@gmail.com> wrote:\n>> On Wed, Oct 4, 2017 at 7:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>> On 10/05/2017 01:19 AM, Rob Clark wrote:\n>>>> On Wed, Oct 4, 2017 at 6:01 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>>>> On 10/04/2017 10:54 PM, Rob Clark wrote:\n>>>>>> On Wed, Oct 4, 2017 at 2:53 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:\n>>>>>>> On 09/10/2017 03:22 PM, Rob Clark wrote:\n>>>>>>>> Shell.efi uses this, and supporting color attributes makes things look\n>>>>>>>> nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\n>>>>>>>> Not all colors have a perfect match, but spec just says \"Devices\n>>>>>>>> supporting a different number of text colors are required to emulate the\n>>>>>>>> above colors to the best of the device’s capabilities\".\n>>>>>>>>\n>>>>>>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>>>>>>> ---\n>>>>>>>>  include/efi_api.h            | 29 +++++++++++++++++++++++++++++\n>>>>>>>>  lib/efi_loader/efi_console.c | 30 ++++++++++++++++++++++++++++++\n>>>>>>>>  2 files changed, 59 insertions(+)\n>>>>>>>>\n>>>>>>>> diff --git a/include/efi_api.h b/include/efi_api.h\n>>>>>>>> index 87c8ffe68e..3cc1dbac2e 100644\n>>>>>>>> --- a/include/efi_api.h\n>>>>>>>> +++ b/include/efi_api.h\n>>>>>>>> @@ -426,6 +426,35 @@ struct simple_text_output_mode {\n>>>>>>>>       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \\\n>>>>>>>>                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)\n>>>>>>>>\n>>>>>>>> +#define EFI_BLACK                0x00\n>>>>>>>> +#define EFI_BLUE                 0x01\n>>>>>>>> +#define EFI_GREEN                0x02\n>>>>>>>> +#define EFI_CYAN                 0x03\n>>>>>>>> +#define EFI_RED                  0x04\n>>>>>>>> +#define EFI_MAGENTA              0x05\n>>>>>>>> +#define EFI_BROWN                0x06\n>>>>>>>> +#define EFI_LIGHTGRAY            0x07\n>>>>>>>> +#define EFI_BRIGHT               0x08\n>>>>>>>> +#define EFI_DARKGRAY             0x08\n>>>>>>>> +#define EFI_LIGHTBLUE            0x09\n>>>>>>>> +#define EFI_LIGHTGREEN           0x0a\n>>>>>>>> +#define EFI_LIGHTCYAN            0x0b\n>>>>>>>> +#define EFI_LIGHTRED             0x0c\n>>>>>>>> +#define EFI_LIGHTMAGENTA         0x0d\n>>>>>>>> +#define EFI_YELLOW               0x0e\n>>>>>>>> +#define EFI_WHITE                0x0f\n>>>>>>>> +#define EFI_BACKGROUND_BLACK     0x00\n>>>>>>>> +#define EFI_BACKGROUND_BLUE      0x10\n>>>>>>>> +#define EFI_BACKGROUND_GREEN     0x20\n>>>>>>>> +#define EFI_BACKGROUND_CYAN      0x30\n>>>>>>>> +#define EFI_BACKGROUND_RED       0x40\n>>>>>>>> +#define EFI_BACKGROUND_MAGENTA   0x50\n>>>>>>>> +#define EFI_BACKGROUND_BROWN     0x60\n>>>>>>>> +#define EFI_BACKGROUND_LIGHTGRAY 0x70\n>>>>>>>\n>>>>>>> Will we ever use these constants?\n>>>>>>>\n>>>>>>\n>>>>>> possibly not, but it is useful to understand what is going on with\n>>>>>> efi->ansi mapping, so I would prefer to keep them.\n>>>>>>\n>>>>>>>\n>>>>>>> Where are the comments explaining the defines below?\n>>>>>>>\n>>>>>>>> +\n>>>>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n>>>>>>>\n>>>>>>> This saves 8 entries in the table below.\n>>>>>>> +#define EFI_ATTR_FG(attr)        ((attr) & 0x07)\n>>>>>>>\n>>>>>>>> +#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n>>>>>>>\n>>>>>>> Add\n>>>>>>> #define EFI_ATTR_BOLD(attr) (((attr) >> 3) & 0x01)\n>>>>>>>\n>>>>>>>> +\n>>>>>>>>  struct efi_simple_text_output_protocol {\n>>>>>>>>       void *reset;\n>>>>>>>>       efi_status_t (EFIAPI *output_string)(\n>>>>>>>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\n>>>>>>>> index 2e13fdc096..fcd65ca488 100644\n>>>>>>>> --- a/lib/efi_loader/efi_console.c\n>>>>>>>> +++ b/lib/efi_loader/efi_console.c\n>>>>>>>> @@ -316,12 +316,42 @@ static efi_status_t EFIAPI efi_cout_set_mode(\n>>>>>>>>       return EFI_EXIT(EFI_SUCCESS);\n>>>>>>>>  }\n>>>>>>>>\n>>>>>>>> +static const struct {\n>>>>>>>> +     unsigned fg;\n>>>>>>>> +     unsigned bg;\n>>>>>>>> +} color[] = {\n>>>>>>>> +     { 30, 40 },     /* 0: black */\n>>>>>>>> +     { 34, 44 },     /* 1: blue */\n>>>>>>>> +     { 32, 42 },     /* 2: green */\n>>>>>>>> +     { 36, 46 },     /* 3: cyan */\n>>>>>>>> +     { 31, 41 },     /* 4: red */\n>>>>>>>> +     { 35, 45 },     /* 5: magenta */\n>>>>>>>> +     { 30, 40 },     /* 6: brown, map to black */\n>>>>>>>\n>>>>>>> This should be { 33, 43 }\n>>>>>>>\n>>>>>>>> +     { 37, 47 },     /* 7: light grey, map to white */\n>>>>>>>\n>>>>>>> The entries below are redundant.\n>>>>>>>\n>>>>>>>> +     { 37, 47 },     /* 8: bright, map to white */\n>>>>>>>> +     { 34, 44 },     /* 9: light blue, map to blue */\n>>>>>>>> +     { 32, 42 },     /* A: light green, map to green */\n>>>>>>>> +     { 36, 46 },     /* B: light cyan, map to cyan */\n>>>>>>>> +     { 31, 41 },     /* C: light red, map to red */\n>>>>>>>> +     { 35, 45 },     /* D: light magenta, map to magenta */\n>>>>>>>> +     { 33, 43 },     /* E: yellow */\n>>>>>>>> +     { 37, 47 },     /* F: white */\n>>>>>>>> +};\n>>>>>>>> +\n>>>>>>\n>>>>>> I'm not totally convinced about mapping extra colors that UEFI defines\n>>>>>> to bold.. unless you have some example of prior-art for this on other\n>>>>>> platforms.\n>>>>>\n>>>>> See\n>>>>> Standard ECMA-48 - Control Functions for Coded Character Sets\n>>>>> chapter 8.3.117 SGR - SELECT GRAPHIC RENDITION\n>>>>>\n>>>>> 1 - bold or increased intensity\n>>>>> 22 - normal colour or normal intensity (neither bold nor faint)\n>>>>>\n>>>>> You can easily experiment in your bash shell like this:\n>>>>>\n>>>>> printf \"\\x1b[1;32;40m bold \\x1b[22;32;40m normal\\x1b[22;39;49m\\n\";\n>>>>>\n>>>>> You will find that \"bold\" prints bold and bright in the KDE konsole and\n>>>>> xterm.\n>>>>\n>>>> but I think we don't want (potential) font changes, just color changes..\n>>>>\n>>>> if you can find the code in edk2 that does this, I guess it would be a\n>>>> reasonable precedent to follow.. but if not I wanted to avoid things\n>>>> that might be specific to particular terminal emulators, since I\n>>>> wasn't really looking forward to testing them all.  Otherwise I'd just\n>>>> rely on the extension that allowed 256 colors..\n>>>>\n>>>> BR,\n>>>> -R\n>>>\n>>> The same problem seems has led the EDK folks to a similar solution.\n>>>\n>>> See\n>>> MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c\n>>\n>> ok, I'll have a closer look at that.. I don't feel badly about doing\n>> the same thing that edk2 does when there is doubt ;-)\n> \n> hmm, the semi-annoying thing will be to have to implement the\n> vidconsole-uclass side of this.. I suppose I could ignore anything\n> other than 0 (normal) and 1 (bold).  Reverse wouldn't be too hard, but\n> blink would be hard I think without timer interrupts (same reason that\n> I didn't implement cursor yet)\n\nIt is not necessary that a cursor is blinking. The KDE konsole only has\na filled block (something like Unicode U+2588). For the colors you can\nuse a RGB lookup table. EDK uses these colors:\n\nEFI_GRAPHICS_OUTPUT_BLT_PIXEL        mGraphicsEfiColors[16] = {\n  //\n  // B    G    R   reserved\n  //\n  {0x00, 0x00, 0x00, 0x00},  // BLACK\n  {0x98, 0x00, 0x00, 0x00},  // LIGHTBLUE\n  {0x00, 0x98, 0x00, 0x00},  // LIGHGREEN\n  {0x98, 0x98, 0x00, 0x00},  // LIGHCYAN\n  {0x00, 0x00, 0x98, 0x00},  // LIGHRED\n  {0x98, 0x00, 0x98, 0x00},  // MAGENTA\n  {0x00, 0x98, 0x98, 0x00},  // BROWN\n  {0x98, 0x98, 0x98, 0x00},  // LIGHTGRAY\n  {0x30, 0x30, 0x30, 0x00},  // DARKGRAY - BRIGHT BLACK\n  {0xff, 0x00, 0x00, 0x00},  // BLUE\n  {0x00, 0xff, 0x00, 0x00},  // LIME\n  {0xff, 0xff, 0x00, 0x00},  // CYAN\n  {0x00, 0x00, 0xff, 0x00},  // RED\n  {0xff, 0x00, 0xff, 0x00},  // FUCHSIA\n  {0x00, 0xff, 0xff, 0x00},  // YELLOW\n  {0xff, 0xff, 0xff, 0x00}   // WHITE\n};\n\nOracle prefers darker colors and brighter grays:\nhttps://docs.oracle.com/cd/E19728-01/820-2550/term_em_colormaps.html\n\nBest regards\n\nHeinrich\n\n> \n>> BR,\n>> -R\n>>\n>>\n>>> Everything starts with this array:\n>>>\n>>> { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };\n>>>\n>>> The first '0' is replaced by either 0 or 1 depending on brightness.\n>>>\n>>> mSetAttributeString[BRIGHT_CONTROL_OFFSET] =\n>>>   (CHAR16) ('0' + BrightControl);\n>>>\n>>> The first '4', '0' is replaced by the foreground color.\n>>> The second '4', '0' is replaced by the background color.\n>>>\n>>> ECMA 48 says:\n>>>\n>>> 0 - default rendition, cancels the effect of any preceding SGR\n>>>\n>>> So you can use this instead of 22.\n>>>\n>>> Best regards\n>>>\n>>> Heinrich\n>>>\n>>>\n>>>>\n>>>>> Using colors 90-97 as foreground colors produces only bright but not\n>>>>> bold in the KDE konsole and xterm:\n>>>>>\n>>>>> printf \"\\x1b[92;40m bold \\x1b[32;40m normal\\x1b[22;39;49m\\n\";\n>>>>>\n>>>>> But these codes are not defined in ECMA-48.\n>>>>>\n>>>>> Best regards\n>>>>>\n>>>>> Heinrich\n>>>>>\n>>>>\n>>>\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y6v1v0hyJz9t2S\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 11:35:29 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid E524FC21E90; Thu,  5 Oct 2017 00:35:24 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 541D3C21D8D;\n\tThu,  5 Oct 2017 00:35:20 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid AEE34C21D8D; Thu,  5 Oct 2017 00:35:18 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.15.15])\n\tby lists.denx.de (Postfix) with ESMTPS id 5B8EEC21C54\n\tfor <u-boot@lists.denx.de>; Thu,  5 Oct 2017 00:35:18 +0000 (UTC)","from [192.168.123.82] ([94.114.42.150]) by mail.gmx.com (mrgmx002\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t0MC4VE-1e8fYQ3yPw-008vV8; Thu, 05 Oct 2017 02:35:07 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=FREEMAIL_FROM\n\tautolearn=unavailable autolearn_force=no version=3.4.0","To":"Rob Clark <robdclark@gmail.com>","References":"<20170910132236.14318-1-robdclark@gmail.com>\n\t<20170910132236.14318-9-robdclark@gmail.com>\n\t<d9f8f47f-de87-1995-caa0-51108b1e699e@gmx.de>\n\t<CAF6AEGtM1DH_u8p25XXq3RyjMA2N0n0j6TB61=HS2Oa06KdmZQ@mail.gmail.com>\n\t<6f91564b-2458-22cb-1432-1cf560eb05c4@gmx.de>\n\t<CAF6AEGtJfdb-TMd5_iZqzmwqvEzsJG2jp5y+D10oEH9y7ke8Xw@mail.gmail.com>\n\t<fd00ccb0-51ad-2c0c-8a83-06c47c0a190e@gmx.de>\n\t<CAF6AEGszcdU8+5S=uxtt7JUOrBeaU6hTznHoMkz66fJE+HORrA@mail.gmail.com>\n\t<CAF6AEGvRfNZOMGwd0OXPGNZ58c1n2hy1Kexo7rV=5+iHCZF6MQ@mail.gmail.com>","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","Message-ID":"<26f6a158-f379-0102-36d9-9712a0339cbb@gmx.de>","Date":"Thu, 5 Oct 2017 02:33:00 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<CAF6AEGvRfNZOMGwd0OXPGNZ58c1n2hy1Kexo7rV=5+iHCZF6MQ@mail.gmail.com>","Content-Language":"en-US","X-Provags-ID":"V03:K0:GuFe6Ba+LxNWki/vf9FPPbNYRDH4Y5q7NuWzVgTQXJ3vJuYMk94\n\tgnmhd2j1YbOdi2UtYOvDZyJ96B9cbh+sOL6KfVM/o8GM1aDwhLwIibKRkJMyiiqlnN9VfVP\n\tjWNStk6gyBKvhGyrzw2SvBbLTHm+FMQGLLE5Lzx4deNkcO6ZfiCHkNPUNvN4EQcMXHobYZj\n\t3HlMdh7L6iYbVaLmevXQA==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:sqpsztvIg70=:hkCmgvHdbKOcJWOk+B3Tc0\n\tH3yGF+d1LW6ZaDopMxSMOtDKCbqMK2IrxWd8kVHjBlNOlo8Z7MOu8K7nbaMPWooFU6kbXOCX4\n\tdImJ1rlGelGmO0aeXXutj8X0ZxvqEajSCyEVvAoV6SHL7t+dG69evIHKQunaLJwwaaOOFDl81\n\ttPvviPGWuDVdBmJLwec3lOfKlXexmkYSpNUE/ohIfMZbfTVFCd9VfWryu8BHsOrUPZINORyNw\n\t9S7+Jnv9aL2toZ1HRTki/YuuW05JfjRiJoA9kQu70geVBRtqr/bdWdud6F0jKVBWXf+7YtF2q\n\tb7OjLLECfL889E389/0P8sjknk33cm/gt+vkhAw3TqhYwrbJXvT5QV/9sYKB4XEHTp2a1J43j\n\tZKmgkE7EMnxjJUQCTz6WLk1ScaDDUj1J1WndBhOmBvIPRP8PVLaSYMMEOxzWa68KmsKj8c6Nu\n\tzxaQ7QMnmm9tDngr4s+7QV2A4jMXOTWh4E01g0KdcAZd36bbqRgntuf3VjeC8VDrdZrSXD0sR\n\tyuXK8KvZJhHQ3yZHkaz89OXYyUkWaF3n00+1MhvVrCnf8GUGeTnuZtMau68srUC8IFtAl8gUR\n\tLBpprA0G/Zc+ohGRxCx2fv0RNSKYAlR/zYiHohfbMJ9Sx+72qJg/0YA+Ymti1IwSR+yRhxTlh\n\tFFd94GbqohUa8nkF4ujCX9M2jhJkmP3JDiPAslzzIAzuaru7JQkJN1aKN5wZTVNlNrkRzN5dI\n\t9oUorE+CF2jAvrXh3eHi0lyIlXhFAmKku0R4PhhIdpWGuq+EpkMndyaBrVQyQFZAmd6K1Yr0z\n\tHgs3fRVr0miO91wDLQ7ywCD65ODh6U5w8oVrTXPQJxW5v2XxSc=","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tPeter Jones <pjones@redhat.com>, \n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"Re: [U-Boot] [PATCH v1 08/12] efi_loader: console support for color\n\tattributes","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]