Path: blob/master/drivers/firmware/efi/libstub/screen_info.c
26483 views
// SPDX-License-Identifier: GPL-2.012#include <linux/efi.h>3#include <linux/screen_info.h>45#include <asm/efi.h>67#include "efistub.h"89/*10* There are two ways of populating the core kernel's struct screen_info via the stub:11* - using a configuration table, like below, which relies on the EFI init code12* to locate the table and copy the contents;13* - by linking directly to the core kernel's copy of the global symbol.14*15* The latter is preferred because it makes the EFIFB earlycon available very16* early, but it only works if the EFI stub is part of the core kernel image17* itself. The zboot decompressor can only use the configuration table18* approach.19*/2021static efi_guid_t screen_info_guid = LINUX_EFI_SCREEN_INFO_TABLE_GUID;2223struct screen_info *__alloc_screen_info(void)24{25struct screen_info *si;26efi_status_t status;2728status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,29sizeof(*si), (void **)&si);3031if (status != EFI_SUCCESS)32return NULL;3334memset(si, 0, sizeof(*si));3536status = efi_bs_call(install_configuration_table,37&screen_info_guid, si);38if (status == EFI_SUCCESS)39return si;4041efi_bs_call(free_pool, si);42return NULL;43}4445void free_screen_info(struct screen_info *si)46{47if (!si)48return;4950efi_bs_call(install_configuration_table, &screen_info_guid, NULL);51efi_bs_call(free_pool, si);52}535455