sync with OpenBSD -current

This commit is contained in:
purplerain 2023-12-23 13:56:21 +00:00
parent 38dbdec412
commit 933c153850
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
49 changed files with 931 additions and 4156 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: drm_linux.c,v 1.104 2023/10/20 03:38:58 jsg Exp $ */
/* $OpenBSD: drm_linux.c,v 1.105 2023/12/23 14:18:27 kettenis Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@ -1501,6 +1501,9 @@ acpi_format_exception(acpi_status status)
#endif
SLIST_HEAD(,backlight_device) backlight_device_list =
SLIST_HEAD_INITIALIZER(backlight_device_list);
void
backlight_do_update_status(void *arg)
{
@ -1509,7 +1512,7 @@ backlight_do_update_status(void *arg)
struct backlight_device *
backlight_device_register(const char *name, void *kdev, void *data,
const struct backlight_ops *ops, struct backlight_properties *props)
const struct backlight_ops *ops, const struct backlight_properties *props)
{
struct backlight_device *bd;
@ -1520,31 +1523,26 @@ backlight_device_register(const char *name, void *kdev, void *data,
task_set(&bd->task, backlight_do_update_status, bd);
SLIST_INSERT_HEAD(&backlight_device_list, bd, next);
bd->name = name;
return bd;
}
void
backlight_device_unregister(struct backlight_device *bd)
{
SLIST_REMOVE(&backlight_device_list, bd, backlight_device, next);
free(bd, M_DRM, sizeof(*bd));
}
struct backlight_device *
devm_backlight_device_register(void *dev, const char *name, void *parent,
void *data, const struct backlight_ops *bo,
const struct backlight_properties *bp)
{
STUB();
return NULL;
}
void
backlight_schedule_update_status(struct backlight_device *bd)
{
task_add(systq, &bd->task);
}
inline int
int
backlight_enable(struct backlight_device *bd)
{
if (bd == NULL)
@ -1555,7 +1553,7 @@ backlight_enable(struct backlight_device *bd)
return bd->ops->update_status(bd);
}
inline int
int
backlight_disable(struct backlight_device *bd)
{
if (bd == NULL)
@ -1566,6 +1564,62 @@ backlight_disable(struct backlight_device *bd)
return bd->ops->update_status(bd);
}
struct backlight_device *
backlight_device_get_by_name(const char *name)
{
struct backlight_device *bd;
SLIST_FOREACH(bd, &backlight_device_list, next) {
if (strcmp(name, bd->name) == 0)
return bd;
}
return NULL;
}
struct drvdata {
struct device *dev;
void *data;
SLIST_ENTRY(drvdata) next;
};
SLIST_HEAD(,drvdata) drvdata_list = SLIST_HEAD_INITIALIZER(drvdata_list);
void
dev_set_drvdata(struct device *dev, void *data)
{
struct drvdata *drvdata;
SLIST_FOREACH(drvdata, &drvdata_list, next) {
if (drvdata->dev == dev) {
drvdata->data = data;
return;
}
}
if (data == NULL)
return;
drvdata = malloc(sizeof(*drvdata), M_DRM, M_WAITOK);
drvdata->dev = dev;
drvdata->data = data;
SLIST_INSERT_HEAD(&drvdata_list, drvdata, next);
}
void *
dev_get_drvdata(struct device *dev)
{
struct drvdata *drvdata;
SLIST_FOREACH(drvdata, &drvdata_list, next) {
if (drvdata->dev == dev)
return drvdata->data;
}
return NULL;
}
void
drm_sysfs_hotplug_event(struct drm_device *dev)
{

View file

@ -73,9 +73,7 @@ struct drm_minor {
/* private: */
int index; /* Minor device number */
int type; /* Control or render */
#ifdef __linux__
struct device *kdev; /* Linux device */
#endif
struct drm_device *dev;
struct dentry *debugfs_root;

View file

