Implementing MSI
Unlike with previous topics, I’m going to take a holistic approach here. Namely, I’m going to show an example first, and then I’ll describe the MSI family of functions.
The following function, named ciss_setup_msix
and defined in /sys/dev/ciss/ciss.c, sets up MSI for the ciss(4)
driver.
Note
This function was chosen solely because it’s simple. The fact that it’s from ciss(4)
is irrelevant.
static int ciss_setup_msix(struct ciss_softc *sc) { int i, count, error; i = ciss_lookup(sc->ciss_dev); if (ciss_vendor_data[i].flags & CISS_BOARD_NOMSI) return (EINVAL); count = pci_msix_count(sc->ciss_dev); if (count < CISS_MSI_COUNT) { count = ...
Get FreeBSD Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.