mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00

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>
64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
/*
|
|
* This file is part of the flashrom project.
|
|
*
|
|
* Copyright (C) 2011 Carl-Daniel Hailfinger
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
/*
|
|
* Header file for OS checking.
|
|
*/
|
|
|
|
#include "platform.h"
|
|
|
|
// Solaris
|
|
#if defined (__sun) && (defined(__i386) || defined(__amd64))
|
|
#define __FLASHROM_OS__ "SunOS"
|
|
// OS X
|
|
#elif defined(__MACH__) && defined(__APPLE__)
|
|
#define __FLASHROM_OS__ "Darwin"
|
|
// FreeBSD
|
|
#elif defined(__FreeBSD__)
|
|
#define __FLASHROM_OS__ "FreeBSD"
|
|
// FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD)
|
|
#elif defined(__FreeBSD_kernel__) && defined(__GLIBC__)
|
|
#define __FLASHROM_OS__ "FreeBSD-glibc"
|
|
// DragonFlyBSD
|
|
#elif defined(__DragonFly__)
|
|
#define __FLASHROM_OS__ "DragonFlyBSD"
|
|
// NetBSD
|
|
#elif defined(__NetBSD__)
|
|
#define __FLASHROM_OS__ "NetBSD"
|
|
// OpenBSD
|
|
#elif defined(__OpenBSD__)
|
|
#define __FLASHROM_OS__ "OpenBSD"
|
|
// DJGPP
|
|
#elif defined(__DJGPP__)
|
|
#define __FLASHROM_OS__ "DOS"
|
|
// MinGW (always has _WIN32 available)
|
|
#elif defined(__MINGW32__)
|
|
#define __FLASHROM_OS__ "MinGW"
|
|
// Cygwin (usually without _WIN32)
|
|
#elif defined( __CYGWIN__)
|
|
#define __FLASHROM_OS__ "Cygwin"
|
|
// libpayload
|
|
#elif defined(__LIBPAYLOAD__)
|
|
#define __FLASHROM_OS__ "libpayload"
|
|
// Linux
|
|
#elif defined(__linux__)
|
|
#define __FLASHROM_OS__ "Linux"
|
|
#endif
|
|
__FLASHROM_OS__
|