1 '\" te 2 .\" Copyright (c) 2000, Sun Microsystems, Inc. 3 .\" All Rights Reserved 4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 7 .TH PROBE 9E "February 15, 2020" 8 .SH NAME 9 probe \- determine if a non-self-identifying device is present 10 .SH SYNOPSIS 11 .nf 12 #include <sys/conf.h> 13 #include <sys/ddi.h> 14 #include <sys/sunddi.h> 15 16 17 18 \fBstatic int prefix\fR\fBprobe\fR(\fBdev_info_t *\fR\fIdip\fR); 19 .fi 20 21 .SH INTERFACE LEVEL 22 Solaris DDI specific (Solaris DDI). This entry point is required for 23 non-self-identifying devices. You must write it for such devices. For 24 self-identifying devices, \fBnulldev\fR(9F) should be specified in the 25 \fBdev_ops\fR(9S) structure if a probe routine is not necessary. 26 .SH ARGUMENTS 27 .ne 2 28 .na 29 \fB\fIdip\fR \fR 30 .ad 31 .RS 8n 32 Pointer to the device's \fBdev_info\fR structure. 33 .RE 34 35 .SH DESCRIPTION 36 \fBprobe()\fR determines whether the device corresponding to \fIdip\fR actually 37 exists and is a valid device for this driver. \fBprobe()\fR is called after 38 \fBidentify\fR(9E) and before \fBattach\fR(9E) for a given \fIdip\fR. For 39 example, the \fBprobe()\fR routine can map the device registers using 40 \fBddi_map_regs\fR(9F) then attempt to access the hardware using 41 \fBddi_peek\fR(9F) or \fBddi_poke\fR(9F) and determine if the device exists. 42 Then the device registers should be unmapped using \fBddi_unmap_regs\fR(9F). 43 .sp 44 .LP 45 To probe a device that was left powered off after the last \fBdetach()\fR, it 46 might be necessary to power it up. If so, the driver must power up the device 47 by accessing device registers directly. \fBpm_raise_power\fR(9F) will be not be 48 available until \fBattach\fR(9E). The framework ensures that the ancestors of 49 the node being probed and all relevant platform-specific power management 50 hardware is at full power at the time that \fBprobe()\fR is called. 51 .sp 52 .LP 53 \fBprobe()\fR should only probe the device. It should not change any software 54 state and should not create any software state. Device initialization should be 55 done in \fBattach\fR(9E). 56 .sp 57 .LP 58 For a self-identifying device, this entry point is not necessary. However, if a 59 device exists in both self-identifying and non-self-identifying forms, a 60 \fBprobe()\fR routine can be provided to simplify the driver. 61 \fBddi_dev_is_sid\fR(9F) can then be used to determine whether \fBprobe()\fR 62 needs to do any work. See \fBddi_dev_is_sid\fR(9F) for an example. 63 .SH RETURN VALUES 64 .ne 2 65 .na 66 \fB\fBDDI_PROBE_SUCCESS\fR \fR 67 .ad 68 .RS 23n 69 If the probe was successful. 70 .RE 71 72 .sp 73 .ne 2 74 .na 75 \fB\fBDDI_PROBE_FAILURE\fR \fR 76 .ad 77 .RS 23n 78 If the probe failed. 79 .RE 80 81 .sp 82 .ne 2 83 .na 84 \fB\fBDDI_PROBE_DONTCARE\fR \fR 85 .ad 86 .RS 23n 87 If the probe was unsuccessful, yet \fBattach\fR(9E) should still be called. 88 .RE 89 90 .sp 91 .ne 2 92 .na 93 \fB\fBDDI_PROBE_PARTIAL\fR \fR 94 .ad 95 .RS 23n 96 If the instance is not present now, but may be present in the future. 97 .RE 98 99 .SH SEE ALSO 100 \fBattach\fR(9E), \fBidentify\fR(9E), \fBddi_dev_is_sid\fR(9F), 101 \fBddi_map_regs\fR(9F), \fBddi_peek\fR(9F), \fBddi_poke\fR(9F), 102 \fBnulldev\fR(9F), \fBdev_ops\fR(9S) 103 .sp 104 .LP 105 \fIWriting Device Drivers\fR