arch/x86/platform/efi/quirks.c
Source file repositories/reference/linux-study-clean/arch/x86/platform/efi/quirks.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/platform/efi/quirks.c- Extension
.c- Size
- 23729 bytes
- Lines
- 844
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/string.hlinux/time.hlinux/types.hlinux/efi.hlinux/slab.hlinux/memblock.hlinux/acpi.hlinux/dmi.hasm/e820/api.hasm/efi.hasm/uv/uv.hasm/cpu_device_id.hasm/realmode.hasm/reboot.h
Detected Declarations
struct quark_security_headerstruct efi_freeable_rangefunction stalefunction efi_delete_dummy_variablefunction efivar_reserved_spacefunction query_variable_store_nonblockingfunction efi_query_variable_storefunction ExitBootServicesfunction efi_reserve_boot_servicesfunction efi_reserve_boot_servicesfunction for_each_efi_memory_descfunction memblock_reservefunction efi_unmap_pagesfunction efi_unmap_boot_servicesfunction for_each_efi_memory_descfunction efi_free_boot_servicesfunction efi_reuse_configfunction efi_apply_memmap_quirksfunction efi_reboot_requiredfunction efi_poweroff_requiredfunction qrk_capsule_setup_infofunction efi_capsule_setup_infofunction efi_crash_gracefully_on_page_faultfunction efi_reset_systemexport efivar_reserved_spaceexport efi_query_variable_store
Annotated Snippet
struct quark_security_header {
u32 csh_signature;
u32 version;
u32 modulesize;
u32 security_version_number_index;
u32 security_version_number;
u32 rsvd_module_id;
u32 rsvd_module_vendor;
u32 rsvd_date;
u32 headersize;
u32 hash_algo;
u32 cryp_algo;
u32 keysize;
u32 signaturesize;
u32 rsvd_next_header;
u32 rsvd[2];
};
static const efi_char16_t efi_dummy_name[] = L"DUMMY";
static bool efi_no_storage_paranoia;
/*
* Some firmware implementations refuse to boot if there's insufficient
* space in the variable store. The implementation of garbage collection
* in some FW versions causes stale (deleted) variables to take up space
* longer than intended and space is only freed once the store becomes
* almost completely full.
*
* Enabling this option disables the space checks in
* efi_query_variable_store() and forces garbage collection.
*
* Only enable this option if deleting EFI variables does not free up
* space in your variable store, e.g. if despite deleting variables
* you're unable to create new ones.
*/
static int __init setup_storage_paranoia(char *arg)
{
efi_no_storage_paranoia = true;
return 0;
}
early_param("efi_no_storage_paranoia", setup_storage_paranoia);
/*
* Deleting the dummy variable which kicks off garbage collection
*/
void efi_delete_dummy_variable(void)
{
efi.set_variable_nonblocking((efi_char16_t *)efi_dummy_name,
&EFI_DUMMY_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL);
}
u64 efivar_reserved_space(void)
{
if (efi_no_storage_paranoia)
return 0;
return EFI_MIN_RESERVE;
}
EXPORT_SYMBOL_GPL(efivar_reserved_space);
/*
* In the nonblocking case we do not attempt to perform garbage
* collection if we do not have enough free space. Rather, we do the
* bare minimum check and give up immediately if the available space
* is below EFI_MIN_RESERVE.
*
* This function is intended to be small and simple because it is
* invoked from crash handler paths.
*/
static efi_status_t
query_variable_store_nonblocking(u32 attributes, unsigned long size)
{
efi_status_t status;
u64 storage_size, remaining_size, max_size;
status = efi.query_variable_info_nonblocking(attributes, &storage_size,
&remaining_size,
&max_size);
if (status != EFI_SUCCESS)
return status;
if (remaining_size - size < EFI_MIN_RESERVE)
return EFI_OUT_OF_RESOURCES;
return EFI_SUCCESS;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/string.h`, `linux/time.h`, `linux/types.h`, `linux/efi.h`, `linux/slab.h`, `linux/memblock.h`.
- Detected declarations: `struct quark_security_header`, `struct efi_freeable_range`, `function stale`, `function efi_delete_dummy_variable`, `function efivar_reserved_space`, `function query_variable_store_nonblocking`, `function efi_query_variable_store`, `function ExitBootServices`, `function efi_reserve_boot_services`, `function efi_reserve_boot_services`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration 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.