Subject: Re: proposal for changes to todr interface
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: tech-kern
Date: 09/06/2006 09:53:46
Izumi Tsutsui wrote:
> garrett_damore@tadpole.com wrote:
>
>   
>>>>     * add todr_flags
>>>>
>>>>         primarily I want to add a new flag, TODR_USE_LOCALTIME, that
>>>>         indicates that the clock chip stores time in the local timezone,
>>>>         rather than using a GMT offset.  essentially, this will allow
>>>>         the common code to apply the rtc_offset adjustments on behalf of
>>>>         the rtc chip.
>>>>         
>>> Do you mean that MI drivers will adjust clock as per rtc_offset
>>> if TODR_USE_LOCALTIME is set?
>>>       
>> I mean that the routines in kern_todr.c will pass an "adjusted" time
>> (using the rtc_offset) to the driver, and apply the rtc_offset from the
>> driver as well.   This means that if drivers that need an rtc_offset
>> adjustment, they will get it without ever actually being aware of the
>> rtc_offset variable.
>>     
>
> Hmm, how and where is TODR_USE_LOCALTIME flag set?
>   

I was assuming the clock driver would set it.  How it makes that
decision could vary.  For drivers that are MD, it could just be set. 
For some drivers it could be set by "md-specific" attachment code.  For
truly MI drivers (like i2c drivers), in my opinion these parameters
should be passed into the driver from properties set by MD-specific
autoconfig().


> Isn't it better to always pass an adjusted time using rtc_offset
> in kern_todr.c as old i386 todr functions did?
> (since the default of rtc_offset is zero in param.c)
>   

That's a good question.  I was assuming that some ports want to use
rtc_offset or not depending on whether or not the port used local time
or not.  Some ports seem to honor rtc_offset, whereas some don't.

> I don't think any driver requires rtc_offset adjustment,
> but the machine itself (or maybe other OSes on it) needs
> adjustment on reading/storing time regardless of its rtc chip.
>   

That may be true.  Again, I was sort of assuming that the decision would
follow the combination of clock driver + port.  If it is true that for
any given kernel, all the hardware supported by that kernel either does
or does not want the rtc offset, then we could skip this whole parameter
and make it a kernel config that affects inittodr internally.

Doing it that way requires changing a port all at once however.

    -- Garrett
> ---
> Izumi Tsutsui
>   


-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191