Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc Allow code to allow inclusive/exclusive loc...
details: https://anonhg.NetBSD.org/src/rev/64c917cd666b
branches: trunk
changeset: 761807:64c917cd666b
user: matt <matt%NetBSD.org@localhost>
date: Tue Feb 08 06:21:03 2011 +0000
description:
Allow code to allow inclusive/exclusive locators for subdevices.
(uses on mpc85xx to match on SVRs or not match on SVRs).
diffstat:
sys/arch/powerpc/booke/dev/cpunode.c | 35 ++++++++++++++++++++++++++++++--
sys/arch/powerpc/include/booke/cpuvar.h | 3 +-
2 files changed, 34 insertions(+), 4 deletions(-)
diffs (80 lines):
diff -r e0706452e999 -r 64c917cd666b sys/arch/powerpc/booke/dev/cpunode.c
--- a/sys/arch/powerpc/booke/dev/cpunode.c Tue Feb 08 06:19:13 2011 +0000
+++ b/sys/arch/powerpc/booke/dev/cpunode.c Tue Feb 08 06:21:03 2011 +0000
@@ -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?
diff -r e0706452e999 -r 64c917cd666b sys/arch/powerpc/include/booke/cpuvar.h
--- a/sys/arch/powerpc/include/booke/cpuvar.h Tue Feb 08 06:19:13 2011 +0000
+++ b/sys/arch/powerpc/include/booke/cpuvar.h Tue Feb 08 06:21:03 2011 +0000
@@ -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 {
Home |
Main Index |
Thread Index |
Old Index