Writing Device Drivers

Interrupt Block Cookies

An iblock cookie is an opaque data structure that represents the information the system needs to block interrupts and is returned from ddi_get_iblock_cookie(9F) or ddi_get_soft_iblock_cookie(9F). This interface uses an interrupt number to return the iblock cookie associated with a specific interrupt source. The value of the iblock cookie (not the address) must be passed to mutex_init(9F) when initializing driver mutexes that will be used in the interrupt routine. The value of the iblock cookie is obtained by passing the address of the cookie to ddi_get_iblock_cookie() or ddi_get_soft_iblock_cookie(). For example:


       ddi_get_soft_iblock_cookie(dip, DDI_SOFTINT_HI,
               &xsp->low_iblock_cookie)
       mutex_init(&xsp->low_mu, NULL, MUTEX_DRIVER,
               (void *)xsp->low_iblock_cookie);