| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: efiboot.c,v 1.22 2021/10/06 10:13:19 jmcneill Exp $ */ | | 1 | /* $NetBSD: efiboot.c,v 1.22.4.1 2024/04/18 15:32:36 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -76,26 +76,28 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS | | | @@ -76,26 +76,28 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS |
76 | uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, TRUE); | | 76 | uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, TRUE); |
77 | | | 77 | |
78 | status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData, sz, &heap_start); | | 78 | status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData, sz, &heap_start); |
79 | if (EFI_ERROR(status)) | | 79 | if (EFI_ERROR(status)) |
80 | return status; | | 80 | return status; |
81 | setheap((void *)(uintptr_t)heap_start, (void *)(uintptr_t)(heap_start + heap_size)); | | 81 | setheap((void *)(uintptr_t)heap_start, (void *)(uintptr_t)(heap_start + heap_size)); |
82 | | | 82 | |
83 | status = uefi_call_wrapper(BS->HandleProtocol, 3, imageHandle, &LoadedImageProtocol, (void **)&efi_li); | | 83 | status = uefi_call_wrapper(BS->HandleProtocol, 3, imageHandle, &LoadedImageProtocol, (void **)&efi_li); |
84 | if (EFI_ERROR(status)) | | 84 | if (EFI_ERROR(status)) |
85 | return status; | | 85 | return status; |
86 | status = uefi_call_wrapper(BS->HandleProtocol, 3, efi_li->DeviceHandle, &DevicePathProtocol, (void **)&efi_bootdp); | | 86 | status = uefi_call_wrapper(BS->HandleProtocol, 3, efi_li->DeviceHandle, &DevicePathProtocol, (void **)&efi_bootdp); |
87 | if (EFI_ERROR(status)) | | 87 | if (EFI_ERROR(status)) |
88 | efi_bootdp = NULL; | | 88 | efi_bootdp = NULL; |
| | | 89 | else |
| | | 90 | efi_bootdp = DuplicateDevicePath(efi_bootdp); |
89 | | | 91 | |
90 | #ifdef EFIBOOT_DEBUG | | 92 | #ifdef EFIBOOT_DEBUG |
91 | Print(L"Loaded image : 0x%" PRIxEFIPTR "\n", efi_li); | | 93 | Print(L"Loaded image : 0x%" PRIxEFIPTR "\n", efi_li); |
92 | Print(L"FilePath : 0x%" PRIxEFIPTR "\n", efi_li->FilePath); | | 94 | Print(L"FilePath : 0x%" PRIxEFIPTR "\n", efi_li->FilePath); |
93 | Print(L"ImageBase : 0x%" PRIxEFIPTR "\n", efi_li->ImageBase); | | 95 | Print(L"ImageBase : 0x%" PRIxEFIPTR "\n", efi_li->ImageBase); |
94 | Print(L"ImageSize : 0x%" PRIxEFISIZE "\n", efi_li->ImageSize); | | 96 | Print(L"ImageSize : 0x%" PRIxEFISIZE "\n", efi_li->ImageSize); |
95 | Print(L"Image file : %s\n", DevicePathToStr(efi_li->FilePath)); | | 97 | Print(L"Image file : %s\n", DevicePathToStr(efi_li->FilePath)); |
96 | #endif | | 98 | #endif |
97 | | | 99 | |
98 | #ifdef EFIBOOT_ACPI | | 100 | #ifdef EFIBOOT_ACPI |
99 | efi_acpi_probe(); | | 101 | efi_acpi_probe(); |
100 | #endif | | 102 | #endif |
101 | #ifdef EFIBOOT_FDT | | 103 | #ifdef EFIBOOT_FDT |