MODULE_DEVICE_TABLE(isapnp, ...) does nothing
Hello,
just found that Linux does not automatically load "ne" module for ISA PnP NE2000 cards (RTL8019AS). ne.c contains this:
static struct isapnp_device_id isapnp_clone_list[] __initdata = {
{ ISAPNP_CARD_ID('A','X','E',0x2011),
ISAPNP_VENDOR('A','X','E'), ISAPNP_FUNCTION(0x2011),
(long) "NetGear EA201" },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID,
ISAPNP_VENDOR('E','D','I'), ISAPNP_FUNCTION(0x0216),
(long) "NN NE2000" },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID,
ISAPNP_VENDOR('P','N','P'), ISAPNP_FUNCTION(0x80d6),
(long) "Generic PNP" },
{ } /* terminate list */
};MODULE_DEVICE_TABLE(isapnp, isapnp_clone_list);
but "modinfo ne" does not show any aliases. The ne.mod.c file produced during build does not contain aliases too. The problem is that scripts/mod/file2alias.c simply ignores isapnp.
ne.c is not the only file using MODULE_DEVICE_TABLE(isapnp, ...):drivers/pcmcia/i82365.cdrivers/net/3c515.cdrivers/net/ne.cdrivers/net/smc-ultra.c drivers/isdn/hisax/hisax_fspcipnp.c drivers/media/radio/radio-sf16fmi.c drivers/scsi/aha1542.cdrivers/scsi/aha152x.cdrivers/scsi/sym53c416.cdrivers/scsi/g_NCR5380.csound/oss/ad1848.c
How is (was) this supposed to work?
Signature · 1 line
Ondrej Zary
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.
AFAICT it always has, and noone has complained until now. Perhaps something was still reading /lib/modules/uname -r/modules.isapnpmap?
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)
The first patches would look something like these. We could mangle the PNP names a-la ISAPNP_VENDOR/ISAPNP_DEVICE, but as long as the published modalias matches the file2alias result, it doesn't matter.
Jaroslav? Greg? Patches for sysfs welcome...
Thanks,
Rusty.
PS. Jon, perhaps the new decade is a good time to kill modules.*map?
isapnp: move definitions to mod_devicetable.h so file2alias can reach them.
include/linux/isapnp.h +1 -7
@@ -43,10 +43,10 @@*/ #ifdef __KERNEL__ +#include <linux/mod_devicetable.h> #define DEVICE_COUNT_COMPATIBLE 4 -#define ISAPNP_ANY_ID 0xffff#define ISAPNP_CARD_DEVS 8#define ISAPNP_CARD_ID (_va, _vb, _vc, _device) \
@@ -74,12 +74,6 @@ struct isapnp_card_id {#define ISAPNP_DEVICE_SINGLE_END \ .card_vendor = 0, .card_device = 0 -struct isapnp_device_id { -unsigned short card_vendor, card_device; -unsigned short vendor, function; -unsigned long driver_data;/* data private to the driver */ -}; -#if defined(CONFIG_ISAPNP ) || (defined(CONFIG_ISAPNP_MODULE ) && defined(MODULE ))#define __ISAPNP__
include/linux/mod_devicetable.h +7 -0
@@ -474,4 +474,11 @@ struct platform_device_id { __attribute__((aligned(sizeof(kernel_ulong_t)))); }; +#define ISAPNP_ANY_ID 0xffff +struct isapnp_device_id { +unsigned short card_vendor, card_device; +unsigned short vendor, function; +kernel_ulong_t driver_data;/* data private to the driver */ +}; +#endif /* LINUX_MOD_DEVICETABLE_H */
isapnp: put aliases in .modinfo so modinfo can find them.
Once isa devices publish a modalias field, I think udev should "Just Work".
scripts/mod/file2alias.c +17 -0
@@ -727,6 +727,19 @@ static int do_platform_entry(const charreturn 1 ; } +/* Format is: isa:cvNcdNvNfN */ +static int do_isapnp_entry (const char *filename, +struct isapnp_device_id *id,char *alias) +{ +strcpy (alias,"isa:" ); +ADD (alias,"cv" , id->card_vendor !=ISAPNP_ANY_ID , id->card_vendor); +ADD (alias,"cd" , id->card_device !=ISAPNP_ANY_ID , id->card_device); +ADD (alias,"v" , id->vendor !=ISAPNP_ANY_ID , id->vendor); +ADD (alias,"f" , id->function, id->function); +add_wildcard (alias); +return 1 ; +} +/* Ignore any prefix, eg. some architectures prepend _ */ static inline int sym_is (const char *symbol,const char *name) {
@@ -874,6 +887,10 @@ void handle_moddevtable(struct module *mdo_table (symval, sym->st_size,sizeof (struct platform_device_id ),"platform" , do_platform_entry, mod); + else if (sym_is(symname, "__mod_isapnp_device_table")) + do_table(symval, sym->st_size, + sizeof(struct isapnp_device_id), "isa", + do_isapnp_entry, mod);free (zeros ); }
At Mon, 23 Nov 2009 13:59:53 +1030,
Quoted 7 lines · Rusty Russell
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.AFAICT it always has, and noone has complained until now. Perhaps something was still reading
/lib/modules/uname -r/modules.isapnpmap?
I don't think modules.isapnpmap is needed again.
The question came from the fact that the isapnp device wasn't loaded automatically.
But, I thought Kay already added isapnp support sometime ago, but it didn't seem to get in... Kay?
Quoted 4 lines
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)
There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice.
thanks,
Takashi
Quoted 100 lines
The first patches would look something like these. We could mangle the PNP names a-la ISAPNP_VENDOR/ISAPNP_DEVICE, but as long as the published modalias matches the file2alias result, it doesn't matter.
Jaroslav? Greg? Patches for sysfs welcome...
Thanks,
Rusty.
PS. Jon, perhaps the new decade is a good time to kill modules.*map?isapnp: move definitions to
mod_devicetable.hso file2alias can reach them.Signed-off-by Rusty Russell <[email protected]>include/linux/isapnp.h +1
-7@@ -43,10 +43,10 @@*/ #ifdef __KERNEL__ +#include <linux/mod_devicetable.h> #define DEVICE_COUNT_COMPATIBLE 4 -#define ISAPNP_ANY_ID 0xffff#define ISAPNP_CARD_DEVS 8#define ISAPNP_CARD_ID (_va, _vb, _vc, _device) \@@ -74,12 +74,6 @@ struct isapnp_card_id {#define ISAPNP_DEVICE_SINGLE_END \ .card_vendor = 0, .card_device = 0 -struct isapnp_device_id { -unsigned short card_vendor, card_device; -unsigned short vendor, function; -unsigned long driver_data;/* data private to the driver */ -}; -#if defined(CONFIG_ISAPNP ) || (defined(CONFIG_ISAPNP_MODULE ) && defined(MODULE ))#define __ISAPNP__include/linux/mod_devicetable.h +7
-0@@ -474,4 +474,11 @@ struct platform_device_id { __attribute__((aligned(sizeof(kernel_ulong_t)))); }; +#define ISAPNP_ANY_ID 0xffff +struct isapnp_device_id { +unsigned short card_vendor, card_device; +unsigned short vendor, function; +kernel_ulong_t driver_data;/* data private to the driver */ +}; +#endif /* LINUX_MOD_DEVICETABLE_H */ isapnp: put aliases in .modinfo so modinfo can find them.
Once isa devices publish a modalias field, I think udev should "Just Work".
Signed-off-by Rusty Russell <[email protected]>scripts/mod/file2alias.c +17
-0@@ -727,6 +727,19 @@ static int do_platform_entry(const charreturn 1 ; } +/* Format is: isa:cvNcdNvNfN */ +static int do_isapnp_entry (const char *filename, +struct isapnp_device_id *id,char *alias) +{ +strcpy (alias,"isa:" ); +ADD (alias,"cv" , id->card_vendor !=ISAPNP_ANY_ID , id->card_vendor); +ADD (alias,"cd" , id->card_device !=ISAPNP_ANY_ID , id->card_device); +ADD (alias,"v" , id->vendor !=ISAPNP_ANY_ID , id->vendor); +ADD (alias,"f" , id->function, id->function); +add_wildcard (alias); +return 1 ; +} +/* Ignore any prefix, eg. some architectures prepend _ */ static inline int sym_is (const char *symbol,const char *name) {@@ -874,6 +887,10 @@ void handle_moddevtable(struct module *mdo_table (symval, sym->st_size,sizeof (struct platform_device_id ),"platform" , do_platform_entry, mod); + else if (sym_is(symname, "__mod_isapnp_device_table")) + do_table(symval, sym->st_size, + sizeof(struct isapnp_device_id), "isa", + do_isapnp_entry, mod);free (zeros ); }
Quoted 7 lines · Takashi Iwai
At Mon, 23 Nov 2009 13:59:53 +1030,
Quoted 5 lines · Rusty Russell
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.
Quoted 6 lines
Quoted 2 lines
AFAICT it always has, and noone has complained until now. Perhaps something was still reading
/lib/modules/uname -r/modules.isapnpmap?I don't think modules.isapnpmap is needed again.
The question came from the fact that the isapnp device wasn't loaded automatically.
All the map files are not uses for anything these days. Ideally, depmod should just stop creating these dead files.
Quoted 2 lines
But, I thought Kay already added isapnp support sometime ago, but it didn't seem to get in... Kay?
No, we don't even have proper modaliases for the pnp bus (/sys/bus/pnp) and the alias string for pnp in the modules have a broken and unfixable format. PNP autoloading is all handled by the acpi modaliases these days. This is the first time in years I hear anybody asking for hotplug setups of plain old pnp devices. :)
Thanks,
Kay
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Rusty Russell
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice.
Without pnp, I don't think you can enumerate the ISA bus. Hence I chose "isa:" in the hope that udev would "just work" if isapnp created the modalias under /sys/bus/isa...
But Kay says there's a pnp bus (who knew?). I don't know what he means by unfixable aliases tho, since it's all in the kernel source so we can change it at any time?
Thanks,
Rusty.
Quoted 18 lines · Kay Sievers
Quoted 7 lines · Takashi Iwai
At Mon, 23 Nov 2009 13:59:53 +1030,
Quoted 4 lines · Rusty Russell
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.Quoted 6 lines
Quoted 2 lines
AFAICT it always has, and noone has complained until now. Perhaps something was still reading
/lib/modules/uname -r/modules.isapnpmap?I don't think modules.isapnpmap is needed again.
The question came from the fact that the isapnp device wasn't loaded automatically.All the map files are not uses for anything these days. Ideally, depmod should just stop creating these dead files.
Quoted 8 lines
Quoted 2 lines
But, I thought Kay already added isapnp support sometime ago, but it didn't seem to get in... Kay?
No, we don't even have proper modaliases for the pnp bus (
/sys/bus/pnp) and the alias string for pnp in the modules have a broken and unfixable format. PNP autoloading is all handled by the acpi modaliases these days. This is the first time in years I hear anybody asking for hotplug setups of plain old pnp devices. :)
Added these two lines to modules.alias (and deleted modules.alias.bin):
alias acpi*:RTL8019:* ne
alias pnp:dRTL8019* ne
and it works. This works too:
alias acpi*:PNP80d6:* ne
alias pnp:dPNP80d6* ne
The card has two IDs (as some PnP devices do) and both work.
Signature · 1 line
Ondrej Zary
Quoted 10 lines · Rusty Russell
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Rusty Russell
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice.
Quoted 7 lines
Without pnp, I don't think you can enumerate the ISA bus. Hence I chose "isa:" in the hope that udev would "just work" if isapnp created the modalias under
/sys/bus/isa...But Kay says there's a pnp bus (who knew?). I don't know what he means by unfixable aliases tho, since it's all in the kernel source so we can change it at any time?
Here's a bit of the background:
The aliases in the modules can only match a single value, but PNP devices often have vendor specific IDs and usual IDs describing the function.
Like here, where the interesting ID is only the second one of the two for a single device:
$ grep . /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/00:09/id:LEN0006 /sys/bus/pnp/devices/00:09/id:PNP0f13
So the kernel device would need to compose a "modalias" string with all IDs in a single line. But the in-module aliases can unfortunately match only on a single value, like:
alias pnp:dPNP0700* floppy
For that reason, a while ago udev switched to acpi aliases entirely, and dropped all pnp: usage. The acpi aliases can handle multi-values just fine with single strings like:
$ cat /sys/bus/acpi/devices/LEN0006:00/modalias acpi:LEN0006:PNP0F13:
alias acpi*:PNP0700:* floppy
Udev does not use any pnp: or /sys/bus/pnp/ values since a while. But there might be still distros who use the (broken) pnp: aliases and ship the (also broken) shell scripts to iterate over the sysfs devices and call modprobe for all they find.
Thanks,
Kay
Quoted 29 lines · Ondrej Zary
Quoted 18 lines · Kay Sievers
Quoted 7 lines · Takashi Iwai
At Mon, 23 Nov 2009 13:59:53 +1030,
Quoted 4 lines · Rusty Russell
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.Quoted 6 lines
Quoted 2 lines
AFAICT it always has, and noone has complained until now. Perhaps something was still reading
/lib/modules/uname -r/modules.isapnpmap?I don't think modules.isapnpmap is needed again.
The question came from the fact that the isapnp device wasn't loaded automatically.All the map files are not uses for anything these days. Ideally, depmod should just stop creating these dead files.
Quoted 8 lines
Quoted 2 lines
But, I thought Kay already added isapnp support sometime ago, but it didn't seem to get in... Kay?
No, we don't even have proper modaliases for the pnp bus (
/sys/bus/pnp) and the alias string for pnp in the modules have a broken and unfixable format. PNP autoloading is all handled by the acpi modaliases these days. This is the first time in years I hear anybody asking for hotplug setups of plain old pnp devices. :)
Quoted 7 lines
Added these two lines to modules.alias (and deleted modules.alias.bin):
alias acpi*:RTL8019:* ne
alias pnp:dRTL8019* neand it works. This works too:
alias acpi*:PNP80d6:* ne
alias pnp:dPNP80d6* ne
Oh, your box has acpi mapped pnp aliases for this device? You can see your ID string somewhere in this list?
grep . /sys/bus/acpi/devices/*/modalias
If not, is it in the pnp bus list?
grep . /sys/bus/pnp/devices/*/id
Thanks,
Kay
Quoted 1 line · On Tuesday 24 November 2009 09:57:28 Kay Sievers wrote:
On Tue, Nov 24, 2009 at 08:29, Ondrej Zary <[email protected]>
Quoted 37 lines · wrote:
Quoted 29 lines · Kay Sievers
Quoted 19 lines · Takashi Iwai
Quoted 7 lines
At Mon, 23 Nov 2009 13:59:53 +1030,
Quoted 4 lines · Rusty Russell
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.Quoted 7 lines
Quoted 3 lines
AFAICT it always has, and noone has complained until now. Perhaps something was still reading
/lib/modules/uname -r/modules.isapnpmap?I don't think modules.isapnpmap is needed again.
The question came from the fact that the isapnp device wasn't loaded automatically.All the map files are not uses for anything these days. Ideally, depmod should just stop creating these dead files.
Quoted 8 lines
Quoted 2 lines
But, I thought Kay already added isapnp support sometime ago, but it didn't seem to get in... Kay?
No, we don't even have proper modaliases for the pnp bus (
/sys/bus/pnp) and the alias string for pnp in the modules have a broken and unfixable format. PNP autoloading is all handled by the acpi modaliases these days. This is the first time in years I hear anybody asking for hotplug setups of plain old pnp devices. :)Quoted 7 lines
Added these two lines to modules.alias (and deleted modules.alias.bin):
alias acpi*:RTL8019:* ne
alias pnp:dRTL8019* neand it works. This works too:
alias acpi*:PNP80d6:* ne
alias pnp:dPNP80d6* ne
Quoted 6 lines
Oh, your box has acpi mapped pnp aliases for this device? You can see your ID string somewhere in this list?
grep ./sys/bus/acpi/devices/*/modaliasIf not, is it in the pnp bus list?
grep ./sys/bus/pnp/devices/*/id
It's listen in the pnp bus only:
$ grep -i 80d6 /sys/bus/acpi/devices/*/modalias $ grep -i 80d6 /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/01:01.00/id:PNP80d6 $ cat /sys/bus/pnp/devices/01\:01.00/id RTL8019 PNP80d6
So the acpi alias was useless (I just copied another entry). This alone works:
alias pnp:dPNP80d6* ne
Signature · 1 line
Ondrej Zary
Quoted 19 lines · Kay Sievers
Quoted 10 lines · Rusty Russell
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Rusty Russell
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice.
Quoted 7 lines
Without pnp, I don't think you can enumerate the ISA bus. Hence I chose "isa:" in the hope that udev would "just work" if isapnp created the modalias under
/sys/bus/isa...But Kay says there's a pnp bus (who knew?). I don't know what he means by unfixable aliases tho, since it's all in the kernel source so we can change it at any time?
Quoted 5 lines
Here's a bit of the background:
The aliases in the modules can only match a single value, but PNP devices often have vendor specific IDs and usual IDs describing the function.
I'm confused. You can have multiple aliases in a module. Many do.
Quoted 11 lines
Like here, where the interesting ID is only the second one of the two for a single device:
$ grep . /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/00:09/id:LEN0006 /sys/bus/pnp/devices/00:09/id:PNP0f13So the kernel device would need to compose a "modalias" string with all IDs in a single line. But the in-module aliases can unfortunately match only on a single value, like:
alias pnp:dPNP0700* floppy
Quoted 7 lines
For that reason, a while ago udev switched to acpi aliases entirely, and dropped all pnp: usage. The acpi aliases can handle multi-values just fine with single strings like:
$ cat /sys/bus/acpi/devices/LEN0006:00/modalias acpi:LEN0006:PNP0F13:alias acpi*:PNP0700:* floppy
Then why didn't you change the pnp modalias format to be more like the ACPI one?
(I know nothing about ACPI or PNP, so maybe I'm missing something fundamental).
Thanks,
Rusty.
Quoted 20 lines · Rusty Russell
Quoted 19 lines · Kay Sievers
Quoted 17 lines · Rusty Russell
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Rusty Russell
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice.
Without pnp, I don't think you can enumerate the ISA bus. Hence I chose "isa:" in the hope that udev would "just work" if isapnp created the modalias under
/sys/bus/isa...But Kay says there's a pnp bus (who knew?). I don't know what he means by unfixable aliases tho, since it's all in the kernel source so we can change it at any time?
Quoted 7 lines
Quoted 5 lines
Here's a bit of the background:
The aliases in the modules can only match a single value, but PNP devices often have vendor specific IDs and usual IDs describing the function.
I'm confused. You can have multiple aliases in a module. Many do.
Sure, but we have only a single modalias string to match against. The aliases need to be in a form where they can match the modalias string containing more than a single entry. The current ones can't do that, but they were known to be used by some systems with hacky shell scripts or custom modprobe configs to load pnp device modules.
Quoted 17 lines
Quoted 17 lines
Like here, where the interesting ID is only the second one of the two for a single device:
$ grep . /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/00:09/id:LEN0006 /sys/bus/pnp/devices/00:09/id:PNP0f13So the kernel device would need to compose a "modalias" string with all IDs in a single line. But the in-module aliases can unfortunately match only on a single value, like:
alias pnp:dPNP0700* floppyFor that reason, a while ago udev switched to acpi aliases entirely, and dropped all pnp: usage. The acpi aliases can handle multi-values just fine with single strings like:
$ cat /sys/bus/acpi/devices/LEN0006:00/modalias acpi:LEN0006:PNP0F13:
Quoted 4 lines
Quoted 1 line
alias acpi*:PNP0700:* floppy
Then why didn't you change the pnp modalias format to be more like the ACPI one?
I'm all for doing that, but the current ones are used in old shell script hacks and custom modprobe configs. Not sure, if that is still something we need to care about. As mentioned, for that reason, upstream udev dropped all that a while ago and supports only acpi aliases today. At the moment we decide not to care about the possible old users anymore, we could change the pnp aliases to a sane format.
Quoted 1 line
(I know nothing about ACPI or PNP, so maybe I'm missing something fundamental).
I think you don't miss anything, it's just a bit hard sometimes to get rid of old users, even when they use the stuff in a wrong way. :)
Thanks,
Kay
Quoted 18 lines · Ondrej Zary
Quoted 6 lines · On Tuesday 24 November 2009 09:57:28 Kay Sievers wrote:
Oh, your box has acpi mapped pnp aliases for this device? You can see your ID string somewhere in this list?
grep ./sys/bus/acpi/devices/*/modaliasIf not, is it in the pnp bus list?
grep ./sys/bus/pnp/devices/*/idIt's listen in the pnp bus only:
$ grep -i 80d6 /sys/bus/acpi/devices/*/modalias $ grep -i 80d6 /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/01:01.00/id:PNP80d6 $ cat /sys/bus/pnp/devices/01\:01.00/id RTL8019 PNP80d6
Quoted 2 lines
So the acpi alias was useless (I just copied another entry). This alone works:
alias pnp:dPNP80d6* ne
I see. Plain upstream udev would not load anything here, as the pnp bus has no modalias support because of the non-working aliases. We rely on acpi mapping all the pnp entries. Your system probably runs the shell script which iterates over the "id" file and calls modprobe for all it finds in there.
Kay
Quoted 1 line · Kay Sievers
On Tue, Nov 24, 2009 at 22:23, Ondrej Zary <[email protected]>
Quoted 17 lines · wrote:
Quoted 17 lines · On Tuesday 24 November 2009 09:57:28 Kay Sievers wrote:
Quoted 6 lines
Oh, your box has acpi mapped pnp aliases for this device? You can see your ID string somewhere in this list?
grep ./sys/bus/acpi/devices/*/modaliasIf not, is it in the pnp bus list?
grep ./sys/bus/pnp/devices/*/idIt's listen in the pnp bus only:
$ grep -i 80d6 /sys/bus/acpi/devices/*/modalias $ grep -i 80d6 /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/01:01.00/id:PNP80d6 $ cat /sys/bus/pnp/devices/01\:01.00/id RTL8019 PNP80d6
Quoted 8 lines
Quoted 2 lines
So the acpi alias was useless (I just copied another entry). This alone
works: alias pnp:dPNP80d6* neI see. Plain upstream udev would not load anything here, as the pnp bus has no modalias support because of the non-working aliases. We rely on acpi mapping all the pnp entries. Your system probably runs the shell script which iterates over the "id" file and calls modprobe for all it finds in there.
It's Debian Squeeze.
Signature · 1 line
Ondrej Zary
Hi,
Quoted 7 lines · Kay Sievers <kay.sievers <at> vrfy.org> writes:
No, we don't even have proper modaliases for the pnp bus (
/sys/bus/pnp) and the alias string for pnp in the modules have a broken and unfixable format. PNP autoloading is all handled by the acpi modaliases these days. This is the first time in years I hear anybody asking for hotplug setups of plain old pnp devices. :)
The naming is really bad. This as nothing to do with acpi : pnp and pnp_cards entries are duplicated to another naming. And this should work on system without
acpi.
This should have been named to pnp2 or something like that.
Now I don't see why isapnp_device_id and pnp_card_device_id can't be merged together.
For example most of alsa isa card use pnp_card_device_id and not isapnp_device_id.
Matthieu
Quoted 8 lines · Matthieu CASTET
Quoted 7 lines · Kay Sievers <kay.sievers <at> vrfy.org> writes:
No, we don't even have proper modaliases for the pnp bus (
/sys/bus/pnp) and the alias string for pnp in the modules have a broken and unfixable format. PNP autoloading is all handled by the acpi modaliases these days. This is the first time in years I hear anybody asking for hotplug setups of plain old pnp devices. :)
Quoted 5 lines
The naming is really bad. This as nothing to do with acpi : pnp and
pnp_cardsentries are duplicated to another naming. And this should work on system without
acpi.
This should have been named to pnp2 or something like that.
I don' think there is anything like a second version, it's just that acpi handles the same pnp ids natively, so we added (non-broken) matches for it, which works properly on almost all current boxes. If someone wants to finally fix pnp and get proper modalias working, the acpi alias generation in the pnp modules can be reverted without trouble.
Quoted 5 lines
Now I don't see why
isapnp_device_idandpnp_card_device_idcan't be merged together.For example most of alsa isa card use
pnp_card_device_idand notisapnp_device_id.
It's just that nobody really cared, I guess. I wouldn't be surprised, if this is just another round of "discussion" like we had so many about this topic the past years, and nothing will happen to pnp/isapnp. :)
Kay
Quoted 25 lines · On Tuesday 24 November 2009 09:53:51 Kay Sievers wrote:
Quoted 10 lines · Rusty Russell
Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Rusty Russell
Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)There is non-pnp ISA bus, so I'm afraid "isa" may conflict. I suppose "isapnp" would be a safer choice.
Quoted 7 lines
Without pnp, I don't think you can enumerate the ISA bus. Hence I chose "isa:" in the hope that udev would "just work" if isapnp created the modalias under
/sys/bus/isa...But Kay says there's a pnp bus (who knew?). I don't know what he means by unfixable aliases tho, since it's all in the kernel source so we can change it at any time?
Here's a bit of the background:
The aliases in the modules can only match a single value, but PNP devices often have vendor specific IDs and usual IDs describing the function.
Quoted 5 lines
Like here, where the interesting ID is only the second one of the two for a single device:
$ grep . /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/00:09/id:LEN0006 /sys/bus/pnp/devices/00:09/id:PNP0f13
It's the same for my RTL8019 card:
$ grep . /sys/bus/pnp/devices/*/id /sys/bus/pnp/devices/01:01.00/id:RTL8019 /sys/bus/pnp/devices/01:01.00/id:PNP80d6
and it works with this (which could be easily generated from the current ne module, I think):
alias pnp:dPNP80d6* ne
This works fine too:
alias pnp:dRTL8019* ne
alias pnp:dPNP80d6* ne
Quoted 20 lines
So the kernel device would need to compose a "modalias" string with all IDs in a single line. But the in-module aliases can unfortunately match only on a single value, like:
alias pnp:dPNP0700* floppyFor that reason, a while ago udev switched to acpi aliases entirely, and dropped all pnp: usage. The acpi aliases can handle multi-values just fine with single strings like:
$ cat /sys/bus/acpi/devices/LEN0006:00/modalias acpi:LEN0006:PNP0F13:alias acpi*:PNP0700:* floppy
Udev does not use any pnp: or
/sys/bus/pnp/values since a while. But there might be still distros who use the (broken) pnp: aliases and ship the (also broken) shell scripts to iterate over the sysfs devices and call modprobe for all they find.Thanks,
Kay
Signature · 1 line
Ondrej Zary
Quoted 102 lines · On Monday 23 November 2009 04:29:53 Rusty Russell wrote:
Quoted 2 lines · Ondrej Zary
The problem is that
scripts/mod/file2alias.csimply ignores isapnp.AFAICT it always has, and noone has complained until now. Perhaps something was still reading
/lib/modules/uname -r/modules.isapnpmap?Two things are required:
1) Modify file2alias to add aliases for isapnp. This is pretty easy.
2) Expose the isapnp devices in sysfs where udev will match them up (/sys/bus/isa/devices/<dev>/modalias I guess?)The first patches would look something like these. We could mangle the PNP names a-la ISAPNP_VENDOR/ISAPNP_DEVICE, but as long as the published modalias matches the file2alias result, it doesn't matter.
Jaroslav? Greg? Patches for sysfs welcome...
Thanks,
Rusty.
PS. Jon, perhaps the new decade is a good time to kill modules.*map?isapnp: move definitions to
mod_devicetable.hso file2alias can reach them.Signed-off-by Rusty Russell <[email protected]>include/linux/isapnp.h +1
-7@@ -43,10 +43,10 @@*/ #ifdef __KERNEL__ +#include <linux/mod_devicetable.h> #define DEVICE_COUNT_COMPATIBLE 4 -#define ISAPNP_ANY_ID 0xffff#define ISAPNP_CARD_DEVS 8#define ISAPNP_CARD_ID (_va, _vb, _vc, _device) \@@ -74,12 +74,6 @@ struct isapnp_card_id {#define ISAPNP_DEVICE_SINGLE_END \ .card_vendor = 0, .card_device = 0 -struct isapnp_device_id { -unsigned short card_vendor, card_device; -unsigned short vendor, function; -unsigned long driver_data;/* data private to the driver */ -}; -#if defined(CONFIG_ISAPNP ) || (defined(CONFIG_ISAPNP_MODULE ) && defined(MODULE ))#define
__ISAPNP__(quoted diff) +0
-0
b/include/linux/mod_devicetable.h---a/include/linux/mod_devicetable.h+++b/include/linux/mod_devicetable.hinclude/linux/isapnp.h +7
-0@@ -474,4 +474,11 @@ struct platform_device_id { __attribute__((aligned(sizeof(kernel_ulong_t)))); }; +#define ISAPNP_ANY_ID 0xffff +struct isapnp_device_id { +unsigned short card_vendor, card_device; +unsigned short vendor, function; +kernel_ulong_t driver_data;/* data private to the driver */ +}; +#endif /* LINUX_MOD_DEVICETABLE_H */ isapnp: put aliases in .modinfo so modinfo can find them.
Once isa devices publish a modalias field, I think udev should "Just Work".
Signed-off-by Rusty Russell <[email protected]>scripts/mod/file2alias.c +13
-0@@ -727,6 +727,19 @@ static int do_platform_entry(const charreturn 1 ; } +/* Format is: isa:cvNcdNvNfN */ +static int do_isapnp_entry (const char *filename, +struct isapnp_device_id *id,char *alias) +{ +strcpy (alias,"isa:" ); +ADD (alias,"cv" , id->card_vendor !=ISAPNP_ANY_ID , id->card_vendor); +ADD (alias,"cd" , id->card_device !=ISAPNP_ANY_ID , id->card_device); +ADD (alias,"v" , id->vendor !=ISAPNP_ANY_ID , id->vendor); +ADD (alias,"f" , id->function, id->function); +add_wildcard (alias); +return 1 ; +} +/* Ignore any prefix, eg. some architectures prepend _ */ static inline int sym_is (const char *symbol,const char *name) {
scripts/mod/file2alias.c void handle_moddevtable(struct module *m · line 895
Quoted 9 lines
scripts/mod/file2alias.c +4
-0@@ -874,6 +887,10 @@ void handle_moddevtable(struct module *mdo_table (symval, sym->st_size,sizeof (struct platform_device_id ),"platform" , do_platform_entry, mod); + else if (sym_is(symname, "__mod_isapnp_device_table")) + do_table(symval, sym->st_size, + sizeof(struct isapnp_device_id), "isa", + do_isapnp_entry, mod);free (zeros ); }
The above patch did not work. However, the patch below works fine (at least with Debian). It needs your first patch that moves the definitions to mod_devicetable.h. Verified that aliases for these modules are generated correctly:drivers/media/radio/radio-sf16fmi.cdrivers/net/ne.cdrivers/net/3c515.cdrivers/net/smc-ultra.cdrivers/pcmcia/i82365.cdrivers/scsi/aha1542.cdrivers/scsi/aha152x.cdrivers/scsi/sym53c416.cdrivers/scsi/g_NCR5380.c
Tested with RTL8019AS (ne), AVA-1505AE (aha152x) and dtc436e (g_NCR5380) cards - they now work automatically.
Found that drivers/isdn/hisax/hisax_fcpcipnp.c has broken pnp device table - wrong type (isapnp instead of pnp) and also ending record missing.
Generate pnp:d aliases for isapnp_device_tables. This allows udev to load these modules automatically.
scripts/mod/file2alias.c +17 -0
@@ -727,6 +727,19 @@ static int do_platform_entry(const charreturn 1 ; } +/* looks like: "pnp:dD" */ +static int do_isapnp_entry (const char *filename, +struct isapnp_device_id *id,char *alias) +{ +sprintf (alias,"pnp:d%c%c%c%x%x%x%x*" , +'A' + ((id->vendor >>2 ) &0x3f ) -1 , +'A' + (((id->vendor &3 ) <<3 ) | ((id->vendor >>13 ) &7 )) -1 , +'A' + ((id->vendor >>8 ) &0x1f ) -1 , + (id->function >>4 ) &0x0f , id->function &0x0f , + (id->function >>12 ) &0x0f , (id->function >>8 ) &0x0f ); +return 1 ; +} +/* Ignore any prefix, eg. some architectures prepend _ */ static inline int sym_is (const char *symbol,const char *name) {
@@ -874,6 +887,10 @@ void handle_moddevtable(struct module *mdo_table (symval, sym->st_size,sizeof (struct platform_device_id ),"platform" , do_platform_entry, mod); + else if (sym_is(symname, "__mod_isapnp_device_table")) + do_table(symval, sym->st_size, + sizeof(struct isapnp_device_id), "isa", + do_isapnp_entry, mod);free (zeros ); }
hisax_fcpcipnp: fix broken isapnp device table.
drivers/isdn/hisax/hisax_fcpcipnp.c +2 -1
@@ -74,9 +74,10 @@ static struct pnp_device_id fcpnp_ids[] .id = "AVM0900", .driver_data = (unsigned long) "Fritz!Card PnP", }, + { .id = "" } }; -MODULE_DEVICE_TABLE (isapnp, fcpnp_ids); +MODULE_DEVICE_TABLE (pnp, fcpnp_ids);#endif static int protocol =2 ;/* EURO-ISDN Default */
Signature · 1 line
Ondrej Zary
Quoted 4 lines · Ondrej Zary
Generate pnp:d aliases for
isapnp_device_tables. This allows udev to load these modules automatically.Signed-off-by Ondrej Zary <[email protected]>
I'm happy with this, so I've separated and taken them. Too late for the merge window I'm afraid, but it'll be in next one.
Thanks,
Rusty.
Quoted 8 lines · Rusty Russell
Quoted 4 lines · Ondrej Zary
Generate pnp:d aliases for
isapnp_device_tables. This allows udev to load these modules automatically.Signed-off-by Ondrej Zary <[email protected]>I'm happy with this, so I've separated and taken them. Too late for the merge window I'm afraid, but it'll be in next one.
When will this go in?
Signature · 1 line
Ondrej Zary
Quoted 11 lines · Ondrej Zary
Quoted 8 lines · Rusty Russell
Quoted 4 lines · Ondrej Zary
Generate pnp:d aliases for
isapnp_device_tables. This allows udev to load these modules automatically.Signed-off-by Ondrej Zary <[email protected]>I'm happy with this, so I've separated and taken them. Too late for the merge window I'm afraid, but it'll be in next one.
When will this go in?
Sorry, my bad. It was at the back of my queue and got lost.
It'd be nice for it to go in, but it needs at least a few days in linux-next, simple as it is. Linus is unlikely to believe me if I tell him it's suddenly urgent.
Sorry,
Rusty.