Skip to content

Commit f0827e1

Browse files
Ard BiesheuvelIngo Molnar
authored andcommitted
efi/arm*/libstub: Wire up GOP protocol to 'struct screen_info'
This adds the code to the ARM and arm64 versions of the UEFI stub to populate struct screen_info based on the information received from the firmware via the GOP protocol. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Borislav Petkov <bp@alien8.de> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Jones <pjones@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/1461614832-17633-23-git-send-email-matt@codeblueprint.co.uk Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 801820b commit f0827e1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/firmware/efi/libstub/arm-stub.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,25 @@ void efi_char16_printk(efi_system_table_t *sys_table_arg,
169169
out->output_string(out, str);
170170
}
171171

172+
static struct screen_info *setup_graphics(efi_system_table_t *sys_table_arg)
173+
{
174+
efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
175+
efi_status_t status;
176+
unsigned long size;
177+
void **gop_handle = NULL;
178+
struct screen_info *si = NULL;
179+
180+
size = 0;
181+
status = efi_call_early(locate_handle, EFI_LOCATE_BY_PROTOCOL,
182+
&gop_proto, NULL, &size, gop_handle);
183+
if (status == EFI_BUFFER_TOO_SMALL) {
184+
si = alloc_screen_info(sys_table_arg);
185+
if (!si)
186+
return NULL;
187+
efi_setup_gop(sys_table_arg, si, &gop_proto, size);
188+
}
189+
return si;
190+
}
172191

173192
/*
174193
* This function handles the architcture specific differences between arm and
@@ -208,6 +227,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
208227
unsigned long reserve_addr = 0;
209228
unsigned long reserve_size = 0;
210229
int secure_boot = 0;
230+
struct screen_info *si;
211231

212232
/* Check if we were booted by the EFI firmware */
213233
if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
@@ -260,6 +280,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
260280
__nokaslr = true;
261281
}
262282

283+
si = setup_graphics(sys_table);
284+
263285
status = handle_kernel_image(sys_table, image_addr, &image_size,
264286
&reserve_addr,
265287
&reserve_size,
@@ -341,6 +363,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
341363
efi_free(sys_table, image_size, *image_addr);
342364
efi_free(sys_table, reserve_size, reserve_addr);
343365
fail_free_cmdline:
366+
free_screen_info(sys_table, si);
344367
efi_free(sys_table, cmdline_size, (unsigned long)cmdline_ptr);
345368
fail:
346369
return EFI_ERROR;

0 commit comments

Comments
 (0)