{"id":812145,"url":"http://patchwork.ozlabs.org/api/patches/812145/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170910132236.14318-9-robdclark@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170910132236.14318-9-robdclark@gmail.com>","list_archive_url":null,"date":"2017-09-10T13:22:29","name":"[U-Boot,v1,08/12] efi_loader: console support for color attributes","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"adb8aac81ddbb3794e217864b165551a827540a6","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/?format=json","name":"Rob Clark","email":"robdclark@gmail.com"},"delegate":{"id":3400,"url":"http://patchwork.ozlabs.org/api/users/3400/?format=json","username":"agraf","first_name":"Alexander","last_name":"Graf","email":"agraf@suse.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170910132236.14318-9-robdclark@gmail.com/mbox/","series":[{"id":2401,"url":"http://patchwork.ozlabs.org/api/series/2401/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=2401","date":"2017-09-10T13:22:21","name":"efi_loader+video: support for Shell.efi","version":1,"mbox":"http://patchwork.ozlabs.org/series/2401/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812145/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812145/checks/","tags":{},"related":[],"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=\"atausQi1\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xqsMJ3cpWz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 23:28:28 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 3CCA3C21E8C; Sun, 10 Sep 2017 13:26:15 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 4E6E7C21F56;\n\tSun, 10 Sep 2017 13:24:04 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid E12C6C21F6C; Sun, 10 Sep 2017 13:23:19 +0000 (UTC)","from mail-qk0-f193.google.com (mail-qk0-f193.google.com\n\t[209.85.220.193])\n\tby lists.denx.de (Postfix) with ESMTPS id D0885C21F3C\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 13:23:10 +0000 (UTC)","by mail-qk0-f193.google.com with SMTP id d70so4071027qkc.1\n\tfor <u-boot@lists.denx.de>; Sun, 10 Sep 2017 06:23:10 -0700 (PDT)","from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\tg132sm4200279qke.11.2017.09.10.06.23.08\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 10 Sep 2017 06:23:08 -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_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=2xAWRAf/a5Nbxul9xbdSVE572q0Z9uMMhO3kG8dCpaQ=;\n\tb=atausQi1Lvynv6jduAI3c4iixa1xo0FH63k+tsLwIE/S5nHonxQgL/8oC+brfsez2Y\n\tDIYPcWjBFIU2QRKGOv9JgQYqAwq7wJICYWfHRq2jiSkOvzwzPSF3ct1UjfsC5liddC/h\n\tROTas5meLdeM/CHRf4suFrr1XYCnOazuoAH+hNM7dxA9Yt1/B6lDhjbnOQGyzNBGrBpg\n\t4L8EfO9lT6S4jQ70y9mFwt5PJPosu+itkQ0XFEYIWJNeV5m3GgU3v6fhtNt8DKXGacXd\n\tezK/zAoASjRf4urMNUC2VQ6pDll7bQ6MbGqPw4HFN0mvDtoTV+5Sq4T0T4qGQCgz2vXh\n\tfkXQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=2xAWRAf/a5Nbxul9xbdSVE572q0Z9uMMhO3kG8dCpaQ=;\n\tb=WI84A00J2Id8JL1A+wftxkJCJBR9BkGXXrMNR8YofHbccy/fS5sBnf6swMm070wj60\n\tGXQH+M2rJDkc8fNjIbHpPeTIYSPL4OmZ6HeY/dkRjCqvJbIUwy6zaNVsG2utehklX1ld\n\tH9ylXXBLzfHX05btKZA6oFTiA84/F5Si+xFqPN5zXrMBvlcjSQFz7spzu+sBCl2D7H1j\n\t2ciehyEFusjsF/vyybQSEbpgymf9G6zGqhHE8w26mT9D6g9gXQ2K+k/91L4WjwG68Yla\n\tK2V785XNZlGfk8Mo+obgin2Xa+PrZj8gE6mTsCkqOZX1jAlYkO7UvFqCY8w/Wrp7dLMj\n\t9qtg==","X-Gm-Message-State":"AHPjjUgtEi4yqNS9Wd8J3mjodG302E17BvoWVpVMhKpndiVb6OaESaww\n\tPjbr3gyNZN6M27AxWvI=","X-Google-Smtp-Source":"AOwi7QCaVHxsRAIof83mQSH9B/LZ2kW4tq6U1CeB25IEcMTHLkpoW/OjHIfsCA445m+VwxBsTfP+Yw==","X-Received":"by 10.55.76.196 with SMTP id z187mr11956889qka.100.1505049789483;\n\tSun, 10 Sep 2017 06:23:09 -0700 (PDT)","From":"Rob Clark <robdclark@gmail.com>","To":"U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Sun, 10 Sep 2017 09:22:29 -0400","Message-Id":"<20170910132236.14318-9-robdclark@gmail.com>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170910132236.14318-1-robdclark@gmail.com>","References":"<20170910132236.14318-1-robdclark@gmail.com>","MIME-Version":"1.0","Cc":"Heinrich Schuchardt <xypron.glpk@gmx.de>, Peter Jones <pjones@redhat.com>,\n\tLeif Lindholm <leif.lindholm@linaro.org>","Subject":"[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>"},"content":"Shell.efi uses this, and supporting color attributes makes things look\nnicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.\nNot all colors have a perfect match, but spec just says \"Devices\nsupporting a different number of text colors are required to emulate the\nabove colors to the best of the device’s capabilities\".\n\nSigned-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(+)","diff":"diff --git a/include/efi_api.h b/include/efi_api.h\nindex 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+\n+#define EFI_ATTR_FG(attr)        ((attr) & 0x0f)\n+#define EFI_ATTR_BG(attr)        (((attr) >> 4) & 0x7)\n+\n struct efi_simple_text_output_protocol {\n \tvoid *reset;\n \tefi_status_t (EFIAPI *output_string)(\ndiff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c\nindex 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+\t{ 37, 47 },     /* 7: light grey, map to white */\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 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+\n \tEFI_ENTRY(\"%p, %lx\", this, attribute);\n \n+\tif (attribute)\n+\t\tprintf(ESC\"[%u;%um\", color[fg].fg, color[bg].bg);\n+\telse\n+\t\tprintf(ESC\"[37;40m\");\n+\n \t/* Just ignore attributes (colors) for now */\n \treturn EFI_EXIT(EFI_UNSUPPORTED);\n }\n","prefixes":["U-Boot","v1","08/12"]}