From patchwork Sun Sep 10 13:22:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 112153 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2583760qgf; Sun, 10 Sep 2017 06:25:09 -0700 (PDT) X-Received: by 10.80.216.11 with SMTP id o11mr7097141edj.183.1505049908948; Sun, 10 Sep 2017 06:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505049908; cv=none; d=google.com; s=arc-20160816; b=AnAipuSPOZKfwUMPoRFMC5wIVsmONI+vdzRjeYQkJU/7V7FqER+GfSw5rJSpE7nKST XGqiz049qKldD1m8DyGMYRy/gjwnm2MoziANrlleoz1+omsfqgbwiVwcGRtPR0HBEBgC cpq0kqbWs2HJ+EtKcoTJqnpf/vStV21F9nr1vaVBE87BIVD7ez6TC48Uuf4yxLgIvpdN /xophHBSgAI0Tig/OdH7vNk+vJmWvQmdM2v9xDMAAJJRLMUoD6wEsi39HQTv89haOvL3 7mrSVwQgDUgMuqYQnEyIvg8zCsxlh2h+G6eEzUEXdeuHp7EoakW/heR9eBYzAwMI4Wov WuMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=kFvwtbfOuwwfONnbcwfmPrTD+/cX397irOLz9cjxdAY=; b=H5lDpaX3L55N3imjCqtNOp3/05/4aQcydyC/EAcNpZeTxEvPmi7Qn1UnXfI+BskinA UFiiosXmKamUQYKK4I+2a//epxvE2eP91due3qSPlpkPXvSM4NZE6XbkUmDF3bbYrE/w omnus7jzhKczWiikqVxfTJn8/wvxhCf4WCy/e61/UWy+ZgI+odqp6RabQh25gNo6BdK8 lhiN5SjFnItXuDjURbeX6YvBgFs3IwANuX/Ufcap79CaCFwIvccXEAjJyyI2Er669mcL 1LDG4+h3Bk0bwZaCMYQ+sc/rxDSFyQnRTasXKnFcTd2VvigV3YRECKhNsBo/Qsas+wq4 v5TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=MqLl4sid; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id m12si4453733eda.230.2017.09.10.06.25.08; Sun, 10 Sep 2017 06:25:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=MqLl4sid; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: by lists.denx.de (Postfix, from userid 105) id 7F61BC21F8C; Sun, 10 Sep 2017 13:24:11 +0000 (UTC) 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, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 08FB2C21F36; Sun, 10 Sep 2017 13:23:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 48AF5C21F26; Sun, 10 Sep 2017 13:22:56 +0000 (UTC) Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) by lists.denx.de (Postfix) with ESMTPS id D9C68C21F28 for ; Sun, 10 Sep 2017 13:22:52 +0000 (UTC) Received: by mail-qk0-f195.google.com with SMTP id o77so4071010qke.2 for ; Sun, 10 Sep 2017 06:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VLevONSjqVfJnJYbW80jG7Q8IPFI4445jP68p46tfd8=; b=MqLl4sidANuOu0wL+dSmtMfpAgkVsBfnyYwxwlRB2OvCfn6uYzB/+BXIoJSoK0scz+ o7oRjqngmajVnisRoWhmRxppbvdujY9hrpw8hXL9D223XzyJurp0oNtpOieXtkXg/yBR VGZJm6Z6Tp1SLYmOmmtkNVXeHZ+MeGvfbkvwfW8W9tP1+QUVsctJvU8H10hH2PDAUarO dVhTxWpvp0U2gvszi2lJ0NIqfgVRnT4vrFdfvHztGjnOTb2oiHgCXZFNn8j7V2AWgRTq I8vgRP7dMPwaJ0QeKhzhOQGdbEEc0Ux/2n+LFRc4HjeyLdR81ezEOGksRovC5KLXCSka PKpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VLevONSjqVfJnJYbW80jG7Q8IPFI4445jP68p46tfd8=; b=DSn9bSzdCYkiUk/uD818Fa+ioHzIUxtv/z4liWYsxxxliANXdCM3J6gf322P99Sdqg k45vzdq4KikrPkCbYaiGdXkx/Hx/xYhz8EVdlC03vR/sniUvOkhukJRvQXnRTnBCWiZA uIfrwJFqwZOW9IH9JkG1GSokXGzFI2wZrp3LPfjBTcwgDC3FA6dyl6ySrD9jxZsUH+4Y l1DOH+vrmfHHF5sRvXA2U1VAkV3D5Brn/aABb9yek7ecnTE0Lm0aD+zbrWB7m2nflpZU q2Okq/dhzt9X4QkJx05tFgL8B39327eBYJQNJk3kEeZRnDdKH4wmoUKvM97SGa2J/SFx xz7g== X-Gm-Message-State: AHPjjUitKjnE38ZSM/hJzG0jNaspLny4EombCWz4ylGaKuQ0oNMOypH0 z6eUBGkoe3frWJL9rPI= X-Google-Smtp-Source: AOwi7QBUCPG9ToHMC0FUSwAAxiEloVwfStWv94EJ/s0ISrdNypi27I+h6WsRq72F78ln2/k6YadFSQ== X-Received: by 10.55.49.73 with SMTP id x70mr12162302qkx.238.1505049771587; Sun, 10 Sep 2017 06:22:51 -0700 (PDT) Received: from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a]) by smtp.gmail.com with ESMTPSA id 48sm4538925qty.29.2017.09.10.06.22.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Sep 2017 06:22:50 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Sun, 10 Sep 2017 09:22:24 -0400 Message-Id: <20170910132236.14318-4-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> Cc: Heinrich Schuchardt , Peter Jones , Leif Lindholm Subject: [U-Boot] [PATCH v1 03/12] efi_loader: add EFI_UNICODE_COLLATION_PROTOCOL stub X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Leif Lindholm Signed-off-by: Leif Lindholm --- include/efi_api.h | 33 +++++++++++++++++++ include/efi_loader.h | 2 ++ lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_boottime.c | 3 ++ lib/efi_loader/efi_unicode.c | 73 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 lib/efi_loader/efi_unicode.c diff --git a/include/efi_api.h b/include/efi_api.h index 932a3429a8..25f774f253 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -740,6 +740,39 @@ struct efi_hii_string_protocol UINTN *secondary_languages_size); }; +#define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \ + EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \ + 0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49) + +struct efi_unicode_collation_protocol +{ + INTN(EFIAPI *stri_coll)( + struct efi_unicode_collation_protocol *this, + efi_string_t s1, + efi_string_t s2); + bool(EFIAPI *metai_match)( + struct efi_unicode_collation_protocol *this, + efi_string_t string, + efi_string_t pattern); + void(EFIAPI *str_lwr)( + struct efi_unicode_collation_protocol *this, + efi_string_t string); + void(EFIAPI *str_upr)( + struct efi_unicode_collation_protocol *this, + efi_string_t string); + void(EFIAPI *fat_to_str)( + struct efi_unicode_collation_protocol *this, + UINTN fat_size, + uint8_t *fat, + efi_string_t string); + bool(EFIAPI *str_to_fat)( + struct efi_unicode_collation_protocol *this, + efi_string_t string, + UINTN fat_size, + uint8_t *fat); + uint8_t *supported_languages; +}; + #define EFI_GOP_GUID \ EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \ 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a) diff --git a/include/efi_loader.h b/include/efi_loader.h index a89bb2fcd9..6668338d0b 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -62,6 +62,7 @@ extern const struct efi_device_path_utilities_protocol efi_device_path_utilities extern const struct efi_hii_config_routing_protocol efi_hii_config_routing; extern const struct efi_hii_database_protocol efi_hii_database; extern const struct efi_hii_string_protocol efi_hii_string; +extern const struct efi_unicode_collation_protocol efi_unicode_collation; uint16_t *efi_dp_str(struct efi_device_path *dp); @@ -76,6 +77,7 @@ extern const efi_guid_t efi_guid_device_path_utilities_protocol; extern const efi_guid_t efi_guid_hii_config_routing_protocol; extern const efi_guid_t efi_guid_hii_database_protocol; extern const efi_guid_t efi_guid_hii_string_protocol; +extern const efi_guid_t efi_guid_unicode_collation_protocol2; extern unsigned int __efi_runtime_start, __efi_runtime_stop; extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index e8fd6823a3..82b703bb39 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -16,7 +16,7 @@ always := $(efiprogs-y) obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o -obj-y += efi_device_path_utilities.o efi_hii.o +obj-y += efi_device_path_utilities.o efi_hii.o efi_unicode.o obj-y += efi_file.o efi_variable.o efi_bootmgr.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 4d1a16051b..04358e8aca 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -788,6 +788,9 @@ void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *ob obj->protocols[7].guid = &efi_guid_hii_config_routing_protocol; obj->protocols[7].protocol_interface = (void *)&efi_hii_config_routing; + obj->protocols[8].guid = &efi_guid_unicode_collation_protocol2; + obj->protocols[8].protocol_interface = (void *)&efi_unicode_collation; + info->file_path = file_path; info->device_handle = efi_dp_find_obj(device_path, NULL); diff --git a/lib/efi_loader/efi_unicode.c b/lib/efi_loader/efi_unicode.c new file mode 100644 index 0000000000..fdf1a99812 --- /dev/null +++ b/lib/efi_loader/efi_unicode.c @@ -0,0 +1,73 @@ +/* +* EFI Unicode interface + * + * Copyright (c) 2017 Leif Lindholm + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +const efi_guid_t efi_guid_unicode_collation_protocol2 = + EFI_UNICODE_COLLATION_PROTOCOL2_GUID; + +INTN stri_coll(struct efi_unicode_collation_protocol *this, + efi_string_t s1, + efi_string_t s2) +{ + EFI_ENTRY("%p, \"%ls\", \"%ls\"", this, s1, s2); + return EFI_EXIT(0); +} + +bool metai_match(struct efi_unicode_collation_protocol *this, + efi_string_t string, + efi_string_t pattern) +{ + EFI_ENTRY("%p, \"%ls\", \"%ls\"", this, string, pattern); + return EFI_EXIT(false); +} + +void str_lwr(struct efi_unicode_collation_protocol *this, + efi_string_t string) +{ + EFI_ENTRY("%p, \"%ls\"", this, string); + EFI_EXIT(0); + return; +} + +void str_upr(struct efi_unicode_collation_protocol *this, + efi_string_t string) +{ + EFI_ENTRY("%p, \"%ls\"", this, string); + EFI_EXIT(0); + return; +} + +void fat_to_str(struct efi_unicode_collation_protocol *this, + UINTN fat_size, + uint8_t *fat, + efi_string_t string) +{ + EFI_ENTRY("%p, %lu, \"%s\", %p", this, fat_size, fat, string); + EFI_EXIT(0); + return; +} + +bool str_to_fat(struct efi_unicode_collation_protocol *this, + efi_string_t string, + UINTN fat_size, + uint8_t *fat) +{ + EFI_ENTRY("%p, \"%ls\", %lu, %p", this, string, fat_size, fat); + return EFI_EXIT(false); +} + +const struct efi_unicode_collation_protocol efi_unicode_collation = { + .stri_coll = stri_coll, + .metai_match = metai_match, + .str_lwr = str_lwr, + .str_upr = str_upr, + .fat_to_str = fat_to_str, + .str_to_fat = str_to_fat +};