Lines 101-106
Link Here
|
101 |
char buf[24]; |
101 |
char buf[24]; |
102 |
int revision; |
102 |
int revision; |
103 |
EFI_STATUS status; |
103 |
EFI_STATUS status; |
|
|
104 |
EFI_MEMORY_DESCRIPTOR *map; |
105 |
UINTN mmsz, sz; |
106 |
UINT32 mmver; |
104 |
|
107 |
|
105 |
rsdp = efi_get_table(&acpi20_guid); |
108 |
rsdp = efi_get_table(&acpi20_guid); |
106 |
if (rsdp == NULL) { |
109 |
if (rsdp == NULL) { |
Lines 176-184
Link Here
|
176 |
|
179 |
|
177 |
status = BS->ExitBootServices(IH, efi_mapkey); |
180 |
status = BS->ExitBootServices(IH, efi_mapkey); |
178 |
if (EFI_ERROR(status)) { |
181 |
if (EFI_ERROR(status)) { |
179 |
printf("%s: ExitBootServices() returned 0x%lx\n", __func__, |
182 |
/* Map key is incorrect, update it and retry */ |
180 |
(long)status); |
183 |
printf("%s: ExitBootServices() returned 0x%lx, re-fetching " |
181 |
return (EINVAL); |
184 |
"memory map key and retrying\n", __func__, (long)status); |
|
|
185 |
sz = 0; |
186 |
status = BS->GetMemoryMap(&sz, 0, &efi_mapkey, &mmsz, &mmver); |
187 |
if (status != EFI_BUFFER_TOO_SMALL) { |
188 |
printf("%s: GetMemoryMap() returned 0x%lx, cannot read " |
189 |
"memory map size\n", __func__, (long)status); |
190 |
return (EINVAL); |
191 |
} |
192 |
map = malloc(sz); |
193 |
status = BS->GetMemoryMap(&sz, map, &efi_mapkey, &mmsz, &mmver); |
194 |
free(map); /* The only thing we need is an updated map key */ |
195 |
if (EFI_ERROR(status)) { |
196 |
printf("%s: GetMemoryMap() returned 0x%lx, cannot read " |
197 |
"memory map key\n", __func__, (long)status); |
198 |
return (EINVAL); |
199 |
} |
200 |
status = BS->ExitBootServices(IH, efi_mapkey); |
201 |
if (EFI_ERROR(status)) { |
202 |
printf("%s: ExitBootServices() returned 0x%lx, no try " |
203 |
"left\n", __func__, (long)status); |
204 |
return (EINVAL); |
205 |
} |
182 |
} |
206 |
} |
183 |
|
207 |
|
184 |
dev_cleanup(); |
208 |
dev_cleanup(); |