summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-06-26 18:20:37 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-06-26 18:20:37 +0000
commitf113e30f6563dfc57bc40cf991a22d7c3eb4c136 (patch)
tree1529218f815d166ea2fe9d61e200f7b8a16901aa /sys/arch/sparc64
parent6a06d1f4fa889d4bb75e5353760a0c3711b5b16e (diff)
Implement pci_intr_map_msi().
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/dev/pci_machdep.c21
-rw-r--r--sys/arch/sparc64/include/pci_machdep.h6
2 files changed, 23 insertions, 4 deletions
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 $ */
/*
@@ -404,6 +404,20 @@ pci_intr_map(pa, ihp)
}
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)
{
return (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);
diff --git a/sys/arch/sparc64/include/pci_machdep.h b/sys/arch/sparc64/include/pci_machdep.h
index cb3ee38f4d4..a2b82f3e3e3 100644
--- a/sys/arch/sparc64/include/pci_machdep.h
+++ b/sys/arch/sparc64/include/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.27 2011/05/21 20:46:11 kettenis Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.28 2011/06/26 18:20:36 kettenis Exp $ */
/* $NetBSD: pci_machdep.h,v 1.7 2001/07/20 00:07:14 eeh Exp $ */
/*
@@ -42,6 +42,8 @@ struct pci_attach_args;
*/
typedef struct sparc_pci_chipset *pci_chipset_tag_t;
+
+#define PCI_INTR_MSI 0x80000000
typedef u_int pci_intr_handle_t;
/*
@@ -85,6 +87,7 @@ pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
pcireg_t);
int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
+int pci_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *);
int pci_intr_line(pci_chipset_tag_t, pci_intr_handle_t);
const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
@@ -100,7 +103,6 @@ int sparc64_pci_enumerate_bus(struct pci_softc *,
#define pciide_machdep_compat_intr_establish(a, b, c, d, e) (NULL)
#define pciide_machdep_compat_intr_disestablish(a, b) do { } while (0)
-#define pci_intr_map_msi(a, b) (-1)
#define pci_dev_postattach(a, b)
#endif /* _MACHINE_PCI_MACHDEP_H_ */