Writing Device Drivers for Oracle® Solaris 11.2

Exit Print View

Updated: September 2014
 
 

dev_ops Structure

static struct dev_ops xx_dev_ops = {
    DEVO_REV,                  /* devo_rev */
    0,                         /* devo_refcnt  */
    xxgetinfo,                 /* devo_getinfo: getinfo(9E) */
    nulldev,                   /* devo_identify: identify(9E) */
    xxprobe,                   /* devo_probe: probe(9E) */
    xxattach,                  /* devo_attach: attach(9E) */
    xxdetach,                  /* devo_detach: detach(9E) */
    nodev,                     /* devo_reset: see devo_quiesce */
    &xx_cb_ops,                /* devo_cb_ops */
    NULL,                      /* devo_bus_ops */
    &xxpower,                  /* devo_power: power(9E) */
    ddi_quiesce_not_needed,    /* devo_quiesce: quiesce(9E) */
};

The dev_ops(9S) structure enables the kernel to find the autoconfiguration entry points of the device driver. The devo_rev field identifies the revision number of the structure. This field must be set to DEVO_REV. The devo_refcnt field must be initialized to zero. The function address fields should be filled in with the address of the appropriate driver entry point, except in the following cases:

  • Set the devo_identify field to nulldev(9F). The identify() entry point is obsolete.

  • Set the devo_probe field to nulldev(9F) if a probe(9E) routine is not needed.

  • Set the devo_reset field to nodev(9F). The nodev() function returns ENXIO. See devo_quiesce.

  • Set the devo_power field to NULL if a power() routine is not needed. Drivers for devices that provide Power Management functionality must have a power(9E) entry point. See Chapter 12, Power Management.

  • Set the devo_quiesce field to ddi_quiesce_not_needed() if the driver does not need to implement quiesce. Drivers that manage devices must provide a quiesce(9E) entry point.

The devo_cb_ops member should include the address of the cb_ops(9S) structure. The devo_bus_ops field must be set to NULL.