From f113e30f6563dfc57bc40cf991a22d7c3eb4c136 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sun, 26 Jun 2011 18:20:37 +0000 Subject: Implement pci_intr_map_msi(). --- sys/arch/sparc64/dev/pci_machdep.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'sys/arch/sparc64/dev/pci_machdep.c') diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c index 964063c2ef5..04aae58666f 100644 --- a/sys/arch/sparc64/dev/pci_machdep.c +++ b/sys/arch/sparc64/dev/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.40 2010/12/04 17:06:32 miod Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.41 2011/06/26 18:20:36 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */ /* @@ -403,6 +403,20 @@ pci_intr_map(pa, ihp) return (0); } +int +pci_intr_map_msi(struct pci_attach_args *pa, pci_intr_handle_t *ihp) +{ + pci_chipset_tag_t pc = pa->pa_pc; + pcitag_t tag = pa->pa_tag; + + if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || + pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) + return (-1); + + *ihp = PCITAG_OFFSET(pa->pa_tag) | PCI_INTR_MSI; + return (0); +} + int pci_intr_line(pci_chipset_tag_t pc, pci_intr_handle_t ih) { @@ -417,7 +431,10 @@ pci_intr_string(pc, ih) static char str[16]; DPRINTF(SPDB_INTR, ("pci_intr_string: ih %u", ih)); - snprintf(str, sizeof str, "ivec 0x%x", INTVEC(ih)); + if (ih & PCI_INTR_MSI) + snprintf(str, sizeof str, "msi"); + else + snprintf(str, sizeof str, "ivec 0x%x", INTVEC(ih)); DPRINTF(SPDB_INTR, ("; returning %s\n", str)); return (str); -- cgit v1.2.3