Skip to contentSkip to conversation

linux pnp layer

DISCUSSION Adam Belay 1 participant 1 message Oct 15, 2002 2 messages not in the archive

Subsystems (5)
Sound ACPI Pnp support Parallel port +1 more subsystems
lore
Share & tools
lore

Adam Belay

author
#2 lore raw
In reply to a message not in the archive
Quoted 1 line · Dominik Brodowski

Have you got any feedback on your pnp-layer-rewrite yet? I just tried to

Yes, and it has been positive and I have made a few changes that were suggested.

Here's a list:

The following are changes between versions 0.6 and 0.7:

1.)  Added PnP Support Debugging option
2.)  Cleanups for isapnp and pnpbios protocols
3.)  Added a global matching function for use by driver, names, quirks, and
compat
4.)  Added PnP Quirks
5.)  added several more names to the pnp name database
6.)  converted the opl3sa2 driver
7.)  converted the parport_pc driver
8.)  fixed potential bugs when PnP Support is not compiled
9.)  added pnp_alloc for memory allocation

10.) fixed a bug in the interface in which the string "INDEPENDENT:" was displayed even when it was not needed
11.) made the function portion of matching case insensitive
12.) added compatibility functions to make it easier to convert drivers that use the old isapnp APIs, drivers that are not converted will still compile but will not use PnP.
13.) fixed a bug in the isapnp protocol that was the result of an incorrect sync with 2.4.41.
14.) changed defconfig to reflect the new PnP options

The following are changes between versions 0.7 and 0.8:
1.) added isapnp lowlevel proc, should have never removed this - Thanks to Jaroslav for pointing this out
2.) added more ids - from Thomas
3.) removed __PNP__, use CONFIG_PNP now - thanks to Greg for pointing this out. 4.) reserve system resources is no longer a compile time option because there isn't a reason not to use it.
5.) device id cleanups
6.) disabled compile as module for pnp support, pnp support and all of its protocols currently cannot be compiled as a module. Eventually this may change, but is there any reason to compile them as a module anyway? I think it makes more sense not to becuase most of this is needed at boot time.
7.) added some comments, more documentation is coming.

Quoted 2 lines

download v0.6 - 2.5.40 from the mailing list archives at marc.theaimsgroup.com, but somehow it doesn't arrive here :-(

You may not be recieving it becuase of its size. Some archives filter out large messages. A copy of the latest version, 0.8, is attached. It's against 2.5.42. If you test it be sure to enable both protocols and pnp debug.

As you suggested, I'll forward this to Andrew Grover and the ACPI mailing list.

I'm interested in your comments.

Thanks,
Adam

CREDITS +5 -0
diff -ur --new-file --exclude *.flags a/CREDITS b/CREDITS
@@ -1750,6 +1750,11 @@
 S: 370 01  Ceske Budejovice
 S: Czech Republic
 
+N: Adam Belay
+E: ambx1-IBH0VoN/[email protected]
+D: Linux Plug and Play Support
+S: USA
+
 N: Bas Laarhoven
 E: sjml-qWit8jRvyhVmR6Xm/[email protected]
 D: Loadable modules and ftape driver
MAINTAINERS +2 -5
diff -ur --new-file --exclude *.flags a/MAINTAINERS b/MAINTAINERS
@@ -1293,11 +1293,8 @@
 S:	Maintained
 
 PNP SUPPORT
-P:	Tom Lees
-M:	tom-jMAA5W8IFouX/[email protected]
-L:	[email protected]
-L:	[email protected]
-W:	http://www-jcr.lmh.ox.ac.uk/~pnp/
+P:	Adam Belay
+M:	ambx1-IBH0VoN/[email protected]
 S:	Maintained
 
 PPP PROTOCOL DRIVERS AND COMPRESSORS
arch/i386/defconfig +4 -1
diff -ur --new-file --exclude *.flags a/arch/i386/defconfig b/arch/i386/defconfig
@@ -176,8 +176,11 @@
 # Plug and Play configuration
 #
 CONFIG_PNP=y
+CONFIG_PNP_NAMES=y
+CONFIG_PNP_SYSTEM=y
+# CONFIG_PNP_DEBUG is not set
 CONFIG_ISAPNP=y
-# CONFIG_PNPBIOS is not set
+CONFIG_PNPBIOS=y
 
 #
 # Block devices
drivers/parport/parport_pc.c +26 -3
diff -ur --new-file --exclude *.flags a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
@@ -52,6 +52,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
+#include <linux/pnp.h>
 #include <linux/sysctl.h>
 
 #include <asm/io.h>
@@ -2939,9 +2940,9 @@
 }
 
 static struct pci_driver parport_pc_pci_driver = {
-	name:		"parport_pc",
-	id_table:	parport_pc_pci_tbl,
-	probe:		parport_pc_pci_probe,
+	.name		= "parport_pc",
+	.id_table	= parport_pc_pci_tbl,
+	.probe		= parport_pc_pci_probe,
 };
 
 static int __init parport_pc_init_superio (int autoirq, int autodma)
@@ -2968,6 +2969,25 @@
 static int __init parport_pc_init_superio(int autoirq, int autodma) {return 0;}
 #endif /* CONFIG_PCI */
 
+#ifdef CONFIG_PNP
+static const struct pnp_id pnp_dev_table[] = {
+	/* Standard LPT Printer Port */
+	{.id = "PNP0400", .driver_data = 0},
+	/* ECP Printer Port */
+	{.id = "PNP0401", .driver_data = 0},
+	{.id = ""}
+};
+
+/* we only need the pnp layer to activate the device, at least for now */
+static struct pnp_driver parport_pc_pnp_driver = {
+	.name		= "parport_pc",
+	.card_id_table	= NULL,
+	.id_table	= pnp_dev_table,
+};
+#else
+static const struct pnp_driver parport_pc_pnp_driver;
+#endif
+
 /* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */
 static int __init __attribute__((unused))
 parport_pc_find_isa_ports (int autoirq, int autodma)
@@ -3020,6 +3040,8 @@
 
 int __init parport_pc_init (int *io, int *io_hi, int *irq, int *dma)
 {
+	/* try to activate any PnP parports first */
+	pnp_register_driver(&parport_pc_pnp_driver);
 	int count = 0, i = 0;
 
 	if (io && *io) {
@@ -3133,5 +3155,6 @@
 
 		p = tmp;
 	}
+	pnp_unregister_driver (&parport_pc_pnp_driver);
 }
 #endif
drivers/pnp/Config.help +18 -11
diff -ur --new-file --exclude *.flags a/drivers/pnp/Config.help b/drivers/pnp/Config.help
@@ -6,15 +6,22 @@
   or using a user-space utility.
 
   Say Y here if you would like Linux to configure your Plug and Play
-  devices. You should then also say Y to "ISA Plug and Play support",
-  below. Alternatively, you can say N here and configure your PnP
-  devices using the user space utilities contained in the isapnptools
-  package.
-
-  This support is also available as a module ( = code which can be
-  inserted in and removed from the running kernel whenever you want).
-  If you want to compile it as a module, say M here and read
-  <file:Documentation/modules.txt>.
+  devices. You should then also say Y to all of the protocols below.
+  Alternatively, you can say N here and configure your PnP devices
+  using user space utilities such as the isapnptools package.
+
+  If unsure, say Y.
+
+CONFIG_PNP_NAMES
+  Select Y if you want the Plug and Play Layer to keep a database of
+  human readable names for your PnP devices.  It will increase the size
+  of the kernel image by around 5 KB and use 16 KB of system memory.
+
+  If unsure, say Y.
+
+CONFIG_PNP_DEBUG
+  Say Y if you want the Plug and Play Layer to print debug messages.  
+  This is useful if you are developing a PnP driver or troubleshooting.
 
 CONFIG_ISAPNP
   Say Y here if you would like support for ISA Plug and Play devices.
@@ -32,8 +39,8 @@
   Specification Version 1.0A May 5, 1994" to autodetect built-in
   mainboard resources (e.g. parallel port resources).
 
-  Other features (e.g. change resources, ESCD, event notification,
-  Docking station information, ISAPNP services) are not used.
+  Some features (e.g. event notification, docking station information,
+  ISAPNP services) are not used.
 
   Note: ACPI is expected to supersede PNPBIOS some day, currently it
   co-exists nicely.
drivers/pnp/Config.in +7 -4
diff -ur --new-file --exclude *.flags a/drivers/pnp/Config.in b/drivers/pnp/Config.in
@@ -4,12 +4,15 @@
 mainmenu_option next_comment
 comment 'Plug and Play configuration'
 
-tristate 'Plug and Play support' CONFIG_PNP
+dep_bool 'Plug and Play support' CONFIG_PNP
 
-dep_tristate '  ISA Plug and Play support' CONFIG_ISAPNP $CONFIG_PNP
+   dep_bool '  Plug and Play device name database' CONFIG_PNP_NAMES $CONFIG_PNP
+   dep_bool '  PnP Debug Messages' CONFIG_PNP_DEBUG $CONFIG_PNP
+
+comment 'Protocols' $CONFIG_PNP
 
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-   dep_bool '  PNPBIOS support (EXPERIMENTAL)' CONFIG_PNPBIOS $CONFIG_PNP
+   dep_bool '  ISA Plug and Play support (EXPERIMENTAL)' CONFIG_ISAPNP $CONFIG_PNP
+   dep_bool '  Plug and Play BIOS support (EXPERIMENTAL)' CONFIG_PNPBIOS $CONFIG_PNP
 fi
