* Allocate and fill new entry in irq_map table. */
| 1660 | * Allocate and fill new entry in irq_map table. |
| 1661 | */ |
| 1662 | u_int |
| 1663 | intr_map_irq(device_t dev, intptr_t xref, struct intr_map_data *data) |
| 1664 | { |
| 1665 | u_int i; |
| 1666 | struct intr_map_entry *entry; |
| 1667 | |
| 1668 | /* Prepare new entry first. */ |
| 1669 | entry = malloc(sizeof(*entry), M_INTRNG, M_WAITOK | M_ZERO); |
| 1670 | |
| 1671 | entry->dev = dev; |
| 1672 | entry->xref = xref; |
| 1673 | entry->map_data = data; |
| 1674 | entry->isrc = NULL; |
| 1675 | |
| 1676 | mtx_lock(&irq_map_lock); |
| 1677 | for (i = irq_map_first_free_idx; i < irq_map_count; i++) { |
| 1678 | if (irq_map[i] == NULL) { |
| 1679 | irq_map[i] = entry; |
| 1680 | irq_map_first_free_idx = i + 1; |
| 1681 | mtx_unlock(&irq_map_lock); |
| 1682 | return (i); |
| 1683 | } |
| 1684 | } |
| 1685 | mtx_unlock(&irq_map_lock); |
| 1686 | |
| 1687 | /* XXX Expand irq_map table */ |
| 1688 | panic("IRQ mapping table is full."); |
| 1689 | } |
| 1690 | |
| 1691 | /* |
| 1692 | * Remove and free mapping entry. |
no test coverage detected