]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/MODULE_PNP_INFO.9
MFV r307315:
[FreeBSD/FreeBSD.git] / share / man / man9 / MODULE_PNP_INFO.9
1 .\" Copyright (c) 2018 Conrad Meyer <cem@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd February 12, 2018
28 .Dt MODULE_PNP_INFO 9
29 .Os
30 .Sh NAME
31 .Nm MODULE_PNP_INFO
32 .Nd register plug and play information for device matching
33 .\"
34 .Sh SYNOPSIS
35 .In sys/module.h
36 .Fo MODULE_PNP_INFO
37 .Fa "const char *descriptor_string"
38 .Fa "bus"
39 .Fa "module"
40 .Fa "void *table"
41 .Fa "size_t entry_len"
42 .Fa "size_t num_entries"
43 .Fc
44 .\"
45 .Sh DESCRIPTION
46 The
47 .Fn MODULE_PNP_INFO
48 macro registers a
49 .Fa table
50 of device-identifying data for use by
51 .Xr devmatch 8 .
52 .Pp
53 The macro takes a
54 .Fa descriptor_string
55 that describes the memory layout of table entries.
56 The string is a series of members separated by semi-colons.
57 Members are identified by a type and a name.
58 They are encoded in the descriptor string by concatenating the type with a
59 colon, followed by the name.
60 (The special type
61 .Vt W32
62 represents two members.
63 The first name is encoded like any other type.
64 The second name is encoded by appending a forward slash and the second
65 name after the first.)
66 .Pp
67 Types are one of the following:
68 .Bl -tag -width U16
69 .It Dq Vt U8
70 .Vt uint8_t
71 element.
72 .It Dq Vt V8
73 Same as
74 .Vt U8 ,
75 except that the sentinel value 0xFF matches any.
76 .It Dq Vt G16
77 .Vt uint16_t
78 element; any value greater than or equal matches.
79 .It Dq Vt L16
80 .Vt uint16_t
81 element; any value less than or equal matches.
82 .It Dq Vt M16
83 .Vt uint16_t
84 element; mask of which of the following fields to use.
85 .It Dq Vt U16
86 .Vt uint16_t
87 element.
88 .It Dq Vt V16
89 Same as
90 .Vt U16 ,
91 except that the sentinel value 0xFFFF matches any.
92 .It Dq Vt U32
93 .Vt uint32_t
94 element.
95 .It Dq Vt V32
96 Same as
97 .Vt U32 ,
98 except that the sentinel value 0xFFFFFFFF matches any.
99 .It Dq Vt W32
100 Two
101 .Vt uint16_t
102 values; the first named member is in the least significant word and the second
103 named member is in the most significant word.
104 .It Dq Vt Z
105 A pointer to a string to match exactly.
106 .It Dq Vt D
107 A pointer to a human readable description for the device.
108 .It Dq Vt P
109 A pointer that should be ignored.
110 .It Dq Vt E
111 EISA PNP Identifier.
112 .It Dq Vt T
113 PNP info that's true for the for the whole table.
114 The driver code checks for these condition pragmatically before using
115 this table to match devices.
116 This item must come last in the list.
117 .El
118 .Pp
119 The pseudo-name
120 .Dq #
121 is reserved for fields that should be ignored.
122 Any member that does not match the parent device's pnpinfo output must be
123 ignored.
124 .Pp
125 The
126 .Fa bus
127 parameter is an unquoted word naming the parent bus of the driver.
128 For example,
129 .Dq pci .
130 .Pp
131 The
132 .Fa module
133 parameter is also an unquoted word.
134 It must be unique to the driver.
135 Usually the driver's name is used.
136 .Pp
137 The
138 .Fa table
139 parameter points to the device matching data with entries matching the
140 .Fa descriptor_string .
141 .Pp
142 The
143 .Fa entry_len
144 parameter is the size of each table entry, i.e.,
145 .Ql sizeof(table[0]) .
146 .Pp
147 The
148 .Fa num_entries
149 parameter is the number of entries in the table, i.e.,
150 .Ql nitems(table) .
151 Note that only valid entries should be included.
152 If the table contains trailing zero or bogus values, they should not be
153 included in
154 .Fa num_entries .
155 .\"
156 .Sh EXAMPLES
157 .Bd -literal -offset indent -compact
158 #include <sys/param.h>
159 #include <sys/module.h>
160 static struct my_pciids {
161         uint32_t devid;
162         const char *desc;
163 } my_ids[] = {
164         { 0x12345678, "Foo bar" },
165         { 0x9abcdef0, "Baz fizz" },
166 };
167 MODULE_PNP_INFO("W32:vendor/device", pci, my_driver, my_ids, sizeof(my_ids[0]),
168     nitems(my_ids));
169 .Ed
170 .\"
171 .Sh SEE ALSO
172 .Xr module 9 ,
173 .Xr DRIVER_MODULE 9 ,
174 .Xr devmatch 8
175 .Sh HISTORY
176 The macro
177 .Nm
178 appeared in
179 .Fx 12.0 .
180 .Sh AUTHORS
181 The PNP framework and
182 .Xr devmatch 8
183 utility were written by
184 .An Warner Losh Aq Mt imp@FreeBSD.org .