summaryrefslogtreecommitdiffstats
path: root/sys/boot/efi/loader
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-08-02 08:22:03 +0000
committermarcel <marcel@FreeBSD.org>2003-08-02 08:22:03 +0000
commit108e5926e237db8402ca3e4b52da3bfed397384a (patch)
treeba20491ea124db0ee57b8194e2c4229465b175bc /sys/boot/efi/loader
parent145ea2a06aa3953365fc749fe6b386d66d1e4ffe (diff)
downloadFreeBSD-src-108e5926e237db8402ca3e4b52da3bfed397384a.zip
FreeBSD-src-108e5926e237db8402ca3e4b52da3bfed397384a.tar.gz
Don't hardcode unit 0 for the current device if we're loaded from an
EFI file system. When booting from a CD and there's already an EFI system partition on the disk, setting the current device to unit 0 will select the harddisk. This invariably breaks installing FreeBSD when other operating systems have been installed before. We obviously want to do the same when we're booting over the network. Maybe later. Based on a patch (from memory) from: arun
Diffstat (limited to 'sys/boot/efi/loader')
-rw-r--r--sys/boot/efi/loader/main.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c
index 58b9620..752c243 100644
--- a/sys/boot/efi/loader/main.c
+++ b/sys/boot/efi/loader/main.c
@@ -54,6 +54,7 @@ extern u_int64_t ia64_pal_entry;
EFI_GUID acpi = ACPI_TABLE_GUID;
EFI_GUID acpi20 = ACPI_20_TABLE_GUID;
+EFI_GUID devid = DEVICE_PATH_PROTOCOL;
EFI_GUID hcdp = HCDP_TABLE_GUID;
EFI_GUID imgid = LOADED_IMAGE_PROTOCOL;
EFI_GUID mps = MPS_TABLE_GUID;
@@ -101,8 +102,6 @@ EFI_STATUS
main(int argc, CHAR16 *argv[])
{
EFI_LOADED_IMAGE *img;
- EFI_SIMPLE_NETWORK *net;
- EFI_STATUS status;
int i;
/*
@@ -129,7 +128,6 @@ main(int argc, CHAR16 *argv[])
efinet_init_driver();
-
/* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
@@ -139,23 +137,16 @@ main(int argc, CHAR16 *argv[])
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
printf("(%s, %s)\n", bootprog_maker, bootprog_date);
- /*
- * XXX quick and dirty check to see if we're loaded from the
- * network. If so, we set the default device to 'net'. In all
- * other cases we set the default device to 'disk'. We presume
- * fixed positions in devsw for both net and disk.
- */
- status = BS->HandleProtocol(img->DeviceHandle, &netid, (VOID**)&net);
- if (status == EFI_SUCCESS && net != NULL) {
- currdev.d_dev = devsw[1]; /* XXX net */
- currdev.d_kind.netif.unit = 0;
- } else {
- currdev.d_dev = devsw[0]; /* XXX disk */
- currdev.d_kind.efidisk.unit = 0;
+ i = efifs_get_unit(img->DeviceHandle);
+ if (i >= 0) {
+ currdev.d_dev = devsw[0]; /* XXX disk */
+ currdev.d_kind.efidisk.unit = i;
/* XXX should be able to detect this, default to autoprobe */
currdev.d_kind.efidisk.slice = -1;
- /* default to 'a' */
currdev.d_kind.efidisk.partition = 0;
+ } else {
+ currdev.d_dev = devsw[1]; /* XXX net */
+ currdev.d_kind.netif.unit = 0; /* XXX */
}
currdev.d_type = currdev.d_dev->dv_type;
OpenPOWER on IntegriCloud