struct udevice;
/*
- * END - Template end node for EFI device paths.
+ * EFI_DP_END - Template end node for EFI device paths.
*
* Represents the terminating node of an EFI device path.
* It has a type of DEVICE_PATH_TYPE_END and sub_type DEVICE_PATH_SUB_TYPE_END
*/
-extern const struct efi_device_path END;
+extern const struct efi_device_path EFI_DP_END;
/**
* efi_dp_next() - Iterate to next block in device-path
* efi_dp_last_node() - Determine the last device path node before the end node
*
* Iterate through the device path to find the very last node before
- * the terminating END node.
+ * the terminating EFI_DP_END node.
*
* @dp: Pointer to the device path.
* Return: Pointer to the last actual data node before the end node if it exists
- * otherwise NULL (e.g., if dp is NULL or only an END node).
+ * otherwise NULL (e.g., if dp is NULL or only an EFI_DP_END node).
*/
const struct efi_device_path *efi_dp_last_node(const struct efi_device_path *dp);
* end node (if any) or the final device path. The end node is not included.
*
* @dp: Pointer to the device path.
- * Return: Size in bytes of the first instance, or 0 if dp is NULL or an END
- * node
+ * Return: Size in bytes of the first instance, or 0 if dp is NULL or an
+ * EFI_DP_END node
*/
efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp);
*
* @dp: Pointer to the device path.
* Return: Total size in bytes of all nodes in the device path (excluding the
- * final END node), or 0 if dp is NULL.
+ * final EFI_DP_END node), or 0 if dp is NULL.
*/
efi_uintn_t efi_dp_size(const struct efi_device_path *dp);
* @dp2: Second device path
* @split_end_node:
* - 0 to concatenate (dp1 is assumed not to have an end node or it's ignored,
- * dp2 is appended, then one END node)
+ * dp2 is appended, then one EFI_DP_END node)
* - 1 to concatenate with end node added as separator (dp1, END_THIS_INSTANCE,
* dp2, END_ENTIRE)
*
* Create a new device path by appending a given node to an existing
* device path.
* If the original device path @dp is NULL, a new path is created
- * with the given @node followed by an END node.
+ * with the given @node followed by an EFI_DP_END node.
* If the @node is NULL and @dp is not NULL, the original path @dp is
* duplicated.
- * If both @dp and @node are NULL, a path with only an END node is returned.
+ * If both @dp and @node are NULL, a path with only an EFI_DP_END node is
+ * returned.
* The caller must free the returned path (e.g., using efi_free()).
*
* @dp: Original device path (can be NULL).
*
* Given a pointer to a pointer to a device path (@dp), this function extracts
* the first instance from the path. It allocates a new path for this extracted
- * instance (including its instance-specific END node). The input pointer
+ * instance (including its instance-specific EFI_DP_END node). The input pointer
* (*@dp) is then updated to point to the start of the next instance in the
* original path, or set to NULL if no more instances remain.
* The caller is responsible for freeing the returned instance path (e.g.,
* On output, *@dp is updated to point to the start of the next instance,
* or NULL if no more instances.
* @size: Optional pointer to an efi_uintn_t variable that will receive the size
- * of the extracted instance path (including its END node).
+ * of the extracted instance path (including its EFI_DP_END node).
* Return: Pointer to a newly allocated device path for the extracted instance,
* or NULL if no instance could be extracted or an error occurred (e.g.,
* allocation failure).
*
* Set the device path to an IPv4 path as provided by efi_dp_from_ipv4
* concatenated with a device path of subtype DEVICE_PATH_SUB_TYPE_MSG_URI,
- * and an END node.
+ * and an EFI_DP_END node.
*
* @server: URI of remote server
* @dev: net udevice
#include <asm-generic/unaligned.h>
#include <linux/compat.h> /* U16_MAX */
-/* template END node: */
-const struct efi_device_path END = {
+/* template EFI_DP_END node: */
+const struct efi_device_path EFI_DP_END = {
.type = DEVICE_PATH_TYPE_END,
.sub_type = DEVICE_PATH_SUB_TYPE_END,
- .length = sizeof(END),
+ .length = sizeof(EFI_DP_END),
};
#if defined(CONFIG_MMC)
struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp)
{
struct efi_device_path *ndp;
- size_t sz = efi_dp_size(dp) + sizeof(END);
+ size_t sz = efi_dp_size(dp) + sizeof(EFI_DP_END);
if (!dp)
return NULL;
if (!dp1 && !dp2) {
/* return an end node */
- ret = efi_dp_dup(&END);
+ ret = efi_dp_dup(&EFI_DP_END);
} else if (!dp1) {
ret = efi_dp_dup(dp2);
} else if (!dp2) {
sz1 = split_end_node;
if (split_end_node)
- end_size = 2 * sizeof(END);
+ end_size = 2 * sizeof(EFI_DP_END);
else
- end_size = sizeof(END);
+ end_size = sizeof(EFI_DP_END);
p = efi_alloc(sz1 + sz2 + end_size);
if (!p)
return NULL;
p += sz1;
if (split_end_node) {
- memcpy(p, &END, sizeof(END));
- p += sizeof(END);
+ memcpy(p, &EFI_DP_END, sizeof(EFI_DP_END));
+ p += sizeof(EFI_DP_END);
}
/* the end node of the second device path has to be retained */
memcpy(p, dp2, sz2);
p += sz2;
- memcpy(p, &END, sizeof(END));
+ memcpy(p, &EFI_DP_END, sizeof(EFI_DP_END));
}
return ret;
struct efi_device_path *ret;
if (!node && !dp) {
- ret = efi_dp_dup(&END);
+ ret = efi_dp_dup(&EFI_DP_END);
} else if (!node) {
ret = efi_dp_dup(dp);
} else if (!dp) {
size_t sz = node->length;
- void *p = efi_alloc(sz + sizeof(END));
+ void *p = efi_alloc(sz + sizeof(EFI_DP_END));
if (!p)
return NULL;
memcpy(p, node, sz);
- memcpy(p + sz, &END, sizeof(END));
+ memcpy(p + sz, &EFI_DP_END, sizeof(EFI_DP_END));
ret = p;
} else {
/* both dp and node are non-null */
size_t sz = efi_dp_size(dp);
- void *p = efi_alloc(sz + node->length + sizeof(END));
+ void *p = efi_alloc(sz + node->length + sizeof(EFI_DP_END));
if (!p)
return NULL;
memcpy(p, dp, sz);
memcpy(p + sz, node, node->length);
- memcpy(p + sz + node->length, &END, sizeof(END));
+ memcpy(p + sz + node->length, &EFI_DP_END, sizeof(EFI_DP_END));
ret = p;
}
return efi_dp_dup(dpi);
sz = efi_dp_size(dp);
szi = efi_dp_instance_size(dpi);
- p = efi_alloc(sz + szi + 2 * sizeof(END));
+ p = efi_alloc(sz + szi + 2 * sizeof(EFI_DP_END));
if (!p)
return NULL;
ret = p;
- memcpy(p, dp, sz + sizeof(END));
+ memcpy(p, dp, sz + sizeof(EFI_DP_END));
p = (void *)p + sz;
p->sub_type = DEVICE_PATH_SUB_TYPE_INSTANCE_END;
- p = (void *)p + sizeof(END);
+ p = (void *)p + sizeof(EFI_DP_END);
memcpy(p, dpi, szi);
p = (void *)p + szi;
- memcpy(p, &END, sizeof(END));
+ memcpy(p, &EFI_DP_END, sizeof(EFI_DP_END));
return ret;
}
if (!dp || !*dp)
return NULL;
sz = efi_dp_instance_size(*dp);
- p = efi_alloc(sz + sizeof(END));
+ p = efi_alloc(sz + sizeof(EFI_DP_END));
if (!p)
return NULL;
- memcpy(p, *dp, sz + sizeof(END));
+ memcpy(p, *dp, sz + sizeof(EFI_DP_END));
*dp = (void *)*dp + sz;
if ((*dp)->sub_type == DEVICE_PATH_SUB_TYPE_INSTANCE_END)
- *dp = (void *)*dp + sizeof(END);
+ *dp = (void *)*dp + sizeof(EFI_DP_END);
else
*dp = NULL;
if (size)
- *size = sz + sizeof(END);
+ *size = sz + sizeof(EFI_DP_END);
return p;
}
{
void *buf, *start;
- start = buf = efi_alloc(dp_part_size(desc, part) + sizeof(END));
- if (!buf)
+ start = efi_alloc(dp_part_size(desc, part) + sizeof(EFI_DP_END));
+ if (!start)
return NULL;
- buf = dp_part_fill(buf, desc, part);
+ buf = dp_part_fill(start, desc, part);
- *((struct efi_device_path *)buf) = END;
+ *((struct efi_device_path *)buf) = EFI_DP_END;
return start;
}
if (fpsize > U16_MAX)
return NULL;
- buf = efi_alloc(dpsize + fpsize + sizeof(END));
+ buf = efi_alloc(dpsize + fpsize + sizeof(EFI_DP_END));
if (!buf)
return NULL;
pos += fpsize;
}
- memcpy(pos, &END, sizeof(END));
+ memcpy(pos, &EFI_DP_END, sizeof(EFI_DP_END));
return buf;
}
{
void *buf, *pos;
struct efi_device_path_uart *uart;
- size_t dpsize = dp_size(dm_root()) + sizeof(*uart) + sizeof(END);
+ size_t dpsize = dp_size(dm_root()) + sizeof(*uart) + sizeof(EFI_DP_END);
buf = efi_alloc(dpsize);
if (!buf)
uart->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_UART;
uart->dp.length = sizeof(*uart);
pos += sizeof(*uart);
- memcpy(pos, &END, sizeof(END));
+ memcpy(pos, &EFI_DP_END, sizeof(EFI_DP_END));
return buf;
}
dpsize += dp_size(dev);
- start = buf = efi_alloc(dpsize + sizeof(END));
- if (!buf)
+ start = efi_alloc(dpsize + sizeof(EFI_DP_END));
+ if (!start)
return NULL;
- buf = dp_fill(buf, dev);
+ buf = dp_fill(start, dev);
- *((struct efi_device_path *)buf) = END;
+ *((struct efi_device_path *)buf) = EFI_DP_END;
return start;
}
*
* Set the device path to an ethernet device path as provided by
* efi_dp_from_eth() concatenated with a device path of subtype
- * DEVICE_PATH_SUB_TYPE_MSG_IPV4, and an END node.
+ * DEVICE_PATH_SUB_TYPE_MSG_IPV4, and an EFI_DP_END node.
*
* @ip: IPv4 local address
* @mask: network mask
if (srv)
memcpy(&dp.ipv4dp.remote_ip_address, srv, sizeof(*srv));
pos = &dp.end;
- memcpy(pos, &END, sizeof(END));
+ memcpy(pos, &EFI_DP_END, sizeof(EFI_DP_END));
dp1 = efi_dp_from_eth(dev);
if (!dp1)
}
uridp_len = sizeof(struct efi_device_path) + strlen(tmp) + 1;
- uridp = efi_alloc(uridp_len + sizeof(END));
+ uridp = efi_alloc(uridp_len + sizeof(EFI_DP_END));
if (!uridp) {
log_err("Out of memory\n");
return NULL;
memcpy(uridp->uri, tmp, strlen(tmp) + 1);
pos = (char *)uridp + uridp_len;
- memcpy(pos, &END, sizeof(END));
+ memcpy(pos, &EFI_DP_END, sizeof(EFI_DP_END));
dp2 = efi_dp_concat(dp1, (const struct efi_device_path *)uridp, 0);
struct efi_device_path_memory *mdp;
void *buf, *start;
- start = buf = efi_alloc(sizeof(*mdp) + sizeof(END));
- if (!buf)
+ start = efi_alloc(sizeof(*mdp) + sizeof(EFI_DP_END));
+ if (!start)
return NULL;
- mdp = buf;
+ mdp = start;
mdp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE;
mdp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MEMORY;
mdp->dp.length = sizeof(*mdp);
mdp->end_address = start_address + size;
buf = &mdp[1];
- *((struct efi_device_path *)buf) = END;
+ *((struct efi_device_path *)buf) = EFI_DP_END;
return start;
}