drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c- Extension
.c- Size
- 163804 bytes
- Lines
- 5633
- 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/unaligned.hlinux/kernel.hhw.har9003_phy.har9003_eeprom.har9003_mci.h
Detected Declarations
function ath9k_hw_ar9300_check_eepromfunction interpolatefunction ath9k_hw_ar9300_get_eepromfunction ar9300_eeprom_read_bytefunction ar9300_eeprom_read_wordfunction ar9300_read_eepromfunction ar9300_otp_read_wordfunction ar9300_read_otpfunction ar9300_comp_hdr_unpackfunction ar9300_comp_cksumfunction ar9300_uncompress_blockfunction ar9300_compress_decisionfunction ar9300_check_headerfunction ar9300_check_eeprom_headerfunction ar9300_eeprom_restore_flashfunction ar9300_eeprom_restore_internalfunction ath9k_hw_ar9300_fill_eepromfunction ar9003_dump_modal_eepromfunction ar9003_dump_cal_datafunction ath9k_hw_ar9003_dump_eepromfunction ath9k_hw_ar9003_dump_eepromfunction ath9k_hw_ar9300_get_eeprom_verfunction ath9k_hw_ar9300_get_eeprom_revfunction ar9003_hw_xpa_bias_level_applyfunction ar9003_switch_com_spdt_getfunction ar9003_hw_ant_ctrl_common_getfunction ar9003_hw_ant_ctrl_common_2_getfunction ar9003_hw_ant_ctrl_chain_getfunction ar9003_hw_ant_ctrl_applyfunction ar9003_hw_drive_strength_applyfunction ar9003_hw_atten_chain_getfunction ar9003_hw_atten_chain_get_marginfunction ar9003_hw_atten_applyfunction is_pmu_setfunction ar9003_hw_internal_regulator_applyfunction AR_SREV_9561function ar9003_hw_apply_tuning_capsfunction ar9003_hw_quick_drop_applyfunction ar9003_hw_txend_to_xpa_off_applyfunction ar9003_hw_xpa_timing_control_applyfunction ar9003_hw_xlna_bias_strength_applyfunction ar9003_hw_get_thermometerfunction ar9003_hw_thermometer_applyfunction ar9003_hw_thermo_cal_applyfunction ar9003_hw_apply_minccapwr_threshfunction ath9k_hw_ar9300_set_board_valuesfunction ath9k_hw_ar9300_set_addacfunction ar9003_hw_eeprom_get_tgt_pwr
Annotated Snippet
if (length > 0 && spot >= 0 && spot+length <= mdataSize) {
ath_dbg(common, EEPROM,
"Restore at %d: spot=%d offset=%d length=%d\n",
it, spot, offset, length);
memcpy(&mptr[spot], &block[it+2], length);
spot += length;
} else if (length > 0) {
ath_dbg(common, EEPROM,
"Bad restore at %d: spot=%d offset=%d length=%d\n",
it, spot, offset, length);
return false;
}
}
return true;
}
static int ar9300_compress_decision(struct ath_hw *ah,
int it,
int code,
int reference,
u8 *mptr,
u8 *word, int length, int mdata_size)
{
struct ath_common *common = ath9k_hw_common(ah);
const struct ar9300_eeprom *eep = NULL;
switch (code) {
case _CompressNone:
if (length != mdata_size) {
ath_dbg(common, EEPROM,
"EEPROM structure size mismatch memory=%d eeprom=%d\n",
mdata_size, length);
return -1;
}
memcpy(mptr, word + COMP_HDR_LEN, length);
ath_dbg(common, EEPROM,
"restored eeprom %d: uncompressed, length %d\n",
it, length);
break;
case _CompressBlock:
if (reference != 0) {
eep = ar9003_eeprom_struct_find_by_id(reference);
if (eep == NULL) {
ath_dbg(common, EEPROM,
"can't find reference eeprom struct %d\n",
reference);
return -1;
}
memcpy(mptr, eep, mdata_size);
}
ath_dbg(common, EEPROM,
"restore eeprom %d: block, reference %d, length %d\n",
it, reference, length);
ar9300_uncompress_block(ah, mptr, mdata_size,
(word + COMP_HDR_LEN), length);
break;
default:
ath_dbg(common, EEPROM, "unknown compression code %d\n", code);
return -1;
}
return 0;
}
typedef bool (*eeprom_read_op)(struct ath_hw *ah, int address, u8 *buffer,
int count);
static bool ar9300_check_header(void *data)
{
u32 *word = data;
return !(*word == 0 || *word == ~0);
}
static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
int base_addr)
{
u8 header[4];
if (!read(ah, base_addr, header, 4))
return false;
return ar9300_check_header(header);
}
static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
int mdata_size)
{
u16 *data = (u16 *) mptr;
int i;
for (i = 0; i < mdata_size / 2; i++, data++)
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/kernel.h`, `hw.h`, `ar9003_phy.h`, `ar9003_eeprom.h`, `ar9003_mci.h`.
- Detected declarations: `function ath9k_hw_ar9300_check_eeprom`, `function interpolate`, `function ath9k_hw_ar9300_get_eeprom`, `function ar9300_eeprom_read_byte`, `function ar9300_eeprom_read_word`, `function ar9300_read_eeprom`, `function ar9300_otp_read_word`, `function ar9300_read_otp`, `function ar9300_comp_hdr_unpack`, `function ar9300_comp_cksum`.
- 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.