emlxs_event.c (82527734) emlxs_event.c (a9800beb)
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

--- 6 unchanged lines hidden (view full) ---

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/*
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

--- 6 unchanged lines hidden (view full) ---

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 2009 Emulex. All rights reserved.
23 * Copyright 2010 Emulex. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27
28#define DEF_EVENT_STRUCT /* Needed for emlxs_events.h in emlxs_event.h */
29#include <emlxs.h>
30
31

--- 29 unchanged lines hidden (view full) ---

61} /* emlxs_event_check() */
62
63
64extern uint32_t
65emlxs_event_queue_create(emlxs_hba_t *hba)
66{
67 emlxs_event_queue_t *eventq = &EVENTQ;
68 char buf[40];
24 * Use is subject to license terms.
25 */
26
27
28#define DEF_EVENT_STRUCT /* Needed for emlxs_events.h in emlxs_event.h */
29#include <emlxs.h>
30
31

--- 29 unchanged lines hidden (view full) ---

61} /* emlxs_event_check() */
62
63
64extern uint32_t
65emlxs_event_queue_create(emlxs_hba_t *hba)
66{
67 emlxs_event_queue_t *eventq = &EVENTQ;
68 char buf[40];
69#ifdef MSI_SUPPORT
70 ddi_intr_handle_t handle;
71 uint32_t intr_pri;
72 int32_t actual;
73 uint32_t ret;
74#endif /* MSI_SUPPORT */
75 ddi_iblock_cookie_t iblock;
76
77 /* Clear the queue */
78 bzero(eventq, sizeof (emlxs_event_queue_t));
79
80 /* Initialize */
81 (void) sprintf(buf, "?%s%d_evt_lock control variable", DRIVER_NAME,
82 hba->ddiinst);

--- 6 unchanged lines hidden (view full) ---

89 (void) ddi_get_iblock_cookie(hba->dip, (uint_t)EMLXS_INUMBER,
90 &iblock);
91
92 /* Create the mutex lock */
93 mutex_init(&eventq->lock, buf, MUTEX_DRIVER, (void *)iblock);
94 }
95#ifdef MSI_SUPPORT
96 else {
69 ddi_iblock_cookie_t iblock;
70
71 /* Clear the queue */
72 bzero(eventq, sizeof (emlxs_event_queue_t));
73
74 /* Initialize */
75 (void) sprintf(buf, "?%s%d_evt_lock control variable", DRIVER_NAME,
76 hba->ddiinst);

--- 6 unchanged lines hidden (view full) ---

83 (void) ddi_get_iblock_cookie(hba->dip, (uint_t)EMLXS_INUMBER,
84 &iblock);
85
86 /* Create the mutex lock */
87 mutex_init(&eventq->lock, buf, MUTEX_DRIVER, (void *)iblock);
88 }
89#ifdef MSI_SUPPORT
90 else {
97 /* Allocate a temporary interrupt handle */
98 actual = 0;
99 ret =
100 ddi_intr_alloc(hba->dip, &handle, DDI_INTR_TYPE_FIXED,
101 EMLXS_MSI_INUMBER, 1, &actual, DDI_INTR_ALLOC_NORMAL);
102
103 if (ret != DDI_SUCCESS || actual == 0) {
104 cmn_err(CE_WARN,
105 "?%s%d: Unable to allocate temporary interrupt "
106 "handle. ret=%d actual=%d", DRIVER_NAME,
107 hba->ddiinst, ret, actual);
108
109 bzero(eventq, sizeof (emlxs_event_queue_t));
110
111 return (0);
112 }
113
114 /* Get the current interrupt priority */
115 ret = ddi_intr_get_pri(handle, &intr_pri);
116
117 if (ret != DDI_SUCCESS) {
118 cmn_err(CE_WARN,
119 "?%s%d: Unable to get interrupt priority. ret=%d",
120 DRIVER_NAME, hba->ddiinst, ret);
121
122 bzero(eventq, sizeof (emlxs_event_queue_t));
123
124 return (0);
125 }
126
127 /* Create the log mutex lock */
91 /* Create event mutex lock */
128 mutex_init(&eventq->lock, buf, MUTEX_DRIVER,
92 mutex_init(&eventq->lock, buf, MUTEX_DRIVER,
129 (void *)((unsigned long)intr_pri));
130
131 /* Free the temporary handle */
132 (void) ddi_intr_free(handle);
93 DDI_INTR_PRI(hba->intr_arg));
133 }
134#endif
135
136 return (1);
137
138} /* emlxs_event_queue_create() */
139
140

--- 1379 unchanged lines hidden ---
94 }
95#endif
96
97 return (1);
98
99} /* emlxs_event_queue_create() */
100
101

--- 1379 unchanged lines hidden ---