[U-Boot] [PATCH 13/17] efi_loader: size fields in SimpleNetworkProtocol

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Sep 24 19:57:12 UTC 2017


The size fields in the Simple Network Protocol are all
UINTN in the UEFI spec. So use size_t.

Provide a function description of the receive function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 include/efi_api.h        |  4 ++--
 lib/efi_loader/efi_net.c | 24 ++++++++++++++++++++----
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 1f349db246..a9a6494afe 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -636,11 +636,11 @@ struct efi_simple_network
 	efi_status_t (EFIAPI *get_status)(struct efi_simple_network *this,
 			u32 *int_status, void **txbuf);
 	efi_status_t (EFIAPI *transmit)(struct efi_simple_network *this,
-			ulong header_size, ulong buffer_size, void *buffer,
+			size_t header_size, size_t buffer_size, void *buffer,
 			struct efi_mac_address *src_addr,
 			struct efi_mac_address *dest_addr, u16 *protocol);
 	efi_status_t (EFIAPI *receive)(struct efi_simple_network *this,
-			ulong *header_size, ulong *buffer_size, void *buffer,
+			size_t *header_size, size_t *buffer_size, void *buffer,
 			struct efi_mac_address *src_addr,
 			struct efi_mac_address *dest_addr, u16 *protocol);
 	struct efi_event *wait_for_packet;
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 89dc2006f1..5344210fff 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -150,12 +150,13 @@ static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this,
 }
 
 static efi_status_t EFIAPI efi_net_transmit(struct efi_simple_network *this,
-		ulong header_size, ulong buffer_size, void *buffer,
+		size_t header_size, size_t buffer_size, void *buffer,
 		struct efi_mac_address *src_addr,
 		struct efi_mac_address *dest_addr, u16 *protocol)
 {
-	EFI_ENTRY("%p, %lx, %lx, %p, %p, %p, %p", this, header_size,
-		  buffer_size, buffer, src_addr, dest_addr, protocol);
+	EFI_ENTRY("%p, %lu, %lu, %p, %p, %p, %p", this,
+		  (unsigned long)header_size, (unsigned long)buffer_size,
+		  buffer, src_addr, dest_addr, protocol);
 
 	efi_timer_check();
 
@@ -182,8 +183,23 @@ static void efi_net_push(void *pkt, int len)
 	new_rx_packet = true;
 }
 
+/*
+ * Receive a packet from a network interface.
+ *
+ * This function implements the Receive service of the Simple Network Protocol.
+ * See the UEFI spec for details.
+ *
+ * @this	the instance of the Simple Network Protocol
+ * @header_size	size of the media header
+ * @buffer_size	size of the buffer to receive the packet
+ * @buffer	buffer to receive the packet
+ * @src_addr	source MAC address
+ * @dest_addr	destination MAC address
+ * @protocol	protocol
+ * @return	status code
+ */
 static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this,
-		ulong *header_size, ulong *buffer_size, void *buffer,
+		size_t *header_size, size_t *buffer_size, void *buffer,
 		struct efi_mac_address *src_addr,
 		struct efi_mac_address *dest_addr, u16 *protocol)
 {
-- 
2.14.1



More information about the U-Boot mailing list