Drop requirement for specifying firmware map size
The HAIKU_FIRMWARE_NAME_MAP macro takes a size parameter to define the firmware map array type, and then a multi-dimensional array literal is assigned to the array defined by that macro. This is error-prone. The idualwifi7260 driver, before this patch, had the size incorrectly set to 6 when the number of entries was 7, which sliced the last entry off of the map, making it unavailable to the driver. After fixing this size, the driver properly loads the iwm-8265-22.ucode firmware on my computer. This patch changes that macro to take a const char[][2] literal as its only parameter, making it less likely for this sort of bug to be re-introduced. Fixes #15413. Change-Id: I78a75e692a8637af0f13d1eb16180ce8d95d0852 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1917 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
e4c933c93f
commit
d8779e44ee
@ -26,7 +26,7 @@ NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(1);
|
||||
HAIKU_FIRMWARE_NAME_MAP(6) = {
|
||||
HAIKU_FIRMWARE_NAME_MAP({
|
||||
{"iwm3160fw", "iwm-3160-17.ucode"},
|
||||
{"iwm3168fw", "iwm-3168-22.ucode"},
|
||||
{"iwm7260fw", "iwm-7260-17.ucode"},
|
||||
@ -34,7 +34,7 @@ HAIKU_FIRMWARE_NAME_MAP(6) = {
|
||||
{"iwm7265Dfw", "iwm-7265D-22.ucode"},
|
||||
{"iwm8000Cfw", "iwm-8000C-22.ucode"},
|
||||
{"iwm8265fw", "iwm-8265-22.ucode"},
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
int
|
||||
|
@ -23,11 +23,11 @@ NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(130);
|
||||
HAIKU_FIRMWARE_NAME_MAP(3) = {
|
||||
HAIKU_FIRMWARE_NAME_MAP({
|
||||
{"ipw_bss", "ipw2100-1.3.fw"},
|
||||
{"ipw_ibss", "ipw2100-1.3-i.fw"},
|
||||
{"ipw_monitor", "ipw2100-1.3-p.fw"}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
int
|
||||
|
@ -22,8 +22,11 @@ HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi2200, iwi, pci)
|
||||
NO_HAIKU_FBSD_MII_DRIVER();
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(300);
|
||||
HAIKU_FIRMWARE_NAME_MAP(3) = {{"iwi_bss", "ipw2200-bss.fw"},
|
||||
{"iwi_ibss", "ipw2200-ibss.fw"}, {"iwi_monitor", "ipw2200-sniffer.fw"}};
|
||||
HAIKU_FIRMWARE_NAME_MAP({
|
||||
{"iwi_bss", "ipw2200-bss.fw"},
|
||||
{"iwi_ibss", "ipw2200-ibss.fw"},
|
||||
{"iwi_monitor", "ipw2200-sniffer.fw"}
|
||||
});
|
||||
|
||||
|
||||
int
|
||||
|
@ -25,7 +25,7 @@ NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(2144);
|
||||
HAIKU_FIRMWARE_NAME_MAP(1) = {{"wpifw", "iwlwifi-3945-2.ucode"}};
|
||||
HAIKU_FIRMWARE_NAME_MAP({{"wpifw", "iwlwifi-3945-2.ucode"}});
|
||||
|
||||
|
||||
int
|
||||
|
@ -26,7 +26,7 @@ NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(44417);
|
||||
HAIKU_FIRMWARE_NAME_MAP(13) = {
|
||||
HAIKU_FIRMWARE_NAME_MAP({
|
||||
{"iwn100fw", "iwlwifi-100-5.ucode"},
|
||||
{"iwn105fw", "iwlwifi-105-6.ucode"},
|
||||
{"iwn135fw", "iwlwifi-135-6.ucode"},
|
||||
@ -40,7 +40,7 @@ HAIKU_FIRMWARE_NAME_MAP(13) = {
|
||||
{"iwn6000g2afw", "iwlwifi-6000g2a-6.ucode"},
|
||||
{"iwn6000g2bfw", "iwlwifi-6000g2b-6.ucode"},
|
||||
{"iwn6050fw", "iwlwifi-6050-5.ucode"}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
int
|
||||
|
@ -28,12 +28,12 @@
|
||||
HAIKU_FBSD_WLAN_DRIVER_GLUE(ralinkwifi, ral, pci)
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(0);
|
||||
HAIKU_FIRMWARE_NAME_MAP(4) = {
|
||||
HAIKU_FIRMWARE_NAME_MAP({
|
||||
{"rt2561fw", "rt2561.bin"},
|
||||
{"rt2561sfw", "rt2561s.bin"},
|
||||
{"rt2661fw", "rt2661.bin"},
|
||||
{"rt2860fw", "rt2860.bin"}
|
||||
};
|
||||
});
|
||||
|
||||
NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
|
@ -24,11 +24,11 @@
|
||||
HAIKU_FBSD_WLAN_DRIVER_GLUE(realtekwifi, rtwn_pci, pci)
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(0);
|
||||
HAIKU_FIRMWARE_NAME_MAP(3) = {
|
||||
HAIKU_FIRMWARE_NAME_MAP({
|
||||
{"rtwn-rtl8188eefw", "rtl8188eefw.ucode"},
|
||||
{"rtwn-rtl8192cfwE", "rtl8192cfwE.ucode"},
|
||||
{"rtwn-rtl8192cfwE_B", "rtl8192cfwE_B.ucode"},
|
||||
};
|
||||
});
|
||||
|
||||
NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
|
@ -234,9 +234,17 @@ extern const uint __haiku_firmware_version;
|
||||
extern const uint __haiku_firmware_parts_count;
|
||||
extern const char* __haiku_firmware_name_map[][2];
|
||||
|
||||
#define HAIKU_FIRMWARE_NAME_MAP(firmwarePartsCount) \
|
||||
const uint __haiku_firmware_parts_count = firmwarePartsCount; \
|
||||
const char* __haiku_firmware_name_map[firmwarePartsCount][2]
|
||||
/*
|
||||
* Provide a firmware name mapping as a multi-dimentional const char* array.
|
||||
*
|
||||
* HAIKU_FIRMWARE_NAME_MAP({
|
||||
* {"name-used-by-driver", "actual-name-of-firmware-file-on-disk"},
|
||||
* ...
|
||||
* });
|
||||
*/
|
||||
#define HAIKU_FIRMWARE_NAME_MAP(...) \
|
||||
const char* __haiku_firmware_name_map[][2] = __VA_ARGS__; \
|
||||
const uint __haiku_firmware_parts_count = B_COUNT_OF(__haiku_firmware_name_map)
|
||||
|
||||
#define NO_HAIKU_FIRMWARE_NAME_MAP() \
|
||||
const uint __haiku_firmware_parts_count = 0; \
|
||||
|
Loading…
Reference in New Issue
Block a user