> +static int __init htab_dt_scan_seg_sizes(unsigned long node,
> +                                      const char *uname, int depth,
> +                                      void *data)
> +{
> +     char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> +     u32 *prop;
> +     unsigned long size = 0;
> +
> +     /* We are scanning "cpu" nodes only */
> +     if (type == NULL || strcmp(type, "cpu") != 0)
> +             return 0;
> +
> +     prop = (u32 *)of_get_flat_dt_prop(node, "ibm,processor-segment-sizes",
> +                                       &size);
> +     if (prop != NULL && size >= 8) {
> +             if (prop[0] == 0x1c && prop[1] == 0x28) {
> +                     DBG("1T segment support detected\n");
> +                     cur_cpu_spec->cpu_features |= CPU_FTR_1T_SEGMENT;
> +             }

Shouldn't this iterate through the property prop and _only_ look for a
0x28 entry rather than assuming the first two are going to be 0x1c and
0x28?

Something like:
        prop = (u32 *)of_get_flat_dt_prop(node, "ibm,processor-segment-sizes",
                                          &size);
        if (prop != NULL) 
                for (i = 0; i < size/4; i++)
                        if (prop[1] == 0x28)
                                DBG("1T segment support detected\n");
                                cur_cpu_spec->cpu_features |=
                                          CPU_FTR_1T_SEGMENT;

Mikey
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to