Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 11:38:04 UTC 2021

Modified Files:
        src/sys/external/bsd/common/include/linux: list.h workqueue.h
        src/sys/external/bsd/common/linux: linux_work.c
        src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h intel_csr.c
            intel_sideband.h
        src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c
            intel_atomic.c intel_atomic_plane.c intel_audio.c intel_bios.c
            intel_crt.h intel_display.c intel_display.h intel_display_power.c
            intel_dp.c intel_dp.h intel_lpe_audio.h intel_lvds.h intel_sdvo.h
        src/sys/external/bsd/drm2/dist/drm/i915/gt: intel_breadcrumbs.c
            intel_context.c
        src/sys/external/bsd/drm2/i915drm: files.i915drmkms vlv_dsi.c
        src/sys/external/bsd/drm2/include: i915_trace.h
        src/sys/external/bsd/drm2/include/drm: drm_mipi_dsi.h
        src/sys/external/bsd/drm2/include/linux: acpi.h bitfield.h hdmi.h
            ktime.h pci.h scatterlist.h smp.h uuid.h
        src/sys/external/bsd/drm2/linux: linux_pci.c linux_sg.c

Log Message:
i915: another whack at it


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/common/include/linux/list.h
cvs rdiff -u -r1.23 -r1.24 \
    src/sys/external/bsd/common/include/linux/workqueue.h
cvs rdiff -u -r1.52 -r1.53 src/sys/external/bsd/common/linux/linux_work.c
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/intel_csr.c
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h
cvs rdiff -u -r1.3 -r1.4 \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h
cvs rdiff -u -r1.4 -r1.5 \
    src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h
cvs rdiff -u -r1.3 -r1.4 \
    src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c
cvs rdiff -u -r1.73 -r1.74 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/i915drm/vlv_dsi.c
cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/include/i915_trace.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/acpi.h \
    src/sys/external/bsd/drm2/include/linux/scatterlist.h
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/include/linux/bitfield.h
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/hdmi.h
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/ktime.h
cvs rdiff -u -r1.48 -r1.49 src/sys/external/bsd/drm2/include/linux/pci.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/smp.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/uuid.h
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/drm2/linux/linux_pci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/linux/linux_sg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/common/include/linux/list.h
diff -u src/sys/external/bsd/common/include/linux/list.h:1.30 src/sys/external/bsd/common/include/linux/list.h:1.31
--- src/sys/external/bsd/common/include/linux/list.h:1.30	Sun Dec 19 11:37:41 2021
+++ src/sys/external/bsd/common/include/linux/list.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: list.h,v 1.30 2021/12/19 11:37:41 riastradh Exp $	*/
+/*	$NetBSD: list.h,v 1.31 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -283,6 +283,11 @@ list_del_init(struct list_head *node)
 		(VAR) != (HEAD);					\
 		(VAR) = list_next((VAR)))
 
+#define	list_for_each_prev(VAR, HEAD)					\
+	for ((VAR) = list_last((HEAD));					\
+		(VAR) != (HEAD);					\
+		(VAR) = list_prev((VAR)))
+
 #define	list_for_each_safe(VAR, NEXT, HEAD)				\
 	for ((VAR) = list_first((HEAD));				\
 		((VAR) != (HEAD)) && ((NEXT) = list_next((VAR)), 1);	\

Index: src/sys/external/bsd/common/include/linux/workqueue.h
diff -u src/sys/external/bsd/common/include/linux/workqueue.h:1.23 src/sys/external/bsd/common/include/linux/workqueue.h:1.24
--- src/sys/external/bsd/common/include/linux/workqueue.h:1.23	Sun Dec 19 11:10:17 2021
+++ src/sys/external/bsd/common/include/linux/workqueue.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.h,v 1.23 2021/12/19 11:10:17 riastradh Exp $	*/
+/*	$NetBSD: workqueue.h,v 1.24 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -59,6 +59,7 @@
 #define	queue_work			linux_queue_work
 #define	schedule_delayed_work		linux_schedule_delayed_work
 #define	schedule_work			linux_schedule_work
+#define	system_highpri_wq		linux_system_highpri_wq
 #define	system_long_wq			linux_system_long_wq
 #define	system_power_efficient_wq	linux_system_power_efficient_wq
 #define	system_unbound_wq		linux_system_unbound_wq
@@ -95,16 +96,19 @@ struct rcu_work {
 #define	WQ_MEM_RECLAIM		__BIT(2)
 #define	WQ_UNBOUND		__BIT(3)
 
+#define	WQ_UNBOUND_MAX_ACTIVE	0
+
 static inline struct delayed_work *
 to_delayed_work(struct work_struct *work)
 {
 	return container_of(work, struct delayed_work, work);
 }
 
-extern struct workqueue_struct	*system_wq;
+extern struct workqueue_struct	*system_highpri_wq;
 extern struct workqueue_struct	*system_long_wq;
 extern struct workqueue_struct	*system_power_efficient_wq;
 extern struct workqueue_struct	*system_unbound_wq;
+extern struct workqueue_struct	*system_wq;
 
 int	linux_workqueue_init(void);
 void	linux_workqueue_fini(void);

Index: src/sys/external/bsd/common/linux/linux_work.c
diff -u src/sys/external/bsd/common/linux/linux_work.c:1.52 src/sys/external/bsd/common/linux/linux_work.c:1.53
--- src/sys/external/bsd/common/linux/linux_work.c:1.52	Sun Dec 19 01:51:02 2021
+++ src/sys/external/bsd/common/linux/linux_work.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.52 2021/12/19 01:51:02 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.53 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.52 2021/12/19 01:51:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.53 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -117,10 +117,11 @@ SDT_PROBE_DEFINE1(sdt, linux, work, flus
 
 static specificdata_key_t workqueue_key __read_mostly;
 
-struct workqueue_struct	*system_wq __read_mostly;
+struct workqueue_struct	*system_highpri_wq __read_mostly;
 struct workqueue_struct	*system_long_wq __read_mostly;
 struct workqueue_struct	*system_power_efficient_wq __read_mostly;
 struct workqueue_struct	*system_unbound_wq __read_mostly;
+struct workqueue_struct	*system_wq __read_mostly;
 
 static inline uintptr_t
 atomic_cas_uintptr(volatile uintptr_t *p, uintptr_t old, uintptr_t new)
@@ -142,41 +143,56 @@ linux_workqueue_init0(void)
 
 	error = lwp_specific_key_create(&workqueue_key, NULL);
 	if (error)
-		goto fail0;
+		goto out;
 
-	system_wq = alloc_ordered_workqueue("lnxsyswq", 0);
-	if (system_wq == NULL) {
+	system_highpri_wq = alloc_ordered_workqueue("lnxhipwq", 0);
+	if (system_highpri_wq == NULL) {
 		error = ENOMEM;
-		goto fail1;
+		goto out;
 	}
 
 	system_long_wq = alloc_ordered_workqueue("lnxlngwq", 0);
 	if (system_long_wq == NULL) {
 		error = ENOMEM;
-		goto fail2;
+		goto out;
 	}
 
 	system_power_efficient_wq = alloc_ordered_workqueue("lnxpwrwq", 0);
 	if (system_power_efficient_wq == NULL) {
 		error = ENOMEM;
-		goto fail3;
+		goto out;
 	}
 
 	system_unbound_wq = alloc_ordered_workqueue("lnxubdwq", 0);
 	if (system_unbound_wq == NULL) {
 		error = ENOMEM;
-		goto fail4;
+		goto out;
 	}
 
-	return 0;
+	system_wq = alloc_ordered_workqueue("lnxsyswq", 0);
+	if (system_wq == NULL) {
+		error = ENOMEM;
+		goto out;
+	}
+
+	/* Success!  */
+	error = 0;
+
+out:	if (error) {
+		if (system_highpri_wq)
+			destroy_workqueue(system_highpri_wq);
+		if (system_long_wq)
+			destroy_workqueue(system_long_wq);
+		if (system_power_efficient_wq)
+			destroy_workqueue(system_power_efficient_wq);
+		if (system_unbound_wq)
+			destroy_workqueue(system_unbound_wq);
+		if (system_wq)
+			destroy_workqueue(system_wq);
+		if (workqueue_key)
+			lwp_specific_key_delete(workqueue_key);
+	}
 
