<div dir="ltr">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.<div>

<br></div><div>Alternately, perhaps it would be sufficient to use strstr() to find "GodsonV2", "Loongson-2", and "Loongson-3"?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Thu, Jul 25, 2013 at 8:33 AM, Stefan Tauner <span dir="ltr"><<a href="mailto:stefan.tauner@student.tuwien.ac.at" target="_blank">stefan.tauner@student.tuwien.ac.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Also be less restrictive regarding Loongson 2, because these strings seem<br>
to be rather volatile:<br>
<a href="http://www.linux-mips.org/archives/linux-mips/2013-04/msg00179.html" target="_blank">http://www.linux-mips.org/archives/linux-mips/2013-04/msg00179.html</a><br>
<a href="http://www.loongson.cn/dev/gitweb/?p=linux-loongson-all;a=history;f=arch/mips/kernel/cpu-probe.c" target="_blank">http://www.loongson.cn/dev/gitweb/?p=linux-loongson-all;a=history;f=arch/mips/kernel/cpu-probe.c</a><br>


<br>
Signed-off-by: Stefan Tauner <<a href="mailto:stefan.tauner@student.tuwien.ac.at">stefan.tauner@student.tuwien.ac.at</a>><br>
---<br>
<br>
Let's pretend I know what I am doing here... if I read the chinese<br>
data sheets correctly then Loongson-3B has moved to use SPI primarily<br>
for its firmware but there is always a chipset attached too...<br>
In any case I would rather not touch it yet. 3A OTOH seems to be<br>
more similar to Loongson-2 so this might actually work.<br>
<br>
This patch applies w/o conflicts to r1565 and later.<br>
<br>
 processor_enable.c | 5 +++--<br>
 1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/processor_enable.c b/processor_enable.c<br>
index 1361dd5..92c6b18 100644<br>
--- a/processor_enable.c<br>
+++ b/processor_enable.c<br>
@@ -58,8 +58,9 @@ static int is_loongson(void)<br>
                while (*ptr && isspace((unsigned char)*ptr))<br>
                        ptr++;<br>
                fclose(cpuinfo);<br>
-               return (strncmp(ptr, "ICT Loongson-2 V0.3", strlen("ICT Loongson-2 V0.3")) == 0) ||<br>
-                      (strncmp(ptr, "Godson2 V0.3  FPU V0.1", strlen("Godson2 V0.3  FPU V0.1")) == 0);<br>
+               return (strncmp(ptr, "ICT Loongson-2", strlen("ICT Loongson-2")) == 0) ||<br>
+                      (strncmp(ptr, "Godson2 V0.3  FPU V0.1", strlen("Godson2 V0.3  FPU V0.1")) == 0) ||<br>
+                      (strncmp(ptr, "ICT Loongson-3A", strlen("ICT Loongson-3A")) == 0);<br>
        }<br>
        fclose(cpuinfo);<br>
        return 0;<br>
<span class="HOEnZb"><font color="#888888">--<br>
Kind regards, Stefan Tauner<br>
<br>
<br>
_______________________________________________<br>
flashrom mailing list<br>
<a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a><br>
<a href="http://www.flashrom.org/mailman/listinfo/flashrom" target="_blank">http://www.flashrom.org/mailman/listinfo/flashrom</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.
</div>