summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/pci_ereport_setup.9f
blob: 649db95543a74adefaf3f37a8e675036fb1678d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" 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.
.\" 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.
.\" 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]
.TH PCI_EREPORT_SETUP 9F "Mar 27, 2016"
.SH NAME
pci_ereport_setup, pci_ereport_teardown, pci_ereport_post \- post error reports
for the generic PCI errors logged in the PCI Configuration Status register.
.SH SYNOPSIS
.LP
.nf
#include <sys/sunddi.h>

\fBvoid\fR \fBpci_ereport_setup\fR(\fBdev_info_t\fR *\fIdip\fR);
.fi

.LP
.nf
\fBvoid\fR \fBpci_ereport_teardown\fR(\fBdev_info_t\fR *\fIdip\fR);
.fi

.LP
.nf
\fBvoid\fR \fBpci_ereport_post\fR(\fBdev_info_t\fR *\fIdip\fR, \fBddi_fm_error_t\fR *\fIdep\fR,
     \fBuin16_t\fR *\fIstatus\fR);
.fi

.SH INTERFACE LEVEL
.LP
Solaris DDI specific (Solaris DDI)
.SH PARAMETERS
.ne 2
.na
\fB\fIdip\fR\fR
.ad
.RS 10n
Pointer to the \fBdev_info\fR structure of the devices
.RE

.sp
.ne 2
.na
\fB\fIdep\fR\fR
.ad
.RS 10n
Pointer to DDI error status
.RE

.sp
.ne 2
.na
\fB\fIstatus\fR\fR
.ad
.RS 10n
Pointer to status bit storage location
.RE

