drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h- Extension
.h- Size
- 2279 bytes
- Lines
- 64
- 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/bitfield.hlinux/io-64-nonatomic-lo-hi.h
Detected Declarations
function hbg_reg_readfunction hbg_reg_writefunction hbg_reg_read64function hbg_reg_write64
Annotated Snippet
#ifndef __HBG_HW_H
#define __HBG_HW_H
#include <linux/bitfield.h>
#include <linux/io-64-nonatomic-lo-hi.h>
static inline u32 hbg_reg_read(struct hbg_priv *priv, u32 addr)
{
return readl(priv->io_base + addr);
}
static inline void hbg_reg_write(struct hbg_priv *priv, u32 addr, u32 value)
{
writel(value, priv->io_base + addr);
}
static inline u64 hbg_reg_read64(struct hbg_priv *priv, u32 addr)
{
return lo_hi_readq(priv->io_base + addr);
}
static inline void hbg_reg_write64(struct hbg_priv *priv, u32 addr, u64 value)
{
lo_hi_writeq(value, priv->io_base + addr);
}
#define hbg_reg_read_field(priv, addr, mask) \
FIELD_GET(mask, hbg_reg_read(priv, addr))
#define hbg_field_modify(reg_value, mask, value) ({ \
(reg_value) &= ~(mask); \
(reg_value) |= FIELD_PREP(mask, value); })
#define hbg_reg_write_field(priv, addr, mask, val) ({ \
typeof(priv) _priv = (priv); \
typeof(addr) _addr = (addr); \
u32 _value = hbg_reg_read(_priv, _addr); \
hbg_field_modify(_value, mask, val); \
hbg_reg_write(_priv, _addr, _value); })
int hbg_hw_event_notify(struct hbg_priv *priv,
enum hbg_hw_event_type event_type);
int hbg_hw_init(struct hbg_priv *priv);
void hbg_hw_adjust_link(struct hbg_priv *priv, u32 speed, u32 duplex);
u32 hbg_hw_get_irq_status(struct hbg_priv *priv);
void hbg_hw_irq_clear(struct hbg_priv *priv, u32 mask);
bool hbg_hw_irq_is_enabled(struct hbg_priv *priv, u32 mask);
void hbg_hw_irq_enable(struct hbg_priv *priv, u32 mask, bool enable);
void hbg_hw_set_mtu(struct hbg_priv *priv, u16 mtu);
void hbg_hw_mac_enable(struct hbg_priv *priv, u32 enable);
void hbg_hw_set_uc_addr(struct hbg_priv *priv, u64 mac_addr, u32 index);
u32 hbg_hw_get_fifo_used_num(struct hbg_priv *priv, enum hbg_dir dir);
void hbg_hw_set_tx_desc(struct hbg_priv *priv, struct hbg_tx_desc *tx_desc);
void hbg_hw_fill_buffer(struct hbg_priv *priv, u32 buffer_dma_addr);
void hbg_hw_set_mac_filter_enable(struct hbg_priv *priv, u32 enable);
void hbg_hw_set_pause_enable(struct hbg_priv *priv, u32 tx_en, u32 rx_en);
void hbg_hw_get_pause_enable(struct hbg_priv *priv, u32 *tx_en, u32 *rx_en);
void hbg_hw_set_rx_pause_mac_addr(struct hbg_priv *priv, u64 mac_addr);
#endif
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/io-64-nonatomic-lo-hi.h`.
- Detected declarations: `function hbg_reg_read`, `function hbg_reg_write`, `function hbg_reg_read64`, `function hbg_reg_write64`.
- 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.