drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c- Extension
.c- Size
- 5207 bytes
- Lines
- 207
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hliquidio_common.hocteon_droq.hocteon_iq.hresponse_manager.hocteon_device.hocteon_mem_ops.h
Detected Declarations
function octeon_toggle_bar1_swapmodefunction octeon_pci_fastwritefunction octeon_pci_fastreadfunction __octeon_pci_rw_core_memfunction octeon_pci_read_core_memfunction octeon_pci_write_core_memfunction octeon_read_device_mem64function octeon_read_device_mem32function octeon_write_device_mem32export octeon_pci_read_core_memexport octeon_pci_write_core_memexport octeon_read_device_mem64export octeon_read_device_mem32export octeon_write_device_mem32
Annotated Snippet
if (((addr + len - 1) & ~(0x3fffff)) != (addr & ~(0x3fffff))) {
copy_len = (u32)(((addr & ~(0x3fffff)) +
(MEMOPS_IDX << 22)) - addr);
} else {
copy_len = len;
}
if (op) { /* read from core */
octeon_pci_fastread(oct, mapped_addr, hostbuf,
copy_len);
} else {
octeon_pci_fastwrite(oct, mapped_addr, hostbuf,
copy_len);
}
len -= copy_len;
addr += copy_len;
hostbuf += copy_len;
} while (len);
oct->fn_list.bar1_idx_write(oct, MEMOPS_IDX, index_reg_val);
spin_unlock_irqrestore(&oct->mem_access_lock, flags);
}
void
octeon_pci_read_core_mem(struct octeon_device *oct,
u64 coreaddr,
u8 *buf,
u32 len)
{
__octeon_pci_rw_core_mem(oct, coreaddr, buf, len, 1);
}
EXPORT_SYMBOL_GPL(octeon_pci_read_core_mem);
void
octeon_pci_write_core_mem(struct octeon_device *oct,
u64 coreaddr,
const u8 *buf,
u32 len)
{
__octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)buf, len, 0);
}
EXPORT_SYMBOL_GPL(octeon_pci_write_core_mem);
u64 octeon_read_device_mem64(struct octeon_device *oct, u64 coreaddr)
{
__be64 ret;
__octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)&ret, 8, 1);
return be64_to_cpu(ret);
}
EXPORT_SYMBOL_GPL(octeon_read_device_mem64);
u32 octeon_read_device_mem32(struct octeon_device *oct, u64 coreaddr)
{
__be32 ret;
__octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)&ret, 4, 1);
return be32_to_cpu(ret);
}
EXPORT_SYMBOL_GPL(octeon_read_device_mem32);
void octeon_write_device_mem32(struct octeon_device *oct, u64 coreaddr,
u32 val)
{
__be32 t = cpu_to_be32(val);
__octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)&t, 4, 0);
}
EXPORT_SYMBOL_GPL(octeon_write_device_mem32);
Annotation
- Immediate include surface: `linux/netdevice.h`, `liquidio_common.h`, `octeon_droq.h`, `octeon_iq.h`, `response_manager.h`, `octeon_device.h`, `octeon_mem_ops.h`.
- Detected declarations: `function octeon_toggle_bar1_swapmode`, `function octeon_pci_fastwrite`, `function octeon_pci_fastread`, `function __octeon_pci_rw_core_mem`, `function octeon_pci_read_core_mem`, `function octeon_pci_write_core_mem`, `function octeon_read_device_mem64`, `function octeon_read_device_mem32`, `function octeon_write_device_mem32`, `export octeon_pci_read_core_mem`.
- Atlas domain: Driver Families / drivers/net.
- 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.