1 /* $Id: timer.h,v 1.12 1996/03/24 20:21:29 davem Exp $ 2 * timer.h: Definitions for the timer chips on the Sparc. 3 * 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 */ 6 #ifndef _SPARC_TIMER_H 7 #define _SPARC_TIMER_H 8 9 #include <asm/system.h> /* For NCPUS */ 10 11 /* Timer structures. The interrupt timer has two properties which 12 * are the counter (which is handled in do_timer in sched.c) and the limit. 13 * This limit is where the timer's counter 'wraps' around. Oddly enough, 14 * the sun4c timer when it hits the limit wraps back to 1 and not zero 15 * thus when calculating the value at which it will fire a microsecond you 16 * must adjust by one. Thanks SUN for designing such great hardware ;( 17 */ 18 19 /* Note that I am only going to use the timer that interrupts at 20 * Sparc IRQ 10. There is another one available that can fire at 21 * IRQ 14. Currently it is left untouched, we keep the PROM's limit 22 * register value and let the prom take these interrupts. This allows 23 * L1-A to work. 24 */ 25 26 struct sun4c_timer_info { 27 volatile unsigned int cur_count10; 28 volatile unsigned int timer_limit10; 29 volatile unsigned int cur_count14; 30 volatile unsigned int timer_limit14; 31 }; 32 33 #define SUN4C_TIMER_PHYSADDR 0xf3000000 34 35 /* A sun4m has two blocks of registers which are probably of the same 36 * structure. LSI Logic's L64851 is told to _decrement_ from the limit 37 * value. Aurora behaves similarly but its limit value is compacted in 38 * other fashion (it's wider). Documented fields are defined here. 39 */ 40 41 /* As with the interrupt register, we have two classes of timer registers 42 * which are per-cpu and master. Per-cpu timers only hit that cpu and are 43 * only level 14 ticks, master timer hits all cpus and is level 10. 44 */ 45 46 #define SUN4M_PRM_CNT_L 0x80000000 47 #define SUN4M_PRM_CNT_LVALUE 0x7FFFFC00 48 49 struct sun4m_timer_percpu_info { 50 volatile unsigned int l14_timer_limit; /* Initial value is 0x009c4000 */ 51 volatile unsigned int l14_cur_count; 52 53 /* This register appears to be write only and/or inaccessible 54 * on Uni-Processor sun4m machines. 55 */ 56 volatile unsigned int l14_limit_noclear; /* Data access error is here */ 57 58 volatile unsigned int cntrl; /* =1 after POST on Aurora */ 59 volatile unsigned char space[PAGE_SIZE - 16]; 60 }; 61 62 struct sun4m_timer_regs { 63 struct sun4m_timer_percpu_info cpu_timers[NCPUS]; 64 volatile unsigned int l10_timer_limit; 65 volatile unsigned int l10_cur_count; 66 67 /* Again, this appears to be write only and/or inaccessible 68 * on uni-processor sun4m machines. 69 */ 70 volatile unsigned int l10_limit_noclear; 71 72 /* This register too, it must be magic. */ 73 volatile unsigned int foobar; 74 75 volatile unsigned int cfg; /* equals zero at boot time... */ 76 }; 77 78 extern struct sun4m_timer_regs *sun4m_timers; 79 extern volatile unsigned int *master_l10_counter; 80 extern volatile unsigned int *master_l10_limit; 81 82 #endif /* !(_SPARC_TIMER_H) */