dc68054305
- Restore 29 recipe symlinks (libdrm, qtbase, dbus, sddm, pipewire, etc.) - Restore 33 patches (KDE, libdrm, mesa, pipewire, sddm, wireplumber) - Restore 20+ local/scripts (audit, lint, test, build helpers) - Restore src/cook/scheduler.rs, status.rs, gnu-config/ - Restore scripts/patch-inclusion-gate.sh, run_mini1.sh, validate-collision-log.sh - Recover TLC source from HEAD (was overwritten by 0.2.3 checkout) - Recover 11 local/docs plans from HEAD (were overwritten) - Recover qt6-wayland-smoke symlink from HEAD - Fix MOTD: remove garbled ASCII art, use clean text - Update version: 0.2.0 -> 0.2.4 in os-release, motd, config - Reduce filesystem_size: 1536 -> 512 MiB - Add ABSOLUTE RULE to AGENTS.md: never delete/ignore packages - Reduce pcid scheme log verbosity: info -> debug
40 lines
1.5 KiB
C
40 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
|
|
*/
|
|
|
|
#include <asm/byteorder.h>
|
|
|
|
#define CFI_HOST_ENDIAN 1
|
|
#define CFI_LITTLE_ENDIAN 2
|
|
#define CFI_BIG_ENDIAN 3
|
|
|
|
#if !defined(CONFIG_MTD_CFI_ADV_OPTIONS) || defined(CONFIG_MTD_CFI_NOSWAP)
|
|
#define CFI_DEFAULT_ENDIAN CFI_HOST_ENDIAN
|
|
#elif defined(CONFIG_MTD_CFI_LE_BYTE_SWAP)
|
|
#define CFI_DEFAULT_ENDIAN CFI_LITTLE_ENDIAN
|
|
#elif defined(CONFIG_MTD_CFI_BE_BYTE_SWAP)
|
|
#define CFI_DEFAULT_ENDIAN CFI_BIG_ENDIAN
|
|
#else
|
|
#error No CFI endianness defined
|
|
#endif
|
|
|
|
#define cfi_default(s) ((s)?:CFI_DEFAULT_ENDIAN)
|
|
#define cfi_be(s) (cfi_default(s) == CFI_BIG_ENDIAN)
|
|
#define cfi_le(s) (cfi_default(s) == CFI_LITTLE_ENDIAN)
|
|
#define cfi_host(s) (cfi_default(s) == CFI_HOST_ENDIAN)
|
|
|
|
#define cpu_to_cfi8(map, x) (x)
|
|
#define cfi8_to_cpu(map, x) (x)
|
|
#define cpu_to_cfi16(map, x) _cpu_to_cfi(16, (map)->swap, (x))
|
|
#define cpu_to_cfi32(map, x) _cpu_to_cfi(32, (map)->swap, (x))
|
|
#define cpu_to_cfi64(map, x) _cpu_to_cfi(64, (map)->swap, (x))
|
|
#define cfi16_to_cpu(map, x) _cfi_to_cpu(16, (map)->swap, (x))
|
|
#define cfi32_to_cpu(map, x) _cfi_to_cpu(32, (map)->swap, (x))
|
|
#define cfi64_to_cpu(map, x) _cfi_to_cpu(64, (map)->swap, (x))
|
|
|
|
#define _cpu_to_cfi(w, s, x) (cfi_host(s)?(x):_swap_to_cfi(w, s, x))
|
|
#define _cfi_to_cpu(w, s, x) (cfi_host(s)?(x):_swap_to_cpu(w, s, x))
|
|
#define _swap_to_cfi(w, s, x) (cfi_be(s)?cpu_to_be##w(x):cpu_to_le##w(x))
|
|
#define _swap_to_cpu(w, s, x) (cfi_be(s)?be##w##_to_cpu(x):le##w##_to_cpu(x))
|