-fail5: __unused
-	destroy_workqueue(system_unbound_wq);
-fail4:	destroy_workqueue(system_power_efficient_wq);
-fail3:	destroy_workqueue(system_long_wq);
-fail2:	destroy_workqueue(system_wq);
-fail1:	lwp_specific_key_delete(workqueue_key);
-fail0:	KASSERT(error);
 	return error;
 }
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.17 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.18
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.17	Sun Dec 19 11:14:16 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_reg.h,v 1.17 2021/12/19 11:14:16 riastradh Exp $	*/
+/*	$NetBSD: i915_reg.h,v 1.18 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -29,6 +29,7 @@
 
 #include <linux/bitfield.h>
 #include <linux/bits.h>
+#include <linux/types.h>
 
 /**
  * DOC: The i915 register macro definition style guide

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_csr.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_csr.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_csr.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_csr.c:1.7	Sat Dec 18 23:45:28 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_csr.c	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_csr.c,v 1.7 2021/12/18 23:45:28 riastradh Exp $	*/
+/*	$NetBSD: intel_csr.c,v 1.8 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_csr.c,v 1.7 2021/12/18 23:45:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_csr.c,v 1.8 2021/12/19 11:38:04 riastradh Exp $");
 
 #include <linux/firmware.h>
 
@@ -229,7 +229,7 @@ struct stepping_info {
  * Kabylake derivated from Skylake H0, so SKL H0
  * is the right firmware for KBL A0 (revid 0).
  */
