diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -60,7 +60,6 @@ MODULE_DEPEND(usb_quirk, usb, 1, 1, 1); MODULE_VERSION(usb_quirk, 1); -#define USB_DEV_QUIRKS_MAX 384 #define USB_SUB_QUIRKS_MAX 8 #define USB_QUIRK_ENVROOT "hw.usb.quirk." @@ -80,7 +79,29 @@ #define USB_QUIRK(v,p,l,h,...) \ USB_QUIRK_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, l, h, __VA_ARGS__) -static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { +#define USB_QUIRK_SLOT_ALLOC_2() \ + USB_QUIRK_VP(0x0000, 0x0000, 0x0000, 0x0000, UQ_NONE), \ + USB_QUIRK_VP(0x0000, 0x0000, 0x0000, 0x0000, UQ_NONE), +#define USB_QUIRK_SLOT_ALLOC_4() \ + USB_QUIRK_SLOT_ALLOC_2() \ + USB_QUIRK_SLOT_ALLOC_2() +#define USB_QUIRK_SLOT_ALLOC_8() \ + USB_QUIRK_SLOT_ALLOC_4() \ + USB_QUIRK_SLOT_ALLOC_4() +#define USB_QUIRK_SLOT_ALLOC_16() \ + USB_QUIRK_SLOT_ALLOC_8() \ + USB_QUIRK_SLOT_ALLOC_8() +#define USB_QUIRK_SLOT_ALLOC_32() \ + USB_QUIRK_SLOT_ALLOC_16() \ + USB_QUIRK_SLOT_ALLOC_16() +#define USB_QUIRK_SLOT_ALLOC_64() \ + USB_QUIRK_SLOT_ALLOC_32() \ + USB_QUIRK_SLOT_ALLOC_32() +#define USB_QUIRK_SLOT_ALLOC_128() \ + USB_QUIRK_SLOT_ALLOC_64() \ + USB_QUIRK_SLOT_ALLOC_64() + +static struct usb_quirk_entry usb_quirks[] = { USB_QUIRK(ASUS, LCM, 0x0000, 0xffff, UQ_HID_IGNORE), USB_QUIRK(INSIDEOUT, EDGEPORT4, 0x094, 0x094, UQ_SWAP_UNICODE), USB_QUIRK(DALLAS, J6502, 0x0a2, 0x0a2, UQ_BAD_ADC), @@ -638,7 +659,11 @@ /* This works much better with if_cdce than if_ure */ USB_QUIRK(LENOVO, TBT3LAN, 0x0000, 0xffff, UQ_CFG_INDEX_1), + + /* The following slots are reserved for adding devices dynamically */ + USB_QUIRK_SLOT_ALLOC_128() }; +static uint32_t USB_DEV_QUIRKS_MAX = sizeof(usb_quirks)/sizeof(usb_quirks[0]); #undef USB_QUIRK_VP #undef USB_QUIRK