Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ieee1394 don't allocate rom scratch memory from an i...



details:   https://anonhg.NetBSD.org/src/rev/3e96cd079d99
branches:  trunk
changeset: 755119:3e96cd079d99
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 23 02:24:40 2010 +0000

description:
don't allocate rom scratch memory from an interrupt context:

fwohci0: BUS reset
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2  0 cpl 6 rsp fffffff
f80fafb08
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
kmem_zalloc() at netbsd:kmem_zalloc+0xf
fw_busreset() at netbsd:fw_busreset+0x23b
fwohci_intr() at netbsd:fwohci_intr+0xa56
...

diffstat:

 sys/dev/ieee1394/firewire.c    |  13 +++++--------
 sys/dev/ieee1394/firewirereg.h |   3 ++-
 2 files changed, 7 insertions(+), 9 deletions(-)

diffs (62 lines):

diff -r 649df5b67153 -r 3e96cd079d99 sys/dev/ieee1394/firewire.c
--- a/sys/dev/ieee1394/firewire.c       Sun May 23 01:59:12 2010 +0000
+++ b/sys/dev/ieee1394/firewire.c       Sun May 23 02:24:40 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firewire.c,v 1.33 2010/05/15 10:42:51 kiyohara Exp $   */
+/*     $NetBSD: firewire.c,v 1.34 2010/05/23 02:24:40 christos Exp $   */
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.33 2010/05/15 10:42:51 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.34 2010/05/23 02:24:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -548,7 +548,6 @@
        struct firewire_dev_list *devlist;
        struct firewire_dev_comm *fdc;
        struct crom_src *src;
-       uint32_t *newrom;
 
        if (fc->status == FWBUSMGRELECT)
                callout_stop(&fc->bmr_callout);
@@ -583,15 +582,13 @@
         * Configuration ROM.
         */
 #define FW_MAX_GENERATION      0xF
-       newrom = kmem_zalloc(CROMSIZE, KM_NOSLEEP);
        src = &fc->crom_src_buf->src;
-       crom_load(src, newrom, CROMSIZE);
-       if (memcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
+       crom_load(src, fc->new_rom, CROMSIZE);
+       if (memcmp(fc->new_rom, fc->config_rom, CROMSIZE) != 0) {
                if (src->businfo.generation++ > FW_MAX_GENERATION)
                        src->businfo.generation = FW_GENERATION_CHANGEABLE;
-               memcpy((void *)fc->config_rom, newrom, CROMSIZE);
+               memcpy(fc->config_rom, fc->new_rom, CROMSIZE);
        }
-       kmem_free(newrom, CROMSIZE);
 }
 
 /* Call once after reboot */
diff -r 649df5b67153 -r 3e96cd079d99 sys/dev/ieee1394/firewirereg.h
--- a/sys/dev/ieee1394/firewirereg.h    Sun May 23 01:59:12 2010 +0000
+++ b/sys/dev/ieee1394/firewirereg.h    Sun May 23 02:24:40 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firewirereg.h,v 1.11 2010/03/29 03:05:27 kiyohara Exp $        */
+/*     $NetBSD: firewirereg.h,v 1.12 2010/05/23 02:24:40 christos Exp $        */
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -141,6 +141,7 @@
        uint32_t csr_arc[CSRSIZE/4];
 #define CROMSIZE 0x400
        uint32_t *config_rom;
+       uint32_t *new_rom;
        struct crom_src_buf *crom_src_buf;
        struct crom_src *crom_src;
        struct crom_chunk *crom_root;



Home | Main Index | Thread Index | Old Index