Mon Aug 27 06:16:01 2018 UTC ()
provide enum irqreturn

merge in old ifdefs
ifdef out code that I'm unsure about right away and turn into panic
call.

Author: coypu <coypu@sdf.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>


(riastradh)
diff -r1.16 -r1.17 src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c
diff -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c
diff -r1.4 -r1.5 src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h

cvs diff -r1.16 -r1.17 src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_display.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_display.c 2018/08/27 04:58:24 1.16
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_display.c 2018/08/27 06:16:01 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intel_display.c,v 1.16 2018/08/27 04:58:24 riastradh Exp $ */ 1/* $NetBSD: intel_display.c,v 1.17 2018/08/27 06:16:01 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2006-2007 Intel Corporation 4 * Copyright © 2006-2007 Intel Corporation
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the next 13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the 14 * paragraph) shall be included in all copies or substantial portions of the
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE. 23 * DEALINGS IN THE SOFTWARE.
24 * 24 *
25 * Authors: 25 * Authors:
26 * Eric Anholt <eric@anholt.net> 26 * Eric Anholt <eric@anholt.net>
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: intel_display.c,v 1.16 2018/08/27 04:58:24 riastradh Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: intel_display.c,v 1.17 2018/08/27 06:16:01 riastradh Exp $");
31 31
32#include <linux/dmi.h> 32#include <linux/dmi.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/input.h> 34#include <linux/input.h>
35#include <linux/i2c.h> 35#include <linux/i2c.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/vgaarb.h> 38#include <linux/vgaarb.h>
39#include <drm/drm_edid.h> 39#include <drm/drm_edid.h>
40#include <drm/drmP.h> 40#include <drm/drmP.h>
41#include "intel_drv.h" 41#include "intel_drv.h"
42#include <drm/i915_drm.h> 42#include <drm/i915_drm.h>
43#include "i915_drv.h" 43#include "i915_drv.h"
@@ -14760,27 +14760,31 @@ static void intel_init_display(struct dr @@ -14760,27 +14760,31 @@ static void intel_init_display(struct dr
14760 dev_priv->display.queue_flip = intel_gen6_queue_flip; 14760 dev_priv->display.queue_flip = intel_gen6_queue_flip;
14761 break; 14761 break;
14762 case 7: 14762 case 7:
14763 case 8: /* FIXME(BDW): Check that the gen8 RCS flip works. */ 14763 case 8: /* FIXME(BDW): Check that the gen8 RCS flip works. */
14764 dev_priv->display.queue_flip = intel_gen7_queue_flip; 14764 dev_priv->display.queue_flip = intel_gen7_queue_flip;
14765 break; 14765 break;
14766 case 9: 14766 case 9:
14767 /* Drop through - unsupported since execlist only. */ 14767 /* Drop through - unsupported since execlist only. */
14768 default: 14768 default:
14769 /* Default just returns -ENODEV to indicate unsupported */ 14769 /* Default just returns -ENODEV to indicate unsupported */
14770 dev_priv->display.queue_flip = intel_default_queue_flip; 14770 dev_priv->display.queue_flip = intel_default_queue_flip;
14771 } 14771 }
14772 14772
 14773#ifdef __NetBSD__
 14774 linux_mutex_init(&dev_priv->pps_mutex);
 14775#else
14773 mutex_init(&dev_priv->pps_mutex); 14776 mutex_init(&dev_priv->pps_mutex);
 14777#endif
14774} 14778}
14775 14779
14776/* 14780/*
14777 * Some BIOSes insist on assuming the GPU's pipe A is enabled at suspend, 14781 * Some BIOSes insist on assuming the GPU's pipe A is enabled at suspend,
14778 * resume, or other times. This quirk makes sure that's the case for 14782 * resume, or other times. This quirk makes sure that's the case for
14779 * affected systems. 14783 * affected systems.
14780 */ 14784 */
14781static void quirk_pipea_force(struct drm_device *dev) 14785static void quirk_pipea_force(struct drm_device *dev)
14782{ 14786{
14783 struct drm_i915_private *dev_priv = dev->dev_private; 14787 struct drm_i915_private *dev_priv = dev->dev_private;
14784 14788
14785 dev_priv->quirks |= QUIRK_PIPEA_FORCE; 14789 dev_priv->quirks |= QUIRK_PIPEA_FORCE;
14786 DRM_INFO("applying pipe a force quirk\n"); 14790 DRM_INFO("applying pipe a force quirk\n");
@@ -14968,26 +14972,27 @@ void i915_disable_vga(struct drm_device  @@ -14968,26 +14972,27 @@ void i915_disable_vga(struct drm_device
14968 (sr1 | __BIT(5))); 14972 (sr1 | __BIT(5)));
14969 bus_space_unmap(iot, ioh, 0x10); 14973 bus_space_unmap(iot, ioh, 0x10);
14970 } 14974 }
14971 } 14975 }
14972#else 14976#else
14973 /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */ 14977 /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
14974 vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO); 14978 vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
14975 outb(SR01, VGA_SR_INDEX); 14979 outb(SR01, VGA_SR_INDEX);
14976 sr1 = inb(VGA_SR_DATA); 14980 sr1 = inb(VGA_SR_DATA);
14977 outb(sr1 | 1<<5, VGA_SR_DATA); 14981 outb(sr1 | 1<<5, VGA_SR_DATA);
14978 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); 14982 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
14979#endif 14983#endif
14980 udelay(300); 14984 udelay(300);
 14985#endif
