diff options
author | Dmitrii Merkurev <dimorinny@google.com> | 2023-04-12 19:49:31 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-05-05 17:48:44 -0400 |
commit | c8acbbbf0847744ff2ad98e9d8d4e11d5e37eda2 (patch) | |
tree | e37737cfec46839b48ab3e86d49239f9bf24c451 /net/fastboot_udp.c | |
parent | 443d319180a68156ca152d164f446e6789004c1d (diff) |
net: share fastboot boot handle logic between transports
Introduce reboot, boot and continue commands support to
TCP fastboot by moving existing UDP logic into the common module.
Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Сс: Joe Hershberger <joe.hershberger@ni.com>
Сс: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'net/fastboot_udp.c')
-rw-r--r-- | net/fastboot_udp.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/net/fastboot_udp.c b/net/fastboot_udp.c index 27e779d8e09..d706928d168 100644 --- a/net/fastboot_udp.c +++ b/net/fastboot_udp.c @@ -40,8 +40,6 @@ static int fastboot_remote_port; /* The UDP port at our end */ static int fastboot_our_port; -static void boot_downloaded_image(void); - /** * fastboot_udp_send_info() - Send an INFO packet during long commands. * @@ -209,40 +207,13 @@ static void fastboot_send(struct fastboot_header header, char *fastboot_data, net_send_udp_packet(net_server_ethaddr, fastboot_remote_ip, fastboot_remote_port, fastboot_our_port, len); - /* Continue boot process after sending response */ - if (!strncmp("OKAY", response, 4)) { - switch (cmd) { - case FASTBOOT_COMMAND_BOOT: - boot_downloaded_image(); - break; - - case FASTBOOT_COMMAND_CONTINUE: - net_set_state(NETLOOP_SUCCESS); - break; - - case FASTBOOT_COMMAND_REBOOT: - case FASTBOOT_COMMAND_REBOOT_BOOTLOADER: - case FASTBOOT_COMMAND_REBOOT_FASTBOOTD: - case FASTBOOT_COMMAND_REBOOT_RECOVERY: - do_reset(NULL, 0, 0, NULL); - break; - } - } + fastboot_handle_boot(cmd, strncmp("OKAY", response, 4) == 0); if (!strncmp("OKAY", response, 4) || !strncmp("FAIL", response, 4)) cmd = -1; } /** - * boot_downloaded_image() - Boots into downloaded image. - */ -static void boot_downloaded_image(void) -{ - fastboot_boot(); - net_set_state(NETLOOP_SUCCESS); -} - -/** * fastboot_handler() - Incoming UDP packet handler. * * @packet: Pointer to incoming UDP packet |