drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c- Extension
.c- Size
- 5762 bytes
- Lines
- 228
- 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.
- 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/etherdevice.hlinux/if_ether.hlinux/string.hlinux/iopoll.hlinux/types.hlinux/pci.h../libwx/wx_type.h../libwx/wx_hw.htxgbe_type.htxgbe_hw.h
Detected Declarations
function txgbe_disable_sec_tx_pathfunction txgbe_enable_sec_tx_pathfunction txgbe_init_thermal_sensor_threshfunction txgbe_calc_eeprom_checksumfunction txgbe_validate_eeprom_checksumfunction txgbe_reset_miscfunction txgbe_reset_hw
Annotated Snippet
if (wx->mac.type == wx_mac_aml) {
if (i >= TXGBE_EEPROM_I2C_SRART_PTR &&
i < TXGBE_EEPROM_I2C_END_PTR)
local_buffer[i] = 0xffff;
}
if (i != wx->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM)
*checksum += local_buffer[i];
}
kvfree(eeprom_ptrs);
*checksum = TXGBE_EEPROM_SUM - *checksum;
return 0;
}
/**
* txgbe_validate_eeprom_checksum - Validate EEPROM checksum
* @wx: pointer to hardware structure
* @checksum_val: calculated checksum
*
* Performs checksum calculation and validates the EEPROM checksum. If the
* caller does not need checksum_val, the value can be NULL.
**/
int txgbe_validate_eeprom_checksum(struct wx *wx, u16 *checksum_val)
{
u16 read_checksum = 0;
u16 checksum;
int status;
/* Read the first word from the EEPROM. If this times out or fails, do
* not continue or we could be in for a very long wait while every
* EEPROM read fails
*/
status = wx_read_ee_hostif(wx, 0, &checksum);
if (status) {
wx_err(wx, "EEPROM read failed\n");
return status;
}
checksum = 0;
status = txgbe_calc_eeprom_checksum(wx, &checksum);
if (status != 0)
return status;
status = wx_read_ee_hostif(wx, wx->eeprom.sw_region_offset +
TXGBE_EEPROM_CHECKSUM, &read_checksum);
if (status != 0)
return status;
/* Verify read checksum from EEPROM is the same as
* calculated checksum
*/
if (read_checksum != checksum) {
status = -EIO;
wx_err(wx, "Invalid EEPROM checksum\n");
}
/* If the user cares, return the calculated checksum */
if (checksum_val)
*checksum_val = checksum;
return status;
}
static void txgbe_reset_misc(struct wx *wx)
{
wx_reset_misc(wx);
txgbe_init_thermal_sensor_thresh(wx);
}
/**
* txgbe_reset_hw - Perform hardware reset
* @wx: pointer to wx structure
*
* Resets the hardware by resetting the transmit and receive units, masks
* and clears all interrupts, perform a PHY reset, and perform a link (MAC)
* reset.
**/
int txgbe_reset_hw(struct wx *wx)
{
int status;
/* Call adapter stop to disable tx/rx and clear interrupts */
status = wx_stop_adapter(wx);
if (status != 0)
return status;
if (wx->media_type != wx_media_copper) {
u32 val;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/if_ether.h`, `linux/string.h`, `linux/iopoll.h`, `linux/types.h`, `linux/pci.h`, `../libwx/wx_type.h`, `../libwx/wx_hw.h`.
- Detected declarations: `function txgbe_disable_sec_tx_path`, `function txgbe_enable_sec_tx_path`, `function txgbe_init_thermal_sensor_thresh`, `function txgbe_calc_eeprom_checksum`, `function txgbe_validate_eeprom_checksum`, `function txgbe_reset_misc`, `function txgbe_reset_hw`.
- 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.