Changeset View
Changeset View
Standalone View
Standalone View
head/stand/efi/libefi/efipart.c
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | if ((node = efi_devpath_last_node(devpath)) == NULL) | ||||
return (false); | return (false); | ||||
if (DevicePathType(node) == MEDIA_DEVICE_PATH && | if (DevicePathType(node) == MEDIA_DEVICE_PATH && | ||||
DevicePathSubType(node) == MEDIA_CDROM_DP) { | DevicePathSubType(node) == MEDIA_CDROM_DP) { | ||||
return (false); | return (false); | ||||
} | } | ||||
/* Make sure we do have the media. */ | /* Make sure we do have the media. */ | ||||
status = BS->HandleProtocol(efipart_handles[i], | status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, | ||||
&blkio_guid, (void **)&blkio); | (void **)&blkio); | ||||
if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
return (false); | return (false); | ||||
/* USB or SATA cd without the media. */ | /* USB or SATA cd without the media. */ | ||||
if (blkio->Media->RemovableMedia && | if (blkio->Media->RemovableMedia && | ||||
!blkio->Media->MediaPresent) { | !blkio->Media->MediaPresent) { | ||||
return (false); | return (false); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | if ((node = efi_devpath_last_node(devpath)) == NULL) | ||||
continue; | continue; | ||||
if (efipart_floppy(node) != NULL) | if (efipart_floppy(node) != NULL) | ||||
continue; | continue; | ||||
if (efipart_hdd(devpath)) | if (efipart_hdd(devpath)) | ||||
continue; | continue; | ||||
status = BS->HandleProtocol(efipart_handles[i], | status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, | ||||
&blkio_guid, (void **)&blkio); | (void **)&blkio); | ||||
if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
continue; | continue; | ||||
/* | /* | ||||
* If we come across a logical partition of subtype CDROM | * If we come across a logical partition of subtype CDROM | ||||
* it doesn't refer to the CD filesystem itself, but rather | * it doesn't refer to the CD filesystem itself, but rather | ||||
* to any usable El Torito boot image on it. In this case | * to any usable El Torito boot image on it. In this case | ||||
* we try to find the parent device and add that instead as | * we try to find the parent device and add that instead as | ||||
* that will be the CD filesystem. | * that will be the CD filesystem. | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | if (devpath == NULL) | ||||
continue; | continue; | ||||
if ((node = efi_devpath_last_node(devpath)) == NULL) | if ((node = efi_devpath_last_node(devpath)) == NULL) | ||||
continue; | continue; | ||||
if (!efipart_hdd(devpath)) | if (!efipart_hdd(devpath)) | ||||
continue; | continue; | ||||
status = BS->HandleProtocol(efipart_handles[i], | status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid, | ||||
&blkio_guid, (void **)&blkio); | (void **)&blkio); | ||||
if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
continue; | continue; | ||||
if (DevicePathType(node) == MEDIA_DEVICE_PATH && | if (DevicePathType(node) == MEDIA_DEVICE_PATH && | ||||
DevicePathSubType(node) == MEDIA_FILEPATH_DP) { | DevicePathSubType(node) == MEDIA_FILEPATH_DP) { | ||||
efipart_hdinfo_add_filepath(efipart_handles[i]); | efipart_hdinfo_add_filepath(efipart_handles[i]); | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (verbose) { /* Output the device path. */ | ||||
efi_free_devpath_name(text); | efi_free_devpath_name(text); | ||||
if ((ret = pager_output("\n")) != 0) | if ((ret = pager_output("\n")) != 0) | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
snprintf(line, sizeof(line), | snprintf(line, sizeof(line), | ||||
" %s%d", dev->dv_name, pd->pd_unit); | " %s%d", dev->dv_name, pd->pd_unit); | ||||
printf("%s:", line); | printf("%s:", line); | ||||
status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio); | status = OpenProtocolByHandle(h, &blkio_guid, (void **)&blkio); | ||||
if (!EFI_ERROR(status)) { | if (!EFI_ERROR(status)) { | ||||
printf(" %llu", | printf(" %llu", | ||||
blkio->Media->LastBlock == 0? 0: | blkio->Media->LastBlock == 0? 0: | ||||
(unsigned long long) (blkio->Media->LastBlock + 1)); | (unsigned long long) (blkio->Media->LastBlock + 1)); | ||||
if (blkio->Media->LastBlock != 0) { | if (blkio->Media->LastBlock != 0) { | ||||
printf(" X %u", blkio->Media->BlockSize); | printf(" X %u", blkio->Media->BlockSize); | ||||
} | } | ||||
printf(" blocks"); | printf(" blocks"); | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | efipart_open(struct open_file *f, ...) | ||||
if (dev == NULL) | if (dev == NULL) | ||||
return (EINVAL); | return (EINVAL); | ||||
pd = efiblk_get_pdinfo((struct devdesc *)dev); | pd = efiblk_get_pdinfo((struct devdesc *)dev); | ||||
if (pd == NULL) | if (pd == NULL) | ||||
return (EIO); | return (EIO); | ||||
if (pd->pd_blkio == NULL) { | if (pd->pd_blkio == NULL) { | ||||
status = BS->HandleProtocol(pd->pd_handle, &blkio_guid, | status = OpenProtocolByHandle(pd->pd_handle, &blkio_guid, | ||||
(void **)&pd->pd_blkio); | (void **)&pd->pd_blkio); | ||||
if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
return (efi_status_to_errno(status)); | return (efi_status_to_errno(status)); | ||||
} | } | ||||
blkio = pd->pd_blkio; | blkio = pd->pd_blkio; | ||||
if (!blkio->Media->MediaPresent) | if (!blkio->Media->MediaPresent) | ||||
return (EAGAIN); | return (EAGAIN); | ||||
▲ Show 20 Lines • Show All 257 Lines • Show Last 20 Lines |