drivers/rapidio/rio-access.c
Source file repositories/reference/linux-study-clean/drivers/rapidio/rio-access.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rapidio/rio-access.c- Extension
.c- Size
- 4524 bytes
- Lines
- 144
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/rio.hlinux/module.hlinux/rio_drv.h
Detected Declarations
function rio_mport_send_doorbellexport __rio_local_read_config_8export __rio_local_read_config_16export __rio_local_read_config_32export __rio_local_write_config_8export __rio_local_write_config_16export __rio_local_write_config_32export rio_mport_read_config_8export rio_mport_read_config_16export rio_mport_read_config_32export rio_mport_write_config_8export rio_mport_write_config_16export rio_mport_write_config_32export rio_mport_send_doorbell
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* RapidIO configuration space access support
*
* Copyright 2005 MontaVista Software, Inc.
* Matt Porter <mporter@kernel.crashing.org>
*/
#include <linux/rio.h>
#include <linux/module.h>
#include <linux/rio_drv.h>
/*
* Wrappers for all RIO configuration access functions. They just check
* alignment and call the low-level functions pointed to by rio_mport->ops.
*/
#define RIO_8_BAD 0
#define RIO_16_BAD (offset & 1)
#define RIO_32_BAD (offset & 3)
/**
* RIO_LOP_READ - Generate rio_local_read_config_* functions
* @size: Size of configuration space read (8, 16, 32 bits)
* @type: C type of value argument
* @len: Length of configuration space read (1, 2, 4 bytes)
*
* Generates rio_local_read_config_* functions used to access
* configuration space registers on the local device.
*/
#define RIO_LOP_READ(size,type,len) \
int __rio_local_read_config_##size \
(struct rio_mport *mport, u32 offset, type *value) \
{ \
int res; \
u32 data = 0; \
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
res = mport->ops->lcread(mport, mport->id, offset, len, &data); \
*value = (type)data; \
return res; \
}
/**
* RIO_LOP_WRITE - Generate rio_local_write_config_* functions
* @size: Size of configuration space write (8, 16, 32 bits)
* @type: C type of value argument
* @len: Length of configuration space write (1, 2, 4 bytes)
*
* Generates rio_local_write_config_* functions used to access
* configuration space registers on the local device.
*/
#define RIO_LOP_WRITE(size,type,len) \
int __rio_local_write_config_##size \
(struct rio_mport *mport, u32 offset, type value) \
{ \
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
return mport->ops->lcwrite(mport, mport->id, offset, len, value);\
}
RIO_LOP_READ(8, u8, 1)
RIO_LOP_READ(16, u16, 2)
RIO_LOP_READ(32, u32, 4)
RIO_LOP_WRITE(8, u8, 1)
RIO_LOP_WRITE(16, u16, 2)
RIO_LOP_WRITE(32, u32, 4)
EXPORT_SYMBOL_GPL(__rio_local_read_config_8);
EXPORT_SYMBOL_GPL(__rio_local_read_config_16);
EXPORT_SYMBOL_GPL(__rio_local_read_config_32);
EXPORT_SYMBOL_GPL(__rio_local_write_config_8);
EXPORT_SYMBOL_GPL(__rio_local_write_config_16);
EXPORT_SYMBOL_GPL(__rio_local_write_config_32);
/**
* RIO_OP_READ - Generate rio_mport_read_config_* functions
* @size: Size of configuration space read (8, 16, 32 bits)
* @type: C type of value argument
* @len: Length of configuration space read (1, 2, 4 bytes)
*
* Generates rio_mport_read_config_* functions used to access
* configuration space registers on the local device.
*/
#define RIO_OP_READ(size,type,len) \
int rio_mport_read_config_##size \
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type *value) \
{ \
int res; \
u32 data = 0; \
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \
Annotation
- Immediate include surface: `linux/rio.h`, `linux/module.h`, `linux/rio_drv.h`.
- Detected declarations: `function rio_mport_send_doorbell`, `export __rio_local_read_config_8`, `export __rio_local_read_config_16`, `export __rio_local_read_config_32`, `export __rio_local_write_config_8`, `export __rio_local_write_config_16`, `export __rio_local_write_config_32`, `export rio_mport_read_config_8`, `export rio_mport_read_config_16`, `export rio_mport_read_config_32`.
- Atlas domain: Driver Families / drivers/rapidio.
- Implementation status: integration 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.