Path: blob/master/drivers/firmware/efi/libstub/primary_display.c
121834 views
// SPDX-License-Identifier: GPL-2.012#include <linux/efi.h>3#include <linux/sysfb.h>45#include <asm/efi.h>67#include "efistub.h"89/*10* There are two ways of populating the core kernel's sysfb_primary_display11* via the stub:12*13* - using a configuration table, which relies on the EFI init code to14* locate the table and copy the contents; or15*16* - by linking directly to the core kernel's copy of the global symbol.17*18* The latter is preferred because it makes the EFIFB earlycon available very19* early, but it only works if the EFI stub is part of the core kernel image20* itself. The zboot decompressor can only use the configuration table21* approach.22*/2324static efi_guid_t primary_display_guid = LINUX_EFI_PRIMARY_DISPLAY_TABLE_GUID;2526struct sysfb_display_info *__alloc_primary_display(void)27{28struct sysfb_display_info *dpy;29efi_status_t status;3031status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,32sizeof(*dpy), (void **)&dpy);3334if (status != EFI_SUCCESS)35return NULL;3637memset(dpy, 0, sizeof(*dpy));3839status = efi_bs_call(install_configuration_table,40&primary_display_guid, dpy);41if (status == EFI_SUCCESS)42return dpy;4344efi_bs_call(free_pool, dpy);45return NULL;46}4748void free_primary_display(struct sysfb_display_info *dpy)49{50if (!dpy)51return;5253efi_bs_call(install_configuration_table, &primary_display_guid, NULL);54efi_bs_call(free_pool, dpy);55}565758