~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/pnp.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/admin-guide/pnp.rst (Version linux-6.12-rc7) and /Documentation/admin-guide/pnp.rst (Version linux-5.14.21)


  1 =================================                   1 =================================
  2 Linux Plug and Play Documentation                   2 Linux Plug and Play Documentation
  3 =================================                   3 =================================
  4                                                     4 
  5 :Author: Adam Belay <ambx1@neo.rr.com>               5 :Author: Adam Belay <ambx1@neo.rr.com>
  6 :Last updated: Oct. 16, 2002                        6 :Last updated: Oct. 16, 2002
  7                                                     7 
  8                                                     8 
  9 Overview                                            9 Overview
 10 --------                                           10 --------
 11                                                    11 
 12 Plug and Play provides a means of detecting an     12 Plug and Play provides a means of detecting and setting resources for legacy or
 13 otherwise unconfigurable devices.  The Linux P     13 otherwise unconfigurable devices.  The Linux Plug and Play Layer provides these 
 14 services to compatible drivers.                    14 services to compatible drivers.
 15                                                    15 
 16                                                    16 
 17 The User Interface                                 17 The User Interface
 18 ------------------                                 18 ------------------
 19                                                    19 
 20 The Linux Plug and Play user interface provide     20 The Linux Plug and Play user interface provides a means to activate PnP devices
 21 for legacy and user level drivers that do not      21 for legacy and user level drivers that do not support Linux Plug and Play.  The 
 22 user interface is integrated into sysfs.           22 user interface is integrated into sysfs.
 23                                                    23 
 24 In addition to the standard sysfs file the fol     24 In addition to the standard sysfs file the following are created in each
 25 device's directory:                                25 device's directory:
 26 - id - displays a list of support EISA IDs         26 - id - displays a list of support EISA IDs
 27 - options - displays possible resource configu     27 - options - displays possible resource configurations
 28 - resources - displays currently allocated res     28 - resources - displays currently allocated resources and allows resource changes
 29                                                    29 
 30 activating a device                                30 activating a device
 31 ^^^^^^^^^^^^^^^^^^^                                31 ^^^^^^^^^^^^^^^^^^^
 32                                                    32 
 33 ::                                                 33 ::
 34                                                    34 
 35         # echo "auto" > resources                  35         # echo "auto" > resources
 36                                                    36 
 37 this will invoke the automatic resource config     37 this will invoke the automatic resource config system to activate the device
 38                                                    38 
 39 manually activating a device                       39 manually activating a device
 40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                       40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 41                                                    41 
 42 ::                                                 42 ::
 43                                                    43 
 44         # echo "manual <depnum> <mode>" > reso     44         # echo "manual <depnum> <mode>" > resources
 45                                                    45 
 46         <depnum> - the configuration number        46         <depnum> - the configuration number
 47         <mode> - static or dynamic                 47         <mode> - static or dynamic
 48                  static = for next boot            48                  static = for next boot
 49                  dynamic = now                     49                  dynamic = now
 50                                                    50 
 51 disabling a device                                 51 disabling a device
 52 ^^^^^^^^^^^^^^^^^^                                 52 ^^^^^^^^^^^^^^^^^^
 53                                                    53 
 54 ::                                                 54 ::
 55                                                    55 
 56         # echo "disable" > resources               56         # echo "disable" > resources
 57                                                    57 
 58                                                    58 
 59 EXAMPLE:                                           59 EXAMPLE:
 60                                                    60 
 61 Suppose you need to activate the floppy disk c     61 Suppose you need to activate the floppy disk controller.
 62                                                    62 
 63 1. change to the proper directory, in my case      63 1. change to the proper directory, in my case it is
 64    /driver/bus/pnp/devices/00:0f::                 64    /driver/bus/pnp/devices/00:0f::
 65                                                    65 
 66         # cd /driver/bus/pnp/devices/00:0f         66         # cd /driver/bus/pnp/devices/00:0f
 67         # cat name                                 67         # cat name
 68         PC standard floppy disk controller         68         PC standard floppy disk controller
 69                                                    69 
 70 2. check if the device is already active::         70 2. check if the device is already active::
 71                                                    71 
 72         # cat resources                            72         # cat resources
 73         DISABLED                                   73         DISABLED
 74                                                    74 
 75   - Notice the string "DISABLED".  This means      75   - Notice the string "DISABLED".  This means the device is not active.
 76                                                    76 
 77 3. check the device's possible configurations      77 3. check the device's possible configurations (optional)::
 78                                                    78 
 79         # cat options                              79         # cat options
 80         Dependent: 01 - Priority acceptable        80         Dependent: 01 - Priority acceptable
 81             port 0x3f0-0x3f0, align 0x7, size      81             port 0x3f0-0x3f0, align 0x7, size 0x6, 16-bit address decoding
 82             port 0x3f7-0x3f7, align 0x0, size      82             port 0x3f7-0x3f7, align 0x0, size 0x1, 16-bit address decoding
 83             irq 6                                  83             irq 6
 84             dma 2 8-bit compatible                 84             dma 2 8-bit compatible
 85         Dependent: 02 - Priority acceptable        85         Dependent: 02 - Priority acceptable
 86             port 0x370-0x370, align 0x7, size      86             port 0x370-0x370, align 0x7, size 0x6, 16-bit address decoding
 87             port 0x377-0x377, align 0x0, size      87             port 0x377-0x377, align 0x0, size 0x1, 16-bit address decoding
 88             irq 6                                  88             irq 6
 89             dma 2 8-bit compatible                 89             dma 2 8-bit compatible
 90                                                    90 
 91 4. now activate the device::                       91 4. now activate the device::
 92                                                    92 
 93         # echo "auto" > resources                  93         # echo "auto" > resources
 94                                                    94 
 95 5. finally check if the device is active::         95 5. finally check if the device is active::
 96                                                    96 
 97         # cat resources                            97         # cat resources
 98         io 0x3f0-0x3f5                             98         io 0x3f0-0x3f5
 99         io 0x3f7-0x3f7                             99         io 0x3f7-0x3f7
