Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/xen/bus/xen_intr.c
Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | #ifdef SMP | ||||
u_int cpu; | u_int cpu; | ||||
#endif | #endif | ||||
KASSERT(params != NULL, ("%s: NULL params passed in", __func__)); | KASSERT(params != NULL, ("%s: NULL params passed in", __func__)); | ||||
*isrcp = NULL; | *isrcp = NULL; | ||||
if (port_handlep == NULL) { | if (port_handlep == NULL) { | ||||
printf("%s: %s: Bad event handle\n", intr_owner, __func__); | printf("%s: %s: Bad event handle\n", intr_owner, __func__); | ||||
return (EINVAL); | error = EINVAL; | ||||
goto failearly; | |||||
} | } | ||||
*port_handlep = NULL; | *port_handlep = NULL; | ||||
KASSERT((params->xi_type > EVTCHN_TYPE_UNBOUND) && | KASSERT((params->xi_type > EVTCHN_TYPE_UNBOUND) && | ||||
(params->xi_type < EVTCHN_TYPE_COUNT), | (params->xi_type < EVTCHN_TYPE_COUNT), | ||||
("%s: Called with invalid event channel type (%d)", __func__, | ("%s: Called with invalid event channel type (%d)", __func__, | ||||
params->xi_type)); | params->xi_type)); | ||||
isrc = xen_intr_alloc_isrc(params); | isrc = xen_intr_alloc_isrc(params); | ||||
if (isrc == NULL) | if (isrc == NULL) { | ||||
return (ENOSPC); | error = ENOSPC; | ||||
goto failearly; | |||||
} | |||||
refcount_init(&isrc->xi_refcount, 1); | refcount_init(&isrc->xi_refcount, 1); | ||||
#ifdef SMP | #ifdef SMP | ||||
cpu = isrc->xi_cpu; | cpu = isrc->xi_cpu; | ||||
isrc->xi_cpu = 0; /* initialize to the likely correct value */ | isrc->xi_cpu = 0; /* initialize to the likely correct value */ | ||||
#endif | #endif | ||||
mtx_lock(&xen_intr_isrc_lock); | mtx_lock(&xen_intr_isrc_lock); | ||||
xen_intr_port_to_isrc[isrc->xi_port] = isrc; | xen_intr_port_to_isrc[isrc->xi_port] = isrc; | ||||
mtx_unlock(&xen_intr_isrc_lock); | mtx_unlock(&xen_intr_isrc_lock); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | if (filter != NULL || handler != NULL) { | ||||
* in charge of setting that up. | * in charge of setting that up. | ||||
* } | * } | ||||
*/ | */ | ||||
*isrcp = isrc; | *isrcp = isrc; | ||||
/* Assign the opaque handler */ | /* Assign the opaque handler */ | ||||
*port_handlep = xen_intr_handle_from_isrc(isrc); | *port_handlep = xen_intr_handle_from_isrc(isrc); | ||||
return (0); | return (0); | ||||
failearly: | |||||
if (params->xi_close) { | |||||
evtchn_close_t close = { .port = params->xi_port }; | |||||
if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close)) | |||||
panic("EVTCHNOP_close failed"); | |||||
} | |||||
return (error); | |||||
} | } | ||||
/** | /** | ||||
* Determine the event channel ports at the given section of the | * Determine the event channel ports at the given section of the | ||||
* event port bitmap which have pending events for the given cpu. | * event port bitmap which have pending events for the given cpu. | ||||
* | * | ||||
* \param pcpu The Xen interrupt pcpu data for the cpu being queried. | * \param pcpu The Xen interrupt pcpu data for the cpu being queried. | ||||
* \param sh The Xen shared info area. | * \param sh The Xen shared info area. | ||||
▲ Show 20 Lines • Show All 879 Lines • Show Last 20 Lines |