NetBSD-Bugs archive

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

Re: kern/56562: drm update breaks Sandy Bridge display



The following reply was made to PR kern/56562; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: mlelstv%serpens.de@localhost
Subject: Re: kern/56562: drm update breaks Sandy Bridge display
Date: Fri, 24 Dec 2021 13:28:20 +0000

 This is a multi-part message in MIME format.
 --=_su1OON3HGWIM8fZuEZsawKeY4iHDSE1Z
 
 Can you try the attached patch and see if it makes a difference?
 
 --=_su1OON3HGWIM8fZuEZsawKeY4iHDSE1Z
 Content-Type: text/plain; charset="ISO-8859-1"; name="opregion"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="opregion.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);
 =20
  #ifdef __NetBSD__
 -	opregion->bst =3D pdev->pd_pa.pa_memt;
 -	err =3D -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 =3D bus_space_vaddr(opregion->bst, opregion->asls_bsh);
 +	base =3D AcpiOsMapMemory(asls, OPREGION_SIZE);
  #else
  	base =3D memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
  #endif
 @@ -1035,14 +1027,7 @@ int intel_opregion_setup(struct drm_i915_private *de=
 v_priv)
  		}
 =20
  #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 =3D NULL;
 -		else
 -			opregion->rvda =3D bus_space_vaddr(opregion->bst,
 -			    opregion->rvda_bsh);
 +		opregion->rvda =3D AcpiOsMapMemory(rvda, opregion->asle->rvds);
  #else
  		opregion->rvda =3D memremap(rvda, opregion->asle->rvds,
  					  MEMREMAP_WB);
 @@ -1058,11 +1043,8 @@ int intel_opregion_setup(struct drm_i915_private *de=
 v_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:
 =20
  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_priv=
 ate *i915)
 =20
  	/* just clear all opregion memory pointers now */
  #ifdef __NetBSD__
 -	bus_space_unmap(opregion->bst, opregion->asls_bsh, OPREGION_SIZE);
 +	size_t rvds =3D 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;
 =20
 -#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 {
 =20
  #define OPREGION_SIZE            (8 * 1024)
 =20
 -#ifdef __NetBSD__		/* XXX acpi iomem */
 -#  undef	__iomem
 -#endif
 -
  #ifdef CONFIG_ACPI
 =20
  int intel_opregion_setup(struct drm_i915_private *dev_priv);
 
 --=_su1OON3HGWIM8fZuEZsawKeY4iHDSE1Z--
 


Home | Main Index | Thread Index | Old Index