Thomas Gleixner | 97873a3 | 2019-06-04 10:11:30 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Eric Snowberg | b84a64f | 2018-11-29 18:12:20 +0100 | [diff] [blame] | 2 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 3 | /* ----------------------------------------------------------------------- |
| 4 | * |
| 5 | * Copyright 2011 Intel Corporation; author Matt Fleming |
| 6 | * |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 7 | * ----------------------------------------------------------------------- */ |
| 8 | |
| 9 | #include <linux/efi.h> |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 10 | #include <linux/pci.h> |
Ingo Molnar | 5520b7e | 2017-01-27 11:59:46 +0100 | [diff] [blame] | 11 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 12 | #include <asm/efi.h> |
Ingo Molnar | 5520b7e | 2017-01-27 11:59:46 +0100 | [diff] [blame] | 13 | #include <asm/e820/types.h> |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 14 | #include <asm/setup.h> |
| 15 | #include <asm/desc.h> |
Kairui Song | 220dd76 | 2019-10-29 18:37:54 +0100 | [diff] [blame] | 16 | #include <asm/boot.h> |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 17 | |
Ard Biesheuvel | c2d0b47 | 2020-02-10 17:02:36 +0100 | [diff] [blame] | 18 | #include "efistub.h" |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 19 | |
| 20 | static efi_system_table_t *sys_table; |
Ard Biesheuvel | 796eb8d | 2020-01-13 18:22:33 +0100 | [diff] [blame] | 21 | extern const bool efi_is64; |
Matt Fleming | 204b0a1 | 2014-03-22 10:09:01 +0000 | [diff] [blame] | 22 | |
Ard Biesheuvel | 2fcdad2 | 2019-12-24 16:10:15 +0100 | [diff] [blame] | 23 | __pure efi_system_table_t *efi_system_table(void) |
| 24 | { |
| 25 | return sys_table; |
| 26 | } |
| 27 | |
Ard Biesheuvel | 796eb8d | 2020-01-13 18:22:33 +0100 | [diff] [blame] | 28 | __attribute_const__ bool efi_is_64bit(void) |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 29 | { |
Ard Biesheuvel | 796eb8d | 2020-01-13 18:22:33 +0100 | [diff] [blame] | 30 | if (IS_ENABLED(CONFIG_EFI_MIXED)) |
| 31 | return efi_is64; |
Qian Cai | cada0b6 | 2020-01-22 14:14:30 -0500 | [diff] [blame] | 32 | return IS_ENABLED(CONFIG_X86_64); |
Matt Fleming | 54b52d8 | 2014-01-10 15:27:14 +0000 | [diff] [blame] | 33 | } |
Matt Fleming | 54b52d8 | 2014-01-10 15:27:14 +0000 | [diff] [blame] | 34 | |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 35 | static efi_status_t |
Ard Biesheuvel | 75c5a71 | 2018-07-20 10:47:19 +0900 | [diff] [blame] | 36 | preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom) |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 37 | { |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 38 | struct pci_setup_rom *rom = NULL; |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 39 | efi_status_t status; |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 40 | unsigned long size; |
Ard Biesheuvel | e296701 | 2018-07-11 11:02:35 +0200 | [diff] [blame] | 41 | uint64_t romsize; |
Ard Biesheuvel | 2c3625c | 2018-05-04 08:00:00 +0200 | [diff] [blame] | 42 | void *romimage; |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 43 | |
Hans de Goede | 1de3a1b | 2018-05-04 08:00:01 +0200 | [diff] [blame] | 44 | /* |
Ard Biesheuvel | e296701 | 2018-07-11 11:02:35 +0200 | [diff] [blame] | 45 | * Some firmware images contain EFI function pointers at the place where |
| 46 | * the romimage and romsize fields are supposed to be. Typically the EFI |
Hans de Goede | 1de3a1b | 2018-05-04 08:00:01 +0200 | [diff] [blame] | 47 | * code is mapped at high addresses, translating to an unrealistically |
| 48 | * large romsize. The UEFI spec limits the size of option ROMs to 16 |
| 49 | * MiB so we reject any ROMs over 16 MiB in size to catch this. |
| 50 | */ |
Ard Biesheuvel | 99ea8b1 | 2019-12-24 16:10:22 +0100 | [diff] [blame] | 51 | romimage = efi_table_attr(pci, romimage); |
| 52 | romsize = efi_table_attr(pci, romsize); |
Hans de Goede | 1de3a1b | 2018-05-04 08:00:01 +0200 | [diff] [blame] | 53 | if (!romimage || !romsize || romsize > SZ_16M) |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 54 | return EFI_INVALID_PARAMETER; |
| 55 | |
Ard Biesheuvel | 2c3625c | 2018-05-04 08:00:00 +0200 | [diff] [blame] | 56 | size = romsize + sizeof(*rom); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 57 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 58 | status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, size, |
| 59 | (void **)&rom); |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 60 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 61 | efi_printk("Failed to allocate memory for 'rom'\n"); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 62 | return status; |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 63 | } |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 64 | |
| 65 | memset(rom, 0, sizeof(*rom)); |
| 66 | |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 67 | rom->data.type = SETUP_PCI; |
| 68 | rom->data.len = size - sizeof(struct setup_data); |
| 69 | rom->data.next = 0; |
| 70 | rom->pcilen = pci->romsize; |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 71 | *__rom = rom; |
| 72 | |
Ard Biesheuvel | 47c0fd3 | 2019-12-24 16:10:21 +0100 | [diff] [blame] | 73 | status = efi_call_proto(pci, pci.read, EfiPciIoWidthUint16, |
| 74 | PCI_VENDOR_ID, 1, &rom->vendor); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 75 | |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 76 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 77 | efi_printk("Failed to read rom->vendor\n"); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 78 | goto free_struct; |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 79 | } |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 80 | |
Ard Biesheuvel | 47c0fd3 | 2019-12-24 16:10:21 +0100 | [diff] [blame] | 81 | status = efi_call_proto(pci, pci.read, EfiPciIoWidthUint16, |
| 82 | PCI_DEVICE_ID, 1, &rom->devid); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 83 | |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 84 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 85 | efi_printk("Failed to read rom->devid\n"); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 86 | goto free_struct; |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 87 | } |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 88 | |
Ard Biesheuvel | 47c0fd3 | 2019-12-24 16:10:21 +0100 | [diff] [blame] | 89 | status = efi_call_proto(pci, get_location, &rom->segment, &rom->bus, |
| 90 | &rom->device, &rom->function); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 91 | |
| 92 | if (status != EFI_SUCCESS) |
| 93 | goto free_struct; |
| 94 | |
Ard Biesheuvel | 2c3625c | 2018-05-04 08:00:00 +0200 | [diff] [blame] | 95 | memcpy(rom->romdata, romimage, romsize); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 96 | return status; |
| 97 | |
| 98 | free_struct: |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 99 | efi_bs_call(free_pool, rom); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 100 | return status; |
| 101 | } |
| 102 | |
Matt Fleming | 56394ab | 2014-09-11 09:04:25 +0100 | [diff] [blame] | 103 | /* |
| 104 | * There's no way to return an informative status from this function, |
| 105 | * because any analysis (and printing of error messages) needs to be |
| 106 | * done directly at the EFI function call-site. |
| 107 | * |
| 108 | * For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we |
| 109 | * just didn't find any PCI devices, but there's no way to tell outside |
| 110 | * the context of the call. |
| 111 | */ |
| 112 | static void setup_efi_pci(struct boot_params *params) |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 113 | { |
| 114 | efi_status_t status; |
| 115 | void **pci_handle = NULL; |
| 116 | efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID; |
| 117 | unsigned long size = 0; |
Ard Biesheuvel | 75c5a71 | 2018-07-20 10:47:19 +0900 | [diff] [blame] | 118 | struct setup_data *data; |
Ard Biesheuvel | 2732ea0 | 2019-12-24 16:10:07 +0100 | [diff] [blame] | 119 | efi_handle_t h; |
Ard Biesheuvel | 75c5a71 | 2018-07-20 10:47:19 +0900 | [diff] [blame] | 120 | int i; |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 121 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 122 | status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL, |
| 123 | &pci_proto, NULL, &size, pci_handle); |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 124 | |
| 125 | if (status == EFI_BUFFER_TOO_SMALL) { |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 126 | status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, size, |
| 127 | (void **)&pci_handle); |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 128 | |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 129 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 130 | efi_printk("Failed to allocate memory for 'pci_handle'\n"); |
Matt Fleming | 56394ab | 2014-09-11 09:04:25 +0100 | [diff] [blame] | 131 | return; |
Andre Müller | 77e21e8 | 2014-09-10 01:00:22 +0200 | [diff] [blame] | 132 | } |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 133 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 134 | status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL, |
| 135 | &pci_proto, NULL, &size, pci_handle); |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | if (status != EFI_SUCCESS) |
| 139 | goto free_handle; |
| 140 | |
Ard Biesheuvel | 75c5a71 | 2018-07-20 10:47:19 +0900 | [diff] [blame] | 141 | data = (struct setup_data *)(unsigned long)params->hdr.setup_data; |
| 142 | |
| 143 | while (data && data->next) |
| 144 | data = (struct setup_data *)(unsigned long)data->next; |
| 145 | |
Ard Biesheuvel | 2732ea0 | 2019-12-24 16:10:07 +0100 | [diff] [blame] | 146 | for_each_efi_handle(h, pci_handle, size, i) { |
Ard Biesheuvel | 75c5a71 | 2018-07-20 10:47:19 +0900 | [diff] [blame] | 147 | efi_pci_io_protocol_t *pci = NULL; |
| 148 | struct pci_setup_rom *rom; |
| 149 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 150 | status = efi_bs_call(handle_protocol, h, &pci_proto, |
| 151 | (void **)&pci); |
Ard Biesheuvel | 75c5a71 | 2018-07-20 10:47:19 +0900 | [diff] [blame] | 152 | if (status != EFI_SUCCESS || !pci) |
| 153 | continue; |
| 154 | |
| 155 | status = preserve_pci_rom_image(pci, &rom); |
| 156 | if (status != EFI_SUCCESS) |
| 157 | continue; |
| 158 | |
| 159 | if (data) |
| 160 | data->next = (unsigned long)rom; |
| 161 | else |
| 162 | params->hdr.setup_data = (unsigned long)rom; |
| 163 | |
| 164 | data = (struct setup_data *)rom; |
| 165 | } |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 166 | |
| 167 | free_handle: |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 168 | efi_bs_call(free_pool, pci_handle); |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 169 | } |
| 170 | |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 171 | static void retrieve_apple_device_properties(struct boot_params *boot_params) |
| 172 | { |
| 173 | efi_guid_t guid = APPLE_PROPERTIES_PROTOCOL_GUID; |
| 174 | struct setup_data *data, *new; |
| 175 | efi_status_t status; |
| 176 | u32 size = 0; |
Ard Biesheuvel | 960a8d0 | 2019-12-24 16:10:11 +0100 | [diff] [blame] | 177 | apple_properties_protocol_t *p; |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 178 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 179 | status = efi_bs_call(locate_protocol, &guid, NULL, (void **)&p); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 180 | if (status != EFI_SUCCESS) |
| 181 | return; |
| 182 | |
Ard Biesheuvel | 99ea8b1 | 2019-12-24 16:10:22 +0100 | [diff] [blame] | 183 | if (efi_table_attr(p, version) != 0x10000) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 184 | efi_printk("Unsupported properties proto version\n"); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 185 | return; |
| 186 | } |
| 187 | |
Ard Biesheuvel | 47c0fd3 | 2019-12-24 16:10:21 +0100 | [diff] [blame] | 188 | efi_call_proto(p, get_all, NULL, &size); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 189 | if (!size) |
| 190 | return; |
| 191 | |
| 192 | do { |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 193 | status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, |
| 194 | size + sizeof(struct setup_data), |
| 195 | (void **)&new); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 196 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 197 | efi_printk("Failed to allocate memory for 'properties'\n"); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 198 | return; |
| 199 | } |
| 200 | |
Ard Biesheuvel | 47c0fd3 | 2019-12-24 16:10:21 +0100 | [diff] [blame] | 201 | status = efi_call_proto(p, get_all, new->data, &size); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 202 | |
| 203 | if (status == EFI_BUFFER_TOO_SMALL) |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 204 | efi_bs_call(free_pool, new); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 205 | } while (status == EFI_BUFFER_TOO_SMALL); |
| 206 | |
| 207 | new->type = SETUP_APPLE_PROPERTIES; |
| 208 | new->len = size; |
| 209 | new->next = 0; |
| 210 | |
| 211 | data = (struct setup_data *)(unsigned long)boot_params->hdr.setup_data; |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 212 | if (!data) { |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 213 | boot_params->hdr.setup_data = (unsigned long)new; |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 214 | } else { |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 215 | while (data->next) |
| 216 | data = (struct setup_data *)(unsigned long)data->next; |
| 217 | data->next = (unsigned long)new; |
| 218 | } |
| 219 | } |
| 220 | |
Ard Biesheuvel | 36b6497 | 2018-03-12 08:45:00 +0000 | [diff] [blame] | 221 | static const efi_char16_t apple[] = L"Apple"; |
| 222 | |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 223 | static void setup_quirks(struct boot_params *boot_params) |
| 224 | { |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 225 | efi_char16_t *fw_vendor = (efi_char16_t *)(unsigned long) |
Ard Biesheuvel | 99ea8b1 | 2019-12-24 16:10:22 +0100 | [diff] [blame] | 226 | efi_table_attr(efi_system_table(), fw_vendor); |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 227 | |
| 228 | if (!memcmp(fw_vendor, apple, sizeof(apple))) { |
| 229 | if (IS_ENABLED(CONFIG_APPLE_PROPERTIES)) |
| 230 | retrieve_apple_device_properties(boot_params); |
| 231 | } |
| 232 | } |
| 233 | |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 234 | /* |
| 235 | * See if we have Universal Graphics Adapter (UGA) protocol |
| 236 | */ |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 237 | static efi_status_t |
| 238 | setup_uga(struct screen_info *si, efi_guid_t *uga_proto, unsigned long size) |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 239 | { |
| 240 | efi_status_t status; |
| 241 | u32 width, height; |
| 242 | void **uga_handle = NULL; |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 243 | efi_uga_draw_protocol_t *uga = NULL, *first_uga; |
Ard Biesheuvel | 2732ea0 | 2019-12-24 16:10:07 +0100 | [diff] [blame] | 244 | efi_handle_t handle; |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 245 | int i; |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 246 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 247 | status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, size, |
| 248 | (void **)&uga_handle); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 249 | if (status != EFI_SUCCESS) |
| 250 | return status; |
| 251 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 252 | status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL, |
| 253 | uga_proto, NULL, &size, uga_handle); |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 254 | if (status != EFI_SUCCESS) |
| 255 | goto free_handle; |
| 256 | |
| 257 | height = 0; |
| 258 | width = 0; |
| 259 | |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 260 | first_uga = NULL; |
Ard Biesheuvel | 2732ea0 | 2019-12-24 16:10:07 +0100 | [diff] [blame] | 261 | for_each_efi_handle(handle, uga_handle, size, i) { |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 262 | efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID; |
| 263 | u32 w, h, depth, refresh; |
| 264 | void *pciio; |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 265 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 266 | status = efi_bs_call(handle_protocol, handle, uga_proto, |
| 267 | (void **)&uga); |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 268 | if (status != EFI_SUCCESS) |
| 269 | continue; |
| 270 | |
Ard Biesheuvel | 093174f | 2018-07-20 10:47:22 +0900 | [diff] [blame] | 271 | pciio = NULL; |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 272 | efi_bs_call(handle_protocol, handle, &pciio_proto, &pciio); |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 273 | |
Ard Biesheuvel | 47c0fd3 | 2019-12-24 16:10:21 +0100 | [diff] [blame] | 274 | status = efi_call_proto(uga, get_mode, &w, &h, &depth, &refresh); |
Ard Biesheuvel | 290084c | 2018-07-20 10:47:21 +0900 | [diff] [blame] | 275 | if (status == EFI_SUCCESS && (!first_uga || pciio)) { |
| 276 | width = w; |
| 277 | height = h; |
| 278 | |
| 279 | /* |
| 280 | * Once we've found a UGA supporting PCIIO, |
| 281 | * don't bother looking any further. |
| 282 | */ |
| 283 | if (pciio) |
| 284 | break; |
| 285 | |
| 286 | first_uga = uga; |
| 287 | } |
| 288 | } |
Matt Fleming | c116e8d | 2014-01-16 11:35:43 +0000 | [diff] [blame] | 289 | |
| 290 | if (!width && !height) |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 291 | goto free_handle; |
| 292 | |
| 293 | /* EFI framebuffer */ |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 294 | si->orig_video_isVGA = VIDEO_TYPE_EFI; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 295 | |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 296 | si->lfb_depth = 32; |
| 297 | si->lfb_width = width; |
| 298 | si->lfb_height = height; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 299 | |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 300 | si->red_size = 8; |
| 301 | si->red_pos = 16; |
| 302 | si->green_size = 8; |
| 303 | si->green_pos = 8; |
| 304 | si->blue_size = 8; |
| 305 | si->blue_pos = 0; |
| 306 | si->rsvd_size = 8; |
| 307 | si->rsvd_pos = 24; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 308 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 309 | free_handle: |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 310 | efi_bs_call(free_pool, uga_handle); |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 311 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 312 | return status; |
| 313 | } |
| 314 | |
Arvind Sankar | f32ea1c | 2020-01-30 17:20:04 -0500 | [diff] [blame] | 315 | static void setup_graphics(struct boot_params *boot_params) |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 316 | { |
| 317 | efi_guid_t graphics_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; |
| 318 | struct screen_info *si; |
| 319 | efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID; |
| 320 | efi_status_t status; |
| 321 | unsigned long size; |
| 322 | void **gop_handle = NULL; |
| 323 | void **uga_handle = NULL; |
| 324 | |
| 325 | si = &boot_params->screen_info; |
| 326 | memset(si, 0, sizeof(*si)); |
| 327 | |
| 328 | size = 0; |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 329 | status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL, |
| 330 | &graphics_proto, NULL, &size, gop_handle); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 331 | if (status == EFI_BUFFER_TOO_SMALL) |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 332 | status = efi_setup_gop(si, &graphics_proto, size); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 333 | |
| 334 | if (status != EFI_SUCCESS) { |
| 335 | size = 0; |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 336 | status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL, |
| 337 | &uga_proto, NULL, &size, uga_handle); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 338 | if (status == EFI_BUFFER_TOO_SMALL) |
| 339 | setup_uga(si, &uga_proto, size); |
| 340 | } |
| 341 | } |
| 342 | |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 343 | |
| 344 | static void __noreturn efi_exit(efi_handle_t handle, efi_status_t status) |
| 345 | { |
| 346 | efi_bs_call(exit, handle, status, 0, NULL); |
Ard Biesheuvel | f3fa0ef | 2020-03-08 09:08:45 +0100 | [diff] [blame] | 347 | for(;;) |
| 348 | asm("hlt"); |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 349 | } |
| 350 | |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 351 | void startup_32(struct boot_params *boot_params); |
| 352 | |
| 353 | void __noreturn efi_stub_entry(efi_handle_t handle, |
| 354 | efi_system_table_t *sys_table_arg, |
| 355 | struct boot_params *boot_params); |
| 356 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 357 | /* |
| 358 | * Because the x86 boot code expects to be passed a boot_params we |
| 359 | * need to create one ourselves (usually the bootloader would create |
| 360 | * one for us). |
| 361 | */ |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 362 | efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, |
| 363 | efi_system_table_t *sys_table_arg) |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 364 | { |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 365 | struct boot_params *boot_params; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 366 | struct setup_header *hdr; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 367 | efi_loaded_image_t *image; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 368 | efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 369 | int options_size = 0; |
| 370 | efi_status_t status; |
Roy Franz | 5fef387 | 2013-09-22 15:45:33 -0700 | [diff] [blame] | 371 | char *cmdline_ptr; |
Roy Franz | 46f4582 | 2013-09-22 15:45:39 -0700 | [diff] [blame] | 372 | unsigned long ramdisk_addr; |
| 373 | unsigned long ramdisk_size; |
Ard Biesheuvel | 6a4db9b | 2020-02-10 17:02:39 +0100 | [diff] [blame] | 374 | bool above4g; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 375 | |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 376 | sys_table = sys_table_arg; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 377 | |
| 378 | /* Check if we were booted by the EFI firmware */ |
| 379 | if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 380 | efi_exit(handle, EFI_INVALID_PARAMETER); |
Matt Fleming | 54b52d8 | 2014-01-10 15:27:14 +0000 | [diff] [blame] | 381 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 382 | status = efi_bs_call(handle_protocol, handle, &proto, (void *)&image); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 383 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 384 | efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n"); |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 385 | efi_exit(handle, status); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 386 | } |
| 387 | |
Ard Biesheuvel | f7b85b3 | 2020-02-14 14:29:21 +0100 | [diff] [blame] | 388 | hdr = &((struct boot_params *)efi_table_attr(image, image_base))->hdr; |
Ard Biesheuvel | 6a4db9b | 2020-02-10 17:02:39 +0100 | [diff] [blame] | 389 | above4g = hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G; |
| 390 | |
| 391 | status = efi_allocate_pages(0x4000, (unsigned long *)&boot_params, |
| 392 | above4g ? ULONG_MAX : UINT_MAX); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 393 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 394 | efi_printk("Failed to allocate lowmem for boot params\n"); |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 395 | efi_exit(handle, status); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | memset(boot_params, 0x0, 0x4000); |
| 399 | |
| 400 | hdr = &boot_params->hdr; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 401 | |
| 402 | /* Copy the second sector to boot_params */ |
Ard Biesheuvel | f7b85b3 | 2020-02-14 14:29:21 +0100 | [diff] [blame] | 403 | memcpy(&hdr->jump, efi_table_attr(image, image_base) + 512, 512); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 404 | |
| 405 | /* |
| 406 | * Fill out some of the header fields ourselves because the |
| 407 | * EFI firmware loader doesn't load the first sector. |
| 408 | */ |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 409 | hdr->root_flags = 1; |
| 410 | hdr->vid_mode = 0xffff; |
| 411 | hdr->boot_flag = 0xAA55; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 412 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 413 | hdr->type_of_loader = 0x21; |
| 414 | |
| 415 | /* Convert unicode cmdline to ascii */ |
Ard Biesheuvel | 1e45bf7 | 2020-02-10 17:02:40 +0100 | [diff] [blame] | 416 | cmdline_ptr = efi_convert_cmdline(image, &options_size, |
| 417 | above4g ? ULONG_MAX : UINT_MAX); |
Roy Franz | 5fef387 | 2013-09-22 15:45:33 -0700 | [diff] [blame] | 418 | if (!cmdline_ptr) |
| 419 | goto fail; |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 420 | |
Roy Franz | 5fef387 | 2013-09-22 15:45:33 -0700 | [diff] [blame] | 421 | hdr->cmd_line_ptr = (unsigned long)cmdline_ptr; |
Roy Franz | 98b228f | 2015-04-15 16:32:24 -0700 | [diff] [blame] | 422 | /* Fill in upper bits of command line address, NOP on 32 bit */ |
| 423 | boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 424 | |
| 425 | hdr->ramdisk_image = 0; |
| 426 | hdr->ramdisk_size = 0; |
| 427 | |
Ard Biesheuvel | 17054f4 | 2020-02-12 23:20:54 +0100 | [diff] [blame] | 428 | if (efi_is_native()) { |
| 429 | status = efi_parse_options(cmdline_ptr); |
Ard Biesheuvel | 79d3219 | 2020-02-04 22:01:22 +0000 | [diff] [blame] | 430 | if (status != EFI_SUCCESS) |
| 431 | goto fail2; |
Ard Biesheuvel | 17054f4 | 2020-02-12 23:20:54 +0100 | [diff] [blame] | 432 | |
| 433 | if (!noinitrd()) { |
| 434 | status = efi_load_initrd(image, &ramdisk_addr, |
| 435 | &ramdisk_size, |
| 436 | hdr->initrd_addr_max, |
| 437 | above4g ? ULONG_MAX |
| 438 | : hdr->initrd_addr_max); |
| 439 | if (status != EFI_SUCCESS) |
| 440 | goto fail2; |
| 441 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; |
| 442 | hdr->ramdisk_size = ramdisk_size & 0xffffffff; |
| 443 | boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32; |
| 444 | boot_params->ext_ramdisk_size = (u64)ramdisk_size >> 32; |
| 445 | } |
Ard Biesheuvel | 79d3219 | 2020-02-04 22:01:22 +0000 | [diff] [blame] | 446 | } |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 447 | |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 448 | efi_stub_entry(handle, sys_table, boot_params); |
| 449 | /* not reached */ |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 450 | |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 451 | fail2: |
Ard Biesheuvel | 1e45bf7 | 2020-02-10 17:02:40 +0100 | [diff] [blame] | 452 | efi_free(options_size, (unsigned long)cmdline_ptr); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 453 | fail: |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 454 | efi_free(0x4000, (unsigned long)boot_params); |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 455 | |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 456 | efi_exit(handle, status); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 457 | } |
| 458 | |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 459 | static void add_e820ext(struct boot_params *params, |
| 460 | struct setup_data *e820ext, u32 nr_entries) |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 461 | { |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 462 | struct setup_data *data; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 463 | |
| 464 | e820ext->type = SETUP_E820_EXT; |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 465 | e820ext->len = nr_entries * sizeof(struct boot_e820_entry); |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 466 | e820ext->next = 0; |
| 467 | |
| 468 | data = (struct setup_data *)(unsigned long)params->hdr.setup_data; |
| 469 | |
| 470 | while (data && data->next) |
| 471 | data = (struct setup_data *)(unsigned long)data->next; |
| 472 | |
| 473 | if (data) |
| 474 | data->next = (unsigned long)e820ext; |
| 475 | else |
| 476 | params->hdr.setup_data = (unsigned long)e820ext; |
| 477 | } |
| 478 | |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 479 | static efi_status_t |
| 480 | setup_e820(struct boot_params *params, struct setup_data *e820ext, u32 e820ext_size) |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 481 | { |
Ingo Molnar | 7410aa1 | 2017-01-29 12:56:13 +0100 | [diff] [blame] | 482 | struct boot_e820_entry *entry = params->e820_table; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 483 | struct efi_info *efi = ¶ms->efi_info; |
Ingo Molnar | 7410aa1 | 2017-01-29 12:56:13 +0100 | [diff] [blame] | 484 | struct boot_e820_entry *prev = NULL; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 485 | u32 nr_entries; |
| 486 | u32 nr_desc; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 487 | int i; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 488 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 489 | nr_entries = 0; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 490 | nr_desc = efi->efi_memmap_size / efi->efi_memdesc_size; |
| 491 | |
| 492 | for (i = 0; i < nr_desc; i++) { |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 493 | efi_memory_desc_t *d; |
| 494 | unsigned int e820_type = 0; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 495 | unsigned long m = efi->efi_memmap; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 496 | |
Dmitry Skorodumov | 7cc03e4 | 2015-07-28 18:38:32 +0400 | [diff] [blame] | 497 | #ifdef CONFIG_X86_64 |
| 498 | m |= (u64)efi->efi_memmap_hi << 32; |
| 499 | #endif |
| 500 | |
Baoquan He | 02e43c2 | 2017-08-16 21:46:51 +0800 | [diff] [blame] | 501 | d = efi_early_memdesc_ptr(m, efi->efi_memdesc_size, i); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 502 | switch (d->type) { |
| 503 | case EFI_RESERVED_TYPE: |
| 504 | case EFI_RUNTIME_SERVICES_CODE: |
| 505 | case EFI_RUNTIME_SERVICES_DATA: |
| 506 | case EFI_MEMORY_MAPPED_IO: |
| 507 | case EFI_MEMORY_MAPPED_IO_PORT_SPACE: |
| 508 | case EFI_PAL_CODE: |
Ingo Molnar | 09821ff | 2017-01-28 17:09:33 +0100 | [diff] [blame] | 509 | e820_type = E820_TYPE_RESERVED; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 510 | break; |
| 511 | |
| 512 | case EFI_UNUSABLE_MEMORY: |
Ingo Molnar | 09821ff | 2017-01-28 17:09:33 +0100 | [diff] [blame] | 513 | e820_type = E820_TYPE_UNUSABLE; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 514 | break; |
| 515 | |
| 516 | case EFI_ACPI_RECLAIM_MEMORY: |
Ingo Molnar | 09821ff | 2017-01-28 17:09:33 +0100 | [diff] [blame] | 517 | e820_type = E820_TYPE_ACPI; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 518 | break; |
| 519 | |
| 520 | case EFI_LOADER_CODE: |
| 521 | case EFI_LOADER_DATA: |
| 522 | case EFI_BOOT_SERVICES_CODE: |
| 523 | case EFI_BOOT_SERVICES_DATA: |
| 524 | case EFI_CONVENTIONAL_MEMORY: |
Dan Williams | 262b45a | 2019-11-06 17:43:16 -0800 | [diff] [blame] | 525 | if (efi_soft_reserve_enabled() && |
| 526 | (d->attribute & EFI_MEMORY_SP)) |
| 527 | e820_type = E820_TYPE_SOFT_RESERVED; |
| 528 | else |
| 529 | e820_type = E820_TYPE_RAM; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 530 | break; |
| 531 | |
| 532 | case EFI_ACPI_MEMORY_NVS: |
Ingo Molnar | 09821ff | 2017-01-28 17:09:33 +0100 | [diff] [blame] | 533 | e820_type = E820_TYPE_NVS; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 534 | break; |
| 535 | |
Dan Williams | ad5fb87 | 2015-04-03 12:05:28 -0400 | [diff] [blame] | 536 | case EFI_PERSISTENT_MEMORY: |
Ingo Molnar | 09821ff | 2017-01-28 17:09:33 +0100 | [diff] [blame] | 537 | e820_type = E820_TYPE_PMEM; |
Dan Williams | ad5fb87 | 2015-04-03 12:05:28 -0400 | [diff] [blame] | 538 | break; |
| 539 | |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 540 | default: |
| 541 | continue; |
| 542 | } |
| 543 | |
| 544 | /* Merge adjacent mappings */ |
| 545 | if (prev && prev->type == e820_type && |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 546 | (prev->addr + prev->size) == d->phys_addr) { |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 547 | prev->size += d->num_pages << 12; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 548 | continue; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 549 | } |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 550 | |
Ingo Molnar | 61a5010 | 2017-01-27 13:54:38 +0100 | [diff] [blame] | 551 | if (nr_entries == ARRAY_SIZE(params->e820_table)) { |
Ingo Molnar | 8ec67d9 | 2017-01-27 12:54:38 +0100 | [diff] [blame] | 552 | u32 need = (nr_desc - i) * sizeof(struct e820_entry) + |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 553 | sizeof(struct setup_data); |
| 554 | |
| 555 | if (!e820ext || e820ext_size < need) |
| 556 | return EFI_BUFFER_TOO_SMALL; |
| 557 | |
| 558 | /* boot_params map full, switch to e820 extended */ |
Ingo Molnar | 7410aa1 | 2017-01-29 12:56:13 +0100 | [diff] [blame] | 559 | entry = (struct boot_e820_entry *)e820ext->data; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 560 | } |
| 561 | |
Ingo Molnar | 7410aa1 | 2017-01-29 12:56:13 +0100 | [diff] [blame] | 562 | entry->addr = d->phys_addr; |
| 563 | entry->size = d->num_pages << PAGE_SHIFT; |
| 564 | entry->type = e820_type; |
| 565 | prev = entry++; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 566 | nr_entries++; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 567 | } |
| 568 | |
Ingo Molnar | 61a5010 | 2017-01-27 13:54:38 +0100 | [diff] [blame] | 569 | if (nr_entries > ARRAY_SIZE(params->e820_table)) { |
| 570 | u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_table); |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 571 | |
| 572 | add_e820ext(params, e820ext, nr_e820ext); |
| 573 | nr_entries -= nr_e820ext; |
| 574 | } |
| 575 | |
| 576 | params->e820_entries = (u8)nr_entries; |
| 577 | |
| 578 | return EFI_SUCCESS; |
| 579 | } |
| 580 | |
| 581 | static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, |
| 582 | u32 *e820ext_size) |
| 583 | { |
| 584 | efi_status_t status; |
| 585 | unsigned long size; |
| 586 | |
| 587 | size = sizeof(struct setup_data) + |
Ingo Molnar | 8ec67d9 | 2017-01-27 12:54:38 +0100 | [diff] [blame] | 588 | sizeof(struct e820_entry) * nr_desc; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 589 | |
| 590 | if (*e820ext) { |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 591 | efi_bs_call(free_pool, *e820ext); |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 592 | *e820ext = NULL; |
| 593 | *e820ext_size = 0; |
| 594 | } |
| 595 | |
Ard Biesheuvel | 966291f | 2019-12-24 16:10:23 +0100 | [diff] [blame] | 596 | status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, size, |
| 597 | (void **)e820ext); |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 598 | if (status == EFI_SUCCESS) |
| 599 | *e820ext_size = size; |
| 600 | |
| 601 | return status; |
| 602 | } |
| 603 | |
Eric Snowberg | b84a64f | 2018-11-29 18:12:20 +0100 | [diff] [blame] | 604 | static efi_status_t allocate_e820(struct boot_params *params, |
| 605 | struct setup_data **e820ext, |
| 606 | u32 *e820ext_size) |
| 607 | { |
| 608 | unsigned long map_size, desc_size, buff_size; |
| 609 | struct efi_boot_memmap boot_map; |
| 610 | efi_memory_desc_t *map; |
| 611 | efi_status_t status; |
| 612 | __u32 nr_desc; |
| 613 | |
| 614 | boot_map.map = ↦ |
| 615 | boot_map.map_size = &map_size; |
| 616 | boot_map.desc_size = &desc_size; |
| 617 | boot_map.desc_ver = NULL; |
| 618 | boot_map.key_ptr = NULL; |
| 619 | boot_map.buff_size = &buff_size; |
| 620 | |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 621 | status = efi_get_memory_map(&boot_map); |
Eric Snowberg | b84a64f | 2018-11-29 18:12:20 +0100 | [diff] [blame] | 622 | if (status != EFI_SUCCESS) |
| 623 | return status; |
| 624 | |
| 625 | nr_desc = buff_size / desc_size; |
| 626 | |
| 627 | if (nr_desc > ARRAY_SIZE(params->e820_table)) { |
| 628 | u32 nr_e820ext = nr_desc - ARRAY_SIZE(params->e820_table); |
| 629 | |
| 630 | status = alloc_e820ext(nr_e820ext, e820ext, e820ext_size); |
| 631 | if (status != EFI_SUCCESS) |
| 632 | return status; |
| 633 | } |
| 634 | |
| 635 | return EFI_SUCCESS; |
| 636 | } |
| 637 | |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 638 | struct exit_boot_struct { |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 639 | struct boot_params *boot_params; |
| 640 | struct efi_info *efi; |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 641 | }; |
| 642 | |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 643 | static efi_status_t exit_boot_func(struct efi_boot_memmap *map, |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 644 | void *priv) |
| 645 | { |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 646 | const char *signature; |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 647 | struct exit_boot_struct *p = priv; |
| 648 | |
Ard Biesheuvel | aab9593 | 2018-07-20 10:47:24 +0900 | [diff] [blame] | 649 | signature = efi_is_64bit() ? EFI64_LOADER_SIGNATURE |
| 650 | : EFI32_LOADER_SIGNATURE; |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 651 | memcpy(&p->efi->efi_loader_signature, signature, sizeof(__u32)); |
| 652 | |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 653 | p->efi->efi_systab = (unsigned long)efi_system_table(); |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 654 | p->efi->efi_memdesc_size = *map->desc_size; |
| 655 | p->efi->efi_memdesc_version = *map->desc_ver; |
| 656 | p->efi->efi_memmap = (unsigned long)*map->map; |
| 657 | p->efi->efi_memmap_size = *map->map_size; |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 658 | |
| 659 | #ifdef CONFIG_X86_64 |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 660 | p->efi->efi_systab_hi = (unsigned long)efi_system_table() >> 32; |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 661 | p->efi->efi_memmap_hi = (unsigned long)*map->map >> 32; |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 662 | #endif |
| 663 | |
| 664 | return EFI_SUCCESS; |
| 665 | } |
| 666 | |
Ard Biesheuvel | aab9593 | 2018-07-20 10:47:24 +0900 | [diff] [blame] | 667 | static efi_status_t exit_boot(struct boot_params *boot_params, void *handle) |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 668 | { |
Jeffrey Hugo | dadb57a | 2016-08-29 14:38:51 -0600 | [diff] [blame] | 669 | unsigned long map_sz, key, desc_size, buff_size; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 670 | efi_memory_desc_t *mem_map; |
Eric Snowberg | b84a64f | 2018-11-29 18:12:20 +0100 | [diff] [blame] | 671 | struct setup_data *e820ext = NULL; |
| 672 | __u32 e820ext_size = 0; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 673 | efi_status_t status; |
| 674 | __u32 desc_version; |
Jeffrey Hugo | dadb57a | 2016-08-29 14:38:51 -0600 | [diff] [blame] | 675 | struct efi_boot_memmap map; |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 676 | struct exit_boot_struct priv; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 677 | |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 678 | map.map = &mem_map; |
| 679 | map.map_size = &map_sz; |
| 680 | map.desc_size = &desc_size; |
| 681 | map.desc_ver = &desc_version; |
| 682 | map.key_ptr = &key; |
| 683 | map.buff_size = &buff_size; |
| 684 | priv.boot_params = boot_params; |
| 685 | priv.efi = &boot_params->efi_info; |
Eric Snowberg | b84a64f | 2018-11-29 18:12:20 +0100 | [diff] [blame] | 686 | |
| 687 | status = allocate_e820(boot_params, &e820ext, &e820ext_size); |
| 688 | if (status != EFI_SUCCESS) |
| 689 | return status; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 690 | |
Jeffrey Hugo | d649340 | 2016-08-29 14:38:54 -0600 | [diff] [blame] | 691 | /* Might as well exit boot services now */ |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 692 | status = efi_exit_boot_services(handle, &map, &priv, exit_boot_func); |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 693 | if (status != EFI_SUCCESS) |
| 694 | return status; |
| 695 | |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 696 | /* Historic? */ |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 697 | boot_params->alt_mem_k = 32 * 1024; |
Linn Crosetto | d2078d5 | 2013-09-22 19:59:08 -0600 | [diff] [blame] | 698 | |
| 699 | status = setup_e820(boot_params, e820ext, e820ext_size); |
| 700 | if (status != EFI_SUCCESS) |
| 701 | return status; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 702 | |
| 703 | return EFI_SUCCESS; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 704 | } |
| 705 | |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 706 | /* |
Arvind Sankar | 8acf63e | 2020-03-08 09:08:43 +0100 | [diff] [blame] | 707 | * On success, we return the address of startup_32, which has potentially been |
| 708 | * relocated by efi_relocate_kernel. |
| 709 | * On failure, we exit to the firmware via efi_exit instead of returning. |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 710 | */ |
Arvind Sankar | 8acf63e | 2020-03-08 09:08:43 +0100 | [diff] [blame] | 711 | unsigned long efi_main(efi_handle_t handle, |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 712 | efi_system_table_t *sys_table_arg, |
Ard Biesheuvel | 796eb8d | 2020-01-13 18:22:33 +0100 | [diff] [blame] | 713 | struct boot_params *boot_params) |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 714 | { |
Ard Biesheuvel | 04a7d0e | 2020-02-10 17:02:31 +0100 | [diff] [blame] | 715 | unsigned long bzimage_addr = (unsigned long)startup_32; |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 716 | struct setup_header *hdr = &boot_params->hdr; |
| 717 | efi_status_t status; |
Hans de Goede | c33ce98 | 2018-09-12 20:32:05 +0200 | [diff] [blame] | 718 | unsigned long cmdline_paddr; |
Matt Fleming | 54b52d8 | 2014-01-10 15:27:14 +0000 | [diff] [blame] | 719 | |
Ard Biesheuvel | c3710de | 2019-12-24 16:10:17 +0100 | [diff] [blame] | 720 | sys_table = sys_table_arg; |
Matt Fleming | 54b52d8 | 2014-01-10 15:27:14 +0000 | [diff] [blame] | 721 | |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 722 | /* Check if we were booted by the EFI firmware */ |
| 723 | if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 724 | efi_exit(handle, EFI_INVALID_PARAMETER); |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 725 | |
David Howells | de8cb45 | 2017-02-06 11:22:43 +0000 | [diff] [blame] | 726 | /* |
Ard Biesheuvel | 04a7d0e | 2020-02-10 17:02:31 +0100 | [diff] [blame] | 727 | * If the kernel isn't already loaded at the preferred load |
| 728 | * address, relocate it. |
| 729 | */ |
| 730 | if (bzimage_addr != hdr->pref_address) { |
| 731 | status = efi_relocate_kernel(&bzimage_addr, |
| 732 | hdr->init_size, hdr->init_size, |
| 733 | hdr->pref_address, |
| 734 | hdr->kernel_alignment, |
| 735 | LOAD_PHYSICAL_ADDR); |
| 736 | if (status != EFI_SUCCESS) { |
| 737 | efi_printk("efi_relocate_kernel() failed!\n"); |
| 738 | goto fail; |
| 739 | } |
| 740 | } |
Ard Biesheuvel | 04a7d0e | 2020-02-10 17:02:31 +0100 | [diff] [blame] | 741 | |
| 742 | /* |
Ard Biesheuvel | 91d150c | 2020-02-10 17:02:46 +0100 | [diff] [blame] | 743 | * efi_pe_entry() may have been called before efi_main(), in which |
Hans de Goede | c33ce98 | 2018-09-12 20:32:05 +0200 | [diff] [blame] | 744 | * case this is the second time we parse the cmdline. This is ok, |
| 745 | * parsing the cmdline multiple times does not have side-effects. |
| 746 | */ |
| 747 | cmdline_paddr = ((u64)hdr->cmd_line_ptr | |
| 748 | ((u64)boot_params->ext_cmd_line_ptr << 32)); |
| 749 | efi_parse_options((char *)cmdline_paddr); |
| 750 | |
| 751 | /* |
Ard Biesheuvel | ec93fc3 | 2020-02-03 23:45:14 +0000 | [diff] [blame] | 752 | * At this point, an initrd may already have been loaded, either by |
| 753 | * the bootloader and passed via bootparams, or loaded from a initrd= |
| 754 | * command line option by efi_pe_entry() above. In either case, we |
| 755 | * permit an initrd loaded from the LINUX_EFI_INITRD_MEDIA_GUID device |
| 756 | * path to supersede it. |
| 757 | */ |
Ard Biesheuvel | 79d3219 | 2020-02-04 22:01:22 +0000 | [diff] [blame] | 758 | if (!noinitrd()) { |
| 759 | unsigned long addr, size; |
| 760 | unsigned long max_addr = hdr->initrd_addr_max; |
| 761 | |
| 762 | if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) |
| 763 | max_addr = ULONG_MAX; |
| 764 | |
| 765 | status = efi_load_initrd_dev_path(&addr, &size, max_addr); |
| 766 | if (status == EFI_SUCCESS) { |
| 767 | hdr->ramdisk_image = (u32)addr; |
| 768 | hdr->ramdisk_size = (u32)size; |
| 769 | boot_params->ext_ramdisk_image = (u64)addr >> 32; |
| 770 | boot_params->ext_ramdisk_size = (u64)size >> 32; |
| 771 | } else if (status != EFI_NOT_FOUND) { |
| 772 | efi_printk("efi_load_initrd_dev_path() failed!\n"); |
| 773 | goto fail; |
| 774 | } |
Ard Biesheuvel | ec93fc3 | 2020-02-03 23:45:14 +0000 | [diff] [blame] | 775 | } |
| 776 | |
| 777 | /* |
David Howells | de8cb45 | 2017-02-06 11:22:43 +0000 | [diff] [blame] | 778 | * If the boot loader gave us a value for secure_boot then we use that, |
| 779 | * otherwise we ask the BIOS. |
| 780 | */ |
| 781 | if (boot_params->secure_boot == efi_secureboot_mode_unset) |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 782 | boot_params->secure_boot = efi_get_secureboot(); |
David Howells | de8cb45 | 2017-02-06 11:22:43 +0000 | [diff] [blame] | 783 | |
Matthew Garrett | ccc829b | 2017-08-25 16:50:15 +0100 | [diff] [blame] | 784 | /* Ask the firmware to clear memory on unclean shutdown */ |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 785 | efi_enable_reset_attack_mitigation(); |
Dominik Brodowski | 0d95981 | 2019-11-06 08:06:13 +0100 | [diff] [blame] | 786 | |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 787 | efi_random_get_seed(); |
Dominik Brodowski | 0d95981 | 2019-11-06 08:06:13 +0100 | [diff] [blame] | 788 | |
Ard Biesheuvel | cd33a5c | 2019-12-24 16:10:19 +0100 | [diff] [blame] | 789 | efi_retrieve_tpm2_eventlog(); |
Matthew Garrett | ccc829b | 2017-08-25 16:50:15 +0100 | [diff] [blame] | 790 | |
Matt Fleming | 9ca8f72 | 2012-07-19 10:23:48 +0100 | [diff] [blame] | 791 | setup_graphics(boot_params); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 792 | |
Matt Fleming | 56394ab | 2014-09-11 09:04:25 +0100 | [diff] [blame] | 793 | setup_efi_pci(boot_params); |
Matthew Garrett | dd5fc85 | 2012-12-05 14:33:26 -0700 | [diff] [blame] | 794 | |
Lukas Wunner | 58c5475 | 2016-11-12 21:32:36 +0000 | [diff] [blame] | 795 | setup_quirks(boot_params); |
| 796 | |
Ard Biesheuvel | aab9593 | 2018-07-20 10:47:24 +0900 | [diff] [blame] | 797 | status = exit_boot(boot_params, handle); |
Ulf Winkelvos | fb86b24 | 2014-07-10 02:12:41 +0200 | [diff] [blame] | 798 | if (status != EFI_SUCCESS) { |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 799 | efi_printk("exit_boot() failed!\n"); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 800 | goto fail; |
Ulf Winkelvos | fb86b24 | 2014-07-10 02:12:41 +0200 | [diff] [blame] | 801 | } |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 802 | |
Arvind Sankar | 8acf63e | 2020-03-08 09:08:43 +0100 | [diff] [blame] | 803 | return bzimage_addr; |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 804 | fail: |
Ard Biesheuvel | 8173ec7 | 2019-12-24 16:10:18 +0100 | [diff] [blame] | 805 | efi_printk("efi_main() failed!\n"); |
Ingo Molnar | 90a2186 | 2018-07-11 11:40:33 +0200 | [diff] [blame] | 806 | |
Ard Biesheuvel | 3b8f44f | 2020-02-16 00:03:25 +0100 | [diff] [blame] | 807 | efi_exit(handle, status); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 808 | } |