Date: Fri, 22 Apr 2005 06:05:17 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 75699 for review Message-ID: <200504220605.j3M65HFY004367@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=75699 Change 75699 by marcel@marcel_nfs on 2005/04/22 06:04:59 IFC @75698 Affected files ... .. //depot/projects/ia64/lib/libc/i386/string/bcmp.S#3 integrate .. //depot/projects/ia64/sys/conf/files.ia64#59 integrate .. //depot/projects/ia64/sys/dev/esp/ncr53c9x.c#5 integrate .. //depot/projects/ia64/sys/i386/i386/support.s#16 integrate .. //depot/projects/ia64/sys/ia64/ia64/clock.c#20 integrate .. //depot/projects/ia64/sys/ia64/ia64/clock_if.m#3 delete .. //depot/projects/ia64/sys/ia64/ia64/eficlock.c#5 delete .. //depot/projects/ia64/sys/ia64/include/clockvar.h#3 delete .. //depot/projects/ia64/sys/kern/vfs_bio.c#78 integrate .. //depot/projects/ia64/sys/kern/vfs_subr.c#80 integrate Differences ... ==== //depot/projects/ia64/lib/libc/i386/string/bcmp.S#3 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <machine/asm.h> -__FBSDID("$FreeBSD: src/lib/libc/i386/string/bcmp.S,v 1.8 2002/03/23 02:44:19 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/i386/string/bcmp.S,v 1.9 2005/04/21 23:07:20 alc Exp $"); /* * bcmp (void *b1, void *b2, size_t len) @@ -43,7 +43,6 @@ pushl %esi movl 12(%esp),%edi movl 16(%esp),%esi - xorl %eax,%eax /* clear return value */ cld /* set compare direction forward */ movl 20(%esp),%ecx /* compare by words */ @@ -56,9 +55,9 @@ andl $3,%ecx repe cmpsb - je L2 - -L1: incl %eax -L2: popl %esi +L1: + setne %al + movsbl %al,%eax + popl %esi popl %edi ret ==== //depot/projects/ia64/sys/conf/files.ia64#59 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.ia64,v 1.75 2005/04/04 21:53:53 jhb Exp $ +# $FreeBSD: src/sys/conf/files.ia64,v 1.76 2005/04/22 05:04:57 marcel Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -88,13 +88,11 @@ ia64/ia64/autoconf.c standard ia64/ia64/busdma_machdep.c standard ia64/ia64/clock.c standard -ia64/ia64/clock_if.m standard ia64/ia64/context.S standard ia64/ia64/db_interface.c optional ddb ia64/ia64/db_trace.c optional ddb ia64/ia64/dump_machdep.c standard ia64/ia64/efi.c standard -ia64/ia64/eficlock.c standard ia64/ia64/elf_machdep.c standard ia64/ia64/exception.S standard ia64/ia64/gdb_machdep.c optional gdb ==== //depot/projects/ia64/sys/dev/esp/ncr53c9x.c#5 (text+ko) ==== @@ -104,7 +104,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/esp/ncr53c9x.c,v 1.9 2005/04/17 17:44:01 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/esp/ncr53c9x.c,v 1.10 2005/04/22 03:37:10 scottl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -2228,6 +2228,11 @@ * a DATA transfer. Print a diagnostic * if the DMA counter and TC bit * appear to be out of sync. + * + * XXX This is fatal and usually means that + * the DMA engine is hopelessly out of + * sync with reality. A disk is likely + * getting spammed at this point. */ device_printf(sc->sc_dev, "!TC on DATA XFER" " [intr %x, stat %x, step %d]" @@ -2237,6 +2242,7 @@ sc->sc_espstep, sc->sc_prevphase, ecb ? ecb->dleft : -1); + panic("esp: unrecoverable DMA error"); } } } ==== //depot/projects/ia64/sys/i386/i386/support.s#16 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/i386/support.s,v 1.106 2004/11/16 20:42:31 jhb Exp $ + * $FreeBSD: src/sys/i386/i386/support.s,v 1.107 2005/04/21 23:07:20 alc Exp $ */ #include "opt_npx.h" @@ -1401,7 +1401,6 @@ movl 12(%esp),%edi movl 16(%esp),%esi movl 20(%esp),%edx - xorl %eax,%eax movl %edx,%ecx shrl $2,%ecx @@ -1414,10 +1413,9 @@ andl $3,%ecx repe cmpsb - je 2f 1: - incl %eax -2: + setne %al + movsbl %al,%eax popl %esi popl %edi ret ==== //depot/projects/ia64/sys/ia64/ia64/clock.c#20 (text+ko) ==== @@ -1,44 +1,31 @@ /*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 2005 Marcel Moolenaar + * All rights reserved. * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: clock.c 1.18 91/01/21 - * - * @(#)clock.c 8.1 (Berkeley) 6/10/93 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $NetBSD: clock.c,v 1.20 1998/01/31 10:32:47 ross Exp $ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ia64/ia64/clock.c,v 1.24 2005/01/06 22:18:22 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/clock.c,v 1.25 2005/04/22 05:04:58 marcel Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -50,40 +37,72 @@ #include <sys/pcpu.h> #include <machine/clock.h> -#include <machine/clockvar.h> #include <machine/cpu.h> - -#define SECMIN ((unsigned)60) /* seconds per minute */ -#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */ -#define SECDAY ((unsigned)(24*SECHOUR)) /* seconds per day */ -#define SECYR ((unsigned)(365*SECDAY)) /* seconds per common year */ +#include <machine/efi.h> -/* - * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we - * can use a simple formula for leap years. - * XXX time_t is 64-bits on ia64. - */ -#define LEAPYEAR(y) (((y) % 4) == 0) - static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS); -int disable_rtc_set; /* disable resettodr() if != 0 */ +int disable_rtc_set; /* disable resettodr() if != 0 */ SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, 0, ""); -int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ +int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); -int adjkerntz; /* local offset from GMT in seconds */ +int adjkerntz; /* local offset from GMT in seconds */ SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW, &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", ""); -kobj_t clockdev; -int todr_initialized; +static int +sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) +{ + int error; + + error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); + if (!error && req->newptr) + resettodr(); + return (error); +} uint64_t ia64_clock_reload; +static int clock_initialized = 0; + +static short dayyr[12] = { + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 +}; + +/* + * Leap years + * + * Our well-known calendar, the Gregorian calendar, is intended to be of the + * same length as the cycle of the seasons (the tropical year). However, the + * tropical year is approximately 365.2422 days. If the calendar year always + * consisted of 365 days, it would be short of the tropical year by about + * 0.2422 days every year. Over a century, the beginning of spring in the + * northern hemisphere would shift from March 20 to April 13. + * + * When Pope Gregory XIII instituted the Gregorian calendar in 1582, the + * calendar was shifted to make the beginning of spring fall on March 21 and + * a new system of leap days was introduced. Instead of intercalating a leap + * day every fourth year, 97 leap days would be introduced every 400 years, + * according to the following rule: + * + * Years evenly divisible by 4 are leap years, with the exception of + * centurial years that are not evenly divisible by 400. + * + * Thus, the average Gregorian calendar year is 365.2425 days in length. This + * agrees to within half a minute of the length of the tropical year. + */ + +static __inline +int isleap(int yr) +{ + + return ((yr % 4) ? 0 : (yr % 100) ? 1 : (yr % 400) ? 0 : 1); +} + #ifndef SMP static timecounter_get_t ia64_get_timecount; @@ -102,34 +121,6 @@ } #endif -static int -sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) -{ - int error; - - error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); - if (!error && req->newptr) - resettodr(); - return (error); -} - -void -clockattach(kobj_t dev) -{ - - if (clockdev) - panic("clockattach: multiple clocks"); - - clockdev = dev; - -#ifdef EVCNT_COUNTERS - evcnt_attach(dev, "intr", &clock_intr_evcnt); -#endif - - /* Get the clock started. */ - CLOCK_INIT(clockdev); -} - void pcpu_initclock(void) { @@ -176,88 +167,59 @@ /* nothing to do */ } -/* - * This code is defunct after 2099. - * Will Unix still be here then?? - */ -static short dayyr[12] = { - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 -}; - -/* - * Initialize the time of day register, based on the time base which is, - * e.g. from a filesystem. Base provides the time to within six months, - * and the time of year clock (if any) provides the rest. - */ void inittodr(time_t base) { - struct clocktime ct; + struct efi_tm tm; struct timespec ts; - time_t deltat; - int badbase, days, s, yr; + long days; + int yr; + + efi_get_time(&tm); + + /* + * This code was written in 2005, so logically EFI cannot return + * a year smaller than that. Assume the EFI clock is out of whack + * in that case and reset the EFI clock. + */ + if (tm.tm_year < 2005) { + printf("WARNING: CHECK AND RESET THE DATE!\n"); + memset(&tm, 0, sizeof(tm)); + tm.tm_year = 2005; + tm.tm_mon = tm.tm_mday = 1; + if (efi_set_time(&tm)) + printf("ERROR: COULD NOT RESET EFI CLOCK!\n"); + } - if (base < 5*SECYR) { - printf("WARNING: preposterous time in filesystem"); - /* read the system clock anyway */ - base = 6*SECYR + 186*SECDAY + SECDAY/2; - badbase = 1; - } else - badbase = 0; + days = 0L; + for (yr = 1970; yr < (int)tm.tm_year; yr++) + days += isleap(yr) ? 366L : 365L; + days += dayyr[tm.tm_mon - 1] + tm.tm_mday - 1L; + if (isleap(tm.tm_year) && tm.tm_mon > 2) + days++; - CLOCK_GET(clockdev, base, &ct); - todr_initialized = 1; + ts.tv_sec = ((days * 24L + tm.tm_hour) * 60L + tm.tm_min) * 60L + + tm.tm_sec + ((wall_cmos_clock) ? adjkerntz : 0L); + ts.tv_nsec = tm.tm_nsec; - /* simple sanity checks */ - if (ct.year < 70 || ct.mon < 1 || ct.mon > 12 || ct.day < 1 || - ct.day > 31 || ct.hour > 23 || ct.min > 59 || ct.sec > 59) { - /* - * Believe the time in the filesystem for lack of - * anything better, resetting the TODR. - */ - s = splclock(); + /* + * The EFI clock is supposed to be a real-time clock, whereas the + * base argument is coming from a saved (as on disk) time. It's + * impossible for a saved time to represent a time in the future, + * so we expect the EFI clock to be larger. If not, the EFI clock + * may not be reliable and we trust the base. + * Warn if the EFI clock was off by 2 or more days. + */ + if (ts.tv_sec < base) { + days = (base - ts.tv_sec) / (60L * 60L * 24L); + if (days >= 2) + printf("WARNING: EFI clock lost %ld days!\n", days); ts.tv_sec = base; ts.tv_nsec = 0; - tc_setclock(&ts); - splx(s); - if (!badbase) { - printf("WARNING: preposterous clock chip time\n"); - resettodr(); - } - goto bad; } - days = 0; - for (yr = 70; yr < ct.year; yr++) - days += LEAPYEAR(yr) ? 366 : 365; - days += dayyr[ct.mon - 1] + ct.day - 1; - if (LEAPYEAR(yr) && ct.mon > 2) - days++; - /* now have days since Jan 1, 1970; the rest is easy... */ - s = splclock(); - ts.tv_sec = - days * SECDAY + ct.hour * SECHOUR + ct.min * SECMIN + ct.sec; - if (wall_cmos_clock) - ts.tv_sec += adjkerntz; - ts.tv_nsec = 0; tc_setclock(&ts); - splx(s); - - if (!badbase) { - /* - * See if we gained/lost two or more days; - * if so, assume something is amiss. - */ - deltat = ts.tv_sec - base; - if (deltat < 0) - deltat = -deltat; - if (deltat < 2 * SECDAY) - return; - printf("WARNING: clock %s %ld days", - ts.tv_sec < base ? "lost" : "gained", deltat / SECDAY); - } -bad: - printf(" -- CHECK AND RESET THE DATE!\n"); + clock_initialized = 1; } /* @@ -270,49 +232,35 @@ void resettodr() { - struct clocktime ct; - unsigned long tm; - int s, t, t2; + struct efi_tm tm; + long t; + int x; - if (!todr_initialized || disable_rtc_set) + if (!clock_initialized || disable_rtc_set) return; - s = splclock(); - tm = time_second; - splx(s); + efi_get_time(&tm); + tm.tm_nsec = 0; - /* Calculate local time to put in RTC */ - tm -= (wall_cmos_clock ? adjkerntz : 0); + t = time_second - ((wall_cmos_clock) ? adjkerntz : 0L); - /* compute the day of week. */ - t2 = tm / SECDAY; - ct.dow = (t2 + 4) % 7; /* 1/1/1970 was thursday */ + tm.tm_sec = t % 60; t /= 60L; + tm.tm_min = t % 60; t /= 60L; + tm.tm_hour = t % 24; t /= 24L; - /* compute the year */ - ct.year = 69; - t = t2; /* XXX ? */ - while (t2 >= 0) { /* whittle off years */ - t = t2; - ct.year++; - t2 -= LEAPYEAR(ct.year) ? 366 : 365; + tm.tm_year = 1970; + x = (isleap(tm.tm_year)) ? 366 : 365; + while (t > x) { + t -= x; + tm.tm_year++; + x = (isleap(tm.tm_year)) ? 366 : 365; } - /* t = month + day; separate */ - t2 = LEAPYEAR(ct.year); - for (ct.mon = 1; ct.mon < 12; ct.mon++) - if (t < dayyr[ct.mon] + (t2 && ct.mon > 1)) - break; - - ct.day = t - dayyr[ct.mon - 1] + 1; - if (t2 && ct.mon > 2) - ct.day--; - - /* the rest is easy */ - t = tm % SECDAY; - ct.hour = t / SECHOUR; - t %= 3600; - ct.min = t / SECMIN; - ct.sec = t % SECMIN; - - CLOCK_SET(clockdev, &ct); + x = 11; + while (t < dayyr[x]) + x--; + tm.tm_mon = x + 1; + tm.tm_mday = t - dayyr[x] + 1; + if (efi_set_time(&tm)) + printf("ERROR: COULD NOT RESET EFI CLOCK!\n"); } ==== //depot/projects/ia64/sys/kern/vfs_bio.c#78 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.482 2005/03/25 00:20:37 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.483 2005/04/22 00:53:20 jeff Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1831,6 +1831,12 @@ buf_deallocate(bp); if (bp->b_vflags & BV_BKGRDINPROG) panic("losing buffer 3"); + KASSERT(bp->b_vp == NULL, + ("bp: %p still has vnode %p. qindex: %d", + bp, bp->b_vp, qindex)); + KASSERT((bp->b_xflags & (BX_VNCLEAN|BX_VNDIRTY)) == 0, + ("bp: %p still on a buffer list. xflags %X", + bp, bp->b_xflags)); if (bp->b_bufsize) allocbuf(bp, 0); ==== //depot/projects/ia64/sys/kern/vfs_subr.c#80 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.616 2005/04/18 21:11:47 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.617 2005/04/22 00:57:05 jeff Exp $"); #include "opt_ddb.h" #include "opt_mac.h" @@ -821,10 +821,12 @@ } msleep(&vnlruproc_sig, &vnode_free_list_mtx, PVFS, "vlruwk", hz); +#if 0 /* XXX Not all VFS_VGET/ffs_vget callers check returns. */ if (numvnodes > desiredvnodes) { mtx_unlock(&vnode_free_list_mtx); return (ENFILE); } +#endif } numvnodes++; mtx_unlock(&vnode_free_list_mtx);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504220605.j3M65HFY004367>