From patchwork Sun Sep 10 13:22:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 112152 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2583558qgf; Sun, 10 Sep 2017 06:24:58 -0700 (PDT) X-Received: by 10.80.206.11 with SMTP id y11mr7264617edi.94.1505049898166; Sun, 10 Sep 2017 06:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505049898; cv=none; d=google.com; s=arc-20160816; b=OLs7yl4FkMVwPU68X3cx+wQDUUO9syuckOlVzTwezB7wlJuA9ft0b9shy/wqw6UKyQ LAU1zCqxFUq6WdVGRn70q6DSyUx7tEHGncUNXYxY9Q3CLFM5PEgBtJdVmGYKOh1TvE1u J6CC5bt726xmyzNbJTUl4nD52dMxXRKhEC870jW4gaOMBcPCsOcBUPPwKaJWT2McuBJF 7vNP5vAORjw3nCEFSbnTCUOiWOf/kejJG0a/0JynuB9ru936Cy8wHIxMFCCPEaiSkb03 Q11ijU7CJETGGloChFo4IBd46J2uOCCahggv4d5k4ohV1wKzqlO+PtWa6jRvMoVmCKgP ivug== 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=Rp+eM7vmWNV6+A2EHNMSjmoRFqhXldnA2YPDNWdZJ+Y=; b=E7SeVR+4wH+6G0ZwIZHA6T/KtlCe09H1QcG8geVt9r7JJJDdjsoDsSLd5QqPrZLO8d cnAkD2HtfheqoLn5a6XU7RV9moEAmxsmXBzoeArpi2IGXkMjvR7c69BaUpZuCc4e8JvH kuG7w3KB3ckc+X7JEPL0gRTbUNKUVh3HdD0WSHQb/pmxepVm3ukLE5PFqf6KXrMAtHOi pM5k5E//L5Lwx3WwsiQkVSkoaCkuT5F808YKeTerKJkGY2RktjvrnKl2LyuRTFXEgnHV c/E+OPX75/pXu1AfMPASG/77v551DjjP2IWcSYPKzVKwnvfYt4tWDbx4NjHLUNX6y8nZ A38A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cnTj3IX4; 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 w36si8005161edc.97.2017.09.10.06.24.57; Sun, 10 Sep 2017 06:24:58 -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=cnTj3IX4; 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 B04A2C21F21; Sun, 10 Sep 2017 13:23:45 +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 A5D56C21E40; Sun, 10 Sep 2017 13:23:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F01B3C21DEB; Sun, 10 Sep 2017 13:22:50 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by lists.denx.de (Postfix) with ESMTPS id ECC63C21EA9 for ; Sun, 10 Sep 2017 13:22:45 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id 7so4190460qtz.3 for ; Sun, 10 Sep 2017 06:22:45 -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=LemN/4krNFCT7o7M65iutcrbnjNiKuB/STSObMRxCqM=; b=cnTj3IX4hrwrtvNfIAGaggGHWgL57KskJNjNFw6tD2rMUYAvkYmYQJ/MHydIuswxjo 805l3L3TWDovdwtNEadVuYAfmQa2D7ARHaM99kGyK4T0prGZXhHG9anHSU966XjA/nrr BX9t33iCz6isTFT1iZp5i/qh0UFi9L9QIM6KAdaVFR0WjJOomHbIdaZ7b28DnbwH9mzd dxRNFF7qiUNDZKwP6vKGq4efgrXcLRft+XBpt8HKZL8wmoB2yljY61EjR3QCmtC5lwws deukzAZ5vl7JW/qXi0578xwpPkYVk7bEpaII2ODzEnaIzW8l8oaSW8oqsTmOT9xhLGXt nwTA== 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=LemN/4krNFCT7o7M65iutcrbnjNiKuB/STSObMRxCqM=; b=qic6I8l79oHzX9w0iORMWKgqrQtZ0dVEr9fzqr6QzgK26R+BbV2gaAqHcDPIRGYK+Y SFrku7TxyDoI41+MajSc8bH/GN1Hig7NZIzHtnI7u+SRRX0mrS7ia2JNw8/c1A4UlneV //mzR0vcKkn9IgAHAzy/ti449+jWik8RRu0Ylve1nPpuOdAX8DPXUpW9S5p28/Qbp4ze wPm75eYsAMzDOO1ZBZJlnVNXPyHOwqBvNi47gzoxtt+0b1LppPmR6WP886zNVQWQplAF suIBi2yAz9LqXVpxoIZOP7xTp+qN13AW/8MBig8qdaUxGXEC1tqDFw5z9JaDB0vLZI/U Lnhg== X-Gm-Message-State: AHPjjUikqU4EMJsP3ON4dqghDsDuJrk8BRnbynhN9TQ4WtUrhcoAlCml /gC3UmUk48V4ZNugUG8= X-Google-Smtp-Source: AOwi7QDMnsT27AC7mRHS7S8ysEDWpXaou6B9ratYeOw2y9Lpr/PhaUDZcM8qibQhMX+7VZhXJPGVUg== X-Received: by 10.200.26.123 with SMTP id q56mr5514604qtk.130.1505049764657; Sun, 10 Sep 2017 06:22:44 -0700 (PDT) Received: from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a]) by smtp.gmail.com with ESMTPSA id h58sm4438932qta.82.2017.09.10.06.22.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Sep 2017 06:22:43 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Sun, 10 Sep 2017 09:22:22 -0400 Message-Id: <20170910132236.14318-2-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 01/12] efi_loader: add stub EFI_DEVICE_PATH_UTILITIES_PROTOCOL 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 | 30 +++++++++++ include/efi_loader.h | 2 + lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_boottime.c | 4 ++ lib/efi_loader/efi_device_path_utilities.c | 83 ++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 lib/efi_loader/efi_device_path_utilities.c diff --git a/include/efi_api.h b/include/efi_api.h index c3b9032a48..57468dd972 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -506,6 +506,36 @@ struct efi_device_path_to_text_protocol bool allow_shortcuts); }; +#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \ + EFI_GUID(0x0379be4e, 0xd706, 0x437d, \ + 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4) + +struct efi_device_path_utilities_protocol +{ + UINTN(EFIAPI *get_device_path_size)( + const struct efi_device_path *device_path); + struct efi_device_path *(EFIAPI *duplicate_device_path)( + const struct efi_device_path *device_path); + struct efi_device_path *(EFIAPI *append_device_path)( + const struct efi_device_path *src1, + const struct efi_device_path *src2); + struct efi_device_path *(EFIAPI *append_device_node)( + const struct efi_device_path *device_path, + const struct efi_device_path *device_node); + struct efi_device_path *(EFIAPI *append_device_path_instance)( + const struct efi_device_path *device_path, + const struct efi_device_path *device_path_instance); + struct efi_device_path *(EFIAPI *get_next_device_path_instance)( + struct efi_device_path **device_path_instance, + UINTN *device_path_instance_size); + struct efi_device_path *(EFIAPI *create_device_node)( + uint8_t node_type, + uint8_t node_sub_type, + uint16_t node_length); + bool(EFIAPI *is_device_path_multi_instance)( + const struct efi_device_path *device_path); +}; + #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 43b12b94fa..c009828db9 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -58,6 +58,7 @@ extern const struct efi_simple_text_output_protocol efi_con_out; extern struct efi_simple_input_interface efi_con_in; extern const struct efi_console_control_protocol efi_console_control; extern const struct efi_device_path_to_text_protocol efi_device_path_to_text; +extern const struct efi_device_path_utilities_protocol efi_device_path_utilities; uint16_t *efi_dp_str(struct efi_device_path *dp); @@ -68,6 +69,7 @@ extern const efi_guid_t efi_guid_loaded_image; extern const efi_guid_t efi_guid_device_path_to_text_protocol; extern const efi_guid_t efi_simple_file_system_protocol_guid; extern const efi_guid_t efi_file_info_guid; +extern const efi_guid_t efi_guid_device_path_utilities_protocol; 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 930c0e218e..f5e69dd078 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -16,6 +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 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 3860feb79b..8bb243d673 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -775,6 +775,10 @@ void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *ob obj->protocols[3].protocol_interface = (void *)&efi_device_path_to_text; + obj->protocols[4].guid = &efi_guid_device_path_utilities_protocol; + obj->protocols[4].protocol_interface = + (void *)&efi_device_path_utilities; + info->file_path = file_path; info->device_handle = efi_dp_find_obj(device_path, NULL); diff --git a/lib/efi_loader/efi_device_path_utilities.c b/lib/efi_loader/efi_device_path_utilities.c new file mode 100644 index 0000000000..4b97080f35 --- /dev/null +++ b/lib/efi_loader/efi_device_path_utilities.c @@ -0,0 +1,83 @@ +/* + * EFI device path interface + * + * Copyright (c) 2017 Leif Lindholm + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +const efi_guid_t efi_guid_device_path_utilities_protocol = + EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID; + +static UINTN get_device_path_size(const struct efi_device_path *device_path) +{ + EFI_ENTRY("%p", device_path); + return EFI_EXIT(0); +} + +static struct efi_device_path *duplicate_device_path( + const struct efi_device_path *device_path) +{ + EFI_ENTRY("%p", device_path); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *append_device_path( + const struct efi_device_path *src1, + const struct efi_device_path *src2) +{ + EFI_ENTRY("%p, %p", src1, src2); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *append_device_node( + const struct efi_device_path *device_path, + const struct efi_device_path *device_node) +{ + EFI_ENTRY("%p, %p", device_path, device_node); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *append_device_path_instance( + const struct efi_device_path *device_path, + const struct efi_device_path *device_path_instance) +{ + EFI_ENTRY("%p, %p", device_path, device_path_instance); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *get_next_device_path_instance( + struct efi_device_path **device_path_instance, + UINTN *device_path_instance_size) +{ + EFI_ENTRY("%p, %p", device_path_instance, device_path_instance_size); + return EFI_EXIT(NULL); +} + +static struct efi_device_path *create_device_node( + uint8_t node_type, uint8_t node_sub_type, uint16_t node_length) +{ + EFI_ENTRY("%u, %u, %u", node_type, node_sub_type, node_length); + return EFI_EXIT(NULL); +} + +static bool is_device_path_multi_instance( + const struct efi_device_path *device_path) +{ + EFI_ENTRY("%p", device_path); + return EFI_EXIT(false); +} + +const struct efi_device_path_utilities_protocol efi_device_path_utilities = { + .get_device_path_size = get_device_path_size, + .duplicate_device_path = duplicate_device_path, + .append_device_path = append_device_path, + .append_device_node = append_device_node, + .append_device_path_instance = append_device_path_instance, + .get_next_device_path_instance = get_next_device_path_instance, + .create_device_node = create_device_node, + .is_device_path_multi_instance = is_device_path_multi_instance, +}; From patchwork Sun Sep 10 13:22:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 112151 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2581897qgf; Sun, 10 Sep 2017 06:23:22 -0700 (PDT) X-Received: by 10.80.143.67 with SMTP id 61mr7037915edy.290.1505049801996; Sun, 10 Sep 2017 06:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505049801; cv=none; d=google.com; s=arc-20160816; b=NMsInHFN6KpI+JTyXLIEnfziaeTLPXrNlk9NfQSxPx8UK+iiMObXUQp3WIka2goI6K QtHL9tkmhkx+4TyK1trbPBm8mRtI0j2mQaVSXpBhM6llxtU98blF18JNa1Xh51zMGWFt W8kfH+UK1UB7/Sy1HhdGpoUhwEmRjX89arr0ikTcR3MGLsTHfPvhGay9JTV9jCe52Ind aec1Wjhdy3w44hwiJURtO7aWxAswWGNpubCkOOI+i5lckrSp8vuDifAyDxnVrakjeL+L Tnr05NeR+jJyi+NN+6bK2nNUTBCIySo+CMKGCgUneiF/8vcWJP2Skkqxz9IPhLwEh4Kk rUYA== 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=75QbsYMdJGaqwuKuJEUhQloOOSv+IqlNoSU/RIJbFuE=; b=Cv0aMSfK/vE/7ygnMqxiC/6G34eBoypb2D50030wwW/rm17xJdH+TiQM+HdW6J4EgP YJ9veOy9JpfKpe8CRgUUqlXkpfwRIOYblTV+sL1V7Twu5GoEYVrRyht9QR7FR9jFfxNk rm9pCXAcngHbRDawF5zDUaS4pP8P/uvf6HSP4QR57f5wr/rF95rpxlHMjq2hM5YLu4Vk 3cC4UyLe16olZNqlOTs90LFBRDCSJBVOtBmnMudsjfrC4TkI52BiF+Bresh03S8LGW4i 73y1A+CDBtfhicULwpTgx41sLLG+BHteDy1i1tWqoW/q+WnKCdOcr0OhuuYqPvK9WmR7 I0BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=c3sdRb3v; 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 q2si6468350edd.140.2017.09.10.06.23.21; Sun, 10 Sep 2017 06:23:21 -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=c3sdRb3v; 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 96C61C21EA7; Sun, 10 Sep 2017 13:23:02 +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 281EEC21E57; Sun, 10 Sep 2017 13:22:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0B39DC21F0A; Sun, 10 Sep 2017 13:22:53 +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 A51C1C21E97 for ; Sun, 10 Sep 2017 13:22:49 +0000 (UTC) Received: by mail-qk0-f195.google.com with SMTP id r66so3910003qke.4 for ; Sun, 10 Sep 2017 06:22:49 -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=RtPQLWKaPJcVpsEQKBXFnRvuG0rJRVtnOnItYqmzEuQ=; b=c3sdRb3v9rYMrP+6AfuezFgaGOaHzCUybvDA75chpZuhSZP7ZVCaI+WUu0m2jO2J1/ kPCdj7+6g0FaJQV+/0OfiTM2nCgsXf69fM4TLhXEFuWi3DDXoOoAUYVWoyLrcNxKPX9d yzmwrpSItIcVKTlQf5FAl8A1AERLVSbauAST9XQLg2ToPWNSs6qIHYy5b1sbIBZebwDn oJLmac9A1iBpZITVohmM4GBeigQxrSg64Mrs8MlmgQBrKwYbnwNDI3sIZMnNn7r22u+z cazjVSc6n0sdZRzfwuRAN50Qx4Ak/EX+QlZ/DZuvMGgFyC0dKzA1Gxhwx6h/SDJKTNVU OpLA== 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=RtPQLWKaPJcVpsEQKBXFnRvuG0rJRVtnOnItYqmzEuQ=; b=dXGpTmgawxYustKmDjFvJBX2HU0o3a1Oit2wq3Xgf4R0chSVQD/EMJCGaJCanoT9I1 wfCjKiGJeNN0UPSLj9ptup9u4MnkvlM+aR6qjzkKOddrGpWk+zz0hygNyf2xh6yFaXVC A37i4qiaV9AAEo3o7DD6TX/qEWYehImKwpIjT5zz9u4QjeahmKgVj4LZoNMAGY+m9c47 VB+zFELs+g6jrR19MftCBhy4guEbZ6RWtu8ZpS1hY9JiYNaBH2PEnyGSt5rhhkOfP55d 1QMS81dzFwAHNQkYXPh+bJuUyjZsmOgs2u19urKYHFaWnquomLrD0u4n7YnWgj3Qw8fO AN+w== X-Gm-Message-State: AHPjjUgqECY8tz0VYlwHNIwgtyWaPXc3dExpd94zyZ5It+wq3Dg/gC61 G8W9tDYBw6volaB5FJk= X-Google-Smtp-Source: AOwi7QDLfvYIj7/SDKKyF8vryzQNiRpcjIulVnNqCU9q1+sPIH0V45elGjYknIh1ELMPyD5mk8qcjA== X-Received: by 10.55.104.138 with SMTP id d132mr12032680qkc.151.1505049768178; Sun, 10 Sep 2017 06:22:48 -0700 (PDT) Received: from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a]) by smtp.gmail.com with ESMTPSA id p7sm4422690qke.78.2017.09.10.06.22.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Sep 2017 06:22:47 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Sun, 10 Sep 2017 09:22:23 -0400 Message-Id: <20170910132236.14318-3-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 02/12] efi_loader: add stub HII protocols 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 EfiHiiConfigRoutingProtocolGuid EfiHiiDatabaseProtocol EfiHiiStringProtocol Signed-off-by: Leif Lindholm --- include/efi_api.h | 204 ++++++++++++++++++++++++++++ include/efi_loader.h | 6 + lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_boottime.c | 9 ++ lib/efi_loader/efi_hii.c | 303 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 523 insertions(+), 1 deletion(-) create mode 100644 lib/efi_loader/efi_hii.c diff --git a/include/efi_api.h b/include/efi_api.h index 57468dd972..932a3429a8 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -536,6 +536,210 @@ struct efi_device_path_utilities_protocol const struct efi_device_path *device_path); }; +#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \ + EFI_GUID(0x587e72d7, 0xcc50, 0x4f79, \ + 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f) + +struct efi_hii_config_routing_protocol +{ + efi_status_t(EFIAPI *extract_config)( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t request, + efi_string_t *progress, + efi_string_t *results); + efi_status_t(EFIAPI *export_config)( + const struct efi_hii_config_routing_protocol *this, + efi_string_t *results); + efi_status_t(EFIAPI *route_config)( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t configuration, + efi_string_t *progress); + efi_status_t(EFIAPI *block_to_config)( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t config_request, + const uint8_t *block, + const UINTN block_size, + efi_string_t *config, + efi_string_t *progress); + efi_status_t(EFIAPI *config_to_block)( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t config_resp, + const uint8_t *block, + const UINTN *block_size, + efi_string_t *progress); + efi_status_t(EFIAPI *get_alt_config)( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t config_resp, + const efi_guid_t *guid, + const efi_string_t name, + const struct efi_device_path *device_path, + const efi_string_t alt_cfg_id, + efi_string_t *alt_cfg_resp); +}; + +#define EFI_HII_DATABASE_PROTOCOL_GUID \ + EFI_GUID(0xef9fc172, 0xa1b2, 0x4693, \ + 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42) + +typedef enum { + EfiKeyLCtrl, EfiKeyA0, EfiKeyLAlt, EfiKeySpaceBar, + EfiKeyA2, EfiKeyA3, EfiKeyA4, EfiKeyRCtrl, EfiKeyLeftArrow, + EfiKeyDownArrow, EfiKeyRightArrow, EfiKeyZero, + EfiKeyPeriod, EfiKeyEnter, EfiKeyLShift, EfiKeyB0, + EfiKeyB1, EfiKeyB2, EfiKeyB3, EfiKeyB4, EfiKeyB5, EfiKeyB6, + EfiKeyB7, EfiKeyB8, EfiKeyB9, EfiKeyB10, EfiKeyRShift, + EfiKeyUpArrow, EfiKeyOne, EfiKeyTwo, EfiKeyThree, + EfiKeyCapsLock, EfiKeyC1, EfiKeyC2, EfiKeyC3, EfiKeyC4, + EfiKeyC5, EfiKeyC6, EfiKeyC7, EfiKeyC8, EfiKeyC9, + EfiKeyC10, EfiKeyC11, EfiKeyC12, EfiKeyFour, EfiKeyFive, + EfiKeySix, EfiKeyPlus, EfiKeyTab, EfiKeyD1, EfiKeyD2, + EfiKeyD3, EfiKeyD4, EfiKeyD5, EfiKeyD6, EfiKeyD7, EfiKeyD8, + EfiKeyD9, EfiKeyD10, EfiKeyD11, EfiKeyD12, EfiKeyD13, + EfiKeyDel, EfiKeyEnd, EfiKeyPgDn, EfiKeySeven, EfiKeyEight, + EfiKeyNine, EfiKeyE0, EfiKeyE1, EfiKeyE2, EfiKeyE3, + EfiKeyE4, EfiKeyE5, EfiKeyE6, EfiKeyE7, EfiKeyE8, EfiKeyE9, + EfiKeyE10, EfiKeyE11, EfiKeyE12, EfiKeyBackSpace, + EfiKeyIns, EfiKeyHome, EfiKeyPgUp, EfiKeyNLck, EfiKeySlash, + EfiKeyAsterisk, EfiKeyMinus, EfiKeyEsc, EfiKeyF1, EfiKeyF2, + EfiKeyF3, EfiKeyF4, EfiKeyF5, EfiKeyF6, EfiKeyF7, EfiKeyF8, + EfiKeyF9, EfiKeyF10, EfiKeyF11, EfiKeyF12, EfiKeyPrint, + EfiKeySLck, EfiKeyPause +} efi_key; + +struct efi_key_descriptor +{ + efi_key key; + uint16_t unicode; + uint16_t shifted_unicode; + uint16_t alt_gr_unicode; + uint16_t shifted_alt_gr_unicode; + uint16_t modifier; + uint16_t affected_attribute; +}; + +struct efi_hii_keyboard_layout +{ + uint16_t layout_length; + efi_guid_t guid; + uint32_t layout_descriptor_string_offset; + uint8_t descriptor_count; + struct efi_key_descriptor descriptors[]; +}; + +struct efi_hii_package_list_header +{ + efi_guid_t package_list_guid; + uint32_t package_length; +}; + +typedef void *efi_hii_handle_t; + +struct efi_hii_database_protocol +{ + efi_status_t(EFIAPI *new_package_list)( + const struct efi_hii_database_protocol *this, + const struct efi_hii_package_list_header *package_list, + const efi_handle_t driver_handle, + efi_hii_handle_t *handle); + efi_status_t(EFIAPI *remove_package_list)( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t handle); + efi_status_t(EFIAPI *update_package_list)( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t handle, + const struct efi_hii_package_list_header *package_list); + efi_status_t(EFIAPI *list_package_lists)( + const struct efi_hii_database_protocol *this, + uint8_t package_type, + const efi_guid_t *package_guid, + UINTN *handle_buffer_length, + efi_hii_handle_t *handle); + efi_status_t(EFIAPI *export_package_lists)( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t handle, + UINTN *buffer_size, + struct efi_hii_package_list_header *buffer); + efi_status_t(EFIAPI *register_package_notify)( + const struct efi_hii_database_protocol *this, + uint8_t package_type, + const efi_guid_t *package_guid, + const void *package_notify_fn, + UINTN notify_type, + efi_handle_t *notify_handle); + efi_status_t(EFIAPI *unregister_package_notify)( + const struct efi_hii_database_protocol *this, + efi_handle_t notification_handle + ); + efi_status_t(EFIAPI *find_keyboard_layouts)( + const struct efi_hii_database_protocol *this, + uint16_t *key_guid_buffer_length, + efi_guid_t *key_guid_buffer); + efi_status_t(EFIAPI *get_keyboard_layout)( + const struct efi_hii_database_protocol *this, + efi_guid_t *key_guid, + uint16_t *keyboard_layout_length, + struct efi_hii_keyboard_layout *keyboard_layout); + efi_status_t(EFIAPI *set_keyboard_layout)( + const struct efi_hii_database_protocol *this, + efi_guid_t *key_guid); + efi_status_t(EFIAPI *get_package_list_handle)( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t package_list_handle, + efi_handle_t *driver_handle); +}; + +#define EFI_HII_STRING_PROTOCOL_GUID \ + EFI_GUID(0x0fd96974, 0x23aa, 0x4cdc, \ + 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a) + +typedef uint32_t efi_hii_font_style_t; +typedef uint16_t efi_string_id_t; + +struct efi_font_info +{ + efi_hii_font_style_t font_style; + uint16_t font_size; + uint16_t font_name[1]; +}; + +struct efi_hii_string_protocol +{ + efi_status_t(EFIAPI *new_string)( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + efi_string_id_t *string_id, + const uint8_t *language, + const uint16_t *language_name, + const efi_string_t string, + const struct efi_font_info *string_font_info); + efi_status_t(EFIAPI *get_string)( + const struct efi_hii_string_protocol *this, + const uint8_t *language, + efi_hii_handle_t package_list, + efi_string_id_t string_id, + efi_string_t string, + UINTN *string_size, + struct efi_font_info **string_font_info); + efi_status_t(EFIAPI *set_string)( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + efi_string_id_t string_id, + const uint8_t *language, + const efi_string_t string, + const struct efi_font_info *string_font_info); + efi_status_t(EFIAPI *get_languages)( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + uint8_t *languages, + UINTN *languages_size); + efi_status_t(EFIAPI *get_secondary_languages)( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + const uint8_t *primary_language, + uint8_t *secondary_languages, + UINTN *secondary_languages_size); +}; + #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 c009828db9..a89bb2fcd9 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -59,6 +59,9 @@ extern struct efi_simple_input_interface efi_con_in; extern const struct efi_console_control_protocol efi_console_control; extern const struct efi_device_path_to_text_protocol efi_device_path_to_text; 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; uint16_t *efi_dp_str(struct efi_device_path *dp); @@ -70,6 +73,9 @@ extern const efi_guid_t efi_guid_device_path_to_text_protocol; extern const efi_guid_t efi_simple_file_system_protocol_guid; extern const efi_guid_t efi_file_info_guid; 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 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 f5e69dd078..e8fd6823a3 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 +obj-y += efi_device_path_utilities.o efi_hii.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 8bb243d673..4d1a16051b 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -779,6 +779,15 @@ void efi_setup_loaded_image(struct efi_loaded_image *info, struct efi_object *ob obj->protocols[4].protocol_interface = (void *)&efi_device_path_utilities; + obj->protocols[5].guid = &efi_guid_hii_string_protocol; + obj->protocols[5].protocol_interface = (void *)&efi_hii_string; + + obj->protocols[6].guid = &efi_guid_hii_database_protocol; + obj->protocols[6].protocol_interface = (void *)&efi_hii_database; + + obj->protocols[7].guid = &efi_guid_hii_config_routing_protocol; + obj->protocols[7].protocol_interface = (void *)&efi_hii_config_routing; + info->file_path = file_path; info->device_handle = efi_dp_find_obj(device_path, NULL); diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c new file mode 100644 index 0000000000..cc68a28d2b --- /dev/null +++ b/lib/efi_loader/efi_hii.c @@ -0,0 +1,303 @@ +/* + * EFI Human Interface Infrastructure ... interface + * + * Copyright (c) 2017 Leif Lindholm + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +const efi_guid_t efi_guid_hii_config_routing_protocol = + EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID; +const efi_guid_t efi_guid_hii_database_protocol = EFI_HII_DATABASE_PROTOCOL_GUID; +const efi_guid_t efi_guid_hii_string_protocol = EFI_HII_STRING_PROTOCOL_GUID; + + +/* + * EFI_HII_CONFIG_ROUTING_PROTOCOL + */ + +static efi_status_t extract_config( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t request, + efi_string_t *progress, + efi_string_t *results) +{ + EFI_ENTRY("%p, \"%ls\", %p, %p", this, request, progress, results); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t export_config( + const struct efi_hii_config_routing_protocol *this, + efi_string_t *results) +{ + EFI_ENTRY("%p, %p", this, results); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t route_config( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t configuration, + efi_string_t *progress) +{ + EFI_ENTRY("%p, \"%ls\", %p", this, configuration, progress); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t block_to_config( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t config_request, + const uint8_t *block, + const UINTN block_size, + efi_string_t *config, + efi_string_t *progress) +{ + EFI_ENTRY("%p, \"%ls\", %p, %lu, %p, %p", this, config_request, block, + block_size, config, progress); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t config_to_block( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t config_resp, + const uint8_t *block, + const UINTN *block_size, + efi_string_t *progress) +{ + EFI_ENTRY("%p, \"%ls\", %p, %p, %p", this, config_resp, block, + block_size, progress); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t get_alt_config( + const struct efi_hii_config_routing_protocol *this, + const efi_string_t config_resp, + const efi_guid_t *guid, + const efi_string_t name, + const struct efi_device_path *device_path, + const efi_string_t alt_cfg_id, + efi_string_t *alt_cfg_resp) +{ + EFI_ENTRY("%p, \"%ls\", %pUl, \"%ls\", %p, \"%ls\", %p", this, + config_resp, guid, name, device_path, alt_cfg_id, + alt_cfg_resp); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + + +/* + * EFI_HII_DATABASE_PROTOCOL + */ + +static efi_status_t new_package_list( + const struct efi_hii_database_protocol *this, + const struct efi_hii_package_list_header *package_list, + const efi_handle_t driver_handle, + efi_hii_handle_t *handle) +{ + /* Current shell start failure. */ + /* Invoked from MdeModulePkg/Library/UefiHiiLib/HiiLib.c : HiiAddPackages */ + /* (Via autogenerated .c file.) */ + EFI_ENTRY("%p, %p, %p, %p", this, package_list, driver_handle, handle); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t remove_package_list( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t handle) +{ + EFI_ENTRY("%p, %p", this, handle); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t update_package_list( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t handle, + const struct efi_hii_package_list_header *package_list) +{ + EFI_ENTRY("%p, %p, %p", this, handle, package_list); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t list_package_lists( + const struct efi_hii_database_protocol *this, + uint8_t package_type, + const efi_guid_t *package_guid, + UINTN *handle_buffer_length, + efi_hii_handle_t *handle) +{ + EFI_ENTRY("%p, %u, %pUl, %p, %p", this, package_type, package_guid, + handle_buffer_length, handle); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t export_package_lists( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t handle, + UINTN *buffer_size, + struct efi_hii_package_list_header *buffer) +{ + EFI_ENTRY("%p, %p, %p, %p", this, handle, buffer_size, buffer); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t register_package_notify( + const struct efi_hii_database_protocol *this, + uint8_t package_type, + const efi_guid_t *package_guid, + const void *package_notify_fn, + UINTN notify_type, + efi_handle_t *notify_handle) +{ + EFI_ENTRY("%p, %u, %pUl, %p, %lu, %p", this, package_type, + package_guid, package_notify_fn, notify_type, + notify_handle); + return EFI_EXIT(EFI_OUT_OF_RESOURCES); +} + +static efi_status_t unregister_package_notify( + const struct efi_hii_database_protocol *this, + efi_handle_t notification_handle) +{ + EFI_ENTRY("%p, %p", this, notification_handle); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t find_keyboard_layouts( + const struct efi_hii_database_protocol *this, + uint16_t *key_guid_buffer_length, + efi_guid_t *key_guid_buffer) +{ + EFI_ENTRY("%p, %p, %p", this, key_guid_buffer_length, key_guid_buffer); + return EFI_EXIT(EFI_NOT_FOUND); /* Invalid */ +} + +static efi_status_t get_keyboard_layout( + const struct efi_hii_database_protocol *this, + efi_guid_t *key_guid, + uint16_t *keyboard_layout_length, + struct efi_hii_keyboard_layout *keyboard_layout) +{ + EFI_ENTRY("%p, %pUl, %p, %p", this, key_guid, keyboard_layout_length, + keyboard_layout); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t set_keyboard_layout( + const struct efi_hii_database_protocol *this, + efi_guid_t *key_guid) +{ + EFI_ENTRY("%p, %pUl", this, key_guid); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t get_package_list_handle( + const struct efi_hii_database_protocol *this, + efi_hii_handle_t package_list_handle, + efi_handle_t *driver_handle) +{ + EFI_ENTRY("%p, %p, %p", this, package_list_handle, driver_handle); + return EFI_EXIT(EFI_INVALID_PARAMETER); +} + + +/* + * EFI_HII_STRING_PROTOCOL + */ + +static efi_status_t new_string( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + efi_string_id_t *string_id, + const uint8_t *language, + const uint16_t *language_name, + const efi_string_t string, + const struct efi_font_info *string_font_info) +{ + EFI_ENTRY("%p, %p, %p, %p, %p, \"%ls\", %p", this, package_list, + string_id, language, language_name, string, + string_font_info); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t get_string( + const struct efi_hii_string_protocol *this, + const uint8_t *language, + efi_hii_handle_t package_list, + efi_string_id_t string_id, + efi_string_t string, + UINTN *string_size, + struct efi_font_info **string_font_info) +{ + EFI_ENTRY("%p, %p, %p, %u, \"%ls\", %p, %p", this, language, + package_list, string_id, string, string_size, + string_font_info); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t set_string( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + efi_string_id_t string_id, + const uint8_t *language, + const efi_string_t string, + const struct efi_font_info *string_font_info) +{ + EFI_ENTRY("%p, %p, %u, %p, \"%ls\", %p", this, package_list, string_id, + language, string, string_font_info); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t get_languages( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + uint8_t *languages, + UINTN *languages_size) +{ + EFI_ENTRY("%p, %p, %p, %p", this, package_list, languages, + languages_size); + return EFI_EXIT(EFI_NOT_FOUND); +} + +static efi_status_t get_secondary_languages( + const struct efi_hii_string_protocol *this, + efi_hii_handle_t package_list, + const uint8_t *primary_language, + uint8_t *secondary_languages, + UINTN *secondary_languages_size) +{ + EFI_ENTRY("%p, %p, %p, %p, %p", this, package_list, primary_language, + secondary_languages, secondary_languages_size); + return EFI_EXIT(EFI_NOT_FOUND); +} + +const struct efi_hii_config_routing_protocol efi_hii_config_routing = { + .extract_config = extract_config, + .export_config = export_config, + .route_config = route_config, + .block_to_config = block_to_config, + .config_to_block = config_to_block, + .get_alt_config = get_alt_config +}; +const struct efi_hii_database_protocol efi_hii_database = { + .new_package_list = new_package_list, + .remove_package_list = remove_package_list, + .update_package_list = update_package_list, + .list_package_lists = list_package_lists, + .export_package_lists = export_package_lists, + .register_package_notify = register_package_notify, + .unregister_package_notify = unregister_package_notify, + .find_keyboard_layouts = find_keyboard_layouts, + .get_keyboard_layout = get_keyboard_layout, + .set_keyboard_layout = set_keyboard_layout, + .get_package_list_handle = get_package_list_handle +}; +const struct efi_hii_string_protocol efi_hii_string = { + .new_string = new_string, + .get_string = get_string, + .set_string = set_string, + .get_languages = get_languages, + .get_secondary_languages = get_secondary_languages +}; 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 +};