@ -11,24 +11,32 @@ struct device;
struct backlight_properties {
int type;
#define BACKLIGHT_RAW 0
#define BACKLIGHT_FIRMWARE 1
#define BACKLIGHT_PLATFORM 2
int max_brightness;
int brightness;
int power;
int scale;
#define BACKLIGHT_SCALE_LINEAR 0
int state;
#define BL_CORE_SUSPENDED 0x00000001
};
struct backlight_ops {
int options;
#define BL_CORE_SUSPENDRESUME 0x00000001
int (*update_status)(struct backlight_device *);
int (*get_brightness)(struct backlight_device *);
};
#define BL_CORE_SUSPENDRESUME 1
struct backlight_device {
const struct backlight_ops *ops;
struct backlight_properties props;
struct task task;
void *data;
SLIST_ENTRY(backlight_device) next;
const char *name;
};
static inline void *
@ -37,18 +45,25 @@ bl_get_data(struct backlight_device *bd)
return bd->data;
}
#define BACKLIGHT_RAW 0
#define BACKLIGHT_FIRMWARE 1
static inline int
backlight_get_brightness(struct backlight_device *bd)
{
return bd->props.brightness;
}
#define BACKLIGHT_UPDATE_HOTKEY 0
struct backlight_device *backlight_device_register(const char *, void *,
void *, const struct backlight_ops *, struct backlight_properties *);
void *, const struct backlight_ops *, const struct backlight_properties *);
void backlight_device_unregister(struct backlight_device *);
struct backlight_device *devm_backlight_device_register(void *, const char *,
void *, void *, const struct backlight_ops *,
const struct backlight_properties *);
static inline struct backlight_device *
devm_backlight_device_register(void *dev, const char *name, void *parent,
void *data, const struct backlight_ops *bo,
const struct backlight_properties *bp)
{
return backlight_device_register(name, dev, data, bo, bp);
}
static inline void
backlight_update_status(struct backlight_device *bd)
@ -82,10 +97,6 @@ devm_of_find_backlight(struct device *dev)
return NULL;
}
static inline struct backlight_device *
backlight_device_get_by_name(const char *name)
{
return NULL;
}
struct backlight_device *backlight_device_get_by_name(const char *);
#endif

View file

@ -16,6 +16,9 @@
struct device_node;
struct bus_type {
};
struct device_driver {
struct device *dev;
};
@ -33,12 +36,13 @@ struct device_attribute {
#define device_create_file(a, b) 0
#define device_remove_file(a, b)
#define dev_get_drvdata(x) NULL
#define dev_set_drvdata(x, y)
void *dev_get_drvdata(struct device *);
void dev_set_drvdata(struct device *, void *);
#define dev_pm_set_driver_flags(x, y)
#define devm_kzalloc(x, y, z) kzalloc(y, z)
#define devm_kfree(x, y) kfree(y)
#define dev_warn(dev, fmt, arg...) \
printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
@ -78,6 +82,10 @@ struct device_attribute {
#define dev_err_once(dev, fmt, arg...) \
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg)
#define dev_err_probe(dev, err, fmt, arg...) \
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg), err
#ifdef DRMDEBUG
#define dev_info(dev, fmt, arg...) \

View file

@ -169,6 +169,9 @@ iowrite64(u64 val, volatile void __iomem *addr)
#define readq(p) ioread64(p)
#define writeq(v, p) iowrite64(v, p)
#define readl_relaxed(p) readl(p)
#define writel_relaxed(v, p) writel(v, p)
int drm_mtrr_add(unsigned long, size_t, int);
int drm_mtrr_del(int, unsigned long, size_t, int);

View file

@ -5,6 +5,8 @@
#include <linux/types.h>
#define IORESOURCE_MEM 0x0001
struct resource {
u_long start;
u_long end;

View file

@ -40,7 +40,12 @@ jiffies_to_nsecs(const unsigned long x)
#define usecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000000)
#define nsecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000000000)
#define nsecs_to_jiffies64(x) (((uint64_t)(x)) * hz / 1000000000)
#define get_jiffies_64() jiffies
static inline uint64_t
get_jiffies_64(void)
{
return jiffies;
}
static inline int
time_after(const unsigned long a, const unsigned long b)
@ -55,6 +60,12 @@ time_after_eq(const unsigned long a, const unsigned long b)
return((long)(b - a) <= 0);
}
static inline int
time_after_eq64(const unsigned long long a, const unsigned long long b)
{
return((long long)(b - a) <= 0);
}
#define time_after32(a,b) ((int32_t)((uint32_t)(b) - (uint32_t)(a)) < 0)
#endif

View file

