drivers/net/ethernet/freescale/enetc/enetc_hw.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc_hw.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc_hw.h- Extension
.h- Size
- 31077 bytes
- Lines
- 1061
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.h
Detected Declarations
struct enetc_hwstruct enetc_cmd_rfsestruct enetc_msg_cmd_headerstruct tgs_gcl_confstruct gcestruct tgs_gcl_datastruct streamid_confstruct streamid_datastruct sfi_confstruct sfi_counter_datastruct sgi_tablestruct sgcl_confstruct sgcestruct sgcl_datastruct fmi_confstruct enetc_cbdenum enetc_bdr_typeenum enetc_txbd_flagsenum enetc_msg_cmd_statusenum enetc_msg_cmd_typeenum enetc_msg_cmd_action_typeenum bdcr_cmd_classfunction enetc_vsi_set_msizefunction enetc_lock_mdiofunction enetc_unlock_mdiofunction enetc_lock_mdiofunction enetc_wr_reg_hotfunction _enetc_rd_reg_wafunction _enetc_wr_reg_wafunction _enetc_rd_mdio_reg_wafunction _enetc_wr_mdio_reg_wafunction _enetc_rd_reg64function _enetc_rd_reg64function _enetc_rd_reg64_wafunction enetc_txbd_set_tx_startfunction enetc_clear_tx_bdfunction enetc_get_primary_mac_addrfunction enetc_load_primary_mac_addrfunction enetc_bdr_enable_rxvlanfunction enetc_bdr_enable_txvlanfunction enetc_set_bdr_priofunction enetc_cycles_to_usecsfunction enetc_usecs_to_cycles
Annotated Snippet
struct enetc_hw {
/* SI registers, used by all PCI functions */
void __iomem *reg;
/* Port registers, PF only */
void __iomem *port;
/* IP global registers, PF only */
void __iomem *global;
};
/* ENETC register accessors */
/* MDIO issue workaround (on LS1028A) -
* Due to a hardware issue, an access to MDIO registers
* that is concurrent with other ENETC register accesses
* may lead to the MDIO access being dropped or corrupted.
* To protect the MDIO accesses a readers-writers locking
* scheme is used, where the MDIO register accesses are
* protected by write locks to insure exclusivity, while
* the remaining ENETC registers are accessed under read
* locks since they only compete with MDIO accesses.
*/
extern rwlock_t enetc_mdio_lock;
DECLARE_STATIC_KEY_FALSE(enetc_has_err050089);
/* use this locking primitive only on the fast datapath to
* group together multiple non-MDIO register accesses to
* minimize the overhead of the lock
*/
static inline void enetc_lock_mdio(void)
{
if (static_branch_unlikely(&enetc_has_err050089))
read_lock(&enetc_mdio_lock);
}
static inline void enetc_unlock_mdio(void)
{
if (static_branch_unlikely(&enetc_has_err050089))
read_unlock(&enetc_mdio_lock);
}
/* use these accessors only on the fast datapath under
* the enetc_lock_mdio() locking primitive to minimize
* the overhead of the lock
*/
static inline u32 enetc_rd_reg_hot(void __iomem *reg)
{
if (static_branch_unlikely(&enetc_has_err050089))
lockdep_assert_held(&enetc_mdio_lock);
return ioread32(reg);
}
static inline void enetc_wr_reg_hot(void __iomem *reg, u32 val)
{
if (static_branch_unlikely(&enetc_has_err050089))
lockdep_assert_held(&enetc_mdio_lock);
iowrite32(val, reg);
}
/* internal helpers for the MDIO w/a */
static inline u32 _enetc_rd_reg_wa(void __iomem *reg)
{
u32 val;
enetc_lock_mdio();
val = ioread32(reg);
enetc_unlock_mdio();
return val;
}
static inline void _enetc_wr_reg_wa(void __iomem *reg, u32 val)
{
enetc_lock_mdio();
iowrite32(val, reg);
enetc_unlock_mdio();
}
static inline u32 _enetc_rd_mdio_reg_wa(void __iomem *reg)
{
unsigned long flags;
u32 val;
if (static_branch_unlikely(&enetc_has_err050089)) {
write_lock_irqsave(&enetc_mdio_lock, flags);
val = ioread32(reg);
write_unlock_irqrestore(&enetc_mdio_lock, flags);
} else {
Annotation
- Immediate include surface: `linux/bitops.h`.
- Detected declarations: `struct enetc_hw`, `struct enetc_cmd_rfse`, `struct enetc_msg_cmd_header`, `struct tgs_gcl_conf`, `struct gce`, `struct tgs_gcl_data`, `struct streamid_conf`, `struct streamid_data`, `struct sfi_conf`, `struct sfi_counter_data`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.