.SH DESCRIPTION
.LP
The \fBpci_ereport_setup()\fR function initializes support for error report
generation and sets up the resources for subsequent access to \fBPCI\fR,
\fBPCI/X\fR or \fBPCI Express Configuration\fR space. The caller must have
established a fault management capability level of at least
\fBDDI_FM_EREPORT_CAPABLE\fR with a previous call to \fBddi_fm_init()\fR for
\fIdip\fR.
.sp
.LP
The \fBpci_ereport_teardown()\fR function releases any resources allocated and
set up by \fBpci_ereport_setup()\fR and associated with \fIdip\fR.
.sp
.LP
The \fBpci_ereport_post()\fR function is called to scan for and post any
\fBPCI\fR, \fBPCI/X\fR or \fBPCI Express Bus\fR errors. On a \fBPCI\fR bus, for
example, the errors detected include:
.RS +4
.TP
.ie t \(bu
.el o
Detected Parity Error
.RE
.RS +4
.TP
.ie t \(bu
.el o
Master Data Parity Error
.RE
.RS +4
.TP
.ie t \(bu
.el o
Target Abort
.RE
.RS +4
.TP
.ie t \(bu
.el o
Master Abort
.RE
.RS +4
.TP
.ie t \(bu
.el o
System Error
.RE
.RS +4
.TP
.ie t \(bu
.el o
Discard Timeout
.RE
.sp
.LP
The \fBpci_ereport_post()\fR function must be called only from a driver's error
handler callback function. See \fBddi_fm_handler_register\fR(9F). The
\fIerror_status\fR argument to the error handler callback function should be
passed through as the \fIdep\fR argument to \fBpci_ereport_post()\fR as it may
contain bus specific information that might be useful for handling any errors
that are discovered.
.sp
.LP
The \fBfme_flag\fR in the \fBerror_status\fR argument to the error handler
callback function will contain one of the following:
.sp
.ne 2
.na
\fB\fBDDI_FM_ERR_UNEXPECTED()\fR\fR
.ad
.RS 27n
Any errors discovered are unexpected.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FM_ERR_EXPECTED()\fR\fR
.ad
.RS 25n
Errors discovered were the result of a \fBDDI_ACC_CAUTIOUS\fR operation.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FM_ERR_POKE()\fR\fR
.ad
.RS 25n
Errors discovered are the result of a \fBddi_poke\fR(9F) operation.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FM_ERR_PEEK()\fR\fR
.ad
.RS 25n
Errors discovered are the result of a \fBddi_peek\fR(9F) operation.
.RE

.sp
.LP
Error report events are generated automatically if \fBfme_flag\fR is set to
\fBDDI_FM_ERR_UNEXPECTED\fR and the corresponding error bits are set in the
various \fBPCI\fR, \fBPCI/X\fR or \fBPCI Express Bus\fR error registers of the
device associated with \fIdip\fR. The generated error report events are posted
to the Solaris Fault Manager, \fBfmd\fR(1M), for diagnosis.
.sp
.LP
If the status argument is non-null, \fBpci_ereport_post()\fR saves the contents
of the \fBPCI Configuration Status Register\fR to \fB*status\fR. If it is not
possible to read the \fBPCI Configuration Status Register\fR, \fB-1\fR is
returned in \fB*status\fR instead.
.sp
.LP
On return from the call to \fBpci_ereport_post()\fR, the \fBddi_fm_error_t\fR
structure pointed at by \fIdep\fR will have been updated, and the
\fBfme_status\fR field contains one of the following values:
.sp
.ne 2
.na
\fB\fBDDI_FM_OK\fR\fR
.ad
.RS 19n
No errors were detected which might affect this device instance.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FM_FATAL\fR\fR
.ad
.RS 19n
An error which is considered fatal to the operational state of the system was
detected.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FM_NONFATAL\fR\fR
.ad
.RS 19n
An error which is not considered fatal to the operational state of the system
was detected. The \fBfme_acc_handle\fR or \fBfme_dma_handle\fR fields in the
returned \fBddi_fm_error_t\fR structure will typically reference a handle that
belongs to the device instance that has been affected.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FM_UNKNOWN\fR\fR
.ad
.RS 19n
An error was detected, but the call was unable to determine the impact of the
error on the operational state of the system. This is treated the same way as
\fBDDI_FM_FATAL\fR unless some other device is able to evaluate the fault to be
\fBDDI_FM_NONFATAL\fR.
.RE

.SH CONTEXT
.LP
The \fBpci_ereport_setup()\fR and \fBpci_ereport_teardown()\fR functions must
be called from user or kernel context.
.sp
.LP
The \fBpci_ereport_post()\fR function can be called in any context.
.SH EXAMPLES
.in +2
.nf
int xxx_fmcap = DDI_FM_EREPORT_CAPABLE | DDI_FM_ERRCB_CAPABLE;

xxx_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) {

      ddi_fm_init(dip, &xxx_fmcap, &xxx_ibc);
      if (xxx_fmcap & DDI_FM_ERRCB_CAPABLE)
         ddi_fm_handler_register(dip, xxx_err_cb);
      if (xxx_fmcap & DDI_FM_EREPORT_CAPABLE)
         pci_ereport_setup(dip);

}

xxx_err_cb(dev_info_t *dip, ddi_fm_error_t *errp) {
     uint16_t status;

     pci_ereport_post(dip, errp, &status);
     return (errp->fme_status);
}

xxx_detach(dev_info_t *dip, ddi_attach_cmd_t cmd) {

     if (xxx_fmcap & DDI_FM_EREPORT_CAPABLE)
         pci_ereport_teardown(dip);
     if (xxx_fmcap & DDI_FM_ERRCB_CAPABLE)
         ddi_fm_handler_unregister(dip);
     ddi_fm_fini(dip);

}
.fi
.in -2

.SH ATTRIBUTES
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
.TE

.SH SEE ALSO
.LP
\fBfmd\fR(1M), \fBattributes\fR(5), \fBddi_fm_handler_register\fR(9F),
\fBddi_fm_init\fR(9F), \fBddi_peek\fR(9F), \fBddi_poke\fR(9F),
\fBddi_fm_error\fR(9S)