From patchwork Thu Sep 5 08:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1158287 X-Patchwork-Delegate: xypron.glpk@gmx.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="O61Ahz/Z"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46PDPY3mRYz9sN1 for ; Thu, 5 Sep 2019 18:29:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 315DCC21E26; Thu, 5 Sep 2019 08:27:21 +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_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 0FB48C21E6A; Thu, 5 Sep 2019 08:21:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6BE34C21E7E; Thu, 5 Sep 2019 08:21:12 +0000 (UTC) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by lists.denx.de (Postfix) with ESMTPS id 4ECF2C21E26 for ; Thu, 5 Sep 2019 08:20:42 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id u72so982768pgb.10 for ; Thu, 05 Sep 2019 01:20:42 -0700 (PDT) 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=l4FoEeMewlQV0agYn4vj3tQa5l/PcLntpRl/DrSgfCE=; b=O61Ahz/ZwcCG3Xk2aXVY2xUjGXgVQf8aXv8d3jSuKDCaWv1+GTXqNy9BIsZOUNKXTO R509m1BIxW+0ckpuZg72Zu0gzgJ9zJP4QbyGxPQGJUzTHZe2ArzFFBYYxopsYSTXyEuC Jzxd/gj763+hw901RoBzzsc23E717tPQ1cw/aHSgeHxumEoptoLF9vaNFebBaSOm360j ofTI0KlNrwXLHuLpclZRjrBNLKsIhaeUiqMBRInSRc4CJlpcqwv63drMkpmdDO4DBZV+ 4el7mKE7vxORAFINHzLHLjfud/4fmWybeS1zvioWsg7hLrTVq46VnGeTbnOqUXkXPyfY BSGQ== 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=l4FoEeMewlQV0agYn4vj3tQa5l/PcLntpRl/DrSgfCE=; b=swKQ3fZYJe76753xpUZ68jC88dD0J63DYBBsus2iBWbhbFupPD49LuDxkehZ8LYa3o TLs/5wB3JXkeqHRdHXO47LjAc7kNGlvAGSfIbkhRB2MN0UZbDC8Fw4XC+D8vBIkFkbI4 37pa66YDLQE7XH5YfDpw0CyOWcFtuWn9S5+3rRjJYED5UZLFE5p3lzp6UZIpWD9tUoUw zm5VmvQnqh867IPaOcA4TzqrnZA8L8f0eAwlCoVZQFVkDKe5eBZuDNN1sZBQ80ZHeSSl /Fjac/D1TiYFV3EVF9yQbTOoHqXhM9ZuwnUrDbbDLcxC4XmfmgEC3psuXQDL35vPTGwK 54KQ== X-Gm-Message-State: APjAAAUcBg1uAvCehdbxYVyThLmOJjda+h4zlihCWLhXE+YtzT0hYjEi 7GcKEGLUNrq2Zgk+EQT7zCA5Iw== X-Google-Smtp-Source: APXvYqzW9qKxb9yOfkmeNuaDl6riraw23tONH4qJNhaZ/FAFh4qM9wQMCQk5ogTCpztqNuOgdG0K9Q== X-Received: by 2002:a17:90a:f993:: with SMTP id cq19mr2563805pjb.51.1567671640762; Thu, 05 Sep 2019 01:20:40 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id s2sm1133877pjq.0.2019.09.05.01.20.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Sep 2019 01:20:40 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, xypron.glpk@gmx.de, agraf@csgraf.de, wd@denx.de Date: Thu, 5 Sep 2019 17:21:30 +0900 Message-Id: <20190905082133.18996-17-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905082133.18996-1-takahiro.akashi@linaro.org> References: <20190905082133.18996-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v5 16/19] net: converted with new env interfaces 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" env_xxx(...) -> env_xxx(ctx_uboot, ...) Signed-off-by: AKASHI Takahiro --- net/bootp.c | 17 +++++++++-------- net/dns.c | 2 +- net/eth-uclass.c | 6 +++--- net/eth_common.c | 18 +++++++++--------- net/eth_legacy.c | 2 +- net/link_local.c | 2 +- net/net.c | 11 ++++++----- net/tftp.c | 10 +++++----- net/wol.c | 2 +- 9 files changed, 36 insertions(+), 34 deletions(-) diff --git a/net/bootp.c b/net/bootp.c index 505489140e8a..3a9ca24e649f 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -176,7 +176,7 @@ static void store_net_params(struct bootp_hdr *bp) * not contain a new value */ if (*net_boot_file_name) - env_set("bootfile", net_boot_file_name); + env_set(ctx_uboot, "bootfile", net_boot_file_name); #endif net_copy_ip(&net_ip, &bp->bp_yiaddr); } @@ -395,7 +395,7 @@ static void bootp_timeout_handler(void) #ifdef CONFIG_BOOTP_MAY_FAIL char *ethrotate; - ethrotate = env_get("ethrotate"); + ethrotate = env_get(ctx_uboot, "ethrotate"); if ((ethrotate && strcmp(ethrotate, "no") == 0) || net_restart_wrap) { puts("\nRetry time exceeded\n"); @@ -427,7 +427,7 @@ static void bootp_timeout_handler(void) static u8 *add_vci(u8 *e) { char *vci = NULL; - char *env_vci = env_get("bootp_vci"); + char *env_vci = env_get(ctx_uboot, "bootp_vci"); #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING) vci = CONFIG_SPL_NET_VCI_STRING; @@ -501,7 +501,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip, *e++ = tmp & 0xff; } #if defined(CONFIG_BOOTP_SEND_HOSTNAME) - hostname = env_get("hostname"); + hostname = env_get(ctx_uboot, "hostname"); if (hostname) { int hostnamelen = strlen(hostname); @@ -516,8 +516,9 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip, clientarch = CONFIG_BOOTP_PXE_CLIENTARCH; #endif - if (env_get("bootp_arch")) - clientarch = env_get_ulong("bootp_arch", 16, clientarch); + if (env_get(ctx_uboot, "bootp_arch")) + clientarch = env_get_ulong(ctx_uboot, "bootp_arch", 16, + clientarch); if (clientarch > 0) { *e++ = 93; /* Client System Architecture */ @@ -533,7 +534,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip, *e++ = 0; /* minor revision */ #ifdef CONFIG_LIB_UUID - uuid = env_get("pxeuuid"); + uuid = env_get(ctx_uboot, "pxeuuid"); if (uuid) { if (uuid_str_valid(uuid)) { @@ -726,7 +727,7 @@ void bootp_request(void) dhcp_state = INIT; #endif - ep = env_get("bootpretryperiod"); + ep = env_get(ctx_uboot, "bootpretryperiod"); if (ep != NULL) time_taken_max = simple_strtoul(ep, NULL, 10); else diff --git a/net/dns.c b/net/dns.c index 67d761d7c0f5..93e338e9cb22 100644 --- a/net/dns.c +++ b/net/dns.c @@ -185,7 +185,7 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip, ip_to_string(ip_addr, ip_str); printf("%s\n", ip_str); if (net_dns_env_var) - env_set(net_dns_env_var, ip_str); + env_set(ctx_uboot, net_dns_env_var, ip_str); } else { puts("server responded with invalid IP number\n"); } diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 1d5d2f03b7d9..d7bec3377e6f 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -240,8 +240,8 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr); int eth_init(void) { - char *ethact = env_get("ethact"); - char *ethrotate = env_get("ethrotate"); + char *ethact = env_get(ctx_uboot, "ethact"); + char *ethrotate = env_get(ctx_uboot, "ethrotate"); struct udevice *current = NULL; struct udevice *old_current; int ret = -ENODEV; @@ -401,7 +401,7 @@ int eth_initialize(void) printf("No ethernet found.\n"); bootstage_error(BOOTSTAGE_ID_NET_ETH_START); } else { - char *ethprime = env_get("ethprime"); + char *ethprime = env_get(ctx_uboot, "ethprime"); struct udevice *prime_dev = NULL; if (ethprime) diff --git a/net/eth_common.c b/net/eth_common.c index ed26b1b69359..f845601a13b0 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -46,13 +46,13 @@ int eth_mac_skip(int index) char *skip_state; sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index); - skip_state = env_get(enetvar); + skip_state = env_get(ctx_uboot, enetvar); return skip_state != NULL; } void eth_current_changed(void) { - char *act = env_get("ethact"); + char *act = env_get(ctx_uboot, "ethact"); char *ethrotate; /* @@ -60,21 +60,21 @@ void eth_current_changed(void) * ethernet device if uc_priv->current == NULL. This is not what * we want when 'ethrotate' variable is 'no'. */ - ethrotate = env_get("ethrotate"); + ethrotate = env_get(ctx_uboot, "ethrotate"); if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0)) return; /* update current ethernet name */ if (eth_get_dev()) { if (act == NULL || strcmp(act, eth_get_name()) != 0) - env_set("ethact", eth_get_name()); + env_set(ctx_uboot, "ethact", eth_get_name()); } /* * remove the variable completely if there is no active * interface */ else if (act != NULL) - env_set("ethact", NULL); + env_set(ctx_uboot, "ethact", NULL); } void eth_try_another(int first_restart) @@ -86,7 +86,7 @@ void eth_try_another(int first_restart) * Do not rotate between network interfaces when * 'ethrotate' variable is set to 'no'. */ - ethrotate = env_get("ethrotate"); + ethrotate = env_get(ctx_uboot, "ethrotate"); if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0)) return; @@ -110,14 +110,14 @@ void eth_set_current(void) static int env_changed_id; int env_id; - env_id = env_get_id(); + env_id = env_get_id(ctx_uboot); if ((act == NULL) || (env_changed_id != env_id)) { - act = env_get("ethact"); + act = env_get(ctx_uboot, "ethact"); env_changed_id = env_id; } if (act == NULL) { - char *ethprime = env_get("ethprime"); + char *ethprime = env_get(ctx_uboot, "ethprime"); void *dev = NULL; if (ethprime) diff --git a/net/eth_legacy.c b/net/eth_legacy.c index 850f362d873e..a166244e18bf 100644 --- a/net/eth_legacy.c +++ b/net/eth_legacy.c @@ -260,7 +260,7 @@ int eth_initialize(void) bootstage_error(BOOTSTAGE_ID_NET_ETH_START); } else { struct eth_device *dev = eth_devices; - char *ethprime = env_get("ethprime"); + char *ethprime = env_get(ctx_uboot, "ethprime"); bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT); do { diff --git a/net/link_local.c b/net/link_local.c index dd9fcad0874d..c0adc583fb71 100644 --- a/net/link_local.c +++ b/net/link_local.c @@ -105,7 +105,7 @@ static void configure_wait(void) void link_local_start(void) { - ip = env_get_ip("llipaddr"); + ip = env_get_ip(ctx_uboot, "llipaddr"); if (ip.s_addr != 0 && (ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) { puts("invalid link address"); diff --git a/net/net.c b/net/net.c index 40511db645df..92e3c9fa8016 100644 --- a/net/net.c +++ b/net/net.c @@ -306,7 +306,7 @@ U_BOOT_ENV_CALLBACK(dnsip, on_dnsip); void net_auto_load(void) { #if defined(CONFIG_CMD_NFS) - const char *s = env_get("autoload"); + const char *s = env_get(ctx_uboot, "autoload"); if (s != NULL && strcmp(s, "NFS") == 0) { if (net_check_prereq(NFS)) { @@ -635,8 +635,9 @@ restart: if (net_boot_file_size > 0) { printf("Bytes transferred = %d (%x hex)\n", net_boot_file_size, net_boot_file_size); - env_set_hex("filesize", net_boot_file_size); - env_set_hex("fileaddr", load_addr); + env_set_hex(ctx_uboot, "filesize", + net_boot_file_size); + env_set_hex(ctx_uboot, "fileaddr", load_addr); } if (protocol != NETCONS) eth_halt(); @@ -689,7 +690,7 @@ int net_start_again(void) unsigned long retrycnt = 0; int ret; - nretry = env_get("netretry"); + nretry = env_get(ctx_uboot, "netretry"); if (nretry) { if (!strcmp(nretry, "yes")) retry_forever = 1; @@ -1612,7 +1613,7 @@ ushort string_to_vlan(const char *s) ushort env_get_vlan(char *var) { - return string_to_vlan(env_get(var)); + return string_to_vlan(env_get(ctx_uboot, var)); } void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr) diff --git a/net/tftp.c b/net/tftp.c index 5a69bca6413c..452628dd7f8c 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -629,11 +629,11 @@ void tftp_start(enum proto_t protocol) * TFTP protocol has a minimal timeout of 1 second. */ - ep = env_get("tftpblocksize"); + ep = env_get(ctx_uboot, "tftpblocksize"); if (ep != NULL) tftp_block_size_option = simple_strtol(ep, NULL, 10); - ep = env_get("tftptimeout"); + ep = env_get(ctx_uboot, "tftptimeout"); if (ep != NULL) timeout_ms = simple_strtol(ep, NULL, 10); @@ -643,7 +643,7 @@ void tftp_start(enum proto_t protocol) timeout_ms = 1000; } - ep = env_get("tftptimeoutcountmax"); + ep = env_get(ctx_uboot, "tftptimeoutcountmax"); if (ep != NULL) tftp_timeout_count_max = simple_strtol(ep, NULL, 10); @@ -743,10 +743,10 @@ void tftp_start(enum proto_t protocol) tftp_our_port = 1024 + (get_timer(0) % 3072); #ifdef CONFIG_TFTP_PORT - ep = env_get("tftpdstp"); + ep = env_get(ctx_uboot, "tftpdstp"); if (ep != NULL) tftp_remote_port = simple_strtol(ep, NULL, 10); - ep = env_get("tftpsrcp"); + ep = env_get(ctx_uboot, "tftpsrcp"); if (ep != NULL) tftp_our_port = simple_strtol(ep, NULL, 10); #endif diff --git a/net/wol.c b/net/wol.c index 0a625668a992..9afd7149f34c 100644 --- a/net/wol.c +++ b/net/wol.c @@ -56,7 +56,7 @@ void wol_receive(struct ip_udp_hdr *ip, unsigned int len) struct in_addr *ip = (struct in_addr *)(wol->wol_passwd); ip_to_string(*ip, buffer); - env_set("wolpassword", buffer); + env_set(ctx_uboot, "wolpassword", buffer); } net_set_state(NETLOOP_SUCCESS); }