Source-Changes-HG archive

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

[src/trunk]: src/sys/arch For Explora 451, call calc_delayconst() before pckb...



details:   https://anonhg.NetBSD.org/src/rev/b1b10e6ad7f9
branches:  trunk
changeset: 953293:b1b10e6ad7f9
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Mar 05 06:06:34 2021 +0000

description:
For Explora 451, call calc_delayconst() before pckbc_cnattach(), which
depends on delay() and DELAY().

Unfortunately, proplib(9) API is not available for MD codes, that are
called before consinit() (since pool(9) is not initialized yet).

Therefore, hard-code CPU frequency to calc_delayconst() in case
"processor-frequency" is not initialized.

diffstat:

 sys/arch/evbppc/conf/std.explora    |   4 +++-
 sys/arch/evbppc/explora/consinit.c  |   8 ++++++--
 sys/arch/powerpc/conf/files.powerpc |   4 ++--
 sys/arch/powerpc/ibm4xx/clock.c     |  17 +++++++++++++----
 4 files changed, 24 insertions(+), 9 deletions(-)

diffs (108 lines):

diff -r 9981bdb4a730 -r b1b10e6ad7f9 sys/arch/evbppc/conf/std.explora
--- a/sys/arch/evbppc/conf/std.explora  Fri Mar 05 05:35:50 2021 +0000
+++ b/sys/arch/evbppc/conf/std.explora  Fri Mar 05 06:06:34 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.explora,v 1.5 2011/06/20 17:44:33 matt Exp $
+#      $NetBSD: std.explora,v 1.6 2021/03/05 06:06:34 rin Exp $
 #
 # Standard/required options for NetBSD/explora.
 
@@ -22,4 +22,6 @@
 
 options        INTSTK=8192
 
+options        PPC_CPU_FREQ=66000000   # XXX hack for pckbc_cnattach()
+
 include                "arch/evbppc/conf/files.explora"
diff -r 9981bdb4a730 -r b1b10e6ad7f9 sys/arch/evbppc/explora/consinit.c
--- a/sys/arch/evbppc/explora/consinit.c        Fri Mar 05 05:35:50 2021 +0000
+++ b/sys/arch/evbppc/explora/consinit.c        Fri Mar 05 06:06:34 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: consinit.c,v 1.9 2012/10/13 17:58:53 jdc Exp $ */
+/*     $NetBSD: consinit.c,v 1.10 2021/03/05 06:06:34 rin Exp $        */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.9 2012/10/13 17:58:53 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.10 2021/03/05 06:06:34 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@
 #include "pckbd.h"
 
 #include <evbppc/explora/dev/elbvar.h>
+#include <powerpc/ibm4xx/cpu.h>
 
 #include "opt_explora.h"
 
@@ -86,6 +87,9 @@
 
        tag = elb_get_bus_space_tag(BASE_FB);
        fb_cnattach(tag, BASE_FB2, (void *)BASE_FB);
+
+       calc_delayconst();      /* required by pckbc_cnattach() */
+
        tag = elb_get_bus_space_tag(BASE_PCKBC);
        pckbc_cnattach(tag, _BUS_SPACE_UNSTRIDE(tag, BASE_PCKBC),
            _BUS_SPACE_UNSTRIDE(tag, BASE_PCKBC2-BASE_PCKBC), PCKBC_KBD_SLOT,
diff -r 9981bdb4a730 -r b1b10e6ad7f9 sys/arch/powerpc/conf/files.powerpc
--- a/sys/arch/powerpc/conf/files.powerpc       Fri Mar 05 05:35:50 2021 +0000
+++ b/sys/arch/powerpc/conf/files.powerpc       Fri Mar 05 06:06:34 2021 +0000
@@ -1,8 +1,8 @@
-#      $NetBSD: files.powerpc,v 1.97 2020/10/21 13:31:51 christos Exp $
+#      $NetBSD: files.powerpc,v 1.98 2021/03/05 06:06:34 rin Exp $
 
 defflag        opt_altivec.h   ALTIVEC K_ALTIVEC PPC_HAVE_SPE
 defflag        opt_openpic.h   OPENPIC_DISTRIBUTE
-defparam opt_ppcparam.h        L2CR_CONFIG L3CR_CONFIG INTSTK CLOCKBASE VERBOSE_INITPPC
+defparam opt_ppcparam.h        L2CR_CONFIG L3CR_CONFIG INTSTK CLOCKBASE VERBOSE_INITPPC PPC_CPU_FREQ
 defflag        opt_ppcarch.h   PPC_OEA PPC_OEA601 PPC_OEA64 PPC_OEA64_BRIDGE PPC_MPC8XX PPC_IBM4XX PPC_IBM403 PPC_IBM440 PPC_BOOKE
 defflag opt_ppccache.h CACHE_PROTO_MEI
 defflag opt_pmap.h     PMAPDEBUG PMAPCHECK PMAPCOUNTERS PMAP_MINIMALTLB PMAP_TLBDEBUG
diff -r 9981bdb4a730 -r b1b10e6ad7f9 sys/arch/powerpc/ibm4xx/clock.c
--- a/sys/arch/powerpc/ibm4xx/clock.c   Fri Mar 05 05:35:50 2021 +0000
+++ b/sys/arch/powerpc/ibm4xx/clock.c   Fri Mar 05 06:06:34 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.31 2021/01/18 04:35:04 rin Exp $   */
+/*     $NetBSD: clock.c,v 1.32 2021/03/05 06:06:34 rin Exp $   */
 /*      $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $  */
 
 /*
@@ -33,10 +33,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.31 2021/01/18 04:35:04 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.32 2021/03/05 06:06:34 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
+#include "opt_ppcparam.h"
 #endif
 
 #include <sys/param.h>
@@ -197,9 +198,17 @@
        prop_number_t freq;
 
        freq = prop_dictionary_get(board_properties, "processor-frequency");
-       KASSERT(freq != NULL);
 
-       ticks_per_sec = (u_long) prop_number_integer_value(freq);
+#ifndef PPC_CPU_FREQ
+       KASSERT(freq != NULL);
+#else
+       /* XXX hack for pckbc_cnattach() for Explora */
+       if (freq == NULL)
+               ticks_per_sec = (u_long) PPC_CPU_FREQ;
+       else
+#endif
+               ticks_per_sec = (u_long) prop_number_integer_value(freq);
+
        ns_per_tick = 1000000000 / ticks_per_sec;
 }
 



Home | Main Index | Thread Index | Old Index