e1000_manage.c (169248) | e1000_manage.c (169589) |
---|---|
1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ | 1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ |
33/*$FreeBSD: head/sys/dev/em/e1000_manage.c 169589 2007-05-16 00:14:23Z jfv $*/ |
|
33 | 34 |
34#include <sys/cdefs.h> 35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_manage.c 169248 2007-05-04 13:30:44Z rwatson $"); | |
36 | 35 |
37 | 36#include "e1000_api.h" |
38#include "e1000_manage.h" 39 40static u8 e1000_calculate_checksum(u8 *buffer, u32 length); 41 42/** 43 * e1000_calculate_checksum - Calculate checksum for buffer | 37#include "e1000_manage.h" 38 39static u8 e1000_calculate_checksum(u8 *buffer, u32 length); 40 41/** 42 * e1000_calculate_checksum - Calculate checksum for buffer |
44 * @buffer - pointer to EEPROM 45 * @length - size of EEPROM to calculate a checksum for | 43 * @buffer: pointer to EEPROM 44 * @length: size of EEPROM to calculate a checksum for |
46 * 47 * Calculates the checksum for some buffer on a specified length. The 48 * checksum calculated is returned. 49 **/ 50static u8 51e1000_calculate_checksum(u8 *buffer, u32 length) 52{ 53 u32 i; --- 7 unchanged lines hidden (view full) --- 61 for (i = 0; i < length; i++) 62 sum += buffer[i]; 63 64 return (u8) (0 - sum); 65} 66 67/** 68 * e1000_mng_enable_host_if_generic - Checks host interface is enabled | 45 * 46 * Calculates the checksum for some buffer on a specified length. The 47 * checksum calculated is returned. 48 **/ 49static u8 50e1000_calculate_checksum(u8 *buffer, u32 length) 51{ 52 u32 i; --- 7 unchanged lines hidden (view full) --- 60 for (i = 0; i < length; i++) 61 sum += buffer[i]; 62 63 return (u8) (0 - sum); 64} 65 66/** 67 * e1000_mng_enable_host_if_generic - Checks host interface is enabled |
69 * @hw - pointer to the HW structure | 68 * @hw: pointer to the HW structure |
70 * 71 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND 72 * 73 * This function checks whether the HOST IF is enabled for command operaton 74 * and also checks whether the previous command is completed. It busy waits 75 * in case of previous command is not completed. 76 **/ 77s32 --- 27 unchanged lines hidden (view full) --- 105 } 106 107out: 108 return ret_val; 109} 110 111/** 112 * e1000_check_mng_mode_generic - Generic check managament mode | 69 * 70 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND 71 * 72 * This function checks whether the HOST IF is enabled for command operaton 73 * and also checks whether the previous command is completed. It busy waits 74 * in case of previous command is not completed. 75 **/ 76s32 --- 27 unchanged lines hidden (view full) --- 104 } 105 106out: 107 return ret_val; 108} 109 110/** 111 * e1000_check_mng_mode_generic - Generic check managament mode |
113 * @hw - pointer to the HW structure | 112 * @hw: pointer to the HW structure |
114 * 115 * Reads the firmware semaphore register and returns true (>0) if 116 * manageability is enabled, else false (0). 117 **/ 118boolean_t 119e1000_check_mng_mode_generic(struct e1000_hw *hw) 120{ 121 u32 fwsm; 122 123 DEBUGFUNC("e1000_check_mng_mode_generic"); 124 125 fwsm = E1000_READ_REG(hw, E1000_FWSM); 126 127 return ((fwsm & E1000_FWSM_MODE_MASK) == 128 (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)); 129} 130 131/** 132 * e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on TX | 113 * 114 * Reads the firmware semaphore register and returns true (>0) if 115 * manageability is enabled, else false (0). 116 **/ 117boolean_t 118e1000_check_mng_mode_generic(struct e1000_hw *hw) 119{ 120 u32 fwsm; 121 122 DEBUGFUNC("e1000_check_mng_mode_generic"); 123 124 fwsm = E1000_READ_REG(hw, E1000_FWSM); 125 126 return ((fwsm & E1000_FWSM_MODE_MASK) == 127 (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)); 128} 129 130/** 131 * e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on TX |
133 * @hw - pointer to the HW structure | 132 * @hw: pointer to the HW structure |
134 * 135 * Enables packet filtering on transmit packets if manageability is enabled 136 * and host interface is enabled. 137 **/ 138boolean_t 139e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) 140{ 141 struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie; --- 47 unchanged lines hidden (view full) --- 189 190out: 191 hw->mac.tx_pkt_filtering = tx_filter; 192 return tx_filter; 193} 194 195/** 196 * e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface | 133 * 134 * Enables packet filtering on transmit packets if manageability is enabled 135 * and host interface is enabled. 136 **/ 137boolean_t 138e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw) 139{ 140 struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie; --- 47 unchanged lines hidden (view full) --- 188 189out: 190 hw->mac.tx_pkt_filtering = tx_filter; 191 return tx_filter; 192} 193 194/** 195 * e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface |
197 * @hw - pointer to the HW structure 198 * @buffer - pointer to the host interface 199 * @length - size of the buffer | 196 * @hw: pointer to the HW structure 197 * @buffer: pointer to the host interface 198 * @length: size of the buffer |
200 * 201 * Writes the DHCP information to the host interface. 202 **/ 203s32 204e1000_mng_write_dhcp_info_generic(struct e1000_hw * hw, u8 *buffer, u16 length) 205{ 206 struct e1000_host_mng_command_header hdr; 207 s32 ret_val; --- 28 unchanged lines hidden (view full) --- 236 E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); 237 238out: 239 return ret_val; 240} 241 242/** 243 * e1000_mng_write_cmd_header_generic - Writes manageability command header | 199 * 200 * Writes the DHCP information to the host interface. 201 **/ 202s32 203e1000_mng_write_dhcp_info_generic(struct e1000_hw * hw, u8 *buffer, u16 length) 204{ 205 struct e1000_host_mng_command_header hdr; 206 s32 ret_val; --- 28 unchanged lines hidden (view full) --- 235 E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C); 236 237out: 238 return ret_val; 239} 240 241/** 242 * e1000_mng_write_cmd_header_generic - Writes manageability command header |
244 * @hw - pointer to the HW structure 245 * @hdr - pointer to the host interface command header | 243 * @hw: pointer to the HW structure 244 * @hdr: pointer to the host interface command header |
246 * 247 * Writes the command header after does the checksum calculation. 248 **/ 249s32 250e1000_mng_write_cmd_header_generic(struct e1000_hw * hw, 251 struct e1000_host_mng_command_header * hdr) 252{ 253 u16 i, length = sizeof(struct e1000_host_mng_command_header); --- 11 unchanged lines hidden (view full) --- 265 E1000_WRITE_FLUSH(hw); 266 } 267 268 return E1000_SUCCESS; 269} 270 271/** 272 * e1000_mng_host_if_write_generic - Writes to the manageability host interface | 245 * 246 * Writes the command header after does the checksum calculation. 247 **/ 248s32 249e1000_mng_write_cmd_header_generic(struct e1000_hw * hw, 250 struct e1000_host_mng_command_header * hdr) 251{ 252 u16 i, length = sizeof(struct e1000_host_mng_command_header); --- 11 unchanged lines hidden (view full) --- 264 E1000_WRITE_FLUSH(hw); 265 } 266 267 return E1000_SUCCESS; 268} 269 270/** 271 * e1000_mng_host_if_write_generic - Writes to the manageability host interface |
273 * @hw - pointer to the HW structure 274 * @buffer - pointer to the host interface buffer 275 * @length - size of the buffer 276 * @offset - location in the buffer to write to 277 * @sum - sum of the data (not checksum) | 272 * @hw: pointer to the HW structure 273 * @buffer: pointer to the host interface buffer 274 * @length: size of the buffer 275 * @offset: location in the buffer to write to 276 * @sum: sum of the data (not checksum) |
278 * 279 * This function writes the buffer content at the offset given on the host if. 280 * It also does alignment considerations to do the writes in most efficient 281 * way. Also fills up the sum of the buffer in *buffer parameter. 282 **/ 283s32 284e1000_mng_host_if_write_generic(struct e1000_hw * hw, u8 *buffer, u16 length, 285 u16 offset, u8 *sum) --- 57 unchanged lines hidden (view full) --- 343 } 344 345out: 346 return ret_val; 347} 348 349/** 350 * e1000_enable_mng_pass_thru - Enable processing of ARP's | 277 * 278 * This function writes the buffer content at the offset given on the host if. 279 * It also does alignment considerations to do the writes in most efficient 280 * way. Also fills up the sum of the buffer in *buffer parameter. 281 **/ 282s32 283e1000_mng_host_if_write_generic(struct e1000_hw * hw, u8 *buffer, u16 length, 284 u16 offset, u8 *sum) --- 57 unchanged lines hidden (view full) --- 342 } 343 344out: 345 return ret_val; 346} 347 348/** 349 * e1000_enable_mng_pass_thru - Enable processing of ARP's |
351 * @hw - pointer to the HW structure | 350 * @hw: pointer to the HW structure |
352 * 353 * Verifies the hardware needs to allow ARPs to be processed by the host. 354 **/ 355boolean_t 356e1000_enable_mng_pass_thru(struct e1000_hw *hw) 357{ 358 u32 manc; 359 u32 fwsm, factps; --- 34 unchanged lines hidden --- | 351 * 352 * Verifies the hardware needs to allow ARPs to be processed by the host. 353 **/ 354boolean_t 355e1000_enable_mng_pass_thru(struct e1000_hw *hw) 356{ 357 u32 manc; 358 u32 fwsm, factps; --- 34 unchanged lines hidden --- |