Page MenuHomeFreeBSD

linuxkpi: MODULE_DEVICE_TABLE to MODULE_PNP_INFO
AcceptedPublic

Authored by bz on Oct 3 2020, 6:12 PM.

Details

Reviewers
imp
kib
hselasky
Summary

Implement (hack) up MODULE_PNP_INFO() support in the linuxkpi
for the Linux MODULE_DEVICE_TABLE.
Sadly we need to ensure there is a DRIVER_MODULE() (or probably just
a DECLARE_MODULE but that makes not much difference) before it
(also see man page).

Also sadly add subvendor, etc. fields as comments at the end
to the descriptor_string seem to prevent autoloading and that
should be sorted out separately. To kldxref or devinfo the
devices currently will simply look like duplicates.

Sponsored by:  The FreeBSD Foundation

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 33974
Build 31167: arc lint + arc unit

Event Timeline

bz requested review of this revision.Oct 3 2020, 6:12 PM

I'd still love to update this so that we can have the full set but I need to find the bug first that prevents this (with the comments) from working. You can still see how this turns out (just with less columns):

Module lkpi_iwl_hw_card_ids_pci in if_iwl.ko
Version: if iwl.1 kmod if_iwl.ko
PNP info for bus pci format I:vendor;I:device;I:#;I:#;I:#;I:#; 263 entries (if_iwl.ko)
   0x8086:0x8b1:0xffffffff:0x4070:0:0:
   0x8086:0x8b1:0xffffffff:0x4072:0:0:
   0x8086:0x8b1:0xffffffff:0x4170:0:0:
   0x8086:0x8b1:0xffffffff:0x4c60:0:0:
   0x8086:0x8b1:0xffffffff:0x4c70:0:0:
   0x8086:0x8b1:0xffffffff:0x4060:0:0:
   0x8086:0x8b1:0xffffffff:0x406a:0:0:
   0x8086:0x8b1:0xffffffff:0x4160:0:0:
   0x8086:0x8b1:0xffffffff:0x4062:0:0:
   0x8086:0x8b1:0xffffffff:0x4162:0:0:
   0x8086:0x8b2:0xffffffff:0x4270:0:0:
   0x8086:0x8b2:0xffffffff:0x4272:0:0:
   0x8086:0x8b2:0xffffffff:0x4260:0:0:
   0x8086:0x8b2:0xffffffff:0x426a:0:0:
   0x8086:0x8b2:0xffffffff:0x4262:0:0:
   0x8086:0x8b1:0xffffffff:0x4470:0:0:
   0x8086:0x8b1:0xffffffff:0x4472:0:0:
..
sys/compat/linuxkpi/common/include/linux/pci.h
72

DEVMETHOD_END is the right for { 0, 0 }

Change looks good in total.

Also sadly add subvendor, etc. fields as comments at the end

to the descriptor_string seem to prevent autoloading and that

Linux uses -1U for wildcard. Maybe devmatch needs support for that too!

@bz

I:vendor;I:device;I:#;I:#;I:#;I:#

Format should use "J" instead, I guess, because it allows -1 as ignore value.

Also sadly add subvendor, etc. fields as comments at the end

to the descriptor_string seem to prevent autoloading and that

Linux uses -1U for wildcard. Maybe devmatch needs support for that too!

We do support that...

sys/compat/linuxkpi/common/include/linux/pci.h
86

Why not include the subvender and subdevice? There's no reason to omit them.

@bz

I:vendor;I:device;I:#;I:#;I:#;I:#

Format should use "J" instead, I guess, because it allows -1 as ignore value.

-1 is the don't care value.

bz marked an inline comment as done.

Use DEVMETHOD_END.
Include subvendor/subdevice as V32 to deal with the -1 wildcard.
Add the bus name to the name filed in the driver_t.

bz marked an inline comment as done.Oct 4 2020, 2:36 PM
This revision is now accepted and ready to land.Oct 4 2020, 3:01 PM