efi_loader: expose symbols to be used by the EFI network stack
The following symbols are exposed:
- efi_reinstall_protocol_interface
This is done so that the device path protocol interface
of the network device can be changed internally by u-boot
when a new bootfile gets downloaded.
- eth_set_dev
To support multiple network udevices
- efi_close_event
This comes in preparation to support unregistering
an EFI network device from the EFI network stack when
the underlying U-boot device gets removed
- efi_[dis]connect_controller
The EFI network driver uses ConnectController to add a
NIC to the EFI network stack.
- efi_uninstall_protocol_interface
connect_controler for the efi network driver can install
protocols, which need to be uninstalled in disconnect_controller
- EFI_SIMPLE_NETWORK_PROTOCOL_GUID
Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 1d75d97..6a17a41 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -321,6 +321,8 @@
#endif
/* GUID of the EFI_BLOCK_IO_PROTOCOL */
extern const efi_guid_t efi_block_io_guid;
+/* GUID of the EFI_SIMPLE_NETWORK_PROTOCOL */
+extern const efi_guid_t efi_net_guid;
extern const efi_guid_t efi_global_variable_guid;
extern const efi_guid_t efi_guid_console_control;
extern const efi_guid_t efi_guid_device_path;
@@ -733,6 +735,10 @@
efi_status_t efi_add_protocol(const efi_handle_t handle,
const efi_guid_t *protocol,
void *protocol_interface);
+/* Uninstall new protocol on a handle */
+efi_status_t efi_uninstall_protocol
+ (efi_handle_t handle, const efi_guid_t *protocol,
+ void *protocol_interface, bool preserve);
/* Reinstall a protocol on a handle */
efi_status_t EFIAPI efi_reinstall_protocol_interface(
efi_handle_t handle,
@@ -748,6 +754,15 @@
efi_install_multiple_protocol_interfaces(efi_handle_t *handle, ...);
efi_status_t EFIAPI
efi_uninstall_multiple_protocol_interfaces(efi_handle_t handle, ...);
+/* Connect and disconnect controller */
+efi_status_t EFIAPI efi_connect_controller(efi_handle_t controller_handle,
+ efi_handle_t *driver_image_handle,
+ struct efi_device_path *remain_device_path,
+ bool recursive);
+efi_status_t EFIAPI efi_disconnect_controller(
+ efi_handle_t controller_handle,
+ efi_handle_t driver_image_handle,
+ efi_handle_t child_handle);
/* Get handles that support a given protocol */
efi_status_t EFIAPI efi_locate_handle_buffer(
enum efi_locate_search_type search_type,
@@ -768,6 +783,8 @@
void *context),
void *notify_context, const efi_guid_t *group,
struct efi_event **event);
+/* Call this to close an event */
+efi_status_t EFIAPI efi_close_event(struct efi_event *event);
/* Call this to set a timer */
efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
uint64_t trigger_time);
diff --git a/include/net-common.h b/include/net-common.h
index 29d31f3..1d507b1 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -291,6 +291,7 @@
#define eth_get_ops(dev) ((struct eth_ops *)(dev)->driver->ops)
struct udevice *eth_get_dev(void); /* get the current device */
+void eth_set_dev(struct udevice *dev); /* set a device */
unsigned char *eth_get_ethaddr(void); /* get the current device MAC */
int eth_rx(void); /* Check for received packets */
void eth_halt(void); /* stop SCC */
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 5164cb1..02ad9f7 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -60,9 +60,9 @@
static volatile gd_t *efi_gd, *app_gd;
#endif
-static efi_status_t efi_uninstall_protocol
- (efi_handle_t handle, const efi_guid_t *protocol,
- void *protocol_interface, bool preserve);
+efi_status_t efi_uninstall_protocol
+ (efi_handle_t handle, const efi_guid_t *protocol,
+ void *protocol_interface, bool preserve);
/* 1 if inside U-Boot code, 0 if inside EFI payload code */
static int entry_count = 1;
@@ -100,12 +100,11 @@
/* GUID of the SMBIOS table */
const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
-static efi_status_t EFIAPI efi_disconnect_controller(
+efi_status_t EFIAPI efi_disconnect_controller(
efi_handle_t controller_handle,
efi_handle_t driver_image_handle,
efi_handle_t child_handle);
-static
efi_status_t EFIAPI efi_connect_controller(efi_handle_t controller_handle,
efi_handle_t *driver_image_handle,
struct efi_device_path *remain_device_path,
@@ -1039,7 +1038,7 @@
*
* Return: status code
*/
-static efi_status_t EFIAPI efi_close_event(struct efi_event *event)
+efi_status_t EFIAPI efi_close_event(struct efi_event *event)
{
struct efi_register_notify_event *item, *next;
@@ -1380,9 +1379,9 @@
*
* Return: status code
*/
-static efi_status_t efi_uninstall_protocol
- (efi_handle_t handle, const efi_guid_t *protocol,
- void *protocol_interface, bool preserve)
+efi_status_t efi_uninstall_protocol
+ (efi_handle_t handle, const efi_guid_t *protocol,
+ void *protocol_interface, bool preserve)
{
struct efi_handler *handler;
struct efi_open_protocol_info_item *item;
@@ -3665,7 +3664,7 @@
*
* Return: status code
*/
-static efi_status_t EFIAPI efi_connect_controller(
+efi_status_t EFIAPI efi_connect_controller(
efi_handle_t controller_handle,
efi_handle_t *driver_image_handle,
struct efi_device_path *remain_device_path,
@@ -3844,7 +3843,7 @@
*
* Return: status code
*/
-static efi_status_t EFIAPI efi_disconnect_controller(
+efi_status_t EFIAPI efi_disconnect_controller(
efi_handle_t controller_handle,
efi_handle_t driver_image_handle,
efi_handle_t child_handle)
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 60aa076..afca200 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -24,7 +24,7 @@
#include <vsprintf.h>
#include <net.h>
-static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
+const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
static const efi_guid_t efi_pxe_base_code_protocol_guid =
EFI_PXE_BASE_CODE_PROTOCOL_GUID;
static struct efi_pxe_packet *dhcp_ack;
diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c
index 15af8d3..b00c76c 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -67,7 +67,6 @@
static struct efi_boot_services *boottime;
static struct efi_simple_network *net;
static struct efi_event *timer;
-static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
/* IP packet ID */
static unsigned int net_ip_id;