Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915/display i915: Use AcpiOs...



details:   https://anonhg.NetBSD.org/src/rev/4e75bc6fd970
branches:  trunk
changeset: 1029172:4e75bc6fd970
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Dec 24 15:08:09 2021 +0000

description:
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)

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c |  38 +++--------
 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h |  16 +----
 2 files changed, 11 insertions(+), 43 deletions(-)

diffs (130 lines):

diff -r cdfd4b93280b -r 4e75bc6fd970 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c      Fri Dec 24 15:07:47 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c      Fri Dec 24 15:08:09 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_opregion.c,v 1.4 2021/12/19 11:49:11 riastradh Exp $     */
+/*     $NetBSD: intel_opregion.c,v 1.5 2021/12/24 15:08:09 riastradh Exp $     */
 
 /*
  * Copyright 2008 Intel Corporation <hong.liu%intel.com@localhost>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.4 2021/12/19 11:49:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.5 2021/12/24 15:08:09 riastradh Exp $");
 
 #include <linux/acpi.h>
 #include <linux/dmi.h>
@@ -952,15 +952,7 @@
        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 @@
                }
 
 #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 @@
                } 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 @@
 
 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 @@
 
        /* 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 -r cdfd4b93280b -r 4e75bc6fd970 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h      Fri Dec 24 15:07:47 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h      Fri Dec 24 15:08:09 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_opregion.h,v 1.3 2021/12/19 11:49:11 riastradh Exp $     */
+/*     $NetBSD: intel_opregion.h,v 1.4 2021/12/24 15:08:09 riastradh Exp $     */
 
 /*
  * Copyright © 2008-2017 Intel Corporation
@@ -38,17 +38,7 @@
 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 @@
 
 #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