mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
Vendor the upstream display headers verbatim (drm/display/ DP, MST, dual-mode, DSC, HDCP, HDMI, SCDC; drm_crtc_helper.h, drm_probe_helper.h, drm_modeset_helper.h, drm_modeset_helper_vtables.h, drm_bridge_helper.h, drm_audio_component.h, acpi/video.h, linux/average.h, linux/iopoll.h, media/cec-notifier.h and the uapi linux/cec.h). The trimmed DP/MST helper headers and the inline display stubs they carried give way to the upstream declarations, now that the upstream helpers are built. media/cec.h keeps only the upstream CONFIG_CEC_CORE=n API. Smaller upstream pieces the display code reaches: fsleep()/ssleep() and TICK_NSEC, noinline/noinline_for_stack, the in-place byteorder helpers (kernel.h includes asm/byteorder.h as upstream does), the DIV64_U64_ROUND_* family, the !CONFIG_ACPI companion helpers, guid_t through mod_devicetable.h, str_*() through kernel.h/seq_file.h, and the workqueue disable/current_work declarations. The drm_simple_encoder_init() stub is removed: drm_simple_kms_helper.c provides it, as drm_dp_helper.c and drm_panel_orientation_quirks.c now provide what linuxu/src/drm/dp_helper.c carried.
82 lines
3.4 KiB
C
82 lines
3.4 KiB
C
/* linuxu: SHIM (asm/byteorder.h — the unconditional <asm/byteorder.h>
|
|
* include in third_party/linux/drivers/gpu/drm/amd/display/dc/os_types.h and dmub_cmd.h).
|
|
* Self-contained: defines cpu_to_le32 & friends as LE-identity. The
|
|
* upstream arm64 variant just forwards to
|
|
* <linux/byteorder/little_endian.h>, which is not part of the 5-spike
|
|
* closure; to keep this header standalone (and not depend on the
|
|
* linux/ chunk providing that file), the macros live here.
|
|
* NOTE: <linux/types.h> must be included before this header (it is,
|
|
* via <linux/types.h> in every translation unit that reaches this). */
|
|
#include <linux/types.h>
|
|
|
|
#ifndef __ASM_BYTEORDER_H
|
|
#define __ASM_BYTEORDER_H
|
|
|
|
/* Little-endian identity conversions (Apple Silicon is LE). */
|
|
static inline u8 __cpu_to_le8(u8 x) { return x; }
|
|
static inline u16 __cpu_to_le16(u16 x) { return x; }
|
|
static inline u32 __cpu_to_le32(u32 x) { return x; }
|
|
static inline u64 __cpu_to_le64(u64 x) { return x; }
|
|
|
|
static inline u8 __le8_to_cpu(u8 x) { return x; }
|
|
static inline u16 __le16_to_cpu(u16 x) { return x; }
|
|
static inline u32 __le32_to_cpu(u32 x) { return x; }
|
|
static inline u64 __le64_to_cpu(u64 x) { return x; }
|
|
|
|
/* Big-endian conversions (LE host -> BE). */
|
|
static inline u16 __cpu_to_be16(u16 x)
|
|
{
|
|
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
return __builtin_bswap16(x);
|
|
#else
|
|
return x;
|
|
#endif
|
|
}
|
|
static inline u32 __cpu_to_be32(u32 x)
|
|
{
|
|
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
return __builtin_bswap32(x);
|
|
#else
|
|
return x;
|
|
#endif
|
|
}
|
|
static inline u64 __cpu_to_be64(u64 x)
|
|
{
|
|
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
return __builtin_bswap64(x);
|
|
#else
|
|
return x;
|
|
#endif
|
|
}
|
|
static inline u16 __be16_to_cpu(u16 x) { return __cpu_to_be16(x); }
|
|
static inline u32 __be32_to_cpu(u32 x) { return __cpu_to_be32(x); }
|
|
static inline u64 __be64_to_cpu(u64 x) { return __cpu_to_be64(x); }
|
|
|
|
#define cpu_to_le8(x) ((__le8) __cpu_to_le8(x))
|
|
#define cpu_to_le16(x) ((__le16) __cpu_to_le16(x))
|
|
#define cpu_to_le32(x) ((__le32) __cpu_to_le32(x))
|
|
#define cpu_to_le64(x) ((__le64) __cpu_to_le64(x))
|
|
#define le8_to_cpu(x) ((__u8) __le8_to_cpu((__le8) (x)))
|
|
#define le16_to_cpu(x) ((__u16) __le16_to_cpu((__le16) (x)))
|
|
#define le32_to_cpu(x) ((__u32) __le32_to_cpu((__le32) (x)))
|
|
#define le64_to_cpu(x) ((__u64) __le64_to_cpu((__le64) (x)))
|
|
|
|
#define cpu_to_be8(x) ((x))
|
|
#define cpu_to_be16(x) ((__be16) __cpu_to_be16(x))
|
|
#define cpu_to_be32(x) ((__be32) __cpu_to_be32(x))
|
|
#define cpu_to_be64(x) ((__be64) __cpu_to_be64(x))
|
|
#define be8_to_cpu(x) ((x))
|
|
#define be16_to_cpu(x) ((__u16) __be16_to_cpu((__be16) (x)))
|
|
#define be32_to_cpu(x) ((__u32) __be32_to_cpu((__be32) (x)))
|
|
#define be64_to_cpu(x) ((__u64) __be64_to_cpu((__be64) (x)))
|
|
|
|
/* linux/byteorder/generic.h in-place helpers. */
|
|
static inline void le16_add_cpu(__le16 *var, u16 val) { *var = cpu_to_le16(le16_to_cpu(*var) + val); }
|
|
static inline void le32_add_cpu(__le32 *var, u32 val) { *var = cpu_to_le32(le32_to_cpu(*var) + val); }
|
|
static inline void le64_add_cpu(__le64 *var, u64 val) { *var = cpu_to_le64(le64_to_cpu(*var) + val); }
|
|
static inline void be16_add_cpu(__be16 *var, u16 val) { *var = cpu_to_be16(be16_to_cpu(*var) + val); }
|
|
static inline void be32_add_cpu(__be32 *var, u32 val) { *var = cpu_to_be32(be32_to_cpu(*var) + val); }
|
|
static inline void be64_add_cpu(__be64 *var, u64 val) { *var = cpu_to_be64(be64_to_cpu(*var) + val); }
|
|
|
|
#endif /* __ASM_BYTEORDER_H */
|