Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

potential hack/workaround for cpuinfo not being setup early



hi folks.

i found this lying around in my tree.  can someone try it out and
commit it if it is useful?  i won't have a chance to look at this
for a while myself.  i do recall it booted once and seemed to work
but i haven't touched this for a long time.


.mrg.


Index: sys/arch/sparc/sparc/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/sparc/cpu.c,v
retrieving revision 1.211
diff -p -r1.211 cpu.c
*** sys/arch/sparc/sparc/cpu.c  4 Jun 2008 12:41:41 -0000       1.211
--- sys/arch/sparc/sparc/cpu.c  16 Aug 2008 19:47:35 -0000
*************** cpu_attach(struct cpu_softc *sc, int nod
*** 410,416 ****
         * The first CPU we're attaching must be the boot CPU.
         * (see autoconf.c and cpuunit.c)
         */
!       if (cpus == NULL) {
                cpus = malloc(sparc_ncpus * sizeof(cpi), M_DEVBUF, M_NOWAIT);
                bzero(cpus, sparc_ncpus * sizeof(cpi));
  
--- 410,416 ----
         * The first CPU we're attaching must be the boot CPU.
         * (see autoconf.c and cpuunit.c)
         */
!       if (cpu_instance == 0) {
                cpus = malloc(sparc_ncpus * sizeof(cpi), M_DEVBUF, M_NOWAIT);
                bzero(cpus, sparc_ncpus * sizeof(cpi));
  
Index: sys/arch/sparc/sparc/cpuvar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/sparc/cpuvar.h,v
retrieving revision 1.75
diff -p -r1.75 cpuvar.h
*** sys/arch/sparc/sparc/cpuvar.h       28 Apr 2008 20:23:36 -0000      1.75
--- sys/arch/sparc/sparc/cpuvar.h       3 May 2008 20:40:28 -0000
*************** struct cpu_info {
*** 416,422 ****
  
  #define CPU_INFO_ITERATOR             int
  #ifdef MULTIPROCESSOR
! #define CPU_INFO_FOREACH(cii, ci)     cii = 0; ci = cpus[cii], cii < 
sparc_ncpus; cii++
  #else
  #define       CPU_INFO_FOREACH(cii, ci)       (void)cii, ci = curcpu(); ci != 
NULL; ci = NULL
  #endif
--- 416,422 ----
  
  #define CPU_INFO_ITERATOR             int
  #ifdef MULTIPROCESSOR
! #define CPU_INFO_FOREACH(cii, ci)     cii = 0; (ci = cpus[cii]) && cii < 
sparc_ncpus; cii++
  #else
  #define       CPU_INFO_FOREACH(cii, ci)       (void)cii, ci = curcpu(); ci != 
NULL; ci = NULL
  #endif
Index: sys/arch/sparc/sparc/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/sparc/pmap.c,v
retrieving revision 1.322
diff -p -r1.322 pmap.c
*** sys/arch/sparc/sparc/pmap.c 2 Jan 2008 11:48:29 -0000       1.322
--- sys/arch/sparc/sparc/pmap.c 18 Feb 2008 13:44:49 -0000
*************** static void pmap_bootstrap4m(void *);
*** 2964,2969 ****
--- 2964,2971 ----
  static void pmap_bootstrap4_4c(void *, int, int, int);
  #endif
  
+ struct cpu_info *static_cpu_info[2];
+ 
  /*
   * Bootstrap the system enough to run with VM enabled.
   *
*************** pmap_bootstrap(int nctx, int nregion, in
*** 3015,3020 ****
--- 3017,3029 ----
  
        pmap_page_upload();
        curlwp = &lwp0;
+ 
+       /*
+        * Setup a bootstrap cpus[].
+        */
+       static_cpu_info[0] = &cpuinfo;
+       static_cpu_info[1] = NULL;
+       cpus = static_cpu_info;
  }
  
  #if defined(SUN4) || defined(SUN4C)


Home | Main Index | Thread Index | Old Index