iPXE
Functions
efi_autoboot.h File Reference

EFI autoboot device. More...

#include <ipxe/efi/efi.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
int efi_set_autoboot_ll_addr (EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *path)
 Identify autoboot device. More...
 

Detailed Description

EFI autoboot device.

Definition in file efi_autoboot.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ efi_set_autoboot_ll_addr()

int efi_set_autoboot_ll_addr ( EFI_HANDLE  device,
EFI_DEVICE_PATH_PROTOCOL path 
)

Identify autoboot device.

Parameters
deviceDevice handle
pathDevice path
Return values
rcReturn status code

Definition at line 49 of file efi_autoboot.c.

50  {
52  union {
54  void *interface;
55  } snp;
57  EFI_STATUS efirc;
58  unsigned int vlan;
59  int rc;
60 
61  /* Look for an SNP instance on the image's device handle */
62  if ( ( efirc = bs->OpenProtocol ( device,
64  &snp.interface, efi_image_handle,
65  NULL,
67  rc = -EEFI ( efirc );
68  DBGC ( device, "EFI %s has no SNP instance: %s\n",
69  efi_handle_name ( device ), strerror ( rc ) );
70  return rc;
71  }
72 
73  /* Record autoboot device */
74  mode = snp.snp->Mode;
75  vlan = efi_path_vlan ( path );
77  vlan );
78  DBGC ( device, "EFI %s found autoboot link-layer address:\n",
79  efi_handle_name ( device ) );
80  DBGC_HDA ( device, 0, &mode->CurrentAddress, mode->HwAddressSize );
81  if ( vlan ) {
82  DBGC ( device, "EFI %s found autoboot VLAN %d\n",
83  efi_handle_name ( device ), vlan );
84  }
85 
86  /* Configure automatic VLAN device, if applicable */
87  if ( vlan && ( mode->HwAddressSize == ETH_ALEN ) ) {
88  vlan_auto ( &mode->CurrentAddress, vlan );
89  DBGC ( device, "EFI %s configured automatic VLAN %d\n",
90  efi_handle_name ( device ), vlan );
91  }
92 
93  /* Close protocol */
96 
97  return 0;
98 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
unsigned int efi_path_vlan(EFI_DEVICE_PATH_PROTOCOL *path)
Get VLAN tag from device path.
Definition: efi_path.c:180
The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access to a network adapter.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:171
EFI_GUID efi_simple_network_protocol_guid
Simple network protocol GUID.
Definition: efi_guid.c:307
#define DBGC(...)
Definition: compiler.h:505
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1987
EFI_MAC_ADDRESS CurrentAddress
The current HW MAC address for the network interface.
A hardware device.
Definition: device.h:73
void vlan_auto(const void *ll_addr, unsigned int tag)
Configure automatic VLAN device.
Definition: vlan.c:462
An object interface.
Definition: interface.h:124
#define DBGC_HDA(...)
Definition: compiler.h:506
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
Definition: UefiSpec.h:1344
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:34
void set_autoboot_ll_addr(const void *ll_addr, size_t len, unsigned int vlan)
Identify autoboot device by link-layer address.
Definition: autoboot.c:520
#define ETH_ALEN
Definition: if_ether.h:8
UINT32 HwAddressSize
The size, in bytes, of the network interface's HW address.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1986
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseProtocol, EFI_SIMPLE_NETWORK_MODE::CurrentAddress, DBGC, DBGC_HDA, EEFI, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_path_vlan(), efi_simple_network_protocol_guid, efi_systab, ETH_ALEN, EFI_SIMPLE_NETWORK_MODE::HwAddressSize, NULL, EFI_BOOT_SERVICES::OpenProtocol, rc, set_autoboot_ll_addr(), strerror(), and vlan_auto().

Referenced by efi_init_application().