Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc First pass of the new PCI MSI/MSI ABI defin...
details: https://anonhg.NetBSD.org/src/rev/fe103860b595
branches: trunk
changeset: 768504:fe103860b595
user: matt <matt%NetBSD.org@localhost>
date: Wed Aug 17 18:52:00 2011 +0000
description:
First pass of the new PCI MSI/MSI ABI definitions. (return EOPNOTSUPP for
now).
diffstat:
sys/arch/powerpc/booke/pci/pq3pci.c | 20 ++++-
sys/arch/powerpc/ibm4xx/dev/ibm405gp.c | 7 +-
sys/arch/powerpc/include/pci_machdep.h | 133 +++++++++++++++++++++++++++++-
sys/arch/powerpc/marvell/pci_machdep.c | 10 +-
sys/arch/powerpc/pci/pci_machdep_common.c | 82 ++++++++++++++++++-
5 files changed, 241 insertions(+), 11 deletions(-)
diffs (truncated from 393 to 300 lines):
diff -r 020eb056ee63 -r fe103860b595 sys/arch/powerpc/booke/pci/pq3pci.c
--- a/sys/arch/powerpc/booke/pci/pq3pci.c Wed Aug 17 18:51:10 2011 +0000
+++ b/sys/arch/powerpc/booke/pci/pq3pci.c Wed Aug 17 18:52:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3pci.c,v 1.9 2011/08/17 00:59:47 dyoung Exp $ */
+/* $NetBSD: pq3pci.c,v 1.10 2011/08/17 18:52:00 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -44,7 +44,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.9 2011/08/17 00:59:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.10 2011/08/17 18:52:00 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -1468,6 +1468,22 @@
pc->pc_intr_establish = pq3pci_intr_establish;
pc->pc_intr_disestablish = pq3pci_intr_disestablish;
pc->pc_conf_interrupt = pq3pci_conf_interrupt;
+
+ pc->pc_msi_v = sc;
+ genppc_pci_chipset_msi_init(pc);
+#if 0
+ pc->pc_msi_request = pq3pci_msi_request;
+ pc->pc_msi_available = pq3pci_msi_available;
+ pc->pc_msi_type = pq3pci_msi_type;
+ pc->pc_msi_string = pq3pci_msi_string;
+ pc->pc_msi_evcnt = genppc_pci_msi_evcnt;
+ pc->pc_msi_establish = pq3pci_msi_establish;
+ pc->pc_msix_establish = pq3pci_msix_establish;
+ pc->pc_msi_disestablish = pq3pci_msi_disestablish;
+ pc->pc_msi_release = pq3pci_msi_release;
+ pc->pc_msi_free = pq3pci_msi_free;
+#endif
+
pc->pc_decompose_tag = pq3pci_decompose_tag;
pc->pc_conf_hook = pq3pci_conf_hook;
diff -r 020eb056ee63 -r fe103860b595 sys/arch/powerpc/ibm4xx/dev/ibm405gp.c
--- a/sys/arch/powerpc/ibm4xx/dev/ibm405gp.c Wed Aug 17 18:51:10 2011 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/ibm405gp.c Wed Aug 17 18:52:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibm405gp.c,v 1.6 2011/06/22 18:06:34 matt Exp $ */
+/* $NetBSD: ibm405gp.c,v 1.7 2011/08/17 18:52:01 matt Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibm405gp.c,v 1.6 2011/06/22 18:06:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm405gp.c,v 1.7 2011/08/17 18:52:01 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -77,6 +77,9 @@
.pc_intr_disestablish = genppc_pci_intr_disestablish,
.pc_intr_setattr = ibm4xx_pci_intr_setattr,
+ .pc_msi_v = &genppc_ibm4xx_chipset,
+ GENPPC_PCI_MSI_INITIALIZER,
+
.pc_conf_interrupt = ibm4xx_pci_conf_interrupt,
.pc_decompose_tag = ibm4xx_pci_decompose_tag,
.pc_conf_hook = ibm4xx_pci_conf_hook,
diff -r 020eb056ee63 -r fe103860b595 sys/arch/powerpc/include/pci_machdep.h
--- a/sys/arch/powerpc/include/pci_machdep.h Wed Aug 17 18:51:10 2011 +0000
+++ b/sys/arch/powerpc/include/pci_machdep.h Wed Aug 17 18:52:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.11 2011/06/22 18:06:34 matt Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.12 2011/08/17 18:52:00 matt Exp $ */
/*-
* Copyright (c) 2002,2007 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@
* Types provided to machine-independent PCI code
*/
typedef struct genppc_pci_chipset *pci_chipset_tag_t;
+typedef void *pci_msi_handle_t;
typedef int pcitag_t;
typedef int pci_intr_handle_t;
@@ -87,6 +88,21 @@
int pci_intr_setattr(pci_chipset_tag_t, pci_intr_handle_t *,
int, uint64_t);
+int pci_msi_request(const struct pci_attach_args *,
+ pci_msi_handle_t *, size_t, int, int);
+int pci_msi_type(pci_chipset_tag_t, pci_msi_handle_t);
+size_t pci_msi_available(pci_chipset_tag_t, pci_msi_handle_t);
+const char * pci_msi_string(pci_chipset_tag_t, pci_msi_handle_t, size_t);
+const struct evcnt *
+ pci_msi_evcnt(pci_chipset_tag_t, pci_msi_handle_t, size_t);
+void * pci_msi_establish(pci_chipset_tag_t, pci_msi_handle_t, size_t,
+ int, int (*)(void *), void *);
+void * pci_msix_establish(pci_chipset_tag_t, pci_msi_handle_t, size_t,
+ size_t, int, int (*)(void *), void *);
+void pci_msi_disestablish(pci_chipset_tag_t, void *);
+void pci_msi_free(pci_chipset_tag_t, pci_msi_handle_t, size_t);
+void pci_msi_release(pci_chipset_tag_t, pci_msi_handle_t);
+
void pci_conf_interrupt(pci_chipset_tag_t, int, int, int,
int, int *);
int pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
@@ -123,6 +139,22 @@
int (*pc_intr_setattr)(void *, pci_intr_handle_t *,
int, uint64_t);
+ void *pc_msi_v;
+ int (*pc_msi_request)(const struct pci_attach_args *,
+ pci_msi_handle_t *, size_t, int, int);
+ int (*pc_msi_type)(void *, pci_msi_handle_t);
+ size_t (*pc_msi_available)(void *, pci_msi_handle_t);
+ const char * (*pc_msi_string)(void *, pci_msi_handle_t, size_t);
+ const struct evcnt *
+ (*pc_msi_evcnt)(void *, pci_msi_handle_t, size_t);
+ void * (*pc_msi_establish)(void *, pci_msi_handle_t, size_t,
+ int, int (*)(void *), void *);
+ void * (*pc_msix_establish)(void *, pci_msi_handle_t, size_t,
+ size_t, int, int (*)(void *), void *);
+ void (*pc_msi_disestablish)(void *, void *);
+ void (*pc_msi_free)(void *, pci_msi_handle_t, size_t);
+ void (*pc_msi_release)(void *, pci_msi_handle_t);
+
void (*pc_conf_interrupt)(void *, int, int, int, int, int *);
void (*pc_decompose_tag)(void *, pcitag_t, int *,
int *, int *);
@@ -239,6 +271,72 @@
return (*pc->pc_conf_hook)(pc->pc_conf_v, bus, device, function, id);
}
+__pci_inline int
+pci_msi_request(const struct pci_attach_args *pa, pci_msi_handle_t *msihp,
+ size_t nmsi, int ipl, int capid)
+{
+ return (*pci_attach_args_pc(pa)->pc_msi_request)(pa, msihp, nmsi,
+ ipl, capid);
+}
+
+__pci_inline int
+pci_msi_type(pci_chipset_tag_t pc, pci_msi_handle_t msih)
+{
+ return (*pc->pc_msi_type)(pc->pc_msi_v, msih);
+}
+
+__pci_inline size_t
+pci_msi_available(pci_chipset_tag_t pc, pci_msi_handle_t msih)
+{
+ return (*pc->pc_msi_available)(pc->pc_msi_v, msih);
+}
+
+__pci_inline const char *
+pci_msi_string(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq)
+{
+ return (*pc->pc_msi_string)(pc->pc_msi_v, msih, msirq);
+}
+
+__pci_inline const struct evcnt *
+pci_msi_evcnt(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq)
+{
+ return (*pc->pc_msi_evcnt)(pc->pc_msi_v, msih, msirq);
+}
+
+__pci_inline void *
+pci_msi_establish(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq,
+ int ipl, int (*func)(void *), void *arg)
+{
+ return (*pc->pc_msi_establish)(pc->pc_msi_v, msih, msirq, ipl,
+ func, arg);
+}
+
+__pci_inline void *
+pci_msix_establish(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t vec,
+ size_t msirq, int ipl, int (*func)(void *), void *arg)
+{
+ return (*pc->pc_msix_establish)(pc->pc_msi_v, msih, vec, msirq, ipl,
+ func, arg);
+}
+
+__pci_inline void
+pci_msi_disestablish(pci_chipset_tag_t pc, void *ih)
+{
+ (*pc->pc_msi_disestablish)(pc->pc_msi_v, ih);
+}
+
+__pci_inline void
+pci_msi_free(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq)
+{
+ (*pc->pc_msi_free)(pc->pc_msi_v, msih, msirq);
+}
+
+__pci_inline void
+pci_msi_release(pci_chipset_tag_t pc, pci_msi_handle_t msih)
+{
+ (*pc->pc_msi_release)(pc->pc_msi_v, msih);
+}
+
#undef __pci_inline
/*
@@ -246,16 +344,45 @@
*/
int genppc_pci_bus_maxdevs(void *, int);
+
+int genppc_pci_intr_map(const struct pci_attach_args *,
+ pci_intr_handle_t *);
const char *genppc_pci_intr_string(void *, pci_intr_handle_t);
const struct evcnt *genppc_pci_intr_evcnt(void *, pci_intr_handle_t);
void *genppc_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
void *);
void genppc_pci_intr_disestablish(void *, void *);
int genppc_pci_intr_setattr(void *, pci_intr_handle_t *, int, uint64_t);
+
+int genppc_pci_msi_request(const struct pci_attach_args *, pci_msi_handle_t *,
+ size_t, int, int);
+int genppc_pci_msi_type(void *, pci_msi_handle_t);
+size_t genppc_pci_msi_available(void *, pci_msi_handle_t);
+const struct evcnt *genppc_pci_msi_evcnt(void *, pci_msi_handle_t, size_t);
+const char *genppc_pci_msi_string(void *, pci_msi_handle_t, size_t);
+void *genppc_pci_msi_establish(void *, pci_msi_handle_t, size_t,
+ int, int (*)(void *), void *);
+void *genppc_pci_msix_establish(void *, pci_msi_handle_t, size_t,
+ size_t, int, int (*)(void *), void *);
+void genppc_pci_msi_disestablish(void *, void *);
+void genppc_pci_msi_free(void *, pci_msi_handle_t, size_t);
+void genppc_pci_msi_release(void *, pci_msi_handle_t);
+void genppc_pci_chipset_msi_init(pci_chipset_tag_t);
+
+#define GENPPC_PCI_MSI_INITIALIZER \
+ .pc_msi_request = genppc_pci_msi_request, \
+ .pc_msi_type = genppc_pci_msi_type, \
+ .pc_msi_available = genppc_pci_msi_available, \
+ .pc_msi_evcnt = genppc_pci_msi_evcnt, \
+ .pc_msi_string = genppc_pci_msi_string, \
+ .pc_msi_establish = genppc_pci_msi_establish, \
+ .pc_msix_establish = genppc_pci_msix_establish, \
+ .pc_msi_disestablish = genppc_pci_msi_disestablish, \
+ .pc_msi_free = genppc_pci_msi_free, \
+ .pc_msi_release = genppc_pci_msi_release
+
void genppc_pci_conf_interrupt(void *, int, int, int, int, int *);
int genppc_pci_conf_hook(void *, int, int, int, pcireg_t);
-int genppc_pci_intr_map(const struct pci_attach_args *,
- pci_intr_handle_t *);
/* generic indirect PCI functions */
void genppc_pci_indirect_attach_hook(device_t, device_t,
diff -r 020eb056ee63 -r fe103860b595 sys/arch/powerpc/marvell/pci_machdep.c
--- a/sys/arch/powerpc/marvell/pci_machdep.c Wed Aug 17 18:51:10 2011 +0000
+++ b/sys/arch/powerpc/marvell/pci_machdep.c Wed Aug 17 18:52:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.3 2011/06/22 18:06:34 matt Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.4 2011/08/17 18:52:01 matt Exp $ */
/*
* Copyright (c) 2009 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.3 2011/06/22 18:06:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.4 2011/08/17 18:52:01 matt Exp $");
#include "gtpci.h"
#include "pci.h"
@@ -68,6 +68,9 @@
.pc_intr_disestablish = genppc_pci_intr_disestablish,
.pc_intr_setattr = genppc_pci_intr_setattr,
+ .pc_msi_v = &genppc_gtpci0_chipset,
+ GENPPC_PCI_MSI_INITIALIZER,
+
.pc_conf_interrupt = gtpci_md_conf_interrupt,
.pc_decompose_tag = gtpci_decompose_tag,
.pc_conf_hook = gtpci_md_conf_hook,
@@ -89,6 +92,9 @@
.pc_intr_setattr = genppc_pci_intr_setattr,
.pc_intr_map = genppc_pci_intr_map,
+ .pc_msi_v = &genppc_gtpci1_chipset,
+ GENPPC_PCI_MSI_INITIALIZER,
+
.pc_conf_interrupt = gtpci_md_conf_interrupt,
.pc_decompose_tag = gtpci_decompose_tag,
.pc_conf_hook = gtpci_md_conf_hook,
diff -r 020eb056ee63 -r fe103860b595 sys/arch/powerpc/pci/pci_machdep_common.c
--- a/sys/arch/powerpc/pci/pci_machdep_common.c Wed Aug 17 18:51:10 2011 +0000
+++ b/sys/arch/powerpc/pci/pci_machdep_common.c Wed Aug 17 18:52:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep_common.c,v 1.13 2011/06/22 18:06:34 matt Exp $ */
+/* $NetBSD: pci_machdep_common.c,v 1.14 2011/08/17 18:52:01 matt Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
Home |
Main Index |
Thread Index |
Old Index