linux/drivers/firmware/efi/esrt.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * esrt.c
 *
 * This module exports EFI System Resource Table (ESRT) entries into userspace
 * through the sysfs file system. The ESRT provides a read-only catalog of
 * system components for which the system accepts firmware upgrades via UEFI's
 * "Capsule Update" feature. This module allows userland utilities to evaluate
 * what firmware updates can be applied to this system, and potentially arrange
 * for those updates to occur.
 *
 * Data is currently found below /sys/firmware/efi/esrt/...
 */
#define pr_fmt(fmt)

#include <linux/capability.h>
#include <linux/device.h>
#include <linux/efi.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/memblock.h>
#include <linux/slab.h>
#include <linux/types.h>

#include <asm/io.h>
#include <asm/early_ioremap.h>

struct efi_system_resource_entry_v1 {};

/*
 * _count and _version are what they seem like.  _max is actually just
 * accounting info for the firmware when creating the table; it should never
 * have been exposed to us.  To wit, the spec says:
 * The maximum number of resource array entries that can be within the
 * table without reallocating the table, must not be zero.
 * Since there's no guidance about what that means in terms of memory layout,
 * it means nothing to us.
 */
struct efi_system_resource_table {};

static phys_addr_t esrt_data;
static size_t esrt_data_size;

static struct efi_system_resource_table *esrt;

struct esre_entry {};

/* global list of esre_entry. */
static LIST_HEAD(entry_list);

/* entry attribute */
struct esre_attribute {};

static struct esre_entry *to_entry(struct kobject *kobj)
{}

static struct esre_attribute *to_attr(struct attribute *attr)
{}

static ssize_t esre_attr_show(struct kobject *kobj,
			      struct attribute *_attr, char *buf)
{}

static const struct sysfs_ops esre_attr_ops =;

/* Generic ESRT Entry ("ESRE") support. */
static ssize_t fw_class_show(struct esre_entry *entry, char *buf)
{}

static struct esre_attribute esre_fw_class =;

#define esre_attr_decl(name, size, fmt)

esre_attr_decl();
esre_attr_decl();
esre_attr_decl();
esre_attr_decl();
esre_attr_decl();
esre_attr_decl();

static struct attribute *esre1_attrs[] =;
ATTRIBUTE_GROUPS();

static void esre_release(struct kobject *kobj)
{}

static const struct kobj_type esre1_ktype =;


static struct kobject *esrt_kobj;
static struct kset *esrt_kset;

static int esre_create_sysfs_entry(void *esre, int entry_num)
{}

/* support for displaying ESRT fields at the top level */
#define esrt_attr_decl(name, size, fmt)

esrt_attr_decl();
esrt_attr_decl();
esrt_attr_decl();

static struct attribute *esrt_attrs[] =;

static inline int esrt_table_exists(void)
{}

static umode_t esrt_attr_is_visible(struct kobject *kobj,
				    struct attribute *attr, int n)
{}

static const struct attribute_group esrt_attr_group =;

/*
 * remap the table, validate it, mark it reserved and unmap it.
 */
void __init efi_esrt_init(void)
{}

static int __init register_entries(void)
{}

static void cleanup_entry_list(void)
{}

static int __init esrt_sysfs_init(void)
{}
device_initcall(esrt_sysfs_init);

/*
MODULE_AUTHOR("Peter Jones <[email protected]>");
MODULE_DESCRIPTION("EFI System Resource Table support");
MODULE_LICENSE("GPL");
*/