Author: raj
Date: Sat May 26 13:42:55 2012
New Revision: 236098
URL: http://svn.freebsd.org/changeset/base/236098

Log:
  Retrieve CPU number info from the device tree.
  
  Obtained from:        Freescale, Semihalf.

Modified:
  head/sys/powerpc/booke/platform_bare.c

Modified: head/sys/powerpc/booke/platform_bare.c
==============================================================================
--- head/sys/powerpc/booke/platform_bare.c      Sat May 26 13:36:18 2012        
(r236097)
+++ head/sys/powerpc/booke/platform_bare.c      Sat May 26 13:42:55 2012        
(r236098)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008-2009 Semihalf, Rafal Jaworowski
+ * Copyright (c) 2008-2012 Semihalf.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -101,26 +101,16 @@ PLATFORM_DEF(bare_platform);
 static int
 bare_probe(platform_t plat)
 {
-       uint32_t ver, sr;
+       phandle_t cpus, child;
+       uint32_t sr;
        int i, law_max, tgt;
 
-       ver = SVR_VER(mfspr(SPR_SVR));
-       switch (ver & ~0x0008) {        /* Mask Security Enabled bit */
-       case SVR_P4080:
-               maxcpu = 8;
-               break;
-       case SVR_P4040:
-               maxcpu = 4;
-               break;
-       case SVR_MPC8572:
-       case SVR_P1020:
-       case SVR_P2020:
-               maxcpu = 2;
-               break;
-       default:
+       if ((cpus = OF_finddevice("/cpus")) != 0) {
+               for (maxcpu = 0, child = OF_child(cpus); child != 0;
+                   child = OF_peer(child), maxcpu++)
+                       ;
+       } else
                maxcpu = 1;
-               break;
-       }
 
        /*
         * Clear local access windows. Skip DRAM entries, so we don't shoot
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to