Module Name:    src
Committed By:   christos
Date:           Sun May 23 02:24:40 UTC 2010

Modified Files:
        src/sys/dev/ieee1394: firewire.c firewirereg.h

Log Message:
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
...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ieee1394/firewirereg.h

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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.33 src/sys/dev/ieee1394/firewire.c:1.34
--- src/sys/dev/ieee1394/firewire.c:1.33	Sat May 15 06:42:51 2010
+++ src/sys/dev/ieee1394/firewire.c	Sat May 22 22:24:40 2010
@@ -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 */

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.11 src/sys/dev/ieee1394/firewirereg.h:1.12
--- src/sys/dev/ieee1394/firewirereg.h:1.11	Sun Mar 28 23:05:27 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Sat May 22 22:24:40 2010
@@ -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;

Reply via email to