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

Manuel Bouyer <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
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 <[email protected]>
     NetBSD: 26 ans d'experience feront toujours la difference
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.