Lines Matching refs:dp
32 .dp = {
76 struct efi_device_path *efi_dp_next(const struct efi_device_path *dp) in efi_dp_next() argument
78 if (dp == NULL) in efi_dp_next()
80 if (dp->type == DEVICE_PATH_TYPE_END) in efi_dp_next()
82 dp = ((void *)dp) + dp->length; in efi_dp_next()
83 if (dp->type == DEVICE_PATH_TYPE_END) in efi_dp_next()
85 return (struct efi_device_path *)dp; in efi_dp_next()
128 static struct efi_device_path *shorten_path(struct efi_device_path *dp) in shorten_path() argument
130 while (dp) { in shorten_path()
136 if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB_CLASS) || in shorten_path()
137 EFI_DP_TYPE(dp, MEDIA_DEVICE, HARD_DRIVE_PATH) || in shorten_path()
138 EFI_DP_TYPE(dp, MEDIA_DEVICE, FILE_PATH)) in shorten_path()
139 return dp; in shorten_path()
141 dp = efi_dp_next(dp); in shorten_path()
144 return dp; in shorten_path()
147 static struct efi_object *find_obj(struct efi_device_path *dp, bool short_path, in find_obj() argument
151 efi_uintn_t dp_size = efi_dp_instance_size(dp); in find_obj()
165 if (efi_dp_match(dp, obj_dp) == 0) { in find_obj()
171 *rem = ((void *)dp) + in find_obj()
193 struct efi_object *efi_dp_find_obj(struct efi_device_path *dp, in efi_dp_find_obj() argument
199 efiobj = find_obj(dp, false, NULL); in efi_dp_find_obj()
203 efiobj = find_obj(dp, false, rem); in efi_dp_find_obj()
207 efiobj = find_obj(dp, true, rem); in efi_dp_find_obj()
219 const struct efi_device_path *efi_dp_last_node(const struct efi_device_path *dp) in efi_dp_last_node() argument
223 if (!dp || dp->type == DEVICE_PATH_TYPE_END) in efi_dp_last_node()
225 while (dp) { in efi_dp_last_node()
226 ret = (struct efi_device_path *)dp; in efi_dp_last_node()
227 dp = efi_dp_next(dp); in efi_dp_last_node()
233 efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp) in efi_dp_instance_size() argument
237 if (!dp || dp->type == DEVICE_PATH_TYPE_END) in efi_dp_instance_size()
239 while (dp) { in efi_dp_instance_size()
240 sz += dp->length; in efi_dp_instance_size()
241 dp = efi_dp_next(dp); in efi_dp_instance_size()
248 efi_uintn_t efi_dp_size(const struct efi_device_path *dp) in efi_dp_size() argument
250 const struct efi_device_path *p = dp; in efi_dp_size()
258 return (void *)p - (void *)dp; in efi_dp_size()
262 struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp) in efi_dp_dup() argument
265 size_t sz = efi_dp_size(dp) + sizeof(END); in efi_dp_dup()
267 if (!dp) in efi_dp_dup()
273 memcpy(ndp, dp, sz); in efi_dp_dup()
306 struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, in efi_dp_append_node() argument
311 if (!node && !dp) { in efi_dp_append_node()
314 ret = efi_dp_dup(dp); in efi_dp_append_node()
315 } else if (!dp) { in efi_dp_append_node()
325 size_t sz = efi_dp_size(dp); in efi_dp_append_node()
329 memcpy(p, dp, sz); in efi_dp_append_node()
354 const struct efi_device_path *dp, in efi_dp_append_instance() argument
362 if (!dp) in efi_dp_append_instance()
364 sz = efi_dp_size(dp); in efi_dp_append_instance()
370 memcpy(p, dp, sz + sizeof(END)); in efi_dp_append_instance()
380 struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp, in efi_dp_get_next_instance() argument
388 if (!dp || !*dp) in efi_dp_get_next_instance()
390 p = *dp; in efi_dp_get_next_instance()
391 sz = efi_dp_instance_size(*dp); in efi_dp_get_next_instance()
395 memcpy(p, *dp, sz + sizeof(END)); in efi_dp_get_next_instance()
396 *dp = (void *)*dp + sz; in efi_dp_get_next_instance()
397 if ((*dp)->sub_type == DEVICE_PATH_SUB_TYPE_INSTANCE_END) in efi_dp_get_next_instance()
398 *dp = (void *)*dp + sizeof(END); in efi_dp_get_next_instance()
400 *dp = NULL; in efi_dp_get_next_instance()
406 bool efi_dp_is_multi_instance(const struct efi_device_path *dp) in efi_dp_is_multi_instance() argument
408 const struct efi_device_path *p = dp; in efi_dp_is_multi_instance()
493 struct efi_device_path_mac_addr *dp = in dp_fill() local
497 dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
498 dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR; in dp_fill()
499 dp->dp.length = sizeof(*dp); in dp_fill()
500 memset(&dp->mac, 0, sizeof(dp->mac)); in dp_fill()
502 memcpy(&dp->mac, &pdata->enetaddr, ARP_HLEN); in dp_fill()
504 dp->if_type = 1; in dp_fill()
505 return &dp[1]; in dp_fill()
513 struct efi_device_path_atapi *dp = in dp_fill() local
517 dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
518 dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_ATAPI; in dp_fill()
519 dp->dp.length = sizeof(*dp); in dp_fill()
520 dp->logical_unit_number = desc->devnum; in dp_fill()
521 dp->primary_secondary = IDE_BUS(desc->devnum); in dp_fill()
522 dp->slave_master = desc->devnum % in dp_fill()
525 return &dp[1]; in dp_fill()
530 struct efi_device_path_scsi *dp = in dp_fill() local
534 dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
535 dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_SCSI; in dp_fill()
536 dp->dp.length = sizeof(*dp); in dp_fill()
537 dp->logical_unit_number = desc->lun; in dp_fill()
538 dp->target_id = desc->target; in dp_fill()
539 return &dp[1]; in dp_fill()
548 sddp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
549 sddp->dp.sub_type = is_sd(desc) ? in dp_fill()
552 sddp->dp.length = sizeof(*sddp); in dp_fill()
571 sddp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
572 sddp->dp.sub_type = is_sd(desc) ? in dp_fill()
575 sddp->dp.length = sizeof(*sddp); in dp_fill()
588 udp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_fill()
589 udp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS; in dp_fill()
590 udp->dp.length = sizeof(*udp); in dp_fill()
667 cddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; in dp_part_node()
668 cddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_CDROM_PATH; in dp_part_node()
669 cddp->dp.length = sizeof(*cddp); in dp_part_node()
677 hddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; in dp_part_node()
678 hddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH; in dp_part_node()
679 hddp->dp.length = sizeof(*hddp); in dp_part_node()
747 udp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in dp_part_fill()
748 udp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_USB; in dp_part_fill()
749 udp->dp.length = sizeof(*udp); in dp_part_fill()
838 fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE; in efi_dp_from_file()
839 fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH; in efi_dp_from_file()
840 fp->dp.length = fpsize; in efi_dp_from_file()
878 ndp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; in efi_dp_from_eth()
879 ndp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR; in efi_dp_from_eth()
880 ndp->dp.length = sizeof(*ndp); in efi_dp_from_eth()
905 mdp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; in efi_dp_from_mem()
906 mdp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MEMORY; in efi_dp_from_mem()
907 mdp->dp.length = sizeof(*mdp); in efi_dp_from_mem()
926 struct efi_device_path *p, *dp, *fp; in efi_dp_split_file_path() local
930 dp = efi_dp_dup(full_path); in efi_dp_split_file_path()
931 if (!dp) in efi_dp_split_file_path()
933 p = dp; in efi_dp_split_file_path()
946 *device_path = dp; in efi_dp_split_file_path()