|
@@ -2109,6 +2109,28 @@ static void iwl3945_nic_start(struct iwl_priv *priv)
|
|
|
iwl_write32(priv, CSR_RESET, 0);
|
|
|
}
|
|
|
|
|
|
+#define IWL3945_UCODE_GET(item) \
|
|
|
+static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\
|
|
|
+{ \
|
|
|
+ return le32_to_cpu(ucode->u.v1.item); \
|
|
|
+}
|
|
|
+
|
|
|
+static u32 iwl3945_ucode_get_header_size(u32 api_ver)
|
|
|
+{
|
|
|
+ return UCODE_HEADER_SIZE(1);
|
|
|
+}
|
|
|
+
|
|
|
+static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode)
|
|
|
+{
|
|
|
+ return (u8 *) ucode->u.v1.data;
|
|
|
+}
|
|
|
+
|
|
|
+IWL3945_UCODE_GET(inst_size);
|
|
|
+IWL3945_UCODE_GET(data_size);
|
|
|
+IWL3945_UCODE_GET(init_size);
|
|
|
+IWL3945_UCODE_GET(init_data_size);
|
|
|
+IWL3945_UCODE_GET(boot_size);
|
|
|
+
|
|
|
/**
|
|
|
* iwl3945_read_ucode - Read uCode images from disk file.
|
|
|
*
|
|
@@ -2157,7 +2179,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
|
|
|
goto error;
|
|
|
|
|
|
/* Make sure that we got at least our header! */
|
|
|
- if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) {
|
|
|
+ if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) {
|
|
|
IWL_ERR(priv, "File size way too small!\n");
|
|
|
ret = -EINVAL;
|
|
|
goto err_release;
|
|
@@ -2168,13 +2190,12 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
|
|
|
|
|
|
priv->ucode_ver = le32_to_cpu(ucode->ver);
|
|
|
api_ver = IWL_UCODE_API(priv->ucode_ver);
|
|
|
- inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver);
|
|
|
- data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver);
|
|
|
- init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver);
|
|
|
- init_data_size =
|
|
|
- priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver);
|
|
|
- boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver);
|
|
|
- src = priv->cfg->ops->ucode->get_data(ucode, api_ver);
|
|
|
+ inst_size = iwl3945_ucode_get_inst_size(ucode);
|
|
|
+ data_size = iwl3945_ucode_get_data_size(ucode);
|
|
|
+ init_size = iwl3945_ucode_get_init_size(ucode);
|
|
|
+ init_data_size = iwl3945_ucode_get_init_data_size(ucode);
|
|
|
+ boot_size = iwl3945_ucode_get_boot_size(ucode);
|
|
|
+ src = iwl3945_ucode_get_data(ucode);
|
|
|
|
|
|
/* api_ver should match the api version forming part of the
|
|
|
* firmware filename ... but we don't check for that and only rely
|
|
@@ -2223,7 +2244,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
|
|
|
|
|
|
|
|
|
/* Verify size of file vs. image size info in file's header */
|
|
|
- if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) +
|
|
|
+ if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) +
|
|
|
inst_size + data_size + init_size +
|
|
|
init_data_size + boot_size) {
|
|
|
|