Subject: Re: sdpmem(4) reporting DDR2 speed/type incorrectly
To: Paul Goyette <paul@whooppee.com>
From: David Brownlee <abs@NetBSD.org>
List: current-users
Date: 09/19/2007 10:06:36
On Mon, 17 Sep 2007, Paul Goyette wrote:

> Hmmm.  If you're going to report 667 vs 666, you should also plan on 
> reporting 1667 vs 1666!  It will happen someday, probably sooner than
> any of us think.  :)
>
>> @@ -308,6 +308,8 @@ spdmem_attach(struct device *parent, str
>> 				bits -= 8;
>> 		}
>> 		d_clk /= cycle_time;
>> +		if ((d_clk % 1000) == 666)
>> +			d_clk++;
>> 		p_clk = d_clk * bits / 8;
>> 		if ((p_clk % 100) >= 50)
>> 			p_clk += 50;

 	If you're going to do that then it really should be generalised

 	d_clk = d_clk * 2 / cycle_time;
 	if (d_clk & 1)
 	        d_clk = d_clk / 2 + 1;
 	else
 	        d_clk /= 2;

 	Though this introduces the risk of overflow for very large values
 	of d_clk...

-- 
 		David/absolute       -- www.NetBSD.org: No hype required --