summaryrefslogtreecommitdiffstats
path: root/sys/boot/efi
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-05-26 22:13:40 +0000
committerjhb <jhb@FreeBSD.org>2016-05-26 22:13:40 +0000
commit761a966fdf9b5793e3d3cc43d695cdcd89b26b30 (patch)
tree0ba2cbdb6346147c599e452d5fa9780157d3e68b /sys/boot/efi
parent07b97b9c422106184dc329bcd4a71c76fdb4c2a0 (diff)
downloadFreeBSD-src-761a966fdf9b5793e3d3cc43d695cdcd89b26b30.zip
FreeBSD-src-761a966fdf9b5793e3d3cc43d695cdcd89b26b30.tar.gz
Use routines from the recently added devpath.c.
These efipart layer did several devpath related operations inline. This just switches it over to using shared code for working with device paths. Sponsored by: Cisco Systems
Diffstat (limited to 'sys/boot/efi')
-rw-r--r--sys/boot/efi/libefi/efipart.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c
index e8691c5..11b7a1a 100644
--- a/sys/boot/efi/libefi/efipart.c
+++ b/sys/boot/efi/libefi/efipart.c
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
#include <efiprot.h>
static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
-static EFI_GUID devpath_guid = DEVICE_PATH_PROTOCOL;
static int efipart_init(void);
static int efipart_strategy(void *, int, daddr_t, size_t, size_t, char *,
@@ -85,7 +84,6 @@ efipart_init(void)
UINTN sz;
u_int n, nin, nout;
int err;
- size_t devpathlen;
sz = 0;
hin = NULL;
@@ -112,20 +110,11 @@ efipart_init(void)
return (ENOMEM);
for (n = 0; n < nin; n++) {
- status = BS->HandleProtocol(hin[n], &devpath_guid,
- (void **)&devpath);
- if (EFI_ERROR(status)) {
+ devpath = efi_lookup_devpath(hin[n]);
+ if (devpath == NULL) {
continue;
}
- node = devpath;
- devpathlen = DevicePathNodeLength(node);
- while (!IsDevicePathEnd(NextDevicePathNode(node))) {
- node = NextDevicePathNode(node);
- devpathlen += DevicePathNodeLength(node);
- }
- devpathlen += DevicePathNodeLength(NextDevicePathNode(node));
-
status = BS->HandleProtocol(hin[n], &blkio_guid,
(void**)&blkio);
if (EFI_ERROR(status))
@@ -140,14 +129,10 @@ efipart_init(void)
* we try to find the parent device and add that instead as
* that will be the CD filesystem.
*/
+ node = efi_devpath_last_node(devpath);
if (DevicePathType(node) == MEDIA_DEVICE_PATH &&
DevicePathSubType(node) == MEDIA_CDROM_DP) {
- devpathcpy = malloc(devpathlen);
- memcpy(devpathcpy, devpath, devpathlen);
- node = devpathcpy;
- while (!IsDevicePathEnd(NextDevicePathNode(node)))
- node = NextDevicePathNode(node);
- SetDevicePathEndNode(node);
+ devpathcpy = efi_devpath_trim(devpath);
tmpdevpath = devpathcpy;
status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath,
&handle);
OpenPOWER on IntegriCloud