File Formats pci(4)
NAME
pci, pcie - configuration files for PCI and PCI Express dev-
ice driversDESCRIPTION
The Peripheral Component Interconnect (PCI) bus is a littleendian bus. PCI Express (PCIe) and PCI-X are successors to
PCI. All three types of devices share the same configuration parameters. What is specified here for PCI devices appliesto PCI-X 1.0 devices as well. All three types of devices are
self-identifying, which means that these devices provide
configuration parameters to the system that allow the system to identify the device and its driver. The configurationparameters are represented in the form of name-value pairs
that can be retrieved using the DDI property interfaces. Seeddi_prop_lookup(9F) for details.
The bus properties of PCI devices or logical bus properties of PCIe devices are derived from PCI configuration space, or supplied by the Fcode PROM, if it exists. Therefore, driver configuration files are not necessary for these devices. On some occasions, drivers for PCI and PCIe devices can usedriver configuration files to provide driver private proper-
ties through the global property mechanism. See driver.conf(4) for further details. Driver configuration files can also be used to augment or override properties for a specific instance of a driver.All bus drivers of PCI and PCIe devices recognize the fol-
lowing properties: reg An arbitrary length array where each elementof the array consists of a 5-tuple of 32-bit
values. Each array element describes a logi-
cally contiguous mappable resource on the PCI bus or PCIe device tree.The first three values in the 5-tuple describe
the PCI address of the mappable resource. Thefirst tuple contains the following informa-
tion:Bits 0 - 7 8-bit register number
Bits 8 - 10 3-bit function number
Bits 11 - 15 5-bit device number
Bits 16 - 23 8-bit bus number
SunOS 5.11 Last change: 13 May 2005 1
File Formats pci(4)
Bits 24 - 25 2-bit address space type identifier
Bits 31 - 28 Register number extended bits 8:11
for extended config space. Zero for conventional configuration space. The address space type identifier can be interpreted as follows: 0x0 configuration space0x1 I/O space
0x2 32-bit memory space address
0x3 64-bit memory space address
The bus number is a unique identifying number assigned to each PCI bus or PCIe logical bus within its domain. The device number is a unique identifying number assigned to each device on a PCI bus or PCIe logical bus. Note that a device number is unique only within the set of device numbers for a particular bus or logical bus. Each PCI or PCIe device can have one to eight logically independent functions, each with itsown independent set of configuration regis-
ters. Each function on a device is assigned a function number. For a device with only one function, the function number must be 0. The register number fields select a particular register within the set of configurationregisters corresponding to the selected func-
tion. When the address space type identifierindicates configuration space, non-zero regis-
ter number extended bits select registers in extended configuration space.The second and third values in the reg pro-
perty 5-tuple specify the 64-bit address of
the mappable resource within the PCI or PCIeaddress domain. The second 32-bit tuple
corresponds to the high order four bytes ofthe 64-bit address. The third 32-bit tuple
corresponds to the low order bytes.The fourth and fifth 32-bit values in the 5-
tuple reg property specify the size of themappable resource. The size is a 64-bit value,
where the fourth tuple corresponds to the highSunOS 5.11 Last change: 13 May 2005 2
File Formats pci(4)
order bytes of the 64-bit size and the fifth
corresponds to the low order. The driver can refer to the elements of this array by index, and construct kernel mappings to these addresses usingddi_regs_map_setup(9F). The index into the
array is passed as the rnumber argument ofddi_regs_map_setup(9F).
At a high-level interrupt context, you can use
the ddi_get* and ddi_put* family of functions
to access I/O and memory space. However, access to configuration space is not allowed
when running at a high-interrupt level.
interrupts This property consists of a single-integer
element array. Valid interrupt property values are 1, 2, 3, and 4. This value is derived directly from the contents of the device'sconfiguration-interrupt-pin register.
A driver should use an index value of 0 when registering its interrupt handler with the DDI interrupt interfaces.All PCI and PCIe devices support the reg property. The dev-
ice number and function number as derived from the reg pro-
perty are used to construct the address part of the device name under /devices. Only devices that generate interrupts support an interrupts property. Occasionally it might be necessary to override or augmentthe configuration information supplied by a PCI or PCIe dev-
ice. This change can be achieved by writing a driver confi-
guration file that describes a prototype device node specif-
ication containing the additional properties required. For the system to merge the prototype node specification into an actual device node, certain conditions must be met. o First, the name property must be identical. Thevalue of the name property needs to match the bind-
ing name of the device. The binding name is theSunOS 5.11 Last change: 13 May 2005 3
File Formats pci(4)
name chosen by the system to bind a driver to a device and is either an alias associated with the driver or the hardware node name of the device. o Second, the parent property must identify the PCI bus or PCIe logical bus.o Third, the unit-address property must identify the
card. The format of the unit-address property is:
DD[,F] where DD is the device number and F is the function number. If the function number is 0, only DD is specified.EXAMPLES
Example 1 Sample Configuration FileAn example configuration file called ACME,scsi-hba.conf for
a PCI driver called ACME,scsi-hba follows:
#
# Copyright (c) 1995, ACME SCSI Host Bus Adaptor
# ident "@(#)ACME,scsi-hba.conf 1.1 96/02/04"
name="ACME,scsi-hba" parent="/pci@1,0/pci@1f,4000"
unit-address="3" scsi-initiator-id=6;
hba-advanced-mode="on";
hba-dma-speed=10;
In this example, a property scsi-initiator-id specifies the
SCSI bus initiator id that the adapter should use, for just one particular instance of adapter installed in the machine.The name property identifies the driver and the parent pro-
perty to identify the particular bus the card is pluggedinto. This example uses the parent's full path name to iden-
tify the bus. The unit-address property identifies the card
itself, with device number of 3 and function number of 0.Two global driver properties are also created: hba-
advanced-mode (which has the string value on) and hba-dma-
speed (which has the value 10 M bit/s). These propertiesapply to all device nodes of the ACME,scsi-hba.
SunOS 5.11 Last change: 13 May 2005 4
File Formats pci(4)
Configuration files for PCIe devices are similar. Shownbelow is an example configuration file called ACME,pcie-
widget.conf for a PCIe driver called ACME,pcie-widget.
#
# Copyright (c) 2005, ACME PCIe Widget Adapter
# ident "@(#)ACME,pcie-widget.conf 1.1 05/11/14"
name="ACME,pcie-widget" parent="/pci@780" unit-address="2,1"
debug-mode=12;
In this example, we provide a property debug-mode for a par-
ticular PCIe device. As before, the logical bus is identi-
fied by the pathname of the parent of the device. The device has a device number of 2, and a function number of 1.ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Architecture | SPARC, x86 ||_____________________________|_____________________________|
SEE ALSO
driver.conf(4), attributes(5), ddi_intr_add_handler(9F),
ddi_prop_lookup(9F), ddi_regs_map_setup(9F)
Writing Device Drivers IEEE 1275 PCI Bus Bindinghttp://playground.sun.com/1275/bindings/pci/pci-express.txt
NOTESPCIe devices support an extended configuration space una-
vailable to PCI devices. While PCIe devices can be operatedusing a PCI device driver, operating them using a PCIe dev-
ice driver can make use of the extended properties and features made available only in the extended configurationSunOS 5.11 Last change: 13 May 2005 5
File Formats pci(4)
space.SunOS 5.11 Last change: 13 May 2005 6