Print this page
NEX-1890 update oce from source provided by Emulex
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/io/fibre-channel/fca/oce/oce_fm.c
+++ new/usr/src/uts/common/io/fibre-channel/fca/oce/oce_fm.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 -/* Copyright © 2003-2011 Emulex. All rights reserved. */
22 +/*
23 + * Copyright (c) 2009-2012 Emulex. All rights reserved.
24 + * Use is subject to license terms.
25 + */
23 26
27 +
28 +
24 29 /*
25 30 * Source file containing the implementation of fma support in driver
26 31 *
27 32 */
28 33
29 34 #include <oce_impl.h>
30 35
31 36 static int oce_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err,
32 37 const void *impl_data);
33 38
34 39 /*
35 40 * function to initialize driver fma support
36 41 *
37 42 * dev - software handle to the device
38 43 *
39 44 * return none
40 45 */
41 46
42 47 void
43 48 oce_fm_init(struct oce_dev *dev)
44 49 {
45 50 ddi_iblock_cookie_t ibc;
46 51
47 52 if (dev->fm_caps == DDI_FM_NOT_CAPABLE) {
48 53 return;
49 54 }
50 55
51 56 oce_set_dma_fma_flags(dev->fm_caps);
52 57 oce_set_reg_fma_flags(dev->fm_caps);
53 58
54 59 (void) ddi_fm_init(dev->dip, &dev->fm_caps, &ibc);
55 60 if (DDI_FM_EREPORT_CAP(dev->fm_caps) ||
56 61 DDI_FM_ERRCB_CAP(dev->fm_caps)) {
57 62 pci_ereport_setup(dev->dip);
58 63 }
59 64 if (DDI_FM_ERRCB_CAP(dev->fm_caps)) {
60 65 ddi_fm_handler_register(dev->dip, oce_fm_error_cb,
61 66 (void *)dev);
62 67 }
63 68 } /* oce_fm_init */
64 69
65 70 /*
66 71 * function to deinitialize driver fma support
67 72 *
68 73 * dev - software handle to the device
69 74 *
70 75 * return none
71 76 */
72 77 void
73 78 oce_fm_fini(struct oce_dev *dev)
74 79 {
75 80 if (dev->fm_caps == DDI_FM_NOT_CAPABLE) {
76 81 return;
77 82 }
78 83 if (DDI_FM_ERRCB_CAP(dev->fm_caps)) {
79 84 ddi_fm_handler_unregister(dev->dip);
80 85 }
81 86 if (DDI_FM_EREPORT_CAP(dev->fm_caps) ||
82 87 DDI_FM_ERRCB_CAP(dev->fm_caps)) {
83 88 pci_ereport_teardown(dev->dip);
84 89 }
85 90 (void) ddi_fm_fini(dev->dip);
86 91 } /* oce_fm_fini */
87 92
88 93 /*
89 94 * function to check the access handle
90 95 *
91 96 * dev - software handle to the device
92 97 * acc_handle - access handle
93 98 *
94 99 * return fm error status
95 100 */
96 101 int
97 102 oce_fm_check_acc_handle(struct oce_dev *dev, ddi_acc_handle_t acc_handle)
98 103 {
99 104 ddi_fm_error_t fme;
100 105
101 106
102 107 if (!DDI_FM_ACC_ERR_CAP(dev->fm_caps)) {
103 108 return (DDI_FM_OK);
104 109 }
105 110 (void) ddi_fm_acc_err_get(acc_handle, &fme, DDI_FME_VERSION);
106 111 (void) ddi_fm_acc_err_clear(acc_handle, DDI_FME_VERSION);
107 112
108 113 return (fme.fme_status);
109 114 } /* oce_fm_chk_ach */
110 115
111 116 /*
112 117 * function to check error updates associated with a dma handle
113 118 *
114 119 * dev - software handle to the device
115 120 * dma_handle - dma handle to the resources on which to check for errors
116 121 *
117 122 * return error code. DDI_FM_OK => no error
118 123 */
119 124 int
120 125 oce_fm_check_dma_handle(struct oce_dev *dev, ddi_dma_handle_t dma_handle)
121 126 {
122 127 ddi_fm_error_t fme;
123 128
124 129 if (!DDI_FM_DMA_ERR_CAP(dev->fm_caps)) {
125 130 return (DDI_FM_OK);
126 131 }
127 132
128 133 (void) ddi_fm_dma_err_get(dma_handle, &fme, DDI_FME_VERSION);
129 134 return (fme.fme_status);
130 135 } /* oce_fm_chk_dh */
131 136
132 137 /*
133 138 * function to report an error to the FMA framework
134 139 *
135 140 * dev - software handle to the device
136 141 * detail - OS defined string that provides the kind of error to report
137 142 */
138 143 void
139 144 oce_fm_ereport(struct oce_dev *dev, char *detail)
140 145 {
141 146 uint64_t ena;
142 147 char buf[FM_MAX_CLASS];
143 148
144 149 if (!DDI_FM_EREPORT_CAP(dev->fm_caps) || detail == NULL) {
145 150 return;
146 151 }
147 152 (void) snprintf(buf, FM_MAX_CLASS, "%s.%s", DDI_FM_DEVICE, detail);
148 153 ena = fm_ena_generate(0, FM_ENA_FMT1);
149 154 if (DDI_FM_EREPORT_CAP(dev->fm_caps)) {
150 155 ddi_fm_ereport_post(dev->dip, buf, ena, DDI_NOSLEEP,
151 156 FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0, NULL);
152 157 }
153 158 } /* oce_fm_ereport */
154 159
155 160 /*
156 161 * callback function registered with the FMA infrastructure. This callback is
157 162 * called by the nexux driver if there is an error with the device
158 163 *
159 164 * dip - dev_info_t structure for this device
160 165 * err - error information provided by the nexus
161 166 * impl_data - callback data
162 167 *
163 168 * return error code. DDI_FM_OK => no error
164 169 */
165 170 static int
166 171 oce_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err, const void *impl_data)
167 172 {
168 173 _NOTE(ARGUNUSED(impl_data));
169 174 /* Driver must handle the dma/access error */
170 175 pci_ereport_post(dip, err, NULL);
171 176 return (err->fme_status);
172 177 }
|
↓ open down ↓ |
139 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX