1 PROBE(9E)                     Driver Entry Points                    PROBE(9E)
   2 
   3 
   4 
   5 NAME
   6        probe - determine if a non-self-identifying device is present
   7 
   8 SYNOPSIS
   9        #include <sys/conf.h>
  10        #include <sys/ddi.h>
  11        #include <sys/sunddi.h>
  12 
  13 
  14 
  15        static int prefixprobe(dev_info_t *dip);
  16 
  17 
  18 INTERFACE LEVEL
  19        Solaris DDI specific (Solaris DDI). This entry point is required for
  20        non-self-identifying devices.  You must write it for such devices. For
  21        self-identifying devices, nulldev(9F) should be specified in the
  22        dev_ops(9S) structure if a probe routine is not necessary.
  23 
  24 ARGUMENTS
  25        dip
  26                Pointer to the device's dev_info structure.
  27 
  28 
  29 DESCRIPTION
  30        probe() determines whether the device corresponding to dip actually
  31        exists and is a valid device for this driver. probe() is called after
  32        identify(9E) and before attach(9E) for a given dip. For example, the
  33        probe() routine can map the device registers using ddi_map_regs(9F)
  34        then attempt to access the hardware using ddi_peek(9F) or ddi_poke(9F)
  35        and determine if the device exists.  Then the device registers should
  36        be unmapped using ddi_unmap_regs(9F).
  37 
  38 
  39        To probe a device that was left powered off after the last detach(), it
  40        might be necessary to power it up. If so, the driver must power up the
  41        device by accessing device registers directly. pm_raise_power(9F) will
  42        be not be available until attach(9E). The framework ensures that the
  43        ancestors of the node being probed and all relevant platform-specific
  44        power management hardware is at full power at the time that probe() is
  45        called.
  46 
  47 
  48        probe() should only probe the device. It should not change any software
  49        state and should not create any software state. Device initialization
  50        should be done in attach(9E).
  51 
  52 
  53        For a self-identifying device, this entry point is not necessary.
  54        However, if a device exists in both self-identifying and non-self-
  55        identifying forms, a probe() routine can be provided to simplify the
  56        driver.  ddi_dev_is_sid(9F) can then be used to determine whether
  57        probe() needs to do any work. See ddi_dev_is_sid(9F) for an example.
  58 
  59 RETURN VALUES
  60        DDI_PROBE_SUCCESS
  61                               If the probe was successful.
  62 
  63 
  64        DDI_PROBE_FAILURE
  65                               If the probe failed.
  66 
  67 
  68        DDI_PROBE_DONTCARE
  69                               If the probe was unsuccessful, yet attach(9E)
  70                               should still be called.
  71 
  72 
  73        DDI_PROBE_PARTIAL
  74                               If the instance is not present now, but may be
  75                               present in the future.
  76 
  77 
  78 SEE ALSO
  79        attach(9E), identify(9E), ddi_dev_is_sid(9F), ddi_map_regs(9F),
  80        ddi_peek(9F), ddi_poke(9F), nulldev(9F), dev_ops(9S)
  81 
  82 
  83        Writing Device Drivers
  84 
  85 
  86 
  87                                February 15, 2020                     PROBE(9E)