summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_device_path.c
diff options
context:
space:
mode:
authorAdriano Cordova <adrianox@gmail.com>2025-03-03 11:13:14 -0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2025-03-10 07:01:37 +0100
commit267b0a7ddf89d414000d98345aa3222c7e01ff38 (patch)
tree45e8354ed7d018dc371436b295f688eb807fdbbf /lib/efi_loader/efi_device_path.c
parent6a832d4b2e5d4d1ebc9d036afcc02d9550257ab2 (diff)
efi_loader: efi_device_path: Pass net udevice as argument
In preparation to support multiple EFI net objects, support constructing device paths using an ethernet device different than the default. Add a udevice argument to the device path generation, and keep the callsites with eth_get_dev() to preserve existing functionality. Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Diffstat (limited to 'lib/efi_loader/efi_device_path.c')
-rw-r--r--lib/efi_loader/efi_device_path.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index c0633a736b6..64183d40340 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -954,20 +954,20 @@ struct efi_device_path *efi_dp_from_uart(void)
return buf;
}
-struct efi_device_path __maybe_unused *efi_dp_from_eth(void)
+struct efi_device_path __maybe_unused *efi_dp_from_eth(struct udevice *dev)
{
void *buf, *start;
unsigned dpsize = 0;
- assert(eth_get_dev());
+ assert(dev);
- dpsize += dp_size(eth_get_dev());
+ dpsize += dp_size(dev);
start = buf = efi_alloc(dpsize + sizeof(END));
if (!buf)
return NULL;
- buf = dp_fill(buf, eth_get_dev());
+ buf = dp_fill(buf, dev);
*((struct efi_device_path *)buf) = END;
@@ -984,11 +984,13 @@ struct efi_device_path __maybe_unused *efi_dp_from_eth(void)
* @ip: IPv4 local address
* @mask: network mask
* @srv: IPv4 remote/server address
+ * @dev: net udevice
* Return: pointer to device path, NULL on error
*/
static struct efi_device_path *efi_dp_from_ipv4(struct efi_ipv4_address *ip,
struct efi_ipv4_address *mask,
- struct efi_ipv4_address *srv)
+ struct efi_ipv4_address *srv,
+ struct udevice *dev)
{
struct efi_device_path *dp1, *dp2, *pos;
struct {
@@ -1010,7 +1012,7 @@ static struct efi_device_path *efi_dp_from_ipv4(struct efi_ipv4_address *ip,
pos = &dp.end;
memcpy(pos, &END, sizeof(END));
- dp1 = efi_dp_from_eth();
+ dp1 = efi_dp_from_eth(dev);
if (!dp1)
return NULL;
@@ -1029,9 +1031,10 @@ static struct efi_device_path *efi_dp_from_ipv4(struct efi_ipv4_address *ip,
* and an END node.
*
* @server: URI of remote server
+ * @dev: net udevice
* Return: pointer to HTTP device path, NULL on error
*/
-struct efi_device_path *efi_dp_from_http(const char *server)
+struct efi_device_path *efi_dp_from_http(const char *server, struct udevice *dev)
{
struct efi_device_path *dp1, *dp2;
struct efi_device_path_uri *uridp;
@@ -1047,10 +1050,11 @@ struct efi_device_path *efi_dp_from_http(const char *server)
efi_net_get_addr(&ip, &mask, NULL);
- dp1 = efi_dp_from_ipv4(&ip, &mask, NULL);
+ dp1 = efi_dp_from_ipv4(&ip, &mask, NULL, dev);
if (!dp1)
return NULL;
+
strcpy(tmp, "http://");
if (server) {