Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Cope with up to four "interrupts" prope...
details: https://anonhg.NetBSD.org/src/rev/8e0aabea1ddc
branches: trunk
changeset: 750578:8e0aabea1ddc
user: jdc <jdc%NetBSD.org@localhost>
date: Thu Jan 07 09:33:44 2010 +0000
description:
Cope with up to four "interrupts" properties for a node.
Just use the first one for now. This should be improved.
OK: mrg@.
diffstat:
sys/arch/sparc64/dev/pci_machdep.c | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diffs (74 lines):
diff -r 5ec6dcdcae3a -r 8e0aabea1ddc sys/arch/sparc64/dev/pci_machdep.c
--- a/sys/arch/sparc64/dev/pci_machdep.c Thu Jan 07 09:31:44 2010 +0000
+++ b/sys/arch/sparc64/dev/pci_machdep.c Thu Jan 07 09:33:44 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.66 2010/01/06 05:55:01 mrg Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.67 2010/01/07 09:33:44 jdc Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.66 2010/01/06 05:55:01 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.67 2010/01/07 09:33:44 jdc Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -415,37 +415,44 @@
pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
{
pcitag_t tag = pa->pa_tag;
- int interrupts, *intp;
+ int interrupts[4], *intp, int_used;
int len, node = PCITAG_NODE(tag);
char devtype[30];
- intp = &interrupts;
- len = 1;
- if (prom_getprop(node, "interrupts", sizeof(interrupts),
+ intp = &interrupts[0];
+ len = prom_getproplen(node, "interrupts");
+ if (len > sizeof(interrupts)) {
+ DPRINTF(SPDB_INTMAP,
+ ("pci_intr_map: too many available interrupts\n"));
+ return (ENODEV);
+ }
+ if (prom_getprop(node, "interrupts", len,
&len, &intp) != 0 || len != 1) {
DPRINTF(SPDB_INTMAP,
("pci_intr_map: could not read interrupts\n"));
return (ENODEV);
}
- if (OF_mapintr(node, &interrupts, sizeof(interrupts),
- sizeof(interrupts)) < 0) {
+ /* XXX We pick the first interrupt, but should do better */
+ int_used = interrupts[0];
+ if (OF_mapintr(node, &int_used, sizeof(int_used),
+ sizeof(int_used)) < 0) {
printf("OF_mapintr failed\n");
KASSERT(pa->pa_pc->spc_find_ino);
- pa->pa_pc->spc_find_ino(pa, &interrupts);
+ pa->pa_pc->spc_find_ino(pa, &int_used);
}
- DPRINTF(SPDB_INTMAP, ("OF_mapintr() gave %x\n", interrupts));
+ DPRINTF(SPDB_INTMAP, ("OF_mapintr() gave %x\n", int_used));
/* Try to find an IPL for this type of device. */
prom_getpropstringA(node, "device_type", devtype, sizeof(devtype));
for (len = 0; intrmap[len].in_class != NULL; len++)
if (strcmp(intrmap[len].in_class, devtype) == 0) {
- interrupts |= INTLEVENCODE(intrmap[len].in_lev);
- DPRINTF(SPDB_INTMAP, ("reset to %x\n", interrupts));
+ int_used |= INTLEVENCODE(intrmap[len].in_lev);
+ DPRINTF(SPDB_INTMAP, ("reset to %x\n", int_used));
break;
}
- *ihp = interrupts;
+ *ihp = int_used;
/* Call the sub-driver is necessary */
if (pa->pa_pc->spc_intr_map)
Home |
Main Index |
Thread Index |
Old Index