Detecting XO-1.5 in kernel boot

Mitch Bradley wmb at laptop.org
Tue Sep 21 12:35:48 EDT 2010


On 9/21/2010 6:15 AM, Daniel Drake wrote:
> I'm working on XO-1.5 support upstream and would appreciate comments
> on the following:
>
>
>
> The very core "am I an XO?" check that runs during boot is this:
>
> http://lxr.free-electrons.com/source/arch/x86/kernel/olpc.c#L212
>
> It runs ioremap() on 0xffffffc0 and expects to read the OFW signature "CL1   Q"
>
> If we pass the check, we then go on to call into OFW to read the board
> revision, etc.
>
> We're talking upstream kernel here, so this would normally run on
> every kernel (i.e. all the distro kernels) that compile with OLPC
> support. According to comments in the file, the check is dangerous, so
> we cut down where it is run, bailing out early:
>
> 	/* The ioremap check is dangerous; limit what we run it on */
> 	if (!is_geode() || cs5535_has_vsa2())
> 		return 0;
>
>
> This needs an update for XO-1.5, where we want this code to run, but
> we aren't a geode or cs5535.
> How should we update the check?
>
> One idea: check the DMI info, look for the OLPC XO-1.5
> manufacturer/product codes.
>
> Others?

You could get all the information from the device tree, after having first checked for the presence of the device tree 
by looking for the relevant "files".  "/ofw/architecture", for example, contains "OLPC\0".  The "/ofw" may turn into 
"/proc/something" or something else once Andres finishes, so it's probably a good idea to bury that prefix in a 
subroutine somewhere.

> Thanks,
> Daniel



More information about the Devel mailing list