staging: rtl8192e: Add rt_fw_blob
rt_fw_blob contains single firmware blob and its size. Update firmware loading code accordingly. Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
c0f6479165
Коммит
292f4b47ba
|
@ -233,7 +233,7 @@ bool rtl92e_init_fw(struct net_device *dev)
|
||||||
|
|
||||||
for (i = starting_state; i <= FW_INIT_STEP2_DATA; i++) {
|
for (i = starting_state; i <= FW_INIT_STEP2_DATA; i++) {
|
||||||
if (rst_opt == OPT_SYSTEM_RESET) {
|
if (rst_opt == OPT_SYSTEM_RESET) {
|
||||||
if (pfirmware->firmware_buf_size[i] == 0) {
|
if (pfirmware->blobs[i].size == 0) {
|
||||||
const char *fw_name[3] = {
|
const char *fw_name[3] = {
|
||||||
RTL8192E_BOOT_IMG_FW,
|
RTL8192E_BOOT_IMG_FW,
|
||||||
RTL8192E_MAIN_IMG_FW,
|
RTL8192E_MAIN_IMG_FW,
|
||||||
|
@ -250,8 +250,7 @@ bool rtl92e_init_fw(struct net_device *dev)
|
||||||
"request firmware fail!\n");
|
"request firmware fail!\n");
|
||||||
goto download_firmware_fail;
|
goto download_firmware_fail;
|
||||||
}
|
}
|
||||||
if (fw_entry->size >
|
if (fw_entry->size > MAX_FW_SIZE) {
|
||||||
sizeof(pfirmware->firmware_buf[i])) {
|
|
||||||
RT_TRACE(COMP_FIRMWARE,
|
RT_TRACE(COMP_FIRMWARE,
|
||||||
"img file size exceed the container struct buffer fail!\n");
|
"img file size exceed the container struct buffer fail!\n");
|
||||||
release_firmware(fw_entry);
|
release_firmware(fw_entry);
|
||||||
|
@ -259,17 +258,17 @@ bool rtl92e_init_fw(struct net_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != FW_INIT_STEP1_MAIN) {
|
if (i != FW_INIT_STEP1_MAIN) {
|
||||||
memcpy(pfirmware->firmware_buf[i],
|
memcpy(pfirmware->blobs[i].data,
|
||||||
fw_entry->data, fw_entry->size);
|
fw_entry->data, fw_entry->size);
|
||||||
pfirmware->firmware_buf_size[i] =
|
pfirmware->blobs[i].size =
|
||||||
fw_entry->size;
|
fw_entry->size;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
memset(pfirmware->firmware_buf[i],
|
memset(pfirmware->blobs[i].data,
|
||||||
0, 128);
|
0, 128);
|
||||||
memcpy(&pfirmware->firmware_buf[i][128],
|
memcpy(&pfirmware->blobs[i].data[128],
|
||||||
fw_entry->data, fw_entry->size);
|
fw_entry->data, fw_entry->size);
|
||||||
pfirmware->firmware_buf_size[i] =
|
pfirmware->blobs[i].size =
|
||||||
fw_entry->size + 128;
|
fw_entry->size + 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,8 +277,8 @@ bool rtl92e_init_fw(struct net_device *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapped_file = pfirmware->firmware_buf[i];
|
mapped_file = pfirmware->blobs[i].data;
|
||||||
file_length = pfirmware->firmware_buf_size[i];
|
file_length = pfirmware->blobs[i].size;
|
||||||
|
|
||||||
rt_status = _rtl92e_fw_download_code(dev, mapped_file,
|
rt_status = _rtl92e_fw_download_code(dev, mapped_file,
|
||||||
file_length);
|
file_length);
|
||||||
|
|
|
@ -44,12 +44,16 @@ enum firmware_status {
|
||||||
FW_STATUS_5_READY = 5,
|
FW_STATUS_5_READY = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MAX_FW_SIZE 64000
|
||||||
|
struct rt_fw_blob {
|
||||||
|
u16 size;
|
||||||
|
u8 data[MAX_FW_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FW_BLOBS 3
|
||||||
struct rt_firmware {
|
struct rt_firmware {
|
||||||
enum firmware_status firmware_status;
|
enum firmware_status firmware_status;
|
||||||
#define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000
|
struct rt_fw_blob blobs[FW_BLOBS];
|
||||||
#define MAX_FW_INIT_STEP 3
|
|
||||||
u8 firmware_buf[MAX_FW_INIT_STEP][RTL8190_MAX_FIRMWARE_CODE_SIZE];
|
|
||||||
u16 firmware_buf_size[MAX_FW_INIT_STEP];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool rtl92e_init_fw(struct net_device *dev);
|
bool rtl92e_init_fw(struct net_device *dev);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче