1 .\" Copyright (c) 2018 Conrad Meyer <cem@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .Nd register plug and play information for device matching
37 .Fa "const char *descriptor_string"
41 .Fa "size_t num_entries"
49 of device-identifying data for use by
51 Since it is built off module marking macros, it must follow a
57 that describes the memory layout of table entries.
58 The string is a series of members separated by semi-colons.
59 Members are identified by a type and a name.
60 They are encoded in the descriptor string by concatenating the type with a
61 colon, followed by the name.
64 represents two members.
65 The first name is encoded like any other type.
66 The second name is encoded by appending a forward slash and the second
67 name after the first.)
69 Types are one of the following:
77 except that the sentinel value 0xFF matches any.
80 element; any value greater than or equal matches.
83 element; any value less than or equal matches.
86 element; mask of which of the following fields to use.
93 except that the sentinel value 0xFFFF matches any.
100 except that the sentinel value 0xFFFFFFFF matches any.
104 values; the first named member is in the least significant word and the second
105 named member is in the most significant word.
107 A pointer to a string to match exactly.
109 A pointer to a human readable description for the device.
111 A pointer that should be ignored.
115 PNP info that is true for the whole table.
116 The driver code checks for these condition pragmatically before using
117 this table to match devices.
118 This item must come last in the list.
123 is reserved for fields that should be ignored.
124 Any member that does not match the parent device's pnpinfo output must be
129 parameter is an unquoted word naming the parent bus of the driver.
135 parameter is also an unquoted word.
136 It must be unique to the driver.
137 Usually the driver's name is used.
141 parameter points to the device matching data with entries matching the
142 .Fa descriptor_string .
146 parameter is the number of entries in the table, i.e.,
148 Note that only valid entries should be included.
149 If the table contains trailing zero or bogus values, they should not be
155 .It Sy Example 1\&: No Using W32 for vendor/device pair
157 The following example shows usage of
159 type when vendor/device values are combined into single
163 #include <sys/param.h>
164 #include <sys/module.h>
166 static struct my_pciids {
170 { 0x12345678, "Foo bar" },
171 { 0x9abcdef0, "Baz fizz" },
174 MODULE_PNP_INFO("W32:vendor/device;D:#", pci, my_driver, my_ids,
177 .It Sy Example 2\&: No Using T for common vendor value
179 The following example shows usage of
181 type when all entries in the table have the same vendor value:
183 #include <sys/param.h>
184 #include <sys/module.h>
186 static struct my_pciids {
190 { 0x9abc, "Foo bar" },
191 { 0xdef0, "Baz fizz" },
194 MODULE_PNP_INFO("U16:device;D:#;T:vendor=0x1234", pci, my_driver,
195 my_ids, nitems(my_ids));
204 invocations due to limitations in the
209 .Xr DRIVER_MODULE 9 ,
217 The PNP framework and
219 utility were written by
220 .An Warner Losh Aq Mt imp@FreeBSD.org .