drivers/firmware/efi/libstub/zboot-decompress-zstd.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/libstub/zboot-decompress-zstd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/libstub/zboot-decompress-zstd.c- Extension
.c- Size
- 1119 bytes
- Lines
- 50
- 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.
- 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
linux/efi.hlinux/zstd.hasm/efi.hdecompress_sources.hefistub.h
Detected Declarations
function efi_zboot_decompress_initfunction efi_zboot_decompress
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/efi.h>
#include <linux/zstd.h>
#include <asm/efi.h>
#include "decompress_sources.h"
#include "efistub.h"
extern unsigned char _gzdata_start[], _gzdata_end[];
extern u32 __aligned(1) payload_size;
static size_t wksp_size;
static void *wksp;
efi_status_t efi_zboot_decompress_init(unsigned long *alloc_size)
{
efi_status_t status;
wksp_size = zstd_dctx_workspace_bound();
status = efi_allocate_pages(wksp_size, (unsigned long *)&wksp, ULONG_MAX);
if (status != EFI_SUCCESS)
return status;
*alloc_size = payload_size;
return EFI_SUCCESS;
}
efi_status_t efi_zboot_decompress(u8 *out, unsigned long outlen)
{
zstd_dctx *dctx = zstd_init_dctx(wksp, wksp_size);
size_t ret;
int retval;
ret = zstd_decompress_dctx(dctx, out, outlen, _gzdata_start,
_gzdata_end - _gzdata_start - 4);
efi_free(wksp_size, (unsigned long)wksp);
retval = zstd_get_error_code(ret);
if (retval) {
efi_err("ZSTD-decompression failed with status %d\n", retval);
return EFI_LOAD_ERROR;
}
efi_cache_sync_image((unsigned long)out, outlen);
return EFI_SUCCESS;
}
Annotation
- Immediate include surface: `linux/efi.h`, `linux/zstd.h`, `asm/efi.h`, `decompress_sources.h`, `efistub.h`.
- Detected declarations: `function efi_zboot_decompress_init`, `function efi_zboot_decompress`.
- Atlas domain: Driver Families / drivers/firmware.
- 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.