diff options
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 38 | ||||
-rw-r--r-- | drivers/firmware/efi/efi-stub-helper.c | 96 |
2 files changed, 72 insertions, 62 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index ab0eefcc5123..65b6a34f56d6 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -453,13 +453,13 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table) | |||
453 | status = efi_call_phys3(sys_table->boottime->handle_protocol, | 453 | status = efi_call_phys3(sys_table->boottime->handle_protocol, |
454 | handle, &proto, (void *)&image); | 454 | handle, &proto, (void *)&image); |
455 | if (status != EFI_SUCCESS) { | 455 | if (status != EFI_SUCCESS) { |
456 | efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n"); | 456 | efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n"); |
457 | return NULL; | 457 | return NULL; |
458 | } | 458 | } |
459 | 459 | ||
460 | status = low_alloc(0x4000, 1, (unsigned long *)&boot_params); | 460 | status = low_alloc(sys_table, 0x4000, 1, (unsigned long *)&boot_params); |
461 | if (status != EFI_SUCCESS) { | 461 | if (status != EFI_SUCCESS) { |
462 | efi_printk("Failed to alloc lowmem for boot params\n"); | 462 | efi_printk(sys_table, "Failed to alloc lowmem for boot params\n"); |
463 | return NULL; | 463 | return NULL; |
464 | } | 464 | } |
465 | 465 | ||
@@ -503,9 +503,10 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table) | |||
503 | 503 | ||
504 | options_size++; /* NUL termination */ | 504 | options_size++; /* NUL termination */ |
505 | 505 | ||
506 | status = low_alloc(options_size, 1, &cmdline); | 506 | status = low_alloc(sys_table, options_size, 1, |
507 | &cmdline); | ||
507 | if (status != EFI_SUCCESS) { | 508 | if (status != EFI_SUCCESS) { |
508 | efi_printk("Failed to alloc mem for cmdline\n"); | 509 | efi_printk(sys_table, "Failed to alloc mem for cmdline\n"); |
509 | goto fail; | 510 | goto fail; |
510 | } | 511 | } |
511 | 512 | ||
@@ -529,16 +530,16 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table) | |||
529 | 530 | ||
530 | memset(sdt, 0, sizeof(*sdt)); | 531 | memset(sdt, 0, sizeof(*sdt)); |
531 | 532 | ||
532 | status = handle_ramdisks(image, hdr); | 533 | status = handle_ramdisks(sys_table, image, hdr); |
533 | if (status != EFI_SUCCESS) | 534 | if (status != EFI_SUCCESS) |
534 | goto fail2; | 535 | goto fail2; |
535 | 536 | ||
536 | return boot_params; | 537 | return boot_params; |
537 | fail2: | 538 | fail2: |
538 | if (options_size) | 539 | if (options_size) |
539 | low_free(options_size, hdr->cmd_line_ptr); | 540 | low_free(sys_table, options_size, hdr->cmd_line_ptr); |
540 | fail: | 541 | fail: |
541 | low_free(0x4000, (unsigned long)boot_params); | 542 | low_free(sys_table, 0x4000, (unsigned long)boot_params); |
542 | return NULL; | 543 | return NULL; |
543 | } | 544 | } |
544 | 545 | ||
@@ -561,7 +562,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params, | |||
561 | again: | 562 | again: |
562 | size += sizeof(*mem_map) * 2; | 563 | size += sizeof(*mem_map) * 2; |
563 | _size = size; | 564 | _size = size; |
564 | status = low_alloc(size, 1, (unsigned long *)&mem_map); | 565 | status = low_alloc(sys_table, size, 1, (unsigned long *)&mem_map); |
565 | if (status != EFI_SUCCESS) | 566 | if (status != EFI_SUCCESS) |
566 | return status; | 567 | return status; |
567 | 568 | ||
@@ -569,7 +570,7 @@ get_map: | |||
569 | status = efi_call_phys5(sys_table->boottime->get_memory_map, &size, | 570 | status = efi_call_phys5(sys_table->boottime->get_memory_map, &size, |
570 | mem_map, &key, &desc_size, &desc_version); | 571 | mem_map, &key, &desc_size, &desc_version); |
571 | if (status == EFI_BUFFER_TOO_SMALL) { | 572 | if (status == EFI_BUFFER_TOO_SMALL) { |
572 | low_free(_size, (unsigned long)mem_map); | 573 | low_free(sys_table, _size, (unsigned long)mem_map); |
573 | goto again; | 574 | goto again; |
574 | } | 575 | } |
575 | 576 | ||
@@ -671,7 +672,7 @@ get_map: | |||
671 | return EFI_SUCCESS; | 672 | return EFI_SUCCESS; |
672 | 673 | ||
673 | free_mem_map: | 674 | free_mem_map: |
674 | low_free(_size, (unsigned long)mem_map); | 675 | low_free(sys_table, _size, (unsigned long)mem_map); |
675 | return status; | 676 | return status; |
676 | } | 677 | } |
677 | 678 | ||
@@ -694,10 +695,10 @@ static efi_status_t relocate_kernel(struct setup_header *hdr) | |||
694 | EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, | 695 | EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, |
695 | nr_pages, &start); | 696 | nr_pages, &start); |
696 | if (status != EFI_SUCCESS) { | 697 | if (status != EFI_SUCCESS) { |
697 | status = low_alloc(hdr->init_size, hdr->kernel_alignment, | 698 | status = low_alloc(sys_table, hdr->init_size, |
698 | &start); | 699 | hdr->kernel_alignment, &start); |
699 | if (status != EFI_SUCCESS) | 700 | if (status != EFI_SUCCESS) |
700 | efi_printk("Failed to alloc mem for kernel\n"); | 701 | efi_printk(sys_table, "Failed to alloc mem for kernel\n"); |
701 | } | 702 | } |
702 | 703 | ||
703 | if (status == EFI_SUCCESS) | 704 | if (status == EFI_SUCCESS) |
@@ -737,14 +738,15 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table, | |||
737 | EFI_LOADER_DATA, sizeof(*gdt), | 738 | EFI_LOADER_DATA, sizeof(*gdt), |
738 | (void **)&gdt); | 739 | (void **)&gdt); |
739 | if (status != EFI_SUCCESS) { | 740 | if (status != EFI_SUCCESS) { |
740 | efi_printk("Failed to alloc mem for gdt structure\n"); | 741 | efi_printk(sys_table, "Failed to alloc mem for gdt structure\n"); |
741 | goto fail; | 742 | goto fail; |
742 | } | 743 | } |
743 | 744 | ||
744 | gdt->size = 0x800; | 745 | gdt->size = 0x800; |
745 | status = low_alloc(gdt->size, 8, (unsigned long *)&gdt->address); | 746 | status = low_alloc(sys_table, gdt->size, 8, |
747 | (unsigned long *)&gdt->address); | ||
746 | if (status != EFI_SUCCESS) { | 748 | if (status != EFI_SUCCESS) { |
747 | efi_printk("Failed to alloc mem for gdt\n"); | 749 | efi_printk(sys_table, "Failed to alloc mem for gdt\n"); |
748 | goto fail; | 750 | goto fail; |
749 | } | 751 | } |
750 | 752 | ||
@@ -752,7 +754,7 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table, | |||
752 | EFI_LOADER_DATA, sizeof(*idt), | 754 | EFI_LOADER_DATA, sizeof(*idt), |
753 | (void **)&idt); | 755 | (void **)&idt); |
754 | if (status != EFI_SUCCESS) { | 756 | if (status != EFI_SUCCESS) { |
755 | efi_printk("Failed to alloc mem for idt structure\n"); | 757 | efi_printk(sys_table, "Failed to alloc mem for idt structure\n"); |
756 | goto fail; | 758 | goto fail; |
757 | } | 759 | } |
758 | 760 | ||
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c index 8a83387fef92..05c539e9a3c8 100644 --- a/drivers/firmware/efi/efi-stub-helper.c +++ b/drivers/firmware/efi/efi-stub-helper.c | |||
@@ -19,15 +19,16 @@ struct initrd { | |||
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | static void efi_char16_printk(efi_char16_t *str) | 22 | static void efi_char16_printk(efi_system_table_t *sys_table_arg, |
23 | efi_char16_t *str) | ||
23 | { | 24 | { |
24 | struct efi_simple_text_output_protocol *out; | 25 | struct efi_simple_text_output_protocol *out; |
25 | 26 | ||
26 | out = (struct efi_simple_text_output_protocol *)sys_table->con_out; | 27 | out = (struct efi_simple_text_output_protocol *)sys_table_arg->con_out; |
27 | efi_call_phys2(out->output_string, out, str); | 28 | efi_call_phys2(out->output_string, out, str); |
28 | } | 29 | } |
29 | 30 | ||
30 | static void efi_printk(char *str) | 31 | static void efi_printk(efi_system_table_t *sys_table_arg, char *str) |
31 | { | 32 | { |
32 | char *s8; | 33 | char *s8; |
33 | 34 | ||
@@ -37,15 +38,17 @@ static void efi_printk(char *str) | |||
37 | ch[0] = *s8; | 38 | ch[0] = *s8; |
38 | if (*s8 == '\n') { | 39 | if (*s8 == '\n') { |
39 | efi_char16_t nl[2] = { '\r', 0 }; | 40 | efi_char16_t nl[2] = { '\r', 0 }; |
40 | efi_char16_printk(nl); | 41 | efi_char16_printk(sys_table_arg, nl); |
41 | } | 42 | } |
42 | 43 | ||
43 | efi_char16_printk(ch); | 44 | efi_char16_printk(sys_table_arg, ch); |
44 | } | 45 | } |
45 | } | 46 | } |
46 | 47 | ||
47 | 48 | ||
48 | static efi_status_t __get_map(efi_memory_desc_t **map, unsigned long *map_size, | 49 | static efi_status_t __get_map(efi_system_table_t *sys_table_arg, |
50 | efi_memory_desc_t **map, | ||
51 | unsigned long *map_size, | ||
49 | unsigned long *desc_size) | 52 | unsigned long *desc_size) |
50 | { | 53 | { |
51 | efi_memory_desc_t *m = NULL; | 54 | efi_memory_desc_t *m = NULL; |
@@ -60,20 +63,20 @@ again: | |||
60 | * allocation which may be in a new descriptor region. | 63 | * allocation which may be in a new descriptor region. |
61 | */ | 64 | */ |
62 | *map_size += sizeof(*m); | 65 | *map_size += sizeof(*m); |
63 | status = efi_call_phys3(sys_table->boottime->allocate_pool, | 66 | status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, |
64 | EFI_LOADER_DATA, *map_size, (void **)&m); | 67 | EFI_LOADER_DATA, *map_size, (void **)&m); |
65 | if (status != EFI_SUCCESS) | 68 | if (status != EFI_SUCCESS) |
66 | goto fail; | 69 | goto fail; |
67 | 70 | ||
68 | status = efi_call_phys5(sys_table->boottime->get_memory_map, map_size, | 71 | status = efi_call_phys5(sys_table_arg->boottime->get_memory_map, |
69 | m, &key, desc_size, &desc_version); | 72 | map_size, m, &key, desc_size, &desc_version); |
70 | if (status == EFI_BUFFER_TOO_SMALL) { | 73 | if (status == EFI_BUFFER_TOO_SMALL) { |
71 | efi_call_phys1(sys_table->boottime->free_pool, m); | 74 | efi_call_phys1(sys_table_arg->boottime->free_pool, m); |
72 | goto again; | 75 | goto again; |
73 | } | 76 | } |
74 | 77 | ||
75 | if (status != EFI_SUCCESS) | 78 | if (status != EFI_SUCCESS) |
76 | efi_call_phys1(sys_table->boottime->free_pool, m); | 79 | efi_call_phys1(sys_table_arg->boottime->free_pool, m); |
77 | 80 | ||
78 | fail: | 81 | fail: |
79 | *map = m; | 82 | *map = m; |
@@ -83,8 +86,9 @@ fail: | |||
83 | /* | 86 | /* |
84 | * Allocate at the highest possible address that is not above 'max'. | 87 | * Allocate at the highest possible address that is not above 'max'. |
85 | */ | 88 | */ |
86 | static efi_status_t high_alloc(unsigned long size, unsigned long align, | 89 | static efi_status_t high_alloc(efi_system_table_t *sys_table_arg, |
87 | unsigned long *addr, unsigned long max) | 90 | unsigned long size, unsigned long align, |
91 | unsigned long *addr, unsigned long max) | ||
88 | { | 92 | { |
89 | unsigned long map_size, desc_size; | 93 | unsigned long map_size, desc_size; |
90 | efi_memory_desc_t *map; | 94 | efi_memory_desc_t *map; |
@@ -93,7 +97,7 @@ static efi_status_t high_alloc(unsigned long size, unsigned long align, | |||
93 | u64 max_addr = 0; | 97 | u64 max_addr = 0; |
94 | int i; | 98 | int i; |
95 | 99 | ||
96 | status = __get_map(&map, &map_size, &desc_size); | 100 | status = __get_map(sys_table_arg, &map, &map_size, &desc_size); |
97 | if (status != EFI_SUCCESS) | 101 | if (status != EFI_SUCCESS) |
98 | goto fail; | 102 | goto fail; |
99 | 103 | ||
@@ -139,7 +143,7 @@ again: | |||
139 | if (!max_addr) | 143 | if (!max_addr) |
140 | status = EFI_NOT_FOUND; | 144 | status = EFI_NOT_FOUND; |
141 | else { | 145 | else { |
142 | status = efi_call_phys4(sys_table->boottime->allocate_pages, | 146 | status = efi_call_phys4(sys_table_arg->boottime->allocate_pages, |
143 | EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, | 147 | EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, |
144 | nr_pages, &max_addr); | 148 | nr_pages, &max_addr); |
145 | if (status != EFI_SUCCESS) { | 149 | if (status != EFI_SUCCESS) { |
@@ -152,7 +156,7 @@ again: | |||
152 | } | 156 | } |
153 | 157 | ||
154 | free_pool: | 158 | free_pool: |
155 | efi_call_phys1(sys_table->boottime->free_pool, map); | 159 | efi_call_phys1(sys_table_arg->boottime->free_pool, map); |
156 | 160 | ||
157 | fail: | 161 | fail: |
158 | return status; | 162 | return status; |
@@ -161,7 +165,8 @@ fail: | |||
161 | /* | 165 | /* |
162 | * Allocate at the lowest possible address. | 166 | * Allocate at the lowest possible address. |
163 | */ | 167 | */ |
164 | static efi_status_t low_alloc(unsigned long size, unsigned long align, | 168 | static efi_status_t low_alloc(efi_system_table_t *sys_table_arg, |
169 | unsigned long size, unsigned long align, | ||
165 | unsigned long *addr) | 170 | unsigned long *addr) |
166 | { | 171 | { |
167 | unsigned long map_size, desc_size; | 172 | unsigned long map_size, desc_size; |
@@ -170,7 +175,7 @@ static efi_status_t low_alloc(unsigned long size, unsigned long align, | |||
170 | unsigned long nr_pages; | 175 | unsigned long nr_pages; |
171 | int i; | 176 | int i; |
172 | 177 | ||
173 | status = __get_map(&map, &map_size, &desc_size); | 178 | status = __get_map(sys_table_arg, &map, &map_size, &desc_size); |
174 | if (status != EFI_SUCCESS) | 179 | if (status != EFI_SUCCESS) |
175 | goto fail; | 180 | goto fail; |
176 | 181 | ||
@@ -203,7 +208,7 @@ static efi_status_t low_alloc(unsigned long size, unsigned long align, | |||
203 | if ((start + size) > end) | 208 | if ((start + size) > end) |
204 | continue; | 209 | continue; |
205 | 210 | ||
206 | status = efi_call_phys4(sys_table->boottime->allocate_pages, | 211 | status = efi_call_phys4(sys_table_arg->boottime->allocate_pages, |
207 | EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, | 212 | EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, |
208 | nr_pages, &start); | 213 | nr_pages, &start); |
209 | if (status == EFI_SUCCESS) { | 214 | if (status == EFI_SUCCESS) { |
@@ -216,17 +221,18 @@ static efi_status_t low_alloc(unsigned long size, unsigned long align, | |||
216 | status = EFI_NOT_FOUND; | 221 | status = EFI_NOT_FOUND; |
217 | 222 | ||
218 | free_pool: | 223 | free_pool: |
219 | efi_call_phys1(sys_table->boottime->free_pool, map); | 224 | efi_call_phys1(sys_table_arg->boottime->free_pool, map); |
220 | fail: | 225 | fail: |
221 | return status; | 226 | return status; |
222 | } | 227 | } |
223 | 228 | ||
224 | static void low_free(unsigned long size, unsigned long addr) | 229 | static void low_free(efi_system_table_t *sys_table_arg, unsigned long size, |
230 | unsigned long addr) | ||
225 | { | 231 | { |
226 | unsigned long nr_pages; | 232 | unsigned long nr_pages; |
227 | 233 | ||
228 | nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; | 234 | nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; |
229 | efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages); | 235 | efi_call_phys2(sys_table_arg->boottime->free_pages, addr, nr_pages); |
230 | } | 236 | } |
231 | 237 | ||
232 | 238 | ||
@@ -236,7 +242,8 @@ static void low_free(unsigned long size, unsigned long addr) | |||
236 | * We only support loading an initrd from the same filesystem as the | 242 | * We only support loading an initrd from the same filesystem as the |
237 | * kernel image. | 243 | * kernel image. |
238 | */ | 244 | */ |
239 | static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | 245 | static efi_status_t handle_ramdisks(efi_system_table_t *sys_table_arg, |
246 | efi_loaded_image_t *image, | ||
240 | struct setup_header *hdr) | 247 | struct setup_header *hdr) |
241 | { | 248 | { |
242 | struct initrd *initrds; | 249 | struct initrd *initrds; |
@@ -278,12 +285,12 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | |||
278 | if (!nr_initrds) | 285 | if (!nr_initrds) |
279 | return EFI_SUCCESS; | 286 | return EFI_SUCCESS; |
280 | 287 | ||
281 | status = efi_call_phys3(sys_table->boottime->allocate_pool, | 288 | status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, |
282 | EFI_LOADER_DATA, | 289 | EFI_LOADER_DATA, |
283 | nr_initrds * sizeof(*initrds), | 290 | nr_initrds * sizeof(*initrds), |
284 | &initrds); | 291 | &initrds); |
285 | if (status != EFI_SUCCESS) { | 292 | if (status != EFI_SUCCESS) { |
286 | efi_printk("Failed to alloc mem for initrds\n"); | 293 | efi_printk(sys_table_arg, "Failed to alloc mem for initrds\n"); |
287 | goto fail; | 294 | goto fail; |
288 | } | 295 | } |
289 | 296 | ||
@@ -329,18 +336,18 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | |||
329 | if (!i) { | 336 | if (!i) { |
330 | efi_boot_services_t *boottime; | 337 | efi_boot_services_t *boottime; |
331 | 338 | ||
332 | boottime = sys_table->boottime; | 339 | boottime = sys_table_arg->boottime; |
333 | 340 | ||
334 | status = efi_call_phys3(boottime->handle_protocol, | 341 | status = efi_call_phys3(boottime->handle_protocol, |
335 | image->device_handle, &fs_proto, &io); | 342 | image->device_handle, &fs_proto, &io); |
336 | if (status != EFI_SUCCESS) { | 343 | if (status != EFI_SUCCESS) { |
337 | efi_printk("Failed to handle fs_proto\n"); | 344 | efi_printk(sys_table_arg, "Failed to handle fs_proto\n"); |
338 | goto free_initrds; | 345 | goto free_initrds; |
339 | } | 346 | } |
340 | 347 | ||
341 | status = efi_call_phys2(io->open_volume, io, &fh); | 348 | status = efi_call_phys2(io->open_volume, io, &fh); |
342 | if (status != EFI_SUCCESS) { | 349 | if (status != EFI_SUCCESS) { |
343 | efi_printk("Failed to open volume\n"); | 350 | efi_printk(sys_table_arg, "Failed to open volume\n"); |
344 | goto free_initrds; | 351 | goto free_initrds; |
345 | } | 352 | } |
346 | } | 353 | } |
@@ -348,9 +355,9 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | |||
348 | status = efi_call_phys5(fh->open, fh, &h, filename_16, | 355 | status = efi_call_phys5(fh->open, fh, &h, filename_16, |
349 | EFI_FILE_MODE_READ, (u64)0); | 356 | EFI_FILE_MODE_READ, (u64)0); |
350 | if (status != EFI_SUCCESS) { | 357 | if (status != EFI_SUCCESS) { |
351 | efi_printk("Failed to open initrd file: "); | 358 | efi_printk(sys_table_arg, "Failed to open initrd file: "); |
352 | efi_char16_printk(filename_16); | 359 | efi_char16_printk(sys_table_arg, filename_16); |
353 | efi_printk("\n"); | 360 | efi_printk(sys_table_arg, "\n"); |
354 | goto close_handles; | 361 | goto close_handles; |
355 | } | 362 | } |
356 | 363 | ||
@@ -360,30 +367,31 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | |||
360 | status = efi_call_phys4(h->get_info, h, &info_guid, | 367 | status = efi_call_phys4(h->get_info, h, &info_guid, |
361 | &info_sz, NULL); | 368 | &info_sz, NULL); |
362 | if (status != EFI_BUFFER_TOO_SMALL) { | 369 | if (status != EFI_BUFFER_TOO_SMALL) { |
363 | efi_printk("Failed to get initrd info size\n"); | 370 | efi_printk(sys_table_arg, "Failed to get initrd info size\n"); |
364 | goto close_handles; | 371 | goto close_handles; |
365 | } | 372 | } |
366 | 373 | ||
367 | grow: | 374 | grow: |
368 | status = efi_call_phys3(sys_table->boottime->allocate_pool, | 375 | status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, |
369 | EFI_LOADER_DATA, info_sz, &info); | 376 | EFI_LOADER_DATA, info_sz, &info); |
370 | if (status != EFI_SUCCESS) { | 377 | if (status != EFI_SUCCESS) { |
371 | efi_printk("Failed to alloc mem for initrd info\n"); | 378 | efi_printk(sys_table_arg, "Failed to alloc mem for initrd info\n"); |
372 | goto close_handles; | 379 | goto close_handles; |
373 | } | 380 | } |
374 | 381 | ||
375 | status = efi_call_phys4(h->get_info, h, &info_guid, | 382 | status = efi_call_phys4(h->get_info, h, &info_guid, |
376 | &info_sz, info); | 383 | &info_sz, info); |
377 | if (status == EFI_BUFFER_TOO_SMALL) { | 384 | if (status == EFI_BUFFER_TOO_SMALL) { |
378 | efi_call_phys1(sys_table->boottime->free_pool, info); | 385 | efi_call_phys1(sys_table_arg->boottime->free_pool, |
386 | info); | ||
379 | goto grow; | 387 | goto grow; |
380 | } | 388 | } |
381 | 389 | ||
382 | file_sz = info->file_size; | 390 | file_sz = info->file_size; |
383 | efi_call_phys1(sys_table->boottime->free_pool, info); | 391 | efi_call_phys1(sys_table_arg->boottime->free_pool, info); |
384 | 392 | ||
385 | if (status != EFI_SUCCESS) { | 393 | if (status != EFI_SUCCESS) { |
386 | efi_printk("Failed to get initrd info\n"); | 394 | efi_printk(sys_table_arg, "Failed to get initrd info\n"); |
387 | goto close_handles; | 395 | goto close_handles; |
388 | } | 396 | } |
389 | 397 | ||
@@ -399,16 +407,16 @@ grow: | |||
399 | * addresses in memory, so allocate enough memory for | 407 | * addresses in memory, so allocate enough memory for |
400 | * all the initrd's. | 408 | * all the initrd's. |
401 | */ | 409 | */ |
402 | status = high_alloc(initrd_total, 0x1000, | 410 | status = high_alloc(sys_table_arg, initrd_total, 0x1000, |
403 | &initrd_addr, hdr->initrd_addr_max); | 411 | &initrd_addr, hdr->initrd_addr_max); |
404 | if (status != EFI_SUCCESS) { | 412 | if (status != EFI_SUCCESS) { |
405 | efi_printk("Failed to alloc highmem for initrds\n"); | 413 | efi_printk(sys_table_arg, "Failed to alloc highmem for initrds\n"); |
406 | goto close_handles; | 414 | goto close_handles; |
407 | } | 415 | } |
408 | 416 | ||
409 | /* We've run out of free low memory. */ | 417 | /* We've run out of free low memory. */ |
410 | if (initrd_addr > hdr->initrd_addr_max) { | 418 | if (initrd_addr > hdr->initrd_addr_max) { |
411 | efi_printk("We've run out of free low memory\n"); | 419 | efi_printk(sys_table_arg, "We've run out of free low memory\n"); |
412 | status = EFI_INVALID_PARAMETER; | 420 | status = EFI_INVALID_PARAMETER; |
413 | goto free_initrd_total; | 421 | goto free_initrd_total; |
414 | } | 422 | } |
@@ -428,7 +436,7 @@ grow: | |||
428 | initrds[j].handle, | 436 | initrds[j].handle, |
429 | &chunksize, addr); | 437 | &chunksize, addr); |
430 | if (status != EFI_SUCCESS) { | 438 | if (status != EFI_SUCCESS) { |
431 | efi_printk("Failed to read initrd\n"); | 439 | efi_printk(sys_table_arg, "Failed to read initrd\n"); |
432 | goto free_initrd_total; | 440 | goto free_initrd_total; |
433 | } | 441 | } |
434 | addr += chunksize; | 442 | addr += chunksize; |
@@ -440,7 +448,7 @@ grow: | |||
440 | 448 | ||
441 | } | 449 | } |
442 | 450 | ||
443 | efi_call_phys1(sys_table->boottime->free_pool, initrds); | 451 | efi_call_phys1(sys_table_arg->boottime->free_pool, initrds); |
444 | 452 | ||
445 | hdr->ramdisk_image = initrd_addr; | 453 | hdr->ramdisk_image = initrd_addr; |
446 | hdr->ramdisk_size = initrd_total; | 454 | hdr->ramdisk_size = initrd_total; |
@@ -448,13 +456,13 @@ grow: | |||
448 | return status; | 456 | return status; |
449 | 457 | ||
450 | free_initrd_total: | 458 | free_initrd_total: |
451 | low_free(initrd_total, initrd_addr); | 459 | low_free(sys_table_arg, initrd_total, initrd_addr); |
452 | 460 | ||
453 | close_handles: | 461 | close_handles: |
454 | for (k = j; k < i; k++) | 462 | for (k = j; k < i; k++) |
455 | efi_call_phys1(fh->close, initrds[k].handle); | 463 | efi_call_phys1(fh->close, initrds[k].handle); |
456 | free_initrds: | 464 | free_initrds: |
457 | efi_call_phys1(sys_table->boottime->free_pool, initrds); | 465 | efi_call_phys1(sys_table_arg->boottime->free_pool, initrds); |
458 | fail: | 466 | fail: |
459 | hdr->ramdisk_image = 0; | 467 | hdr->ramdisk_image = 0; |
460 | hdr->ramdisk_size = 0; | 468 | hdr->ramdisk_size = 0; |