1 // SPDX-License-Identifier: GPL-2.0+
3 * EFI application network access support
5 * Copyright (c) 2016 Alexander Graf
9 #include <efi_loader.h>
12 static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
13 static const efi_guid_t efi_pxe_base_code_protocol_guid =
14 EFI_PXE_BASE_CODE_PROTOCOL_GUID;
15 static struct efi_pxe_packet *dhcp_ack;
16 static bool new_rx_packet;
17 static void *new_tx_packet;
18 static void *transmit_buffer;
21 * The notification function of this event is called in every timer cycle
22 * to check if a new network packet has been received.
24 static struct efi_event *network_timer_event;
26 * This event is signaled when a packet has been received.
28 static struct efi_event *wait_for_packet;
31 * struct efi_net_obj - EFI object representing a network interface
33 * @header: EFI object header
34 * @net: simple network protocol interface
35 * @net_mode: status of the network interface
36 * @pxe: PXE base code protocol interface
37 * @pxe_mode: status of the PXE base code protocol
40 struct efi_object header;
41 struct efi_simple_network net;
42 struct efi_simple_network_mode net_mode;
43 struct efi_pxe_base_code_protocol pxe;
44 struct efi_pxe_mode pxe_mode;
48 * efi_net_start() - start the network interface
50 * This function implements the Start service of the
51 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
52 * (UEFI) specification for details.
54 * @this: pointer to the protocol instance
57 static efi_status_t EFIAPI efi_net_start(struct efi_simple_network *this)
59 efi_status_t ret = EFI_SUCCESS;
61 EFI_ENTRY("%p", this);
63 /* Check parameters */
65 ret = EFI_INVALID_PARAMETER;
69 if (this->mode->state != EFI_NETWORK_STOPPED)
70 ret = EFI_ALREADY_STARTED;
72 this->mode->state = EFI_NETWORK_STARTED;
78 * efi_net_stop() - stop the network interface
80 * This function implements the Stop service of the
81 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
82 * (UEFI) specification for details.
84 * @this: pointer to the protocol instance
87 static efi_status_t EFIAPI efi_net_stop(struct efi_simple_network *this)
89 efi_status_t ret = EFI_SUCCESS;
91 EFI_ENTRY("%p", this);
93 /* Check parameters */
95 ret = EFI_INVALID_PARAMETER;
99 if (this->mode->state == EFI_NETWORK_STOPPED)
100 ret = EFI_NOT_STARTED;
102 this->mode->state = EFI_NETWORK_STOPPED;
104 return EFI_EXIT(ret);
108 * efi_net_initialize() - initialize the network interface
110 * This function implements the Initialize service of the
111 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
112 * (UEFI) specification for details.
114 * @this: pointer to the protocol instance
115 * @extra_rx: extra receive buffer to be allocated
116 * @extra_tx: extra transmit buffer to be allocated
117 * Return: status code
119 static efi_status_t EFIAPI efi_net_initialize(struct efi_simple_network *this,
120 ulong extra_rx, ulong extra_tx)
123 efi_status_t r = EFI_SUCCESS;
125 EFI_ENTRY("%p, %lx, %lx", this, extra_rx, extra_tx);
127 /* Check parameters */
129 r = EFI_INVALID_PARAMETER;
133 /* Setup packet buffers */
135 /* Disable hardware and put it into the reset state */
137 /* Set current device according to environment variables */
139 /* Get hardware ready for send and receive operations */
143 this->mode->state = EFI_NETWORK_STOPPED;
144 r = EFI_DEVICE_ERROR;
147 this->mode->state = EFI_NETWORK_INITIALIZED;
154 * efi_net_reset() - reinitialize the network interface
156 * This function implements the Reset service of the
157 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
158 * (UEFI) specification for details.
160 * @this: pointer to the protocol instance
161 * @extended_verification: execute exhaustive verification
162 * Return: status code
164 static efi_status_t EFIAPI efi_net_reset(struct efi_simple_network *this,
165 int extended_verification)
167 EFI_ENTRY("%p, %x", this, extended_verification);
169 return EFI_EXIT(EFI_CALL(efi_net_initialize(this, 0, 0)));
173 * efi_net_shutdown() - shut down the network interface
175 * This function implements the Shutdown service of the
176 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
177 * (UEFI) specification for details.
179 * @this: pointer to the protocol instance
180 * Return: status code
182 static efi_status_t EFIAPI efi_net_shutdown(struct efi_simple_network *this)
184 efi_status_t ret = EFI_SUCCESS;
186 EFI_ENTRY("%p", this);
188 /* Check parameters */
190 ret = EFI_INVALID_PARAMETER;
195 this->mode->state = EFI_NETWORK_STOPPED;
198 return EFI_EXIT(ret);
202 * efi_net_receive_filters() - mange multicast receive filters
204 * This function implements the ReceiveFilters service of the
205 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
206 * (UEFI) specification for details.
208 * @this: pointer to the protocol instance
209 * @enable: bit mask of receive filters to enable
210 * @disable: bit mask of receive filters to disable
211 * @reset_mcast_filter: true resets contents of the filters
212 * @mcast_filter_count: number of hardware MAC addresses in the new filters list
213 * @mcast_filter: list of new filters
214 * Return: status code
216 static efi_status_t EFIAPI efi_net_receive_filters
217 (struct efi_simple_network *this, u32 enable, u32 disable,
218 int reset_mcast_filter, ulong mcast_filter_count,
219 struct efi_mac_address *mcast_filter)
221 EFI_ENTRY("%p, %x, %x, %x, %lx, %p", this, enable, disable,
222 reset_mcast_filter, mcast_filter_count, mcast_filter);
224 return EFI_EXIT(EFI_UNSUPPORTED);
228 * efi_net_station_address() - set the hardware MAC address
230 * This function implements the StationAddress service of the
231 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
232 * (UEFI) specification for details.
234 * @this: pointer to the protocol instance
235 * @reset: if true reset the address to default
236 * @new_mac: new MAC address
237 * Return: status code
239 static efi_status_t EFIAPI efi_net_station_address
240 (struct efi_simple_network *this, int reset,
241 struct efi_mac_address *new_mac)
243 EFI_ENTRY("%p, %x, %p", this, reset, new_mac);
245 return EFI_EXIT(EFI_UNSUPPORTED);
249 * efi_net_statistics() - reset or collect statistics of the network interface
251 * This function implements the Statistics service of the
252 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
253 * (UEFI) specification for details.
255 * @this: pointer to the protocol instance
256 * @reset: if true, the statistics are reset
257 * @stat_size: size of the statistics table
258 * @stat_table: table to receive the statistics
259 * Return: status code
261 static efi_status_t EFIAPI efi_net_statistics(struct efi_simple_network *this,
262 int reset, ulong *stat_size,
265 EFI_ENTRY("%p, %x, %p, %p", this, reset, stat_size, stat_table);
267 return EFI_EXIT(EFI_UNSUPPORTED);
271 * efi_net_mcastiptomac() - translate multicast IP address to MAC address
273 * This function implements the Statistics service of the
274 * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface
275 * (UEFI) specification for details.
277 * @this: pointer to the protocol instance
278 * @ipv6: true if the IP address is an IPv6 address
281 * Return: status code
283 static efi_status_t EFIAPI efi_net_mcastiptomac(struct efi_simple_network *this,
285 struct efi_ip_address *ip,
286 struct efi_mac_address *mac)
288 EFI_ENTRY("%p, %x, %p, %p", this, ipv6, ip, mac);
290 return EFI_EXIT(EFI_INVALID_PARAMETER);
294 * efi_net_nvdata() - read or write NVRAM
296 * This function implements the GetStatus service of the Simple Network
297 * Protocol. See the UEFI spec for details.
299 * @this: the instance of the Simple Network Protocol
300 * @readwrite: true for read, false for write
301 * @offset: offset in NVRAM
302 * @buffer_size: size of buffer
304 * Return: status code
306 static efi_status_t EFIAPI efi_net_nvdata(struct efi_simple_network *this,
307 int read_write, ulong offset,
308 ulong buffer_size, char *buffer)
310 EFI_ENTRY("%p, %x, %lx, %lx, %p", this, read_write, offset, buffer_size,
313 return EFI_EXIT(EFI_UNSUPPORTED);
317 * efi_net_get_status() - get interrupt status
319 * This function implements the GetStatus service of the Simple Network
320 * Protocol. See the UEFI spec for details.
322 * @this: the instance of the Simple Network Protocol
323 * @int_status: interface status
324 * @txbuf: transmission buffer
326 static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this,
327 u32 *int_status, void **txbuf)
329 efi_status_t ret = EFI_SUCCESS;
331 EFI_ENTRY("%p, %p, %p", this, int_status, txbuf);
335 /* Check parameters */
337 ret = EFI_INVALID_PARAMETER;
341 switch (this->mode->state) {
342 case EFI_NETWORK_STOPPED:
343 ret = EFI_NOT_STARTED;
345 case EFI_NETWORK_STARTED:
346 ret = EFI_DEVICE_ERROR;
353 /* We send packets synchronously, so nothing is outstanding */
354 *int_status = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
356 *int_status |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;
359 *txbuf = new_tx_packet;
361 new_tx_packet = NULL;
363 return EFI_EXIT(ret);
367 * efi_net_transmit() - transmit a packet
369 * This function implements the Transmit service of the Simple Network Protocol.
370 * See the UEFI spec for details.
372 * @this: the instance of the Simple Network Protocol
373 * @header_size: size of the media header
374 * @buffer_size: size of the buffer to receive the packet
375 * @buffer: buffer to receive the packet
376 * @src_addr: source hardware MAC address
377 * @dest_addr: destination hardware MAC address
378 * @protocol: type of header to build
379 * Return: status code
381 static efi_status_t EFIAPI efi_net_transmit
382 (struct efi_simple_network *this, size_t header_size,
383 size_t buffer_size, void *buffer,
384 struct efi_mac_address *src_addr,
385 struct efi_mac_address *dest_addr, u16 *protocol)
387 efi_status_t ret = EFI_SUCCESS;
389 EFI_ENTRY("%p, %lu, %lu, %p, %p, %p, %p", this,
390 (unsigned long)header_size, (unsigned long)buffer_size,
391 buffer, src_addr, dest_addr, protocol);
395 /* Check parameters */
396 if (!this || !buffer) {
397 ret = EFI_INVALID_PARAMETER;
401 /* We do not support jumbo packets */
402 if (buffer_size > PKTSIZE_ALIGN) {
403 ret = EFI_INVALID_PARAMETER;
409 * TODO: We would need to create the header
410 * if header_size != 0
412 ret = EFI_UNSUPPORTED;
416 switch (this->mode->state) {
417 case EFI_NETWORK_STOPPED:
418 ret = EFI_NOT_STARTED;
420 case EFI_NETWORK_STARTED:
421 ret = EFI_DEVICE_ERROR;
427 /* Ethernet packets always fit, just bounce */
428 memcpy(transmit_buffer, buffer, buffer_size);
429 net_send_packet(transmit_buffer, buffer_size);
431 new_tx_packet = buffer;
434 return EFI_EXIT(ret);
438 * efi_net_receive() - receive a packet from a network interface
440 * This function implements the Receive service of the Simple Network Protocol.
441 * See the UEFI spec for details.
443 * @this: the instance of the Simple Network Protocol
444 * @header_size: size of the media header
445 * @buffer_size: size of the buffer to receive the packet
446 * @buffer: buffer to receive the packet
447 * @src_addr: source MAC address
448 * @dest_addr: destination MAC address
449 * @protocol: protocol
450 * Return: status code
452 static efi_status_t EFIAPI efi_net_receive
453 (struct efi_simple_network *this, size_t *header_size,
454 size_t *buffer_size, void *buffer,
455 struct efi_mac_address *src_addr,
456 struct efi_mac_address *dest_addr, u16 *protocol)
458 efi_status_t ret = EFI_SUCCESS;
459 struct ethernet_hdr *eth_hdr;
460 size_t hdr_size = sizeof(struct ethernet_hdr);
463 EFI_ENTRY("%p, %p, %p, %p, %p, %p, %p", this, header_size,
464 buffer_size, buffer, src_addr, dest_addr, protocol);
469 /* Check parameters */
470 if (!this || !buffer || !buffer_size) {
471 ret = EFI_INVALID_PARAMETER;
475 switch (this->mode->state) {
476 case EFI_NETWORK_STOPPED:
477 ret = EFI_NOT_STARTED;
479 case EFI_NETWORK_STARTED:
480 ret = EFI_DEVICE_ERROR;
486 if (!new_rx_packet) {
490 /* Check that we at least received an Ethernet header */
491 if (net_rx_packet_len < sizeof(struct ethernet_hdr)) {
492 new_rx_packet = false;
496 /* Fill export parameters */
497 eth_hdr = (struct ethernet_hdr *)net_rx_packet;
498 protlen = ntohs(eth_hdr->et_protlen);
499 if (protlen == 0x8100) {
501 protlen = ntohs(*(u16 *)&net_rx_packet[hdr_size - 2]);
504 *header_size = hdr_size;
506 memcpy(dest_addr, eth_hdr->et_dest, ARP_HLEN);
508 memcpy(src_addr, eth_hdr->et_src, ARP_HLEN);
511 if (*buffer_size < net_rx_packet_len) {
512 /* Packet doesn't fit, try again with bigger buffer */
513 *buffer_size = net_rx_packet_len;
514 ret = EFI_BUFFER_TOO_SMALL;
518 memcpy(buffer, net_rx_packet, net_rx_packet_len);
519 *buffer_size = net_rx_packet_len;
520 new_rx_packet = false;
522 return EFI_EXIT(ret);
526 * efi_net_set_dhcp_ack() - take note of a selected DHCP IP address
528 * This function is called by dhcp_handler().
530 void efi_net_set_dhcp_ack(void *pkt, int len)
532 int maxsize = sizeof(*dhcp_ack);
535 dhcp_ack = malloc(maxsize);
537 memcpy(dhcp_ack, pkt, min(len, maxsize));
541 * efi_net_push() - callback for received network packet
543 * This function is called when a network packet is received by eth_rx().
545 * @pkt: network packet
548 static void efi_net_push(void *pkt, int len)
550 new_rx_packet = true;
551 wait_for_packet->is_signaled = true;
555 * efi_network_timer_notify() - check if a new network packet has been received
557 * This notification function is called in every timer cycle.
559 * @event the event for which this notification function is registered
560 * @context event context - not used in this function
562 static void EFIAPI efi_network_timer_notify(struct efi_event *event,
565 struct efi_simple_network *this = (struct efi_simple_network *)context;
567 EFI_ENTRY("%p, %p", event, context);
570 * Some network drivers do not support calling eth_rx() before
573 if (!this || this->mode->state != EFI_NETWORK_INITIALIZED)
576 if (!new_rx_packet) {
577 push_packet = efi_net_push;
582 EFI_EXIT(EFI_SUCCESS);
585 static efi_status_t EFIAPI efi_pxe_base_code_start(
586 struct efi_pxe_base_code_protocol *this,
589 return EFI_UNSUPPORTED;
592 static efi_status_t EFIAPI efi_pxe_base_code_stop(
593 struct efi_pxe_base_code_protocol *this)
595 return EFI_UNSUPPORTED;
598 static efi_status_t EFIAPI efi_pxe_base_code_dhcp(
599 struct efi_pxe_base_code_protocol *this,
602 return EFI_UNSUPPORTED;
605 static efi_status_t EFIAPI efi_pxe_base_code_discover(
606 struct efi_pxe_base_code_protocol *this,
607 u16 type, u16 *layer, u8 bis,
608 struct efi_pxe_base_code_discover_info *info)
610 return EFI_UNSUPPORTED;
613 static efi_status_t EFIAPI efi_pxe_base_code_mtftp(
614 struct efi_pxe_base_code_protocol *this,
615 u32 operation, void *buffer_ptr,
616 u8 overwrite, efi_uintn_t *buffer_size,
617 struct efi_ip_address server_ip, char *filename,
618 struct efi_pxe_base_code_mtftp_info *info,
621 return EFI_UNSUPPORTED;
624 static efi_status_t EFIAPI efi_pxe_base_code_udp_write(
625 struct efi_pxe_base_code_protocol *this,
626 u16 op_flags, struct efi_ip_address *dest_ip,
628 struct efi_ip_address *gateway_ip,
629 struct efi_ip_address *src_ip, u16 *src_port,
630 efi_uintn_t *header_size, void *header_ptr,
631 efi_uintn_t *buffer_size, void *buffer_ptr)
633 return EFI_UNSUPPORTED;
636 static efi_status_t EFIAPI efi_pxe_base_code_udp_read(
637 struct efi_pxe_base_code_protocol *this,
638 u16 op_flags, struct efi_ip_address *dest_ip,
639 u16 *dest_port, struct efi_ip_address *src_ip,
640 u16 *src_port, efi_uintn_t *header_size,
641 void *header_ptr, efi_uintn_t *buffer_size,
644 return EFI_UNSUPPORTED;
647 static efi_status_t EFIAPI efi_pxe_base_code_set_ip_filter(
648 struct efi_pxe_base_code_protocol *this,
649 struct efi_pxe_base_code_filter *new_filter)
651 return EFI_UNSUPPORTED;
654 static efi_status_t EFIAPI efi_pxe_base_code_arp(
655 struct efi_pxe_base_code_protocol *this,
656 struct efi_ip_address *ip_addr,
657 struct efi_mac_address *mac_addr)
659 return EFI_UNSUPPORTED;
662 static efi_status_t EFIAPI efi_pxe_base_code_set_parameters(
663 struct efi_pxe_base_code_protocol *this,
664 u8 *new_auto_arp, u8 *new_send_guid,
665 u8 *new_ttl, u8 *new_tos,
666 u8 *new_make_callback)
668 return EFI_UNSUPPORTED;
671 static efi_status_t EFIAPI efi_pxe_base_code_set_station_ip(
672 struct efi_pxe_base_code_protocol *this,
673 struct efi_ip_address *new_station_ip,
674 struct efi_ip_address *new_subnet_mask)
676 return EFI_UNSUPPORTED;
679 static efi_status_t EFIAPI efi_pxe_base_code_set_packets(
680 struct efi_pxe_base_code_protocol *this,
681 u8 *new_dhcp_discover_valid,
682 u8 *new_dhcp_ack_received,
683 u8 *new_proxy_offer_received,
684 u8 *new_pxe_discover_valid,
685 u8 *new_pxe_reply_received,
686 u8 *new_pxe_bis_reply_received,
687 EFI_PXE_BASE_CODE_PACKET *new_dchp_discover,
688 EFI_PXE_BASE_CODE_PACKET *new_dhcp_acc,
689 EFI_PXE_BASE_CODE_PACKET *new_proxy_offer,
690 EFI_PXE_BASE_CODE_PACKET *new_pxe_discover,
691 EFI_PXE_BASE_CODE_PACKET *new_pxe_reply,
692 EFI_PXE_BASE_CODE_PACKET *new_pxe_bis_reply)
694 return EFI_UNSUPPORTED;
698 * efi_net_register() - register the simple network protocol
700 * This gets called from do_bootefi_exec().
702 efi_status_t efi_net_register(void)
704 struct efi_net_obj *netobj = NULL;
707 if (!eth_get_dev()) {
708 /* No network device active, don't expose any */
712 /* We only expose the "active" network device, so one is enough */
713 netobj = calloc(1, sizeof(*netobj));
715 goto out_of_resources;
717 /* Allocate an aligned transmit buffer */
718 transmit_buffer = calloc(1, PKTSIZE_ALIGN + PKTALIGN);
719 if (!transmit_buffer)
720 goto out_of_resources;
721 transmit_buffer = (void *)ALIGN((uintptr_t)transmit_buffer, PKTALIGN);
723 /* Hook net up to the device list */
724 efi_add_handle(&netobj->header);
726 /* Fill in object data */
727 r = efi_add_protocol(&netobj->header, &efi_net_guid,
729 if (r != EFI_SUCCESS)
730 goto failure_to_add_protocol;
731 r = efi_add_protocol(&netobj->header, &efi_guid_device_path,
733 if (r != EFI_SUCCESS)
734 goto failure_to_add_protocol;
735 r = efi_add_protocol(&netobj->header, &efi_pxe_base_code_protocol_guid,
737 if (r != EFI_SUCCESS)
738 goto failure_to_add_protocol;
739 netobj->net.revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;
740 netobj->net.start = efi_net_start;
741 netobj->net.stop = efi_net_stop;
742 netobj->net.initialize = efi_net_initialize;
743 netobj->net.reset = efi_net_reset;
744 netobj->net.shutdown = efi_net_shutdown;
745 netobj->net.receive_filters = efi_net_receive_filters;
746 netobj->net.station_address = efi_net_station_address;
747 netobj->net.statistics = efi_net_statistics;
748 netobj->net.mcastiptomac = efi_net_mcastiptomac;
749 netobj->net.nvdata = efi_net_nvdata;
750 netobj->net.get_status = efi_net_get_status;
751 netobj->net.transmit = efi_net_transmit;
752 netobj->net.receive = efi_net_receive;
753 netobj->net.mode = &netobj->net_mode;
754 netobj->net_mode.state = EFI_NETWORK_STARTED;
755 memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6);
756 netobj->net_mode.hwaddr_size = ARP_HLEN;
757 netobj->net_mode.max_packet_size = PKTSIZE;
758 netobj->net_mode.if_type = ARP_ETHER;
760 netobj->pxe.revision = EFI_PXE_BASE_CODE_PROTOCOL_REVISION;
761 netobj->pxe.start = efi_pxe_base_code_start;
762 netobj->pxe.stop = efi_pxe_base_code_stop;
763 netobj->pxe.dhcp = efi_pxe_base_code_dhcp;
764 netobj->pxe.discover = efi_pxe_base_code_discover;
765 netobj->pxe.mtftp = efi_pxe_base_code_mtftp;
766 netobj->pxe.udp_write = efi_pxe_base_code_udp_write;
767 netobj->pxe.udp_read = efi_pxe_base_code_udp_read;
768 netobj->pxe.set_ip_filter = efi_pxe_base_code_set_ip_filter;
769 netobj->pxe.arp = efi_pxe_base_code_arp;
770 netobj->pxe.set_parameters = efi_pxe_base_code_set_parameters;
771 netobj->pxe.set_station_ip = efi_pxe_base_code_set_station_ip;
772 netobj->pxe.set_packets = efi_pxe_base_code_set_packets;
773 netobj->pxe.mode = &netobj->pxe_mode;
775 netobj->pxe_mode.dhcp_ack = *dhcp_ack;
778 * Create WaitForPacket event.
780 r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK,
781 efi_network_timer_notify, NULL, NULL,
783 if (r != EFI_SUCCESS) {
784 printf("ERROR: Failed to register network event\n");
787 netobj->net.wait_for_packet = wait_for_packet;
789 * Create a timer event.
791 * The notification function is used to check if a new network packet
794 * iPXE is running at TPL_CALLBACK most of the time. Use a higher TPL.
796 r = efi_create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_NOTIFY,
797 efi_network_timer_notify, &netobj->net, NULL,
798 &network_timer_event);
799 if (r != EFI_SUCCESS) {
800 printf("ERROR: Failed to register network event\n");
803 /* Network is time critical, create event in every timer cycle */
804 r = efi_set_timer(network_timer_event, EFI_TIMER_PERIODIC, 0);
805 if (r != EFI_SUCCESS) {
806 printf("ERROR: Failed to set network timer\n");
811 failure_to_add_protocol:
812 printf("ERROR: Failure to add protocol\n");
816 /* free(transmit_buffer) not needed yet */
817 printf("ERROR: Out of memory\n");
818 return EFI_OUT_OF_RESOURCES;