139 *eecd = *eecd & ~E1000_EECD_SK;
163 mask = 0x01 << (count - 1);
165 eecd &= ~E1000_EECD_DO;
171 eecd &= ~E1000_EECD_DI;
187 eecd &= ~E1000_EECD_DI;
215 for (i = 0; i < count; i++) {
221 eecd &= ~E1000_EECD_DI;
241 u32 attempts = 100000;
246 for (i = 0; i < attempts; i++) {
288 eecd &= ~E1000_EECD_REQ;
290 DEBUGOUT(
"Could not acquire NVM grant\n");
331 eecd &= ~E1000_EECD_CS;
379 eecd &= ~E1000_EECD_REQ;
463 DEBUGOUT(
"nvm parameter(s) out of bounds\n");
488 for (i = 0; i < words; i++) {
490 data[i] = (word_in >> 8) | (word_in << 8);
523 DEBUGOUT(
"nvm parameter(s) out of bounds\n");
535 for (i = 0; i < words; i++) {
576 DEBUGOUT(
"nvm parameter(s) out of bounds\n");
580 for (i = 0; i < words; i++) {
594 DEBUGOUT1(
"NVM read error: %d\n", ret_val);
624 DEBUGOUT(
"nvm parameter(s) out of bounds\n");
628 while (widx < words) {
661 while (widx < words) {
662 u16 word_out = data[widx];
663 word_out = (word_out >> 8) | (word_out << 8);
667 if ((((offset + widx) * 2) % nvm->
page_size) == 0) {
697 u16 words_written = 0;
707 DEBUGOUT(
"nvm parameter(s) out of bounds\n");
726 while (words_written < words) {
737 for (widx = 0; widx < 200; widx++) {
745 DEBUGOUT(
"NVM Write did not complete\n");
784 DEBUGFUNC(
"e1000_read_pba_string_generic");
789 DEBUGOUT(
"Flashless no PBA string\n");
793 if (pba_num == NULL) {
794 DEBUGOUT(
"PBA string buffer was null\n");
815 DEBUGOUT(
"NVM PBA number is not stored as string\n");
819 DEBUGOUT(
"PBA string buffer too small\n");
824 pba_num[0] = (nvm_data >> 12) & 0xF;
825 pba_num[1] = (nvm_data >> 8) & 0xF;
826 pba_num[2] = (nvm_data >> 4) & 0xF;
827 pba_num[3] = nvm_data & 0xF;
828 pba_num[4] = (pba_ptr >> 12) & 0xF;
829 pba_num[5] = (pba_ptr >> 8) & 0xF;
832 pba_num[8] = (pba_ptr >> 4) & 0xF;
833 pba_num[9] = pba_ptr & 0xF;
839 for (offset = 0; offset < 10; offset++) {
840 if (pba_num[offset] < 0xA)
841 pba_num[offset] +=
'0';
842 else if (pba_num[offset] < 0x10)
843 pba_num[offset] +=
'A' - 0xA;
849 ret_val = hw->
nvm.
ops.
read(hw, pba_ptr, 1, &length);
855 if (length == 0xFFFF || length == 0) {
856 DEBUGOUT(
"NVM PBA number section invalid length\n");
860 if (pba_num_size < (((
u32)length * 2) - 1)) {
861 DEBUGOUT(
"PBA string buffer too small\n");
869 for (offset = 0; offset < length; offset++) {
870 ret_val = hw->
nvm.
ops.
read(hw, pba_ptr + offset, 1, &nvm_data);
875 pba_num[offset * 2] = (
u8)(nvm_data >> 8);
876 pba_num[(offset * 2) + 1] = (
u8)(nvm_data & 0xFF);
878 pba_num[offset * 2] =
'\0';
898 DEBUGFUNC(
"e1000_read_pba_length_generic");
900 if (pba_num_size == NULL) {
901 DEBUGOUT(
"PBA buffer size was null\n");
923 ret_val = hw->
nvm.
ops.
read(hw, pba_ptr, 1, &length);
929 if (length == 0xFFFF || length == 0) {
930 DEBUGOUT(
"NVM PBA number section invalid length\n");
937 *pba_num_size = ((
u32)length * 2) - 1;
965 *pba_num = (
u32)(nvm_data << 16);
972 *pba_num |= nvm_data;
991 u32 eeprom_buf_size,
u16 max_pba_block_size,
1000 if (eeprom_buf == NULL) {
1024 if (pba_block_size > max_pba_block_size)
1027 if (eeprom_buf == NULL) {
1034 if (eeprom_buf_size > (
u32)(pba->
word[1] +
1037 &eeprom_buf[pba->
word[1]],
1038 pba_block_size *
sizeof(
u16));
1067 if (eeprom_buf == NULL) {
1085 if (eeprom_buf == NULL) {
1092 if (eeprom_buf_size > (
u32)(pba->
word[1] +
1094 memcpy(&eeprom_buf[pba->
word[1]],
1119 u32 eeprom_buf_size,
u16 *pba_block_size)
1127 if (eeprom_buf == NULL) {
1141 if (eeprom_buf == NULL) {
1147 if (eeprom_buf_size > pba_word[1])
1148 length = eeprom_buf[pba_word[1] + 0];
1153 if (length == 0xFFFF || length == 0)
1160 if (pba_block_size != NULL)
1161 *pba_block_size = length;
1189 for (i = 0; i < ETHER_ADDR_LEN; i++)
1208 DEBUGFUNC(
"e1000_validate_nvm_checksum_generic");
1211 ret_val = hw->
nvm.
ops.
read(hw, i, 1, &nvm_data);
1216 checksum += nvm_data;
1220 DEBUGOUT(
"NVM Checksum Invalid\n");
1244 ret_val = hw->
nvm.
ops.
read(hw, i, 1, &nvm_data);
1246 DEBUGOUT(
"NVM Read Error while updating checksum.\n");
1249 checksum += nvm_data;
1254 DEBUGOUT(
"NVM Write Error while updating checksum.\n");
1288 u16 eeprom_verh, eeprom_verl, etrack_test, fw_version;
1289 u8 q, hval, rem, result;
1290 u16 comb_verh, comb_verl, comb_offset;
1329 if ((comb_offset != 0x0) &&
1333 + 1), 1, &comb_verh);
1338 if ((comb_verh && comb_verl) &&
1374 result = hval + rem;
s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
#define NVM_READ_OPCODE_SPI
#define E1000_NVM_RW_REG_DONE
#define NVM_COMB_VER_MASK
#define E1000_PBANUM_LENGTH
#define E1000_NVM_GRANT_ATTEMPTS
#define NVM_MAX_RETRY_SPI
#define NVM_PBA_PTR_GUARD
#define NVM_WRITE_OPCODE_MICROWIRE
#define NVM_EWEN_OPCODE_MICROWIRE
#define NVM_ETRACK_HIWORD
#define E1000_ERR_NVM_PBA_SECTION
#define NVM_READ_OPCODE_MICROWIRE
#define E1000_NVM_RW_REG_DATA
#define E1000_NVM_RW_ADDR_SHIFT
#define E1000_ERR_NO_SPACE
#define NVM_STATUS_RDY_SPI
#define NVM_IMAGE_ID_MASK
#define E1000_NVM_RW_REG_START
#define NVM_RDSR_OPCODE_SPI
#define NVM_COMB_VER_SHFT
#define E1000_RAH_MAC_ADDR_LEN
#define E1000_ERR_INVALID_ARGUMENT
#define NVM_WRITE_OPCODE_SPI
#define E1000_NVM_POLL_READ
#define NVM_WREN_OPCODE_SPI
#define NVM_EWDS_OPCODE_MICROWIRE
#define E1000_CTRL_EXT_EE_RST
#define NVM_A8_OPCODE_SPI
#define E1000_RAL_MAC_ADDR_LEN
#define E1000_NOT_IMPLEMENTED
@ e1000_nvm_eeprom_microwire
bool e1000_get_flash_presence_i210(struct e1000_hw *hw)
s32 e1000_read_invm_version(struct e1000_hw *hw, struct e1000_fw_version *invm_ver)
s32 e1000_null_ops_generic(struct e1000_hw E1000_UNUSEDARG *hw)
void e1000_null_nvm_generic(struct e1000_hw E1000_UNUSEDARG *hw)
static void e1000_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count)
static void e1000_standby_nvm(struct e1000_hw *hw)
s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *data)
s32 e1000_write_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf, u32 eeprom_buf_size, struct e1000_pba *pba)
s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num)
static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
static void e1000_raise_eec_clk(struct e1000_hw *hw, u32 *eecd)
void e1000_stop_nvm(struct e1000_hw *hw)
s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw)
s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 e1000_read_mac_addr_generic(struct e1000_hw *hw)
s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 e1000_null_write_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, u16 E1000_UNUSEDARG *c)
s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
static void e1000_reload_nvm_generic(struct e1000_hw *hw)
s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 e1000_null_read_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, u16 E1000_UNUSEDARG *c)
void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers)
s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size)
s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
s32 e1000_read_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf, u32 eeprom_buf_size, u16 max_pba_block_size, struct e1000_pba *pba)
void e1000_release_nvm_generic(struct e1000_hw *hw)
static void e1000_lower_eec_clk(struct e1000_hw *hw, u32 *eecd)
static u16 e1000_shift_in_eec_bits(struct e1000_hw *hw, u16 count)
s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
s32 e1000_acquire_nvm_generic(struct e1000_hw *hw)
void e1000_init_nvm_ops_generic(struct e1000_hw *hw)
s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw)
s32 e1000_get_pba_block_size(struct e1000_hw *hw, u16 *eeprom_buf, u32 eeprom_buf_size, u16 *pba_block_size)
#define E1000_WRITE_FLUSH(a)
#define E1000_WRITE_REG(hw, reg, value)
#define E1000_READ_REG(hw, reg)
struct e1000_mac_info mac
struct e1000_nvm_info nvm
u8 perm_addr[ETHER_ADDR_LEN]
struct e1000_nvm_operations ops
void(* release)(struct e1000_hw *)
s32(* init_params)(struct e1000_hw *)
s32(* write)(struct e1000_hw *, u16, u16, u16 *)
void(* reload)(struct e1000_hw *)
s32(* validate)(struct e1000_hw *)
s32(* update)(struct e1000_hw *)
s32(* read)(struct e1000_hw *, u16, u16, u16 *)
s32(* acquire)(struct e1000_hw *)
s32(* valid_led_default)(struct e1000_hw *, u16 *)