drivers/firmware/google/coreboot_table.c
Source file repositories/reference/linux-study-clean/drivers/firmware/google/coreboot_table.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/google/coreboot_table.c- Extension
.c- Size
- 6352 bytes
- Lines
- 278
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/acpi.hlinux/device.hlinux/err.hlinux/init.hlinux/io.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hcoreboot_table.h
Detected Declarations
struct coreboot_table_headerfunction coreboot_bus_matchfunction coreboot_bus_probefunction coreboot_bus_removefunction coreboot_bus_ueventfunction coreboot_device_releasefunction __coreboot_driver_registerfunction coreboot_driver_unregisterfunction coreboot_table_populatefunction coreboot_table_probefunction __cb_dev_unregisterfunction coreboot_table_removefunction coreboot_table_driver_initfunction coreboot_table_driver_exitmodule init coreboot_table_driver_initexport __coreboot_driver_registerexport coreboot_driver_unregister
Annotated Snippet
static int coreboot_bus_match(struct device *dev, const struct device_driver *drv)
{
struct coreboot_device *device = CB_DEV(dev);
const struct coreboot_driver *driver = CB_DRV(drv);
const struct coreboot_device_id *id;
if (!driver->id_table)
return 0;
for (id = driver->id_table; id->tag; id++) {
if (device->entry.tag == id->tag)
return 1;
}
return 0;
}
static int coreboot_bus_probe(struct device *dev)
{
int ret = -ENODEV;
struct coreboot_device *device = CB_DEV(dev);
struct coreboot_driver *driver = CB_DRV(dev->driver);
if (driver->probe)
ret = driver->probe(device);
return ret;
}
static void coreboot_bus_remove(struct device *dev)
{
struct coreboot_device *device = CB_DEV(dev);
struct coreboot_driver *driver = CB_DRV(dev->driver);
if (driver->remove)
driver->remove(device);
}
static int coreboot_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct coreboot_device *device = CB_DEV(dev);
u32 tag = device->entry.tag;
return add_uevent_var(env, "MODALIAS=coreboot:t%08X", tag);
}
static const struct bus_type coreboot_bus_type = {
.name = "coreboot",
.match = coreboot_bus_match,
.probe = coreboot_bus_probe,
.remove = coreboot_bus_remove,
.uevent = coreboot_bus_uevent,
};
static void coreboot_device_release(struct device *dev)
{
struct coreboot_device *device = CB_DEV(dev);
kfree(device);
}
int __coreboot_driver_register(struct coreboot_driver *driver,
struct module *owner)
{
driver->drv.bus = &coreboot_bus_type;
driver->drv.owner = owner;
return driver_register(&driver->drv);
}
EXPORT_SYMBOL(__coreboot_driver_register);
void coreboot_driver_unregister(struct coreboot_driver *driver)
{
driver_unregister(&driver->drv);
}
EXPORT_SYMBOL(coreboot_driver_unregister);
static int coreboot_table_populate(struct device *dev, void *ptr, resource_size_t len)
{
int i, ret;
void *ptr_entry;
struct coreboot_device *device;
struct coreboot_table_entry *entry;
struct coreboot_table_header *header = ptr;
void *ptr_end;
ptr_end = ptr + len;
ptr_entry = ptr + header->header_bytes;
for (i = 0; i < header->table_entries; i++) {
if (ptr_entry + sizeof(*entry) > ptr_end)
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/device.h`, `linux/err.h`, `linux/init.h`, `linux/io.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`.
- Detected declarations: `struct coreboot_table_header`, `function coreboot_bus_match`, `function coreboot_bus_probe`, `function coreboot_bus_remove`, `function coreboot_bus_uevent`, `function coreboot_device_release`, `function __coreboot_driver_register`, `function coreboot_driver_unregister`, `function coreboot_table_populate`, `function coreboot_table_probe`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: pattern 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.