From patchwork Fri Feb 8 08:15:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1038516 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kVogskOb"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43wp4f1nv6z9sML for ; Fri, 8 Feb 2019 19:19:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9BC9FC21C3F; Fri, 8 Feb 2019 08:18:26 +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=RCVD_IN_DNSWL_BLOCKED, 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 18F46C2200A; Fri, 8 Feb 2019 08:15:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4DE1BC2200D; Fri, 8 Feb 2019 08:15:20 +0000 (UTC) Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by lists.denx.de (Postfix) with ESMTPS id F05E6C21F7F for ; Fri, 8 Feb 2019 08:15:15 +0000 (UTC) Received: by mail-yb1-f171.google.com with SMTP id y13so1093067ybr.7 for ; Fri, 08 Feb 2019 00:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YKeIVJhR3iwzVu+XIJz21ft7eNw8XZXOP1i3T9U9njI=; b=kVogskObMs1CtNM3ORMtqOnqnDPbsfDl5TxUTJL76pby+PmO5Ra2gRqVlG8T4REyXw pJ5aENuCxqXFGBLjd+23b59x695hkd7XfjRGgJ2/Gw1BqpRGwi6Z4FDb8mGBVnin9Tdh aW7RRTR2rEhAatrEtKa3Jiiis4MtAVfs5+wQNCcKn2Cd+OeZHjGuW8Ia1V8lGqSVoxE0 V8TGZkrqEutVWvJ/mAdFvUqj9PIZf10qVH3qh/FRlzkUUuB2YwLBCewF9ZL74zMMTu4d L70rlXhmiR6ReFWq+HcxLgtGSl44iwIWQf+IPyIvv6awUADRz6f/lGc1hzAU8omE03w7 fy5Q== 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:mime-version:content-transfer-encoding; bh=YKeIVJhR3iwzVu+XIJz21ft7eNw8XZXOP1i3T9U9njI=; b=GyYYfUJyc41g2d3XxygV/JfB1nVyOEv+KS2X5psCFp8vYV6nAsS+IZ86AnvN9kJ9N7 W4BhpFoBXPB2kWqZRoFJliReQe6iw4l7eRSr1LSMt4aNFCGxrgclsu76KASYgq026jBN uO2bNPnk6K+7TUx5JhTjy4WS8txKUNNoiM+4IvGwt5DptbdyHHLmleijVLOC+cCZ/Te8 VFAlCUuq/M8kmdiVfbX5IEubM2z0xBu9VQ3aSFAFdl7ukVj0IkEyjc5AKYxLYhJ3Nl7g mxSotFKIthUQBLMLtwhEtY64et9OhEpW9XpGW8wPNg8NeEyYzvLdX8/qz3oHc6LJDpRy GTuQ== X-Gm-Message-State: AHQUAua2EJduMI4XhiLcKDqzCQzHiEC8CnoJ0rXzpTs86kwogw4Tm35h J60N8AJ4BAGvn7rW862llRS+qw== X-Google-Smtp-Source: AHgI3Ib+XZM+rPsSqj15o0Ytkp4Wj9KuVa+JceBqAc+AZOH0uehOk84jNOL1+XjzxykQxFcokTIGhA== X-Received: by 2002:a25:37cb:: with SMTP id e194mr16166157yba.329.1549613714900; Fri, 08 Feb 2019 00:15:14 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id s126sm527553ywc.11.2019.02.08.00.15.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 00:15:14 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de, xypron.glpk@gmx.de, sjg@chromium.org Date: Fri, 8 Feb 2019 17:15:35 +0900 Message-Id: <20190208081542.2813-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190208081542.2813-1-takahiro.akashi@linaro.org> References: <20190208081542.2813-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [RFC v2 08/15] efi_loader: console: convert efi console input/output to DM 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: AKASHI Takahiro --- drivers/serial/serial-uclass.c | 6 ++++ lib/efi_loader/efi_console.c | 64 ++++++++++++++++++++++++++-------- lib/efi_loader/efi_setup.c | 3 -- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index ffcd6d15af2b..22103e313051 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -168,6 +168,12 @@ int serial_init(void) void serial_initialize(void) { serial_init(); +#if CONFIG_IS_ENABLED(EFI_LOADER) + extern int efi_console_register(void); + + if (gd->cur_serial_dev) + efi_console_register(); +#endif } static void _serial_putc(struct udevice *dev, char ch) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 66c33a551d5d..1d016934b494 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -12,6 +12,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + #define EFI_COUT_MODE_2 2 #define EFI_MAX_COUT_MODE 3 @@ -1051,34 +1053,29 @@ static void EFIAPI efi_key_notify(struct efi_event *event, void *context) efi_status_t efi_console_register(void) { efi_status_t r; - efi_handle_t console_output_handle; - efi_handle_t console_input_handle; + efi_handle_t handle; /* Set up mode information */ query_console_size(); /* Create handles */ - r = efi_create_handle(&console_output_handle); + handle = gd->cur_serial_dev; + r = efi_add_handle(handle); if (r != EFI_SUCCESS) goto out_of_memory; - r = efi_add_protocol(console_output_handle, + r = efi_add_protocol(handle, &efi_guid_text_output_protocol, &efi_con_out); if (r != EFI_SUCCESS) goto out_of_memory; - systab.con_out_handle = console_output_handle; - systab.stderr_handle = console_output_handle; - - r = efi_create_handle(&console_input_handle); - if (r != EFI_SUCCESS) - goto out_of_memory; - - r = efi_add_protocol(console_input_handle, + systab.con_out_handle = handle; + systab.stderr_handle = handle; + r = efi_add_protocol(handle, &efi_guid_text_input_protocol, &efi_con_in); if (r != EFI_SUCCESS) goto out_of_memory; - systab.con_in_handle = console_input_handle; - r = efi_add_protocol(console_input_handle, + systab.con_in_handle = handle; + r = efi_add_protocol(handle, &efi_guid_text_input_ex_protocol, &efi_con_in_ex); if (r != EFI_SUCCESS) goto out_of_memory; @@ -1107,3 +1104,42 @@ out_of_memory: printf("ERROR: Out of memory\n"); return r; } + +static int efi_simple_text_input_ex_probe(struct udevice *dev) +{ + device_set_name(dev, "SIMPLE_TEXT_INPUT_EX"); + + return 0; +} + +U_BOOT_DRIVER(efi_simple_text_input_ex) = { + .name = "efi_simple_text_input_ex", + .id = UCLASS_EFI_PROTOCOL, + .probe = efi_simple_text_input_ex_probe, +}; + +static int efi_simple_text_input_probe(struct udevice *dev) +{ + device_set_name(dev, "SIMPLE_TEXT_INPUT"); + + return 0; +} + +U_BOOT_DRIVER(efi_simple_text_input) = { + .name = "efi_simple_text_input", + .id = UCLASS_EFI_PROTOCOL, + .probe = efi_simple_text_input_probe, +}; + +static int efi_simple_text_output_probe(struct udevice *dev) +{ + device_set_name(dev, "SIMPLE_TEXT_OUTPUT"); + + return 0; +} + +U_BOOT_DRIVER(efi_simple_text_output) = { + .name = "efi_simple_text_output", + .id = UCLASS_EFI_PROTOCOL, + .probe = efi_simple_text_output_probe, +}; diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index 83f1b842e6be..a0f80948c99c 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -50,9 +50,6 @@ static efi_status_t efi_system_init(void) if (ret != EFI_SUCCESS) goto out; - ret = efi_console_register(); - if (ret != EFI_SUCCESS) - goto out; #ifdef CONFIG_PARTITIONS ret = efi_disk_register(); if (ret != EFI_SUCCESS)