mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
- get_random_bytes()/get_random_u*() from the platform CSPRNG (arc4random_buf(), which DriverKit's libSystem also provides); DP MST uses it for sideband nonces. - lib/uuid.c built unmodified as a helper (guid_gen(), guid_null for DP MST branch GUIDs), with hex_to_bin()/hex2bin()/bin2hex() from lib/hexdump.c and the upstream linux/hex.h. - kstrtobool() and kstrtobool_from_user() from lib/kstrtox.c for the DC debugfs write handlers. - vzalloc() for the DML/DML2 work areas. - Upstream headers and helpers: linux/bitfield.h and linux/typecheck.h verbatim (kernel.h now uses the upstream typecheck()), the full linux/backlight.h and drm_privacy_screen_consumer.h (their !CONFIG inlines replace stray declarations), ffz(), might_sleep_if(), delayed_work_pending(), ARCH_KMALLOC_MINALIGN, linux/minmax.h, and linux/err.h from linux/dmi.h as the quirk tables need. ssleep() is the upstream inline now.
38 lines
1.0 KiB
C
38 lines
1.0 KiB
C
/* linuxu: AS-IS (third_party/linux/include/linux/hex.h) - vendored verbatim from
|
|
* the pinned tree; kernel-only includes resolve to linuxu shadows. */
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_HEX_H
|
|
#define _LINUX_HEX_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
extern const char hex_asc[];
|
|
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
|
|
#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
|
|
|
|
static inline char *hex_byte_pack(char *buf, u8 byte)
|
|
{
|
|
*buf++ = hex_asc_hi(byte);
|
|
*buf++ = hex_asc_lo(byte);
|
|
return buf;
|
|
}
|
|
|
|
extern const char hex_asc_upper[];
|
|
#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
|
|
#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
|
|
|
|
static inline char *hex_byte_pack_upper(char *buf, u8 byte)
|
|
{
|
|
*buf++ = hex_asc_upper_hi(byte);
|
|
*buf++ = hex_asc_upper_lo(byte);
|
|
return buf;
|
|
}
|
|
|
|
extern int hex_to_bin(unsigned char ch);
|
|
extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
|
|
extern char *bin2hex(char *dst, const void *src, size_t count);
|
|
|
|
bool mac_pton(const char *s, u8 *mac);
|
|
|
|
#endif
|