mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
This adds the following commits from upstream: a26ef6400bd8 Restore phandle references from __fixups__ node 05c524db44ff Restore phandle references from __local_fixups__ node db65a3a3f4f0 Restore labels from __symbols__ node 64330c682cac Improve type guessing when compiling to dts format cbb48690c697 Set DTSF_PLUGIN if needed when compiling from dtb ef3b1baf6370 Emit /plugin/ when compiling to .dts with DTSF_PLUGIN set 7c78c8542d73 Added empty node name check 14dd76b96732 fdtdump: Change FDT_PROP prob handling to ease future addition 9a1c801a1a3c Fix discarded const qualifiers 194ac9422ac9 libfdt: fdt_get_name: Add can_assume(VALID_DTB) check 39cae0bd0031 libfdt: Improve size savings in FDT_RO_PROBE slightly b12692473298 libfdt: libfdt_internal.h correct final comment in ASSUME block 7f3184a6c550 libfdt: Remove old MacOS strnlen workaround 9197f1ccd95c checks: Do not check overlays for alias paths e1284ee5dc20 livetree: Add only new data to fixup nodes instead of complete regeneration cba90ce82064 checks: Remove check for graph child addresses 763c6ab4189c livetree: Simplify append_to_property() 739403f22242 libfdt: Drop including string.h from libfdt_internal.h 1c6c51e51b29 Consider drive letters when checking for absolute paths on Windows. 617f3d9b60f7 ci: Add Cirrus CI configuration for FreeBSD testing 04f948e83fef ci: Add GitLab CI configuration for Linux builds e89680263137 ci: Tweaks to GitHub Actions setup 2ad738722b79 build: Add FreeBSD and non-GNU linker compatibility 4132ac08ba95 libfdt: Document most remaining functions 33e66ec845b8 tests: Add compatibility with uutils a0dd7b608102 fdtput: Use strtol() in preference to sscanf() 5b71660724d7 tests: Work around limitation in FreeBSD's printf(1) The graph_child_address check has been removed from upstream. Drop it from the makefiles. Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
|
|
#ifndef LIBFDT_ENV_H
|
|
#define LIBFDT_ENV_H
|
|
/*
|
|
* libfdt - Flat Device Tree manipulation
|
|
* Copyright (C) 2006 David Gibson, IBM Corporation.
|
|
* Copyright 2012 Kim Phillips, Freescale Semiconductor.
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <limits.h>
|
|
|
|
#ifdef __CHECKER__
|
|
#define FDT_FORCE __attribute__((force))
|
|
#define FDT_BITWISE __attribute__((bitwise))
|
|
#else
|
|
#define FDT_FORCE
|
|
#define FDT_BITWISE
|
|
#endif
|
|
|
|
typedef uint16_t FDT_BITWISE fdt16_t;
|
|
typedef uint32_t FDT_BITWISE fdt32_t;
|
|
typedef uint64_t FDT_BITWISE fdt64_t;
|
|
|
|
#define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n])
|
|
#define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))
|
|
#define CPU_TO_FDT32(x) ((EXTRACT_BYTE(x, 0) << 24) | (EXTRACT_BYTE(x, 1) << 16) | \
|
|
(EXTRACT_BYTE(x, 2) << 8) | EXTRACT_BYTE(x, 3))
|
|
#define CPU_TO_FDT64(x) ((EXTRACT_BYTE(x, 0) << 56) | (EXTRACT_BYTE(x, 1) << 48) | \
|
|
(EXTRACT_BYTE(x, 2) << 40) | (EXTRACT_BYTE(x, 3) << 32) | \
|
|
(EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 16) | \
|
|
(EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7))
|
|
|
|
static inline uint16_t fdt16_to_cpu(fdt16_t x)
|
|
{
|
|
return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
|
|
}
|
|
static inline fdt16_t cpu_to_fdt16(uint16_t x)
|
|
{
|
|
return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x);
|
|
}
|
|
|
|
static inline uint32_t fdt32_to_cpu(fdt32_t x)
|
|
{
|
|
return (FDT_FORCE uint32_t)CPU_TO_FDT32(x);
|
|
}
|
|
static inline fdt32_t cpu_to_fdt32(uint32_t x)
|
|
{
|
|
return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x);
|
|
}
|
|
|
|
static inline uint64_t fdt64_to_cpu(fdt64_t x)
|
|
{
|
|
return (FDT_FORCE uint64_t)CPU_TO_FDT64(x);
|
|
}
|
|
static inline fdt64_t cpu_to_fdt64(uint64_t x)
|
|
{
|
|
return (FDT_FORCE fdt64_t)CPU_TO_FDT64(x);
|
|
}
|
|
#undef CPU_TO_FDT64
|
|
#undef CPU_TO_FDT32
|
|
#undef CPU_TO_FDT16
|
|
#undef EXTRACT_BYTE
|
|
|
|
#endif /* LIBFDT_ENV_H */
|