Current File : //usr/share/man/man9f/csx_CS_DDI_Info.9f
'\" te
.\"  Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved
.TH csx_CS_DDI_Info 9F "19 Jul 1996" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
csx_CS_DDI_Info \- obtain DDI information
.SH SYNOPSIS
.LP
.nf
#include <sys/pccard.h> 

\fBint32_t\fR \fBcsx_CS_DDI_Info\fR(\fBcs_ddi_info_t *\fR\fIcdi\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Solaris \fBDDI \fRSpecific (Solaris \fBDDI) \fR
.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIcdi\fR \fR
.ad
.RS 8n
.rt  
Pointer to a \fBcs_ddi_info_t\fR structure.
.RE

.SH DESCRIPTION
.sp
.LP
This function is a Solaris-specific extension that is used by clients that need to provide the \fIxx_getinfo\fR driver entry point (see \fBgetinfo\fR(9E)). It provides a method for clients to obtain \fBDDI \fRinformation based on their socket number and client driver name.
.SH STRUCTURE MEMBERS
.sp
.LP
The structure members of \fBcs_ddi_info_t\fR are:
.sp
.in +2
.nf
uint32_t     Socket;        /* socket number */
char*        driver_name;   /* unique driver name */
dev_info_t   *dip;          /* dip */
int32_t      instance;      /* instance */
.fi
.in -2

.sp
.LP
The fields are defined as follows:
.sp
.ne 2
.mk
.na
\fB\fBSocket\fR \fR
.ad
.RS 16n
.rt  
This field must be set to the physical socket number that the client is interested in getting information about.
.RE

.sp
.ne 2
.mk
.na
\fB\fBdriver_name\fR \fR
.ad
.RS 16n
.rt  
This field must be set to a string containing the name of the client driver to get information about.
.RE

.sp
.LP
If \fBcsx_CS_DDI_Info()\fR is used in a client's \fIxx_getinfo\fR function, then the client will typically extract the \fBSocket\fR value from the \fB*\fR\fIarg\fR argument and it \fImust\fR set the \fBdriver_name\fR field to the same string used with \fBcsx_RegisterClient\fR(9F). 
.sp
.LP
If the \fBdriver_name\fR is found on the \fBSocket\fR, the \fBcsx_CS_DDI_Info()\fR function returns both the \fBdev_info\fR pointer and the \fBinstance\fR fields for the requested driver instance.
.SH RETURN VALUES
.sp
.ne 2
.mk
.na
\fB\fBCS_SUCCESS\fR \fR
.ad
.RS 28n
.rt  
Successful operation.
.RE

.sp
.ne 2
.mk
.na
\fB\fBCS_BAD_SOCKET\fR \fR
.ad
.RS 28n
.rt  
Client not found on \fBSocket\fR. 
.RE

.sp
.ne 2
.mk
.na
\fB\fBCS_UNSUPPORTED_FUNCTION\fR \fR
.ad
.RS 28n
.rt  
No \fBPCMCIA \fRhardware installed.
.RE

.SH CONTEXT
.sp
.LP
This function may be called from user or kernel context.
.SH EXAMPLES
.LP
\fBExample 1 \fR: Using csx_CS_DDI_Info
.sp
.LP
The following example shows how a client might call the \fBcsx_CS_DDI_Info()\fR in the client's \fIxx_getinfo\fR function to return the dip or the instance number:

.sp
.in +2
.nf
static int
pcepp_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg,
	                                                void **result)
{
	   int                          error = DDI_SUCCESS;
	   pcepp_state_t                *pps;
	   cs_ddi_info_t                cs_ddi_info;

   switch (cmd) {
 
	   case DDI_INFO_DEVT2DEVINFO:
          cs_ddi_info.Socket = getminor((dev_t)arg) & 0x3f;
          cs_ddi_info.driver_name = pcepp_name;
          if (csx_CS_DDI_Info(&cs_ddi_info) != CS_SUCCESS)
                   return (DDI_FAILURE);
          if (!(pps = ddi_get_soft_state(pcepp_soft_state_p,
                        cs_ddi_info.instance))) {
                    *result = NULL;
          } else {
                    *result = pps->dip;
          }
          break;

	   case DDI_INFO_DEVT2INSTANCE:
          cs_ddi_info.Socket = getminor((dev_t)arg) & 0x3f;
          cs_ddi_info.driver_name = pcepp_name;
          if (csx_CS_DDI_Info(&cs_ddi_info) != CS_SUCCESS)
	                    return (DDI_FAILURE);
          *result = (void *)cs_ddi_info.instance;
          break;

	   default:
          error = DDI_FAILURE;
          break;

   }

	   return (error);
}
.fi
.in -2

.SH SEE ALSO
.sp
.LP
\fBgetinfo\fR(9E), \fBcsx_RegisterClient\fR(9F), \fBddi_get_instance\fR(9F) 
.sp
.LP
\fIPC Card 95 Standard, PCMCIA/JEIDA\fR