Module Name:    src
Committed By:   riastradh
Date:           Sun Sep  8 15:59:47 UTC 2013

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: intel_pm.c
        src/sys/modules/i915drm2 [riastradh-drm2]: Makefile
Removed Files:
        src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: intel_pm.c

Log Message:
Adapt intel_pm.c to NetBSD.  Drop stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
    src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
cvs rdiff -u -r1.1.2.5 -r0 src/sys/external/bsd/drm2/i915drm/intel_pm.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/modules/i915drm2/Makefile

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/drm2/dist/drm/i915/intel_pm.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.4 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.5
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.4	Sun Sep  8 15:58:53 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	Sun Sep  8 15:59:47 2013
@@ -2300,7 +2300,11 @@ err_unref:
 /**
  * Lock protecting IPS related data structures
  */
+#ifdef __NetBSD__
+spinlock_t mchdev_lock;
+#else
 DEFINE_SPINLOCK(mchdev_lock);
+#endif
 
 /* Global for IPS driver to get at the current i915 device. Protected by
  * mchdev_lock. */
@@ -2682,6 +2686,12 @@ static void gen6_update_ring_freq(struct
 
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
+#ifdef __NetBSD__		/* XXX cpufreq */
+	{
+		extern uint64_t tsc_freq; /* x86 TSC frequency in Hz */
+		max_ia_freq = (tsc_freq / 1000);
+	}
+#else
 	max_ia_freq = cpufreq_quick_get_max(0);
 	/*
 	 * Default to measured freq if none found, PCU will ensure we don't go
@@ -2689,6 +2699,7 @@ static void gen6_update_ring_freq(struct
 	 */
 	if (!max_ia_freq)
 		max_ia_freq = tsc_khz;
+#endif
 
 	/* Convert from kHz to MHz */
 	max_ia_freq /= 1000;
@@ -3190,6 +3201,7 @@ unsigned long i915_gfx_val(struct drm_i9
 	return val;
 }
 
+#ifndef __NetBSD__		/* XXX IPS */
 /**
  * i915_read_mch_val - return value for IPS use
  *
@@ -3329,6 +3341,7 @@ out_unlock:
 	return ret;
 }
 EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
+#endif
 
 /**
  * Tells the intel_ips driver that the i915 driver is now loaded, if
@@ -3354,6 +3367,14 @@ ips_ping_for_i915_load(void)
 
 void intel_gpu_ips_init(struct drm_i915_private *dev_priv)
 {
+#ifdef __NetBSD__		/* XXX */
+	/*
+	 * This seems as good a place as any to initialize mchdev_lock.
+	 * Taking the lock in the rest of this routine is silly, but...
+	 */
+	spin_lock_init(&mchdev_lock);
+#endif
+
 	/* We only register the i915 ips part with intel-ips once everything is
 	 * set up, to avoid intel-ips sneaking in and reading bogus values. */
 	spin_lock_irq(&mchdev_lock);
@@ -3368,6 +3389,9 @@ void intel_gpu_ips_teardown(void)
 	spin_lock_irq(&mchdev_lock);
 	i915_mch_dev = NULL;
 	spin_unlock_irq(&mchdev_lock);
+#ifdef __NetBSD__
+	spin_lock_destroy(&mchdev_lock);
+#endif
 }
 static void intel_init_emon(struct drm_device *dev)
 {

Index: src/sys/modules/i915drm2/Makefile
diff -u src/sys/modules/i915drm2/Makefile:1.1.2.9 src/sys/modules/i915drm2/Makefile:1.1.2.10
--- src/sys/modules/i915drm2/Makefile:1.1.2.9	Sun Sep  8 15:52:20 2013
+++ src/sys/modules/i915drm2/Makefile	Sun Sep  8 15:59:47 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.9 2013/09/08 15:52:20 riastradh Exp $
+# $NetBSD: Makefile,v 1.1.2.10 2013/09/08 15:59:47 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drm2/Makefile.inc"
@@ -57,4 +57,6 @@ SRCS+=	i915_module.c
 SRCS+=	i915_pci.c
 SRCS+=	intel_gtt.c
 
+COPTS.intel_pm.c+=	-Wno-shadow
+
 .include <bsd.kmodule.mk>

Reply via email to