1 '\" te
   2 .\"  Copyright (c) 1996, 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 CSX_CS_DDI_INFO 9F "Jul 19, 1996"
   7 .SH NAME
   8 csx_CS_DDI_Info \- obtain DDI information
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 #include <sys/pccard.h>
  13 
  14 
  15 
  16 \fBint32_t\fR \fBcsx_CS_DDI_Info\fR(\fBcs_ddi_info_t *\fR\fIcdi\fR);
  17 .fi
  18 
  19 .SH INTERFACE LEVEL
  20 .sp
  21 .LP
  22 Solaris \fBDDI \fRSpecific (Solaris \fBDDI) \fR
  23 .SH PARAMETERS
  24 .sp
  25 .ne 2
  26 .na
  27 \fB\fIcdi\fR \fR
  28 .ad
  29 .RS 8n
  30 Pointer to a \fBcs_ddi_info_t\fR structure.
  31 .RE
  32 
  33 .SH DESCRIPTION
  34 .sp
  35 .LP
  36 This function is a Solaris-specific extension that is used by clients that need
  37 to provide the \fIxx_getinfo\fR driver entry point (see \fBgetinfo\fR(9E)). It
  38 provides a method for clients to obtain \fBDDI \fRinformation based on their
  39 socket number and client driver name.
  40 .SH STRUCTURE MEMBERS
  41 .sp
  42 .LP
  43 The structure members of \fBcs_ddi_info_t\fR are:
  44 .sp
  45 .in +2
  46 .nf
  47 uint32_t     Socket;        /* socket number */
  48 char*        driver_name;   /* unique driver name */
  49 dev_info_t   *dip;          /* dip */
  50 int32_t      instance;      /* instance */
  51 .fi
  52 .in -2
  53 
  54 .sp
  55 .LP
  56 The fields are defined as follows:
  57 .sp
  58 .ne 2
  59 .na
  60 \fB\fBSocket\fR \fR
  61 .ad
  62 .RS 16n
  63 This field must be set to the physical socket number that the client is
  64 interested in getting information about.
  65 .RE
  66 
  67 .sp
  68 .ne 2
  69 .na
  70 \fB\fBdriver_name\fR \fR
  71 .ad
  72 .RS 16n
  73 This field must be set to a string containing the name of the client driver to
  74 get information about.
  75 .RE
  76 
  77 .sp
  78 .LP
  79 If \fBcsx_CS_DDI_Info()\fR is used in a client's \fIxx_getinfo\fR function,
  80 then the client will typically extract the \fBSocket\fR value from the
  81 \fB*\fR\fIarg\fR argument and it \fImust\fR set the \fBdriver_name\fR field to
  82 the same string used with \fBcsx_RegisterClient\fR(9F).
  83 .sp
  84 .LP
  85 If the \fBdriver_name\fR is found on the \fBSocket\fR, the
  86 \fBcsx_CS_DDI_Info()\fR function returns both the \fBdev_info\fR pointer and
  87 the \fBinstance\fR fields for the requested driver instance.
  88 .SH RETURN VALUES
  89 .sp
  90 .ne 2
  91 .na
  92 \fB\fBCS_SUCCESS\fR \fR
  93 .ad
  94 .RS 28n
  95 Successful operation.
  96 .RE
  97 
  98 .sp
  99 .ne 2
 100 .na
 101 \fB\fBCS_BAD_SOCKET\fR \fR
 102 .ad
 103 .RS 28n
 104 Client not found on \fBSocket\fR.
 105 .RE
 106 
 107 .sp
 108 .ne 2
 109 .na
 110 \fB\fBCS_UNSUPPORTED_FUNCTION\fR \fR
 111 .ad
 112 .RS 28n
 113 No \fBPCMCIA \fRhardware installed.
 114 .RE
 115 
 116 .SH CONTEXT
 117 .sp
 118 .LP
 119 This function may be called from user or kernel context.
 120 .SH EXAMPLES
 121 .LP
 122 \fBExample 1 \fR: Using csx_CS_DDI_Info
 123 .sp
 124 .LP
 125 The following example shows how a client might call the \fBcsx_CS_DDI_Info()\fR
 126 in the client's \fIxx_getinfo\fR function to return the dip or the instance
 127 number:
 128 
 129 .sp
 130 .in +2
 131 .nf
 132 static int
 133 pcepp_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg,
 134                                                         void **result)
 135 {
 136            int                          error = DDI_SUCCESS;
 137            pcepp_state_t                *pps;
 138            cs_ddi_info_t                cs_ddi_info;
 139 
 140    switch (cmd) {
 141 
 142            case DDI_INFO_DEVT2DEVINFO:
 143           cs_ddi_info.Socket = getminor((dev_t)arg) & 0x3f;
 144           cs_ddi_info.driver_name = pcepp_name;
 145           if (csx_CS_DDI_Info(&cs_ddi_info) != CS_SUCCESS)
 146                    return (DDI_FAILURE);
 147           if (!(pps = ddi_get_soft_state(pcepp_soft_state_p,
 148                         cs_ddi_info.instance))) {
 149                     *result = NULL;
 150           } else {
 151                     *result = pps->dip;
 152           }
 153           break;
 154 
 155            case DDI_INFO_DEVT2INSTANCE:
 156           cs_ddi_info.Socket = getminor((dev_t)arg) & 0x3f;
 157           cs_ddi_info.driver_name = pcepp_name;
 158           if (csx_CS_DDI_Info(&cs_ddi_info) != CS_SUCCESS)
 159                             return (DDI_FAILURE);
 160           *result = (void *)cs_ddi_info.instance;
 161           break;
 162 
 163            default:
 164           error = DDI_FAILURE;
 165           break;
 166 
 167    }
 168 
 169            return (error);
 170 }
 171 .fi
 172 .in -2
 173 
 174 .SH SEE ALSO
 175 .sp
 176 .LP
 177 \fBgetinfo\fR(9E), \fBcsx_RegisterClient\fR(9F), \fBddi_get_instance\fR(9F)
 178 .sp
 179 .LP
 180 \fIPC Card 95 Standard, PCMCIA/JEIDA\fR