Module Name:    src
Committed By:   martin
Date:           Sun Sep 11 18:21:56 UTC 2022

Modified Files:
        src/sys/arch/atari/vme [netbsd-9]: if_le_vme.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1520):

        sys/arch/atari/vme/if_le_vme.c: revision 1.32
        sys/arch/atari/vme/if_le_vme.c: revision 1.33

Fix a long-standing "leprobe: cannot map memory-area" error during probe.

PAM and ROTHRON VME LANCE seem to have 64KB RAM, but the register
address region are overwrapped, so we cannot map both of them via
bus_space_map(9) that checks regions using extent(9).

To work around this, just use only 32KB RAM for buffers.

XXX: not sure if anyone tried these VME LANCE variants

No need to print errors via aprint_error(9) in probe/match function.

Note aprint_error(9) triggers "WARNING: 1 error while detecting hardware"
message after device configuration, so it's a bit confusing for users.

Also check all possible variants even if bus_space_map(9) fails
(though now it shouldn't fail).


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.58.1 src/sys/arch/atari/vme/if_le_vme.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/atari/vme/if_le_vme.c
diff -u src/sys/arch/atari/vme/if_le_vme.c:1.31 src/sys/arch/atari/vme/if_le_vme.c:1.31.58.1
--- src/sys/arch/atari/vme/if_le_vme.c:1.31	Fri Jul  1 20:34:06 2011
+++ src/sys/arch/atari/vme/if_le_vme.c	Sun Sep 11 18:21:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_vme.c,v 1.31 2011/07/01 20:34:06 dyoung Exp $	*/
+/*	$NetBSD: if_le_vme.c,v 1.31.58.1 2022/09/11 18:21:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 maximum entropy.  All rights reserved.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_le_vme.c,v 1.31 2011/07/01 20:34:06 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_vme.c,v 1.31.58.1 2022/09/11 18:21:56 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -111,8 +111,11 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_vme.c,
 #include <atari/vme/if_levar.h>
 
 /*
- * All cards except BVME410 have 64KB RAM. However.... On the Riebl cards the
- * area between the offsets 0xee70-0xeec0 is used to store config data.
+ * All cards except BVME410 have 64KB RAM. However,
+ *  - On the Riebl cards the area between the offsets 0xee70-0xeec0 is used
+ *    to store config data.
+ *  - On PAM and ROTHRON, mem_addr cannot be mapped if reg_addr is already
+ *    mapped because they are overwrapped. Just use 32KB as Linux does.
  */
 struct le_addresses {
 	u_long	reg_addr;
@@ -124,9 +127,9 @@ struct le_addresses {
 } lestd[] = {
 	{ 0xfe00fff0, 0xfe010000, IRQUNK, 16, 64*1024,
 				LE_OLD_RIEBL|LE_NEW_RIEBL }, /* Riebl	*/
-	{ 0xfecffff0, 0xfecf0000,      5, 16, 64*1024,
+	{ 0xfecffff0, 0xfecf0000,      5, 16, 32*1024,
 				LE_PAM },		     /* PAM	*/
-	{ 0xfecffff0, 0xfecf0000,      5, 16, 64*1024,
+	{ 0xfecffff0, 0xfecf0000,      5, 16, 32*1024,
 				LE_ROTHRON },		     /* Rhotron	*/
 	{ 0xfeff4100, 0xfe000000,      4,  8, VMECF_MEMSIZ_DEFAULT,
 				LE_BVME410 }		     /* BVME410 */
@@ -230,8 +233,7 @@ le_vme_match(device_t parent, cfdata_t c
 
 		if (bus_space_map(iot, le_ap->reg_addr, le_ap->reg_size, 0,
 		    &ioh)) {
-			aprint_error("leprobe: cannot map io-area\n");
-			return 0;
+			continue;
 		}
 		if (le_ap->mem_size == VMECF_MEMSIZ_DEFAULT) {
 			if (bvme410_probe(iot, ioh)) {
@@ -249,8 +251,7 @@ le_vme_match(device_t parent, cfdata_t c
 		if (bus_space_map(memt, le_ap->mem_addr, le_ap->mem_size, 0,
 		    &memh)) {
 			bus_space_unmap(iot, ioh, le_ap->reg_size);
-			aprint_error("leprobe: cannot map memory-area\n");
-			return 0;
+			continue;
 		}
 		found = probe_addresses(&iot, &memt, &ioh, &memh);
 		bus_space_unmap(iot, ioh, le_ap->reg_size);

Reply via email to