drivers/xen/efi.c
Source file repositories/reference/linux-study-clean/drivers/xen/efi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/xen/efi.c- Extension
.c- Size
- 10236 bytes
- Lines
- 356
- Domain
- Driver Families
- Bucket
- drivers/xen
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bug.hlinux/efi.hlinux/init.hlinux/string.hxen/interface/xen.hxen/interface/platform.hxen/page.hxen/xen.hxen/xen-ops.hasm/page.hasm/xen/hypercall.h
Detected Declarations
function Copyrightfunction xen_efi_set_timefunction xen_efi_get_wakeup_timefunction xen_efi_set_wakeup_timefunction xen_efi_get_variablefunction xen_efi_get_next_variablefunction xen_efi_set_variablefunction xen_efi_query_variable_infofunction xen_efi_get_next_high_mono_countfunction xen_efi_update_capsulefunction xen_efi_query_capsule_capsfunction xen_efi_reset_systemfunction xen_efi_runtime_setupfunction efi_mem_desc_lookupfunction xen_efi_config_table_is_usable
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* EFI support for Xen.
*
* Copyright (C) 1999 VA Linux Systems
* Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
* Copyright (C) 1999-2002 Hewlett-Packard Co.
* David Mosberger-Tang <davidm@hpl.hp.com>
* Stephane Eranian <eranian@hpl.hp.com>
* Copyright (C) 2005-2008 Intel Co.
* Fenghua Yu <fenghua.yu@intel.com>
* Bibo Mao <bibo.mao@intel.com>
* Chandramouli Narayanan <mouli@linux.intel.com>
* Huang Ying <ying.huang@intel.com>
* Copyright (C) 2011 Novell Co.
* Jan Beulich <JBeulich@suse.com>
* Copyright (C) 2011-2012 Oracle Co.
* Liang Tang <liang.tang@oracle.com>
* Copyright (c) 2014 Oracle Co., Daniel Kiper
*/
#include <linux/bug.h>
#include <linux/efi.h>
#include <linux/init.h>
#include <linux/string.h>
#include <xen/interface/xen.h>
#include <xen/interface/platform.h>
#include <xen/page.h>
#include <xen/xen.h>
#include <xen/xen-ops.h>
#include <asm/page.h>
#include <asm/xen/hypercall.h>
#define INIT_EFI_OP(name) \
{.cmd = XENPF_efi_runtime_call, \
.u.efi_runtime_call.function = XEN_EFI_##name, \
.u.efi_runtime_call.misc = 0}
#define efi_data(op) (op.u.efi_runtime_call)
static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
{
struct xen_platform_op op = INIT_EFI_OP(get_time);
if (HYPERVISOR_platform_op(&op) < 0)
return EFI_UNSUPPORTED;
if (tm) {
BUILD_BUG_ON(sizeof(*tm) != sizeof(efi_data(op).u.get_time.time));
memcpy(tm, &efi_data(op).u.get_time.time, sizeof(*tm));
}
if (tc) {
tc->resolution = efi_data(op).u.get_time.resolution;
tc->accuracy = efi_data(op).u.get_time.accuracy;
tc->sets_to_zero = !!(efi_data(op).misc &
XEN_EFI_GET_TIME_SET_CLEARS_NS);
}
return efi_data(op).status;
}
static efi_status_t xen_efi_set_time(efi_time_t *tm)
{
struct xen_platform_op op = INIT_EFI_OP(set_time);
BUILD_BUG_ON(sizeof(*tm) != sizeof(efi_data(op).u.set_time));
memcpy(&efi_data(op).u.set_time, tm, sizeof(*tm));
if (HYPERVISOR_platform_op(&op) < 0)
return EFI_UNSUPPORTED;
return efi_data(op).status;
}
static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
efi_bool_t *pending,
efi_time_t *tm)
{
struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
if (HYPERVISOR_platform_op(&op) < 0)
return EFI_UNSUPPORTED;
if (tm) {
BUILD_BUG_ON(sizeof(*tm) != sizeof(efi_data(op).u.get_wakeup_time));
memcpy(tm, &efi_data(op).u.get_wakeup_time, sizeof(*tm));
Annotation
- Immediate include surface: `linux/bug.h`, `linux/efi.h`, `linux/init.h`, `linux/string.h`, `xen/interface/xen.h`, `xen/interface/platform.h`, `xen/page.h`, `xen/xen.h`.
- Detected declarations: `function Copyright`, `function xen_efi_set_time`, `function xen_efi_get_wakeup_time`, `function xen_efi_set_wakeup_time`, `function xen_efi_get_variable`, `function xen_efi_get_next_variable`, `function xen_efi_set_variable`, `function xen_efi_query_variable_info`, `function xen_efi_get_next_high_mono_count`, `function xen_efi_update_capsule`.
- Atlas domain: Driver Families / drivers/xen.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.