Charles.Forsyth20060303-partialeea662d19 years agoHistory
150 lines · 4.7 KB · Text
RawDownload
.TH PNP 3.SH NAMEpnp, pci \- Plug 'n' Play ISA and PCI Interfaces.SH SYNOPSIS.nf.B bind -a '#$' /dev .BI /dev/pci/ bus\fL.\fPdev\fL.\fPfn ctl.BI /dev/pci/ bus\fL.\fPdev\fL.\fPfn raw .BI /dev/pnp/ctl.BI /dev/pnp/csn n ctl.BI /dev/pnp/csn n raw\&... .fi.SH DESCRIPTIONThis device provides a limited interface to the PCI bus andPlug 'n' Play ISA devices.Both are present on most PC platforms; on others, only the.B pciinterface is present (because there is no ISA bus)..SS PCI Interface.PPPCI devices are addressed logically by a bus number,a device number on that bus, and a function numberwithin the device.The set of all such device functions may be enumeratedby traversing the.B /dev/pcidirectory; the driver serves two files for each function.These are a control file.RL ( /dev/pci/\fIbus\fP.\fIdev\fP.\fIfn\fPctl )which may be read for a textual summary of the device function,and a `raw' file.RL ( /dev/pci/\fIbus\fP.\fIdev\fP.\fIfn\fPraw )which may be read to obtain the raw contents of PCI configuration space..PPThe first field of a PCI control file contains the class, sub-class andprogramming interface values for the device function, expressedas 2-digit hexadecimal values, and separated by periods.The second field yields the vendor ID and device ID, each as 4-digithex numbers, separated by a slash.The third field is the associated interrupt line in decimal.The remainder of the line enumerates any valid base addressregisters for the function, using two fields for each.In the first field, the index of the register is followed bya colon, and then the value of the register itself.The following field gives the associated size of the memory(or I/O space) that is mapped by the register..SS Plug 'n' Play.PPPlug 'n' Play ISA devices are discovered by sending a fixed `unlock' sequenceover an I/O port, and then reading back data from another port.An arbitration algorithm is used to separate out the individualcards and enumerate them in turn.Each card is assigned a unique number, called a CSN, in the range 1-255 as aresult of enumeration.Cards also have a fixed 64 bit identification number, set by themanufacturer, which is used by the arbitration algorithm toresolve conflicts.The first 32 bits describe the type of the card, and the second32 bits form a serial number for the particular instance of that card type.When formatted textually, it appears as 3 upper-case letters(typically representing the manufacturer),followed by 4 hex digits, then a period, then 8 hex digits.The substring before the period is the card type, and the substringafter the period is the serial number..PPThe enumeration algorithm needs to be enabled by specifying theport number to write the unlock sequence out on.This can be configured to take place at boot time by adding a linelike the following to.IR plan9.ini :.IP.EXpnp0=port=0x203.EE.PPHere.B portshould be chosen to not conflict with any existing devices.It must be in the range.BR 0x203-0x3ff .Alternatively, one can use the following command:.IP.EXecho port 0x203 >/dev/pnp/ctl.EE.PPNote that a side-effect of PnP enumeration is to reset the configurationstate of all such cards; any settings made by a Plug and Play BIOS will be lost.Reading the file.B /dev/pnp/ctlreturns one of the strings.B "enabled\fI port\fP"or.BR "disabled" ..PPFor each enumerated card, two files are served in.BR /dev/pnp .A control file.RL ( /dev/pnp/csn\fIn\fPctl )may be read to determine the ID of the card, and a raw file.RL ( /dev/pnp/csn\fIn\fPraw )may be read to obtain the configuration data associated with the card.It is intended that the control file should take commands which set thevarious configurable resources of the card, but this has not beenimplemented yet..PPA mechanism is provided for configuring cards via.IR plan9.ini (10.6).A line of the form.BI pnp n = "idstring ..."will cause the driver to look for the card named by.I idstringand, if found, assign it the CSN.IR n .The intention is thatany additional text after the idstring is interpreted as if itwas written to the card's.B ctlfile, but this is not yet implemented..SH EXAMPLES.PPTo list all PCI functions:.IP.EXcat /dev/pci/*ctl.EE.PPTo find just the PCI video card (class 3):.IP.EXgrep '^03' /dev/pci/*ctl.EE.SH SOURCE.B /os/pc/devpnp.c.br.B /os/port/devpci.c.SH BUGSThere is currently no way to write to PCI configuration space,or to perform reads of less than 32 bits.Access to the I/O and memory regions of a PCI device is not provided..PPThe ability to set a Plug 'n' Play card's configurable settings has not beenimplemented..PPThere should be a user program for identifying and configuringPlug 'n' Play cards.