From: Rahul Pathak Date: Thu, 2 Feb 2023 04:44:27 +0000 (+0530) Subject: include: types: Add typedefs for endianness X-Git-Tag: accepted/tizen/unified/riscv/20231123.095152~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b224ddb41fe1f9cbdfb246ebf22036ae1fe3f40f;p=platform%2Fkernel%2Fopensbi.git include: types: Add typedefs for endianness If any variable/memory-location follows certain endianness then its important to annotate it properly so that proper conversion can be done before read/write from that variable/memory. Also, use these new typedefs in libfdt_env.h for deriving its own custom fdtX_t types Signed-off-by: Rahul Pathak Reviewed-by: Anup Patel --- diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h index 9c1fef3..def88bb 100644 --- a/include/sbi/sbi_types.h +++ b/include/sbi/sbi_types.h @@ -54,6 +54,13 @@ typedef unsigned long virtual_size_t; typedef unsigned long physical_addr_t; typedef unsigned long physical_size_t; +typedef uint16_t le16_t; +typedef uint16_t be16_t; +typedef uint32_t le32_t; +typedef uint32_t be32_t; +typedef uint64_t le64_t; +typedef uint64_t be64_t; + #define true 1 #define false 0 diff --git a/lib/utils/libfdt/libfdt_env.h b/lib/utils/libfdt/libfdt_env.h index e5ad769..6ebbae0 100644 --- a/lib/utils/libfdt/libfdt_env.h +++ b/lib/utils/libfdt/libfdt_env.h @@ -38,9 +38,9 @@ #define strlen sbi_strlen #define strnlen sbi_strnlen -typedef uint16_t FDT_BITWISE fdt16_t; -typedef uint32_t FDT_BITWISE fdt32_t; -typedef uint64_t FDT_BITWISE fdt64_t; +typedef be16_t FDT_BITWISE fdt16_t; +typedef be32_t FDT_BITWISE fdt32_t; +typedef be64_t FDT_BITWISE fdt64_t; static inline uint16_t fdt16_to_cpu(fdt16_t x) {