238 if (!(1ull << bit & px_debug_flags))
239 return;
240
241 va_start(ap, fmt);
242 if (getpil() > LOCK_LEVEL)
243 px_dbg_queue(bit, dip, fmt, ap);
244 else
245 px_dbg_print(bit, dip, fmt, ap);
246 va_end(ap);
247 }
248 #endif /* DEBUG */
249
250 void
251 px_dbg_attach(dev_info_t *dip, ddi_softint_handle_t *dbg_hdl)
252 {
253 #ifdef DEBUG
254 if (px_dbg_reference++ == 0) {
255 int size = px_dbg_msg_size;
256
257 /* Check if px_dbg_msg_size is ^2 */
258 size = !ISP2(size) ? ((size | ~size) + 1) : size;
259 px_dbg_msg_size = size;
260 px_dbg_qmask = size - 1;
261 px_dbg_msgq = kmem_zalloc(sizeof (px_dbg_msg_t) * size,
262 KM_SLEEP);
263
264 mutex_init(&px_dbg_mutex, NULL, MUTEX_DRIVER, NULL);
265 }
266
267 if (ddi_intr_add_softint(dip, dbg_hdl,
268 DDI_INTR_SOFTPRI_MAX, px_dbg_drain, NULL) != DDI_SUCCESS) {
269 DBG(DBG_ATTACH, dip,
270 "Unable to allocate soft int for DBG printing.\n");
271 dbg_hdl = NULL;
272 }
273 #endif /* DEBUG */
274 }
275
276 /* ARGSUSED */
277 void
|
238 if (!(1ull << bit & px_debug_flags))
239 return;
240
241 va_start(ap, fmt);
242 if (getpil() > LOCK_LEVEL)
243 px_dbg_queue(bit, dip, fmt, ap);
244 else
245 px_dbg_print(bit, dip, fmt, ap);
246 va_end(ap);
247 }
248 #endif /* DEBUG */
249
250 void
251 px_dbg_attach(dev_info_t *dip, ddi_softint_handle_t *dbg_hdl)
252 {
253 #ifdef DEBUG
254 if (px_dbg_reference++ == 0) {
255 int size = px_dbg_msg_size;
256
257 /* Check if px_dbg_msg_size is ^2 */
258 /*
259 * WARNING: The bellow statement makes no sense. If size is
260 * not a power of 2, it will set size to zero.
261 */
262 size = !ISP2(size) ? ((size | ~size) + 1) : size;
263 px_dbg_msg_size = size;
264 px_dbg_qmask = size - 1;
265 px_dbg_msgq = kmem_zalloc(sizeof (px_dbg_msg_t) * size,
266 KM_SLEEP);
267
268 mutex_init(&px_dbg_mutex, NULL, MUTEX_DRIVER, NULL);
269 }
270
271 if (ddi_intr_add_softint(dip, dbg_hdl,
272 DDI_INTR_SOFTPRI_MAX, px_dbg_drain, NULL) != DDI_SUCCESS) {
273 DBG(DBG_ATTACH, dip,
274 "Unable to allocate soft int for DBG printing.\n");
275 dbg_hdl = NULL;
276 }
277 #endif /* DEBUG */
278 }
279
280 /* ARGSUSED */
281 void
|