Lines Matching refs:dp

27 	.dp = {
71 struct efi_device_path *efi_dp_next(const struct efi_device_path *dp) in efi_dp_next() argument
73 if (dp == NULL) in efi_dp_next()
75 if (dp->type == DEVICE_PATH_TYPE_END) in efi_dp_next()
77 dp = ((void *)dp) + dp->length; in efi_dp_next()
78 if (dp->type == DEVICE_PATH_TYPE_END) in efi_dp_next()
80 return (struct efi_device_path *)dp; in efi_dp_next()
124 static struct efi_device_path *shorten_path(struct efi_device_path *dp) in shorten_path() argument
126 while (dp) { in shorten_path()
132 if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB_CLASS) || in shorten_path()
133 EFI_DP_TYPE(dp, MEDIA_DEVICE, HARD_DRIVE_PATH) || in shorten_path()
134 EFI_DP_TYPE(dp, MEDIA_DEVICE, FILE_PATH)) in shorten_path()
135 return dp; in shorten_path()
137 dp = efi_dp_next(dp); in shorten_path()
140 return dp; in shorten_path()
143 static struct efi_object *find_obj(struct efi_device_path *dp, bool short_path, in find_obj() argument
147 efi_uintn_t dp_size = efi_dp_instance_size(dp); in find_obj()
161 if (efi_dp_match(dp, obj_dp) == 0) { in find_obj()
167 *rem = ((void *)dp) + in find_obj()
189 struct efi_object *efi_dp_find_obj(struct efi_device_path *dp, in efi_dp_find_obj() argument
195 efiobj = find_obj(dp, false, NULL); in efi_dp_find_obj()
199 efiobj = find_obj(dp, false, rem); in efi_dp_find_obj()
203 efiobj = find_obj(dp, true, rem); in efi_dp_find_obj()
215 const struct efi_device_path *efi_dp_last_node(const struct efi_device_path *dp) in efi_dp_last_node() argument
219 if (!dp || dp->type == DEVICE_PATH_TYPE_END) in efi_dp_last_node()
221 while (dp) { in efi_dp_last_node()
222 ret = (struct efi_device_path *)dp; in efi_dp_last_node()
223 dp = efi_dp_next(dp); in efi_dp_last_node()
229 efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp) in efi_dp_instance_size() argument
233 if (!dp || dp->type == DEVICE_PATH_TYPE_END) in efi_dp_instance_size()
235 while (dp) { in efi_dp_instance_size()
236 sz += dp->length; in efi_dp_instance_size()
237 dp = efi_dp_next(dp); in efi_dp_instance_size()
244 efi_uintn_t efi_dp_size(const struct efi_device_path *dp) in efi_dp_size() argument
246 const struct efi_device_path *p = dp; in efi_dp_size()
254 return (void *)p - (void *)dp; in efi_dp_size()
258 struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp) in efi_dp_dup() argument
261 size_t sz = efi_dp_size(dp) + sizeof(END); in efi_dp_dup()
263 if (!dp) in efi_dp_dup()
269 memcpy(ndp, dp, sz); in efi_dp_dup()
302 struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, in efi_dp_append_node() argument
307 if (!node && !dp) { in efi_dp_append_node()
310 ret = efi_dp_dup(dp); in efi_dp_append_node()
311 } else if (!dp) { in efi_dp_append_node()
321 size_t sz = efi_dp_size(dp); in efi_dp_append_node()
325 memcpy(p, dp, sz); in efi_dp_append_node()
350 const struct efi_device_path *dp, in efi_dp_append_instance() argument
358 if (!dp) in efi_dp_append_instance()
360 sz = efi_dp_size(dp); in efi_dp_append_instance()
366 memcpy(p, dp, sz + sizeof(END)); in efi_dp_append_instance()
376 struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp, in efi_dp_get_next_instance() argument
384 if (!dp || !*dp) in efi_dp_get_next_instance()
386 sz = efi_dp_instance_size(*dp); in efi_dp_get_next_instance()
390 memcpy(p, *dp, sz + sizeof(END)); in efi_dp_get_next_instance()
391 *dp = (void *)*dp + sz; in efi_dp_get_next_instance()
392 if ((*dp)->sub_type == DEVICE_PATH_SUB_TYPE_INSTANCE_END) in efi_dp_get_next_instance()
393 *dp = (void *)*dp + sizeof(END); in efi_dp_get_next_instance()
395 *dp = NULL; in efi_dp_get_next_instance()
401 bool efi_dp_is_multi_instance(const struct efi_device_path *dp) in efi_dp_is_multi_instance() argument
403 const struct efi_device_path *p = dp; in efi_dp_is_multi_instance()
488 struct efi_device_path_mac_addr *dp = in dp_fill() local
492 dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
493 dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR; in dp_fill()
494 dp->dp.length = sizeof(*dp); in dp_fill()
495 memset(&dp->mac, 0, sizeof(dp->mac)); in dp_fill()
497 memcpy(&dp->mac, &pdata->enetaddr, ARP_HLEN); in dp_fill()
499 dp->if_type = 1; in dp_fill()
500 return &dp[1]; in dp_fill()
508 struct efi_device_path_atapi *dp = in dp_fill() local
512 dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
513 dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_ATAPI; in dp_fill()
514 dp->dp.length = sizeof(*dp); in dp_fill()
515 dp->logical_unit_number = desc->devnum; in dp_fill()
516 dp->primary_secondary = IDE_BUS(desc->devnum); in dp_fill()
517 dp->slave_master = desc->devnum % in dp_fill()
520 return &dp[1]; in dp_fill()
525 struct efi_device_path_scsi *dp = in dp_fill() local
529 dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
530 dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_SCSI; in dp_fill()
531 dp->dp.length = sizeof(*dp); in dp_fill()
532 dp->logical_unit_number = desc->lun; in dp_fill()
533 dp->target_id = desc->target; in dp_fill()
534 return &dp[1]; in dp_fill()
543 sddp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
544 sddp->dp.sub_type = is_sd(desc) ? in dp_fill()
547 sddp->dp.length = sizeof(*sddp); in dp_fill()
566 sddp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
567 sddp->dp.sub_type = is_sd(desc) ? in dp_fill()
570 sddp->dp.length = sizeof(*sddp); in dp_fill()
583 udp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
584 udp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS; in dp_fill()
585 udp->dp.length = sizeof(*udp); in dp_fill()
662 cddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; in dp_part_node()
663 cddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_CDROM_PATH; in dp_part_node()
664 cddp->dp.length = sizeof(*cddp); in dp_part_node()
672 hddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; in dp_part_node()
673 hddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH; in dp_part_node()
674 hddp->dp.length = sizeof(*hddp); in dp_part_node()
742 udp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_part_fill()
743 udp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_USB; in dp_part_fill()
744 udp->dp.length = sizeof(*udp); in dp_part_fill()
833 fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; in efi_dp_from_file()
834 fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH; in efi_dp_from_file()
835 fp->dp.length = fpsize; in efi_dp_from_file()
873 ndp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in efi_dp_from_eth()
874 ndp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR; in efi_dp_from_eth()
875 ndp->dp.length = sizeof(*ndp); in efi_dp_from_eth()
900 mdp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; in efi_dp_from_mem()
901 mdp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MEMORY; in efi_dp_from_mem()
902 mdp->dp.length = sizeof(*mdp); in efi_dp_from_mem()
929 struct efi_device_path *p, *dp, *fp; in efi_dp_split_file_path() local
933 dp = efi_dp_dup(full_path); in efi_dp_split_file_path()
934 if (!dp) in efi_dp_split_file_path()
936 p = dp; in efi_dp_split_file_path()
949 *device_path = dp; in efi_dp_split_file_path()