Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 1 | // SPDX-License-Identifier: MIT |
| 2 | /* |
| 3 | * Copyright 2019 Intel Corporation. |
| 4 | */ |
| 5 | |
| 6 | #include "i915_drv.h" |
| 7 | #include "intel_pch.h" |
| 8 | |
| 9 | /* Map PCH device id to PCH type, or PCH_NONE if unknown. */ |
| 10 | static enum intel_pch |
| 11 | intel_pch_type(const struct drm_i915_private *dev_priv, unsigned short id) |
| 12 | { |
| 13 | switch (id) { |
| 14 | case INTEL_PCH_IBX_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 15 | drm_dbg_kms(&dev_priv->drm, "Found Ibex Peak PCH\n"); |
Lucas De Marchi | 651e7d4 | 2021-06-05 21:50:49 -0700 | [diff] [blame] | 16 | drm_WARN_ON(&dev_priv->drm, GRAPHICS_VER(dev_priv) != 5); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 17 | return PCH_IBX; |
| 18 | case INTEL_PCH_CPT_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 19 | drm_dbg_kms(&dev_priv->drm, "Found CougarPoint PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 20 | drm_WARN_ON(&dev_priv->drm, |
Lucas De Marchi | 651e7d4 | 2021-06-05 21:50:49 -0700 | [diff] [blame] | 21 | GRAPHICS_VER(dev_priv) != 6 && !IS_IVYBRIDGE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 22 | return PCH_CPT; |
| 23 | case INTEL_PCH_PPT_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 24 | drm_dbg_kms(&dev_priv->drm, "Found PantherPoint PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 25 | drm_WARN_ON(&dev_priv->drm, |
Lucas De Marchi | 651e7d4 | 2021-06-05 21:50:49 -0700 | [diff] [blame] | 26 | GRAPHICS_VER(dev_priv) != 6 && !IS_IVYBRIDGE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 27 | /* PantherPoint is CPT compatible */ |
| 28 | return PCH_CPT; |
| 29 | case INTEL_PCH_LPT_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 30 | drm_dbg_kms(&dev_priv->drm, "Found LynxPoint PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 31 | drm_WARN_ON(&dev_priv->drm, |
| 32 | !IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)); |
| 33 | drm_WARN_ON(&dev_priv->drm, |
| 34 | IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 35 | return PCH_LPT; |
| 36 | case INTEL_PCH_LPT_LP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 37 | drm_dbg_kms(&dev_priv->drm, "Found LynxPoint LP PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 38 | drm_WARN_ON(&dev_priv->drm, |
| 39 | !IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)); |
| 40 | drm_WARN_ON(&dev_priv->drm, |
| 41 | !IS_HSW_ULT(dev_priv) && !IS_BDW_ULT(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 42 | return PCH_LPT; |
| 43 | case INTEL_PCH_WPT_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 44 | drm_dbg_kms(&dev_priv->drm, "Found WildcatPoint PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 45 | drm_WARN_ON(&dev_priv->drm, |
| 46 | !IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)); |
| 47 | drm_WARN_ON(&dev_priv->drm, |
| 48 | IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 49 | /* WildcatPoint is LPT compatible */ |
| 50 | return PCH_LPT; |
| 51 | case INTEL_PCH_WPT_LP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 52 | drm_dbg_kms(&dev_priv->drm, "Found WildcatPoint LP PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 53 | drm_WARN_ON(&dev_priv->drm, |
| 54 | !IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)); |
| 55 | drm_WARN_ON(&dev_priv->drm, |
| 56 | !IS_HSW_ULT(dev_priv) && !IS_BDW_ULT(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 57 | /* WildcatPoint is LPT compatible */ |
| 58 | return PCH_LPT; |
| 59 | case INTEL_PCH_SPT_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 60 | drm_dbg_kms(&dev_priv->drm, "Found SunrisePoint PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 61 | drm_WARN_ON(&dev_priv->drm, |
| 62 | !IS_SKYLAKE(dev_priv) && !IS_KABYLAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 63 | return PCH_SPT; |
| 64 | case INTEL_PCH_SPT_LP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 65 | drm_dbg_kms(&dev_priv->drm, "Found SunrisePoint LP PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 66 | drm_WARN_ON(&dev_priv->drm, |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 67 | !IS_SKYLAKE(dev_priv) && |
| 68 | !IS_KABYLAKE(dev_priv) && |
| 69 | !IS_COFFEELAKE(dev_priv) && |
| 70 | !IS_COMETLAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 71 | return PCH_SPT; |
| 72 | case INTEL_PCH_KBP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 73 | drm_dbg_kms(&dev_priv->drm, "Found Kaby Lake PCH (KBP)\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 74 | drm_WARN_ON(&dev_priv->drm, |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 75 | !IS_SKYLAKE(dev_priv) && |
| 76 | !IS_KABYLAKE(dev_priv) && |
| 77 | !IS_COFFEELAKE(dev_priv) && |
| 78 | !IS_COMETLAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 79 | /* KBP is SPT compatible */ |
| 80 | return PCH_SPT; |
| 81 | case INTEL_PCH_CNP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 82 | drm_dbg_kms(&dev_priv->drm, "Found Cannon Lake PCH (CNP)\n"); |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 83 | drm_WARN_ON(&dev_priv->drm, |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 84 | !IS_COFFEELAKE(dev_priv) && |
| 85 | !IS_COMETLAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 86 | return PCH_CNP; |
| 87 | case INTEL_PCH_CNP_LP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 88 | drm_dbg_kms(&dev_priv->drm, |
| 89 | "Found Cannon Lake LP PCH (CNP-LP)\n"); |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 90 | drm_WARN_ON(&dev_priv->drm, |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 91 | !IS_COFFEELAKE(dev_priv) && |
| 92 | !IS_COMETLAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 93 | return PCH_CNP; |
| 94 | case INTEL_PCH_CMP_DEVICE_ID_TYPE: |
Matt Roper | 8698ba5 | 2019-09-16 16:32:51 -0700 | [diff] [blame] | 95 | case INTEL_PCH_CMP2_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 96 | drm_dbg_kms(&dev_priv->drm, "Found Comet Lake PCH (CMP)\n"); |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 97 | drm_WARN_ON(&dev_priv->drm, |
| 98 | !IS_COFFEELAKE(dev_priv) && |
| 99 | !IS_COMETLAKE(dev_priv) && |
Matt Roper | a09e89e | 2020-05-04 15:52:10 -0700 | [diff] [blame] | 100 | !IS_ROCKETLAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 101 | /* CometPoint is CNP Compatible */ |
| 102 | return PCH_CNP; |
Imre Deak | 50a5065 | 2019-11-12 12:46:08 +0200 | [diff] [blame] | 103 | case INTEL_PCH_CMP_V_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 104 | drm_dbg_kms(&dev_priv->drm, "Found Comet Lake V PCH (CMP-V)\n"); |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 105 | drm_WARN_ON(&dev_priv->drm, |
| 106 | !IS_COFFEELAKE(dev_priv) && |
| 107 | !IS_COMETLAKE(dev_priv)); |
Imre Deak | 50a5065 | 2019-11-12 12:46:08 +0200 | [diff] [blame] | 108 | /* Comet Lake V PCH is based on KBP, which is SPT compatible */ |
| 109 | return PCH_SPT; |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 110 | case INTEL_PCH_ICP_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 111 | drm_dbg_kms(&dev_priv->drm, "Found Ice Lake PCH\n"); |
Pankaj Bharadiya | 48a1b8d | 2020-01-15 09:14:53 +0530 | [diff] [blame] | 112 | drm_WARN_ON(&dev_priv->drm, !IS_ICELAKE(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 113 | return PCH_ICP; |
| 114 | case INTEL_PCH_MCC_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 115 | drm_dbg_kms(&dev_priv->drm, "Found Mule Creek Canyon PCH\n"); |
Tejas Upadhyay | 24ea098 | 2020-10-14 00:59:48 +0530 | [diff] [blame] | 116 | drm_WARN_ON(&dev_priv->drm, !IS_JSL_EHL(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 117 | return PCH_MCC; |
| 118 | case INTEL_PCH_TGP_DEVICE_ID_TYPE: |
James Ausmus | 6cf6e59 | 2019-11-05 16:55:26 -0800 | [diff] [blame] | 119 | case INTEL_PCH_TGP2_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 120 | drm_dbg_kms(&dev_priv->drm, "Found Tiger Lake LP PCH\n"); |
Matt Roper | a09e89e | 2020-05-04 15:52:10 -0700 | [diff] [blame] | 121 | drm_WARN_ON(&dev_priv->drm, !IS_TIGERLAKE(dev_priv) && |
Lyude Paul | 4b97039 | 2021-02-09 14:13:05 -0500 | [diff] [blame] | 122 | !IS_ROCKETLAKE(dev_priv) && |
| 123 | !IS_GEN9_BC(dev_priv)); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 124 | return PCH_TGP; |
Matt Roper | 943682e | 2019-10-15 09:28:54 -0700 | [diff] [blame] | 125 | case INTEL_PCH_JSP_DEVICE_ID_TYPE: |
| 126 | case INTEL_PCH_JSP2_DEVICE_ID_TYPE: |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 127 | drm_dbg_kms(&dev_priv->drm, "Found Jasper Lake PCH\n"); |
Tejas Upadhyay | 24ea098 | 2020-10-14 00:59:48 +0530 | [diff] [blame] | 128 | drm_WARN_ON(&dev_priv->drm, !IS_JSL_EHL(dev_priv)); |
Matt Roper | 943682e | 2019-10-15 09:28:54 -0700 | [diff] [blame] | 129 | return PCH_JSP; |
Anusha Srivatsa | fb51970 | 2021-01-25 06:07:45 -0800 | [diff] [blame] | 130 | case INTEL_PCH_ADP_DEVICE_ID_TYPE: |
Clinton Taylor | 83c81a0 | 2021-05-11 21:21:43 -0700 | [diff] [blame] | 131 | case INTEL_PCH_ADP2_DEVICE_ID_TYPE: |
Anusha Srivatsa | fb51970 | 2021-01-25 06:07:45 -0800 | [diff] [blame] | 132 | drm_dbg_kms(&dev_priv->drm, "Found Alder Lake PCH\n"); |
Clinton Taylor | 83c81a0 | 2021-05-11 21:21:43 -0700 | [diff] [blame] | 133 | drm_WARN_ON(&dev_priv->drm, !IS_ALDERLAKE_S(dev_priv) && |
| 134 | !IS_ALDERLAKE_P(dev_priv)); |
Anusha Srivatsa | fb51970 | 2021-01-25 06:07:45 -0800 | [diff] [blame] | 135 | return PCH_ADP; |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 136 | default: |
| 137 | return PCH_NONE; |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | static bool intel_is_virt_pch(unsigned short id, |
| 142 | unsigned short svendor, unsigned short sdevice) |
| 143 | { |
| 144 | return (id == INTEL_PCH_P2X_DEVICE_ID_TYPE || |
| 145 | id == INTEL_PCH_P3X_DEVICE_ID_TYPE || |
| 146 | (id == INTEL_PCH_QEMU_DEVICE_ID_TYPE && |
| 147 | svendor == PCI_SUBVENDOR_ID_REDHAT_QUMRANET && |
| 148 | sdevice == PCI_SUBDEVICE_ID_QEMU)); |
| 149 | } |
| 150 | |
Zhenyu Wang | a1f6bfe | 2021-01-14 08:58:19 +0800 | [diff] [blame] | 151 | static void |
| 152 | intel_virt_detect_pch(const struct drm_i915_private *dev_priv, |
| 153 | unsigned short *pch_id, enum intel_pch *pch_type) |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 154 | { |
| 155 | unsigned short id = 0; |
| 156 | |
| 157 | /* |
| 158 | * In a virtualized passthrough environment we can be in a |
| 159 | * setup where the ISA bridge is not able to be passed through. |
| 160 | * In this case, a south bridge can be emulated and we have to |
| 161 | * make an educated guess as to which PCH is really there. |
| 162 | */ |
| 163 | |
Clinton Taylor | 83c81a0 | 2021-05-11 21:21:43 -0700 | [diff] [blame] | 164 | if (IS_ALDERLAKE_S(dev_priv) || IS_ALDERLAKE_P(dev_priv)) |
Anusha Srivatsa | fb51970 | 2021-01-25 06:07:45 -0800 | [diff] [blame] | 165 | id = INTEL_PCH_ADP_DEVICE_ID_TYPE; |
| 166 | else if (IS_TIGERLAKE(dev_priv) || IS_ROCKETLAKE(dev_priv)) |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 167 | id = INTEL_PCH_TGP_DEVICE_ID_TYPE; |
Tejas Upadhyay | 24ea098 | 2020-10-14 00:59:48 +0530 | [diff] [blame] | 168 | else if (IS_JSL_EHL(dev_priv)) |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 169 | id = INTEL_PCH_MCC_DEVICE_ID_TYPE; |
| 170 | else if (IS_ICELAKE(dev_priv)) |
| 171 | id = INTEL_PCH_ICP_DEVICE_ID_TYPE; |
Lucas De Marchi | cf9fb29 | 2021-07-28 14:59:39 -0700 | [diff] [blame] | 172 | else if (IS_COFFEELAKE(dev_priv) || |
Chris Wilson | 5f4ae27 | 2020-06-02 15:05:40 +0100 | [diff] [blame] | 173 | IS_COMETLAKE(dev_priv)) |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 174 | id = INTEL_PCH_CNP_DEVICE_ID_TYPE; |
| 175 | else if (IS_KABYLAKE(dev_priv) || IS_SKYLAKE(dev_priv)) |
| 176 | id = INTEL_PCH_SPT_DEVICE_ID_TYPE; |
| 177 | else if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv)) |
| 178 | id = INTEL_PCH_LPT_LP_DEVICE_ID_TYPE; |
| 179 | else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) |
| 180 | id = INTEL_PCH_LPT_DEVICE_ID_TYPE; |
Lucas De Marchi | 651e7d4 | 2021-06-05 21:50:49 -0700 | [diff] [blame] | 181 | else if (GRAPHICS_VER(dev_priv) == 6 || IS_IVYBRIDGE(dev_priv)) |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 182 | id = INTEL_PCH_CPT_DEVICE_ID_TYPE; |
Lucas De Marchi | 651e7d4 | 2021-06-05 21:50:49 -0700 | [diff] [blame] | 183 | else if (GRAPHICS_VER(dev_priv) == 5) |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 184 | id = INTEL_PCH_IBX_DEVICE_ID_TYPE; |
| 185 | |
| 186 | if (id) |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 187 | drm_dbg_kms(&dev_priv->drm, "Assuming PCH ID %04x\n", id); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 188 | else |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 189 | drm_dbg_kms(&dev_priv->drm, "Assuming no PCH\n"); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 190 | |
Zhenyu Wang | a1f6bfe | 2021-01-14 08:58:19 +0800 | [diff] [blame] | 191 | *pch_type = intel_pch_type(dev_priv, id); |
| 192 | |
| 193 | /* Sanity check virtual PCH id */ |
| 194 | if (drm_WARN_ON(&dev_priv->drm, |
| 195 | id && *pch_type == PCH_NONE)) |
| 196 | id = 0; |
| 197 | |
| 198 | *pch_id = id; |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | void intel_detect_pch(struct drm_i915_private *dev_priv) |
| 202 | { |
| 203 | struct pci_dev *pch = NULL; |
Zhenyu Wang | a1f6bfe | 2021-01-14 08:58:19 +0800 | [diff] [blame] | 204 | unsigned short id; |
| 205 | enum intel_pch pch_type; |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 206 | |
Lucas De Marchi | 51e3a64 | 2020-07-13 11:23:21 -0700 | [diff] [blame] | 207 | /* DG1 has south engine display on the same PCI device */ |
| 208 | if (IS_DG1(dev_priv)) { |
| 209 | dev_priv->pch_type = PCH_DG1; |
| 210 | return; |
Matt Roper | 3176fb6 | 2021-07-21 15:30:35 -0700 | [diff] [blame] | 211 | } else if (IS_DG2(dev_priv)) { |
| 212 | dev_priv->pch_type = PCH_DG2; |
| 213 | return; |
Lucas De Marchi | 51e3a64 | 2020-07-13 11:23:21 -0700 | [diff] [blame] | 214 | } |
| 215 | |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 216 | /* |
| 217 | * The reason to probe ISA bridge instead of Dev31:Fun0 is to |
| 218 | * make graphics device passthrough work easy for VMM, that only |
| 219 | * need to expose ISA bridge to let driver know the real hardware |
| 220 | * underneath. This is a requirement from virtualization team. |
| 221 | * |
| 222 | * In some virtualized environments (e.g. XEN), there is irrelevant |
| 223 | * ISA bridge in the system. To work reliably, we should scan trhough |
| 224 | * all the ISA bridge devices and check for the first match, instead |
| 225 | * of only checking the first one. |
| 226 | */ |
| 227 | while ((pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, pch))) { |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 228 | if (pch->vendor != PCI_VENDOR_ID_INTEL) |
| 229 | continue; |
| 230 | |
| 231 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; |
| 232 | |
| 233 | pch_type = intel_pch_type(dev_priv, id); |
| 234 | if (pch_type != PCH_NONE) { |
| 235 | dev_priv->pch_type = pch_type; |
| 236 | dev_priv->pch_id = id; |
| 237 | break; |
| 238 | } else if (intel_is_virt_pch(id, pch->subsystem_vendor, |
| 239 | pch->subsystem_device)) { |
Zhenyu Wang | a1f6bfe | 2021-01-14 08:58:19 +0800 | [diff] [blame] | 240 | intel_virt_detect_pch(dev_priv, &id, &pch_type); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 241 | dev_priv->pch_type = pch_type; |
| 242 | dev_priv->pch_id = id; |
| 243 | break; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /* |
| 248 | * Use PCH_NOP (PCH but no South Display) for PCH platforms without |
| 249 | * display. |
| 250 | */ |
| 251 | if (pch && !HAS_DISPLAY(dev_priv)) { |
Wambui Karuga | 0f69958 | 2020-01-07 18:13:29 +0300 | [diff] [blame] | 252 | drm_dbg_kms(&dev_priv->drm, |
| 253 | "Display disabled, reverting to NOP PCH\n"); |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 254 | dev_priv->pch_type = PCH_NOP; |
| 255 | dev_priv->pch_id = 0; |
Zhenyu Wang | a1f6bfe | 2021-01-14 08:58:19 +0800 | [diff] [blame] | 256 | } else if (!pch) { |
| 257 | if (run_as_guest() && HAS_DISPLAY(dev_priv)) { |
| 258 | intel_virt_detect_pch(dev_priv, &id, &pch_type); |
| 259 | dev_priv->pch_type = pch_type; |
| 260 | dev_priv->pch_id = id; |
| 261 | } else { |
| 262 | drm_dbg_kms(&dev_priv->drm, "No PCH found.\n"); |
| 263 | } |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 264 | } |
| 265 | |
Jani Nikula | 707d26d | 2019-08-07 15:04:15 +0300 | [diff] [blame] | 266 | pci_dev_put(pch); |
| 267 | } |