358 if (rv < 0 || actual != 1) {
359 cmn_err(CE_WARN, "Could not allocate evtchn interrupt: %d",
360 rv);
361 return (-1);
362 }
363
364 rv = ddi_intr_add_handler(*ihp, evtchn_callback_fcn, NULL, NULL);
365 if (rv < 0) {
366 (void) ddi_intr_free(*ihp);
367 cmn_err(CE_WARN, "Could not attach evtchn handler");
368 return (-1);
369 }
370 evtchn_ihp = ihp;
371
372 if (ddi_intr_enable(*ihp) != DDI_SUCCESS) {
373 cmn_err(CE_WARN, "Could not enable evtchn interrupts\n");
374 return (-1);
375 }
376
377 /* Tell the hypervisor which interrupt we're waiting on. */
378 evtchn_callback_irq = ((ddi_intr_handle_impl_t *)*ihp)->ih_vector;
379
380 if (set_hvm_callback(evtchn_callback_irq) != 0) {
381 cmn_err(CE_WARN, "Couldn't register evtchn callback");
382 return (-1);
383 }
384 return (0);
385 }
386
387 void
388 ec_resume(void)
389 {
390 int i;
391
392 /* New event-channel space is not 'live' yet. */
393 for (i = 0; i < NR_EVENT_CHANNELS; i++)
394 (void) hypervisor_mask_event(i);
395 if (set_hvm_callback(evtchn_callback_irq) != 0)
396 cmn_err(CE_WARN, "Couldn't register evtchn callback");
397
398 }
|
358 if (rv < 0 || actual != 1) {
359 cmn_err(CE_WARN, "Could not allocate evtchn interrupt: %d",
360 rv);
361 return (-1);
362 }
363
364 rv = ddi_intr_add_handler(*ihp, evtchn_callback_fcn, NULL, NULL);
365 if (rv < 0) {
366 (void) ddi_intr_free(*ihp);
367 cmn_err(CE_WARN, "Could not attach evtchn handler");
368 return (-1);
369 }
370 evtchn_ihp = ihp;
371
372 if (ddi_intr_enable(*ihp) != DDI_SUCCESS) {
373 cmn_err(CE_WARN, "Could not enable evtchn interrupts\n");
374 return (-1);
375 }
376
377 /* Tell the hypervisor which interrupt we're waiting on. */
378 evtchn_callback_irq = ((ddi_intr_handle_impl_t *)*ihp)->ih_irq;
379
380 if (set_hvm_callback(evtchn_callback_irq) != 0) {
381 cmn_err(CE_WARN, "Couldn't register evtchn callback");
382 return (-1);
383 }
384 return (0);
385 }
386
387 void
388 ec_resume(void)
389 {
390 int i;
391
392 /* New event-channel space is not 'live' yet. */
393 for (i = 0; i < NR_EVENT_CHANNELS; i++)
394 (void) hypervisor_mask_event(i);
395 if (set_hvm_callback(evtchn_callback_irq) != 0)
396 cmn_err(CE_WARN, "Couldn't register evtchn callback");
397
398 }
|