6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #pragma ident "%Z%%M% %I% %E% SMI"
27
28 #include <sys/ddi.h>
29 #include <sys/sunddi.h>
30 #include <sys/sunndi.h>
31 #include <sys/ddi_impldefs.h>
32 #include <sys/ddi_implfuncs.h>
33 #include <sys/list.h>
34 #include <sys/reboot.h>
35 #include <sys/sysmacros.h>
36 #include <sys/console.h>
37 #include <sys/devcache.h>
38
39 /*
40 * The nvpair name in the I/O retire specific sub-nvlist
41 */
42 #define RIO_STORE_VERSION_STR "rio-store-version"
43 #define RIO_STORE_MAGIC_STR "rio-store-magic"
44 #define RIO_STORE_FLAGS_STR "rio-store-flags"
45
46 #define RIO_STORE_VERSION_1 1
47 #define RIO_STORE_VERSION RIO_STORE_VERSION_1
293 flags = RIO_STORE_F_RETIRED;
294 rval = nvlist_add_int32(line_nvl, RIO_STORE_FLAGS_STR,
295 flags);
296 if (rval != 0) {
297 goto error;
298 }
299
300 rval = nvlist_add_nvlist(nvl, rsp->rst_devpath, line_nvl);
301 if (rval != 0) {
302 goto error;
303 }
304 nvlist_free(line_nvl);
305 line_nvl = NULL;
306 }
307
308 *ret_nvl = nvl;
309 STORE_DBG((CE_NOTE, "packed retire list into nvlist"));
310 return (DDI_SUCCESS);
311
312 error:
313 if (line_nvl)
314 nvlist_free(line_nvl);
315 ASSERT(nvl);
316 nvlist_free(nvl);
317 return (DDI_FAILURE);
318 }
319
320 int
321 e_ddi_retire_persist(char *devpath)
322 {
323 rio_store_t *rsp;
324 rio_store_t *new_rsp;
325 list_t *listp;
326 char *new_path;
327
328 STORE_DBG((CE_NOTE, "e_ddi_retire_persist: entered: %s", devpath));
329
330 new_rsp = kmem_zalloc(sizeof (*new_rsp), KM_SLEEP);
331 new_rsp->rst_devpath = new_path = i_ddi_strdup(devpath, KM_SLEEP);
332 new_rsp->rst_flags = RIO_STORE_F_RETIRED;
333
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/ddi.h>
27 #include <sys/sunddi.h>
28 #include <sys/sunndi.h>
29 #include <sys/ddi_impldefs.h>
30 #include <sys/ddi_implfuncs.h>
31 #include <sys/list.h>
32 #include <sys/reboot.h>
33 #include <sys/sysmacros.h>
34 #include <sys/console.h>
35 #include <sys/devcache.h>
36
37 /*
38 * The nvpair name in the I/O retire specific sub-nvlist
39 */
40 #define RIO_STORE_VERSION_STR "rio-store-version"
41 #define RIO_STORE_MAGIC_STR "rio-store-magic"
42 #define RIO_STORE_FLAGS_STR "rio-store-flags"
43
44 #define RIO_STORE_VERSION_1 1
45 #define RIO_STORE_VERSION RIO_STORE_VERSION_1
291 flags = RIO_STORE_F_RETIRED;
292 rval = nvlist_add_int32(line_nvl, RIO_STORE_FLAGS_STR,
293 flags);
294 if (rval != 0) {
295 goto error;
296 }
297
298 rval = nvlist_add_nvlist(nvl, rsp->rst_devpath, line_nvl);
299 if (rval != 0) {
300 goto error;
301 }
302 nvlist_free(line_nvl);
303 line_nvl = NULL;
304 }
305
306 *ret_nvl = nvl;
307 STORE_DBG((CE_NOTE, "packed retire list into nvlist"));
308 return (DDI_SUCCESS);
309
310 error:
311 nvlist_free(line_nvl);
312 ASSERT(nvl);
313 nvlist_free(nvl);
314 return (DDI_FAILURE);
315 }
316
317 int
318 e_ddi_retire_persist(char *devpath)
319 {
320 rio_store_t *rsp;
321 rio_store_t *new_rsp;
322 list_t *listp;
323 char *new_path;
324
325 STORE_DBG((CE_NOTE, "e_ddi_retire_persist: entered: %s", devpath));
326
327 new_rsp = kmem_zalloc(sizeof (*new_rsp), KM_SLEEP);
328 new_rsp->rst_devpath = new_path = i_ddi_strdup(devpath, KM_SLEEP);
329 new_rsp->rst_flags = RIO_STORE_F_RETIRED;
330
|