xref: /freebsd/share/man/man4/man4.i386/pnp.4 (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
1.\" pnp(4) - manual page for the scanner device driver `asc'
2.\"
3.\"
4.\" Copyright (c) 1997 Luigi Rizzo
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgements:
16.\"	This product includes software developed by Luigi Rizzo.
17.\" 4. The name of the author may not be used to endorse or promote products
18.\"    derived from this software without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30.\"
31.\" $FreeBSD$
32.\"
33.Dd September 7, 1997
34.Dt PNP 4 i386
35.Os FreeBSD
36.Sh NAME
37.Nm pnp
38.Nd support for PnP devices
39.Sh SYNOPSIS
40.Cd controller pnp0
41.Sh DESCRIPTION
42Support for PnP devices in FreeBSD allows the user to override the
43configuration of PnP cards, and device drivers to fetch/modify
44parameters in the card's configuration space.
45.Pp
46The manual override mechanism requires the kernel to be compiled with
47.Cd options USERCONFIG.
48In this case, the kernel keeps a table of fixed size (20 entries as a
49default) where configuration data are held for PnP devices. Each
50PnP card can contain several independent devices (5 or 6 is not
51unusual).
52.Pp
53By booting the kernel with the
54.Dq Fl c
55flag, commands are available to
56modify the configuration of PnP cards. Commands start with the
57sequence:
58.Dl pnp CSN LDN
59where CSN and LDN are the Card Select Number and Logical Device Number
60associated to the device. Following this sequence any combination of
61the following commands can be used:
62
63.Bl -tag -width "mmmmmmmmmm""
64.It Dv irqN line
65Sets the irq line for interrupt 0 or 1 on the card. Line=0 means the line
66is unused.
67.It Dv drqN n
68Sets the drq channel used for DMA 0 or 1 on the card. Channel=4 means
69the channel is unused.
70.It Dv portN address
71Sets the base address for the N-th port's range (N=0..7). address=0
72means that the port is not used.
73.It Dv memN address
74Sets the base address for the N-th memory's range (N=0..3). address=0
75means that the memory range is not used.
76.It Dv bios
77Makes the PnP device use the configuration set by the BIOS. This
78is the default, and is generally ok if your BIOS has PnP support.
79If BIOS is used, then other parameters are ignored except "flags".
80.It Dv os
81Makes the PnP device to use the configuration specified in this entry.
82.It Dv enable
83Enables the PnP device.
84.It Dv disable
85Disables the PnP device.
86.It Dv delete
87Frees the entry used for the device, so that it can be used for
88another device with a different CSN/LDN pair.
89.It Dv flags
90Sets the value of a 32-bit flags entry which is passed to the device
91driver. This can be used to set special operation modes (e.g. SB vs. WSS
92emulation on some sound cards, etc.).
93.El
94.Pp
95The current content of the table can be printed using the
96.Ic ls
97command in userconfig. In addition to modifications done by the user,
98the table contains an entry for
99all logical devices accessed by a PnP device driver.
100.Pp
101Modifications to
102the table will be saved to the boot image on the filesystem by the
103.Xr kget 8
104command.
105.Pp
106.Sh DEVICE DRIVER SUPPORT FOR PnP
107PnP devices are automatically recognized and configured by the kernel.
108A PnP device is identified by the following data structure:
109.Bd -literal
110struct pnp_device {
111	char	*pd_name;
112	char	*(*pd_probe ) (u_long csn, u_long vendor_id);
113	void	(*pd_attach ) (u_long csn, u_long vend_id, char * name,
114		    struct isa_device *dev);
115	u_long	*pd_count;
116	u_int	*imask;
117	struct	isa_device dev;
118};
119.Ed
120.Pp
121The probe routine must check that the vendor_id passed is a
122recognized one, that any necessary devices on the card are enabled,
123and returns a NULL value in case of failure or a non-NULL value
124(generally a pointer to the device name) unpon success.  In the probe
125routine, the function
126.Fn read_pnp_parms
127can be used to check that the logical devices are enabled.
128.Pp
129The attach routine should do all the necessary initialization, enable
130the PnP card to ISA accesses, fetch the configuration, and call the ISA
131driver for the device.
132.Pp
133The following routines and data structures can be used:
134.Bl -tag -width "xxxxxxxxxx"
135.It Dv struct pnp_cinfo
136This data structure (defined in /sys/i386/isa/pnp.h) contains all
137informations related to a PnP logical device.
138.It Fn read_pnp_parms "struct pnp_cinfo *d" "int ldn"
139This function returns the configuration of the requested
140logical device. It is not possible to specify a CSN since this function
141is only meant to be used during probe and attach routines
142.It Fn write_pnp_parms "struct pnp_cinfo *d" "int ldn"
143This function sets the parameters of the requested logical device. At
144the same time, it updates the entry in the kernel override table.
145Device drivers in general should
146.Em not
147modify the configuration of a device, since either the BIOS or the user
148(through userconfig) should know better what to do. In particular,
149device driver
150.Em should not enable
151a logical device which has
152been found disabled,
153since this would defeat the override mechanism in userconfig.
154Device
155drivers may disable a logical device, or a port range, etc, but should
156do so only that particular device or parameter is known to cause
157troubles.
158.It Fn enable_pnp_card void
159This function
160.Em must
161be used in the attach routine
162.Em only ,
163before accessing the card's ISA ports/memory address ranges.
164.El
165.Pp
166.Sh SEE ALSO
167.Xr kget 8
168.Sh BUGS
169There is no support for visual configuration of PnP devices.
170It would be nice to have commands in userconfig to fetch the
171configuration of PnP devices.
172.Sh AUTHORS
173PnP support was written by
174.An Luigi Rizzo ,
175based on initial work done by
176.An Sujal Patel .
177.Sh HISTORY
178The
179.Nm
180driver first appeared in
181.Fx 2.2.5 .
182