diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 2 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/efi/Kconfig | 83 | ||||
-rw-r--r-- | lib/efi_client/Kconfig | 80 | ||||
-rw-r--r-- | lib/efi_client/Makefile (renamed from lib/efi/Makefile) | 0 | ||||
-rw-r--r-- | lib/efi_client/efi.c (renamed from lib/efi/efi.c) | 0 | ||||
-rw-r--r-- | lib/efi_client/efi_app.c (renamed from lib/efi/efi_app.c) | 0 | ||||
-rw-r--r-- | lib/efi_client/efi_app_init.c (renamed from lib/efi/efi_app_init.c) | 0 | ||||
-rw-r--r-- | lib/efi_client/efi_info.c (renamed from lib/efi/efi_info.c) | 0 | ||||
-rw-r--r-- | lib/efi_client/efi_stub.c (renamed from lib/efi/efi_stub.c) | 0 | ||||
-rw-r--r-- | lib/efi_loader/Kconfig | 5 | ||||
-rw-r--r-- | lib/efi_loader/efi_debug_support.c | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_firmware.c | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_memory.c | 2 | ||||
-rw-r--r-- | lib/efi_selftest/efi_selftest_debug_support.c | 68 | ||||
-rw-r--r-- | lib/efi_selftest/efi_selftest_esrt.c | 6 | ||||
-rw-r--r-- | lib/lwip/lwip/src/apps/tftp/tftp.c | 74 | ||||
-rw-r--r-- | lib/lwip/lwip/src/core/ipv4/icmp.c | 17 | ||||
-rw-r--r-- | lib/lwip/u-boot/arch/cc.h | 16 | ||||
-rw-r--r-- | lib/lwip/u-boot/lwipopts.h | 4 | ||||
-rw-r--r-- | lib/uuid.c | 4 |
21 files changed, 278 insertions, 89 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 6a89f797bef..fbc9de90669 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -1096,7 +1096,7 @@ config VPL_OF_LIBFDT_ASSUME_MASK unsafe execution. See FDT_ASSUME_PERFECT, etc. in libfdt_internal.h menu "System tables" - depends on (!EFI && !SYS_COREBOOT) || (ARM && EFI_LOADER) + depends on (!EFI_CLIENT && !SYS_COREBOOT) || (ARM && EFI_LOADER) config BLOBLIST_TABLES bool "Put tables in a bloblist" diff --git a/lib/Makefile b/lib/Makefile index 18ae0cd87bf..2643bfc867c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -5,7 +5,7 @@ ifndef CONFIG_XPL_BUILD -obj-$(CONFIG_EFI) += efi/ +obj-$(CONFIG_EFI_CLIENT) += efi_client/ obj-$(CONFIG_EFI_LOADER) += efi_driver/ obj-$(CONFIG_EFI_LOADER) += efi_loader/ obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ diff --git a/lib/efi/Kconfig b/lib/efi/Kconfig index 81ed3e66b34..fc6d5b6d6c2 100644 --- a/lib/efi/Kconfig +++ b/lib/efi/Kconfig @@ -1,79 +1,12 @@ -menu "U-Boot as UEFI application" - depends on X86 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright 2025 Simon Glass <sjg@chromium.org> +# config EFI - bool "Support running U-Boot from EFI" - depends on X86 - imply X86_TSC_READ_BASE + bool help - U-Boot can be started from EFI on certain platforms. This allows - EFI to perform most of the system init and then jump to U-Boot for - final system boot. Another option is to run U-Boot as an EFI - application, with U-Boot using EFI's drivers instead of its own. + Indicates that EFI functionality is enabled, either via EFI_CLIENT or + EFI_LOADER -choice - prompt "Select EFI mode to use" - depends on X86 && EFI - -config EFI_APP - bool "Support running as an EFI application" - select CHARSET - help - Build U-Boot as an application which can be started from EFI. This - is useful for examining a platform in the early stages of porting - U-Boot to it. It allows only very basic functionality, such as a - command prompt and memory and I/O functions. Use 'reset' to return - to EFI. - -config EFI_STUB - bool "Support running as an EFI payload" - -endchoice - -choice - prompt "EFI app 32/64-bit selection" - depends on EFI_APP - help - EFI does not support mixing 32-bit and 64-bit modes. This is a - significant problem because it means that you must build a stub with - the correct type for EFI to load it correctly. If you are using - 32-bit EFI, select 32-bit here, else select 64-bit. Failure to do - this may produce no error message - it just won't start! - -config EFI_APP_32BIT - bool "Produce an app for running with 32-bit EFI" - -config EFI_APP_64BIT - bool "Produce an app for running with 64-bit EFI" - -endchoice - -choice - prompt "EFI stub 32/64-bit selection" - depends on EFI_STUB - help - EFI does not support mixing 32-bit and 64-bit modes. This is a - significant problem because it means that you must build a stub with - the correct type for EFI to load it correctly. If you are using - 32-bit EFI, select 32-bit here, else select 64-bit. Failure to do - this may produce no error message - it just won't start! - -config EFI_STUB_32BIT - bool "Produce a stub for running with 32-bit EFI" - -config EFI_STUB_64BIT - bool "Produce a stub for running with 64-bit EFI" - -endchoice - -config EFI_RAM_SIZE - hex "Amount of EFI RAM for U-Boot" - depends on EFI_APP - default 0x10000000 - help - Set the amount of EFI RAM which is claimed by U-Boot for its own - use. U-Boot allocates this from EFI on start-up (along with a few - other smaller amounts) and it can never be increased after that. - It is used as the RAM size in with U-Boot. - -endmenu + This is used to provide libraries shared by both. diff --git a/lib/efi_client/Kconfig b/lib/efi_client/Kconfig new file mode 100644 index 00000000000..723c98d2a75 --- /dev/null +++ b/lib/efi_client/Kconfig @@ -0,0 +1,80 @@ +menu "U-Boot as UEFI application" + depends on X86 + +config EFI_CLIENT + bool "Support running U-Boot from EFI" + depends on X86 + imply X86_TSC_READ_BASE + select EFI + help + U-Boot can be started from EFI on certain platforms. This allows + EFI to perform most of the system init and then jump to U-Boot for + final system boot. Another option is to run U-Boot as an EFI + application, with U-Boot using EFI's drivers instead of its own. + +choice + prompt "Select EFI mode to use" + depends on X86 && EFI_CLIENT + +config EFI_APP + bool "Support running as an EFI application" + select CHARSET + help + Build U-Boot as an application which can be started from EFI. This + is useful for examining a platform in the early stages of porting + U-Boot to it. It allows only very basic functionality, such as a + command prompt and memory and I/O functions. Use 'reset' to return + to EFI. + +config EFI_STUB + bool "Support running as an EFI payload" + +endchoice + +choice + prompt "EFI app 32/64-bit selection" + depends on EFI_APP + help + EFI does not support mixing 32-bit and 64-bit modes. This is a + significant problem because it means that you must build a stub with + the correct type for EFI to load it correctly. If you are using + 32-bit EFI, select 32-bit here, else select 64-bit. Failure to do + this may produce no error message - it just won't start! + +config EFI_APP_32BIT + bool "Produce an app for running with 32-bit EFI" + +config EFI_APP_64BIT + bool "Produce an app for running with 64-bit EFI" + +endchoice + +choice + prompt "EFI stub 32/64-bit selection" + depends on EFI_STUB + help + EFI does not support mixing 32-bit and 64-bit modes. This is a + significant problem because it means that you must build a stub with + the correct type for EFI to load it correctly. If you are using + 32-bit EFI, select 32-bit here, else select 64-bit. Failure to do + this may produce no error message - it just won't start! + +config EFI_STUB_32BIT + bool "Produce a stub for running with 32-bit EFI" + +config EFI_STUB_64BIT + bool "Produce a stub for running with 64-bit EFI" + +endchoice + +config EFI_RAM_SIZE + hex "Amount of EFI RAM for U-Boot" + depends on EFI_APP + default 0x10000000 + help + Set the amount of EFI RAM which is claimed by U-Boot for its own + use. U-Boot allocates this from EFI on start-up (along with a few + other smaller amounts) and it can never be increased after that. + It is used as the RAM size in with U-Boot. + +endmenu diff --git a/lib/efi/Makefile b/lib/efi_client/Makefile index 232fa684360..232fa684360 100644 --- a/lib/efi/Makefile +++ b/lib/efi_client/Makefile diff --git a/lib/efi/efi.c b/lib/efi_client/efi.c index bcb34d67465..bcb34d67465 100644 --- a/lib/efi/efi.c +++ b/lib/efi_client/efi.c diff --git a/lib/efi/efi_app.c b/lib/efi_client/efi_app.c index 9b94a93ee4f..9b94a93ee4f 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi_client/efi_app.c diff --git a/lib/efi/efi_app_init.c b/lib/efi_client/efi_app_init.c index c5e4192fe06..c5e4192fe06 100644 --- a/lib/efi/efi_app_init.c +++ b/lib/efi_client/efi_app_init.c diff --git a/lib/efi/efi_info.c b/lib/efi_client/efi_info.c index 5b564c5651d..5b564c5651d 100644 --- a/lib/efi/efi_info.c +++ b/lib/efi_client/efi_info.c diff --git a/lib/efi/efi_stub.c b/lib/efi_client/efi_stub.c index a083c7f1e9b..a083c7f1e9b 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi_client/efi_stub.c diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 077466f01f0..900113ca3e9 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -16,6 +16,7 @@ config EFI_LOADER depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT depends on !EFI_APP default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8 + select EFI select CHARSET # We need to send DM events, dynamically, in the EFI block driver select DM_EVENT @@ -194,6 +195,7 @@ endchoice config EFI_VARIABLES_PRESEED bool "Initial values for UEFI variables" + depends on !COMPILE_TEST depends on !EFI_MM_COMM_TEE help Include a file with the initial values for non-volatile UEFI variables @@ -563,6 +565,7 @@ config EFI_HTTP_BOOT bool "EFI HTTP Boot support" depends on NET || NET_LWIP select CMD_NET + select CMD_DHCP select CMD_DNS select CMD_WGET select BLKMAP @@ -595,6 +598,8 @@ config BOOTEFI_TESTAPP_COMPILE endif +source "lib/efi_client/Kconfig" + source "lib/efi/Kconfig" endmenu diff --git a/lib/efi_loader/efi_debug_support.c b/lib/efi_loader/efi_debug_support.c index 186bdbce750..490b0bb7088 100644 --- a/lib/efi_loader/efi_debug_support.c +++ b/lib/efi_loader/efi_debug_support.c @@ -22,7 +22,7 @@ struct efi_debug_image_info_table_header efi_m_debug_info_table_header = { */ static u32 efi_m_max_table_entries; -#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof(union efi_debug_image_info *)) +#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof(union efi_debug_image_info)) /** * efi_initialize_system_table_pointer() - Initialize system table pointer diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 75501e21557..216df83de67 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -332,6 +332,8 @@ static efi_status_t efi_fill_image_desc_array( return EFI_BUFFER_TOO_SMALL; } + if (!image_info) + return EFI_INVALID_PARAMETER; *image_info_size = total_size; ret = efi_gen_capsule_guids(); diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 6dfc698a247..b77c2f980cc 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -714,6 +714,8 @@ efi_status_t efi_realloc(void **ptr, size_t size) sizeof(struct efi_pool_allocation); new_ptr = efi_alloc(size); + if (!new_ptr) + return EFI_OUT_OF_RESOURCES; /* copy old data to new alloced buffer */ memcpy(new_ptr, *ptr, min(size, old_size)); diff --git a/lib/efi_selftest/efi_selftest_debug_support.c b/lib/efi_selftest/efi_selftest_debug_support.c index 9ca8b3f82f5..ac77caaf561 100644 --- a/lib/efi_selftest/efi_selftest_debug_support.c +++ b/lib/efi_selftest/efi_selftest_debug_support.c @@ -9,6 +9,7 @@ #include <efi_loader.h> #include <efi_selftest.h> +#include <linux/sizes.h> /** * efi_st_debug_support_execute() - execute test @@ -21,6 +22,12 @@ static int efi_st_debug_support_execute(void) { struct efi_debug_image_info_table_header *efi_st_debug_info_table_header = NULL; efi_guid_t efi_debug_image_info_table_guid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID; + struct efi_mem_desc *memory_map; + efi_uintn_t map_size = 0; + efi_uintn_t map_key; + efi_uintn_t desc_size; + u32 desc_version; + efi_status_t ret; /* get EFI_DEBUG_IMAGE_INFO_TABLE */ efi_st_debug_info_table_header = efi_st_get_config_table(&efi_debug_image_info_table_guid); @@ -30,7 +37,66 @@ static int efi_st_debug_support_execute(void) return EFI_ST_FAILURE; } - return EFI_ST_SUCCESS; + /* Load memory map */ + ret = st_boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size, + &desc_version); + if (ret != EFI_BUFFER_TOO_SMALL) { + efi_st_error + ("GetMemoryMap did not return EFI_BUFFER_TOO_SMALL\n"); + return EFI_ST_FAILURE; + } + /* Allocate extra space for newly allocated memory */ + map_size += sizeof(struct efi_mem_desc); + ret = st_boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size, + (void **)&memory_map); + if (ret != EFI_SUCCESS) { + efi_st_error("AllocatePool failed\n"); + return EFI_ST_FAILURE; + } + ret = st_boottime->get_memory_map(&map_size, memory_map, &map_key, + &desc_size, &desc_version); + if (ret != EFI_SUCCESS) { + efi_st_error("GetMemoryMap failed\n"); + return EFI_ST_FAILURE; + } + /* Find the system table pointer */ + for (efi_uintn_t i = 0; map_size; ++i, map_size -= desc_size) { + struct efi_mem_desc *entry = &memory_map[i]; + u64 end; + + if (entry->type != EFI_RUNTIME_SERVICES_DATA) + continue; + + end = entry->physical_start + + (entry->num_pages << EFI_PAGE_SHIFT); + for (u64 pos = ALIGN(entry->physical_start, SZ_4M); + pos <= end; pos += SZ_4M) { + struct efi_system_table_pointer *systab_pointer = + (void *)(uintptr_t)pos; + + /* check for overflow */ + if (pos < entry->physical_start) + break; + if (systab_pointer->signature == + EFI_SYSTEM_TABLE_SIGNATURE) { + if (systab_pointer->efi_system_table_base != + (uintptr_t)st_systable) { + efi_st_error("Wrong system table address\n"); + ret = EFI_ST_FAILURE; + goto out; + } + ret = EFI_ST_SUCCESS; + goto out; + } + } + } + efi_st_error("System table pointer not found\n"); + ret = EFI_ST_FAILURE; + +out: + st_boottime->free_pool(memory_map); + + return ret; } EFI_UNIT_TEST(debug_support) = { diff --git a/lib/efi_selftest/efi_selftest_esrt.c b/lib/efi_selftest/efi_selftest_esrt.c index b7688deb496..7eadac90fbc 100644 --- a/lib/efi_selftest/efi_selftest_esrt.c +++ b/lib/efi_selftest/efi_selftest_esrt.c @@ -69,10 +69,12 @@ EFIAPI efi_test_fmp_get_image_info(struct efi_firmware_management_protocol *this if (package_version_name) *package_version_name = NULL; - if (*image_info_size < sizeof(*image_info)) { - *image_info_size = *descriptor_size * *descriptor_count; + if (*image_info_size < sizeof(*image_info) * TEST_ESRT_NUM_ENTRIES) { + *image_info_size = sizeof(*image_info) * TEST_ESRT_NUM_ENTRIES; return EFI_BUFFER_TOO_SMALL; } + if (!image_info) + return EFI_INVALID_PARAMETER; for (int idx = 0; idx < TEST_ESRT_NUM_ENTRIES; idx++) image_info[idx] = static_img_info[idx]; diff --git a/lib/lwip/lwip/src/apps/tftp/tftp.c b/lib/lwip/lwip/src/apps/tftp/tftp.c index 63b1e0e0e20..ecb6c55ae11 100644 --- a/lib/lwip/lwip/src/apps/tftp/tftp.c +++ b/lib/lwip/lwip/src/apps/tftp/tftp.c @@ -79,6 +79,14 @@ enum tftp_error { #include <string.h> +struct tftp_req { + ip_addr_t addr; + u16_t port; + u16_t opcode; + enum tftp_transfer_mode mode; + char* fname; +}; + struct tftp_state { const struct tftp_context *ctx; void *handle; @@ -97,14 +105,33 @@ struct tftp_state { }; static struct tftp_state tftp_state; +static struct tftp_req tftp_req; static void tftp_tmr(void *arg); +static void tftp_req_tmr(void *arg); +static const char *mode_to_string(enum tftp_transfer_mode mode); + +static void +clear_req(void) +{ + ip_addr_set_any(0, &tftp_req.addr); + tftp_req.port = 0; + tftp_req.opcode = 0; + free(tftp_req.fname); + tftp_req.fname = NULL; + tftp_req.mode = 0; + + sys_untimeout(tftp_req_tmr, NULL); +} static void close_handle(void) { + clear_req(); + tftp_state.port = 0; ip_addr_set_any(0, &tftp_state.addr); + tftp_state.retries = 0; if (tftp_state.last_data != NULL) { pbuf_free(tftp_state.last_data); @@ -210,6 +237,12 @@ send_ack(const ip_addr_t *addr, u16_t port, u16_t blknum) } static err_t +resend_request(void) +{ + return send_request(&tftp_req.addr, tftp_req.port, tftp_req.opcode, tftp_req.fname, mode_to_string(tftp_req.mode)); +} + +static err_t resend_data(const ip_addr_t *addr, u16_t port) { err_t ret; @@ -336,6 +369,9 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr tftp_state.last_pkt = tftp_state.timer; tftp_state.retries = 0; + if (tftp_req.fname) + clear_req(); + switch (opcode) { case PP_HTONS(TFTP_RRQ): /* fall through */ case PP_HTONS(TFTP_WRQ): { @@ -542,6 +578,26 @@ tftp_tmr(void *arg) } } +static void +tftp_req_tmr(void *arg) +{ + if (tftp_state.handle == NULL) { + return; + } + + sys_timeout(TFTP_TIMER_MSECS, tftp_req_tmr, NULL); + + if (tftp_state.retries < TFTP_MAX_RETRIES) { + LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, ("tftp: req timeout, retrying\n")); + resend_request(); + tftp_state.retries++; + } else { + LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, ("tftp: req timeout\n")); + tftp_state.ctx->error(tftp_state.handle, -1, "Request timeout", strlen("Request timeout")); + close_handle(); + } +} + /** * Initialize TFTP client/server. * @param mode TFTP mode (client/server) @@ -638,6 +694,20 @@ mode_to_string(enum tftp_transfer_mode mode) } err_t +start_send_requests(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, enum tftp_transfer_mode mode) +{ + tftp_req.addr = *addr; + tftp_req.port = port; + tftp_req.opcode = opcode; + tftp_req.fname = strdup(fname); + tftp_req.mode = mode; + if (!tftp_req.fname) + return ERR_MEM; + sys_timeout(TFTP_TIMER_MSECS, tftp_req_tmr, NULL); + return resend_request(); +} + +err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode) { LWIP_ERROR("TFTP client is not enabled (tftp_init)", (tftp_state.tftp_mode & LWIP_TFTP_MODE_CLIENT) != 0, return ERR_VAL); @@ -647,7 +717,7 @@ tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enu tftp_state.handle = handle; tftp_state.blknum = 1; tftp_state.mode_write = 1; /* We want to receive data */ - return send_request(addr, port, TFTP_RRQ, fname, mode_to_string(mode)); + return start_send_requests(addr, port, TFTP_RRQ, fname, mode); } err_t @@ -660,7 +730,7 @@ tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enu tftp_state.handle = handle; tftp_state.blknum = 1; tftp_state.mode_write = 0; /* We want to send data */ - return send_request(addr, port, TFTP_WRQ, fname, mode_to_string(mode)); + return start_send_requests(addr, port, TFTP_WRQ, fname, mode); } #endif /* LWIP_UDP */ diff --git a/lib/lwip/lwip/src/core/ipv4/icmp.c b/lib/lwip/lwip/src/core/ipv4/icmp.c index 9a82a67aa93..6d588349c4a 100644 --- a/lib/lwip/lwip/src/core/ipv4/icmp.c +++ b/lib/lwip/lwip/src/core/ipv4/icmp.c @@ -80,9 +80,9 @@ void icmp_input(struct pbuf *p, struct netif *inp) { u8_t type; -#ifdef LWIP_DEBUG +#if defined(LWIP_DEBUG) || defined(ICMP_DEST_UNREACH_CB) u8_t code; -#endif /* LWIP_DEBUG */ +#endif struct icmp_echo_hdr *iecho; const struct ip_hdr *iphdr_in; u16_t hlen; @@ -103,11 +103,11 @@ icmp_input(struct pbuf *p, struct netif *inp) } type = *((u8_t *)p->payload); -#ifdef LWIP_DEBUG +#if defined(LWIP_DEBUG) || defined(ICMP_DEST_UNREACH_CB) code = *(((u8_t *)p->payload) + 1); /* if debug is enabled but debug statement below is somehow disabled: */ LWIP_UNUSED_ARG(code); -#endif /* LWIP_DEBUG */ +#endif switch (type) { case ICMP_ER: /* This is OK, echo reply might have been parsed by a raw PCB @@ -257,6 +257,15 @@ icmp_input(struct pbuf *p, struct netif *inp) default: if (type == ICMP_DUR) { MIB2_STATS_INC(mib2.icmpindestunreachs); +#ifdef ICMP_DEST_UNREACH_CB + /* + * The callback receives the IP packet (not the ICMP message) so that + * it can extract the source address for example + */ + pbuf_add_header(p, IP_HLEN); + ICMP_DEST_UNREACH_CB(code, p); + pbuf_remove_header(p, IP_HLEN); +#endif } else if (type == ICMP_TE) { MIB2_STATS_INC(mib2.icmpintimeexcds); } else if (type == ICMP_PP) { diff --git a/lib/lwip/u-boot/arch/cc.h b/lib/lwip/u-boot/arch/cc.h index f91127ac565..849c79c5a8d 100644 --- a/lib/lwip/u-boot/arch/cc.h +++ b/lib/lwip/u-boot/arch/cc.h @@ -47,4 +47,20 @@ void sntp_set_system_time(uint32_t sec); #define SNTP_SET_SYSTEM_TIME(sec) sntp_set_system_time(sec) +static inline const char *sntp_format_time(time_t t) +{ + static char buf[29]; /* "(time_t)" + 20 digits max + \0 */ + + snprintf(buf, sizeof(buf), "(time_t)%llu", t); + return buf; +} + +#define sntp_format_time sntp_format_time + +#ifdef CONFIG_LWIP_ICMP_SHOW_UNREACH +struct pbuf; +void net_lwip_icmp_dest_unreach(int code, struct pbuf *p); + +#define ICMP_DEST_UNREACH_CB(_c, _p) net_lwip_icmp_dest_unreach(_c, _p) +#endif #endif /* LWIP_ARCH_CC_H */ diff --git a/lib/lwip/u-boot/lwipopts.h b/lib/lwip/u-boot/lwipopts.h index 46af91f9410..80b93ea172d 100644 --- a/lib/lwip/u-boot/lwipopts.h +++ b/lib/lwip/u-boot/lwipopts.h @@ -80,7 +80,11 @@ #define IP_DEFAULT_TTL 255 +#if defined(CONFIG_PROT_ICMP_LWIP) +#define LWIP_ICMP 1 +#else #define LWIP_ICMP 0 +#endif #if defined(CONFIG_PROT_RAW_LWIP) #define LWIP_RAW 1 diff --git a/lib/uuid.c b/lib/uuid.c index a1c88b9a622..8d99b540d9f 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -94,7 +94,7 @@ static const struct { "system", "EFI System Partition", PARTITION_SYSTEM_GUID, }, -#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI) +#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_CLIENT) { NULL, "Device Path", PARTITION_SYSTEM_GUID, @@ -281,7 +281,7 @@ static const struct { EFI_CERT_TYPE_PKCS7_GUID, }, #endif -#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI) +#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_CLIENT) { "EFI_LZMA_COMPRESSED", NULL, EFI_LZMA_COMPRESSED }, { "EFI_DXE_SERVICES", NULL, EFI_DXE_SERVICES }, { "EFI_HOB_LIST", NULL, EFI_HOB_LIST }, |