summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-08-25 10:13:31 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-08-25 10:13:31 +0000
commit17f1f0da9189e82c93381a61aace686d52339576 (patch)
treed816adac02b9344761cb3843f9fba856c754d419 /sys/arch
parenteb53c59ffd7697d190539b5f500a59265109c9a1 (diff)
Change pci_intr_map to take pci_attach_args as an argument.
All callers actually took all arguments to pci_intr_map from pci_attach_args structs, so this simplifies code. This also allows more complicated interrupt assignment schemes like the one on sparc64. This makes sparc64 pci interrupts work. Inspired by the same change in NetBSD.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/pci/pci_machdep.h7
-rw-r--r--sys/arch/i386/conf/files.i3863
-rw-r--r--sys/arch/i386/pci/pci_machdep.c13
-rw-r--r--sys/arch/i386/pci/pci_machdep.h13
-rw-r--r--sys/arch/mvmeppc/pci/pci_machdep.h7
-rw-r--r--sys/arch/powerpc/mac/if_gm.c5
-rw-r--r--sys/arch/powerpc/pci/pci_machdep.h7
-rw-r--r--sys/arch/sparc64/dev/pci_machdep.c7
-rw-r--r--sys/arch/sparc64/include/pci_machdep.h5
9 files changed, 31 insertions, 36 deletions
diff --git a/sys/arch/alpha/pci/pci_machdep.h b/sys/arch/alpha/pci/pci_machdep.h
index 0bc4c544787..d221276a2bc 100644
--- a/sys/arch/alpha/pci/pci_machdep.h
+++ b/sys/arch/alpha/pci/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.15 2001/08/17 22:26:58 mickey Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.16 2001/08/25 10:13:28 art Exp $ */
/* $NetBSD: pci_machdep.h,v 1.6 1996/11/19 04:49:21 cgd Exp $ */
/*
@@ -98,8 +98,9 @@ int alpha_sysctl_chipset(int *, u_int, char *, size_t *);
(*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
#define pci_conf_write(c, t, r, v) \
(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
-#define pci_intr_map(c, it, ip, il, ihp) \
- (*(c)->pc_intr_map)((c)->pc_intr_v, (it), (ip), (il), (ihp))
+#define pci_intr_map(pa, ihp) \
+ (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \
+ (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp))
#define pci_intr_string(c, ih) \
(*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
#define pci_intr_line(c, ih) \
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index 806f8bbaff3..7f4a97ac8c9 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.91 2001/08/17 21:11:54 mickey Exp $
+# $OpenBSD: files.i386,v 1.92 2001/08/25 10:13:29 art Exp $
# $NetBSD: files.i386,v 1.73 1996/05/07 00:58:36 thorpej Exp $
#
# new style config file for i386 architecture
@@ -90,7 +90,6 @@ file arch/i386/i386/mainbus.c mainbus
include "../../../dev/pci/files.pci"
file arch/i386/pci/pci_machdep.c pci
-file arch/i386/pci/pci_compat.c pci # XXX compatibility
file arch/i386/pci/pciide_machdep.c pciide
file arch/i386/pci/pcic_pci_machdep.c pcic_pci
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c
index de242832c0a..df9d24054b8 100644
--- a/sys/arch/i386/pci/pci_machdep.c
+++ b/sys/arch/i386/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.18 2001/01/27 04:59:40 mickey Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.19 2001/08/25 10:13:29 art Exp $ */
/* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */
/*-
@@ -405,12 +405,15 @@ not1:
}
int
-pci_intr_map(pc, intrtag, pin, line, ihp)
- pci_chipset_tag_t pc;
- pcitag_t intrtag;
- int pin, line;
+pci_intr_map(pa, ihp)
+ struct pci_attach_args *pa;
pci_intr_handle_t *ihp;
{
+ pci_chipset_tag_t pc = pa->pa_pc;
+ pcitag_t intrtag = pa->pa_intrtag;
+ int pin = pa->pa_intrpin;
+ int line = pa->pa_intrline;
+
if (pin == 0) {
/* No IRQ used. */
goto bad;
diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h
index 64adaecff05..911dc7f897a 100644
--- a/sys/arch/i386/pci/pci_machdep.h
+++ b/sys/arch/i386/pci/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.8 2001/08/17 22:26:58 mickey Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.9 2001/08/25 10:13:29 art Exp $ */
/* $NetBSD: pci_machdep.h,v 1.7 1997/06/06 23:29:18 thorpej Exp $ */
/*
@@ -87,7 +87,8 @@ pcitag_t pci_make_tag __P((pci_chipset_tag_t, int, int, int));
pcireg_t pci_conf_read __P((pci_chipset_tag_t, pcitag_t, int));
void pci_conf_write __P((pci_chipset_tag_t, pcitag_t, int,
pcireg_t));
-int pci_intr_map __P((pci_chipset_tag_t, pcitag_t, int, int,
+struct pci_attach_args;
+int pci_intr_map __P((struct pci_attach_args *,
pci_intr_handle_t *));
#define pci_intr_line(ih) ((ih).line)
const char *pci_intr_string __P((pci_chipset_tag_t, pci_intr_handle_t));
@@ -98,14 +99,6 @@ void pci_decompose_tag __P((pci_chipset_tag_t, pcitag_t,
int *, int *, int *));
/*
- * Compatibility functions, to map the old i386 PCI functions to the new ones.
- * NOT TO BE USED BY NEW CODE.
- */
-void *pci_map_int __P((pcitag_t, int, int (*)(void *), void *));
-int pci_map_io __P((pcitag_t, int, int *));
-int pci_map_mem __P((pcitag_t, int, vm_offset_t *, vm_offset_t *));
-
-/*
* Section 6.2.4, `Miscellaneous Functions' of the PIC Specification,
* says that 255 means `unknown' or `no connection' to the interrupt
* controller on a PC.
diff --git a/sys/arch/mvmeppc/pci/pci_machdep.h b/sys/arch/mvmeppc/pci/pci_machdep.h
index 9bc610d1bcc..8407ad1dae9 100644
--- a/sys/arch/mvmeppc/pci/pci_machdep.h
+++ b/sys/arch/mvmeppc/pci/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.2 2001/08/17 22:26:58 mickey Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.3 2001/08/25 10:13:29 art Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -79,8 +79,9 @@ struct ppc_pci_chipset {
(*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
#define pci_conf_write(c, t, r, v) \
(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
-#define pci_intr_map(c, it, ip, il, ihp) \
- (*(c)->pc_intr_map)((c)->pc_intr_v, (it), (ip), (il), (ihp))
+#define pci_intr_map(pa, ihp) \
+ (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \
+ (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp))
#define pci_intr_string(c, ih) \
(*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
#define pci_intr_line(c, ih) \
diff --git a/sys/arch/powerpc/mac/if_gm.c b/sys/arch/powerpc/mac/if_gm.c
index 107d1eb4386..708180a7e20 100644
--- a/sys/arch/powerpc/mac/if_gm.c
+++ b/sys/arch/powerpc/mac/if_gm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gm.c,v 1.18 2001/08/08 21:08:33 miod Exp $ */
+/* $OpenBSD: if_gm.c,v 1.19 2001/08/25 10:13:29 art Exp $ */
/* $NetBSD: if_gm.c,v 1.2 2000/03/04 11:17:00 tsubai Exp $ */
/*-
@@ -236,8 +236,7 @@ gmac_attach(parent, self, aux)
#endif
#if 0
- if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin,
- pa->pa_intrline, &ih)) {
+ if (pci_intr_map(pa, &ih)) {
printf(": unable to map interrupt\n");
return;
}
diff --git a/sys/arch/powerpc/pci/pci_machdep.h b/sys/arch/powerpc/pci/pci_machdep.h
index 2961afb9a10..4cb0eaa06a5 100644
--- a/sys/arch/powerpc/pci/pci_machdep.h
+++ b/sys/arch/powerpc/pci/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.8 2001/08/17 22:26:58 mickey Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.9 2001/08/25 10:13:29 art Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -79,8 +79,9 @@ struct ppc_pci_chipset {
(*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
#define pci_conf_write(c, t, r, v) \
(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
-#define pci_intr_map(c, it, ip, il, ihp) \
- (*(c)->pc_intr_map)((c)->pc_intr_v, (it), (ip), (il), (ihp))
+#define pci_intr_map(pa, ihp) \
+ (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \
+ (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp))
#define pci_intr_string(c, ih) \
(*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
#define pci_intr_establish(c, ih, l, h, a, nm) \
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c
index 0c5c826a657..c4448cca376 100644
--- a/sys/arch/sparc64/dev/pci_machdep.c
+++ b/sys/arch/sparc64/dev/pci_machdep.c
@@ -396,12 +396,11 @@ pci_conf_write(pc, tag, reg, data)
* XXX: how does this deal with multiple interrupts for a device?
*/
int
-pci_intr_map(pc, tag, pin, line, ihp)
- pci_chipset_tag_t pc;
- pcitag_t tag;
- int pin, line;
+pci_intr_map(pa, ihp)
+ struct pci_attach_args *pa;
pci_intr_handle_t *ihp;
{
+ pcitag_t tag = pa->pa_tag;
int interrupts;
int len, node = PCITAG_NODE(tag);
char devtype[30];
diff --git a/sys/arch/sparc64/include/pci_machdep.h b/sys/arch/sparc64/include/pci_machdep.h
index 53980ee6d1e..365bedd18b0 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.3 2001/08/22 20:08:55 art Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.4 2001/08/25 10:13:29 art Exp $ */
/* $NetBSD: pci_machdep.h,v 1.7 2001/07/20 00:07:14 eeh Exp $ */
/*
@@ -85,8 +85,7 @@ pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
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(pci_chipset_tag_t, pcitag_t, int, int,
- pci_intr_handle_t *);
+int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,