| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: efiboot.c,v 1.16.4.1 2019/09/26 19:15:18 martin Exp $ */ | | 1 | /* $NetBSD: efiboot.c,v 1.16.4.2 2024/04/18 15:33:44 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. |
| @@ -74,26 +74,28 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS | | | @@ -74,26 +74,28 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS |
74 | uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut); | | 74 | uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut); |
75 | | | 75 | |
76 | status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData, sz, &heap_start); | | 76 | status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData, sz, &heap_start); |
77 | if (EFI_ERROR(status)) | | 77 | if (EFI_ERROR(status)) |
78 | return status; | | 78 | return status; |
79 | setheap((void *)(uintptr_t)heap_start, (void *)(uintptr_t)(heap_start + heap_size)); | | 79 | setheap((void *)(uintptr_t)heap_start, (void *)(uintptr_t)(heap_start + heap_size)); |
80 | | | 80 | |
81 | status = uefi_call_wrapper(BS->HandleProtocol, 3, imageHandle, &LoadedImageProtocol, (void **)&efi_li); | | 81 | status = uefi_call_wrapper(BS->HandleProtocol, 3, imageHandle, &LoadedImageProtocol, (void **)&efi_li); |
82 | if (EFI_ERROR(status)) | | 82 | if (EFI_ERROR(status)) |
83 | return status; | | 83 | return status; |
84 | status = uefi_call_wrapper(BS->HandleProtocol, 3, efi_li->DeviceHandle, &DevicePathProtocol, (void **)&efi_bootdp); | | 84 | status = uefi_call_wrapper(BS->HandleProtocol, 3, efi_li->DeviceHandle, &DevicePathProtocol, (void **)&efi_bootdp); |
85 | if (EFI_ERROR(status)) | | 85 | if (EFI_ERROR(status)) |
86 | efi_bootdp = NULL; | | 86 | efi_bootdp = NULL; |
| | | 87 | else |
| | | 88 | efi_bootdp = DuplicateDevicePath(efi_bootdp); |
87 | | | 89 | |
88 | #ifdef EFIBOOT_DEBUG | | 90 | #ifdef EFIBOOT_DEBUG |
89 | Print(L"Loaded image : 0x%" PRIxEFIPTR "\n", efi_li); | | 91 | Print(L"Loaded image : 0x%" PRIxEFIPTR "\n", efi_li); |
90 | Print(L"FilePath : 0x%" PRIxEFIPTR "\n", efi_li->FilePath); | | 92 | Print(L"FilePath : 0x%" PRIxEFIPTR "\n", efi_li->FilePath); |
91 | Print(L"ImageBase : 0x%" PRIxEFIPTR "\n", efi_li->ImageBase); | | 93 | Print(L"ImageBase : 0x%" PRIxEFIPTR "\n", efi_li->ImageBase); |
92 | Print(L"ImageSize : 0x%" PRIxEFISIZE "\n", efi_li->ImageSize); | | 94 | Print(L"ImageSize : 0x%" PRIxEFISIZE "\n", efi_li->ImageSize); |
93 | Print(L"Image file : %s\n", DevicePathToStr(efi_li->FilePath)); | | 95 | Print(L"Image file : %s\n", DevicePathToStr(efi_li->FilePath)); |
94 | #endif | | 96 | #endif |
95 | | | 97 | |
96 | efi_acpi_probe(); | | 98 | efi_acpi_probe(); |
97 | efi_fdt_probe(); | | 99 | efi_fdt_probe(); |
98 | efi_pxe_probe(); | | 100 | efi_pxe_probe(); |
99 | efi_net_probe(); | | 101 | efi_net_probe(); |