From 975b706a7bfe53b3f9e639ef5d61bd742235d696 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Thu, 9 Aug 2012 21:09:51 +0000 Subject: Simplify processor_enable.c Corresponding to flashrom svn r1565. Signed-off-by: Peter Lemenkov Acked-by: Stefan Tauner --- processor_enable.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'processor_enable.c') diff --git a/processor_enable.c b/processor_enable.c index d680f97c5..1361dd5a3 100644 --- a/processor_enable.c +++ b/processor_enable.c @@ -24,19 +24,6 @@ #include "flash.h" #include "programmer.h" -#if defined(__i386__) || defined(__x86_64__) - -int processor_flash_enable(void) -{ - /* On x86, flash access is not processor specific except on - * AMD Elan SC520, AMD Geode and maybe other SoC-style CPUs. - * FIXME: Move enable_flash_cs5536 and get_flashbase_sc520 here. - */ - return 0; -} - -#else - #if defined (__MIPSEL__) && defined (__linux) #include #include @@ -71,10 +58,8 @@ 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 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); } fclose(cpuinfo); return 0; @@ -83,15 +68,21 @@ static int is_loongson(void) int processor_flash_enable(void) { + /* Default to 1 to catch not implemented architectures. */ + int ret = 1; + /* FIXME: detect loongson on FreeBSD and OpenBSD as well. */ #if defined (__MIPSEL__) && defined (__linux) if (is_loongson()) { flashbase = 0x1fc00000; - return 0; + ret = 0; } +#elif defined(__i386__) || defined(__x86_64__) + /* On x86, flash access is not processor specific except on + * AMD Elan SC520, AMD Geode and maybe other SoC-style CPUs. + * FIXME: Move enable_flash_cs5536 and get_flashbase_sc520 here. + */ + ret = 0; #endif - /* Not implemented yet. Oh well. */ - return 1; + return ret; } - -#endif -- cgit v1.2.3