This series of patches does some PNP housecleaning and
consolidation.
PNP currently uses a fixed-size table (pnp_resource_table)
to track the IO, MMIO, IRQ, and DMA resources used by a
device. Some motherboard devices have many resources, so
we've been plagued by table overflows and we've had to
drastically increase the table size, which wastes a lot
of memory.
The end goal is to replace that fixed-size table with something
more dynamic. These patches don't go that far, but they do make
pnp_resource_table private to the PNP core and centralize all
references to it in a small set of shared functions.
In addition, this series contains a number of related
cleanups, like centralized allocation of struct pnp_dev,
conversion to dev_printk when possible, removing many
PNP core internal functions from the public interface,
and alignment of the ISAPNP, PNPBIOS, and PNPACPI backends.
Bjorn
--
i386:
#1 errs.ACPI.ACPI_DEBUG.ACPI_PROCFS.HIBERNATION.X86_LOCAL_APIC.X86_IO_APIC
Cleaning...Building...
ERROR: "pnp_get_resource" [sound/oss/sb.ko] undefined!
ERROR: "pnp_get_resource" [sound/oss/ad1848.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/wavefront/snd-wavefront.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-sscape.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-opl3sa2.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-es18xx.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-dt019x.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-cmi8330.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-azt2320.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/snd-als100.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/sb/snd-sbawe.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/sb/snd-sb16.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/sb/snd-es968.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/opti9xx/snd-opti93x.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/opti9xx/snd-opti92x-cs4231.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/opti9xx/snd-opti92x-ad1848.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/gus/snd-interwave.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/gus/snd-interwave-stb.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/cs423x/snd-cs4236.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/cs423x/snd-cs4232.ko] undefined!
ERROR: "pnp_get_resource" [sound/isa/ad1816a/snd-ad1816a.ko] undefined!
ERROR: "pnp_get_resource" [sound/drivers/mpu401/snd-mpu401.ko] undefined!
ERROR: "pnp_get_resource" [drivers/watchdog/sc1200wdt.ko] undefined!
ERROR: "pnp_get_resource" [drivers/telephony/ixj.ko] undefined!
ERROR: "pnp_get_resource" [drivers/scsi/sym53c416.ko] undefined!
ERROR: "pnp_get_resource" [drivers/scsi/g_NCR5380_mmio.ko] undefined!
ERROR: "pnp_get_resource" [drivers/scsi/g_NCR5380.ko] undefined!
ERROR: "pnp_get_resource" [drivers/scsi/aha1542.ko] undefined!
ERROR: "pnp_get_resource" [drivers/scsi/aha152x.ko] undefined!
ERROR: "pnp_get_resource" [drivers/pcmcia/i82365.ko] undefined!
ERROR: "pnp_get_resource" [drivers/parport/parport_pc.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/smc-ultra.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/sb1000.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/ne.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/irda/smsc-ircc2.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/irda/nsc-ircc.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/3c515.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/3c509.ko] undefined!
ERROR: "pnp_get_resource" [drivers/mmc/host/wbsd.ko] undefined!
ERROR: "pnp_get_resource" [drivers/media/radio/radio-sf16fmi.ko] undefined!
ERROR: "pnp_get_resource" [drivers/media/radio/radio-cadet.ko] undefined!
ERROR: "pnp_get_resource" [drivers/isdn/hisax/hisax_fcpcipnp.ko] undefined!
ERROR: "pnp_get_resource" [drivers/isdn/hisax/hisax.ko] undefined!
ERROR: "pnp_get_resource" [drivers/input/gameport/ns558.ko] undefined!
ERROR: "pnp_get_resource" [drivers/ide/ide-pnp.ko] undefined!
ERROR: "pnp_get_resource" [drivers/char/tpm/tpm_tis.ko] undefined!
ERROR: "pnp_get_resource" [drivers/char/tpm/tpm_infineon.ko] undefined!
Build FAILED
x86_64:
#33 errs.allmodconfig
Cleaning...Building...
ERROR: "pnp_get_resource" [sound/oss/sb.ko] undefined!
ERROR: "pnp_get_resource" [sound/drivers/mpu401/snd-mpu401.ko] undefined!
ERROR: "pnp_get_resource" [drivers/watchdog/sc1200wdt.ko] undefined!
ERROR: "pnp_get_resource" [drivers/serial/8250_pnp.ko] undefined!
ERROR: "pnp_get_resource" [drivers/rtc/rtc-cmos.ko] undefined!
ERROR: "pnp_get_resource" [drivers/parport/parport_pc.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/sb1000.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/irda/smsc-ircc2.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/irda/nsc-ircc.ko] undefined!
ERROR: "pnp_get_resource" [drivers/mmc/host/wbsd.ko] undefined!
ERROR: "pnp_get_resource" [drivers/input/serio/i8042.ko] undefined!
ERROR: "pnp_get_resource" [drivers/input/gameport/ns558.ko] undefined!
ERROR: "pnp_get_resource" [drivers/ide/ide-pnp.ko] undefined!
ERROR: "pnp_get_resource" [drivers/char/tpm/tpm_tis.ko] undefined!
ERROR: "pnp_get_resource" [drivers/char/tpm/tpm_infineon.ko] undefined!
Build FAILED
ia64:
#9 errs.allmodconfig
Cleaning...Building...
ERROR: "pnp_get_resource" [sound/drivers/mpu401/snd-mpu401.ko] undefined!
ERROR: "pnp_get_resource" [drivers/serial/8250_pnp.ko] undefined!
ERROR: "pnp_get_resource" [drivers/parport/parport_pc.ko] undefined!
ERROR: "pnp_get_resource" [drivers/net/sb1000.ko] undefined!
ERROR: "pnp_get_resource" [drivers/input/serio/i8042.ko] undefined!
ERROR: "pnp_get_resource" [drivers/input/gameport/ns558.ko] undefined!
ERROR: "pnp_get_resource" [drivers/ide/ide-pnp.ko] undefined!
ERROR: "pnp_get_resource" [drivers/char/tpm/tpm_tis.ko] undefined!
ERROR: "pnp_get_resource" [drivers/char/tpm/tpm_infineon.ko] undefined!
Build FAILED
On Wednesday 26 March 2008 04:42:10 pm Len Brown wrote:
> i386:
>
> #1 errs.ACPI.ACPI_DEBUG.ACPI_PROCFS.HIBERNATION.X86_LOCAL_APIC.X86_IO_APIC
> Cleaning...Building...
> ERROR: "pnp_get_resource" [sound/oss/sb.ko] undefined!
> ERROR: "pnp_get_resource" [sound/oss/ad1848.ko] undefined!
Oops, sorry, I forgot to export pnp_get_resource(). I'll post an
updated patch as a response to the original. Is that easy for you
to handle, Len? If not, let me know what you'd prefer.
Bjorn
On 27-03-08 00:13, Bjorn Helgaas wrote:
> Oops, sorry, I forgot to export pnp_get_resource(). I'll post an updated
> patch as a response to the original. Is that easy for you to handle,
> Len? If not, let me know what you'd prefer.
Works for me at least. Only had time for a quick test. After applying these,
my snd-cs4236 driver ISAPnP soundcard is no longer found.
Rene.
On Wednesday 26 March 2008 06:30:16 pm Rene Herman wrote:
> On 27-03-08 00:13, Bjorn Helgaas wrote:
>
> > Oops, sorry, I forgot to export pnp_get_resource(). I'll post an updated
> > patch as a response to the original. Is that easy for you to handle,
> > Len? If not, let me know what you'd prefer.
>
> Works for me at least. Only had time for a quick test. After applying these,
> my snd-cs4236 driver ISAPnP soundcard is no longer found.
Are any ISAPNP devices at all found? It's possible I broke ISAPNP
completely, because I don't have anything to test it with. If you
have a chance, maybe you could turn on CONFIG_PNP_DEBUG and send me
a dmesg log.
Bjorn
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index c4b95b5..0a41e05 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -403,14 +403,12 @@ static void __init isapnp_skip_bytes(int count)
static void isapnp_to_pnpid(unsigned short vendor, unsigned short device,
char *id)
{
- id[0] = 'A' + ((vendor >> 2) & 0x3f) - 1;
- id[1] = 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1;
- id[2] = 'A' + ((vendor >> 8) & 0x1f) - 1;
- id[3] = '0' + ((device >> 4) & 0x0f);
- id[4] = '0' + (device & 0x0f);
- id[5] = '0' + ((device >> 12) & 0x0f);
- id[6] = '0' + ((device >> 8) & 0x0f);
- id[7] = '\0';
+ sprintf(id, "%c%c%c%x%x%x%x",
+ 'A' + ((vendor >> 2) & 0x3f) - 1,
+ 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
+ 'A' + ((vendor >> 8) & 0x1f) - 1,
+ (device >> 4) & 0x0f, device & 0x0f,
+ (device >> 12) & 0x0f, (device >> 8) & 0x0f);
}
/*
On 31-03-08 21:40, Rene Herman wrote:
> On 27-03-08 18:50, Bjorn Helgaas wrote:
>
>> Are any ISAPNP devices at all found?
>
> Yes, but at most 100 * 10^4 / 2^16 percent of them. Trouble is in 04/37:
Well, that should read "Yes, no less than 100 * 10^4 / 2^16 percent of them
even" but you get the point...
Rene.
On Monday 31 March 2008 01:40:03 pm Rene Herman wrote:
> On 27-03-08 18:50, Bjorn Helgaas wrote:
>
> > Are any ISAPNP devices at all found?
>
> Yes, but at most 100 * 10^4 / 2^16 percent of them. Trouble is in 04/37:
>
> http://lkml.org/lkml/2008/3/26/273
>
> The numeric part of the ID is a 4-digit hexadecimal value, not just decimal,
> so '0'+ don't work. Unfortunately, that one has a few dependents, so you'll
> probably want to restructure things yourself. If I just place the attached
> on top, the card's found again.
Ah, right. Thanks for tracking that down. I forgot to factor out
isapnp_to_pnpid() and pnpid32_to_pnpid() (and acpi_ex_eisa_id_to_string()
for that matter, though that's buried in the ACPI CA)-- they're really
doing the same thing and we should only need one copy (plus the CA
one).
> Not too much avail unfortunately, as I then get a resource assignment
> problem with your patches:
>
> pnp: the driver 'cs4236_isapnp' has been registered
> cs4236_isapnp 01:01.00: driver attached
> cs4236_isapnp 01:01.02: driver attached
> cs4236_isapnp 01:01.03: driver attached
> cs4236_isapnp 01:01.00: unable to assign resources
> CS4236+ WSS PnP configure failed for WSS (out of resources?)
> isapnp detection failed and probing for CS4236+ is not supported
>
> (and exact same thing for snd-es18xx) which I'll try to look at next, but
> this ID thing will certainly need a fix first.
Hmmm... that sounds harder. I'll read over it again and see if I
can figure anything out.
Bjorn
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 454290b..9ff76dc 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -261,7 +261,7 @@ int pnp_check_port(struct pnp_dev *dev, int idx)
if (tdev == dev)
continue;
for (i = 0;
- (tres = pnp_get_resource(dev, IORESOURCE_IO, i));
+ (tres = pnp_get_resource(tdev, IORESOURCE_IO, i));
i++) {
if (tres->flags & IORESOURCE_IO) {
if (cannot_compare(tres->flags))
@@ -325,7 +325,7 @@ int pnp_check_mem(struct pnp_dev *dev, int idx)
if (tdev == dev)
continue;
for (i = 0;
- (tres = pnp_get_resource(dev, IORESOURCE_MEM, i));
+ (tres = pnp_get_resource(tdev, IORESOURCE_MEM, i));
i++) {
if (tres->flags & IORESOURCE_MEM) {
if (cannot_compare(tres->flags))
@@ -408,7 +408,7 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
if (tdev == dev)
continue;
for (i = 0;
- (tres = pnp_get_resource(dev, IORESOURCE_IRQ, i));
+ (tres = pnp_get_resource(tdev, IORESOURCE_IRQ, i));
i++) {
if (tres->flags & IORESOURCE_IRQ) {
if (cannot_compare(tres->flags))
@@ -471,7 +471,7 @@ int pnp_check_dma(struct pnp_dev *dev, int idx)
if (tdev == dev)
continue;
for (i = 0;
- (tres = pnp_get_resource(dev, IORESOURCE_DMA, i));
+ (tres = pnp_get_resource(tdev, IORESOURCE_DMA, i));
i++) {
if (tres->flags & IORESOURCE_DMA) {
if (cannot_compare(tres->flags))