Garrett D'Amore | 12 Sep 08:57 2006

generic TODR changes for shark and ofppc

Attached, find a diff that significantly changes the real-time-clock
support for shark and ofppc.

First, the old oftodclock.c hackery is gone, replaced by dev/ofw/ofrtc.

The old ofrtc.c is changed, it no longer supports character entry
points, but instead uses the new todr framework.

One side effect of this is that ofppc should gain RTC clock support it
lacked before.

This has been tested and shown to work on shark. 

--

-- 
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

Attachment (shark.diff): text/x-patch, 10 KiB
Garrett D'Amore | 12 Sep 09:13 2006

Re: generic TODR changes for shark and ofppc

My apologies, the diff didn't have everything.  I missed the most
important files, which was ofrtc, in a different directory.  New diff
attached.

Garrett D'Amore wrote:
> Attached, find a diff that significantly changes the real-time-clock
> support for shark and ofppc.
>
> First, the old oftodclock.c hackery is gone, replaced by dev/ofw/ofrtc.
>
> The old ofrtc.c is changed, it no longer supports character entry
> points, but instead uses the new todr framework.
>
> One side effect of this is that ofppc should gain RTC clock support it
> lacked before.
>
> This has been tested and shown to work on shark. 
>
>   
> ------------------------------------------------------------------------
>
>   

Attachment (shark.diff): text/x-patch, 17 KiB
Jorge Acereda Maciá | 13 Sep 00:04 2006
Picon

Re: generic TODR changes for shark and ofppc

Garrett D'Amore wrote:

>>Attached, find a diff that significantly changes the real-time-clock
>>support for shark and ofppc.

Now that I look at it, the ofrtc_match() in -current has a bug:

	if ((l = OF_getprop(oba->oba_phandle, "device_type", type,
	    sizeof type - 1)) < 0 ||
	    l >= sizeof type)
		return 0;

	return !strcmp(type, "rtc");

That should be strncmp(type, "rtc", 3)

Garrett D'Amore | 13 Sep 00:17 2006

Re: generic TODR changes for shark and ofppc

Jorge Acereda Maciá wrote:
> Garrett D'Amore wrote:
>
>>> Attached, find a diff that significantly changes the real-time-clock
>>> support for shark and ofppc.
>
> Now that I look at it, the ofrtc_match() in -current has a bug:
>
>     if ((l = OF_getprop(oba->oba_phandle, "device_type", type,
>         sizeof type - 1)) < 0 ||
>         l >= sizeof type)
>         return 0;
>
>     return !strcmp(type, "rtc");
>
> That should be strncmp(type, "rtc", 3)

Ah, okay.   I'll fix it, then.  But is it true that there will never be
a type "rtcXXX" for some other string?

--

-- 
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

Jorge Acereda Maciá | 13 Sep 00:26 2006
Picon

Re: generic TODR changes for shark and ofppc

Garrett D'Amore wrote:
> Jorge Acereda Maciá wrote:
> 
>>Garrett D'Amore wrote:
>>
>>
>>>>Attached, find a diff that significantly changes the real-time-clock
>>>>support for shark and ofppc.
>>
>>Now that I look at it, the ofrtc_match() in -current has a bug:
>>
>>    if ((l = OF_getprop(oba->oba_phandle, "device_type", type,
>>        sizeof type - 1)) < 0 ||
>>        l >= sizeof type)
>>        return 0;
>>
>>    return !strcmp(type, "rtc");
>>
>>That should be strncmp(type, "rtc", 3)
> 
> 
> Ah, okay.   I'll fix it, then.  But is it true that there will never be
> a type "rtcXXX" for some other string?

Ok, should be
    type[l] = 0;


Gmane