1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 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 /* 23 * Copyright 2010 QLogic Corporation. All rights reserved. 24 */ 25 26 #include <qlge.h> 27 28 #define QL_FM_BUF_LEN 128 29 30 void 31 ql_fm_ereport(qlge_t *qlge, char *detail) 32 { 33 uint64_t ena; 34 char buf[QL_FM_BUF_LEN]; 35 36 (void) snprintf(buf, QL_FM_BUF_LEN, "%s.%s", DDI_FM_DEVICE, detail); 37 ena = fm_ena_generate(0, FM_ENA_FMT1); 38 if (DDI_FM_EREPORT_CAP(qlge->fm_capabilities)) { 39 ddi_fm_ereport_post(qlge->dip, buf, ena, DDI_NOSLEEP, 40 FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERS0, NULL); 41 } 42 } 43 44 int 45 ql_fm_check_acc_handle(ddi_acc_handle_t handle) 46 { 47 ddi_fm_error_t err; 48 49 ddi_fm_acc_err_get(handle, &err, DDI_FME_VERSION); 50 /* for OpenSolaris */ 51 ddi_fm_acc_err_clear(handle, DDI_FME_VERSION); 52 return (err.fme_status); 53 } 54 55 int 56 ql_fm_check_dma_handle(ddi_dma_handle_t handle) 57 { 58 ddi_fm_error_t err; 59 60 ddi_fm_dma_err_get(handle, &err, DDI_FME_VERSION); 61 return (err.fme_status); 62 } 63