drivers/rapidio/rio.c
Source file repositories/reference/linux-study-clean/drivers/rapidio/rio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rapidio/rio.c- Extension
.c- Size
- 58609 bytes
- Lines
- 2149
- Domain
- Driver Families
- Bucket
- drivers/rapidio
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/types.hlinux/kernel.hlinux/delay.hlinux/init.hlinux/rio.hlinux/rio_drv.hlinux/rio_ids.hlinux/rio_regs.hlinux/module.hlinux/spinlock.hlinux/slab.hlinux/interrupt.hrio.h
Detected Declarations
struct rio_pwritestruct rio_disc_workfunction rio_local_get_device_idfunction rio_query_mportfunction rio_add_netfunction rio_free_netfunction rio_local_set_device_idfunction rio_add_devicefunction rio_del_devicefunction rio_request_inb_mboxfunction rio_release_inb_mboxfunction rio_request_outb_mboxfunction rio_release_outb_mboxfunction rio_setup_inb_dbellfunction rio_request_inb_dbellfunction rio_release_inb_dbellfunction rio_release_outb_dbellfunction rio_add_mport_pw_handlerfunction rio_del_mport_pw_handlerfunction rio_request_inb_pwritefunction rio_release_inb_pwritefunction rio_pw_enablefunction rio_map_inb_regionfunction rio_unmap_inb_regionfunction rio_map_outb_regionfunction rio_unmap_outb_regionfunction rio_mport_get_physefbfunction rio_set_port_lockoutfunction rio_enable_rx_tx_portfunction devicefunction rio_mport_chk_dev_accessfunction rio_chk_dev_accessfunction rio_get_input_statusfunction rio_clr_err_stoppedfunction rio_inb_pwrite_handlerfunction messagefunction rio_mport_get_efbfunction rio_mport_get_featurefunction rio_std_route_add_entryfunction rio_std_route_get_entryfunction rio_std_route_clr_tablefunction rio_lock_devicefunction rio_unlock_devicefunction add_entryfunction get_entryfunction clr_tablefunction rio_chan_filterfunction rio_release_dma
Annotated Snippet
struct rio_pwrite {
struct list_head node;
int (*pwcback)(struct rio_mport *mport, void *context,
union rio_pw_msg *msg, int step);
void *context;
};
MODULE_DESCRIPTION("RapidIO Subsystem Core");
MODULE_AUTHOR("Matt Porter <mporter@kernel.crashing.org>");
MODULE_AUTHOR("Alexandre Bounine <alexandre.bounine@idt.com>");
MODULE_LICENSE("GPL");
static int hdid[RIO_MAX_MPORTS];
static int ids_num;
module_param_array(hdid, int, &ids_num, 0);
MODULE_PARM_DESC(hdid,
"Destination ID assignment to local RapidIO controllers");
static LIST_HEAD(rio_devices);
static LIST_HEAD(rio_nets);
static DEFINE_SPINLOCK(rio_global_list_lock);
static LIST_HEAD(rio_mports);
static LIST_HEAD(rio_scans);
static DEFINE_MUTEX(rio_mport_list_lock);
static unsigned char next_portid;
static DEFINE_SPINLOCK(rio_mmap_lock);
/**
* rio_local_get_device_id - Get the base/extended device id for a port
* @port: RIO master port from which to get the deviceid
*
* Reads the base/extended device id from the local device
* implementing the master port. Returns the 8/16-bit device
* id.
*/
u16 rio_local_get_device_id(struct rio_mport *port)
{
u32 result;
rio_local_read_config_32(port, RIO_DID_CSR, &result);
return (RIO_GET_DID(port->sys_size, result));
}
EXPORT_SYMBOL_GPL(rio_local_get_device_id);
/**
* rio_query_mport - Query mport device attributes
* @port: mport device to query
* @mport_attr: mport attributes data structure
*
* Returns attributes of specified mport through the
* pointer to attributes data structure.
*/
int rio_query_mport(struct rio_mport *port,
struct rio_mport_attr *mport_attr)
{
if (!port->ops->query_mport)
return -ENODATA;
return port->ops->query_mport(port, mport_attr);
}
EXPORT_SYMBOL(rio_query_mport);
/**
* rio_alloc_net- Allocate and initialize a new RIO network data structure
* @mport: Master port associated with the RIO network
*
* Allocates a RIO network structure, initializes per-network
* list heads, and adds the associated master port to the
* network list of associated master ports. Returns a
* RIO network pointer on success or %NULL on failure.
*/
struct rio_net *rio_alloc_net(struct rio_mport *mport)
{
struct rio_net *net = kzalloc_obj(*net);
if (net) {
INIT_LIST_HEAD(&net->node);
INIT_LIST_HEAD(&net->devices);
INIT_LIST_HEAD(&net->switches);
INIT_LIST_HEAD(&net->mports);
mport->net = net;
}
return net;
}
EXPORT_SYMBOL_GPL(rio_alloc_net);
int rio_add_net(struct rio_net *net)
{
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/delay.h`, `linux/init.h`, `linux/rio.h`, `linux/rio_drv.h`, `linux/rio_ids.h`, `linux/rio_regs.h`.
- Detected declarations: `struct rio_pwrite`, `struct rio_disc_work`, `function rio_local_get_device_id`, `function rio_query_mport`, `function rio_add_net`, `function rio_free_net`, `function rio_local_set_device_id`, `function rio_add_device`, `function rio_del_device`, `function rio_request_inb_mbox`.
- Atlas domain: Driver Families / drivers/rapidio.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.