tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Musings on MSI

I'd like to keep the existing intr framework alone (mostly).  Here's a strawman 
for MI MSI support:

int pci_msi_request(const struct pci_attach_args *pa, pci_msi_handle_t *msihp, 
size_t nmsi, int capid);

msih in an opaque handle which is returned.
nmsi is the maximum number of msi that can be allocated.
capid is either 0 (either), PCI_CAP_MSI, or PCI_CAP_MSIX

returns an E* error.

int pci_msi_type(pci_chipset_tag_t pc, pci_msi_handle_t msih);

return the type of msi allocated (PCI_CAP_MSI or PCI_CAP_MSIX).  In the latter 
case MSI vectors may not be contiguous.

size_t pci_msi_available(pci_chipset_tag_t pc, pci_msi_handle_t msih);

returns the number of MSIs allocated (or currently free).

void * pci_msi_establish(pci_chipset_tag_t pc, pci_msi_handle_t msih, 
   size_t msirq, int level, int (*handler)(void *), void *arg);

establishes the Nth (msirq) MSI (appropriately updating the MSIX vector table
if needed).  More than one handler may be established on a single MSI.

void pci_msi_disestablish(pci_chipset_tag_t pc, void *ih);

Disestablishes but does not free the MSI.

void pci_msi_free(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq);

Free the MSI back to the MSI handle's pool.

void pci_msi_release(pci_chipset_tag pc, pci_msi_handle_t msih);

Free the msih handle context.  It is considered to be a fatal error if
all MSIs have not been freed before calling this.

Home | Main Index | Thread Index | Old Index