Source-Changes-HG archive

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

[src/trunk]: src/sys Add data types, function prototypes, and stub implementa...



details:   https://anonhg.NetBSD.org/src/rev/ae34a1d92e18
branches:  trunk
changeset: 754359:ae34a1d92e18
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Apr 28 20:33:52 2010 +0000

description:
Add data types, function prototypes, and stub implementations
for pci_chipset_tag_create() and pci_chipset_tag_destroy().  On
architectures that support it, an MI PCI bus driver can override the
architecture's default pci(9) and pci_intr(9) implementation.

Coming up next: documentation.
After that: x86 implementation.
Last but not least: make cbb(4) use MI PCI overrides.

diffstat:

 sys/dev/pci/pcivar.h |  37 ++++++++++++++++++++++++++++++++++++-
 sys/kern/kern_stub.c |   6 ++++--
 2 files changed, 40 insertions(+), 3 deletions(-)

diffs (85 lines):

diff -r 946c13210a7b -r ae34a1d92e18 sys/dev/pci/pcivar.h
--- a/sys/dev/pci/pcivar.h      Wed Apr 28 20:27:36 2010 +0000
+++ b/sys/dev/pci/pcivar.h      Wed Apr 28 20:33:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcivar.h,v 1.85 2010/03/12 21:55:05 matt Exp $ */
+/*     $NetBSD: pcivar.h,v 1.86 2010/04/28 20:33:52 dyoung Exp $       */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -59,6 +59,37 @@
  */
 #include <machine/pci_machdep.h>
 
+enum pci_override_idx {
+         PCI_OVERRIDE_CONF_READ                = __BIT(0)
+       , PCI_OVERRIDE_CONF_WRITE               = __BIT(1)
+       , PCI_OVERRIDE_INTR_MAP                 = __BIT(2)
+       , PCI_OVERRIDE_INTR_STRING              = __BIT(3)
+       , PCI_OVERRIDE_INTR_EVCNT               = __BIT(4)
+       , PCI_OVERRIDE_INTR_ESTABLISH           = __BIT(5)
+       , PCI_OVERRIDE_INTR_DISESTABLISH        = __BIT(6)
+       , PCI_OVERRIDE_MAKE_TAG                 = __BIT(7)
+       , PCI_OVERRIDE_DECOMPOSE_TAG            = __BIT(8)
+};
+
+/* Only add new fields to the end of this structure! */
+struct pci_overrides {
+       pcireg_t (*ov_conf_read)(void *, pci_chipset_tag_t, pcitag_t, int);
+       void (*ov_conf_write)(void *, pci_chipset_tag_t, pcitag_t, int,
+           pcireg_t);
+       int (*ov_intr_map)(void *, struct pci_attach_args *,
+          pci_intr_handle_t *);
+       const char *(*ov_intr_string)(void *, pci_chipset_tag_t,
+           pci_intr_handle_t);
+       const struct evcnt *(*ov_intr_evcnt)(void *, pci_chipset_tag_t,
+           pci_intr_handle_t);
+       void *(*ov_intr_establish)(void *, pci_chipset_tag_t, pci_intr_handle_t,
+           int, int (*)(void *), void *);
+       void (*ov_intr_disestablish)(void *, pci_chipset_tag_t, void *);
+       pcitag_t (*ov_make_tag)(void *, pci_chipset_tag_t, int, int, int);
+       void (*ov_decompose_tag)(void *, pci_chipset_tag_t, pcitag_t,
+           int *, int *, int *);
+};
+
 /*
  * PCI bus attach arguments.
  */
@@ -260,6 +291,10 @@
 int    pci_activate(pci_chipset_tag_t, pcitag_t, device_t,
     int (*)(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t));
 int    pci_activate_null(pci_chipset_tag_t, pcitag_t, device_t, pcireg_t);
+int    pci_chipset_tag_create(pci_chipset_tag_t, uint64_t,
+                              const struct pci_overrides *,
+                              void *, pci_chipset_tag_t *);
+void   pci_chipset_tag_destroy(pci_chipset_tag_t);
 
 /*
  * Device abstraction for inheritance by elanpci(4), for example.
diff -r 946c13210a7b -r ae34a1d92e18 sys/kern/kern_stub.c
--- a/sys/kern/kern_stub.c      Wed Apr 28 20:27:36 2010 +0000
+++ b/sys/kern/kern_stub.c      Wed Apr 28 20:33:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $     */
+/*     $NetBSD: kern_stub.c,v 1.28 2010/04/28 20:33:52 dyoung Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.28 2010/04/28 20:33:52 dyoung Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_ktrace.h"
@@ -125,6 +125,8 @@
 __weak_alias(spldebug_start, voidop);
 __weak_alias(spldebug_stop, voidop);
 __weak_alias(machdep_init,nullop);
+__weak_alias(pci_chipset_tag_create, eopnotsupp);
+__weak_alias(pci_chipset_tag_destroy, voidop);
 __weak_alias(bus_space_tag_create, eopnotsupp);
 __weak_alias(bus_space_tag_destroy, voidop);
 __weak_alias(bus_space_is_equal, default_bus_space_is_equal);



Home | Main Index | Thread Index | Old Index