| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 2 | -- Copyright (C) 2017, 2019 secunet Security Networks AG |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 3 | -- |
| 4 | -- This program is free software; you can redistribute it and/or modify |
| 5 | -- it under the terms of the GNU General Public License as published by |
| 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| 8 | -- |
| 9 | -- This program is distributed in the hope that it will be useful, |
| 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | -- GNU General Public License for more details. |
| 13 | -- |
| 14 | |
| 15 | with HW.GFX.GMA.Config; |
| 16 | |
| 17 | package body HW.GFX.GMA.Connectors.DDI.Buffers |
| 18 | is |
| 19 | |
| 20 | subtype Skylake_HDMI_Range is DDI_HDMI_Buf_Trans_Range range 0 .. 10; |
| 21 | |
| 22 | type HDMI_Buf_Trans is record |
| 23 | Trans1 : Word32; |
| 24 | Trans2 : Word32; |
| 25 | end record; |
| 26 | type HDMI_Buf_Trans_Array is array (Skylake_HDMI_Range) of HDMI_Buf_Trans; |
| 27 | |
| 28 | ---------------------------------------------------------------------------- |
| 29 | |
| 30 | Skylake_Trans_EDP : constant Buf_Trans_Array := |
| 31 | (16#0000_0018#, 16#0000_00a8#, |
| 32 | 16#0000_4013#, 16#0000_00a9#, |
| 33 | 16#0000_7011#, 16#0000_00a2#, |
| 34 | 16#0000_9010#, 16#0000_009c#, |
| 35 | 16#0000_0018#, 16#0000_00a9#, |
| 36 | 16#0000_6013#, 16#0000_00a2#, |
| 37 | 16#0000_7011#, 16#0000_00a6#, |
| 38 | 16#0000_0018#, 16#0000_00ab#, |
| 39 | 16#0000_7013#, 16#0000_009f#, |
| 40 | 16#0000_0018#, 16#0000_00df#); |
| 41 | |
| 42 | Skylake_U_Trans_EDP : constant Buf_Trans_Array := |
| 43 | (16#0000_0018#, 16#0000_00a8#, |
| 44 | 16#0000_4013#, 16#0000_00a9#, |
| 45 | 16#0000_7011#, 16#0000_00a2#, |
| 46 | 16#0000_9010#, 16#0000_009c#, |
| 47 | 16#0000_0018#, 16#0000_00a9#, |
| 48 | 16#0000_6013#, 16#0000_00a2#, |
| 49 | 16#0000_7011#, 16#0000_00a6#, |
| 50 | 16#0000_2016#, 16#0000_00ab#, |
| 51 | 16#0000_5013#, 16#0000_009f#, |
| 52 | 16#0000_0018#, 16#0000_00df#); |
| 53 | |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 54 | Skylake_Y_Trans_EDP : constant Buf_Trans_Array := |
| 55 | (16#0000_0018#, 16#0000_00a8#, |
| 56 | 16#0000_4013#, 16#0000_00ab#, |
| 57 | 16#0000_7011#, 16#0000_00a4#, |
| 58 | 16#0000_9010#, 16#0000_00df#, |
| 59 | 16#0000_0018#, 16#0000_00aa#, |
| 60 | 16#0000_6013#, 16#0000_00a4#, |
| 61 | 16#0000_7011#, 16#0000_009d#, |
| 62 | 16#0000_0018#, 16#0000_00a0#, |
| 63 | 16#0000_6012#, 16#0000_00df#, |
| 64 | 16#0000_0018#, 16#0000_008a#); |
| 65 | |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 66 | Skylake_Trans_DP : constant Buf_Trans_Array := |
| 67 | (16#0000_2016#, 16#0000_00a0#, |
| 68 | 16#0000_5012#, 16#0000_009b#, |
| 69 | 16#0000_7011#, 16#0000_0088#, |
| 70 | 16#8000_9010#, 16#0000_00c0#, |
| 71 | 16#0000_2016#, 16#0000_009b#, |
| 72 | 16#0000_5012#, 16#0000_0088#, |
| 73 | 16#8000_7011#, 16#0000_00c0#, |
| 74 | 16#0000_2016#, 16#0000_00df#, |
| 75 | 16#8000_5012#, 16#0000_00c0#, |
| 76 | others => 0); |
| 77 | |
| 78 | Skylake_U_Trans_DP : constant Buf_Trans_Array := |
| 79 | (16#0000_201b#, 16#0000_00a2#, |
| 80 | 16#0000_5012#, 16#0000_0088#, |
| 81 | 16#8000_7011#, 16#0000_00cd#, |
| 82 | 16#8000_9010#, 16#0000_00c0#, |
| 83 | 16#0000_201b#, 16#0000_009d#, |
| 84 | 16#8000_5012#, 16#0000_00c0#, |
| 85 | 16#8000_7011#, 16#0000_00c0#, |
| 86 | 16#0000_2016#, 16#0000_0088#, |
| 87 | 16#8000_5012#, 16#0000_00c0#, |
| 88 | others => 0); |
| 89 | |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 90 | Skylake_Y_Trans_DP : constant Buf_Trans_Array := |
| 91 | (16#0000_0018#, 16#0000_00a2#, |
| 92 | 16#0000_5012#, 16#0000_0088#, |
| 93 | 16#8000_7011#, 16#0000_00cd#, |
| 94 | 16#8000_9010#, 16#0000_00c0#, |
| 95 | 16#0000_0018#, 16#0000_009d#, |
| 96 | 16#8000_5012#, 16#0000_00c0#, |
| 97 | 16#8000_7011#, 16#0000_00c0#, |
| 98 | 16#0000_0018#, 16#0000_0088#, |
| 99 | 16#8000_5012#, 16#0000_00c0#, |
| 100 | others => 0); |
| 101 | |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame^] | 102 | Kaby_Lake_Trans_DP : constant Buf_Trans_Array := |
| 103 | (16#0000_2016#, 16#0000_00a0#, |
| 104 | 16#0000_5012#, 16#0000_009b#, |
| 105 | 16#0000_7011#, 16#0000_0088#, |
| 106 | 16#8000_9010#, 16#0000_00c0#, |
| 107 | 16#0000_2016#, 16#0000_009b#, |
| 108 | 16#0000_5012#, 16#0000_0088#, |
| 109 | 16#8000_7011#, 16#0000_00c0#, |
| 110 | 16#0000_2016#, 16#0000_0097#, |
| 111 | 16#8000_5012#, 16#0000_00c0#, |
| 112 | others => 0); |
| 113 | |
| 114 | Kaby_Lake_U_Trans_DP : constant Buf_Trans_Array := |
| 115 | (16#0000_201b#, 16#0000_00a1#, |
| 116 | 16#0000_5012#, 16#0000_0088#, |
| 117 | 16#8000_7011#, 16#0000_00cd#, |
| 118 | 16#8000_9010#, 16#0000_00c0#, |
| 119 | 16#0000_201b#, 16#0000_009d#, |
| 120 | 16#8000_5012#, 16#0000_00c0#, |
| 121 | 16#8000_7011#, 16#0000_00c0#, |
| 122 | 16#0000_2016#, 16#0000_004f#, |
| 123 | 16#8000_5012#, 16#0000_00c0#, |
| 124 | others => 0); |
| 125 | |
| 126 | Kaby_Lake_Y_Trans_DP : constant Buf_Trans_Array := |
| 127 | (16#0000_1017#, 16#0000_00a1#, |
| 128 | 16#0000_5012#, 16#0000_0088#, |
| 129 | 16#8000_7011#, 16#0000_00cd#, |
| 130 | 16#8000_800f#, 16#0000_00c0#, |
| 131 | 16#0000_1017#, 16#0000_009d#, |
| 132 | 16#8000_5012#, 16#0000_00c0#, |
| 133 | 16#8000_7011#, 16#0000_00c0#, |
| 134 | 16#0000_1017#, 16#0000_004c#, |
| 135 | 16#8000_5012#, 16#0000_00c0#, |
| 136 | others => 0); |
| 137 | |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 138 | Skylake_Trans_HDMI : constant HDMI_Buf_Trans_Array := |
| 139 | ((16#0000_0018#, 16#0000_00ac#), |
| 140 | (16#0000_5012#, 16#0000_009d#), |
| 141 | (16#0000_7011#, 16#0000_0088#), |
| 142 | (16#0000_0018#, 16#0000_00a1#), |
| 143 | (16#0000_0018#, 16#0000_0098#), |
| 144 | (16#0000_4013#, 16#0000_0088#), |
| 145 | (16#8000_6012#, 16#0000_00cd#), |
| 146 | (16#0000_0018#, 16#0000_00df#), |
| 147 | (16#8000_3015#, 16#0000_00cd#), |
| 148 | (16#8000_3015#, 16#0000_00c0#), |
| 149 | (16#8000_0018#, 16#0000_00c0#)); |
| 150 | |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 151 | Skylake_Y_Trans_HDMI : constant HDMI_Buf_Trans_Array := |
| 152 | ((16#0000_0018#, 16#0000_00a1#), |
| 153 | (16#0000_5012#, 16#0000_00df#), |
| 154 | (16#8000_7011#, 16#0000_00cb#), |
| 155 | (16#0000_0018#, 16#0000_00a4#), |
| 156 | (16#0000_0018#, 16#0000_009d#), |
| 157 | (16#0000_4013#, 16#0000_0080#), |
| 158 | (16#8000_6013#, 16#0000_00c0#), |
| 159 | (16#0000_0018#, 16#0000_008a#), |
| 160 | (16#8000_3015#, 16#0000_00c0#), |
| 161 | (16#8000_3015#, 16#0000_00c0#), |
| 162 | (16#8000_0018#, 16#0000_00c0#)); |
| 163 | |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 164 | ---------------------------------------------------------------------------- |
| 165 | |
| 166 | procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port) |
| 167 | is |
| 168 | DDIA_Low_Voltage_Swing : constant Boolean := |
| 169 | Config.EDP_Low_Voltage_Swing and then Port = DIGI_A; |
| 170 | |
| 171 | HDMI_Trans : constant Skylake_HDMI_Range := |
| 172 | (if Config.DDI_HDMI_Buffer_Translation in Skylake_HDMI_Range |
| 173 | then Config.DDI_HDMI_Buffer_Translation |
| 174 | else Config.Default_DDI_HDMI_Buffer_Translation); |
| 175 | begin |
| 176 | Trans := |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame^] | 177 | (if DDIA_Low_Voltage_Swing then |
| 178 | (if Config.Is_ULX then Skylake_Y_Trans_EDP |
| 179 | elsif Config.Is_ULT then Skylake_U_Trans_EDP |
| 180 | else Skylake_Trans_EDP) |
| 181 | elsif not Config.Use_KBL_DDI_Buf_Trans then |
| 182 | (if Config.Is_ULX then Skylake_Y_Trans_DP |
| 183 | elsif Config.Is_ULT then Skylake_U_Trans_DP |
| 184 | else Skylake_Trans_DP) |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 185 | else |
| Nico Huber | 88badbe | 2018-09-27 16:36:47 +0200 | [diff] [blame^] | 186 | (if Config.Is_ULX then Kaby_Lake_Y_Trans_DP |
| 187 | elsif Config.Is_ULT then Kaby_Lake_U_Trans_DP |
| 188 | else Kaby_Lake_Trans_DP)); |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 189 | if not DDIA_Low_Voltage_Swing then |
| Nico Huber | 25fdb15 | 2019-02-17 15:54:39 +0100 | [diff] [blame] | 190 | if Config.Is_ULX then |
| 191 | Trans (18) := Skylake_Y_Trans_HDMI (HDMI_Trans).Trans1; |
| 192 | Trans (19) := Skylake_Y_Trans_HDMI (HDMI_Trans).Trans2; |
| 193 | else |
| 194 | Trans (18) := Skylake_Trans_HDMI (HDMI_Trans).Trans1; |
| 195 | Trans (19) := Skylake_Trans_HDMI (HDMI_Trans).Trans2; |
| 196 | end if; |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 197 | end if; |
| 198 | end Translations; |
| 199 | |
| 200 | end HW.GFX.GMA.Connectors.DDI.Buffers; |