]> Git Repo - J-u-boot.git/blobdiff - cmd/net.c
Subtree merge tag 'v6.12-dts' of dts repo [1] into dts/upstream
[J-u-boot.git] / cmd / net.c
index 68d406291ef1aab96367e0be277905c3024e8792..79525f73a51216fa53e453451b77d9bb9616cded 100644 (file)
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -9,10 +9,10 @@
 /*
  * Boot support
  */
-#include <common.h>
 #include <bootstage.h>
 #include <command.h>
 #include <dm.h>
+#include <dm/devres.h>
 #include <env.h>
 #include <image.h>
 #include <log.h>
@@ -97,7 +97,6 @@ U_BOOT_CMD(
 );
 #endif
 
-
 #ifdef CONFIG_CMD_RARP
 int do_rarpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
@@ -197,6 +196,8 @@ U_BOOT_CMD(
 #if defined(CONFIG_CMD_WGET)
 static int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
 {
+       wget_info = &default_wget_info;
+
        return netboot_common(WGET, cmdtp, argc, argv);
 }
 
@@ -209,7 +210,7 @@ U_BOOT_CMD(
 
 static void netboot_update_env(void)
 {
-       char tmp[44];
+       char tmp[46];
 
        if (net_gateway.s_addr) {
                ip_to_string(net_gateway, tmp);
@@ -274,20 +275,20 @@ static void netboot_update_env(void)
        if (IS_ENABLED(CONFIG_IPV6)) {
                if (!ip6_is_unspecified_addr(&net_ip6) ||
                    net_prefix_length != 0) {
-                       sprintf(tmp, "%pI6c", &net_ip6);
                        if (net_prefix_length != 0)
-                               sprintf(tmp, "%s/%d", tmp, net_prefix_length);
-
+                               snprintf(tmp, sizeof(tmp), "%pI6c/%d", &net_ip6, net_prefix_length);
+                       else
+                               snprintf(tmp, sizeof(tmp), "%pI6c", &net_ip6);
                        env_set("ip6addr", tmp);
                }
 
                if (!ip6_is_unspecified_addr(&net_server_ip6)) {
-                       sprintf(tmp, "%pI6c", &net_server_ip6);
+                       snprintf(tmp, sizeof(tmp), "%pI6c", &net_server_ip6);
                        env_set("serverip6", tmp);
                }
 
                if (!ip6_is_unspecified_addr(&net_gateway6)) {
-                       sprintf(tmp, "%pI6c", &net_gateway6);
+                       snprintf(tmp, sizeof(tmp), "%pI6c", &net_gateway6);
                        env_set("gatewayip6", tmp);
                }
        }
@@ -675,67 +676,3 @@ U_BOOT_CMD(
 );
 
 #endif  /* CONFIG_CMD_LINK_LOCAL */
-
-static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
-       const struct udevice *current = eth_get_dev();
-       unsigned char env_enetaddr[ARP_HLEN];
-       const struct udevice *dev;
-       struct uclass *uc;
-
-       uclass_id_foreach_dev(UCLASS_ETH, dev, uc) {
-               eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr);
-               printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr,
-                      current == dev ? "active" : "");
-       }
-       return CMD_RET_SUCCESS;
-}
-
-static struct cmd_tbl cmd_net[] = {
-       U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""),
-};
-
-static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
-       struct cmd_tbl *cp;
-
-       cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net));
-
-       /* Drop the net command */
-       argc--;
-       argv++;
-
-       if (!cp || argc > cp->maxargs)
-               return CMD_RET_USAGE;
-       if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
-               return CMD_RET_SUCCESS;
-
-       return cp->cmd(cmdtp, flag, argc, argv);
-}
-
-U_BOOT_CMD(
-       net, 2, 1, do_net,
-       "NET sub-system",
-       "list - list available devices\n"
-);
-
-#if defined(CONFIG_CMD_NCSI)
-static int do_ncsi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
-{
-       if (!phy_interface_is_ncsi() || !ncsi_active()) {
-               printf("Device not configured for NC-SI\n");
-               return CMD_RET_FAILURE;
-       }
-
-       if (net_loop(NCSI) < 0)
-               return CMD_RET_FAILURE;
-
-       return CMD_RET_SUCCESS;
-}
-
-U_BOOT_CMD(
-       ncsi,   1,      1,      do_ncsi,
-       "Configure attached NIC via NC-SI",
-       ""
-);
-#endif  /* CONFIG_CMD_NCSI */
This page took 0.027444 seconds and 4 git commands to generate.