.name = _name,                          \
        .device = IWL_CFG_ANY,                  \
        .subdevice = IWL_CFG_ANY,               \
-       .subdevice_mask = ~0,                   \
-       .rf_type = IWL_CFG_ANY,                 \
-       .rf_step = IWL_CFG_ANY,                 \
-       .bw_limit = IWL_CFG_ANY,                \
-       .jacket = IWL_CFG_ANY,                  \
-       .cores = IWL_CFG_ANY,                   \
-       .rf_id = IWL_CFG_ANY,                   \
-       .cdb = IWL_CFG_ANY,                     \
+       .subdevice_m_h = 15,                    \
        __VA_ARGS__                             \
 }
 #define IWL_DEV_INFO(_cfg, _name, ...)         \
        _IWL_DEV_INFO(_cfg, _name, __VA_ARGS__)
 
-#define DEVICE(n)      .device = (n)
-#define SUBDEV(n)      .subdevice = (n)
-#define SUBDEV_MASKED(v, m)                    \
-                       .subdevice = (v),       \
-                       .subdevice_mask = (m)
-#define RF_TYPE(n)     .rf_type = IWL_CFG_RF_TYPE_##n
-#define RF_STEP(n)     .rf_step = SILICON_##n##_STEP
-#define CORES(n)       .cores = IWL_CFG_CORES_##n
-#define RF_ID(n)       .rf_id = IWL_CFG_RF_ID_##n
-#define NO_CDB         .cdb = IWL_CFG_NO_CDB
-#define CDB            .cdb = IWL_CFG_CDB
-#define BW_NOT_LIMITED .bw_limit = 0
-#define BW_LIMITED     .bw_limit = 1
+#define DEVICE(n)              .device = (n)
+#define SUBDEV(n)              .subdevice = (n)
+#define _LOWEST_BIT(n)         (__builtin_ffs(n) - 1)
+#define _BIT_ABOVE_MASK(n)     ((n) + (1 << _LOWEST_BIT(n)))
+#define _HIGHEST_BIT(n)                (__builtin_ffs(_BIT_ABOVE_MASK(n)) - 2)
+#define _IS_POW2(n)            (((n) & ((n) - 1)) == 0)
+#define _IS_CONTIG(n)          _IS_POW2(_BIT_ABOVE_MASK(n))
+#define _CHECK_MASK(m)         BUILD_BUG_ON_ZERO(!_IS_CONTIG(m))
+#define SUBDEV_MASKED(v, m)    .subdevice = (v) + _CHECK_MASK(m),      \
+                               .subdevice_m_l = _LOWEST_BIT(m),        \
+                               .subdevice_m_h = _HIGHEST_BIT(m)
+#define RF_TYPE(n)             .match_rf_type = 1,                     \
+                               .rf_type = IWL_CFG_RF_TYPE_##n
+#define RF_STEP(n)             .match_rf_step = 1,                     \
+                               .rf_step = SILICON_##n##_STEP
+#define RF_ID(n)               .match_rf_id = 1,                       \
+                               .rf_id = IWL_CFG_RF_ID_##n
+#define NO_CDB                 .match_cdb = 1, .cdb = 0
+#define CDB                    .match_cdb = 1, .cdb = 1
+#define BW_NOT_LIMITED         .match_bw_limit = 1, .bw_limit = 0
+#define BW_LIMITED             .match_bw_limit = 1, .bw_limit = 1
 
 VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = {
 #if IS_ENABLED(CONFIG_IWLDVM)
 
 VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info *
 iwl_pci_find_dev_info(u16 device, u16 subsystem_device, u16 rf_type, u8 cdb,
-                     u8 jacket, u8 rf_id, u8 bw_limit, u8 cores, u8 rf_step)
+                     u8 rf_id, u8 bw_limit, u8 rf_step)
 {
        int num_devices = ARRAY_SIZE(iwl_dev_info_table);
        int i;
 
        for (i = num_devices - 1; i >= 0; i--) {
                const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i];
+               u16 subdevice_mask;
 
                if (dev_info->device != (u16)IWL_CFG_ANY &&
                    dev_info->device != device)
                        continue;
 
-               if (dev_info->subdevice != (u16)IWL_CFG_ANY &&
-                   dev_info->subdevice != (subsystem_device & dev_info->subdevice_mask))
-                       continue;
+               subdevice_mask = GENMASK(dev_info->subdevice_m_h,
+                                        dev_info->subdevice_m_l);
 
-               if (dev_info->rf_type != (u16)IWL_CFG_ANY &&
-                   dev_info->rf_type != rf_type)
-                       continue;
-
-               if (dev_info->cdb != (u8)IWL_CFG_ANY &&
-                   dev_info->cdb != cdb)
+               if (dev_info->subdevice != (u16)IWL_CFG_ANY &&
+                   dev_info->subdevice != (subsystem_device & subdevice_mask))
                        continue;
 
-               if (dev_info->jacket != (u8)IWL_CFG_ANY &&
-                   dev_info->jacket != jacket)
+               if (dev_info->match_rf_type && dev_info->rf_type != rf_type)
                        continue;
 
-               if (dev_info->rf_id != (u8)IWL_CFG_ANY &&
-                   dev_info->rf_id != rf_id)
+               if (dev_info->match_cdb && dev_info->cdb != cdb)
                        continue;
 
-               if (dev_info->bw_limit != (u8)IWL_CFG_ANY &&
-                   dev_info->bw_limit != bw_limit)
+               if (dev_info->match_rf_id && dev_info->rf_id != rf_id)
                        continue;
 
-               if (dev_info->cores != (u8)IWL_CFG_ANY &&
-                   dev_info->cores != cores)
+               if (dev_info->match_bw_limit && dev_info->bw_limit != bw_limit)
                        continue;
 
-               if (dev_info->rf_step != (u8)IWL_CFG_ANY &&
-                   dev_info->rf_step != rf_step)
+               if (dev_info->match_rf_step && dev_info->rf_step != rf_step)
                        continue;
 
                return dev_info;
        dev_info = iwl_pci_find_dev_info(pdev->device, pdev->subsystem_device,
                                         CSR_HW_RFID_TYPE(info.hw_rf_id),
                                         CSR_HW_RFID_IS_CDB(info.hw_rf_id),
-                                        CSR_HW_RFID_IS_JACKET(info.hw_rf_id),
                                         IWL_SUBDEVICE_RF_ID(pdev->subsystem_device),
                                         IWL_SUBDEVICE_BW_LIM(pdev->subsystem_device),
-                                        IWL_SUBDEVICE_CORES(pdev->subsystem_device),
                                         CSR_HW_RFID_STEP(info.hw_rf_id));
        if (dev_info) {
                iwl_trans->cfg = dev_info->cfg;
 
 
 static void iwl_pci_print_dev_info(const char *pfx, const struct iwl_dev_info *di)
 {
-       printk(KERN_DEBUG "%sdev=%.4x subdev=%.4x rf_type=%.4x cdb=%d jacket=%d rf_id=%.2x bw_limit=%d cores=%.2x\n",
-              pfx, di->device, di->subdevice,
-              di->rf_type, di->cdb, di->jacket, di->rf_id, di->bw_limit,
-              di->cores);
+       u16 subdevice_mask = GENMASK(di->subdevice_m_h, di->subdevice_m_l);
+       char buf[100] = {};
+       int pos = 0;
+
+       if (di->match_rf_type)
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " rf_type=%03x", di->rf_type);
+       else
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " rf_type=*");
+
+       if (di->match_bw_limit)
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " bw_limit=%d", di->bw_limit);
+       else
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " bw_limit=*");
+
+       if (di->match_rf_step)
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " rf_step=%c",
+                                di->rf_step == SILICON_Z_STEP ? 'Z' :
+                                       'A' + di->rf_step);
+       else
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " rf_step=*");
+
+       if (di->match_rf_id)
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " rf_id=0x%x", di->rf_id);
+       else
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " rf_id=*");
+
+       if (di->match_cdb)
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " cdb=%d", di->cdb);
+       else
+               pos += scnprintf(buf + pos, sizeof(buf) - pos,
+                                " cdb=*");
+
+
+       printk(KERN_DEBUG "%sdev=%04x subdev=%04x/%04x%s\n",
+              pfx, di->device, di->subdevice, subdevice_mask, buf);
 }
 
 static void devinfo_table_order(struct kunit *test)
 
                ret = iwl_pci_find_dev_info(di->device, di->subdevice,
                                            di->rf_type, di->cdb,
-                                           di->jacket, di->rf_id,
-                                           di->bw_limit,
-                                           di->cores, di->rf_step);
+                                           di->rf_id, di->bw_limit,
+                                           di->rf_step);
                if (!ret) {
                        iwl_pci_print_dev_info("No entry found for: ", di);
                        KUNIT_FAIL(test,
 {
        for (int i = 0; i < iwl_dev_info_table_size; i++) {
                const struct iwl_dev_info *di = &iwl_dev_info_table[i];
+               u16 subdevice_mask = GENMASK(di->subdevice_m_h,
+                                            di->subdevice_m_l);
 
                /* if BW limit bit is matched then must have a limit */
-               if (di->bw_limit == 1)
+               if (di->match_bw_limit == 1 && di->bw_limit == 1)
                        KUNIT_EXPECT_NE(test, di->cfg->bw_limit, 0);
 
-               /* if subdevice is ANY we can have RF ID/BW limit/cores */
+               /* if subdevice is ANY we can have RF ID/BW limit */
                if (di->subdevice == (u16)IWL_CFG_ANY)
                        continue;
 
                /* same if the subdevice mask doesn't overlap them */
-               if (IWL_SUBDEVICE_RF_ID(di->subdevice_mask) == 0 &&
-                   IWL_SUBDEVICE_BW_LIM(di->subdevice_mask) == 0 &&
-                   IWL_SUBDEVICE_CORES(di->subdevice_mask) == 0)
+               if (IWL_SUBDEVICE_RF_ID(subdevice_mask) == 0 &&
+                   IWL_SUBDEVICE_BW_LIM(subdevice_mask) == 0)
                        continue;
 
                /* but otherwise they shouldn't be used */
-               KUNIT_EXPECT_EQ(test, di->rf_id, (u8)IWL_CFG_ANY);
-               KUNIT_EXPECT_EQ(test, di->bw_limit, (u8)IWL_CFG_ANY);
-               KUNIT_EXPECT_EQ(test, di->cores, (u8)IWL_CFG_ANY);
+               KUNIT_EXPECT_EQ(test, (int)di->match_rf_id, 0);
+               KUNIT_EXPECT_EQ(test, (int)di->match_bw_limit, 0);
        }
 }