The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=0eaa57625d0fbe9960eabbaaedd522acdf673648
commit 0eaa57625d0fbe9960eabbaaedd522acdf673648 Author: Jean-Sébastien Pédron <[email protected]> AuthorDate: 2026-03-09 19:04:12 +0000 Commit: Jean-Sébastien Pédron <[email protected]> CommitDate: 2026-04-06 19:28:11 +0000 linuxkpi: Add <linux/ascii85.h> This is used by the i915 DRM driver for some time to log more details about a GPU error, but the code was commented out. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56282 --- sys/compat/linuxkpi/common/include/linux/ascii85.h | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/ascii85.h b/sys/compat/linuxkpi/common/include/linux/ascii85.h new file mode 100644 index 000000000000..06777a130e41 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/ascii85.h @@ -0,0 +1,46 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 The FreeBSD Foundation + */ + +#ifndef _LINUXKPI_LINUX_ASCII85_H_ +#define _LINUXKPI_LINUX_ASCII85_H_ + +#include <sys/param.h> + +#define ASCII85_BUFSZ 6 + +static inline long +ascii85_encode_len(long in_len) +{ + long out_len; + + out_len = howmany(in_len, 4); + + return (out_len); +} + +static inline const char * +ascii85_encode(uint32_t in, char *out) +{ + int i; + + if (in == 0) { + out[0] = 'z'; + out[1] = '\0'; + return (out); + } + + for (i = ASCII85_BUFSZ - 2; i >= 0; i--) { + out[i] = in % 85; + out[i] += 33; + + in /= 85; + } + out[ASCII85_BUFSZ - 1] = '\0'; + + return (out); +} + +#endif /* _LINUXKPI_LINUX_ASCII85_H_ */