14981 14986
14982 I915_WRITE(vga_reg, VGA_DISP_DISABLE); 14987 I915_WRITE(vga_reg, VGA_DISP_DISABLE);
14983 POSTING_READ(vga_reg); 14988 POSTING_READ(vga_reg);
14984} 14989}
14985 14990
14986void intel_modeset_init_hw(struct drm_device *dev) 14991void intel_modeset_init_hw(struct drm_device *dev)
14987{ 14992{
14988 intel_update_cdclk(dev); 14993 intel_update_cdclk(dev);
14989 intel_prepare_ddi(dev); 14994 intel_prepare_ddi(dev);
14990 intel_init_clock_gating(dev); 14995 intel_init_clock_gating(dev);
14991 intel_enable_gt_powersave(dev); 14996 intel_enable_gt_powersave(dev);
14992} 14997}
14993 14998

cvs diff -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_dp.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_dp.c 2018/08/27 04:58:24 1.11
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_dp.c 2018/08/27 06:16:01 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intel_dp.c,v 1.11 2018/08/27 04:58:24 riastradh Exp $ */ 1/* $NetBSD: intel_dp.c,v 1.12 2018/08/27 06:16:01 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2008 Intel Corporation 4 * Copyright © 2008 Intel Corporation
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the next 13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the 14 * paragraph) shall be included in all copies or substantial portions of the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * IN THE SOFTWARE. 23 * IN THE SOFTWARE.
24 * 24 *
25 * Authors: 25 * Authors:
26 * Keith Packard <keithp@keithp.com> 26 * Keith Packard <keithp@keithp.com>
27 * 27 *
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.11 2018/08/27 04:58:24 riastradh Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.12 2018/08/27 06:16:01 riastradh Exp $");
32 32
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/export.h> 35#include <linux/export.h>
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/reboot.h> 37#include <linux/reboot.h>
38#include <linux/err.h> 38#include <linux/err.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/printk.h> 40#include <linux/printk.h>
41#include <linux/pm_qos.h> 41#include <linux/pm_qos.h>
42#include <drm/drmP.h> 42#include <drm/drmP.h>
43#include <drm/drm_atomic_helper.h> 43#include <drm/drm_atomic_helper.h>
44#include <drm/drm_crtc.h> 44#include <drm/drm_crtc.h>
@@ -569,26 +569,29 @@ static u32 _pp_stat_reg(struct intel_dp  @@ -569,26 +569,29 @@ static u32 _pp_stat_reg(struct intel_dp
569 if (IS_BROXTON(dev)) 569 if (IS_BROXTON(dev))
570 return BXT_PP_STATUS(0); 570 return BXT_PP_STATUS(0);
571 else if (HAS_PCH_SPLIT(dev)) 571 else if (HAS_PCH_SPLIT(dev))
572 return PCH_PP_STATUS; 572 return PCH_PP_STATUS;
573 else 573 else
574 return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); 574 return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp));
575} 575}
576 576
577/* Reboot notifier handler to shutdown panel power to guarantee T12 timing 577/* Reboot notifier handler to shutdown panel power to guarantee T12 timing
578 This function only applicable when panel PM state is not to be tracked */ 578 This function only applicable when panel PM state is not to be tracked */
579static int edp_notify_handler(struct notifier_block *this, unsigned long code, 579static int edp_notify_handler(struct notifier_block *this, unsigned long code,
580 void *unused) 580 void *unused)
581{ 581{
 582#ifdef __NetBSD__
 583 panic("XXX");
 584#else
582 struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp), 585 struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp),
583 edp_notifier); 586 edp_notifier);
584 struct drm_device *dev = intel_dp_to_dev(intel_dp); 587 struct drm_device *dev = intel_dp_to_dev(intel_dp);
585 struct drm_i915_private *dev_priv = dev->dev_private; 588 struct drm_i915_private *dev_priv = dev->dev_private;
586 589
587 if (!is_edp(intel_dp) || code != SYS_RESTART) 590 if (!is_edp(intel_dp) || code != SYS_RESTART)
588 return 0; 591 return 0;
589 592
590 pps_lock(intel_dp); 593 pps_lock(intel_dp);
591 594
592 if (IS_VALLEYVIEW(dev)) { 595 if (IS_VALLEYVIEW(dev)) {
593 enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); 596 enum pipe pipe = vlv_power_sequencer_pipe(intel_dp);
594 u32 pp_ctrl_reg, pp_div_reg; 597 u32 pp_ctrl_reg, pp_div_reg;
@@ -598,26 +601,27 @@ static int edp_notify_handler(struct not @@ -598,26 +601,27 @@ static int edp_notify_handler(struct not
598 pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe); 601 pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe);
599 pp_div = I915_READ(pp_div_reg); 602 pp_div = I915_READ(pp_div_reg);
600 pp_div &= PP_REFERENCE_DIVIDER_MASK; 603 pp_div &= PP_REFERENCE_DIVIDER_MASK;
601 604
602 /* 0x1F write to PP_DIV_REG sets max cycle delay */ 605 /* 0x1F write to PP_DIV_REG sets max cycle delay */
603 I915_WRITE(pp_div_reg, pp_div | 0x1F); 606 I915_WRITE(pp_div_reg, pp_div | 0x1F);
604 I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF); 607 I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF);
605 msleep(intel_dp->panel_power_cycle_delay); 608 msleep(intel_dp->panel_power_cycle_delay);
606 } 609 }
607 610
608 pps_unlock(intel_dp); 611 pps_unlock(intel_dp);
609 612
610 return 0; 613 return 0;
 614#endif
