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