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 "Nov 18, 1992" 8 .SH NAME 9 probe \- determine if a non-self-identifying device is present 10 .SH SYNOPSIS 11 .LP 12 .nf 13 #include <sys/conf.h> 14 #include <sys/ddi.h> 15 #include <sys/sunddi.h> 16 17 18 19 \fBstatic intprefix\fR\fBprobe\fR(\fBdev_info_t *\fR\fIdip\fR); 20 .fi 21 22 .SH INTERFACE LEVEL 23 .sp 24 .LP 25 Solaris DDI specific (Solaris DDI). This entry point is required for 26 non-self-identifying devices. You must write it for such devices. For 27 self-identifying devices, \fBnulldev\fR(9F) should be specified in the 28 \fBdev_ops\fR(9S) structure if a probe routine is not necessary. 29 .SH ARGUMENTS 30 .sp 31 .ne 2 32 .na 33 \fB\fIdip\fR \fR 34 .ad 35 .RS 8n 36 Pointer to the device's \fBdev_info\fR structure. 37 .RE 38 39 .SH DESCRIPTION 40 .sp 41 .LP 42 \fBprobe()\fR determines whether the device corresponding to \fIdip\fR actually 43 exists and is a valid device for this driver. \fBprobe()\fR is called after 44 \fBidentify\fR(9E) and before \fBattach\fR(9E) for a given \fIdip\fR. For 45 example, the \fBprobe()\fR routine can map the device registers using 46 \fBddi_map_regs\fR(9F) then attempt to access the hardware using 47 \fBddi_peek\fR(9F) or \fBddi_poke\fR(9F) and determine if the device exists. 48 Then the device registers should be unmapped using \fBddi_unmap_regs\fR(9F). 49 .sp 50 .LP 51 To probe a device that was left powered off after the last \fBdetach()\fR, it 52 might be necessary to power it up. If so, the driver must power up the device 53 by accessing device registers directly. \fBpm_raise_power\fR(9F) will be not be 54 available until \fBattach\fR(9E). The framework ensures that the ancestors of 55 the node being probed and all relevant platform-specific power management 56 hardware is at full power at the time that \fBprobe()\fR is called. 57 .sp 58 .LP 59 \fBprobe()\fR should only probe the device. It should not change any software 60 state and should not create any software state. Device initialization should be 61 done in \fBattach\fR(9E). 62 .sp 63 .LP 64 For a self-identifying device, this entry point is not necessary. However, if a 65 device exists in both self-identifying and non-self-identifying forms, a 66 \fBprobe()\fR routine can be provided to simplify the driver. 67 \fBddi_dev_is_sid\fR(9F) can then be used to determine whether \fBprobe()\fR 68 needs to do any work. See \fBddi_dev_is_sid\fR(9F) for an example. 69 .SH RETURN VALUES 70 .sp 71 .ne 2 72 .na 73 \fB\fBDDI_PROBE_SUCCESS\fR \fR 74 .ad 75 .RS 23n 76 If the probe was successful. 77 .RE 78 79 .sp 80 .ne 2 81 .na 82 \fB\fBDDI_PROBE_FAILURE\fR \fR 83 .ad 84 .RS 23n 85 If the probe failed. 86 .RE 87 88 .sp 89 .ne 2 90 .na 91 \fB\fBDDI_PROBE_DONTCARE\fR \fR 92 .ad 93 .RS 23n 94 If the probe was unsuccessful, yet \fBattach\fR(9E) should still be called. 95 .RE 96 97 .sp 98 .ne 2 99 .na 100 \fB\fBDDI_PROBE_PARTIAL\fR \fR 101 .ad 102 .RS 23n 103 If the instance is not present now, but may be present in the future. 104 .RE 105 106 .SH SEE ALSO 107 .sp 108 .LP 109 \fBattach\fR(9E), \fBidentify\fR(9E), \fBddi_dev_is_sid\fR(9F), 110 \fBddi_map_regs\fR(9F), \fBddi_peek\fR(9F), \fBddi_poke\fR(9F), 111 \fBnulldev\fR(9F), \fBdev_ops\fR(9S) 112 .sp 113 .LP 114 \fIWriting Device Drivers\fR