sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-18 08:29:14 +00:00
parent ee68147dcd
commit 1cefe29c7e
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
1651 changed files with 283292 additions and 68089 deletions

View file

@ -56,10 +56,12 @@ struct acpi_table_header;
#define ACPI_SUCCESS(x) ((x) == 0)
#define ACPI_FAILURE(x) ((x) != 0)
#define return_ACPI_STATUS(x) return(x)
#define AE_ERROR 1
#define AE_NOT_FOUND 2
#define AE_BAD_PARAMETER 3
#define AE_NOT_EXIST 4
acpi_status acpi_evaluate_object(acpi_handle, const char *,
struct acpi_object_list *, struct acpi_buffer *);

View file

@ -14,7 +14,9 @@ int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
resource_size_t size);
int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
bool primary, const char *name);
const char *name);
int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev);
int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
#else
@ -26,7 +28,12 @@ static inline int devm_aperture_acquire_for_platform_device(struct platform_devi
}
static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
bool primary, const char *name)
const char *name)
{
return 0;
}
static inline int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev)
{
return 0;
}
@ -39,7 +46,6 @@ static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev,
/**
* aperture_remove_all_conflicting_devices - remove all existing framebuffers
* @primary: also kick vga16fb if present; only relevant for VGA devices
* @name: a descriptive name of the requesting driver
*
* This function removes all graphics device drivers. Use this function on systems
@ -48,9 +54,9 @@ static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev,
* Returns:
* 0 on success, or a negative errno code otherwise
*/
static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name)
static inline int aperture_remove_all_conflicting_devices(const char *name)
{
return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name);
return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name);
}
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: atomic.h,v 1.22 2024/01/06 12:52:20 jsg Exp $ */
/* $OpenBSD: atomic.h,v 1.23 2024/01/16 23:38:13 jsg Exp $ */
/**
* \file drm_atomic.h
* Atomic operations used in the DRM which may or may not be provided by the OS.
@ -217,7 +217,7 @@ atomic64_add_return(int i, atomic64_t *v)
return val;
}
#define atomic64_inc_return(p) atomic64_add_return(p, 1)
#define atomic64_inc_return(p) atomic64_add_return(1, p)
static inline void
atomic64_sub(int i, atomic64_t *v)
@ -426,6 +426,7 @@ find_next_bit(const volatile void *p, int max, int b)
#define dma_rmb() __membar("dmb oshld")
#define dma_wmb() __membar("dmb oshst")
#define dma_mb() __membar("dmb osh")
#define smp_mb() __membar("dmb ish")
#elif defined(__arm__)
#define rmb() __membar("dsb sy")
#define wmb() __membar("dsb sy")
@ -440,6 +441,7 @@ find_next_bit(const volatile void *p, int max, int b)
#define mb() __membar("sync")
#define smp_rmb() __membar("lwsync")
#define smp_wmb() __membar("lwsync")
#define smp_mb() __membar("sync")
#elif defined(__powerpc__)
#define rmb() __membar("sync")
#define wmb() __membar("sync")
@ -482,4 +484,17 @@ find_next_bit(const volatile void *p, int max, int b)
#define smp_store_mb(x, v) do { x = v; mb(); } while (0)
#endif
#ifndef smp_store_release
#define smp_store_release(x, v) do { smp_mb(); WRITE_ONCE(*x, v); } while(0)
#endif
#ifndef smp_load_acquire
#define smp_load_acquire(x) \
({ \
__typeof(*x) _v = READ_ONCE(*x); \
smp_mb(); \
_v; \
})
#endif
#endif

View file

@ -25,6 +25,8 @@
#define noinline_for_stack __attribute__((__noinline__))
#define fallthrough do {} while (0)
#define __PASTE(x,y) __CONCAT(x,y)
#ifndef __user
#define __user
#endif

View file

@ -19,6 +19,7 @@ struct component_master_ops {
};
int component_add(struct device *, const struct component_ops *);
int component_add_typed(struct device *, const struct component_ops *, int);
#define component_del(a, b)
int component_bind_all(struct device *, void *);

View file

@ -6,5 +6,6 @@
#include <linux/kernel.h>
#include <linux/bitmap.h>
#include <linux/bug.h>
#include <linux/numa.h>
#endif

View file

@ -10,5 +10,9 @@ struct debugfs_regset32 {
#define debugfs_remove(a)
#define debugfs_create_dir(a, b) ERR_PTR(-ENOSYS)
#define debugfs_create_file(a, b, c, d, e) ERR_PTR(-ENOSYS)
#define debugfs_create_file_unsafe(a, b, c, d, e) ERR_PTR(-ENOSYS)
#define debugfs_create_bool(a, b, c, d)
#define DEFINE_DEBUGFS_ATTRIBUTE(a, b, c, d)
#endif

View file

@ -34,6 +34,12 @@ mdelay(unsigned long msecs)
#define drm_msleep(x) mdelay(x)
static inline void
fsleep(unsigned long usecs)
{
DELAY(usecs);
}
static inline unsigned int
msleep_interruptible(unsigned int msecs)
{

View file

@ -13,6 +13,7 @@
#include <linux/pm.h>
#include <linux/kobject.h>
#include <linux/ratelimit.h> /* dev_printk.h -> ratelimit.h */
#include <linux/module.h> /* via device/driver.h */
struct device_node;
@ -44,11 +45,17 @@ void dev_set_drvdata(struct device *, void *);
#define devm_kzalloc(x, y, z) kzalloc(y, z)
#define devm_kfree(x, y) kfree(y)
static inline int
devm_device_add_group(struct device *dev, const struct attribute_group *g)
{
return 0;
}
#define dev_warn(dev, fmt, arg...) \
printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_WARN(dev, fmt, arg...) \
printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
#define dev_WARN(dev, fmt, arg...) \
WARN(1, "drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_notice(dev, fmt, arg...) \
printf("drm:pid%d:%s *NOTICE* " fmt, curproc->p_p->ps_pid, \
@ -79,6 +86,9 @@ void dev_set_drvdata(struct device *, void *);
#define dev_warn_once(dev, fmt, arg...) \
printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_WARN_ONCE(dev, cond, fmt, arg...) \
WARN_ONCE(cond, "drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_err_once(dev, fmt, arg...) \
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)

View file

@ -0,0 +1,9 @@
/* Public domain. */
#ifndef _LINUX_DEVICE_BUS_H
#define _LINUX_DEVICE_BUS_H
#define bus_register_notifier(a, b) 0
#define bus_unregister_notifier(a, b) 0
#endif

View file

@ -41,6 +41,7 @@ struct dma_fence_ops {
bool (*signaled)(struct dma_fence *);
long (*wait)(struct dma_fence *, bool, long);
void (*release)(struct dma_fence *);
void (*set_deadline)(struct dma_fence *, ktime_t);
bool use_64bit_seqno;
};
@ -77,6 +78,7 @@ int dma_fence_add_callback(struct dma_fence *, struct dma_fence_cb *,
dma_fence_func_t);
bool dma_fence_remove_callback(struct dma_fence *, struct dma_fence_cb *);
bool dma_fence_is_container(struct dma_fence *);
void dma_fence_set_deadline(struct dma_fence *, ktime_t);
struct dma_fence *dma_fence_get_stub(void);
struct dma_fence *dma_fence_allocate_private_stub(ktime_t);

View file

@ -16,5 +16,7 @@
#define EMULTIHOP EIPSEC
#define EBADSLT EINVAL
#define ENOKEY ENOENT
#define EPROBE_DEFER EAGAIN
#define ENOLINK EIO
#endif

View file

@ -0,0 +1,21 @@
/* Public domain. */
#ifndef _LINUX_EVENTFD_H
#define _LINUX_EVENTFD_H
#include <sys/types.h>
struct eventfd_ctx {
};
static inline void
eventfd_signal(struct eventfd_ctx *c, uint64_t v)
{
}
static inline void
eventfd_ctx_put(struct eventfd_ctx *c)
{
}
#endif

View file

@ -31,8 +31,14 @@ struct fb_ops {
int (*fb_set_par)(struct fb_info *);
};
struct fb_fix_screeninfo {
paddr_t smem_start;
psize_t smem_len;
};
struct fb_info {
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
const struct fb_ops *fbops;
char *screen_buffer;
char *screen_base;
@ -65,6 +71,8 @@ struct fb_info {
#define FB_ROTATE_UD 2
#define FB_ROTATE_CCW 3
#define FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(a, b, c)
static inline struct fb_info *
framebuffer_alloc(size_t size, void *dev)
{

View file

@ -22,4 +22,6 @@ struct seq_file;
struct file_operations {
};
#define DEFINE_SIMPLE_ATTRIBUTE(a, b, c, d)
#endif

View file

@ -170,19 +170,19 @@ struct hdmi_avi_infoframe {
enum hdmi_infoframe_type type;
unsigned char version;
unsigned char length;
bool itc;
unsigned char pixel_repeat;
enum hdmi_colorspace colorspace;
enum hdmi_scan_mode scan_mode;
enum hdmi_colorimetry colorimetry;
enum hdmi_picture_aspect picture_aspect;
enum hdmi_active_aspect active_aspect;
bool itc;
enum hdmi_extended_colorimetry extended_colorimetry;
enum hdmi_quantization_range quantization_range;
enum hdmi_nups nups;
unsigned char video_code;
enum hdmi_ycc_quantization_range ycc_quantization_range;
enum hdmi_content_type content_type;
unsigned char pixel_repeat;
unsigned short top_bar;
unsigned short bottom_bar;
unsigned short left_bar;

View file

@ -19,7 +19,7 @@ resource_size(const struct resource *r)
}
#define DEFINE_RES_MEM(_start, _size) \
{ \
(struct resource) { \
.start = (_start), \
.end = (_start) + (_size) - 1, \
}

View file

@ -17,6 +17,8 @@
#include <linux/printk.h>
#include <linux/typecheck.h>
#include <linux/container_of.h>
#include <linux/stddef.h>
#include <linux/align.h>
#include <asm/byteorder.h>
#define swap(a, b) \
@ -61,9 +63,12 @@
#define min3(x, y, z) MIN(x, MIN(y, z))
#define max3(x, y, z) MAX(x, MAX(y, z))
#define min_not_zero(a, b) (a == 0) ? b : ((b == 0) ? a : min(a, b))
#define mult_frac(x, n, d) (((x) * (n)) / (d))
#define roundup2(x, y) (((x) + ((y) - 1)) & (~((__typeof(x))(y) - 1)))
#define rounddown2(x, y) ((x) & ~((__typeof(x))(y) - 1))
#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define round_down(x, y) (((x) / (y)) * (y)) /* y is power of two */
#define rounddown(x, y) (((x) / (y)) * (y)) /* arbitrary y */
@ -76,6 +81,7 @@
#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
#define PTR_ALIGN(x, y) ((__typeof(x))roundup2((unsigned long)(x), (y)))
#define ALIGN_DOWN(x, y) ((__typeof(x))rounddown2((unsigned long)(x), (y)))
static inline char *
kvasprintf(int flags, const char *fmt, va_list ap)
@ -151,4 +157,6 @@ _in_dbg_master(void)
#define CONCATENATE(x, y) __CONCAT(x, y)
#define PTR_IF(c, p) ((c) ? (p) : NULL)
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: list.h,v 1.7 2023/01/18 23:47:25 jsg Exp $ */
/* $OpenBSD: list.h,v 1.8 2024/01/16 23:38:13 jsg Exp $ */
/* drm_linux_list.h -- linux list functions for the BSDs.
* Created: Mon Apr 7 14:30:16 1999 by anholt@FreeBSD.org
*/
@ -300,6 +300,18 @@ list_splice_tail_init(struct list_head *list, struct list_head *head)
INIT_LIST_HEAD(list);
}
static inline size_t
list_count_nodes(struct list_head *head)
{
struct list_head *entry;
size_t n = 0;
list_for_each(entry, head)
n++;
return n;
}
void list_sort(void *, struct list_head *,
int (*)(void *, const struct list_head *, const struct list_head *));

View file

@ -0,0 +1,6 @@
/* Public domain. */
#ifndef _LINUX_MATH_H
#define _LINUX_MATH_H
#endif

View file

@ -0,0 +1,9 @@
/* Public domain. */
#ifndef _LINUX_MEMREMAP_H
#define _LINUX_MEMREMAP_H
struct dev_pagemap {
};
#endif

View file

@ -95,4 +95,10 @@ totalram_pages(void)
return uvmexp.npages;
}
static inline bool
want_init_on_free(void)
{
return false;
}
#endif

View file

@ -0,0 +1,9 @@
/* Public domain. */
#ifndef _LINUX_MMU_NOTIFIER_H
#define _LINUX_MMU_NOTIFIER_H
struct mmu_interval_notifier {
};
#endif

View file

@ -4,7 +4,9 @@
#define _LINUX_MMZONE_H
#include <linux/mm_types.h>
#include <linux/nodemask.h>
#define MAX_ORDER 11
#define pfn_to_nid(x) 0
#endif

View file

@ -0,0 +1,8 @@
/* Public domain. */
#ifndef _LINUX_NODEMASK_H
#define _LINUX_NODEMASK_H
#define num_possible_nodes() 1
#endif

View file

@ -0,0 +1,8 @@
/* Public domain. */
#ifndef _LINUX_NUMA_H
#define _LINUX_NUMA_H
#define NUMA_NO_NODE (-1)
#endif

View file

@ -9,6 +9,9 @@
#define PAGEVEC_SIZE 15
struct folio_batch {
};
struct pagevec {
uint8_t nr;
struct vm_page *pages[PAGEVEC_SIZE];

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pci.h,v 1.15 2023/12/23 14:18:27 kettenis Exp $ */
/* $OpenBSD: pci.h,v 1.16 2024/01/16 23:38:13 jsg Exp $ */
/*
* Copyright (c) 2015 Mark Kettenis
*
@ -495,9 +495,33 @@ pci_unregister_driver(void *d)
{
}
static inline u16
pci_dev_id(struct pci_dev *dev)
{
return dev->devfn | (dev->bus->number << 8);
}
static inline const struct pci_device_id *
pci_match_id(const struct pci_device_id *ids, struct pci_dev *pdev)
{
int i = 0;
for (i = 0; ids[i].vendor != 0; i++) {
if ((ids[i].vendor == pdev->vendor) &&
(ids[i].device == pdev->device ||
ids[i].device == PCI_ANY_ID) &&
(ids[i].subvendor == PCI_ANY_ID) &&
(ids[i].subdevice == PCI_ANY_ID))
return &ids[i];
}
return NULL;
}
#define PCI_CLASS_DISPLAY_VGA \
((PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA)
#define PCI_CLASS_DISPLAY_OTHER \
((PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_MISC)
#define PCI_CLASS_ACCELERATOR_PROCESSING \
(PCI_CLASS_ACCELERATOR << 8)
#endif /* _LINUX_PCI_H_ */

View file

@ -16,6 +16,16 @@ preempt_disable(void)
{
}
static inline void
migrate_enable(void)
{
}
static inline void
migrate_disable(void)
{
}
static inline bool
in_irq(void)
{

View file

@ -12,6 +12,12 @@ get_random_u32(void)
return arc4random();
}
static inline uint32_t
get_random_u32_below(uint32_t x)
{
return arc4random_uniform(x);
}
static inline unsigned int
get_random_int(void)
{

View file

@ -153,6 +153,26 @@ rb_replace_node(struct rb_node *victim, struct rb_node *new,
*new = *victim;
}
static inline void
rb_add_cached(struct rb_node *node, struct rb_root_cached *root,
bool (*less)(struct rb_node *, const struct rb_node *))
{
struct rb_node **iter = &root->rb_root.rb_node;
struct rb_node *parent = NULL;
while (*iter) {
parent = *iter;
if (less(node, parent))
iter = &(*iter)->rb_left;
else
iter = &(*iter)->rb_right;
}
rb_link_node(node, parent, iter);
rb_insert_color_cached(node, root, false);
}
#undef RB_ROOT
#define RB_ROOT (struct rb_root) { NULL }
#ifdef __clang__

View file

@ -5,15 +5,28 @@
#include <linux/bug.h>
#include <linux/string.h>
#include <linux/string_helpers.h>
#include <linux/fs.h>
struct seq_file {
void *private;
};
static inline void
seq_printf(struct seq_file *m, const char *fmt, ...) {};
seq_printf(struct seq_file *m, const char *fmt, ...)
{
}
static inline void
seq_puts(struct seq_file *m, const char *s) {};
seq_puts(struct seq_file *m, const char *s)
{
}
static inline void
seq_write(struct seq_file *m, const void *p, size_t s)
{
}
#define DEFINE_SHOW_ATTRIBUTE(a)
#endif

View file

@ -14,7 +14,8 @@
#define ARCH_KMALLOC_MINALIGN CACHELINESIZE
#define ZERO_SIZE_PTR NULL
#define ZERO_SIZE_PTR NULL
#define ZERO_OR_NULL_PTR(x) ((x) == NULL)
static inline void *
kmalloc(size_t size, int flags)

View file

@ -3,6 +3,8 @@
#ifndef _LINUX_SORT_H
#define _LINUX_SORT_H
#include <linux/types.h>
void sort(void *, size_t, size_t, int (*)(const void *, const void *), void *);
#endif

View file

@ -25,6 +25,11 @@
mtx_leave(_mtxp); \
} while (0)
#define spin_trylock(_mtxp) \
({ \
mtx_enter_try(_mtxp) ? 1 : 0; \
})
#define spin_trylock_irqsave(_mtxp, _flags) \
({ \
(void)(_flags); \

View file

@ -0,0 +1,9 @@
/* Public domain. */
#ifndef _LINUX_STDDEF_H
#define _LINUX_STDDEF_H
#define DECLARE_FLEX_ARRAY(t, n) \
struct { struct{} n ## __unused; t n[]; }
#endif

View file

@ -31,6 +31,7 @@ struct attribute_group {
#define sysfs_remove_file_from_group(x, y, z)
#define sysfs_create_files(x, y) 0
#define sysfs_remove_files(x, y)
#define sysfs_bin_attr_init(x)
static inline int
sysfs_emit(char *str, const char *format, ...)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: timer.h,v 1.8 2021/07/14 09:56:17 jsg Exp $ */
/* $OpenBSD: timer.h,v 1.9 2024/01/16 23:38:13 jsg Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@ -25,6 +25,7 @@
#include <linux/ktime.h>
#define del_timer_sync(x) timeout_del_barrier((x))
#define timer_shutdown_sync(x) timeout_del_barrier((x))
#define del_timer(x) timeout_del((x))
#define timer_pending(x) timeout_pending((x))

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmalloc.h,v 1.5 2023/03/21 09:44:35 jsg Exp $ */
/* $OpenBSD: vmalloc.h,v 1.6 2024/01/16 23:38:13 jsg Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@ -18,10 +18,11 @@
#ifndef _LINUX_VMALLOC_H
#define _LINUX_VMALLOC_H
#include <sys/types.h>
#include <sys/param.h>
#include <sys/malloc.h>
#include <uvm/uvm_extern.h>
#include <linux/overflow.h>
#include <linux/types.h> /* for pgprot_t */
void *vmap(struct vm_page **, unsigned int, unsigned long, pgprot_t);
void vunmap(void *, size_t);