2 mods with same PCI-ID table, one installs, other fails modprobe
Jim Cromie
jim.cromie at gmail.com
Thu Sep 8 17:48:54 EDT 2011
(aside - whats the correct ML? Ive used both suggested by my mail interface)
I have 2 modules with same modinfo alias,
one installs, the other gets -ENODEV.
Id expect them to both act the same.
What am I missing ?
root at voyage:~# modprobe geode-aes
root at voyage:~# lsmod |grep geode_aes
geode_aes 4229 0
root at voyage:~# modprobe geode-rng
dynamic_debug:ddebug_remove_module: removing module "geode_rng"
FATAL: Error inserting geode_rng
(/lib/modules/3.0.0-skc-dyndbg+/kernel/drivers/char/hw_random/geode-rng.ko):
No such device
root at voyage:~# modinfo geode-aes
filename:
/lib/modules/3.0.0-skc-dyndbg+/kernel/drivers/crypto/geode-aes.ko
license: GPL
description: Geode LX Hardware AES driver
author: Advanced Micro Devices, Inc.
alias: pci:v00001022d00002082sv*sd*bc*sc*i*
depends:
vermagic: 3.0.0-skc-dyndbg+ preempt mod_unload modversions GEODEGX1
root at voyage:~# modinfo geode-rng
filename:
/lib/modules/3.0.0-skc-dyndbg+/kernel/drivers/char/hw_random/geode-rng.ko
license: GPL
description: H/W RNG driver for AMD Geode LX CPUs
alias: pci:v00001022d00002082sv*sd*bc*sc*i*
depends: rng-core
vermagic: 3.0.0-skc-dyndbg+ preempt mod_unload modversions GEODEGX1
IE both have same alias, and (unsurprisingly) the same DEVICE_ID.
geode-rng's 1 dependency isnt the problem:
root at voyage:~# modprobe rng-core
root at voyage:~# lsmod |grep rng
rng_core 3010 0
DEVICE-IDs:
jimc at chumly:~/projects/lx/linux-2.6/drivers/crypto$ grep PCI_DEV geode-aes.c
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_LX_AES), } ,
jimc at chumly:~/projects/lx/linux-2.6/drivers/crypto$ cd ../char/hw_random/
jimc at chumly:~/projects/lx/linux-2.6/drivers/char/hw_random$ grep
PCI_DEV geode-rng.c
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_LX_AES), 0, },
hmmm. is that trailing 0 important ?
Id think not, {..} is a literal constant assignment, 0 is only sensible default.
The apparent diff is how the __init is done.
static struct pci_device_id geode_aes_tbl[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_LX_AES), } ,
{ 0, }
};
MODULE_DEVICE_TABLE(pci, geode_aes_tbl);
static struct pci_driver geode_aes_driver = {
.name = "Geode LX AES",
.id_table = geode_aes_tbl,
.probe = geode_aes_probe,
.remove = __devexit_p(geode_aes_remove)
};
static int __init
geode_aes_init(void)
{
return pci_register_driver(&geode_aes_driver);
}
geode-rng does it the (older?) more manual way:
static int __init mod_init(void)
{
int err = -ENODEV;
struct pci_dev *pdev = NULL;
const struct pci_device_id *ent;
void __iomem *mem;
unsigned long rng_base;
for_each_pci_dev(pdev) {
ent = pci_match_id(pci_tbl, pdev);
if (ent)
goto found;
}
/* Device not found. */
goto out;
found:
...
Qs
1 - why do they differ in modprobe results ?
bug likely ??
2 - which is correct ? success or failure ?
FWIW, heres my PCI devices.
The CPU is an SC1100 - its a Geode, but not a Geode-GX or LX
(though the distinctions arent as clear as Id like :-/)
root at voyage:~# lspci -nn
00:00.0 Host bridge [0600]: Cyrix Corporation PCI Master [1078:0001]
00:06.0 Ethernet controller [0200]: National Semiconductor Corporation
DP83815 (MacPhyter) Ethernet Controller [100b:0020]
00:07.0 Ethernet controller [0200]: National Semiconductor Corporation
DP83815 (MacPhyter) Ethernet Controller [100b:0020]
00:08.0 Ethernet controller [0200]: National Semiconductor Corporation
DP83815 (MacPhyter) Ethernet Controller [100b:0020]
00:0a.0 Ethernet controller [0200]: Belkin Wireless PCI Card - F5D6001
[1799:6001] (rev 20)
00:0e.0 Ethernet controller [0200]: Marvell Technology Group Ltd.
88W8361 [TopDog] 802.11n Wireless [11ab:2a02] (rev 03)
00:12.0 ISA bridge [0601]: National Semiconductor Corporation SC1100
Bridge [100b:0510]
00:12.1 Bridge [0680]: National Semiconductor Corporation SC1100 SMI &
ACPI [100b:0511]
00:12.2 IDE interface [0101]: National Semiconductor Corporation
SCx200, SC1100 IDE controller [100b:0502] (rev 01)
00:12.5 Bridge [0680]: National Semiconductor Corporation SC1100 XBus
[100b:0515]
00:13.0 USB Controller [0c03]: Compaq Computer Corporation ZFMicro
Chipset USB [0e11:a0f8] (rev 08)
Specifically, theres no AMD ID in the output
root at voyage:~# lspci -nn |grep 1022
root at voyage:~# lspci -nn |grep 100b
00:06.0 Ethernet controller [0200]: National Semiconductor Corporation
DP83815 (MacPhyter) Ethernet Controller [100b:0020]
>From all this, it seems that the failure to install is correct,
which suggests some bug in pci_register_driver,
but its hard to imagine that - otherwize its survived (well hidden)
for a long time
More information about the Kernelnewbies
mailing list