'\" te
.\"  Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CARDBUS 4 "Jul 11, 2006"
.SH NAME
cardbus \- configuration files for cardbus device drivers
.SH DESCRIPTION
.sp
.LP
The CardBus bus share the same configuration parameters with the PCI bus.
CardBus 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 configuration parameters are represented in the form
of name-value pairs that can be retrieved using the \fBDDI\fR property
interfaces. See \fBddi_prop_lookup\fR(9F) for details.
.sp
.LP
The CardBus bus properties of CardBus devices are derived from PCI
configuration space. Therefore, driver configuration files are not necessary
for these devices.
.sp
.LP
On some occasions, drivers for CardBus devices can use driver configuration
files to provide driver private properties through the global property
mechanism. See \fBdriver.conf\fR(4) for further details. Driver configuration
files can also be used to augment or override properties for a specific
instance of a driver.
.sp
.LP
The CardBus nexus driver recognizes the following properties:
.sp
.ne 2
.na
\fB\fBreg\fR\fR
.ad
.RS 14n
An arbitrary length array where each element of the array consists of a 5-tuple
of 32-bit values. Each array element describes a logically contiguous mappable
resource on the \fBPCI\fR bus.
.sp
The first three values in the 5-tuple describe the \fBPCI\fR address of the
mappable resource. The first tuple contains the following information:
.sp

.sp
.TS
l l l
l l l .
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	
Bits 24 - 25	2-bit address space type identifier	
Bits 31 - 28	T{
Register number extended bits 8:11 for extended config space. Zero for conventional configuration space.
T}	
.TE

The address space type identifier can be interpreted as follows:
.sp

.sp
.TS
l l l
l l l .
0x0	configuration space	
0x1	I/O space	
0x2	32-bit memory space address	
.TE

The bus number is a unique identifying number assigned to each bus within the
\fBPCI\fR or PCIe domain.
.sp
The device number is a unique identifying number assigned to each device on a
\fBPCI\fR bus, PCIe logical bus, or CardBus bus. A device number is unique only
within the set of device numbers for a particular bus or logical bus.
.sp
Each CardBus device can have one to eight logically independent functions, each
with its own independent set of configuration registers. Each function on a
device is assigned a function number. For a device with only one function, the
function number must be \fB0\fR.
.sp
The register number fields select a particular register within the set of
configuration registers corresponding to the selected function. When the
address space type identifier indicates configuration space, non-zero register
number extended bits select registers in extended configuration space.
.sp
The second and third values in the \fBreg\fR property 5-tuple specify the
64-bit address of the mappable resource within the \fBPCI\fR or PCIe address
domain. Since the CardBus is a 32-bit bus, the second 32-bit tuple is not used.
The third 32-bit tuple corresponds to the 32-bit address.
.sp
The fourth and fifth 32-bit values in the 5-tuple \fBreg\fR property specify
the size of the mappable resource. The size is a 64-bit value. Since it's a
32-bit bus, only the fifth tuple is used.
.sp
The driver can refer to the elements of this array by index, and construct
kernel mappings to these addresses using \fBddi_regs_map_setup\fR(9F). The
index into the array is passed as the \fIrnumber\fR argument of
\fBddi_regs_map_setup\fR(9F).
.sp
At a high-level interrupt context, you can use the \fBddi_get*\fR and
\fBddi_put*\fR 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.
.RE

.sp
.ne 2
.na
\fB\fBinterrupts\fR\fR
.ad
.RS 14n
This property consists of a single-integer element array. Valid interrupt
property values are \fB1\fR, \fB2\fR, \fB3\fR, and \fB4\fR. This value is
derived directly from the contents of the device's configuration-interrupt-pin
register.
.sp
A driver should use an index value of \fB0\fR when registering its interrupt
handler with the DDI interrupt interfaces.
.RE

.sp
.LP
All CardBus devices support the \fBreg\fR property. The device number and
function number as derived from the \fBreg\fR property are used to construct
the address part of the device name under \fB/devices\fR.
.sp
.LP
Only devices that generate interrupts support an \fBinterrupts\fR property.
.sp
.LP
Occasionally it might be necessary to override or augment the configuration
information supplied by a CardBus device. This change can be achieved by
writing a driver configuration file that describes a prototype device node
specification containing the additional properties required.
.sp
.LP
For the system to merge the prototype node specification into an actual device
node, certain conditions must be met.
.RS +4
.TP
.ie t \(bu
.el o
First, the \fBname\fR property must be identical. The value of the \fBname\fR
property needs to match the binding name of the device. The binding name is the
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.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Second, the parent property must identify the PCI bus or PCIe logical bus.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Third, the unit-address property must identify the card. The format of the
unit-address property is:
.RE
.sp
.LP
\fBDD[,F]\fR
.sp
.LP
where \fBDD\fR is the device number and \fBF\fR is the function number. If the
function number is 0, only \fBDD\fR is specified.
.SH EXAMPLES
.LP
\fBExample 1 \fRSample Configuration File
.sp
.LP
An example configuration file called \fBACME,scsi-hba.conf\fR for a CardBus
device driver called \fBACME,scsi-hba\fR follows:

.sp
.in +2
.nf
#
# 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;
.fi
.in -2
.sp

.sp
.LP
In this example, a property \fBscsi-initiator-id\fR specifies the \fBSCSI\fR
bus initiator id that the adapter should use, for just one particular instance
of adapter installed in the machine. The \fBname\fR property identifies the
driver and the parent property to identify the particular bus the card is
plugged into. This example uses the parent's full path name to identify the
bus. The unit-address property identifies the card itself, with device number
of 3 and function number of 0.

.sp
.LP
Two global driver properties are also created: \fBhba-advanced-mode\fR (which
has the string value \fBon\fR) and \fBhba-dma-speed\fR (which has the value
\fB10\fR M bit/s). These properties apply to all device nodes of the
\fBACME,scsi-hba\fR.

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Architecture	SPARC, x86
.TE

.SH SEE ALSO
.sp
.LP
\fBdriver.conf\fR(4), \fBattributes\fR(5), \fBddi_intr_add_handler\fR(9F),
\fBddi_prop_lookup\fR(9F), \fBddi_regs_map_setup\fR(9F)
.sp
.LP
\fIWriting Device Drivers\fR
.sp
.LP
\fIIEEE 1275 PCI Bus Binding\fR