[flashrom] [PATCH] Add support for Loongson-3A.

David Hendricks dhendrix at google.com
Fri Jul 26 21:47:39 CEST 2013


Hmmm, that return statement seems to be getting rather unwieldy especially
since we can probably expect a lot more variants. Maybe you can take this
opportunity to re-factor the code a bit, make a table of known strings, and
use a loop instead? You could also annotate the table entries to indicate
whether the processor is known-working and print a warning if not.

Alternately, perhaps it would be sufficient to use strstr() to find
"GodsonV2", "Loongson-2", and "Loongson-3"?


On Thu, Jul 25, 2013 at 8:33 AM, Stefan Tauner <
stefan.tauner at student.tuwien.ac.at> wrote:

> Also be less restrictive regarding Loongson 2, because these strings seem
> to be rather volatile:
> http://www.linux-mips.org/archives/linux-mips/2013-04/msg00179.html
>
> http://www.loongson.cn/dev/gitweb/?p=linux-loongson-all;a=history;f=arch/mips/kernel/cpu-probe.c
>
> Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
> ---
>
> Let's pretend I know what I am doing here... if I read the chinese
> data sheets correctly then Loongson-3B has moved to use SPI primarily
> for its firmware but there is always a chipset attached too...
> In any case I would rather not touch it yet. 3A OTOH seems to be
> more similar to Loongson-2 so this might actually work.
>
> This patch applies w/o conflicts to r1565 and later.
>
>  processor_enable.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/processor_enable.c b/processor_enable.c
> index 1361dd5..92c6b18 100644
> --- a/processor_enable.c
> +++ b/processor_enable.c
> @@ -58,8 +58,9 @@ static int is_loongson(void)
>                 while (*ptr && isspace((unsigned char)*ptr))
>                         ptr++;
>                 fclose(cpuinfo);
> -               return (strncmp(ptr, "ICT Loongson-2 V0.3", strlen("ICT
> Loongson-2 V0.3")) == 0) ||
> -                      (strncmp(ptr, "Godson2 V0.3  FPU V0.1",
> strlen("Godson2 V0.3  FPU V0.1")) == 0);
> +               return (strncmp(ptr, "ICT Loongson-2", strlen("ICT
> Loongson-2")) == 0) ||
> +                      (strncmp(ptr, "Godson2 V0.3  FPU V0.1",
> strlen("Godson2 V0.3  FPU V0.1")) == 0) ||
> +                      (strncmp(ptr, "ICT Loongson-3A", strlen("ICT
> Loongson-3A")) == 0);
>         }
>         fclose(cpuinfo);
>         return 0;
> --
> Kind regards, Stefan Tauner
>
>
> _______________________________________________
> flashrom mailing list
> flashrom at flashrom.org
> http://www.flashrom.org/mailman/listinfo/flashrom
>



-- 
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20130726/ad69b666/attachment.html>


More information about the flashrom mailing list