-
 endmenu
drivers/pnp/Makefile +5 -9
diff -ur --new-file --exclude *.flags a/drivers/pnp/Makefile b/drivers/pnp/Makefile
@@ -1,16 +1,12 @@
 #
-# Makefile for the kernel Plug-and-Play device drivers.
+# Makefile for the Linux Plug-and-Play Support.
 #
 
-export-objs := isapnp.o pnpbios_core.o
+obj-y		:= core.o driver.o resource.o interface.o quirks.o names.o compat.o system.o
 
-isa-pnp-proc-$(CONFIG_PROC_FS) = isapnp_proc.o
-pnpbios-proc-$(CONFIG_PROC_FS) = pnpbios_proc.o
+obj-$(CONFIG_PNPBIOS)		+= pnpbios/
+obj-$(CONFIG_ISAPNP)		+= isapnp/
 
-isa-pnp-objs := isapnp.o quirks.o $(isa-pnp-proc-y)
-pnpbios-objs := pnpbios_core.o $(pnpbios-proc-y)
-
-obj-$(CONFIG_ISAPNP) += isa-pnp.o
-obj-$(CONFIG_PNPBIOS) += pnpbios.o
+export-objs	:= core.o driver.o resource.o compat.o
 
 include $(TOPDIR)/Rules.make
drivers/pnp/base.h +8 -0
diff -ur --new-file --exclude *.flags a/drivers/pnp/base.h b/drivers/pnp/base.h
@@ -0,0 +1,8 @@
+extern struct bus_type pnp_bus_type;
+extern spinlock_t pnp_lock;
+extern void *pnp_alloc(long size);
+extern int pnp_interface_attach_device(struct pnp_dev *dev);
+extern void pnp_name_device(struct pnp_dev *dev);
+extern void pnp_fixup_device(struct pnp_dev *dev);
+extern int compare_pnp_id(struct list_head * id_list, char * id);
+
drivers/pnp/compat.c +92 -0

92 lines not on this page · raw message

drivers/pnp/core.c +134 -0

134 lines not on this page · raw message

drivers/pnp/driver.c +189 -0

189 lines not on this page · raw message

drivers/pnp/idlist.h +321 -0

321 lines not on this page · raw message

drivers/pnp/interface.c +342 -0

342 lines not on this page · raw message

drivers/pnp/isapnp/Makefile +11 -0
diff -ur --new-file --exclude *.flags a/drivers/pnp/isapnp/Makefile b/drivers/pnp/isapnp/Makefile
@@ -0,0 +1,11 @@
+#
+# Makefile for the kernel ISAPNP driver.
+#
+
+export-objs := core.o
+
+isapnp-proc-$(CONFIG_PROC_FS) = proc.o
+
+obj-y := core.o $(isapnp-proc-y)
+
+include $(TOPDIR)/Rules.make
drivers/pnp/isapnp/core.c +1193 -0

1,193 lines not on this page · raw message

drivers/pnp/isapnp/proc.c +171 -0

171 lines not on this page · raw message

drivers/pnp/isapnp.c +0 -2514

364 lines not on this page · raw message

drivers/pnp/isapnp_proc.c +0 -1134

1,134 lines not on this page · raw message

drivers/pnp/names.c +51 -0

51 lines not on this page · raw message

drivers/pnp/pnpbios/Makefile +11 -0
diff -ur --new-file --exclude *.flags a/drivers/pnp/pnpbios/Makefile b/drivers/pnp/pnpbios/Makefile

Lines of this file are not shown. View the raw message.

drivers/pnp/pnpbios/core.c +1571 -0

1,571 lines not on this page · raw message

drivers/pnp/pnpbios/proc.c +279 -0

279 lines not on this page · raw message

drivers/pnp/pnpbios_core.c +0 -1350

1,350 lines not on this page · raw message

drivers/pnp/pnpbios_proc.c +0 -279

279 lines not on this page · raw message

drivers/pnp/quirks.c +65 -75

140 lines not on this page · raw message

drivers/pnp/resource.c +798 -0

798 lines not on this page · raw message

drivers/pnp/system.c +123 -0

123 lines not on this page · raw message

drivers/serial/8250_pnp.c +50 -152

202 lines not on this page · raw message

drivers/serial/Makefile +1 -1
diff -ur --new-file --exclude *.flags a/drivers/serial/Makefile b/drivers/serial/Makefile

Lines of this file are not shown. View the raw message.

include/linux/isapnp.h +29 -20

49 lines not on this page · raw message

include/linux/pnp.h +282 -0

282 lines not on this page · raw message

include/linux/pnpbios.h +1 -74

75 lines not on this page · raw message

sound/oss/ad1848.c +18 -27

45 lines not on this page · raw message

sound/oss/opl3sa2.c +64 -104

168 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.