1 '\" te
   2 .\"  Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved
   3 .\" 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.
   4 .\" 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.
   5 .\" 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]
   6 .TH CARDBUS 4 "Jul 11, 2006"
   7 .SH NAME
   8 cardbus \- configuration files for cardbus device drivers
   9 .SH DESCRIPTION
  10 .sp
  11 .LP
  12 The CardBus bus share the same configuration parameters with the PCI bus.
  13 CardBus devices are self-identifying, which means that these devices provide
  14 configuration parameters to the system that allow the system to identify the
  15 device and its driver. The configuration parameters are represented in the form
  16 of name-value pairs that can be retrieved using the \fBDDI\fR property
  17 interfaces. See \fBddi_prop_lookup\fR(9F) for details.
  18 .sp
  19 .LP
  20 The CardBus bus properties of CardBus devices are derived from PCI
  21 configuration space. Therefore, driver configuration files are not necessary
  22 for these devices.
  23 .sp
  24 .LP
  25 On some occasions, drivers for CardBus devices can use driver configuration
  26 files to provide driver private properties through the global property
  27 mechanism. See \fBdriver.conf\fR(4) for further details. Driver configuration
  28 files can also be used to augment or override properties for a specific
  29 instance of a driver.
  30 .sp
  31 .LP
  32 The CardBus nexus driver recognizes the following properties:
  33 .sp
  34 .ne 2
  35 .na
  36 \fB\fBreg\fR\fR
  37 .ad
  38 .RS 14n
  39 An arbitrary length array where each element of the array consists of a 5-tuple
  40 of 32-bit values. Each array element describes a logically contiguous mappable
  41 resource on the \fBPCI\fR bus.
  42 .sp
  43 The first three values in the 5-tuple describe the \fBPCI\fR address of the
  44 mappable resource. The first tuple contains the following information:
  45 .sp
  46 
  47 .sp
  48 .TS
  49 l l l
  50 l l l .
  51 Bits 0 - 7      8-bit register number   
  52 Bits 8 - 10     3-bit function number   
  53 Bits 11 - 15    5-bit device number     
  54 Bits 16 - 23    8-bit bus number        
  55 Bits 24 - 25    2-bit address space type identifier     
  56 Bits 31 - 28    T{
  57 Register number extended bits 8:11 for extended config space. Zero for conventional configuration space.
  58 T}      
  59 .TE
  60 
  61 The address space type identifier can be interpreted as follows:
  62 .sp
  63 
  64 .sp
  65 .TS
  66 l l l
  67 l l l .
  68 0x0     configuration space     
  69 0x1     I/O space       
  70 0x2     32-bit memory space address     
  71 .TE
  72 
  73 The bus number is a unique identifying number assigned to each bus within the
  74 \fBPCI\fR or PCIe domain.
  75 .sp
  76 The device number is a unique identifying number assigned to each device on a
  77 \fBPCI\fR bus, PCIe logical bus, or CardBus bus. A device number is unique only
  78 within the set of device numbers for a particular bus or logical bus.
  79 .sp
  80 Each CardBus device can have one to eight logically independent functions, each
  81 with its own independent set of configuration registers. Each function on a
  82 device is assigned a function number. For a device with only one function, the
  83 function number must be \fB0\fR.
  84 .sp
  85 The register number fields select a particular register within the set of
  86 configuration registers corresponding to the selected function. When the
  87 address space type identifier indicates configuration space, non-zero register
  88 number extended bits select registers in extended configuration space.
  89 .sp
  90 The second and third values in the \fBreg\fR property 5-tuple specify the
  91 64-bit address of the mappable resource within the \fBPCI\fR or PCIe address
  92 domain. Since the CardBus is a 32-bit bus, the second 32-bit tuple is not used.
  93 The third 32-bit tuple corresponds to the 32-bit address.
  94 .sp
  95 The fourth and fifth 32-bit values in the 5-tuple \fBreg\fR property specify
  96 the size of the mappable resource. The size is a 64-bit value. Since it's a
  97 32-bit bus, only the fifth tuple is used.
  98 .sp
  99 The driver can refer to the elements of this array by index, and construct
 100 kernel mappings to these addresses using \fBddi_regs_map_setup\fR(9F). The
 101 index into the array is passed as the \fIrnumber\fR argument of
 102 \fBddi_regs_map_setup\fR(9F).
 103 .sp
 104 At a high-level interrupt context, you can use the \fBddi_get*\fR and
 105 \fBddi_put*\fR family of functions to access I/O and memory space. However,
 106 access to configuration space is not allowed when running at a high-interrupt
 107 level.
 108 .RE
 109 
 110 .sp
 111 .ne 2
 112 .na
 113 \fB\fBinterrupts\fR\fR
 114 .ad
 115 .RS 14n
 116 This property consists of a single-integer element array. Valid interrupt
 117 property values are \fB1\fR, \fB2\fR, \fB3\fR, and \fB4\fR. This value is
 118 derived directly from the contents of the device's configuration-interrupt-pin
 119 register.
 120 .sp
 121 A driver should use an index value of \fB0\fR when registering its interrupt
 122 handler with the DDI interrupt interfaces.
 123 .RE
 124 
 125 .sp
 126 .LP
 127 All CardBus devices support the \fBreg\fR property. The device number and
 128 function number as derived from the \fBreg\fR property are used to construct
 129 the address part of the device name under \fB/devices\fR.
 130 .sp
 131 .LP
 132 Only devices that generate interrupts support an \fBinterrupts\fR property.
 133 .sp
 134 .LP
 135 Occasionally it might be necessary to override or augment the configuration
 136 information supplied by a CardBus device. This change can be achieved by
 137 writing a driver configuration file that describes a prototype device node
 138 specification containing the additional properties required.
 139 .sp
 140 .LP
 141 For the system to merge the prototype node specification into an actual device
 142 node, certain conditions must be met.
 143 .RS +4
 144 .TP
 145 .ie t \(bu
 146 .el o
 147 First, the \fBname\fR property must be identical. The value of the \fBname\fR
 148 property needs to match the binding name of the device. The binding name is the
 149 name chosen by the system to bind a driver to a device and is either an alias
 150 associated with the driver or the hardware node name of the device.
 151 .RE
 152 .RS +4
 153 .TP
 154 .ie t \(bu
 155 .el o
 156 Second, the parent property must identify the PCI bus or PCIe logical bus.
 157 .RE
 158 .RS +4
 159 .TP
 160 .ie t \(bu
 161 .el o
 162 Third, the unit-address property must identify the card. The format of the
 163 unit-address property is:
 164 .RE
 165 .sp
 166 .LP
 167 \fBDD[,F]\fR
 168 .sp
 169 .LP
 170 where \fBDD\fR is the device number and \fBF\fR is the function number. If the
 171 function number is 0, only \fBDD\fR is specified.
 172 .SH EXAMPLES
 173 .LP
 174 \fBExample 1 \fRSample Configuration File
 175 .sp
 176 .LP
 177 An example configuration file called \fBACME,scsi-hba.conf\fR for a CardBus
 178 device driver called \fBACME,scsi-hba\fR follows:
 179 
 180 .sp
 181 .in +2
 182 .nf
 183 #
 184 # Copyright (c) 1995, ACME SCSI Host Bus Adaptor
 185 # ident   "@(#)ACME,scsi-hba.conf  1.1  96/02/04"
 186 name="ACME,scsi-hba" parent="/pci@1,0/pci@1f,4000"
 187    unit-address="3" scsi-initiator-id=6;
 188 hba-advanced-mode="on";
 189 hba-dma-speed=10;
 190 .fi
 191 .in -2
 192 .sp
 193 
 194 .sp
 195 .LP
 196 In this example, a property \fBscsi-initiator-id\fR specifies the \fBSCSI\fR
 197 bus initiator id that the adapter should use, for just one particular instance
 198 of adapter installed in the machine. The \fBname\fR property identifies the
 199 driver and the parent property to identify the particular bus the card is
 200 plugged into. This example uses the parent's full path name to identify the
 201 bus. The unit-address property identifies the card itself, with device number
 202 of 3 and function number of 0.
 203 
 204 .sp
 205 .LP
 206 Two global driver properties are also created: \fBhba-advanced-mode\fR (which
 207 has the string value \fBon\fR) and \fBhba-dma-speed\fR (which has the value
 208 \fB10\fR M bit/s). These properties apply to all device nodes of the
 209 \fBACME,scsi-hba\fR.
 210 
 211 .SH ATTRIBUTES
 212 .sp
 213 .LP
 214 See \fBattributes\fR(5) for descriptions of the following attributes:
 215 .sp
 216 
 217 .sp
 218 .TS
 219 box;
 220 c | c
 221 l | l .
 222 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 223 _
 224 Architecture    SPARC, x86
 225 .TE
 226 
 227 .SH SEE ALSO
 228 .sp
 229 .LP
 230 \fBdriver.conf\fR(4), \fBattributes\fR(5), \fBddi_intr_add_handler\fR(9F),
 231 \fBddi_prop_lookup\fR(9F), \fBddi_regs_map_setup\fR(9F)
 232 .sp
 233 .LP
 234 \fIWriting Device Drivers\fR
 235 .sp
 236 .LP
 237 \fIIEEE 1275 PCI Bus Binding\fR