aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-5000.c
diff options
context:
space:
mode:
authorJay Sternberg <jay.e.sternberg@intel.com>2009-07-17 12:30:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:24 -0400
commitcc0f555d511a5fe9d4519334c8f674a1dbab9e3a (patch)
tree33308c826deaf26796112df7ffb983b67146bb7f /drivers/net/wireless/iwlwifi/iwl-5000.c
parent244294e83f7637e31bbf64060301904860a32051 (diff)
iwlwifi: Handle new firmware file with ucode build number in header
Adding new API version to account for change to ucode file format. New header includes the build number of the ucode. This build number is the SVN revision thus allowing for exact correlation to the code that generated it. The header adds the build number so that older ucode images can also be enhanced to include the build in the future. some cleanup in iwl_read_ucode needed to ensure old header not used and reduce unnecessary references through pointer with the data is already in heap variable. Signed-off-by: Jay Sternberg <jay.e.sternberg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-5000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 3f9da6e47108..74103cfcaceb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1456,6 +1456,44 @@ int iwl5000_calc_rssi(struct iwl_priv *priv,
1456 return max_rssi - agc - IWL49_RSSI_OFFSET; 1456 return max_rssi - agc - IWL49_RSSI_OFFSET;
1457} 1457}
1458 1458
1459#define IWL5000_UCODE_GET(item) \
1460static u32 iwl5000_ucode_get_##item(const struct iwl_ucode_header *ucode,\
1461 u32 api_ver) \
1462{ \
1463 if (api_ver <= 2) \
1464 return le32_to_cpu(ucode->u.v1.item); \
1465 return le32_to_cpu(ucode->u.v2.item); \
1466}
1467
1468static u32 iwl5000_ucode_get_header_size(u32 api_ver)
1469{
1470 if (api_ver <= 2)
1471 return UCODE_HEADER_SIZE(1);
1472 return UCODE_HEADER_SIZE(2);
1473}
1474
1475static u32 iwl5000_ucode_get_build(const struct iwl_ucode_header *ucode,
1476 u32 api_ver)
1477{
1478 if (api_ver <= 2)
1479 return 0;
1480 return le32_to_cpu(ucode->u.v2.build);
1481}
1482
1483static u8 *iwl5000_ucode_get_data(const struct iwl_ucode_header *ucode,
1484 u32 api_ver)
1485{
1486 if (api_ver <= 2)
1487 return (u8 *) ucode->u.v1.data;
1488 return (u8 *) ucode->u.v2.data;
1489}
1490
1491IWL5000_UCODE_GET(inst_size);
1492IWL5000_UCODE_GET(data_size);
1493IWL5000_UCODE_GET(init_size);
1494IWL5000_UCODE_GET(init_data_size);
1495IWL5000_UCODE_GET(boot_size);
1496
1459struct iwl_hcmd_ops iwl5000_hcmd = { 1497struct iwl_hcmd_ops iwl5000_hcmd = {
1460 .rxon_assoc = iwl5000_send_rxon_assoc, 1498 .rxon_assoc = iwl5000_send_rxon_assoc,
1461 .commit_rxon = iwl_commit_rxon, 1499 .commit_rxon = iwl_commit_rxon,
@@ -1471,6 +1509,17 @@ struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
1471 .calc_rssi = iwl5000_calc_rssi, 1509 .calc_rssi = iwl5000_calc_rssi,
1472}; 1510};
1473 1511
1512struct iwl_ucode_ops iwl5000_ucode = {
1513 .get_header_size = iwl5000_ucode_get_header_size,
1514 .get_build = iwl5000_ucode_get_build,
1515 .get_inst_size = iwl5000_ucode_get_inst_size,
1516 .get_data_size = iwl5000_ucode_get_data_size,
1517 .get_init_size = iwl5000_ucode_get_init_size,
1518 .get_init_data_size = iwl5000_ucode_get_init_data_size,
1519 .get_boot_size = iwl5000_ucode_get_boot_size,
1520 .get_data = iwl5000_ucode_get_data,
1521};
1522
1474struct iwl_lib_ops iwl5000_lib = { 1523struct iwl_lib_ops iwl5000_lib = {
1475 .set_hw_params = iwl5000_hw_set_hw_params, 1524 .set_hw_params = iwl5000_hw_set_hw_params,
1476 .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, 1525 .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
@@ -1572,12 +1621,14 @@ static struct iwl_lib_ops iwl5150_lib = {
1572}; 1621};
1573 1622
1574struct iwl_ops iwl5000_ops = { 1623struct iwl_ops iwl5000_ops = {
1624 .ucode = &iwl5000_ucode,
1575 .lib = &iwl5000_lib, 1625 .lib = &iwl5000_lib,
1576 .hcmd = &iwl5000_hcmd, 1626 .hcmd = &iwl5000_hcmd,
1577 .utils = &iwl5000_hcmd_utils, 1627 .utils = &iwl5000_hcmd_utils,
1578}; 1628};
1579 1629
1580static struct iwl_ops iwl5150_ops = { 1630static struct iwl_ops iwl5150_ops = {
1631 .ucode = &iwl5000_ucode,
1581 .lib = &iwl5150_lib, 1632 .lib = &iwl5150_lib,
1582 .hcmd = &iwl5000_hcmd, 1633 .hcmd = &iwl5000_hcmd,
1583 .utils = &iwl5000_hcmd_utils, 1634 .utils = &iwl5000_hcmd_utils,