611} 615}
612 616
613static bool edp_have_panel_power(struct intel_dp *intel_dp) 617static bool edp_have_panel_power(struct intel_dp *intel_dp)
614{ 618{
615 struct drm_device *dev = intel_dp_to_dev(intel_dp); 619 struct drm_device *dev = intel_dp_to_dev(intel_dp);
616 struct drm_i915_private *dev_priv = dev->dev_private; 620 struct drm_i915_private *dev_priv = dev->dev_private;
617 621
618 lockdep_assert_held(&dev_priv->pps_mutex); 622 lockdep_assert_held(&dev_priv->pps_mutex);
619 623
620 if (IS_VALLEYVIEW(dev) && 624 if (IS_VALLEYVIEW(dev) &&
621 intel_dp->pps_pipe == INVALID_PIPE) 625 intel_dp->pps_pipe == INVALID_PIPE)
622 return false; 626 return false;
623 627

cvs diff -r1.4 -r1.5 src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h 2015/01/01 01:15:42 1.4
+++ src/sys/external/bsd/drm2/include/drm/drm_irq_netbsd.h 2018/08/27 06:16:01 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: drm_irq_netbsd.h,v 1.4 2015/01/01 01:15:42 mrg Exp $ */ 1/* $NetBSD: drm_irq_netbsd.h,v 1.5 2018/08/27 06:16:01 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,23 +24,25 @@ @@ -24,23 +24,25 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#ifndef _DRM_DRM_IRQ_NETBSD_H_ 32#ifndef _DRM_DRM_IRQ_NETBSD_H_
33#define _DRM_DRM_IRQ_NETBSD_H_ 33#define _DRM_DRM_IRQ_NETBSD_H_
34 34
35typedef int irqreturn_t; 35typedef int irqreturn_t;
36 36
37#define IRQ_NONE 0 37enum irqreturn {
38#define IRQ_HANDLED 1 38 IRQ_NONE = 0x0,
 39 IRQ_HANDLED = 0x1,
 40};
39 41
40#define DRM_IRQ_ARGS void *arg 42#define DRM_IRQ_ARGS void *arg
41 43
42#define IRQF_SHARED 0 /* XXX */ 44#define IRQF_SHARED 0 /* XXX */
43 45
44#define IPL_DRM IPL_TTY /* XXX */ 46#define IPL_DRM IPL_TTY /* XXX */
45 47
46#endif /* _DRM_DRM_IRQ_NETBSD_H_ */ 48#endif /* _DRM_DRM_IRQ_NETBSD_H_ */