OF properties access ?
Sven Luther
sven.luther at wanadoo.fr
Mon Jan 19 01:51:58 EST 2004
On Sun, Jan 18, 2004 at 03:32:25PM +0100, Sven Luther wrote:
>
> On Mon, Jan 19, 2004 at 10:21:36AM +1100, Benjamin Herrenschmidt wrote:
> >
> > On Sun, 2004-01-18 at 23:07, Sven Luther wrote:
> > > On Sat, Jan 17, 2004 at 02:48:11PM +1100, Benjamin Herrenschmidt wrote:
> > > >
> > > > >
> > > > > But this doesn't reply me on why my attempts to read back integer values
> > > > > from OF property only result in the machine hanging, and since it is
> > > > > really early on, i don't even get serial console output to have an idea
> > > > > why :/
> > > > >
> > > > > in particular i cloned the code reading l2cr-value, and changed it to
> > > > > l2cr and instead of reading the value, i got only kernel silently dying.
> > > >
> > > > Show me the code and the relevant device-tree bits.
> > >
> > > Ok, here is the code that dies :
> > >
> > > void pegasos_set_l2cr(void) {
> >
> > Grrr... please put the { on a different line
>
> Ok. (altough i think this is a subject of philosophical debate :)
>
> > > struct device_node *root = find_path_device("/");
> > > char *machine;
> > > struct device_node *np;
> > >
> > > /* On Pegasos, enable the l2 cache if needed, as the OF forgets * it */
> >
> > Check if root isn't NULL...
>
Ok, the following version :
void pegasos_set_l2cr(void)
{
struct device_node *root = find_path_device("/");
char *machine;
struct device_node *np;
int l2cr_value;
/* On Pegasos, enable the l2 cache if needed, as the OF forgets * it */
if (root == NULL) return;
machine = get_property(root, "model", NULL);
if (machine == NULL) return;
if (strncmp(machine, "Pegasos", 7) == 0) {
/* Enable L2 cache if needed */
np = find_devices ("cpus");
if (np == NULL)
np = find_type_devices("cpu");
if (np != NULL) {
unsigned int *l2cr = (unsigned int *)
get_property (np, "l2cr", NULL);
if (l2cr == NULL) return;
l2cr_value = *l2cr;
if (!(l2cr_value & 0x80000000)) {
_set_L2CR(0);
_set_L2CR(l2cr_value | 0x80000000);
}
}
}
}
Does not die, but also does not seem to enable the l2cr thingy, but
then, i don't know how fiable the info from /proc/sys/kernel/l2cr is :
0x00000000: L2 disabled, no parity, no instn only, no data only,
default replacement
Friendly,
Sven Luther
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list