@ -149,4 +149,6 @@ _in_dbg_master(void)
#define STUB() do { printf("%s: stub\n", __func__); } while(0)
#define CONCATENATE(x, y) __CONCAT(x, y)
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pci.h,v 1.14 2023/09/13 12:31:49 jsg Exp $ */
/* $OpenBSD: pci.h,v 1.15 2023/12/23 14:18:27 kettenis Exp $ */
/*
* Copyright (c) 2015 Mark Kettenis
*
@ -482,6 +482,14 @@ pci_set_power_state(struct pci_dev *dev, int state)
return 0;
}
struct pci_driver;
static inline int
pci_register_driver(struct pci_driver *pci_drv)
{
return 0;
}
static inline void
pci_unregister_driver(void *d)
{

View file

@ -37,7 +37,7 @@ typedef uint32_t __be32;
typedef uint64_t __le64;
typedef uint64_t __be64;
typedef bus_addr_t dma_addr_t;
typedef uint64_t dma_addr_t;
typedef paddr_t phys_addr_t;
typedef paddr_t resource_size_t;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if.c,v 1.711 2023/11/11 14:24:03 bluhm Exp $ */
/* $OpenBSD: if.c,v 1.713 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_aggr.c,v 1.40 2023/05/16 14:32:54 jan Exp $ */
/* $OpenBSD: if_aggr.c,v 1.42 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2019 The University of Queensland

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_bpe.c,v 1.20 2023/10/27 20:56:47 jan Exp $ */
/* $OpenBSD: if_bpe.c,v 1.22 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2018 David Gwynne <dlg@openbsd.org>
*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_etherip.c,v 1.52 2023/11/28 13:23:20 bluhm Exp $ */
/* $OpenBSD: if_etherip.c,v 1.54 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_gif.c,v 1.134 2023/11/28 13:23:20 bluhm Exp $ */
/* $OpenBSD: if_gif.c,v 1.136 2023/12/23 10:52:54 bluhm Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_gre.c,v 1.176 2023/11/28 13:23:20 bluhm Exp $ */
/* $OpenBSD: if_gre.c,v 1.178 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mpe.c,v 1.102 2022/08/29 07:51:45 bluhm Exp $ */
/* $OpenBSD: if_mpe.c,v 1.104 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mpip.c,v 1.16 2022/08/29 07:51:45 bluhm Exp $ */
/* $OpenBSD: if_mpip.c,v 1.18 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mpw.c,v 1.63 2022/08/29 07:51:45 bluhm Exp $ */
/* $OpenBSD: if_mpw.c,v 1.65 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pflow.c,v 1.107 2023/12/19 20:34:10 mvs Exp $ */
/* $OpenBSD: if_pflow.c,v 1.109 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pfsync.c,v 1.322 2023/10/03 10:22:10 sthen Exp $ */
/* $OpenBSD: if_pfsync.c,v 1.324 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pppx.c,v 1.126 2023/02/10 14:34:17 visa Exp $ */
/* $OpenBSD: if_pppx.c,v 1.128 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_sec.c,v 1.7 2023/08/15 09:46:30 dlg Exp $ */
/* $OpenBSD: if_sec.c,v 1.9 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2022 The University of Queensland

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_tpmr.c,v 1.33 2023/05/16 14:32:54 jan Exp $ */
/* $OpenBSD: if_tpmr.c,v 1.35 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2019 The University of Queensland

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_trunk.c,v 1.152 2021/08/02 21:10:55 mvs Exp $ */
/* $OpenBSD: if_trunk.c,v 1.154 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_tun.c,v 1.238 2023/02/10 14:39:18 visa Exp $ */
/* $OpenBSD: if_tun.c,v 1.240 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_var.h,v 1.130 2023/11/11 14:24:03 bluhm Exp $ */
/* $OpenBSD: if_var.h,v 1.132 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_veb.c,v 1.32 2023/11/23 23:45:10 dlg Exp $ */
/* $OpenBSD: if_veb.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vlan.c,v 1.216 2023/10/27 20:56:47 jan Exp $ */
/* $OpenBSD: if_vlan.c,v 1.218 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vxlan.c,v 1.97 2023/11/29 18:46:37 denis Exp $ */
/* $OpenBSD: if_vxlan.c,v 1.99 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_wg.c,v 1.32 2023/10/23 10:22:05 mvs Exp $ */
/* $OpenBSD: if_wg.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_carp.c,v 1.358 2023/09/16 09:33:27 mpi Exp $ */
/* $OpenBSD: ip_carp.c,v 1.360 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.