[iwm] Store paging_mem_size field in firmware image information struct.
Obtained from: DragonflyBSD commit a8524cc6c440e5ce9490ba2b0507c99ff6777c6d
This commit is contained in:
parent
a5bc1ccb8b
commit
cb20e5afea
@ -554,6 +554,8 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type)
|
||||
enum iwm_ucode_tlv_type tlv_type;
|
||||
const struct firmware *fwp;
|
||||
const uint8_t *data;
|
||||
uint32_t usniffer_img;
|
||||
uint32_t paging_mem_size;
|
||||
int error = 0;
|
||||
size_t len;
|
||||
|
||||
@ -834,6 +836,38 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type)
|
||||
goto parse_out;
|
||||
break;
|
||||
|
||||
case IWM_UCODE_TLV_PAGING:
|
||||
if (tlv_len != sizeof(uint32_t)) {
|
||||
error = EINVAL;
|
||||
goto parse_out;
|
||||
}
|
||||
paging_mem_size = le32toh(*(const uint32_t *)tlv_data);
|
||||
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_FIRMWARE_TLV,
|
||||
"%s: Paging: paging enabled (size = %u bytes)\n",
|
||||
__func__, paging_mem_size);
|
||||
if (paging_mem_size > IWM_MAX_PAGING_IMAGE_SIZE) {
|
||||
device_printf(sc->sc_dev,
|
||||
"%s: Paging: driver supports up to %u bytes for paging image\n",
|
||||
__func__, IWM_MAX_PAGING_IMAGE_SIZE);
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (paging_mem_size & (IWM_FW_PAGING_SIZE - 1)) {
|
||||
device_printf(sc->sc_dev,
|
||||
"%s: Paging: image isn't multiple %u\n",
|
||||
__func__, IWM_FW_PAGING_SIZE);
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
sc->sc_fw.fw_sects[IWM_UCODE_REGULAR].paging_mem_size =
|
||||
paging_mem_size;
|
||||
usniffer_img = IWM_UCODE_REGULAR_USNIFFER;
|
||||
sc->sc_fw.fw_sects[usniffer_img].paging_mem_size =
|
||||
paging_mem_size;
|
||||
break;
|
||||
|
||||
case IWM_UCODE_TLV_N_SCAN_CHANNELS:
|
||||
if (tlv_len != sizeof(uint32_t)) {
|
||||
error = EINVAL;
|
||||
|
@ -888,6 +888,28 @@ struct iwm_fw_cipher_scheme {
|
||||
uint8_t hw_cipher;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Block paging calculations
|
||||
*/
|
||||
#define IWM_PAGE_2_EXP_SIZE 12 /* 4K == 2^12 */
|
||||
#define IWM_FW_PAGING_SIZE (1 << IWM_PAGE_2_EXP_SIZE) /* page size is 4KB */
|
||||
#define IWM_PAGE_PER_GROUP_2_EXP_SIZE 3
|
||||
/* 8 pages per group */
|
||||
#define IWM_NUM_OF_PAGE_PER_GROUP (1 << IWM_PAGE_PER_GROUP_2_EXP_SIZE)
|
||||
/* don't change, support only 32KB size */
|
||||
#define IWM_PAGING_BLOCK_SIZE (IWM_NUM_OF_PAGE_PER_GROUP * IWM_FW_PAGING_SIZE)
|
||||
/* 32K == 2^15 */
|
||||
#define IWM_BLOCK_2_EXP_SIZE (IWM_PAGE_2_EXP_SIZE + IWM_PAGE_PER_GROUP_2_EXP_SIZE)
|
||||
|
||||
/*
|
||||
* Image paging calculations
|
||||
*/
|
||||
#define IWM_BLOCK_PER_IMAGE_2_EXP_SIZE 5
|
||||
/* 2^5 == 32 blocks per image */
|
||||
#define IWM_NUM_OF_BLOCK_PER_IMAGE (1 << IWM_BLOCK_PER_IMAGE_2_EXP_SIZE)
|
||||
/* maximum image size 1024KB */
|
||||
#define IWM_MAX_PAGING_IMAGE_SIZE (IWM_NUM_OF_BLOCK_PER_IMAGE * IWM_PAGING_BLOCK_SIZE)
|
||||
|
||||
/**
|
||||
* struct iwm_fw_cscheme_list - a cipher scheme list
|
||||
* @size: a number of entries
|
||||
|
@ -181,6 +181,7 @@ struct iwm_fw_info {
|
||||
uint32_t fws_devoff;
|
||||
} fw_sect[IWM_UCODE_SECTION_MAX];
|
||||
int fw_count;
|
||||
uint32_t paging_mem_size;
|
||||
} fw_sects[IWM_UCODE_TYPE_MAX];
|
||||
|
||||
uint32_t phy_config;
|
||||
|
Loading…
Reference in New Issue
Block a user