drivers/net/pcs/pcs-xpcs.c
Source file repositories/reference/linux-study-clean/drivers/net/pcs/pcs-xpcs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/pcs/pcs-xpcs.c- Extension
.c- Size
- 43261 bytes
- Lines
- 1729
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/delay.hlinux/pcs/pcs-xpcs.hlinux/mdio.hlinux/phy.hlinux/phylink.hlinux/property.hpcs-xpcs.h
Detected Declarations
struct dw_xpcs_compatstruct dw_xpcs_descfunction xpcs_find_compatfunction xpcs_get_an_modefunction __xpcs_linkmode_supportedfunction xpcs_readfunction xpcs_writefunction xpcs_modifyfunction xpcs_modify_changedfunction xpcs_read_vendorfunction xpcs_write_vendorfunction xpcs_modify_vendorfunction xpcs_read_vpcsfunction xpcs_write_vpcsfunction xpcs_modify_vpcsfunction xpcs_poll_resetfunction xpcs_soft_resetfunction xpcs_read_fault_c73function xpcs_link_up_usxgmiifunction _xpcs_config_aneg_c73function xpcs_config_aneg_c73function xpcs_aneg_done_c73function xpcs_read_lpa_c73function xpcs_get_max_xlgmii_speedfunction for_each_set_bitfunction xpcs_c45_read_pcs_speedfunction xpcs_resolve_pmafunction xpcs_validatefunction xpcs_inband_capsfunction xpcs_get_interfacesfunction xpcs_switch_interface_modefunction xpcs_pre_configfunction xpcs_config_aneg_c37_sgmiifunction xpcs_config_aneg_c37_1000basexfunction xpcs_config_2500basexfunction xpcs_do_configfunction xpcs_configfunction xpcs_get_state_c73function xpcs_get_state_c37_sgmiifunction xpcs_get_state_c37_1000basexfunction xpcs_get_state_2500basexfunction xpcs_get_statefunction xpcs_link_up_sgmii_1000basexfunction xpcs_link_upfunction xpcs_an_restartfunction xpcs_config_eeefunction xpcs_disable_eeefunction xpcs_enable_eee
Annotated Snippet
struct dw_xpcs_compat {
phy_interface_t interface;
const int *supported;
int an_mode;
int (*pma_config)(struct dw_xpcs *xpcs);
};
struct dw_xpcs_desc {
u32 id;
u32 mask;
const struct dw_xpcs_compat *compat;
};
static const struct dw_xpcs_compat *
xpcs_find_compat(struct dw_xpcs *xpcs, phy_interface_t interface)
{
const struct dw_xpcs_compat *compat;
for (compat = xpcs->desc->compat; compat->supported; compat++)
if (compat->interface == interface)
return compat;
return NULL;
}
struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs)
{
return &xpcs->pcs;
}
EXPORT_SYMBOL_GPL(xpcs_to_phylink_pcs);
int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface)
{
const struct dw_xpcs_compat *compat;
compat = xpcs_find_compat(xpcs, interface);
if (!compat)
return -ENODEV;
return compat->an_mode;
}
EXPORT_SYMBOL_GPL(xpcs_get_an_mode);
static bool __xpcs_linkmode_supported(const struct dw_xpcs_compat *compat,
enum ethtool_link_mode_bit_indices linkmode)
{
int i;
for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++)
if (compat->supported[i] == linkmode)
return true;
return false;
}
#define xpcs_linkmode_supported(compat, mode) \
__xpcs_linkmode_supported(compat, ETHTOOL_LINK_MODE_ ## mode ## _BIT)
int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg)
{
return mdiodev_c45_read(xpcs->mdiodev, dev, reg);
}
int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val)
{
return mdiodev_c45_write(xpcs->mdiodev, dev, reg, val);
}
int xpcs_modify(struct dw_xpcs *xpcs, int dev, u32 reg, u16 mask, u16 set)
{
return mdiodev_c45_modify(xpcs->mdiodev, dev, reg, mask, set);
}
static int xpcs_modify_changed(struct dw_xpcs *xpcs, int dev, u32 reg,
u16 mask, u16 set)
{
return mdiodev_c45_modify_changed(xpcs->mdiodev, dev, reg, mask, set);
}
static int xpcs_read_vendor(struct dw_xpcs *xpcs, int dev, u32 reg)
{
return xpcs_read(xpcs, dev, DW_VENDOR | reg);
}
static int xpcs_write_vendor(struct dw_xpcs *xpcs, int dev, int reg,
u16 val)
{
return xpcs_write(xpcs, dev, DW_VENDOR | reg, val);
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/pcs/pcs-xpcs.h`, `linux/mdio.h`, `linux/phy.h`, `linux/phylink.h`, `linux/property.h`, `pcs-xpcs.h`.
- Detected declarations: `struct dw_xpcs_compat`, `struct dw_xpcs_desc`, `function xpcs_find_compat`, `function xpcs_get_an_mode`, `function __xpcs_linkmode_supported`, `function xpcs_read`, `function xpcs_write`, `function xpcs_modify`, `function xpcs_modify_changed`, `function xpcs_read_vendor`.
- Atlas domain: Driver Families / drivers/net.
- 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.