100         irq 6                                     100         irq 6
101         dma 2                                     101         dma 2
102                                                   102 
103 also there are a series of kernel parameters::    103 also there are a series of kernel parameters::
104                                                   104 
105         pnp_reserve_irq=irq1[,irq2] ....          105         pnp_reserve_irq=irq1[,irq2] ....
106         pnp_reserve_dma=dma1[,dma2] ....          106         pnp_reserve_dma=dma1[,dma2] ....
107         pnp_reserve_io=io1,size1[,io2,size2] .    107         pnp_reserve_io=io1,size1[,io2,size2] ....
108         pnp_reserve_mem=mem1,size1[,mem2,size2    108         pnp_reserve_mem=mem1,size1[,mem2,size2] ....
109                                                   109 
110                                                   110 
111                                                   111 
112 The Unified Plug and Play Layer                   112 The Unified Plug and Play Layer
113 -------------------------------                   113 -------------------------------
114                                                   114 
115 All Plug and Play drivers, protocols, and serv    115 All Plug and Play drivers, protocols, and services meet at a central location
116 called the Plug and Play Layer.  This layer is    116 called the Plug and Play Layer.  This layer is responsible for the exchange of 
117 information between PnP drivers and PnP protoc    117 information between PnP drivers and PnP protocols.  Thus it automatically 
118 forwards commands to the proper protocol.  Thi    118 forwards commands to the proper protocol.  This makes writing PnP drivers 
119 significantly easier.                             119 significantly easier.
120                                                   120 
121 The following functions are available from the    121 The following functions are available from the Plug and Play Layer:
122                                                   122 
123 pnp_get_protocol                                  123 pnp_get_protocol
124   increments the number of uses by one            124   increments the number of uses by one
125                                                   125 
126 pnp_put_protocol                                  126 pnp_put_protocol
127   deincrements the number of uses by one          127   deincrements the number of uses by one
128                                                   128 
129 pnp_register_protocol                             129 pnp_register_protocol
130   use this to register a new PnP protocol         130   use this to register a new PnP protocol
131                                                   131 
132 pnp_unregister_protocol                           132 pnp_unregister_protocol
133   use this function to remove a PnP protocol f    133   use this function to remove a PnP protocol from the Plug and Play Layer
134                                                   134 
135 pnp_register_driver                               135 pnp_register_driver
136   adds a PnP driver to the Plug and Play Layer    136   adds a PnP driver to the Plug and Play Layer
137                                                   137 
138   this includes driver model integration          138   this includes driver model integration
139   returns zero for success or a negative error    139   returns zero for success or a negative error number for failure; count
140   calls to the .add() method if you need to kn    140   calls to the .add() method if you need to know how many devices bind to
141   the driver                                      141   the driver
142                                                   142 
143 pnp_unregister_driver                             143 pnp_unregister_driver
144   removes a PnP driver from the Plug and Play     144   removes a PnP driver from the Plug and Play Layer
145                                                   145 
146                                                   146 
147                                                   147 
148 Plug and Play Protocols                           148 Plug and Play Protocols
149 -----------------------                           149 -----------------------
150                                                   150 
151 This section contains information for PnP prot    151 This section contains information for PnP protocol developers.
152                                                   152 
153 The following Protocols are currently availabl    153 The following Protocols are currently available in the computing world:
154                                                   154 
155 - PNPBIOS:                                        155 - PNPBIOS:
156     used for system devices such as serial and    156     used for system devices such as serial and parallel ports.
157 - ISAPNP:                                         157 - ISAPNP:
158     provides PnP support for the ISA bus          158     provides PnP support for the ISA bus
159 - ACPI:                                           159 - ACPI:
160     among its many uses, ACPI provides informa    160     among its many uses, ACPI provides information about system level
161     devices.                                      161     devices.
162                                                   162 
163 It is meant to replace the PNPBIOS.  It is not    163 It is meant to replace the PNPBIOS.  It is not currently supported by Linux
164 Plug and Play but it is planned to be in the n    164 Plug and Play but it is planned to be in the near future.
165                                                   165 
166                                                   166 
167 Requirements for a Linux PnP protocol:            167 Requirements for a Linux PnP protocol:
168 1. the protocol must use EISA IDs                 168 1. the protocol must use EISA IDs
169 2. the protocol must inform the PnP Layer of a    169 2. the protocol must inform the PnP Layer of a device's current configuration
170                                                   170 
171 - the ability to set resources is optional but    171 - the ability to set resources is optional but preferred.
172                                                   172 
173 The following are PnP protocol related functio    173 The following are PnP protocol related functions:
174                                                   174 
175 pnp_add_device                                    175 pnp_add_device
176   use this function to add a PnP device to the    176   use this function to add a PnP device to the PnP layer
177                                                   177 
178   only call this function when all wanted valu    178   only call this function when all wanted values are set in the pnp_dev
179   structure                                       179   structure
180                                                   180 
181 pnp_init_device                                   181 pnp_init_device
182   call this to initialize the PnP structure       182   call this to initialize the PnP structure
183                                                   183 
184 pnp_remove_device                                 184 pnp_remove_device
185   call this to remove a device from the Plug a    185   call this to remove a device from the Plug and Play Layer.
186   it will fail if the device is still in use.     186   it will fail if the device is still in use.
187   automatically will free mem used by the devi    187   automatically will free mem used by the device and related structures
188                                                   188 
189 pnp_add_id                                        189 pnp_add_id
190   adds an EISA ID to the list of supported IDs    190   adds an EISA ID to the list of supported IDs for the specified device
191                                                   191 
192 For more information consult the source of a p    192 For more information consult the source of a protocol such as
193 /drivers/pnp/pnpbios/core.c.                      193 /drivers/pnp/pnpbios/core.c.
194                                                   194 
195                                                   195 
196                                                   196 
197 Linux Plug and Play Drivers                       197 Linux Plug and Play Drivers
198 ---------------------------                       198 ---------------------------
199                                                   199 
200 This section contains information for Linux Pn    200 This section contains information for Linux PnP driver developers.
201                                                   201 
202 The New Way                                       202 The New Way
203 ^^^^^^^^^^^                                       203 ^^^^^^^^^^^
204                                                   204 
205 1. first make a list of supported EISA IDS        205 1. first make a list of supported EISA IDS
206                                                   206 
207    ex::                                           207    ex::
208                                                   208 
209         static const struct pnp_id pnp_dev_tab    209         static const struct pnp_id pnp_dev_table[] = {
210                 /* Standard LPT Printer Port *    210                 /* Standard LPT Printer Port */
211                 {.id = "PNP0400", .driver_data    211                 {.id = "PNP0400", .driver_data = 0},
212                 /* ECP Printer Port */            212                 /* ECP Printer Port */
213                 {.id = "PNP0401", .driver_data    213                 {.id = "PNP0401", .driver_data = 0},
214                 {.id = ""}                        214                 {.id = ""}
215         };                                        215         };
216                                                   216 
217    Please note that the character 'X' can be u    217    Please note that the character 'X' can be used as a wild card in the function
218    portion (last four characters).                218    portion (last four characters).
219                                                   219 
220    ex::                                           220    ex::
221                                                   221 
222         /* Unknown PnP modems */                  222         /* Unknown PnP modems */
223         {       "PNPCXXX",              UNKNOW    223         {       "PNPCXXX",              UNKNOWN_DEV     },
224                                                   224 
225    Supported PnP card IDs can optionally be de    225    Supported PnP card IDs can optionally be defined.
226    ex::                                           226    ex::
227                                                   227 
228         static const struct pnp_id pnp_card_ta    228         static const struct pnp_id pnp_card_table[] = {
229                 {       "ANYDEVS",                229                 {       "ANYDEVS",              0       },
230                 {       "",                       230                 {       "",                     0       }
231         };                                        231         };
232                                                   232 
233 2. Optionally define probe and remove function    233 2. Optionally define probe and remove functions.  It may make sense not to
234    define these functions if the driver alread    234    define these functions if the driver already has a reliable method of detecting
235    the resources, such as the parport_pc drive    235    the resources, such as the parport_pc driver.
236                                                   236 
237    ex::                                           237    ex::
238                                                   238 
239         static int                                239         static int
240         serial_pnp_probe(struct pnp_dev * dev,    240         serial_pnp_probe(struct pnp_dev * dev, const struct pnp_id *card_id, const
241                         struct pnp_id *dev_id)    241                         struct pnp_id *dev_id)
242         {                                         242         {
243         . . .                                     243         . . .
244                                                   244 
245    ex::                                           245    ex::
246                                                   246 
247         static void serial_pnp_remove(struct p    247         static void serial_pnp_remove(struct pnp_dev * dev)
248         {                                         248         {
249         . . .                                     249         . . .
250                                                   250 
251    consult /drivers/serial/8250_pnp.c for more    251    consult /drivers/serial/8250_pnp.c for more information.
252                                                   252 
253 3. create a driver structure                      253 3. create a driver structure
254                                                   254 
255    ex::                                           255    ex::
256                                                   256 
257         static struct pnp_driver serial_pnp_dr    257         static struct pnp_driver serial_pnp_driver = {
258                 .name           = "serial",       258                 .name           = "serial",
259                 .card_id_table  = pnp_card_tab    259                 .card_id_table  = pnp_card_table,
260                 .id_table       = pnp_dev_tabl    260                 .id_table       = pnp_dev_table,
261                 .probe          = serial_pnp_p    261                 .probe          = serial_pnp_probe,
262                 .remove         = serial_pnp_r    262                 .remove         = serial_pnp_remove,
263         };                                        263         };
264                                                   264 
265    * name and id_table cannot be NULL.            265    * name and id_table cannot be NULL.
266                                                   266 
267 4. register the driver                            267 4. register the driver
268                                                   268 
269    ex::                                           269    ex::
270                                                   270 
271         static int __init serial8250_pnp_init(    271         static int __init serial8250_pnp_init(void)
272         {                                         272         {
273                 return pnp_register_driver(&se    273                 return pnp_register_driver(&serial_pnp_driver);
274         }                                         274         }
275                                                   275 
276 The Old Way                                       276 The Old Way
277 ^^^^^^^^^^^                                       277 ^^^^^^^^^^^
278                                                   278 
279 A series of compatibility functions have been     279 A series of compatibility functions have been created to make it easy to convert
280 ISAPNP drivers.  They should serve as a tempor    280 ISAPNP drivers.  They should serve as a temporary solution only.
281                                                   281 
282 They are as follows::                             282 They are as follows::
283                                                   283 
284         struct pnp_dev *pnp_find_dev(struct pn    284         struct pnp_dev *pnp_find_dev(struct pnp_card *card,
285                                      unsigned     285                                      unsigned short vendor,
286                                      unsigned     286                                      unsigned short function,
287                                      struct pn    287                                      struct pnp_dev *from)
288                                                   288 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php