Date: Fri, 30 May 2003 14:13:08 -0700 (PDT) From: Juli Mallett <jmallett@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 32123 for review Message-ID: <200305302113.h4ULD8Si071608@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=32123 Change 32123 by jmallett@jmallett_dalek on 2003/05/30 14:12:26 Add platform-dependent hooks on trap enter/exit. Useful for such things as disabling watchdog, for now. Now I can spent quite some time in ddb. Affected files ... .. //depot/projects/mips/sys/mips/include/trap.h#2 edit .. //depot/projects/mips/sys/mips/mips/trap.c#6 edit .. //depot/projects/mips/sys/mips/sgimips/ip22.c#4 edit .. //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#19 edit .. //depot/projects/mips/sys/mips/sgimips/sysconf.h#2 edit Differences ... ==== //depot/projects/mips/sys/mips/include/trap.h#2 (text+ko) ==== @@ -42,6 +42,9 @@ * @(#)trap.h 8.1 (Berkeley) 6/10/93 */ +#ifndef _MACHINE_TRAP_H_ +#define _MACHINE_TRAP_H_ + /* * Trap codes * also known in trap.c for name strings @@ -71,3 +74,8 @@ #define T_VCED 31 /* Virtual coherency data */ #define T_USER 0x20 /* user-mode flag or'ed with type */ + +void platform_trap_enter(void); +void platform_trap_exit(void); + +#endif /* _MACHINE_TRAP_H_ */ ==== //depot/projects/mips/sys/mips/mips/trap.c#6 (text+ko) ==== @@ -80,6 +80,8 @@ struct trap_identifier *tid; int code, kernelmode; + platform_trap_enter(); + code = (cause & MIPS3_CR_EXC_CODE) >> MIPS_CR_EXC_CODE_SHIFT; kernelmode = (tf->tf_regs[TF_SR] & MIPS_SR_KSU_USER) == 0; printf("\n\nFatal trap type %d in %s mode:", @@ -110,6 +112,7 @@ default: goto dopanic; } + platform_trap_exit(); return; dopanic: if (panicstr != NULL) { @@ -117,4 +120,5 @@ cpu_reset(); } panic("trap"); + platform_trap_exit(); } ==== //depot/projects/mips/sys/mips/sgimips/ip22.c#4 (text+ko) ==== @@ -62,6 +62,7 @@ int ip22_mappable_intr(void *); void ip22_intr(u_int, u_int, u_int, u_int); void ip22_intr_establish(int, int, int (*)(void *), void *); +void ip22_watchdog(int); unsigned long ip22_clkread(void); unsigned long ip22_cal_timer(u_int32_t, u_int32_t); @@ -139,6 +140,7 @@ platform.iointr = ip22_intr; platform.bus_reset = ip22_bus_reset; platform.intr_establish = ip22_intr_establish; + platform.watchdog = ip22_watchdog; #if maybenever biomask = 0x0700; @@ -507,3 +509,12 @@ break; } } + +void +ip22_watchdog(int enable) +{ + if (enable) + *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fa00004) |= 0x100; + else + *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fa00004) &= ~0x100; +} ==== //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#19 (text+ko) ==== @@ -192,3 +192,19 @@ else panic("Soft interrupt!?\n"); } + +/* + * XXX Maybe return the state of the watchdog in enter, and pass it to + * exit? Like spl(). + */ +void +platform_trap_enter(void) +{ + (*platform.watchdog)(FALSE); +} + +void +platform_trap_exit(void) +{ + (*platform.watchdog)(TRUE); +} ==== //depot/projects/mips/sys/mips/sgimips/sysconf.h#2 (text+ko) ==== @@ -62,6 +62,7 @@ * intr_establish - establish interrupt handler * intr_disestablish - disestablish interrupt handler * clkread - interporate HZ with hi-resolution timer + * watchdog - toggle watchdog */ void (*bus_reset)(void); @@ -69,6 +70,7 @@ void (*iointr)(unsigned, unsigned, unsigned, unsigned); void (*intr_establish)(int , int, int (*)(void *), void *); unsigned long (*clkread) __P((void)); + void (*watchdog)(int); }; extern struct platform platform;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305302113.h4ULD8Si071608>