drivers/firmware/efi/runtime-wrappers.c

Source file repositories/reference/linux-study-clean/drivers/firmware/efi/runtime-wrappers.c

File Facts

System
Linux kernel
Corpus path
drivers/firmware/efi/runtime-wrappers.c
Extension
.c
Size
17086 bytes
Lines
605
Domain
Driver Families
Bucket
drivers/firmware
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * runtime-wrappers.c - Runtime Services function call wrappers
 *
 * Implementation summary:
 * -----------------------
 * 1. When user/kernel thread requests to execute efi_runtime_service(),
 * enqueue work to efi_rts_wq.
 * 2. Caller thread waits for completion until the work is finished
 * because it's dependent on the return status and execution of
 * efi_runtime_service().
 * For instance, get_variable() and get_next_variable().
 *
 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
 *
 * Split off from arch/x86/platform/efi/efi.c
 *
 * Copyright (C) 1999 VA Linux Systems
 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
 * Copyright (C) 1999-2002 Hewlett-Packard Co.
 * Copyright (C) 2005-2008 Intel Co.
 * Copyright (C) 2013 SuSE Labs
 */

#define pr_fmt(fmt)	"efi: " fmt

#include <linux/bug.h>
#include <linux/efi.h>
#include <linux/irqflags.h>
#include <linux/mutex.h>
#include <linux/semaphore.h>
#include <linux/stringify.h>
#include <linux/workqueue.h>
#include <linux/completion.h>

#include <asm/efi.h>

/*
 * Wrap around the new efi_call_virt_generic() macros so that the
 * code doesn't get too cluttered:
 */
#define efi_call_virt(f, args...)   \
	arch_efi_call_virt(efi.runtime, f, args)

union efi_rts_args {
	struct {
		efi_time_t 	*time;
		efi_time_cap_t	*capabilities;
	} GET_TIME;

	struct {
		efi_time_t	*time;
	} SET_TIME;

	struct {
		efi_bool_t	*enabled;
		efi_bool_t	*pending;
		efi_time_t	*time;
	} GET_WAKEUP_TIME;

	struct {
		efi_bool_t	enable;
		efi_time_t	*time;
	} SET_WAKEUP_TIME;

	struct {
		efi_char16_t	*name;
		efi_guid_t	*vendor;
		u32		*attr;
		unsigned long	*data_size;
		void		*data;
	} GET_VARIABLE;

	struct {
		unsigned long	*name_size;
		efi_char16_t	*name;
		efi_guid_t 	*vendor;
	} GET_NEXT_VARIABLE;

	struct {
		efi_char16_t	*name;
		efi_guid_t	*vendor;
		u32		attr;
		unsigned long	data_size;
		void		*data;
	} SET_VARIABLE;

	struct {
		u32		attr;
		u64		*storage_space;

Annotation

Implementation Notes