Module Name:    src
Committed By:   matt
Date:           Tue Feb  8 06:21:03 UTC 2011

Modified Files:
        src/sys/arch/powerpc/booke/dev: cpunode.c
        src/sys/arch/powerpc/include/booke: cpuvar.h

Log Message:
Allow code to allow inclusive/exclusive locators for subdevices.
(uses on mpc85xx to match on SVRs or not match on SVRs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/booke/dev/cpunode.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/include/booke/cpuvar.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/arch/powerpc/booke/dev/cpunode.c
diff -u src/sys/arch/powerpc/booke/dev/cpunode.c:1.2 src/sys/arch/powerpc/booke/dev/cpunode.c:1.3
--- src/sys/arch/powerpc/booke/dev/cpunode.c:1.2	Tue Jan 18 01:02:53 2011
+++ src/sys/arch/powerpc/booke/dev/cpunode.c	Tue Feb  8 06:21:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpunode.c,v 1.2 2011/01/18 01:02:53 matt Exp $	*/
+/*	$NetBSD: cpunode.c,v 1.3 2011/02/08 06:21:03 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cpunode.c,v 1.2 2011/01/18 01:02:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpunode.c,v 1.3 2011/02/08 06:21:03 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -105,7 +105,35 @@
 
 	nodes |= 1 << ma->ma_node;
 
-	for (u_int childmask = 1; cnl->cnl_name != NULL; cnl++, childmask <<= 1) {
+	const uint16_t my_id = board_info_get_number("my-id");
+
+	for (u_int childmask = 1; cnl->cnl_name != NULL; cnl++) {
+		bool inclusive = true;
+		bool found = (cnl->cnl_ids[0] == 0);
+		for (u_int i = 0;
+		     !found
+		     && i < __arraycount(cnl->cnl_ids)
+		     && cnl->cnl_ids[i] != 0;
+		     i++) {
+			if (cnl->cnl_ids[i] == 0xffff) {
+				inclusive = false;
+				continue;
+			}
+			found = (cnl->cnl_ids[i] == my_id);
+		}
+		/*
+		 * found & inclusive == match
+		 * !found & !inclusive == match
+		 * found & !inclusive == no match
+		 * !found & inclusive == no match
+		 * therefore
+		 * found ^ inclusive = no match
+		 * so
+		 * !(found ^ inclusive) = match
+		 */
+		if (found ^ inclusive)
+			continue;
+
 		cna.cna_busname = "cpunode";
 		cna.cna_memt = ma->ma_memt;
 		cna.cna_dmat = ma->ma_dmat;
@@ -125,6 +153,7 @@
 #endif
 		(void)config_found_sm_loc(self, "cpunode", NULL, &cna,
 		    cpunode_print, NULL);
+		childmask <<= 1;
 	}
 	/*
 	 * Anything MD left to do?

Index: src/sys/arch/powerpc/include/booke/cpuvar.h
diff -u src/sys/arch/powerpc/include/booke/cpuvar.h:1.2 src/sys/arch/powerpc/include/booke/cpuvar.h:1.3
--- src/sys/arch/powerpc/include/booke/cpuvar.h:1.2	Tue Jan 18 01:02:54 2011
+++ src/sys/arch/powerpc/include/booke/cpuvar.h	Tue Feb  8 06:21:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.2 2011/01/18 01:02:54 matt Exp $	*/
+/*	$NetBSD: cpuvar.h,v 1.3 2011/02/08 06:21:03 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -69,6 +69,7 @@
 	uint8_t cnl_nintr;
 	uint8_t cnl_intrs[4];
 	uint32_t cnl_flags;
+	uint16_t cnl_ids[6];
 };
 
 struct cpunode_attach_args {

Reply via email to