tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: (tiny) patch review: return if RTC diag fails



On Thu, Feb 13, 2025 at 06:29:03PM +0100, Emile `iMil' Heitor wrote:
> On Thu, 13 Feb 2025, Manuel Bouyer wrote:
> 
> > I think it's not right: mc146818_read(NULL, NVRAM_DIAG) returning a non--0
> > value doens't means that is fails. Usually the RTC BIOS diagnostic has some
> > error because the chip lost track of date/time (maybe because of a bad
> > battery). In this case you still want to use the RTC.
> 
> Understood. So as this seems to only impact qemu/microvm should we
> consider an if (vm) test?
> 
> > Did you check what value is returned in your case ?
> 
> 255

Looks like there's nothing to be read here; some of the bits should never be
1 (see NVRAM_DIAG_BITS definition in nvram.h). This is what inb returns when
there's nothing at this address. so maybe test if (vm && s == 0xff) ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index