drivers/misc/ocxl/mmio.c
Source file repositories/reference/linux-study-clean/drivers/misc/ocxl/mmio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/ocxl/mmio.c- Extension
.c- Size
- 4878 bytes
- Lines
- 235
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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/sched/mm.htrace.hocxl_internal.h
Detected Declarations
function ocxl_global_mmio_read32function ocxl_global_mmio_read64function ocxl_global_mmio_write32function ocxl_global_mmio_write64function ocxl_global_mmio_set32function ocxl_global_mmio_set64function ocxl_global_mmio_clear32function ocxl_global_mmio_clear64export ocxl_global_mmio_read32export ocxl_global_mmio_read64export ocxl_global_mmio_write32export ocxl_global_mmio_write64export ocxl_global_mmio_set32export ocxl_global_mmio_set64export ocxl_global_mmio_clear32export ocxl_global_mmio_clear64
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
// Copyright 2019 IBM Corp.
#include <linux/sched/mm.h>
#include "trace.h"
#include "ocxl_internal.h"
int ocxl_global_mmio_read32(struct ocxl_afu *afu, size_t offset,
enum ocxl_endian endian, u32 *val)
{
if (offset > afu->config.global_mmio_size - 4)
return -EINVAL;
#ifdef __BIG_ENDIAN__
if (endian == OCXL_HOST_ENDIAN)
endian = OCXL_BIG_ENDIAN;
#endif
switch (endian) {
case OCXL_BIG_ENDIAN:
*val = readl_be((char *)afu->global_mmio_ptr + offset);
break;
default:
*val = readl((char *)afu->global_mmio_ptr + offset);
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(ocxl_global_mmio_read32);
int ocxl_global_mmio_read64(struct ocxl_afu *afu, size_t offset,
enum ocxl_endian endian, u64 *val)
{
if (offset > afu->config.global_mmio_size - 8)
return -EINVAL;
#ifdef __BIG_ENDIAN__
if (endian == OCXL_HOST_ENDIAN)
endian = OCXL_BIG_ENDIAN;
#endif
switch (endian) {
case OCXL_BIG_ENDIAN:
*val = readq_be((char *)afu->global_mmio_ptr + offset);
break;
default:
*val = readq((char *)afu->global_mmio_ptr + offset);
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(ocxl_global_mmio_read64);
int ocxl_global_mmio_write32(struct ocxl_afu *afu, size_t offset,
enum ocxl_endian endian, u32 val)
{
if (offset > afu->config.global_mmio_size - 4)
return -EINVAL;
#ifdef __BIG_ENDIAN__
if (endian == OCXL_HOST_ENDIAN)
endian = OCXL_BIG_ENDIAN;
#endif
switch (endian) {
case OCXL_BIG_ENDIAN:
writel_be(val, (char *)afu->global_mmio_ptr + offset);
break;
default:
writel(val, (char *)afu->global_mmio_ptr + offset);
break;
}
return 0;
}
EXPORT_SYMBOL_GPL(ocxl_global_mmio_write32);
int ocxl_global_mmio_write64(struct ocxl_afu *afu, size_t offset,
enum ocxl_endian endian, u64 val)
{
if (offset > afu->config.global_mmio_size - 8)
return -EINVAL;
#ifdef __BIG_ENDIAN__
if (endian == OCXL_HOST_ENDIAN)
Annotation
- Immediate include surface: `linux/sched/mm.h`, `trace.h`, `ocxl_internal.h`.
- Detected declarations: `function ocxl_global_mmio_read32`, `function ocxl_global_mmio_read64`, `function ocxl_global_mmio_write32`, `function ocxl_global_mmio_write64`, `function ocxl_global_mmio_set32`, `function ocxl_global_mmio_set64`, `function ocxl_global_mmio_clear32`, `function ocxl_global_mmio_clear64`, `export ocxl_global_mmio_read32`, `export ocxl_global_mmio_read64`.
- Atlas domain: Driver Families / drivers/misc.
- 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.