aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEmil Tantilov <emil.s.tantilov@intel.com>2011-05-07 03:40:20 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-06-21 04:22:22 -0400
commit9612de92e023bff0d1cd5725ee65293accc70c56 (patch)
tree5b301a051dd73428af19285e7e2c91eeb91db0a7 /drivers
parentfb5475ff7f2e80e920a393d18a43b64124a30270 (diff)
ixgbe: add support for Dell CEM
This patch adds support for Dell CEM (Comprehensive Embedded Management)). This consists of informing the management firmware of the driver version during probe on 82599 and X540 HW. Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Evan Swanson <evan.swanson@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c174
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h46
-rw-r--r--drivers/net/ixgbe/ixgbe_x540.c1
7 files changed, 229 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index bb417d746a16..0d4e38264492 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -1316,6 +1316,7 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1316 .clear_vfta = &ixgbe_clear_vfta_82598, 1316 .clear_vfta = &ixgbe_clear_vfta_82598,
1317 .set_vfta = &ixgbe_set_vfta_82598, 1317 .set_vfta = &ixgbe_set_vfta_82598,
1318 .fc_enable = &ixgbe_fc_enable_82598, 1318 .fc_enable = &ixgbe_fc_enable_82598,
1319 .set_fw_drv_ver = NULL,
1319 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync, 1320 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
1320 .release_swfw_sync = &ixgbe_release_swfw_sync, 1321 .release_swfw_sync = &ixgbe_release_swfw_sync,
1321}; 1322};
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 324a5051f815..4a6826bf9338 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -2126,6 +2126,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2126 .clear_vfta = &ixgbe_clear_vfta_generic, 2126 .clear_vfta = &ixgbe_clear_vfta_generic,
2127 .set_vfta = &ixgbe_set_vfta_generic, 2127 .set_vfta = &ixgbe_set_vfta_generic,
2128 .fc_enable = &ixgbe_fc_enable_generic, 2128 .fc_enable = &ixgbe_fc_enable_generic,
2129 .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
2129 .init_uta_tables = &ixgbe_init_uta_tables_generic, 2130 .init_uta_tables = &ixgbe_init_uta_tables_generic,
2130 .setup_sfp = &ixgbe_setup_sfp_modules_82599, 2131 .setup_sfp = &ixgbe_setup_sfp_modules_82599,
2131 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, 2132 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index cc2a4a1528e2..777051f54e53 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -3333,3 +3333,177 @@ void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw,
3333 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), 0); 3333 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), 0);
3334 } 3334 }
3335} 3335}
3336
3337/**
3338 * ixgbe_calculate_checksum - Calculate checksum for buffer
3339 * @buffer: pointer to EEPROM
3340 * @length: size of EEPROM to calculate a checksum for
3341 * Calculates the checksum for some buffer on a specified length. The
3342 * checksum calculated is returned.
3343 **/
3344static u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
3345{
3346 u32 i;
3347 u8 sum = 0;
3348
3349 if (!buffer)
3350 return 0;
3351
3352 for (i = 0; i < length; i++)
3353 sum += buffer[i];
3354
3355 return (u8) (0 - sum);
3356}
3357
3358/**
3359 * ixgbe_host_interface_command - Issue command to manageability block
3360 * @hw: pointer to the HW structure
3361 * @buffer: contains the command to write and where the return status will
3362 * be placed
3363 * @lenght: lenght of buffer, must be multiple of 4 bytes
3364 *
3365 * Communicates with the manageability block. On success return 0
3366 * else return IXGBE_ERR_HOST_INTERFACE_COMMAND.
3367 **/
3368static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u8 *buffer,
3369 u32 length)
3370{
3371 u32 hicr, i;
3372 u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
3373 u8 buf_len, dword_len;
3374
3375 s32 ret_val = 0;
3376
3377 if (length == 0 || length & 0x3 ||
3378 length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
3379 hw_dbg(hw, "Buffer length failure.\n");
3380 ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND;
3381 goto out;
3382 }
3383
3384 /* Check that the host interface is enabled. */
3385 hicr = IXGBE_READ_REG(hw, IXGBE_HICR);
3386 if ((hicr & IXGBE_HICR_EN) == 0) {
3387 hw_dbg(hw, "IXGBE_HOST_EN bit disabled.\n");
3388 ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND;
3389 goto out;
3390 }
3391
3392 /* Calculate length in DWORDs */
3393 dword_len = length >> 2;
3394
3395 /*
3396 * The device driver writes the relevant command block
3397 * into the ram area.
3398 */
3399 for (i = 0; i < dword_len; i++)
3400 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_FLEX_MNG,
3401 i, *((u32 *)buffer + i));
3402
3403 /* Setting this bit tells the ARC that a new command is pending. */
3404 IXGBE_WRITE_REG(hw, IXGBE_HICR, hicr | IXGBE_HICR_C);
3405
3406 for (i = 0; i < IXGBE_HI_COMMAND_TIMEOUT; i++) {
3407 hicr = IXGBE_READ_REG(hw, IXGBE_HICR);
3408 if (!(hicr & IXGBE_HICR_C))
3409 break;
3410 usleep_range(1000, 2000);
3411 }
3412
3413 /* Check command successful completion. */
3414 if (i == IXGBE_HI_COMMAND_TIMEOUT ||
3415 (!(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV))) {
3416 hw_dbg(hw, "Command has failed with no status valid.\n");
3417 ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND;
3418 goto out;
3419 }
3420
3421 /* Calculate length in DWORDs */
3422 dword_len = hdr_size >> 2;
3423
3424 /* first pull in the header so we know the buffer length */
3425 for (i = 0; i < dword_len; i++)
3426 *((u32 *)buffer + i) =
3427 IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, i);
3428
3429 /* If there is any thing in data position pull it in */
3430 buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len;
3431 if (buf_len == 0)
3432 goto out;
3433
3434 if (length < (buf_len + hdr_size)) {
3435 hw_dbg(hw, "Buffer not large enough for reply message.\n");
3436 ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND;
3437 goto out;
3438 }
3439
3440 /* Calculate length in DWORDs, add one for odd lengths */
3441 dword_len = (buf_len + 1) >> 2;
3442
3443 /* Pull in the rest of the buffer (i is where we left off)*/
3444 for (; i < buf_len; i++)
3445 *((u32 *)buffer + i) =
3446 IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, i);
3447
3448out:
3449 return ret_val;
3450}
3451
3452/**
3453 * ixgbe_set_fw_drv_ver_generic - Sends driver version to firmware
3454 * @hw: pointer to the HW structure
3455 * @maj: driver version major number
3456 * @min: driver version minor number
3457 * @build: driver version build number
3458 * @sub: driver version sub build number
3459 *
3460 * Sends driver version number to firmware through the manageability
3461 * block. On success return 0
3462 * else returns IXGBE_ERR_SWFW_SYNC when encountering an error acquiring
3463 * semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
3464 **/
3465s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
3466 u8 build, u8 sub)
3467{
3468 struct ixgbe_hic_drv_info fw_cmd;
3469 int i;
3470 s32 ret_val = 0;
3471
3472 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM) != 0) {
3473 ret_val = IXGBE_ERR_SWFW_SYNC;
3474 goto out;
3475 }
3476
3477 fw_cmd.hdr.cmd = FW_CEM_CMD_DRIVER_INFO;
3478 fw_cmd.hdr.buf_len = FW_CEM_CMD_DRIVER_INFO_LEN;
3479 fw_cmd.hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED;
3480 fw_cmd.port_num = (u8)hw->bus.func;
3481 fw_cmd.ver_maj = maj;
3482 fw_cmd.ver_min = min;
3483 fw_cmd.ver_build = build;
3484 fw_cmd.ver_sub = sub;
3485 fw_cmd.hdr.checksum = 0;
3486 fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd,
3487 (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len));
3488 fw_cmd.pad = 0;
3489 fw_cmd.pad2 = 0;
3490
3491 for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) {
3492 ret_val = ixgbe_host_interface_command(hw, (u8 *)&fw_cmd,
3493 sizeof(fw_cmd));
3494 if (ret_val != 0)
3495 continue;
3496
3497 if (fw_cmd.hdr.cmd_or_resp.ret_status ==
3498 FW_CEM_RESP_STATUS_SUCCESS)
3499 ret_val = 0;
3500 else
3501 ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND;
3502
3503 break;
3504 }
3505
3506 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
3507out:
3508 return ret_val;
3509}
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 32a454fc67cb..f24fd64a4c46 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -99,6 +99,8 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
99void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf); 99void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf);
100void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf); 100void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf);
101s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps); 101s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps);
102s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
103 u8 build, u8 ver);
102 104
103void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb, 105void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb,
104 u32 headroom, int strategy); 106 u32 headroom, int strategy);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 295ab6d89232..4cd66ae70ccc 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -7674,6 +7674,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
7674 ixgbe_vf_configuration(pdev, (i | 0x10000000)); 7674 ixgbe_vf_configuration(pdev, (i | 0x10000000));
7675 } 7675 }
7676 7676
7677 /* Inform firmware of driver version */
7678 if (hw->mac.ops.set_fw_drv_ver)
7679 hw->mac.ops.set_fw_drv_ver(hw, MAJ, MIN, BUILD, KFIX);
7680
7677 /* add san mac addr to netdev */ 7681 /* add san mac addr to netdev */
7678 ixgbe_add_sanmac_netdev(netdev); 7682 ixgbe_add_sanmac_netdev(netdev);
7679 7683
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 54550646c5c2..9a499a61d141 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -707,6 +707,13 @@
707#define IXGBE_HFDR 0x15FE8 707#define IXGBE_HFDR 0x15FE8
708#define IXGBE_FLEX_MNG 0x15800 /* 0x15800 - 0x15EFC */ 708#define IXGBE_FLEX_MNG 0x15800 /* 0x15800 - 0x15EFC */
709 709
710#define IXGBE_HICR_EN 0x01 /* Enable bit - RO */
711/* Driver sets this bit when done to put command in RAM */
712#define IXGBE_HICR_C 0x02
713#define IXGBE_HICR_SV 0x04 /* Status Validity */
714#define IXGBE_HICR_FW_RESET_ENABLE 0x40
715#define IXGBE_HICR_FW_RESET 0x80
716
710/* PCI-E registers */ 717/* PCI-E registers */
711#define IXGBE_GCR 0x11000 718#define IXGBE_GCR 0x11000
712#define IXGBE_GTV 0x11004 719#define IXGBE_GTV 0x11004
@@ -2124,6 +2131,41 @@ enum ixgbe_fdir_pballoc_type {
2124#define IXGBE_FDIR_INIT_DONE_POLL 10 2131#define IXGBE_FDIR_INIT_DONE_POLL 10
2125#define IXGBE_FDIRCMD_CMD_POLL 10 2132#define IXGBE_FDIRCMD_CMD_POLL 10
2126 2133
2134/* Manageablility Host Interface defines */
2135#define IXGBE_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */
2136#define IXGBE_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */
2137#define IXGBE_HI_COMMAND_TIMEOUT 500 /* Process HI command limit */
2138
2139/* CEM Support */
2140#define FW_CEM_HDR_LEN 0x4
2141#define FW_CEM_CMD_DRIVER_INFO 0xDD
2142#define FW_CEM_CMD_DRIVER_INFO_LEN 0x5
2143#define FW_CEM_CMD_RESERVED 0X0
2144#define FW_CEM_MAX_RETRIES 3
2145#define FW_CEM_RESP_STATUS_SUCCESS 0x1
2146
2147/* Host Interface Command Structures */
2148struct ixgbe_hic_hdr {
2149 u8 cmd;
2150 u8 buf_len;
2151 union {
2152 u8 cmd_resv;
2153 u8 ret_status;
2154 } cmd_or_resp;
2155 u8 checksum;
2156};
2157
2158struct ixgbe_hic_drv_info {
2159 struct ixgbe_hic_hdr hdr;
2160 u8 port_num;
2161 u8 ver_sub;
2162 u8 ver_build;
2163 u8 ver_min;
2164 u8 ver_maj;
2165 u8 pad; /* end spacing to ensure length is mult. of dword */
2166 u16 pad2; /* end spacing to ensure length is mult. of dword2 */
2167};
2168
2127/* Transmit Descriptor - Advanced */ 2169/* Transmit Descriptor - Advanced */
2128union ixgbe_adv_tx_desc { 2170union ixgbe_adv_tx_desc {
2129 struct { 2171 struct {
@@ -2663,6 +2705,9 @@ struct ixgbe_mac_operations {
2663 2705
2664 /* Flow Control */ 2706 /* Flow Control */
2665 s32 (*fc_enable)(struct ixgbe_hw *, s32); 2707 s32 (*fc_enable)(struct ixgbe_hw *, s32);
2708
2709 /* Manageability interface */
2710 s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
2666}; 2711};
2667 2712
2668struct ixgbe_phy_operations { 2713struct ixgbe_phy_operations {
@@ -2832,6 +2877,7 @@ struct ixgbe_info {
2832#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 2877#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30
2833#define IXGBE_ERR_PBA_SECTION -31 2878#define IXGBE_ERR_PBA_SECTION -31
2834#define IXGBE_ERR_INVALID_ARGUMENT -32 2879#define IXGBE_ERR_INVALID_ARGUMENT -32
2880#define IXGBE_ERR_HOST_INTERFACE_COMMAND -33
2835#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF 2881#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
2836 2882
2837#endif /* _IXGBE_TYPE_H_ */ 2883#endif /* _IXGBE_TYPE_H_ */
diff --git a/drivers/net/ixgbe/ixgbe_x540.c b/drivers/net/ixgbe/ixgbe_x540.c
index fa566ede7654..bec30ed91adc 100644
--- a/drivers/net/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ixgbe/ixgbe_x540.c
@@ -894,6 +894,7 @@ static struct ixgbe_mac_operations mac_ops_X540 = {
894 .clear_vfta = &ixgbe_clear_vfta_generic, 894 .clear_vfta = &ixgbe_clear_vfta_generic,
895 .set_vfta = &ixgbe_set_vfta_generic, 895 .set_vfta = &ixgbe_set_vfta_generic,
896 .fc_enable = &ixgbe_fc_enable_generic, 896 .fc_enable = &ixgbe_fc_enable_generic,
897 .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
897 .init_uta_tables = &ixgbe_init_uta_tables_generic, 898 .init_uta_tables = &ixgbe_init_uta_tables_generic,
898 .setup_sfp = NULL, 899 .setup_sfp = NULL,
899 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, 900 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,