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