drivers/firmware/arm_ffa/bus.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_ffa/bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_ffa/bus.c- Extension
.c- Size
- 5957 bytes
- Lines
- 266
- 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/arm_ffa.hlinux/device.hlinux/fs.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/types.hcommon.h
Detected Declarations
function ffa_device_matchfunction ffa_device_probefunction ffa_device_removefunction ffa_device_ueventfunction modalias_showfunction partition_id_showfunction uuid_showfunction ffa_driver_registerfunction ffa_driver_unregisterfunction ffa_release_devicefunction __ffa_devices_unregisterfunction ffa_devices_unregisterfunction ffa_device_is_validfunction ffa_device_registerfunction ffa_device_unregisterfunction arm_ffa_bus_initfunction arm_ffa_bus_exitmodule init arm_ffa_bus_initexport ffa_bus_typeexport ffa_driver_registerexport ffa_driver_unregisterexport ffa_devices_unregisterexport ffa_device_registerexport ffa_device_unregister
Annotated Snippet
static int ffa_device_match(struct device *dev, const struct device_driver *drv)
{
const struct ffa_device_id *id_table;
struct ffa_device *ffa_dev;
id_table = to_ffa_driver(drv)->id_table;
ffa_dev = to_ffa_dev(dev);
if (!id_table)
return 0;
while (!uuid_is_null(&id_table->uuid)) {
/*
* FF-A v1.0 doesn't provide discovery of UUIDs, just the
* partition IDs, so match it unconditionally here and handle
* it via the installed bus notifier during driver binding.
*/
if (uuid_is_null(&ffa_dev->uuid))
return 1;
if (uuid_equal(&ffa_dev->uuid, &id_table->uuid))
return 1;
id_table++;
}
return 0;
}
static int ffa_device_probe(struct device *dev)
{
struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
struct ffa_device *ffa_dev = to_ffa_dev(dev);
/* UUID can be still NULL with FF-A v1.0, so just skip probing them */
if (uuid_is_null(&ffa_dev->uuid))
return -ENODEV;
return ffa_drv->probe(ffa_dev);
}
static void ffa_device_remove(struct device *dev)
{
struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
if (ffa_drv->remove)
ffa_drv->remove(to_ffa_dev(dev));
}
static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct ffa_device *ffa_dev = to_ffa_dev(dev);
return add_uevent_var(env, "MODALIAS=" FFA_UEVENT_MODALIAS_FMT,
ffa_dev->vm_id, &ffa_dev->uuid);
}
static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ffa_device *ffa_dev = to_ffa_dev(dev);
return sysfs_emit(buf, FFA_UEVENT_MODALIAS_FMT, ffa_dev->vm_id,
&ffa_dev->uuid);
}
static DEVICE_ATTR_RO(modalias);
static ssize_t partition_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ffa_device *ffa_dev = to_ffa_dev(dev);
return sprintf(buf, "0x%04x\n", ffa_dev->vm_id);
}
static DEVICE_ATTR_RO(partition_id);
static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct ffa_device *ffa_dev = to_ffa_dev(dev);
return sprintf(buf, "%pUb\n", &ffa_dev->uuid);
}
static DEVICE_ATTR_RO(uuid);
static struct attribute *ffa_device_attributes_attrs[] = {
&dev_attr_partition_id.attr,
&dev_attr_uuid.attr,
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(ffa_device_attributes);
Annotation
- Immediate include surface: `linux/arm_ffa.h`, `linux/device.h`, `linux/fs.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/types.h`, `common.h`.
- Detected declarations: `function ffa_device_match`, `function ffa_device_probe`, `function ffa_device_remove`, `function ffa_device_uevent`, `function modalias_show`, `function partition_id_show`, `function uuid_show`, `function ffa_driver_register`, `function ffa_driver_unregister`, `function ffa_release_device`.
- 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.