arch/parisc/kernel/drivers.c
Source file repositories/reference/linux-study-clean/arch/parisc/kernel/drivers.c
File Facts
- System
- Linux kernel
- Corpus path
arch/parisc/kernel/drivers.c- Extension
.c- Size
- 29636 bytes
- Lines
- 1109
- Domain
- Architecture Layer
- Bucket
- arch/parisc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/slab.hlinux/types.hlinux/kernel.hlinux/pci.hlinux/spinlock.hlinux/string.hlinux/export.hlinux/dma-map-ops.hasm/hardware.hasm/io.hasm/pdc.hasm/parisc-device.hasm/ropes.h
Detected Declarations
struct recurse_structstruct match_countstruct find_datastruct match_id_datastruct parse_tree_datafunction check_devfunction descend_childrenfunction for_each_padevfunction match_devicefunction parisc_driver_probefunction parisc_driver_removefunction register_parisc_driverfunction match_and_countfunction count_parisc_driverfunction unregister_parisc_driverfunction find_devicefunction is_IKE_devicefunction machine_has_merced_busfunction find_pa_parent_typefunction get_node_pathfunction get_pci_node_pathfunction setup_bus_idfunction create_tree_nodefunction match_by_idfunction alloc_tree_nodefunction alloc_pa_devfunction parisc_generic_matchfunction make_modaliasfunction parisc_ueventfunction modalias_showfunction register_parisc_devicefunction match_pci_devicefunction match_parisc_devicefunction check_parentfunction parse_tree_nodefunction device_to_hwpathfunction walk_lower_busfunction busfunction walk_central_busfunction print_parisc_devicefunction init_parisc_busfunction qemu_headerfunction qemu_print_hpafunction qemu_footerfunction qemu_print_iodc_datafunction print_one_devicefunction print_parisc_devicesexport hppa_dma_ops
Annotated Snippet
static int parisc_generic_match(struct device *dev, const struct device_driver *drv)
{
return match_device(to_parisc_driver(drv), to_parisc_device(dev));
}
static ssize_t make_modalias(const struct device *dev, char *buf)
{
const struct parisc_device *padev = to_parisc_device(dev);
const struct parisc_device_id *id = &padev->id;
return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n",
(u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev,
(u32)id->sversion);
}
static int parisc_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct parisc_device *padev;
char modalias[40];
if (!dev)
return -ENODEV;
padev = to_parisc_device(dev);
if (!padev)
return -ENODEV;
if (add_uevent_var(env, "PARISC_NAME=%s", padev->name))
return -ENOMEM;
make_modalias(dev, modalias);
if (add_uevent_var(env, "MODALIAS=%s", modalias))
return -ENOMEM;
return 0;
}
#define pa_dev_attr(name, field, format_string) \
static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
struct parisc_device *padev = to_parisc_device(dev); \
return sprintf(buf, format_string, padev->field); \
} \
static DEVICE_ATTR_RO(name);
#define pa_dev_attr_id(field, format) pa_dev_attr(field, id.field, format)
pa_dev_attr(irq, irq, "%u\n");
pa_dev_attr_id(hw_type, "0x%02x\n");
pa_dev_attr(rev, id.hversion_rev, "0x%x\n");
pa_dev_attr_id(hversion, "0x%03x\n");
pa_dev_attr_id(sversion, "0x%05x\n");
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return make_modalias(dev, buf);
}
static DEVICE_ATTR_RO(modalias);
static struct attribute *parisc_device_attrs[] = {
&dev_attr_irq.attr,
&dev_attr_hw_type.attr,
&dev_attr_rev.attr,
&dev_attr_hversion.attr,
&dev_attr_sversion.attr,
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(parisc_device);
const struct bus_type parisc_bus_type = {
.name = "parisc",
.match = parisc_generic_match,
.uevent = parisc_uevent,
.dev_groups = parisc_device_groups,
.probe = parisc_driver_probe,
.remove = __exit_p(parisc_driver_remove),
};
/**
* register_parisc_device - Locate a driver to manage this device.
* @dev: The parisc device.
*
* Search the driver list for a driver that is willing to manage
* this device.
*/
int __init register_parisc_device(struct parisc_device *dev)
{
if (!dev)
return 0;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/types.h`, `linux/kernel.h`, `linux/pci.h`, `linux/spinlock.h`, `linux/string.h`, `linux/export.h`, `linux/dma-map-ops.h`.
- Detected declarations: `struct recurse_struct`, `struct match_count`, `struct find_data`, `struct match_id_data`, `struct parse_tree_data`, `function check_dev`, `function descend_children`, `function for_each_padev`, `function match_device`, `function parisc_driver_probe`.
- Atlas domain: Architecture Layer / arch/parisc.
- Implementation status: pattern implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.