pnp 4.4 KB

  1. .TH PNP 3
  2. .SH NAME
  3. pnp \- Plug 'n' Play ISA and PCI Interfaces
  5. .nf
  6. .B bind -a '#$' /dev
  7. .BI /dev/pci/ bus\fL.\fPdev\fL.\fPfn ctl
  8. .BI /dev/pci/ bus\fL.\fPdev\fL.\fPfn raw
  9. .BI /dev/pnp/ctl
  10. .BI /dev/pnp/csn n ctl
  11. .BI /dev/pnp/csn n raw
  12. \&...
  13. .fi
  15. .PP
  16. This device provides a limited interface to the PCI bus and
  17. Plug 'n' Play ISA devices.
  18. .SS PCI Interface
  19. .PP
  20. PCI devices are addressed logically by a bus number,
  21. a device number on that bus, and a function number
  22. within the device.
  23. The set of all such device functions may be enumerated
  24. by traversing the
  25. .B /dev/pci
  26. directory; the driver serves two files for each function.
  27. These are a control file
  28. .RL ( /dev/pci/\fIbus\fP.\fIdev\fP.\fIfn\fPctl )
  29. which may be read for a textual summary of the device function,
  30. and a `raw' file
  31. .RL ( /dev/pci/\fIbus\fP.\fIdev\fP.\fIfn\fPraw )
  32. which may be used to read or write the raw contents of PCI configuration space.
  33. .PP
  34. The first field of a PCI control file contains the class, sub-class and
  35. programming interface values for the device function, expressed
  36. as 2-digit hexadecimal values, and separated by periods.
  37. The second field yields the vendor ID and device ID, each as 4-digit
  38. hex numbers, separated by a slash.
  39. The third field is the associated interrupt line in decimal.
  40. The remainder of the line enumerates any valid base address
  41. registers for the function, using two fields for each.
  42. In the first field, the index of the register is followed by
  43. a colon, and then the value of the register itself.
  44. The following field gives the associated size of the memory
  45. (or I/O space) that is mapped by the register.
  46. .SS Plug 'n' Play
  47. .PP
  48. Plug 'n' Play ISA devices are discovered by sending a fixed `unlock' sequence
  49. over an I/O port, and then reading back data from another port.
  50. An arbitration algorithm is used to separate out the individual
  51. cards and enumerate them in turn.
  52. Each card is assigned a unique number, called a CSN, in the range 1-255 as a
  53. result of enumeration.
  54. Cards also have a fixed 64 bit identification number, set by the
  55. manufacturer, which is used by the arbitration algorithm to
  56. resolve conflicts.
  57. The first 32 bits describe the type of the card, and the second
  58. 32 bits form a serial number for the particular instance of that card type.
  59. When formatted textually, it appears as 3 upper-case letters
  60. (typically representing the manufacturer),
  61. followed by 4 hex digits, then a period, then 8 hex digits.
  62. The substring before the period is the card type, and the substring
  63. after the period is the serial number.
  64. .PP
  65. The enumeration algorithm needs to be enabled by specifying the
  66. port number to write the unlock sequence out on.
  67. This can be configured to take place at boot time by adding a line
  68. like the following to
  69. .IR plan9.ini :
  70. .IP
  71. .EX
  72. pnp0=port=0x203
  73. .EE
  74. .PP
  75. Here
  76. .B port
  77. should be chosen to not conflict with any existing devices.
  78. It must be in the range
  79. .BR 0x203-0x3ff .
  80. Alternatively, one can use the following command:
  81. .IP
  82. .EX
  83. echo port 0x203 >/dev/pnp/ctl
  84. .EE
  85. .PP
  86. Note that a side-effect of PnP enumeration is to reset the configuration
  87. state of all such cards; any settings made by a Plug and Play BIOS will be lost.
  88. Reading the file
  89. .B /dev/pnp/ctl
  90. returns one of the strings
  91. .B "enabled\fI port\fP"
  92. or
  93. .BR "disabled" .
  94. .PP
  95. For each enumerated card, two files are served in
  96. .BR /dev/pnp .
  97. A control file
  98. .RL ( /dev/pnp/csn\fIn\fPctl )
  99. may be read to determine the ID of the card, and a raw file
  100. .RL ( /dev/pnp/csn\fIn\fPraw )
  101. may be read to obtain the configuration data associated with the card.
  102. It is intended that the control file should take commands which set the
  103. various configurable resources of the card, but this has not been
  104. implemented yet.
  105. .PP
  106. A mechanism is provided for configuring cards via
  107. .IR plan9.ini (8).
  108. A line of the form
  109. .BI pnp n = "idstring ..."
  110. will cause the driver to look for the card named by
  111. .I idstring
  112. and, if found, assign it the CSN
  113. .IR n .
  114. The intention is that
  115. any additional text after the idstring is interpreted as if it
  116. was written to the card's
  117. .B ctl
  118. file, but this is not yet implemented.
  120. .PP
  121. To list all PCI functions:
  122. .IP
  123. .EX
  124. cat /dev/pci/*ctl
  125. .EE
  126. .PP
  127. To find just the PCI video card (class 3):
  128. .IP
  129. .EX
  130. grep '^03' /dev/pci/*ctl
  131. .EE
  132. .SH SOURCE
  133. .B /sys/src/9/port/devpnp.c
  134. .SH BUGS
  135. Access to the I/O and memory regions of a PCI device is not provided.
  136. .PP
  137. The ability to set a Plug 'n' Play card's configurable settings has not been
  138. implemented.
  139. .PP
  140. There should be a user program for identifying and configuring
  141. Plug 'n' Play cards.