Module Name: src
Committed By: dyoung
Date: Wed Apr 28 20:33:52 UTC 2010
Modified Files:
src/sys/dev/pci: pcivar.h
src/sys/kern: kern_stub.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/pcivar.h
cvs rdiff -u -r1.27 -r1.28 src/sys/kern/kern_stub.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.85 src/sys/dev/pci/pcivar.h:1.86
--- src/sys/dev/pci/pcivar.h:1.85 Fri Mar 12 21:55:05 2010
+++ src/sys/dev/pci/pcivar.h Wed Apr 28 20:33:52 2010
@@ -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.
Index: src/sys/kern/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.27 src/sys/kern/kern_stub.c:1.28
--- src/sys/kern/kern_stub.c:1.27 Mon Apr 26 22:58:53 2010
+++ src/sys/kern/kern_stub.c Wed Apr 28 20:33:52 2010
@@ -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);