Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: HEADS UP: Merging drm update
Better yet -- can you try the attached patch?
From e484fe666999730543f490ce6084486f7d7ce524 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Date: Fri, 24 Dec 2021 11:12:43 +0000
Subject: [PATCH] i915: Use AcpiOsMapMemory, not bus_space_map, for opregion.
Needed because this appears in firmware-type memory mappings, which
are excluded from bus_space_map.
XXX pullup-9 (via manual patch since the code has changed a bit)
---
.../dist/drm/i915/display/intel_opregion.c | 34 +++++--------------
.../dist/drm/i915/display/intel_opregion.h | 14 --------
2 files changed, 8 insertions(+), 40 deletions(-)
diff --git a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
index 4b0412828d49..b2f986bd74c0 100644
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
@@ -952,15 +952,7 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
INIT_WORK(&opregion->asle_work, asle_work);
#ifdef __NetBSD__
- opregion->bst = pdev->pd_pa.pa_memt;
- err = -bus_space_map(opregion->bst, asls, OPREGION_SIZE,
- BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_CACHEABLE,
- &opregion->asls_bsh);
- if (err) {
- DRM_DEBUG_DRIVER("Failed to map opregion: %d\n", err);
- return err;
- }
- base = bus_space_vaddr(opregion->bst, opregion->asls_bsh);
+ base = AcpiOsMapMemory(asls, OPREGION_SIZE);
#else
base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
#endif
@@ -1035,14 +1027,7 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
}
#ifdef __NetBSD__
- if (bus_space_map(opregion->bst, rvda,
- opregion->asle->rvds,
- BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_CACHEABLE,
- &opregion->rvda_bsh))
- opregion->rvda = NULL;
- else
- opregion->rvda = bus_space_vaddr(opregion->bst,
- opregion->rvda_bsh);
+ opregion->rvda = AcpiOsMapMemory(rvda, opregion->asle->rvds);
#else
opregion->rvda = memremap(rvda, opregion->asle->rvds,
MEMREMAP_WB);
@@ -1058,11 +1043,8 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
} else {
DRM_DEBUG_KMS("Invalid VBT in ACPI OpRegion (RVDA)\n");
#ifdef __NetBSD__
- if (opregion->rvda) {
- bus_space_unmap(opregion->bst,
- opregion->rvda_bsh,
- opregion->asle->rvds);
- }
+ AcpiOsUnmapMemory(opregion->rvda,
+ opregion->asle->rvds);
#else
memunmap(opregion->rvda);
#endif
@@ -1094,7 +1076,7 @@ out:
err_out:
#ifdef __NetBSD__
- bus_space_unmap(opregion->bst, opregion->asls_bsh, OPREGION_SIZE);
+ AcpiOsUnmapMemory(base, OPREGION_SIZE);
#else
memunmap(base);
#endif
@@ -1251,14 +1233,14 @@ void intel_opregion_unregister(struct drm_i915_private *i915)
/* just clear all opregion memory pointers now */
#ifdef __NetBSD__
- bus_space_unmap(opregion->bst, opregion->asls_bsh, OPREGION_SIZE);
+ size_t rvds = opregion->asle->rvds;
+ AcpiOsUnmapMemory(opregion->header, OPREGION_SIZE);
#else
memunmap(opregion->header);
#endif
if (opregion->rvda) {
#ifdef __NetBSD__
- bus_space_unmap(opregion->bst, opregion->rvda_bsh,
- opregion->asle->rvds);
+ AcpiOsUnmapMemory(opregion->rvda, rvds);
#else
memunmap(opregion->rvda);
#endif
diff --git a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
index a04f1c9d9f74..879c4135f670 100644
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
@@ -38,17 +38,7 @@ struct opregion_acpi;
struct opregion_swsci;
struct opregion_asle;
-#ifdef __NetBSD__ /* XXX acpi iomem */
-# include <linux/acpi_io.h>
-# define __iomem __acpi_iomem
-#endif
-
struct intel_opregion {
-#ifdef __NetBSD__
- bus_space_tag_t bst;
- bus_space_handle_t asls_bsh;
- bus_space_handle_t rvda_bsh;
-#endif
struct opregion_header *header;
struct opregion_acpi *acpi;
struct opregion_swsci *swsci;
@@ -66,10 +56,6 @@ struct intel_opregion {
#define OPREGION_SIZE (8 * 1024)
-#ifdef __NetBSD__ /* XXX acpi iomem */
-# undef __iomem
-#endif
-
#ifdef CONFIG_ACPI
int intel_opregion_setup(struct drm_i915_private *dev_priv);
Home |
Main Index |
Thread Index |
Old Index