drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/chelsio/cxgb3/t3_hw.c- Extension
.c- Size
- 114798 bytes
- Lines
- 3749
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/etherdevice.hcommon.hregs.hsge_defs.hfirmware_exports.h
Detected Declarations
struct port_type_infostruct t3_vpdstruct intr_infostruct mc7_timing_paramsenum fw_version_typefunction t3_wait_op_done_valfunction t3_write_regsfunction t3_set_reg_fieldfunction t3_read_indirectfunction t3_mc7_bd_readfunction mi1_initfunction t3_mi1_readfunction t3_mi1_writefunction mi1_wr_addrfunction mi1_ext_readfunction mi1_ext_writefunction t3_mdio_change_bitsfunction t3_phy_resetfunction t3_phy_advertisefunction t3_phy_advertise_fiberfunction t3_set_phy_speed_duplexfunction t3_phy_lasi_intr_enablefunction t3_phy_lasi_intr_disablefunction t3_phy_lasi_intr_clearfunction t3_phy_lasi_intr_handlerfunction t3_seeprom_wpfunction vpdstrtouintfunction vpdstrtou16function get_vpd_paramsfunction sf1_readfunction sf1_writefunction flash_wait_opfunction t3_read_flashfunction datafunction t3_get_tp_versionfunction t3_check_tpsram_versionfunction t3_check_tpsramfunction t3_get_fw_versionfunction t3_check_fw_versionfunction t3_flash_erase_sectorsfunction t3_load_fwfunction t3_cim_ctl_blk_readfunction t3_gate_rx_trafficfunction t3_open_rx_trafficfunction t3_link_changedfunction t3_link_faultfunction t3_link_startfunction t3_set_vlan_accel
Annotated Snippet
struct port_type_info {
int (*phy_prep)(struct cphy *phy, struct adapter *adapter,
int phy_addr, const struct mdio_ops *ops);
};
static const struct port_type_info port_types[] = {
{ NULL },
{ t3_ael1002_phy_prep },
{ t3_vsc8211_phy_prep },
{ NULL},
{ t3_xaui_direct_phy_prep },
{ t3_ael2005_phy_prep },
{ t3_qt2045_phy_prep },
{ t3_ael1006_phy_prep },
{ NULL },
{ t3_aq100x_phy_prep },
{ t3_ael2020_phy_prep },
};
#define VPD_ENTRY(name, len) \
u8 name##_kword[2]; u8 name##_len; u8 name##_data[len]
/*
* Partial EEPROM Vital Product Data structure. Includes only the ID and
* VPD-R sections.
*/
struct t3_vpd {
u8 id_tag;
u8 id_len[2];
u8 id_data[16];
u8 vpdr_tag;
u8 vpdr_len[2];
VPD_ENTRY(pn, 16); /* part number */
VPD_ENTRY(ec, 16); /* EC level */
VPD_ENTRY(sn, SERNUM_LEN); /* serial number */
VPD_ENTRY(na, 12); /* MAC address base */
VPD_ENTRY(cclk, 6); /* core clock */
VPD_ENTRY(mclk, 6); /* mem clock */
VPD_ENTRY(uclk, 6); /* uP clk */
VPD_ENTRY(mdc, 6); /* MDIO clk */
VPD_ENTRY(mt, 2); /* mem timing */
VPD_ENTRY(xaui0cfg, 6); /* XAUI0 config */
VPD_ENTRY(xaui1cfg, 6); /* XAUI1 config */
VPD_ENTRY(port0, 2); /* PHY0 complex */
VPD_ENTRY(port1, 2); /* PHY1 complex */
VPD_ENTRY(port2, 2); /* PHY2 complex */
VPD_ENTRY(port3, 2); /* PHY3 complex */
VPD_ENTRY(rv, 1); /* csum */
u32 pad; /* for multiple-of-4 sizing and alignment */
};
#define EEPROM_STAT_ADDR 0x4000
#define VPD_BASE 0xc00
/**
* t3_seeprom_wp - enable/disable EEPROM write protection
* @adapter: the adapter
* @enable: 1 to enable write protection, 0 to disable it
*
* Enables or disables write protection on the serial EEPROM.
*/
int t3_seeprom_wp(struct adapter *adapter, int enable)
{
u32 data = enable ? 0xc : 0;
int ret;
/* EEPROM_STAT_ADDR is outside VPD area, use pci_write_vpd_any() */
ret = pci_write_vpd_any(adapter->pdev, EEPROM_STAT_ADDR, sizeof(u32),
&data);
return ret < 0 ? ret : 0;
}
static int vpdstrtouint(char *s, u8 len, unsigned int base, unsigned int *val)
{
char tok[256];
memcpy(tok, s, len);
tok[len] = 0;
return kstrtouint(strim(tok), base, val);
}
static int vpdstrtou16(char *s, u8 len, unsigned int base, u16 *val)
{
char tok[256];
memcpy(tok, s, len);
tok[len] = 0;
return kstrtou16(strim(tok), base, val);
}
Annotation
- Immediate include surface: `linux/etherdevice.h`, `common.h`, `regs.h`, `sge_defs.h`, `firmware_exports.h`.
- Detected declarations: `struct port_type_info`, `struct t3_vpd`, `struct intr_info`, `struct mc7_timing_params`, `enum fw_version_type`, `function t3_wait_op_done_val`, `function t3_write_regs`, `function t3_set_reg_field`, `function t3_read_indirect`, `function t3_mc7_bd_read`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.