pcrtc.c (18846) | pcrtc.c (19122) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz and Don Ahn. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz and Don Ahn. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 |
37 * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ | 37 * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ |
38 */ 39 40/* 41 * inittodr, settodr and support routines written 42 * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at> 43 * 44 * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94 45 */ 46 47/* 48 * modified for PC98 | 38 */ 39 40/* 41 * inittodr, settodr and support routines written 42 * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at> 43 * 44 * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94 45 */ 46 47/* 48 * modified for PC98 |
49 * $Id: clock.c,v 1.6 1996/10/09 19:47:43 bde Exp $ | 49 * $Id: clock.c,v 1.7 1996/10/09 21:46:11 asami Exp $ |
50 */ 51 52/* 53 * Primitive clock interrupt routines. 54 */ 55 56#include "opt_clock.h" 57#include "opt_cpu.h" --- 1064 unchanged lines hidden (view full) --- 1122 } 1123#endif 1124 1125#ifndef PC98 1126 /* Initialize RTC. */ 1127 writertc(RTC_STATUSA, rtc_statusa); 1128 writertc(RTC_STATUSB, RTCSB_24HR); 1129 | 50 */ 51 52/* 53 * Primitive clock interrupt routines. 54 */ 55 56#include "opt_clock.h" 57#include "opt_cpu.h" --- 1064 unchanged lines hidden (view full) --- 1122 } 1123#endif 1124 1125#ifndef PC98 1126 /* Initialize RTC. */ 1127 writertc(RTC_STATUSA, rtc_statusa); 1128 writertc(RTC_STATUSB, RTCSB_24HR); 1129 |
1130 /* Don't bother enabling the statistics clock. */ 1131 if (statclock_disable) 1132 return; 1133 diag = rtcin(RTC_DIAG); 1134 if (diag != 0) 1135 printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); 1136 register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, 1137 /* XXX */ (inthand2_t *)rtcintr, &stat_imask, 1138 /* unit */ 0); 1139 INTREN(IRQ8); 1140 writertc(RTC_STATUSB, rtc_statusb); 1141#endif 1142} 1143 1144void 1145setstatclockrate(int newhz) 1146{ 1147#ifndef PC98 1148 if (newhz == RTC_PROFRATE) 1149 rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF; 1150 else 1151 rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; 1152 writertc(RTC_STATUSA, rtc_statusa); 1153#endif 1154} 1155 |
|
1130static int 1131sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS 1132{ 1133 int error; 1134 u_int freq; 1135 1136 /* 1137 * Use `i8254' instead of `timer' in external names because `timer' --- 50 unchanged lines hidden (view full) --- 1188 if (error == 0 && req->newptr != NULL) 1189 set_i586_ctr_freq(freq, timer_freq); 1190 return (error); 1191} 1192 1193SYSCTL_PROC(_machdep, OID_AUTO, i586_freq, CTLTYPE_INT | CTLFLAG_RW, 1194 0, sizeof(u_int), sysctl_machdep_i586_freq, "I", ""); 1195#endif /* defined(I586_CPU) || defined(I686_CPU) */ | 1156static int 1157sysctl_machdep_i8254_freq SYSCTL_HANDLER_ARGS 1158{ 1159 int error; 1160 u_int freq; 1161 1162 /* 1163 * Use `i8254' instead of `timer' in external names because `timer' --- 50 unchanged lines hidden (view full) --- 1214 if (error == 0 && req->newptr != NULL) 1215 set_i586_ctr_freq(freq, timer_freq); 1216 return (error); 1217} 1218 1219SYSCTL_PROC(_machdep, OID_AUTO, i586_freq, CTLTYPE_INT | CTLFLAG_RW, 1220 0, sizeof(u_int), sysctl_machdep_i586_freq, "I", ""); 1221#endif /* defined(I586_CPU) || defined(I686_CPU) */ |
1196 1197 /* Don't bother enabling the statistics clock. */ 1198 if (statclock_disable) 1199 return; 1200 diag = rtcin(RTC_DIAG); 1201 if (diag != 0) 1202 printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); 1203 register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, 1204 /* XXX */ (inthand2_t *)rtcintr, &stat_imask, 1205 /* unit */ 0); 1206 INTREN(IRQ8); 1207 writertc(RTC_STATUSB, rtc_statusb); 1208#endif 1209} 1210 1211void 1212setstatclockrate(int newhz) 1213{ 1214#ifndef PC98 1215 if (newhz == RTC_PROFRATE) 1216 rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF; 1217 else 1218 rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; 1219 writertc(RTC_STATUSA, rtc_statusa); 1220#endif 1221} | |