Lines Matching +full:no +full:- +full:hw +full:- +full:checksum
2 SPDX-License-Identifier: BSD-3-Clause
4 Copyright (c) 2001-2020, Intel Corporation
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
39 * e1000_calculate_checksum - Calculate checksum for buffer
41 * @length: size of EEPROM to calculate a checksum for
43 * Calculates the checksum for some buffer on a specified length. The
44 * checksum calculated is returned.
59 return (u8) (0 - sum); in e1000_calculate_checksum()
63 * e1000_mng_enable_host_if_generic - Checks host interface is enabled
64 * @hw: pointer to the HW structure
72 s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw) in e1000_mng_enable_host_if_generic() argument
79 if (!hw->mac.arc_subsystem_valid) { in e1000_mng_enable_host_if_generic()
81 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_mng_enable_host_if_generic()
85 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_mng_enable_host_if_generic()
88 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_mng_enable_host_if_generic()
92 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_mng_enable_host_if_generic()
100 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_mng_enable_host_if_generic()
107 * e1000_check_mng_mode_generic - Generic check management mode
108 * @hw: pointer to the HW structure
113 bool e1000_check_mng_mode_generic(struct e1000_hw *hw) in e1000_check_mng_mode_generic() argument
115 u32 fwsm = E1000_READ_REG(hw, E1000_FWSM); in e1000_check_mng_mode_generic()
125 * e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on Tx
126 * @hw: pointer to the HW structure
131 bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) in e1000_enable_tx_pkt_filtering_generic() argument
133 struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie; in e1000_enable_tx_pkt_filtering_generic()
134 u32 *buffer = (u32 *)&hw->mng_cookie; in e1000_enable_tx_pkt_filtering_generic()
141 hw->mac.tx_pkt_filtering = true; in e1000_enable_tx_pkt_filtering_generic()
143 /* No manageability, no filtering */ in e1000_enable_tx_pkt_filtering_generic()
144 if (!hw->mac.ops.check_mng_mode(hw)) { in e1000_enable_tx_pkt_filtering_generic()
145 hw->mac.tx_pkt_filtering = false; in e1000_enable_tx_pkt_filtering_generic()
146 return hw->mac.tx_pkt_filtering; in e1000_enable_tx_pkt_filtering_generic()
152 ret_val = e1000_mng_enable_host_if_generic(hw); in e1000_enable_tx_pkt_filtering_generic()
154 hw->mac.tx_pkt_filtering = false; in e1000_enable_tx_pkt_filtering_generic()
155 return hw->mac.tx_pkt_filtering; in e1000_enable_tx_pkt_filtering_generic()
162 *(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF, in e1000_enable_tx_pkt_filtering_generic()
164 hdr_csum = hdr->checksum; in e1000_enable_tx_pkt_filtering_generic()
165 hdr->checksum = 0; in e1000_enable_tx_pkt_filtering_generic()
172 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { in e1000_enable_tx_pkt_filtering_generic()
173 hw->mac.tx_pkt_filtering = true; in e1000_enable_tx_pkt_filtering_generic()
174 return hw->mac.tx_pkt_filtering; in e1000_enable_tx_pkt_filtering_generic()
178 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) in e1000_enable_tx_pkt_filtering_generic()
179 hw->mac.tx_pkt_filtering = false; in e1000_enable_tx_pkt_filtering_generic()
181 return hw->mac.tx_pkt_filtering; in e1000_enable_tx_pkt_filtering_generic()
185 * e1000_mng_write_cmd_header_generic - Writes manageability command header
186 * @hw: pointer to the HW structure
189 * Writes the command header after does the checksum calculation.
191 s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw, in e1000_mng_write_cmd_header_generic() argument
198 /* Write the whole command header structure with new checksum. */ in e1000_mng_write_cmd_header_generic()
200 hdr->checksum = e1000_calculate_checksum((u8 *)hdr, length); in e1000_mng_write_cmd_header_generic()
205 E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i, in e1000_mng_write_cmd_header_generic()
207 E1000_WRITE_FLUSH(hw); in e1000_mng_write_cmd_header_generic()
214 * e1000_mng_host_if_write_generic - Write to the manageability host interface
215 * @hw: pointer to the HW structure
219 * @sum: sum of the data (not checksum)
225 s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer, in e1000_mng_host_if_write_generic() argument
235 /* sum = only sum of the data and it is not checksum */ in e1000_mng_host_if_write_generic()
238 return -E1000_ERR_PARAM; in e1000_mng_host_if_write_generic()
245 data = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset); in e1000_mng_host_if_write_generic()
250 E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset, data); in e1000_mng_host_if_write_generic()
251 length -= j - prev_bytes; in e1000_mng_host_if_write_generic()
256 length -= remaining; in e1000_mng_host_if_write_generic()
270 E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, in e1000_mng_host_if_write_generic()
282 E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, in e1000_mng_host_if_write_generic()
290 * e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface
291 * @hw: pointer to the HW structure
297 s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw, u8 *buffer, in e1000_mng_write_dhcp_info_generic() argument
310 hdr.checksum = 0; in e1000_mng_write_dhcp_info_generic()
313 ret_val = e1000_mng_enable_host_if_generic(hw); in e1000_mng_write_dhcp_info_generic()
318 ret_val = e1000_mng_host_if_write_generic(hw, buffer, length, in e1000_mng_write_dhcp_info_generic()
319 sizeof(hdr), &(hdr.checksum)); in e1000_mng_write_dhcp_info_generic()
324 ret_val = e1000_mng_write_cmd_header_generic(hw, &hdr); in e1000_mng_write_dhcp_info_generic()
329 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_mng_write_dhcp_info_generic()
330 E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); in e1000_mng_write_dhcp_info_generic()
336 * e1000_enable_mng_pass_thru - Check if management passthrough is needed
337 * @hw: pointer to the HW structure
342 bool e1000_enable_mng_pass_thru(struct e1000_hw *hw) in e1000_enable_mng_pass_thru() argument
349 if (!hw->mac.asf_firmware_present) in e1000_enable_mng_pass_thru()
352 manc = E1000_READ_REG(hw, E1000_MANC); in e1000_enable_mng_pass_thru()
357 if (hw->mac.has_fwsm) { in e1000_enable_mng_pass_thru()
358 fwsm = E1000_READ_REG(hw, E1000_FWSM); in e1000_enable_mng_pass_thru()
359 factps = E1000_READ_REG(hw, E1000_FACTPS); in e1000_enable_mng_pass_thru()
365 } else if ((hw->mac.type == e1000_82574) || in e1000_enable_mng_pass_thru()
366 (hw->mac.type == e1000_82583)) { in e1000_enable_mng_pass_thru()
370 factps = E1000_READ_REG(hw, E1000_FACTPS); in e1000_enable_mng_pass_thru()
371 ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); in e1000_enable_mng_pass_thru()
388 * e1000_host_interface_command - Writes buffer to host interface
389 * @hw: pointer to the HW structure
396 s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) in e1000_host_interface_command() argument
402 if (!(hw->mac.arc_subsystem_valid)) { in e1000_host_interface_command()
407 if (!hw->mac.asf_firmware_present) { in e1000_host_interface_command()
415 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_host_interface_command()
419 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_host_interface_command()
422 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_host_interface_command()
432 E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i, in e1000_host_interface_command()
436 E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); in e1000_host_interface_command()
439 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_host_interface_command()
447 (!(E1000_READ_REG(hw, E1000_HICR) & E1000_HICR_SV))) { in e1000_host_interface_command()
448 DEBUGOUT("Command has failed with no status valid.\n"); in e1000_host_interface_command()
449 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_host_interface_command()
453 *((u32 *)buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, in e1000_host_interface_command()
461 * e1000_load_firmware - Writes proxy FW code buffer to host interface
463 * @hw: pointer to the HW structure
468 * in HW else returns E1000_ERR_HOST_INTERFACE_COMMAND.
470 s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length) in e1000_load_firmware() argument
476 if (hw->mac.type < e1000_i210) { in e1000_load_firmware()
478 return -E1000_ERR_CONFIG; in e1000_load_firmware()
482 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_load_firmware()
485 return -E1000_ERR_CONFIG; in e1000_load_firmware()
489 return -E1000_ERR_CONFIG; in e1000_load_firmware()
494 return -E1000_ERR_INVALID_ARGUMENT; in e1000_load_firmware()
497 /* Clear notification from ROM-FW by reading ICR register */ in e1000_load_firmware()
498 icr = E1000_READ_REG(hw, E1000_ICR_V2); in e1000_load_firmware()
500 /* Reset ROM-FW */ in e1000_load_firmware()
501 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_load_firmware()
503 E1000_WRITE_REG(hw, E1000_HICR, hicr); in e1000_load_firmware()
505 E1000_WRITE_REG(hw, E1000_HICR, hicr); in e1000_load_firmware()
506 E1000_WRITE_FLUSH(hw); in e1000_load_firmware()
508 /* Wait till MAC notifies about its readiness after ROM-FW reset */ in e1000_load_firmware()
510 icr = E1000_READ_REG(hw, E1000_ICR_V2); in e1000_load_firmware()
519 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_load_firmware()
524 fwsm = E1000_READ_REG(hw, E1000_FWSM); in e1000_load_firmware()
535 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_load_firmware()
551 E1000_WRITE_REG(hw, E1000_HIBBA, hibba); in e1000_load_firmware()
554 E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, in e1000_load_firmware()
560 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_load_firmware()
561 E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); in e1000_load_firmware()
564 hicr = E1000_READ_REG(hw, E1000_HICR); in e1000_load_firmware()
573 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_load_firmware()