drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c- Extension
.c- Size
- 10335 bytes
- Lines
- 407
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/bitfield.hlinux/iopoll.hrnpgbe_mbx.h
Detected Declarations
function mbx_data_rd32function mbx_data_wr32function mbx_ctrl_rd32function mbx_ctrl_wr32function mucse_mbx_get_lock_pffunction mucse_release_mbx_lock_pffunction mucse_obtain_mbx_lock_pffunction mucse_mbx_get_fwreqfunction mucse_mbx_inc_pf_ackfunction mucse_read_mbx_pffunction mucse_check_for_msg_pffunction mucse_poll_for_msgfunction mucse_poll_and_read_mbxfunction mucse_mbx_get_fwackfunction mucse_mbx_inc_pf_reqfunction mucse_write_mbx_pffunction mucse_check_for_ack_pffunction mucse_poll_for_ackfunction mucse_write_and_wait_ack_mbxfunction mucse_mbx_resetfunction mucse_init_mbx_params_pf
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2022 - 2025 Mucse Corporation. */
#include <linux/errno.h>
#include <linux/bitfield.h>
#include <linux/iopoll.h>
#include "rnpgbe_mbx.h"
/**
* mbx_data_rd32 - Reads reg with base mbx->fwpf_shm_base
* @mbx: pointer to the MBX structure
* @reg: register offset
*
* Return: register value
**/
static u32 mbx_data_rd32(struct mucse_mbx_info *mbx, u32 reg)
{
struct mucse_hw *hw = container_of(mbx, struct mucse_hw, mbx);
return readl(hw->hw_addr + mbx->fwpf_shm_base + reg);
}
/**
* mbx_data_wr32 - Writes value to reg with base mbx->fwpf_shm_base
* @mbx: pointer to the MBX structure
* @reg: register offset
* @value: value to be written
*
**/
static void mbx_data_wr32(struct mucse_mbx_info *mbx, u32 reg, u32 value)
{
struct mucse_hw *hw = container_of(mbx, struct mucse_hw, mbx);
writel(value, hw->hw_addr + mbx->fwpf_shm_base + reg);
}
/**
* mbx_ctrl_rd32 - Reads reg with base mbx->fwpf_ctrl_base
* @mbx: pointer to the MBX structure
* @reg: register offset
*
* Return: register value
**/
static u32 mbx_ctrl_rd32(struct mucse_mbx_info *mbx, u32 reg)
{
struct mucse_hw *hw = container_of(mbx, struct mucse_hw, mbx);
return readl(hw->hw_addr + mbx->fwpf_ctrl_base + reg);
}
/**
* mbx_ctrl_wr32 - Writes value to reg with base mbx->fwpf_ctrl_base
* @mbx: pointer to the MBX structure
* @reg: register offset
* @value: value to be written
*
**/
static void mbx_ctrl_wr32(struct mucse_mbx_info *mbx, u32 reg, u32 value)
{
struct mucse_hw *hw = container_of(mbx, struct mucse_hw, mbx);
writel(value, hw->hw_addr + mbx->fwpf_ctrl_base + reg);
}
/**
* mucse_mbx_get_lock_pf - Write ctrl and read back lock status
* @hw: pointer to the HW structure
*
* Return: register value after write
**/
static u32 mucse_mbx_get_lock_pf(struct mucse_hw *hw)
{
struct mucse_mbx_info *mbx = &hw->mbx;
u32 reg = MUCSE_MBX_PF2FW_CTRL(mbx);
mbx_ctrl_wr32(mbx, reg, MUCSE_MBX_PFU);
return mbx_ctrl_rd32(mbx, reg);
}
/**
* mucse_obtain_mbx_lock_pf - Obtain mailbox lock
* @hw: pointer to the HW structure
*
* Pair with mucse_release_mbx_lock_pf()
* This function maybe used in an irq handler.
*
* Return: 0 on success, negative errno on failure
**/
Annotation
- Immediate include surface: `linux/errno.h`, `linux/bitfield.h`, `linux/iopoll.h`, `rnpgbe_mbx.h`.
- Detected declarations: `function mbx_data_rd32`, `function mbx_data_wr32`, `function mbx_ctrl_rd32`, `function mbx_ctrl_wr32`, `function mucse_mbx_get_lock_pf`, `function mucse_release_mbx_lock_pf`, `function mucse_obtain_mbx_lock_pf`, `function mucse_mbx_get_fwreq`, `function mucse_mbx_inc_pf_ack`, `function mucse_read_mbx_pf`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.