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.
175 lines
5.4 KiB
C
175 lines
5.4 KiB
C
/* linuxu: SHIM (third_party/linux/include/linux/seq_file.h)
|
|
* struct seq_file / seq_operations and the record API follow the pinned
|
|
* header; the implementation is linuxu/src/shims/seq_file.c (pinned
|
|
* fs/seq_file.c logic). Path, escape, namespace and RCU-hlist helpers are
|
|
* not provided. seq_puts() is out of line instead of a constant-folding
|
|
* inline. */
|
|
#ifndef __LINUX_SEQ_FILE_H
|
|
#define __LINUX_SEQ_FILE_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/err.h>
|
|
#include <linux/bug.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/list.h>
|
|
#include <linux/string_helpers.h>
|
|
#include <stdarg.h>
|
|
|
|
struct seq_operations;
|
|
|
|
struct seq_file {
|
|
char *buf;
|
|
size_t size;
|
|
size_t from;
|
|
size_t count;
|
|
size_t pad_until;
|
|
loff_t index;
|
|
loff_t read_pos;
|
|
struct mutex lock;
|
|
const struct seq_operations *op;
|
|
int poll_event;
|
|
const struct file *file;
|
|
void *private;
|
|
};
|
|
|
|
struct seq_operations {
|
|
void * (*start) (struct seq_file *m, loff_t *pos);
|
|
void (*stop) (struct seq_file *m, void *v);
|
|
void * (*next) (struct seq_file *m, void *v, loff_t *pos);
|
|
int (*show) (struct seq_file *m, void *v);
|
|
};
|
|
|
|
#define SEQ_SKIP 1
|
|
|
|
/* No Linux user namespace is associated with a DriverKit debug stream. */
|
|
struct user_namespace;
|
|
static inline struct user_namespace *seq_user_ns(struct seq_file *m)
|
|
{
|
|
(void)m;
|
|
return NULL;
|
|
}
|
|
|
|
static inline bool seq_has_overflowed(struct seq_file *m)
|
|
{
|
|
return m->count == m->size;
|
|
}
|
|
|
|
static inline size_t seq_get_buf(struct seq_file *m, char **bufp)
|
|
{
|
|
BUG_ON(m->count > m->size);
|
|
if (m->count < m->size)
|
|
*bufp = m->buf + m->count;
|
|
else
|
|
*bufp = NULL;
|
|
|
|
return m->size - m->count;
|
|
}
|
|
|
|
static inline void seq_commit(struct seq_file *m, int num)
|
|
{
|
|
if (num < 0) {
|
|
m->count = m->size;
|
|
} else {
|
|
BUG_ON(m->count + num > m->size);
|
|
m->count += num;
|
|
}
|
|
}
|
|
|
|
static inline void seq_setwidth(struct seq_file *m, size_t size)
|
|
{
|
|
m->pad_until = m->count + size;
|
|
}
|
|
void seq_pad(struct seq_file *m, char c);
|
|
|
|
int seq_open(struct file *, const struct seq_operations *);
|
|
ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
|
|
/* linuxu: seq_read() into a kernel buffer for in-process debugfs readers
|
|
* (copy_to_user() rejects every copy in this process). */
|
|
ssize_t linuxu_seq_read_kernel(struct file *, char *, size_t, loff_t *);
|
|
loff_t seq_lseek(struct file *, loff_t, int);
|
|
int seq_release(struct inode *, struct file *);
|
|
int seq_write(struct seq_file *seq, const void *data, size_t len);
|
|
|
|
__printf(2, 0)
|
|
void seq_vprintf(struct seq_file *m, const char *fmt, va_list args);
|
|
__printf(2, 3)
|
|
void seq_printf(struct seq_file *m, const char *fmt, ...);
|
|
void seq_putc(struct seq_file *m, char c);
|
|
void __seq_puts(struct seq_file *m, const char *s);
|
|
void seq_puts(struct seq_file *m, const char *s);
|
|
|
|
void seq_put_decimal_ull_width(struct seq_file *m, const char *delimiter,
|
|
unsigned long long num, unsigned int width);
|
|
void seq_put_decimal_ull(struct seq_file *m, const char *delimiter,
|
|
unsigned long long num);
|
|
void seq_put_decimal_ll(struct seq_file *m, const char *delimiter, long long num);
|
|
void seq_put_hex_ll(struct seq_file *m, const char *delimiter,
|
|
unsigned long long v, unsigned int width);
|
|
|
|
void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
|
|
int rowsize, int groupsize, const void *buf, size_t len,
|
|
bool ascii);
|
|
|
|
void *single_start(struct seq_file *, loff_t *);
|
|
int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
|
|
int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);
|
|
int single_release(struct inode *, struct file *);
|
|
void *__seq_open_private(struct file *, const struct seq_operations *, int);
|
|
int seq_open_private(struct file *, const struct seq_operations *, int);
|
|
int seq_release_private(struct inode *, struct file *);
|
|
|
|
#define DEFINE_SEQ_ATTRIBUTE(__name) \
|
|
static int __name ## _open(struct inode *inode, struct file *file) \
|
|
{ \
|
|
int ret = seq_open(file, &__name ## _sops); \
|
|
if (!ret && inode->i_private) { \
|
|
struct seq_file *seq_f = file->private_data; \
|
|
seq_f->private = inode->i_private; \
|
|
} \
|
|
return ret; \
|
|
} \
|
|
\
|
|
static const struct file_operations __name ## _fops = { \
|
|
.open = __name ## _open, \
|
|
.read = seq_read, \
|
|
.llseek = seq_lseek, \
|
|
.release = seq_release, \
|
|
}
|
|
|
|
#define DEFINE_SHOW_ATTRIBUTE(__name) \
|
|
static int __name ## _open(struct inode *inode, struct file *file) \
|
|
{ \
|
|
return single_open(file, __name ## _show, inode->i_private); \
|
|
} \
|
|
\
|
|
static const struct file_operations __name ## _fops = { \
|
|
.open = __name ## _open, \
|
|
.read = seq_read, \
|
|
.llseek = seq_lseek, \
|
|
.release = single_release, \
|
|
}
|
|
|
|
#define DEFINE_SHOW_STORE_ATTRIBUTE(__name) \
|
|
static int __name ## _open(struct inode *inode, struct file *file) \
|
|
{ \
|
|
return single_open(file, __name ## _show, inode->i_private); \
|
|
} \
|
|
\
|
|
static const struct file_operations __name ## _fops = { \
|
|
.open = __name ## _open, \
|
|
.read = seq_read, \
|
|
.write = __name ## _write, \
|
|
.llseek = seq_lseek, \
|
|
.release = single_release, \
|
|
}
|
|
|
|
#define SEQ_START_TOKEN ((void *)1)
|
|
|
|
extern struct list_head *seq_list_start(struct list_head *head, loff_t pos);
|
|
extern struct list_head *seq_list_start_head(struct list_head *head, loff_t pos);
|
|
extern struct list_head *seq_list_next(void *v, struct list_head *head,
|
|
loff_t *ppos);
|
|
|
|
#endif /* __LINUX_SEQ_FILE_H */
|