Subject: Re: BIOS and CD-ROM problems
To: None <M.Drochner@fz-juelich.de>
From: Perry E. Metzger <perry@piermont.com>
List: port-i386
Date: 01/11/1999 09:20:19
drochner@zel459.zel.kfa-juelich.de writes:
> [NVRAM century at nonstandard place]
> 
> perry@piermont.com said:
> > Is there any way we could *detect* this sort of PS/2 descended BIOS?
> > If not...  
> 
> Perhaps check for a PS-2 stule checksum... but there is no
> guarantee that other BIOSes make trouble too.

I'd say it is unlikely that the do, but...

> What do you think about the following?

It seems harmless enough.

.pm


> Index: clock.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/i386/isa/clock.c,v
> retrieving revision 1.55
> diff -c -r1.55 clock.c
> *** clock.c	1998/10/13 15:14:13	1.55
> --- clock.c	1999/01/11 12:17:27
> ***************
> *** 489,494 ****
> --- 489,502 ----
>   static int timeset;
>   
>   /*
> +  * patchable to control century byte handling:
> +  * 1: always update in resettodr()
> +  * -1: never touch
> +  * 0: try to figure out itself
> +  */
> + int rtc_update_century = 0;
> + 
> + /*
>    * Initialize the time of day register, based on the time base which is, e.g.
>    * from a filesystem.
>    */
> ***************
> *** 539,554 ****
>   		    century, yr);
>   
>   		/* Kludge to roll over century. */
> ! 		if ((century == 19) && (tcentury == 20) && (yr == 00)) {
>   			printf("WARNING: Setting NVRAM century to 20\n");
>   			s = splclock();
>   			/* note: 0x20 = 20 in BCD. */
>   			mc146818_write(NULL, NVRAM_CENTURY, 0x20); /*XXXsoftc*/
>   			splx(s);
> - 		} else {
> - 			printf("WARNING: CHECK AND RESET THE DATE!\n");
>   		}
> ! 	}
>   	yr = (tcentury == 20) ? yr+100 : yr;
>    
>   	/*
> --- 547,563 ----
>   		    century, yr);
>   
>   		/* Kludge to roll over century. */
> ! 		if ((century == 19) && (tcentury == 20) && (yr == 00) &&
> ! 			rtc_update_century >= 0) {
>   			printf("WARNING: Setting NVRAM century to 20\n");
>   			s = splclock();
>   			/* note: 0x20 = 20 in BCD. */
>   			mc146818_write(NULL, NVRAM_CENTURY, 0x20); /*XXXsoftc*/
>   			splx(s);
>   		}
> ! 	} else if (century == 19 && rtc_update_century == 0)
> ! 		rtc_update_century = 1; /* will update later in resettodr() */
> ! 
>   	yr = (tcentury == 20) ? yr+100 : yr;
>    
>   	/*
> ***************
> *** 654,660 ****
>   
>   	s = splclock();
>   	rtcput(&rtclk);
> ! 	mc146818_write(NULL, NVRAM_CENTURY, century); /* XXX softc */
>   	splx(s);
>   }
>   
> --- 663,670 ----
>   
>   	s = splclock();
>   	rtcput(&rtclk);
> ! 	if (rtc_update_century > 0)
> ! 		mc146818_write(NULL, NVRAM_CENTURY, century); /* XXX softc */
>   	splx(s);
>   }
>