sound/soc/sof/iomem-utils.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/iomem-utils.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/iomem-utils.c- Extension
.c- Size
- 2810 bytes
- Lines
- 128
- Domain
- Driver Families
- Bucket
- sound/soc
- 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/io-64-nonatomic-lo-hi.hlinux/platform_device.hlinux/unaligned.hsound/soc.hsound/sof.hsof-priv.hops.h
Detected Declarations
function sof_io_xyzfunction sof_io_readfunction sof_io_write64function sof_io_read64function sof_mailbox_writefunction sof_mailbox_readfunction sof_block_writefunction sof_block_readexport sof_io_writeexport sof_io_readexport sof_io_write64export sof_io_read64export sof_mailbox_writeexport sof_mailbox_readexport sof_block_writeexport sof_block_read
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
//
// This file is provided under a dual BSD/GPLv2 license. When using or
// redistributing this file, you may do so under either license.
//
// Copyright(c) 2018-2022 Intel Corporation
//
// Author: Keyon Jie <yang.jie@linux.intel.com>
//
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/platform_device.h>
#include <linux/unaligned.h>
#include <sound/soc.h>
#include <sound/sof.h>
#include "sof-priv.h"
#include "ops.h"
/*
* Register IO
*
* The sof_io_xyz() wrappers are typically referenced in snd_sof_dsp_ops
* structures and cannot be inlined.
*/
void sof_io_write(struct snd_sof_dev *sdev, void __iomem *addr, u32 value)
{
writel(value, addr);
}
EXPORT_SYMBOL(sof_io_write);
u32 sof_io_read(struct snd_sof_dev *sdev, void __iomem *addr)
{
return readl(addr);
}
EXPORT_SYMBOL(sof_io_read);
void sof_io_write64(struct snd_sof_dev *sdev, void __iomem *addr, u64 value)
{
writeq(value, addr);
}
EXPORT_SYMBOL(sof_io_write64);
u64 sof_io_read64(struct snd_sof_dev *sdev, void __iomem *addr)
{
return readq(addr);
}
EXPORT_SYMBOL(sof_io_read64);
/*
* IPC Mailbox IO
*/
void sof_mailbox_write(struct snd_sof_dev *sdev, u32 offset,
void *message, size_t bytes)
{
void __iomem *dest = sdev->bar[sdev->mailbox_bar] + offset;
memcpy_toio(dest, message, bytes);
}
EXPORT_SYMBOL(sof_mailbox_write);
void sof_mailbox_read(struct snd_sof_dev *sdev, u32 offset,
void *message, size_t bytes)
{
void __iomem *src = sdev->bar[sdev->mailbox_bar] + offset;
memcpy_fromio(message, src, bytes);
}
EXPORT_SYMBOL(sof_mailbox_read);
/*
* Memory copy.
*/
int sof_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
u32 offset, void *src, size_t size)
{
int bar = snd_sof_dsp_get_bar_index(sdev, blk_type);
const u8 *src_byte = src;
void __iomem *dest;
u32 affected_mask;
u32 tmp;
int m, n;
if (bar < 0)
return bar;
dest = sdev->bar[bar] + offset;
Annotation
- Immediate include surface: `linux/io-64-nonatomic-lo-hi.h`, `linux/platform_device.h`, `linux/unaligned.h`, `sound/soc.h`, `sound/sof.h`, `sof-priv.h`, `ops.h`.
- Detected declarations: `function sof_io_xyz`, `function sof_io_read`, `function sof_io_write64`, `function sof_io_read64`, `function sof_mailbox_write`, `function sof_mailbox_read`, `function sof_block_write`, `function sof_block_read`, `export sof_io_write`, `export sof_io_read`.
- Atlas domain: Driver Families / sound/soc.
- 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.