Unify target OS and CPU architecture checks

We do CPU architecture checks once for the makefile in arch.h and
once for HW access abstraction in hwaccess.c. This patch unifies
related files so that they can share the checks to improve
maintainability and reduce the chance of inconsistencies.
Furthermore, it refines some of the definitions, which
 - adds "support" for AARCH64 and PPC64,
 - adds big-endian handling on arm as well as LE handling on PPC64,
 - fixes compilation of internal.c on AARCH64 and PPC64.

Additionally, this patch continues to unify all OS checks in
flashrom by adding a new helper macro IS_WINDOWS.

The old header file for architecture checking is renamed to platform.h
to reflect its broader scope and all new macros are add in there.

Corresponding to flashrom svn r1864.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
diff --git a/hwaccess.c b/hwaccess.c
index 5b18c32..c90490b 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -18,19 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#define IS_X86	(defined(__i386__) || defined(__x86_64__) || defined(__amd64__))
-#define IS_MIPS	(defined (__mips) || defined (__mips__) || defined (__MIPS__) || defined (mips))
-#define IS_PPC	(defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__))
-#define IS_ARM	(defined (__arm__) || defined (_ARM))
-#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM)
-#error Unknown architecture
-#endif
-
-#define IS_LINUX	(defined(__gnu_linux__) || defined(__linux__))
-#define IS_MACOSX	(defined(__APPLE__) && defined(__MACH__))
-#if !(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__DJGPP__) || defined(__LIBPAYLOAD__) || defined(__sun))
-#error "Unknown operating system"
-#endif
+#include "platform.h"
 
 #include <stdint.h>
 #include <string.h>
@@ -45,6 +33,10 @@
 #include "flash.h"
 #include "hwaccess.h"
 
+#if !(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__DJGPP__) || defined(__LIBPAYLOAD__) || defined(__sun))
+#error "Unknown operating system"
+#endif
+
 #define USE_IOPL	(IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__))
 #define USE_DEV_IO	(defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__))
 
@@ -62,7 +54,7 @@
  * - MIPS uses uncached accesses in mode 2 on /dev/mem which has also a strongly ordered memory model
  * - ARM uses a strongly ordered memory model for device memories.
  */
-#if IS_PPC
+#if IS_PPC // cf. http://lxr.free-electrons.com/source/arch/powerpc/include/asm/barrier.h
 	asm("eieio" : : : "memory");
 #endif
 }