Module Name:    src
Committed By:   isaki
Date:           Sun Aug  8 09:30:29 UTC 2010

Modified Files:
        src/sys/arch/x68k/dev: bmd.c

Log Message:
Probe not only ctrl address but also bank window address.
This prevents the wrong matching when other boards like
Neptune-X exist.  Reported by Yasushi Oshima.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x68k/dev/bmd.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/arch/x68k/dev/bmd.c
diff -u src/sys/arch/x68k/dev/bmd.c:1.16 src/sys/arch/x68k/dev/bmd.c:1.17
--- src/sys/arch/x68k/dev/bmd.c:1.16	Thu Dec 18 05:56:42 2008
+++ src/sys/arch/x68k/dev/bmd.c	Sun Aug  8 09:30:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bmd.c,v 1.16 2008/12/18 05:56:42 isaki Exp $	*/
+/*	$NetBSD: bmd.c,v 1.17 2010/08/08 09:30:29 isaki Exp $	*/
 
 /*
  * Copyright (c) 2002 Tetsuya Isaki. All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.16 2008/12/18 05:56:42 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.17 2010/08/08 09:30:29 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -124,6 +124,8 @@
 	struct intio_attach_args *ia = aux;
 	bus_space_tag_t iot = ia->ia_bst;
 	bus_space_handle_t ioh;
+	int window;
+	int r;
 
 	if (ia->ia_addr == INTIOCF_ADDR_DEFAULT)
 		ia->ia_addr = BMD_ADDR1;
@@ -132,6 +134,7 @@
 	if (ia->ia_addr != BMD_ADDR1 && ia->ia_addr != BMD_ADDR2)
 		return (0);
 
+	/* Check CTRL addr */
  	if (badaddr((void *)IIOV(ia->ia_addr)))
 		return (0);
 
@@ -139,8 +142,17 @@
 	if (bus_space_map(iot, ia->ia_addr, ia->ia_size, 0, &ioh))
 		return (0);
 
+	/* Check window addr */
+	r = bus_space_read_1(iot, ioh, BMD_CTRL);
 	bus_space_unmap(iot, ioh, ia->ia_size);
 
+	if ((r & BMD_CTRL_WINDOW))
+		window = 0xef0000;
+	else
+		window = 0xee0000;
+	if (badaddr((void *)IIOV(window)))
+		return (0);
+
 	return (1);
 }
 

Reply via email to