2019-08-07 15:04:15 +03:00
// SPDX-License-Identifier: MIT
/*
* Copyright 2019 Intel Corporation .
*/
# include "i915_drv.h"
# include "intel_pch.h"
/* Map PCH device id to PCH type, or PCH_NONE if unknown. */
static enum intel_pch
intel_pch_type ( const struct drm_i915_private * dev_priv , unsigned short id )
{
switch ( id ) {
case INTEL_PCH_IBX_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Ibex Peak PCH \n " ) ;
2021-06-05 21:50:49 -07:00
drm_WARN_ON ( & dev_priv - > drm , GRAPHICS_VER ( dev_priv ) ! = 5 ) ;
2019-08-07 15:04:15 +03:00
return PCH_IBX ;
case INTEL_PCH_CPT_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found CougarPoint PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
2021-06-05 21:50:49 -07:00
GRAPHICS_VER ( dev_priv ) ! = 6 & & ! IS_IVYBRIDGE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_CPT ;
case INTEL_PCH_PPT_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found PantherPoint PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
2021-06-05 21:50:49 -07:00
GRAPHICS_VER ( dev_priv ) ! = 6 & & ! IS_IVYBRIDGE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
/* PantherPoint is CPT compatible */
return PCH_CPT ;
case INTEL_PCH_LPT_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found LynxPoint PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
! IS_HASWELL ( dev_priv ) & & ! IS_BROADWELL ( dev_priv ) ) ;
drm_WARN_ON ( & dev_priv - > drm ,
IS_HSW_ULT ( dev_priv ) | | IS_BDW_ULT ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_LPT ;
case INTEL_PCH_LPT_LP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found LynxPoint LP PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
! IS_HASWELL ( dev_priv ) & & ! IS_BROADWELL ( dev_priv ) ) ;
drm_WARN_ON ( & dev_priv - > drm ,
! IS_HSW_ULT ( dev_priv ) & & ! IS_BDW_ULT ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_LPT ;
case INTEL_PCH_WPT_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found WildcatPoint PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
! IS_HASWELL ( dev_priv ) & & ! IS_BROADWELL ( dev_priv ) ) ;
drm_WARN_ON ( & dev_priv - > drm ,
IS_HSW_ULT ( dev_priv ) | | IS_BDW_ULT ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
/* WildcatPoint is LPT compatible */
return PCH_LPT ;
case INTEL_PCH_WPT_LP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found WildcatPoint LP PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
! IS_HASWELL ( dev_priv ) & & ! IS_BROADWELL ( dev_priv ) ) ;
drm_WARN_ON ( & dev_priv - > drm ,
! IS_HSW_ULT ( dev_priv ) & & ! IS_BDW_ULT ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
/* WildcatPoint is LPT compatible */
return PCH_LPT ;
case INTEL_PCH_SPT_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found SunrisePoint PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
! IS_SKYLAKE ( dev_priv ) & & ! IS_KABYLAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_SPT ;
case INTEL_PCH_SPT_LP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found SunrisePoint LP PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
2020-06-02 15:05:40 +01:00
! IS_SKYLAKE ( dev_priv ) & &
! IS_KABYLAKE ( dev_priv ) & &
! IS_COFFEELAKE ( dev_priv ) & &
! IS_COMETLAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_SPT ;
case INTEL_PCH_KBP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Kaby Lake PCH (KBP) \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm ,
2020-06-02 15:05:40 +01:00
! IS_SKYLAKE ( dev_priv ) & &
! IS_KABYLAKE ( dev_priv ) & &
! IS_COFFEELAKE ( dev_priv ) & &
! IS_COMETLAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
/* KBP is SPT compatible */
return PCH_SPT ;
case INTEL_PCH_CNP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Cannon Lake PCH (CNP) \n " ) ;
2020-06-02 15:05:40 +01:00
drm_WARN_ON ( & dev_priv - > drm ,
! IS_COFFEELAKE ( dev_priv ) & &
! IS_COMETLAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_CNP ;
case INTEL_PCH_CNP_LP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm ,
" Found Cannon Lake LP PCH (CNP-LP) \n " ) ;
2020-06-02 15:05:40 +01:00
drm_WARN_ON ( & dev_priv - > drm ,
! IS_COFFEELAKE ( dev_priv ) & &
! IS_COMETLAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_CNP ;
case INTEL_PCH_CMP_DEVICE_ID_TYPE :
2019-09-16 16:32:51 -07:00
case INTEL_PCH_CMP2_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Comet Lake PCH (CMP) \n " ) ;
2020-06-02 15:05:40 +01:00
drm_WARN_ON ( & dev_priv - > drm ,
! IS_COFFEELAKE ( dev_priv ) & &
! IS_COMETLAKE ( dev_priv ) & &
2020-05-04 15:52:10 -07:00
! IS_ROCKETLAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
/* CometPoint is CNP Compatible */
return PCH_CNP ;
2019-11-12 12:46:08 +02:00
case INTEL_PCH_CMP_V_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Comet Lake V PCH (CMP-V) \n " ) ;
2020-06-02 15:05:40 +01:00
drm_WARN_ON ( & dev_priv - > drm ,
! IS_COFFEELAKE ( dev_priv ) & &
! IS_COMETLAKE ( dev_priv ) ) ;
2019-11-12 12:46:08 +02:00
/* Comet Lake V PCH is based on KBP, which is SPT compatible */
return PCH_SPT ;
2019-08-07 15:04:15 +03:00
case INTEL_PCH_ICP_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Ice Lake PCH \n " ) ;
drm/i915: Make WARN* drm specific where drm_priv ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
command: ls drivers/gpu/drm/i915/*.c | xargs spatch --sp-file \
<script> --linux-spacing --in-place
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200115034455.17658-10-pankaj.laxminarayan.bharadiya@intel.com
2020-01-15 09:14:53 +05:30
drm_WARN_ON ( & dev_priv - > drm , ! IS_ICELAKE ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_ICP ;
case INTEL_PCH_MCC_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Mule Creek Canyon PCH \n " ) ;
2020-10-14 00:59:48 +05:30
drm_WARN_ON ( & dev_priv - > drm , ! IS_JSL_EHL ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_MCC ;
case INTEL_PCH_TGP_DEVICE_ID_TYPE :
2019-11-05 16:55:26 -08:00
case INTEL_PCH_TGP2_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Tiger Lake LP PCH \n " ) ;
2020-05-04 15:52:10 -07:00
drm_WARN_ON ( & dev_priv - > drm , ! IS_TIGERLAKE ( dev_priv ) & &
2021-02-09 14:13:05 -05:00
! IS_ROCKETLAKE ( dev_priv ) & &
! IS_GEN9_BC ( dev_priv ) ) ;
2019-08-07 15:04:15 +03:00
return PCH_TGP ;
2019-10-15 09:28:54 -07:00
case INTEL_PCH_JSP_DEVICE_ID_TYPE :
case INTEL_PCH_JSP2_DEVICE_ID_TYPE :
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Found Jasper Lake PCH \n " ) ;
2020-10-14 00:59:48 +05:30
drm_WARN_ON ( & dev_priv - > drm , ! IS_JSL_EHL ( dev_priv ) ) ;
2019-10-15 09:28:54 -07:00
return PCH_JSP ;
2021-01-25 06:07:45 -08:00
case INTEL_PCH_ADP_DEVICE_ID_TYPE :
2021-05-11 21:21:43 -07:00
case INTEL_PCH_ADP2_DEVICE_ID_TYPE :
2021-12-02 22:35:44 -08:00
case INTEL_PCH_ADP3_DEVICE_ID_TYPE :
2021-01-25 06:07:45 -08:00
drm_dbg_kms ( & dev_priv - > drm , " Found Alder Lake PCH \n " ) ;
2021-05-11 21:21:43 -07:00
drm_WARN_ON ( & dev_priv - > drm , ! IS_ALDERLAKE_S ( dev_priv ) & &
! IS_ALDERLAKE_P ( dev_priv ) ) ;
2021-01-25 06:07:45 -08:00
return PCH_ADP ;
2019-08-07 15:04:15 +03:00
default :
return PCH_NONE ;
}
}
static bool intel_is_virt_pch ( unsigned short id ,
unsigned short svendor , unsigned short sdevice )
{
return ( id = = INTEL_PCH_P2X_DEVICE_ID_TYPE | |
id = = INTEL_PCH_P3X_DEVICE_ID_TYPE | |
( id = = INTEL_PCH_QEMU_DEVICE_ID_TYPE & &
svendor = = PCI_SUBVENDOR_ID_REDHAT_QUMRANET & &
sdevice = = PCI_SUBDEVICE_ID_QEMU ) ) ;
}
2021-01-14 08:58:19 +08:00
static void
intel_virt_detect_pch ( const struct drm_i915_private * dev_priv ,
unsigned short * pch_id , enum intel_pch * pch_type )
2019-08-07 15:04:15 +03:00
{
unsigned short id = 0 ;
/*
* In a virtualized passthrough environment we can be in a
* setup where the ISA bridge is not able to be passed through .
* In this case , a south bridge can be emulated and we have to
* make an educated guess as to which PCH is really there .
*/
2021-05-11 21:21:43 -07:00
if ( IS_ALDERLAKE_S ( dev_priv ) | | IS_ALDERLAKE_P ( dev_priv ) )
2021-01-25 06:07:45 -08:00
id = INTEL_PCH_ADP_DEVICE_ID_TYPE ;
else if ( IS_TIGERLAKE ( dev_priv ) | | IS_ROCKETLAKE ( dev_priv ) )
2019-08-07 15:04:15 +03:00
id = INTEL_PCH_TGP_DEVICE_ID_TYPE ;
2020-10-14 00:59:48 +05:30
else if ( IS_JSL_EHL ( dev_priv ) )
2019-08-07 15:04:15 +03:00
id = INTEL_PCH_MCC_DEVICE_ID_TYPE ;
else if ( IS_ICELAKE ( dev_priv ) )
id = INTEL_PCH_ICP_DEVICE_ID_TYPE ;
2021-07-28 14:59:39 -07:00
else if ( IS_COFFEELAKE ( dev_priv ) | |
2020-06-02 15:05:40 +01:00
IS_COMETLAKE ( dev_priv ) )
2019-08-07 15:04:15 +03:00
id = INTEL_PCH_CNP_DEVICE_ID_TYPE ;
else if ( IS_KABYLAKE ( dev_priv ) | | IS_SKYLAKE ( dev_priv ) )
id = INTEL_PCH_SPT_DEVICE_ID_TYPE ;
else if ( IS_HSW_ULT ( dev_priv ) | | IS_BDW_ULT ( dev_priv ) )
id = INTEL_PCH_LPT_LP_DEVICE_ID_TYPE ;
else if ( IS_HASWELL ( dev_priv ) | | IS_BROADWELL ( dev_priv ) )
id = INTEL_PCH_LPT_DEVICE_ID_TYPE ;
2021-06-05 21:50:49 -07:00
else if ( GRAPHICS_VER ( dev_priv ) = = 6 | | IS_IVYBRIDGE ( dev_priv ) )
2019-08-07 15:04:15 +03:00
id = INTEL_PCH_CPT_DEVICE_ID_TYPE ;
2021-06-05 21:50:49 -07:00
else if ( GRAPHICS_VER ( dev_priv ) = = 5 )
2019-08-07 15:04:15 +03:00
id = INTEL_PCH_IBX_DEVICE_ID_TYPE ;
if ( id )
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Assuming PCH ID %04x \n " , id ) ;
2019-08-07 15:04:15 +03:00
else
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm , " Assuming no PCH \n " ) ;
2019-08-07 15:04:15 +03:00
2021-01-14 08:58:19 +08:00
* pch_type = intel_pch_type ( dev_priv , id ) ;
/* Sanity check virtual PCH id */
if ( drm_WARN_ON ( & dev_priv - > drm ,
id & & * pch_type = = PCH_NONE ) )
id = 0 ;
* pch_id = id ;
2019-08-07 15:04:15 +03:00
}
void intel_detect_pch ( struct drm_i915_private * dev_priv )
{
struct pci_dev * pch = NULL ;
2021-01-14 08:58:19 +08:00
unsigned short id ;
enum intel_pch pch_type ;
2019-08-07 15:04:15 +03:00
2020-07-13 11:23:21 -07:00
/* DG1 has south engine display on the same PCI device */
if ( IS_DG1 ( dev_priv ) ) {
dev_priv - > pch_type = PCH_DG1 ;
return ;
2021-07-21 15:30:35 -07:00
} else if ( IS_DG2 ( dev_priv ) ) {
dev_priv - > pch_type = PCH_DG2 ;
return ;
2020-07-13 11:23:21 -07:00
}
2019-08-07 15:04:15 +03:00
/*
* The reason to probe ISA bridge instead of Dev31 : Fun0 is to
* make graphics device passthrough work easy for VMM , that only
* need to expose ISA bridge to let driver know the real hardware
* underneath . This is a requirement from virtualization team .
*
* In some virtualized environments ( e . g . XEN ) , there is irrelevant
* ISA bridge in the system . To work reliably , we should scan trhough
* all the ISA bridge devices and check for the first match , instead
* of only checking the first one .
*/
while ( ( pch = pci_get_class ( PCI_CLASS_BRIDGE_ISA < < 8 , pch ) ) ) {
if ( pch - > vendor ! = PCI_VENDOR_ID_INTEL )
continue ;
id = pch - > device & INTEL_PCH_DEVICE_ID_MASK ;
pch_type = intel_pch_type ( dev_priv , id ) ;
if ( pch_type ! = PCH_NONE ) {
dev_priv - > pch_type = pch_type ;
dev_priv - > pch_id = id ;
break ;
} else if ( intel_is_virt_pch ( id , pch - > subsystem_vendor ,
pch - > subsystem_device ) ) {
2021-01-14 08:58:19 +08:00
intel_virt_detect_pch ( dev_priv , & id , & pch_type ) ;
2019-08-07 15:04:15 +03:00
dev_priv - > pch_type = pch_type ;
dev_priv - > pch_id = id ;
break ;
}
}
/*
* Use PCH_NOP ( PCH but no South Display ) for PCH platforms without
* display .
*/
if ( pch & & ! HAS_DISPLAY ( dev_priv ) ) {
2020-01-07 18:13:29 +03:00
drm_dbg_kms ( & dev_priv - > drm ,
" Display disabled, reverting to NOP PCH \n " ) ;
2019-08-07 15:04:15 +03:00
dev_priv - > pch_type = PCH_NOP ;
dev_priv - > pch_id = 0 ;
2021-01-14 08:58:19 +08:00
} else if ( ! pch ) {
if ( run_as_guest ( ) & & HAS_DISPLAY ( dev_priv ) ) {
intel_virt_detect_pch ( dev_priv , & id , & pch_type ) ;
dev_priv - > pch_type = pch_type ;
dev_priv - > pch_id = id ;
} else {
drm_dbg_kms ( & dev_priv - > drm , " No PCH found. \n " ) ;
}
2019-08-07 15:04:15 +03:00
}
pci_dev_put ( pch ) ;
}