Home | History | Annotate | Line # | Download | only in mipsco
      1 /*	$NetBSD: clock.c,v 1.11 2024/07/20 20:36:33 andvar Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1988 University of Utah.
      5  * Copyright (c) 1992, 1993
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * This code is derived from software contributed to Berkeley by
      9  * the Systems Programming Group of the University of Utah Computer
     10  * Science Department, Ralph Campbell, and Kazumasa Utashiro of
     11  * Software Research Associates, Inc.
     12  *
     13  * Redistribution and use in source and binary forms, with or without
     14  * modification, are permitted provided that the following conditions
     15  * are met:
     16  * 1. Redistributions of source code must retain the above copyright
     17  *    notice, this list of conditions and the following disclaimer.
     18  * 2. Redistributions in binary form must reproduce the above copyright
     19  *    notice, this list of conditions and the following disclaimer in the
     20  *    documentation and/or other materials provided with the distribution.
     21  * 3. Neither the name of the University nor the names of its contributors
     22  *    may be used to endorse or promote products derived from this software
     23  *    without specific prior written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35  * SUCH DAMAGE.
     36  *
     37  * from: Utah $Hdr: clock.c 1.18 91/01/21$
     38  *
     39  *	@(#)clock.c	8.1 (Berkeley) 6/11/93
     40  */
     41 
     42 #include <sys/cdefs.h>
     43 __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2024/07/20 20:36:33 andvar Exp $");
     44 
     45 #include <sys/param.h>
     46 #include <sys/kernel.h>
     47 #include <sys/device.h>
     48 #include <sys/systm.h>
     49 #include <dev/clock_subr.h>
     50 
     51 #include <machine/cpu.h>
     52 #include <machine/autoconf.h>
     53 #include <machine/mainboard.h>
     54 #include <machine/sysconf.h>
     55 
     56 #define MINYEAR 1998 /* "today" */
     57 
     58 /*
     59  * Machine-dependent clock routines.
     60  *
     61  * Startrtclock restarts the real-time clock, which provides
     62  * hardclock interrupts to kern_clock.c.
     63  *
     64  * Inittodr initializes the time of day hardware which provides
     65  * date functions.  Its primary function is to use some file
     66  * system information in case the hardware clock lost state.
     67  *
     68  * Resettodr restores the time of day hardware after a time change.
     69  */
     70 
     71 /*
     72  * We assume newhz is either stathz or profhz, and that neither will
     73  * change after being set up above.  Could recalculate intervals here
     74  * but that would be a drag.
     75  */
     76 void
     77 setstatclockrate(int newhz)
     78 {
     79 }
     80 
     81 /*
     82  * Set up the real-time and statistics clocks.  Leave stathz 0 only if
     83  * no alternative timer is available.
     84  */
     85 void
     86 cpu_initclocks(void)
     87 {
     88 	if (platform.clkinit)
     89 		(*platform.clkinit)();
     90 }
     91