JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Driver Entry Points     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Driver Entry Points

aread(9E)

attach(9E)

audio_engine_channels(9E)

audio_engine_chinfo(9E)

audio_engine_close(9E)

audio_engine_count(9E)

audio_engine_format(9E)

audio_engine_open(9E)

audio_engine_playahead(9E)

audio_engine_qlen(9E)

audio_engine_rate(9E)

audio_engine_start(9E)

audio_engine_stop(9E)

audio_engine_sync(9E)

awrite(9E)

chpoll(9E)

close(9E)

csx_event_handler(9E)

detach(9E)

devmap(9E)

devmap_access(9E)

devmap_contextmgt(9E)

devmap_dup(9E)

devmap_map(9E)

devmap_unmap(9E)

dump(9E)

_fini(9E)

getinfo(9E)

gld(9E)

gldm_get_stats(9E)

gldm_intr(9E)

gldm_ioctl(9E)

gldm_reset(9E)

gldm_send(9E)

gldm_set_mac_addr(9E)

gldm_set_multicast(9E)

gldm_set_promiscuous(9E)

gldm_start(9E)

gldm_stop(9E)

identify(9E)

_info(9E)

_init(9E)

ioctl(9E)

ks_snapshot(9E)

ks_update(9E)

mac(9E)

mac_capab_rings(9E)

mac_group_info(9E)

mac_ring_info(9E)

mc_getcapab(9E)

mc_getprop(9E)

mc_getstat(9E)

mc_ioctl(9E)

mc_multicst(9E)

mc_propinfo(9E)

mc_setpromisc(9E)

mc_setprop(9E)

mc_start(9E)

mc_stop(9E)

mc_tx(9E)

mc_unicst(9E)

mgi_addmac(9E)

mgi_add_vlanfilter(9E)

mgi_getsriov_info(9E)

mgi_remmac(9E)

mgi_rem_vlanfliter(9E)

mgi_setmtu(9E)

mgi_start(9E)

mgi_stop(9E)

mmap(9E)

mr_gaddring(9E)

mr_gget(9E)

mr_gremring(9E)

mri_intr_disable(9E)

mri_intr_enable(9E)

mri_poll(9E)

mri_start(9E)

mri_stat(9E)

mri_stop(9E)

mri_tx(9E)

mr_rget(9E)

open(9E)

power(9E)

print(9E)

probe(9E)

prop_op(9E)

put(9E)

quiesce(9E)

read(9E)

segmap(9E)

sofop_accepted(9E)

sofop_attach_active(9E)

sofop_attach_passive(9E)

sofop_bind(9E)

sofop_connect(9E)

sofop_data_in(9E)

sofop_data_in_proc(9E)

sofop_data_out(9E)

sofop_detach(9E)

sofop_getpeername(9E)

sofop_getsockname(9E)

sofop_getsockopt(9E)

sofop_listen(9E)

sofop_notify(9E)

sofop_setsockopt(9E)

sofop_shutdown(9E)

srv(9E)

strategy(9E)

tran_abort(9E)

tran_bus_reset(9E)

tran_destroy_pkt(9E)

tran_dmafree(9E)

tran_getcap(9E)

tran_init_pkt(9E)

tran_pkt_constructor(9E)

tran_pkt_destructor(9E)

tran_quiesce(9E)

tran_reset(9E)

tran_reset_notify(9E)

tran_setcap(9E)

tran_setup_pkt(9E)

tran_start(9E)

tran_sync_pkt(9E)

tran_teardown_pkt(9E)

tran_tgt_free(9E)

tran_tgt_init(9E)

tran_tgt_probe(9E)

tran_unquiesce(9E)

write(9E)

getinfo

- get device driver information

Synopsis

#include <sys/ddi.h>
#include <sys/sunddi.h>

int prefixgetinfo(dev_info_t *dip, ddi_info_cmd_t cmd, 
     void *arg, void **resultp);

Interface Level

Solaris DDI specific (Solaris DDI). This entry point is required for drivers which export cb_ops(9S) entry points.

ARGUMENTS

dip

Do not use.

cmd

Command argument – valid command values are DDI_INFO_DEVT2DEVINFO and DDI_INFO_DEVT2INSTANCE.

arg

Command specific argument.

resultp

Pointer to where the requested information is stored.

Description

When cmd is set to DDI_INFO_DEVT2DEVINFO, getinfo() should return the dev_info_t pointer associated with the dev_t arg. The dev_info_t pointer should be returned in the field pointed to by resultp.

When cmd is set to DDI_INFO_DEVT2INSTANCE, getinfo() should return the instance number associated with the dev_t arg. The instance number should be returned in the field pointed to by resultp.

Drivers which do not export cb_ops(9S) entry points are not required to provide a getinfo() entry point, and may use nodev(9F) in the devo_getinfo field of the dev_ops(9S) structure. A SCSI HBA driver is an example of a driver which is not required to provide cb_ops(9S) entry points.

Return Values

getinfo() should return:

DDI_SUCCESS

on success.

DDI_FAILURE

on failure.

Examples

Example 1 getinfo() implementation

/*ARGSUSED*/ 
static int
rd_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, \
void **resultp)
{
       /* Note that in this simple example
        * the minor number is the instance
        * number.      */
         
     devstate_t *sp;
     int error = DDI_FAILURE;
     switch (infocmd) {
     case DDI_INFO_DEVT2DEVINFO:
          if ((sp = ddi_get_soft_state(statep,
              getminor((dev_t) arg))) != NULL) {
                 *resultp = sp->devi;
                 error = DDI_SUCCESS;
          } else
                 *result = NULL;
          break;

     case DDI_INFO_DEVT2INSTANCE:
          *resultp = (void *) (uintptr_t) getminor((dev_t) arg);
          error = DDI_SUCCESS;
          break;
     }

     return (error);
}

See Also

ddi_no_info(9F), nodev(9F), cb_ops(9S), dev_ops(9S)

Writing Device Drivers

Notes

Non-gld(7D)-based DLPI network streams drivers are encouraged to switch to gld(7D). Failing this, a driver that creates DLPI style-2 minor nodes must specify CLONE_DEV for its style-2 ddi_create_minor_node(9F) nodes and use qassociate(9F). A driver that supports both style-1 and style-2 minor nodes should return DDI_FAILURE for DDI_INFO_DEVT2INSTANCE and DDI_INFO_DEVT2DEVINFO getinfo() calls to style-2 minor nodes. (The correct association is already established by qassociate(9F)). A driver that only supports style-2 minor nodes can use ddi_no_info(9F) for its getinfo() implementation. For drivers that do not follow these rules, the results of a modunload(1M) of the driver or a cfgadm(1M) remove of hardware controlled by the driver are undefined.