-static const struct stepping_info kbl_stepping_info[] = {
+static const struct stepping_info kbl_stepping_info[] __unused = {
 	{'H', '0'}, {'I', '0'}
 };
 
@@ -391,7 +391,7 @@ static u32 parse_csr_fw_dmc(struct intel
 	unsigned int header_len_bytes, dmc_header_size, payload_size, i;
 	const u32 *mmioaddr, *mmiodata;
 	u32 mmio_count, mmio_count_max;
-	u8 *payload;
+	const u8 *payload;
 
 	BUILD_BUG_ON(ARRAY_SIZE(csr->mmioaddr) < DMC_V3_MAX_MMIO_COUNT ||
 		     ARRAY_SIZE(csr->mmioaddr) < DMC_V1_MAX_MMIO_COUNT);
@@ -480,7 +480,7 @@ static u32 parse_csr_fw_dmc(struct intel
 		return 0;
 	}
 
-	payload = (u8 *)(dmc_header) + header_len_bytes;
+	payload = (const u8 *)(dmc_header) + header_len_bytes;
 	memcpy(csr->dmc_payload, payload, payload_size);
 
 	return header_len_bytes + payload_size;
@@ -532,7 +532,7 @@ parse_csr_fw_package(struct intel_csr *c
 		num_entries = max_entries;
 
 	fw_info = (const struct intel_fw_info *)
-		((u8 *)package_header + sizeof(*package_header));
+		((const u8 *)package_header + sizeof(*package_header));
 	dmc_offset = find_dmc_fw_offset(fw_info, num_entries, si,
 					package_header->header_ver);
 	if (dmc_offset == CSR_DEFAULT_FW_OFFSET) {
@@ -642,7 +642,8 @@ static void csr_load_work_fn(struct work
 	dev_priv = container_of(work, typeof(*dev_priv), csr.work);
 	csr = &dev_priv->csr;
 
-	request_firmware(&fw, dev_priv->csr.fw_path, &dev_priv->drm.pdev->dev);
+	request_firmware(&fw, dev_priv->csr.fw_path,
+	    pci_dev_dev(dev_priv->drm.pdev));
 	parse_csr_fw(dev_priv, fw);
 
 	if (dev_priv->csr.dmc_payload) {

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_sideband.h,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_sideband.h,v 1.3 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 
@@ -8,6 +8,9 @@
 #include <linux/bitops.h>
 #include <linux/types.h>
 
+#include <sys/file.h>
+#define	pipe	pipe_drmhack	/* see intel_display.h */
+
 struct drm_i915_private;
 enum pipe;
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.3 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.3	Sun Dec 19 10:25:15 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_acpi.c,v 1.3 2021/12/19 10:25:15 riastradh Exp $	*/
+/*	$NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $	*/
 
 // SPDX-License-Identifier: GPL-2.0
 /*
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.3 2021/12/19 10:25:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <linux/pci.h>
 #include <linux/acpi.h>
@@ -22,15 +22,19 @@ __KERNEL_RCSID(0, "$NetBSD: intel_acpi.c
 #define _COMPONENT ACPI_BUTTON_COMPONENT
 ACPI_MODULE_NAME("acpi_intel_brightness")
 
+#include <dev/acpi/acpi_pci.h>
+
 #define acpi_handle	ACPI_HANDLE
 #define	buffer		Buffer
+#define	count		Count
 #define	elements	Elements
 #define	integer		Integer
 #define	package		Package
+#define	pointer		Pointer
 #define	value		Value
 
 static ACPI_OBJECT *
-acpi_evaluate_dsm(ACPI_HANDLE handle, const uint8_t *uuid, int rev, int func,
+acpi_evaluate_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, int func,
     ACPI_OBJECT *argv4)
 {
 	ACPI_OBJECT_LIST arg;
@@ -68,7 +72,7 @@ acpi_evaluate_dsm(ACPI_HANDLE handle, co
 }
 
 static inline ACPI_OBJECT *
-acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const uint8_t *uuid, int rev,
+acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const guid_t *uuid, int rev,
     int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type)
 {
 	ACPI_OBJECT *obj;
@@ -89,7 +93,7 @@ acpi_evaluate_dsm_typed(ACPI_HANDLE hand
 }
 
 static bool
-acpi_check_dsm(ACPI_HANDLE handle, const uint8_t *uuid, int rev, uint64_t funcs)
+acpi_check_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, uint64_t funcs)
 {
 	ACPI_OBJECT *obj;
 	uint64_t mask = 0;
@@ -122,7 +126,7 @@ static const guid_t intel_dsm_guid =
 	GUID_INIT(0x7ed873d3, 0xc2d0, 0x4e4f,
 		  0xa8, 0x54, 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c);
 
-static char *intel_dsm_port_name(u8 id)
+static const char *intel_dsm_port_name(u8 id)
 {
 	switch (id) {
 	case 0:
@@ -158,7 +162,7 @@ static char *intel_dsm_port_name(u8 id)
 	}
 }
 
-static char *intel_dsm_mux_type(u8 type)
+static const char *intel_dsm_mux_type(u8 type)
 {
 	switch (type) {
 	case 0:
@@ -220,7 +224,7 @@ static void intel_dsm_platform_mux_info(
 }
 
 #ifdef __NetBSD__
-static bool intel_dsm_pci_probe(ACPI_HANDLE dhandle)
+static ACPI_HANDLE intel_dsm_pci_probe(ACPI_HANDLE dhandle)
 #else
 static acpi_handle intel_dsm_pci_probe(struct pci_dev *pdev)
 #endif
@@ -247,7 +251,7 @@ static acpi_handle intel_dsm_pci_probe(s
 #ifdef __NetBSD__
 
 static int vga_count;
-static bool has_dsm;
+static ACPI_HANDLE intel_dsm_handle;
 
 /* XXX from sys/dev/pci/vga_pcivar.h */
 #define	DEVICE_IS_VGA_PCI(class, id)					\
@@ -266,8 +270,8 @@ intel_dsm_vga_match(const struct pci_att
 	vga_count++;
 	struct acpi_devnode *node = acpi_pcidev_find(0 /*XXX segment*/,
 	    pa->pa_bus, pa->pa_device, pa->pa_function);
-	if (node != NULL)
-		has_dsm |= intel_dsm_pci_probe(node->ad_handle);
+	if (node != NULL && intel_dsm_handle == NULL)
+		intel_dsm_handle = intel_dsm_pci_probe(node->ad_handle);
 	return 0;
 }
 
@@ -276,11 +280,10 @@ static bool intel_dsm_detect(struct drm_
 	char acpi_method_name[255] = { 0 };
 
 	vga_count = 0;
-	has_dsm = false;
 	pci_find_device(&dev->pdev->pd_pa, intel_dsm_vga_match);
 
-	if (vga_count == 2 && has_dsm) {
-		const char *name = acpi_name(intel_dsm_priv.dhandle);
+	if (vga_count == 2 && intel_dsm_handle) {
+		const char *name = acpi_name(intel_dsm_handle);
 		strlcpy(acpi_method_name, name, sizeof(acpi_method_name));
 		DRM_DEBUG_DRIVER("VGA switcheroo: detected DSM switching method %s handle\n",
 				 acpi_method_name);
@@ -317,7 +320,7 @@ static bool intel_dsm_detect(void)
 #ifdef __NetBSD__
 void intel_register_dsm_handler(struct drm_i915_private *i915)
 {
-	if (!intel_dsm_detect(i915->base.pdev))
+	if (!intel_dsm_detect(&i915->drm))
 		return;
 }
 #else

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_atomic.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_atomic.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2015 Intel Corporation
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_atomic.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_atomic.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -61,8 +61,8 @@ int intel_digital_connector_atomic_get_p
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct intel_digital_connector_state *intel_conn_state =
-		to_intel_digital_connector_state(state);
+	const struct intel_digital_connector_state *intel_conn_state =
+		const_container_of(state, struct intel_digital_connector_state, base);
 
 	if (property == dev_priv->force_audio_property)
 		*val = intel_conn_state->force_audio;
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_atomic_plane.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_atomic_plane.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_atomic_plane.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_atomic_plane.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fourcc.h>
@@ -319,7 +319,7 @@ skl_next_plane_to_commit(struct intel_at
 {
 	struct intel_crtc_state *crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
-	struct intel_plane_state *plane_state;
+	struct intel_plane_state *plane_state __unused;
 	struct intel_plane *plane;
 	int i;
 
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_audio.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_audio.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_audio.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_audio.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <linux/component.h>
 #include <linux/kernel.h>
@@ -805,6 +805,8 @@ void intel_init_audio_hooks(struct drm_i
 	}
 }
 
+#ifndef __NetBSD__		/* XXX intel audio */
+
 static void glk_force_audio_cdclk(struct drm_i915_private *dev_priv,
 				  bool enable)
 {
@@ -843,8 +845,6 @@ retry:
 	drm_modeset_acquire_fini(&ctx);
 }
 
-#ifndef __NetBSD__		/* XXX intel audio */
-
 static unsigned long i915_audio_component_get_power(struct device *kdev)
 {
 	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_bios.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_bios.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2006 Intel Corporation
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_bios.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_bios.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <drm/drm_dp_helper.h>
 #include <drm/i915_drm.h>
@@ -1288,7 +1288,7 @@ static void fixup_mipi_sequences(struct 
 	DRM_DEBUG_KMS("Using init OTP fragment to deassert reset\n");
 
 	/* Copy the fragment, update seq byte and terminate it */
-	init_otp = (u8 *)dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
+	init_otp = (u8 *)__UNCONST(dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]);
 	dev_priv->vbt.dsi.deassert_seq = kmemdup(init_otp, len + 1, GFP_KERNEL);
 	if (!dev_priv->vbt.dsi.deassert_seq)
 		return;
@@ -1980,7 +1980,18 @@ bool intel_bios_is_valid_vbt(const void 
 
 #ifdef __NetBSD__
 #  define	__iomem	__pci_rom_iomem
+#  define	ioread16	fake_ioread16
 #  define	ioread32	fake_ioread32
+static inline uint16_t
+fake_ioread16(const void __iomem *p)
+{
+	uint16_t v;
+
+	v = *(const uint16_t __iomem *)p;
+	__insn_barrier();
+
+	return v;
+}
 static inline uint32_t
 fake_ioread32(const void __iomem *p)
 {
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_crt.h,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_crt.h,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -10,6 +10,9 @@
 
 #include "i915_reg.h"
 
+#include <sys/file.h>
+#define	pipe	pipe_drmhack	/* see intel_display.h */
+
 enum pipe;
 struct drm_encoder;
 struct drm_i915_private;
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_display.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_display.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2006-2007 Intel Corporation
@@ -27,7 +27,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_display.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_display.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
+
+#include "intel_display.h"	/* for pipe_drmhack */
 
 #include <linux/i2c.h>
 #include <linux/input.h>
@@ -2127,7 +2129,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt
 	view->type = I915_GGTT_VIEW_NORMAL;
 	if (drm_rotation_90_or_270(rotation)) {
 		view->type = I915_GGTT_VIEW_ROTATED;
-		view->rotated = to_intel_framebuffer(fb)->rot_info;
+		view->rotated = to_intel_framebuffer((struct drm_framebuffer *)__UNCONST(fb))->rot_info;
 	}
 }
 
@@ -2314,7 +2316,7 @@ static int intel_fb_pitch(const struct d
 			  unsigned int rotation)
 {
 	if (drm_rotation_90_or_270(rotation))
-		return to_intel_framebuffer(fb)->rotated[color_plane].pitch;
+		return to_intel_framebuffer((struct drm_framebuffer *)__UNCONST(fb))->rotated[color_plane].pitch;
 	else
 		return fb->pitches[color_plane];
 }
@@ -3118,7 +3120,7 @@ intel_fill_fb_info(struct drm_i915_priva
 	}
 
 	if (mul_u32_u32(max_size, tile_size) > obj->base.size) {
-		DRM_DEBUG_KMS("fb too big for bo (need %llu bytes, have %zu bytes)\n",
+		DRM_DEBUG_KMS("fb too big for bo (need %"PRIu64" bytes, have %zu bytes)\n",
 			      mul_u32_u32(max_size, tile_size), obj->base.size);
 		return -EINVAL;
 	}
@@ -3415,7 +3417,7 @@ intel_alloc_initial_plane_obj(struct int
 	case I915_FORMAT_MOD_Y_TILED:
 		break;
 	default:
-		DRM_DEBUG_DRIVER("Unsupported modifier for initial FB: 0x%llx\n",
+		DRM_DEBUG_DRIVER("Unsupported modifier for initial FB: 0x%"PRIx64"\n",
 				 fb->modifier);
 		return false;
 	}
@@ -8316,7 +8318,7 @@ static void chv_prepare_pll(struct intel
 	enum pipe pipe = crtc->pipe;
 	enum dpio_channel port = vlv_pipe_to_channel(pipe);
 	u32 loopfilter, tribuf_calcntr;
-	u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
+	u32 bestn __unused, bestm1 __unused, bestm2, bestp1, bestp2, bestm2_frac;
 	u32 dpio_val;
 	int vco;
 
@@ -9085,7 +9087,7 @@ i9xx_get_initial_plane_config(struct int
 	struct intel_plane *plane = to_intel_plane(crtc->base.primary);
 	enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
 	enum pipe pipe;
-	u32 val, base, offset;
+	u32 val, base, offset __unused;
 	int fourcc, pixel_format;
 	unsigned int aligned_height;
 	struct drm_framebuffer *fb;
@@ -10282,7 +10284,7 @@ skl_get_initial_plane_config(struct inte
 	struct intel_plane *plane = to_intel_plane(crtc->base.primary);
 	enum plane_id plane_id = plane->id;
 	enum pipe pipe;
-	u32 val, base, offset, stride_mult, tiling, alpha;
+	u32 val, base, offset __unused, stride_mult, tiling, alpha;
 	int fourcc, pixel_format;
 	unsigned int aligned_height;
 	struct drm_framebuffer *fb;
@@ -14410,7 +14412,7 @@ static int intel_atomic_check_planes(str
 {
 	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
 	struct intel_crtc_state *old_crtc_state, *new_crtc_state;
-	struct intel_plane_state *plane_state;
+	struct intel_plane_state *plane_state __unused;
 	struct intel_plane *plane;
 	struct intel_crtc *crtc;
 	int i, ret;
@@ -14468,7 +14470,7 @@ static int intel_atomic_check_planes(str
 
 static int intel_atomic_check_crtcs(struct intel_atomic_state *state)
 {
-	struct intel_crtc_state *crtc_state;
+	struct intel_crtc_state *crtc_state __unused;
 	struct intel_crtc *crtc;
 	int i;
 
@@ -14549,7 +14551,7 @@ intel_atomic_check_tiled_conns(struct in
 {
 	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
 	struct drm_connector *connector;
-	struct drm_connector_state *old_conn_state, *new_conn_state;
+	struct drm_connector_state *old_conn_state __unused, *new_conn_state __unused;
 	int i, ret;
 
 	if (INTEL_GEN(dev_priv) < 11)
@@ -15271,6 +15273,9 @@ static void intel_atomic_helper_free_sta
 
 static void intel_atomic_commit_fence_wait(struct intel_atomic_state *intel_state)
 {
+#ifdef __NetBSD__
+	panic("NYI");
+#else
 	struct wait_queue_entry wait_fence, wait_reset;
 	struct drm_i915_private *dev_priv = to_i915(intel_state->base.dev);
 
@@ -15294,6 +15299,7 @@ static void intel_atomic_commit_fence_wa
 	finish_wait(bit_waitqueue(&dev_priv->gt.reset.flags,
 				  I915_RESET_MODESET),
 		    &wait_reset);
+#endif
 }
 
 static void intel_atomic_cleanup_work(struct work_struct *work)
@@ -15628,6 +15634,12 @@ static int intel_atomic_commit(struct dr
 	return 0;
 }
 
+#ifdef __NetBSD__
+
+/* XXX */
+
+#else
+
 struct wait_rps_boost {
 	struct wait_queue_entry wait;
 
@@ -15657,6 +15669,8 @@ static int do_rps_boost(struct wait_queu
 	return 1;
 }
 
+#endif
+
 static void add_rps_boost_after_vblank(struct drm_crtc *crtc,
 				       struct dma_fence *fence)
 {
@@ -15671,6 +15685,9 @@ static void add_rps_boost_after_vblank(s
 	if (drm_crtc_vblank_get(crtc))
 		return;
 
+#ifdef __NetBSD__
+	panic("NYI %p", &wait);
+#else
 	wait = kmalloc(sizeof(*wait), GFP_KERNEL);
 	if (!wait) {
 		drm_crtc_vblank_put(crtc);
@@ -15684,6 +15701,7 @@ static void add_rps_boost_after_vblank(s
 	wait->wait.flags = 0;
 
 	add_wait_queue(drm_crtc_vblank_waitqueue(crtc), &wait->wait);
+#endif
 }
 
 static int intel_plane_pin_fb(struct intel_plane_state *plane_state)
@@ -16944,7 +16962,7 @@ static int intel_framebuffer_init(struct
 				      mode_cmd->modifier[0])) {
 		struct drm_format_name_buf format_name;
 
-		DRM_DEBUG_KMS("unsupported pixel format %s / modifier 0x%llx\n",
+		DRM_DEBUG_KMS("unsupported pixel format %s / modifier 0x%"PRIx64"\n",
 			      drm_get_format_name(mode_cmd->pixel_format,
 						  &format_name),
 			      mode_cmd->modifier[0]);
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c:1.2	Sat Dec 18 23:45:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_display_power.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
+/*	$NetBSD: intel_display_power.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -6,7 +6,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_display_power.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_display_power.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
 
 #include "display/intel_crt.h"
 #include "display/intel_dp.h"
@@ -24,6 +24,8 @@ __KERNEL_RCSID(0, "$NetBSD: intel_displa
 #include "intel_tc.h"
 #include "intel_vga.h"
 
+#include <linux/nbsd-namespace.h>
+
 bool intel_display_power_well_is_enabled(struct drm_i915_private *dev_priv,
 					 enum i915_power_well_id power_well_id);
 
@@ -1314,7 +1316,11 @@ static void vlv_display_power_well_deini
 	intel_power_sequencer_reset(dev_priv);
 
 	/* Prevent us from re-enabling polling on accident in late suspend */
+#ifdef __NetBSD__
+	if (device_activation(dev_priv->drm.dev, DEVACT_LEVEL_FULL))
+#else
 	if (!dev_priv->drm.dev->power.is_suspended)
+#endif
 		intel_hpd_poll_init(dev_priv);
 }
 
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_dp.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_dp.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2008 Intel Corporation
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
 
 #include <linux/export.h>
 #include <linux/i2c.h>
@@ -1730,7 +1730,7 @@ static i915_reg_t skl_aux_data_reg(struc
 static void
 intel_dp_aux_fini(struct intel_dp *intel_dp)
 {
-	kfree(intel_dp->aux.name);
+	kfree(__UNCONST(intel_dp->aux.name));
 }
 
 static void
@@ -2345,7 +2345,7 @@ bool intel_dp_limited_color_range(const 
 				  const struct drm_connector_state *conn_state)
 {
 	const struct intel_digital_connector_state *intel_conn_state =
-		to_intel_digital_connector_state(conn_state);
+		const_container_of(conn_state, struct intel_digital_connector_state, base);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
 
@@ -2847,7 +2847,7 @@ static void edp_panel_vdd_schedule_off(s
  */
 static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
 {
-	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
+	struct drm_i915_private *dev_priv __lockdep_used = dp_to_i915(intel_dp);
 
 	lockdep_assert_held(&dev_priv->pps_mutex);
 
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_dp.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_dp.h,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -14,6 +14,9 @@
 
 #include "i915_reg.h"
 
+#include <sys/file.h>
+#define	pipe	pipe_drmhack	/* see intel_display.h */
+
 enum pipe;
 enum port;
 struct drm_connector_state;
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_lpe_audio.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_lpe_audio.h,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -10,6 +10,9 @@
 
 #include <linux/types.h>
 
+#include <sys/file.h>
+#define	pipe	pipe_drmhack	/* see intel_display.h */
+
 enum pipe;
 enum port;
 struct drm_i915_private;
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_lvds.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_lvds.h,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -12,6 +12,9 @@
 
 #include "i915_reg.h"
 
+#include <sys/file.h>
+#define	pipe	pipe_drmhack	/* see intel_display.h */
+
 enum pipe;
 struct drm_i915_private;
 
Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_sdvo.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_sdvo.h,v 1.3 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -14,6 +14,9 @@
 
 #include "i915_reg.h"
 
+#include <sys/file.h>
+#define	pipe	pipe_drmhack	/* see intel_display.h */
+
 struct drm_i915_private;
 enum pipe;
 enum port;

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h:1.4 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h:1.5
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h:1.4	Sun Dec 19 11:12:29 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h	Sun Dec 19 11:38:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_display.h,v 1.4 2021/12/19 11:12:29 riastradh Exp $	*/
+/*	$NetBSD: intel_display.h,v 1.5 2021/12/19 11:38:03 riastradh Exp $	*/
 
 /*
  * Copyright © 2006-2019 Intel Corporation
@@ -27,6 +27,26 @@
 #ifndef _INTEL_DISPLAY_H_
 #define _INTEL_DISPLAY_H_
 
+/*
+ * NetBSD already has struct pipe, and according to C99 6.2.3 there's
+ * only one namespace for struct, union, and enum tags, but the i915
+ * driver wants a type called enum pipe.
+ *
+ * So rename it to avoid conflicts which confuse tools like ctfmerge --
+ * but make sure we include <sys/file.h> first to avoid having two
+ * different versions of struct file, one with a pointer to struct pipe
+ * and another with a pointer to struct i915_pipe.
+ *
+ * This will cause trouble if we ever have an API that involves `pipe'
+ * as a member which we need to reference from within drm code.  But
+ * for now that is not the case.
+ *
+ * XXX Yes, this is disgusting.  Sorry.
+ */
+#include <sys/types.h>
+#include <sys/file.h>
+#define	pipe	pipe_drmhack
+
 #include <drm/drm_util.h>
 #include <drm/i915_drm.h>
 
@@ -77,24 +97,6 @@ enum i915_gpio {
 };
 
 /*
- * NetBSD already has struct pipe, and according to C99 6.2.3 there's
- * only one namespace for struct, union, and enum tags, but the i915
- * driver wants a type called enum pipe.
- *
- * So rename it to avoid conflicts which confuse tools like ctfmerge --
- * but make sure we include <sys/file.h> first to avoid having two
- * different versions of struct file, one with a pointer to struct pipe
- * and another with a pointer to struct i915_pipe.
- *
- * This will cause trouble if we ever have an API that involves `pipe'
- * as a member which we need to reference from within drm code.  But
- * for now that is not the case.
- *
- * XXX Yes, this is disgusting.  Sorry.
- */
-#include <sys/file.h>
-#define	pipe	pipe_drmhack
-/*
  * Keep the pipe enum values fixed: the code assumes that PIPE_A=0, the
  * rest have consecutive values and match the enum values of transcoders
  * with a 1:1 transcoder -> pipe mapping.

Index: src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c:1.3 src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c:1.3	Sun Dec 19 11:03:57 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_breadcrumbs.c,v 1.3 2021/12/19 11:03:57 riastradh Exp $	*/
+/*	$NetBSD: intel_breadcrumbs.c,v 1.4 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*
  * Copyright © 2015 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_breadcrumbs.c,v 1.3 2021/12/19 11:03:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_breadcrumbs.c,v 1.4 2021/12/19 11:38:04 riastradh Exp $");
 
 #include <linux/kthread.h>
 #include <trace/events/dma_fence.h>
@@ -36,6 +36,8 @@ __KERNEL_RCSID(0, "$NetBSD: intel_breadc
 #include "intel_gt_pm.h"
 #include "intel_gt_requests.h"
 
+#include <linux/nbsd-namespace.h>
+
 static void irq_enable(struct intel_engine_cs *engine)
 {
 	if (!engine->irq_enable)
@@ -380,8 +382,9 @@ void intel_engine_print_breadcrumbs(stru
 	spin_lock_irq(&b->irq_lock);
 	list_for_each_entry(ce, &b->signalers, signal_link) {
 		list_for_each_entry(rq, &ce->signals, signal_link) {
-			drm_printf(p, "\t[%llx:%llx%s] @ %dms\n",
-				   rq->fence.context, rq->fence.seqno,
+			drm_printf(p, "\t[%"PRIx64":%"PRIx64"%s] @ %dms\n",
+				   (uint64_t)rq->fence.context,
+				   (uint64_t)rq->fence.seqno,
 				   i915_request_completed(rq) ? "!" :
 				   i915_request_started(rq) ? "*" :
 				   "",

Index: src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c:1.2 src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_context.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_context.c,v 1.3 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_context.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_context.c,v 1.3 2021/12/19 11:38:04 riastradh Exp $");
 
 #include "gem/i915_gem_context.h"
 #include "gem/i915_gem_pm.h"
@@ -20,6 +20,8 @@ __KERNEL_RCSID(0, "$NetBSD: intel_contex
 #include "intel_engine_pm.h"
 #include "intel_ring.h"
 
+#include <linux/nbsd-namespace.h>
+
 static struct i915_global_context {
 	struct i915_global base;
 	struct kmem_cache *slab_ce;

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.73 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.74
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.73	Sun Dec 19 11:37:41 2021
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.73 2021/12/19 11:37:41 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.74 2021/12/19 11:38:04 riastradh Exp $
 
 version	20180827
 
@@ -54,6 +54,7 @@ file	external/bsd/drm2/i915drm/i915_pci_
 file	external/bsd/drm2/i915drm/i915_perf.c	i915drmkms
 file	external/bsd/drm2/i915drm/i915_sysfs.c	i915drmkms
 file	external/bsd/drm2/i915drm/i915_switcheroo.c	i915drmkms
+file	external/bsd/drm2/i915drm/icl_dsi.c		i915drmkms
 file	external/bsd/drm2/i915drm/intel_gtt.c		i915drmkms
 file	external/bsd/drm2/i915drm/intelfb.c		intelfb
 file	external/bsd/drm2/i915drm/vlv_dsi.c	i915drmkms
@@ -65,7 +66,7 @@ file	external/bsd/drm2/dist/drm/i915/dis
 file	external/bsd/drm2/dist/drm/i915/display/dvo_ns2501.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/display/dvo_sil164.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/display/dvo_tfp410.c	i915drmkms
-file	external/bsd/drm2/dist/drm/i915/display/icl_dsi.c	i915drmkms
+#file	external/bsd/drm2/dist/drm/i915/display/icl_dsi.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/display/intel_acpi.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/display/intel_atomic.c	i915drmkms
 file	external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c	i915drmkms

Index: src/sys/external/bsd/drm2/i915drm/vlv_dsi.c
diff -u src/sys/external/bsd/drm2/i915drm/vlv_dsi.c:1.1 src/sys/external/bsd/drm2/i915drm/vlv_dsi.c:1.2
--- src/sys/external/bsd/drm2/i915drm/vlv_dsi.c:1.1	Sun Dec 19 00:57:42 2021
+++ src/sys/external/bsd/drm2/i915drm/vlv_dsi.c	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vlv_dsi.c,v 1.1 2021/12/19 00:57:42 riastradh Exp $	*/
+/*	$NetBSD: vlv_dsi.c,v 1.2 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,9 +30,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vlv_dsi.c,v 1.1 2021/12/19 00:57:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vlv_dsi.c,v 1.2 2021/12/19 11:38:04 riastradh Exp $");
 
-#include "intel_drv.h"
+#include "display/intel_dsi.h"
 
 void
 vlv_dsi_init(struct drm_i915_private *dev_priv)

Index: src/sys/external/bsd/drm2/include/i915_trace.h
diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.19 src/sys/external/bsd/drm2/include/i915_trace.h:1.20
--- src/sys/external/bsd/drm2/include/i915_trace.h:1.19	Sun Dec 19 11:36:17 2021
+++ src/sys/external/bsd/drm2/include/i915_trace.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_trace.h,v 1.19 2021/12/19 11:36:17 riastradh Exp $	*/
+/*	$NetBSD: i915_trace.h,v 1.20 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -474,4 +474,42 @@ trace_i915_pipe_update_end(struct intel_
 	TRACE3(i915,, pipe__update__end,  crtc->pipe, frame, scanline);
 }
 
+DEFINE_TRACE2(i915,, update__plane,
+    "struct drm_plane *"/*plane*/,
+    "struct intel_crtc *"/*crtc*/);
+
+static inline void
+trace_intel_update_plane(struct drm_plane *plane, struct intel_crtc *crtc)
+{
+	TRACE2(i915,, update__plane,  plane, crtc);
+}
+
+DEFINE_TRACE2(i915,, disable__plane,
+    "struct drm_plane *"/*plane*/,
+    "struct intel_crtc *"/*crtc*/);
+
+static inline void
+trace_intel_disable_plane(struct drm_plane *plane, struct intel_crtc *crtc)
+{
+	TRACE2(i915,, disable__plane,  plane, crtc);
+}
+
+DEFINE_TRACE1(i915,, pipe__enable,
+    "struct intel_crtc *"/*crtc*/);
+
+static inline void
+trace_intel_pipe_enable(struct intel_crtc *crtc)
+{
+	TRACE1(i915,, pipe__enable,  crtc);
+}
+
+DEFINE_TRACE1(i915,, pipe__disable,
+    "struct intel_crtc *"/*crtc*/);
+
+static inline void
+trace_intel_pipe_disable(struct intel_crtc *crtc)
+{
+	TRACE1(i915,, pipe__disable,  crtc);
+}
+
 #endif  /* _I915_TRACE_H_ */

Index: src/sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h:1.1 src/sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h:1.2
--- src/sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h:1.1	Mon Aug 27 06:33:57 2018
+++ src/sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_mipi_dsi.h,v 1.1 2018/08/27 06:33:57 riastradh Exp $	*/
+/*	$NetBSD: drm_mipi_dsi.h,v 1.2 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,4 +32,14 @@
 #ifndef _DRM_MIPI_DSI_H_
 #define _DRM_MIPI_DSI_H_
 
+struct mipi_dsi_host_ops;
+
+enum mipi_dsi_pixel_format {
+	MIPI_DSI_PIXEL_NFORMATS,
+};
+
+struct mipi_dsi_host {
+	char dummy;
+};
+
 #endif /*_DRM_MIPI_DSI_H_*/

Index: src/sys/external/bsd/drm2/include/linux/acpi.h
diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.5 src/sys/external/bsd/drm2/include/linux/acpi.h:1.6
--- src/sys/external/bsd/drm2/include/linux/acpi.h:1.5	Sat Jan 18 03:00:04 2020
+++ src/sys/external/bsd/drm2/include/linux/acpi.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.h,v 1.5 2020/01/18 03:00:04 jmcneill Exp $	*/
+/*	$NetBSD: acpi.h,v 1.6 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -44,4 +44,6 @@
 #include <dev/acpi/acpivar.h>
 #endif
 
+#include <linux/uuid.h>
+
 #endif  /* _LINUX_ACPI_H_ */
Index: src/sys/external/bsd/drm2/include/linux/scatterlist.h
diff -u src/sys/external/bsd/drm2/include/linux/scatterlist.h:1.5 src/sys/external/bsd/drm2/include/linux/scatterlist.h:1.6
--- src/sys/external/bsd/drm2/include/linux/scatterlist.h:1.5	Sun Dec 19 11:33:49 2021
+++ src/sys/external/bsd/drm2/include/linux/scatterlist.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: scatterlist.h,v 1.5 2021/12/19 11:33:49 riastradh Exp $	*/
+/*	$NetBSD: scatterlist.h,v 1.6 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -48,6 +48,8 @@
 #define	sg_alloc_table			linux_sg_alloc_table
 #define	sg_alloc_table_from_bus_dmamem	linux_sg_alloc_table_from_bus_dmamem
 #define	sg_alloc_table_from_pages	linux_sg_alloc_table_from_pages
+#define	sg_dma_address			linux_sg_dma_address
+#define	sg_dma_len			linux_sg_dma_len
 #define	sg_free_table			linux_sg_free_table
 
 struct page;
@@ -70,6 +72,9 @@ int sg_alloc_table_from_bus_dmamem(struc
     const bus_dma_segment_t *, int, gfp_t);
 void sg_free_table(struct sg_table *);
 
+bus_addr_t sg_dma_address(const struct scatterlist *);
+bus_size_t sg_dma_len(const struct scatterlist *);
+
 int dma_map_sg(bus_dma_tag_t, struct scatterlist *, int, int);
 int dma_map_sg_attrs(bus_dma_tag_t, struct scatterlist *, int, int, int);
 void dma_unmap_sg(bus_dma_tag_t, struct scatterlist *, int, int);

Index: src/sys/external/bsd/drm2/include/linux/bitfield.h
diff -u src/sys/external/bsd/drm2/include/linux/bitfield.h:1.1 src/sys/external/bsd/drm2/include/linux/bitfield.h:1.2
--- src/sys/external/bsd/drm2/include/linux/bitfield.h:1.1	Sun Dec 19 01:53:29 2021
+++ src/sys/external/bsd/drm2/include/linux/bitfield.h	Sun Dec 19 11:38:04 2021
@@ -0,0 +1,38 @@
+/*	$NetBSD: bitfield.h,v 1.2 2021/12/19 11:38:04 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINUX_BITFIELD_H_
+#define _LINUX_BITFIELD_H_
+
+#include <sys/cdefs.h>
+
+#define	FIELD_GET(MASK, VAR)	__SHIFTOUT(VAR, MASK)
+
+#define	__bf_shf(X)		(__builtin_ffsll(X) - 1)
+
+#endif  /* _LINUX_BITFIELD_H_ */

Index: src/sys/external/bsd/drm2/include/linux/hdmi.h
diff -u src/sys/external/bsd/drm2/include/linux/hdmi.h:1.9 src/sys/external/bsd/drm2/include/linux/hdmi.h:1.10
--- src/sys/external/bsd/drm2/include/linux/hdmi.h:1.9	Sun Dec 19 09:46:24 2021
+++ src/sys/external/bsd/drm2/include/linux/hdmi.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdmi.h,v 1.9 2021/12/19 09:46:24 riastradh Exp $	*/
+/*	$NetBSD: hdmi.h,v 1.10 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -166,11 +166,26 @@ enum hdmi_ycc_quantization_range {
 	HDMI_YCC_QUANTIZATION_RANGE_FULL	= 1,
 };
 
+enum hdmi_packet_type {
+        HDMI_PACKET_TYPE_NULL = 0x00,
+        HDMI_PACKET_TYPE_AUDIO_CLOCK_REGEN	= 0x01,
+        HDMI_PACKET_TYPE_AUDIO_SAMPLE		= 0x02,
+        HDMI_PACKET_TYPE_GENERAL_CONTROL	= 0x03,
+        HDMI_PACKET_TYPE_ACP			= 0x04,
+        HDMI_PACKET_TYPE_ISRC1			= 0x05,
+        HDMI_PACKET_TYPE_ISRC2			= 0x06,
+        HDMI_PACKET_TYPE_ONE_BIT_AUDIO_SAMPLE	= 0x07,
+        HDMI_PACKET_TYPE_DST_AUDIO		= 0x08,
+        HDMI_PACKET_TYPE_HBR_AUDIO_STREAM	= 0x09,
+        HDMI_PACKET_TYPE_GAMUT_METADATA		= 0x0a,
+};
+
 enum hdmi_infoframe_type {
 	HDMI_INFOFRAME_TYPE_VENDOR		= 0x81,
 	HDMI_INFOFRAME_TYPE_AVI			= 0x82,
 	HDMI_INFOFRAME_TYPE_SPD			= 0x83,
 	HDMI_INFOFRAME_TYPE_AUDIO		= 0x84,
+	HDMI_INFOFRAME_TYPE_DRM			= 0x87,
 };
 
 enum hdmi_eotf {
@@ -599,4 +614,11 @@ hdmi_drm_infoframe_init(struct hdmi_drm_
 	return 0;
 }
 
+static inline void
+hdmi_infoframe_log(const char *level, struct device *device,
+    const union hdmi_infoframe *frame)
+{
+	/* XXX */
+}
+
 #endif	/* _LINUX_HDMI_H_ */

Index: src/sys/external/bsd/drm2/include/linux/ktime.h
diff -u src/sys/external/bsd/drm2/include/linux/ktime.h:1.16 src/sys/external/bsd/drm2/include/linux/ktime.h:1.17
--- src/sys/external/bsd/drm2/include/linux/ktime.h:1.16	Sun Dec 19 11:33:49 2021
+++ src/sys/external/bsd/drm2/include/linux/ktime.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ktime.h,v 1.16 2021/12/19 11:33:49 riastradh Exp $	*/
+/*	$NetBSD: ktime.h,v 1.17 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -132,6 +132,13 @@ ktime_get_real(void)
 }
 
 static inline ktime_t
+ktime_get_boottime(void)
+{
+	/* XXX include time spent in suspend */
+	return ktime_get();
+}
+
+static inline ktime_t
 ktime_get_raw(void)
 {
 	/* XXX */

Index: src/sys/external/bsd/drm2/include/linux/pci.h
diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.48 src/sys/external/bsd/drm2/include/linux/pci.h:1.49
--- src/sys/external/bsd/drm2/include/linux/pci.h:1.48	Sun Dec 19 11:09:47 2021
+++ src/sys/external/bsd/drm2/include/linux/pci.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.h,v 1.48 2021/12/19 11:09:47 riastradh Exp $	*/
+/*	$NetBSD: pci.h,v 1.49 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -84,6 +84,10 @@ struct pci_device_id {
 	unsigned long	driver_data;
 };
 
+#define	PCI_DEVICE(VENDOR, DEVICE)					      \
+	.vendor = (VENDOR),						      \
+	.device = (DEVICE)
+
 #define	PCI_ANY_ID		(~0)
 
 #define	PCI_BASE_CLASS_DISPLAY	PCI_CLASS_DISPLAY
@@ -196,6 +200,7 @@ enum pci_bus_speed {
 #define	pci_bus_write_config_word	linux_pci_bus_write_config_word
 #define	pci_clear_master		linux_pci_clear_master
 #define	pci_dev_dev			linux_pci_dev_dev
+#define	pci_dev_present			linux_pci_dev_present
 #define	pci_dev_put			linux_pci_dev_put
 #define	pci_disable_msi			linux_pci_disable_msi
 #define	pci_disable_rom			linux_pci_disable_rom
@@ -287,6 +292,7 @@ int		pci_bus_alloc_resource(struct pci_b
 /* XXX Kludges only -- do not use without checking the implementation!  */
 struct pci_dev *pci_get_domain_bus_and_slot(int, int, int);
 struct pci_dev *pci_get_class(uint32_t, struct pci_dev *); /* i915 kludge */
+int		pci_dev_present(const struct pci_device_id *);
 void		pci_dev_put(struct pci_dev *);
 
 void __pci_rom_iomem *

Index: src/sys/external/bsd/drm2/include/linux/smp.h
diff -u src/sys/external/bsd/drm2/include/linux/smp.h:1.2 src/sys/external/bsd/drm2/include/linux/smp.h:1.3
--- src/sys/external/bsd/drm2/include/linux/smp.h:1.2	Sun Dec 19 09:58:50 2021
+++ src/sys/external/bsd/drm2/include/linux/smp.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: smp.h,v 1.2 2021/12/19 09:58:50 riastradh Exp $	*/
+/*	$NetBSD: smp.h,v 1.3 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,6 +35,8 @@
 #include <sys/systm.h>
 #include <sys/cpu.h>
 
+#define	smp_processor_id()	cpu_number()
+
 static inline int
 get_cpu(void)
 {

Index: src/sys/external/bsd/drm2/include/linux/uuid.h
diff -u src/sys/external/bsd/drm2/include/linux/uuid.h:1.3 src/sys/external/bsd/drm2/include/linux/uuid.h:1.4
--- src/sys/external/bsd/drm2/include/linux/uuid.h:1.3	Sun Dec 19 11:36:57 2021
+++ src/sys/external/bsd/drm2/include/linux/uuid.h	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uuid.h,v 1.3 2021/12/19 11:36:57 riastradh Exp $	*/
+/*	$NetBSD: uuid.h,v 1.4 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,32 @@
 #ifndef _LINUX_UUID_H_
 #define _LINUX_UUID_H_
 
+typedef struct {
+	unsigned char guid_bytes[16];
+} guid_t;
+
+#define	GUID_INIT(x, y, z, v0, v1, v2, v3, v4, v5, v6, v7) ((guid_t)	      \
+{									      \
+	.guid_bytes = {							      \
+		[0] = (x) & 0xff,					      \
+		[1] = ((x) >> 8) & 0xff,				      \
+		[2] = ((x) >> 16) & 0xff,				      \
+		[3] = ((x) >> 24) & 0xff,				      \
+		[4] = (y) & 0xff,					      \
+		[5] = ((y) >> 8) & 0xff,				      \
+		[6] = (z) & 0xff,					      \
+		[7] = ((z) >> 8) & 0xff,				      \
+		[8] = (v0),						      \
+		[9] = (v1),						      \
+		[10] = (v2),						      \
+		[11] = (v3),						      \
+		[12] = (v4),						      \
+		[13] = (v5),						      \
+		[14] = (v6),						      \
+		[15] = (v7),						      \
+	}								      \
+})
+
 #define	UUID_STRING_LEN		36
 
 static inline int

Index: src/sys/external/bsd/drm2/linux/linux_pci.c
diff -u src/sys/external/bsd/drm2/linux/linux_pci.c:1.18 src/sys/external/bsd/drm2/linux/linux_pci.c:1.19
--- src/sys/external/bsd/drm2/linux/linux_pci.c:1.18	Sun Dec 19 11:09:48 2021
+++ src/sys/external/bsd/drm2/linux/linux_pci.c	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pci.c,v 1.18 2021/12/19 11:09:48 riastradh Exp $	*/
+/*	$NetBSD: linux_pci.c,v 1.19 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_pci.c,v 1.18 2021/12/19 11:09:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pci.c,v 1.19 2021/12/19 11:38:04 riastradh Exp $");
 
 #if NACPICA > 0
 #include <dev/acpi/acpivar.h>
@@ -449,6 +449,14 @@ pci_get_class(uint32_t class_subclass_sh
 	return pdev;
 }
 
+int
+pci_dev_present(const struct pci_device_id *ids)
+{
+
+	/* XXX implement me -- pci_find_device doesn't pass a cookie */
+	return 0;
+}
+
 void
 pci_unmap_rom(struct pci_dev *pdev, void __pci_rom_iomem *vaddr __unused)
 {

Index: src/sys/external/bsd/drm2/linux/linux_sg.c
diff -u src/sys/external/bsd/drm2/linux/linux_sg.c:1.2 src/sys/external/bsd/drm2/linux/linux_sg.c:1.3
--- src/sys/external/bsd/drm2/linux/linux_sg.c:1.2	Sun Dec 19 11:33:50 2021
+++ src/sys/external/bsd/drm2/linux/linux_sg.c	Sun Dec 19 11:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sg.c,v 1.2 2021/12/19 11:33:50 riastradh Exp $	*/
+/*	$NetBSD: linux_sg.c,v 1.3 2021/12/19 11:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.2 2021/12/19 11:33:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.3 2021/12/19 11:38:04 riastradh Exp $");
 
 #include <sys/bus.h>
 #include <sys/errno.h>
@@ -195,3 +195,19 @@ dma_unmap_sg_attrs(bus_dma_tag_t dmat, s
 	bus_dmamap_destroy(dmat, sg->sg_dmamap);
 	sg->sg_dmamap = NULL;
 }
+
+bus_addr_t
+sg_dma_address(const struct scatterlist *sg)
+{
+
+	KASSERT(sg->sg_dmamap->dm_nsegs == 1);
+	return sg->sg_dmamap->dm_segs[0].ds_addr;
+}
+
+bus_size_t
+sg_dma_len(const struct scatterlist *sg)
+{
+
+	KASSERT(sg->sg_dmamap->dm_nsegs == 1);
+	return sg->sg_dmamap->dm_segs[0].ds_len;
+}

Reply via email to