| Nico Huber | 730f17c | 2017-06-12 15:51:25 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2017 secunet Security Networks AG |
| 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 Haswell_HDMI_Range is DDI_HDMI_Buf_Trans_Range range 0 .. 11; |
| 21 | subtype Broadwell_HDMI_Range is DDI_HDMI_Buf_Trans_Range range 0 .. 9; |
| 22 | |
| 23 | type HDMI_Buf_Trans is record |
| 24 | Trans1 : Word32; |
| 25 | Trans2 : Word32; |
| 26 | end record; |
| 27 | type HDMI_Buf_Trans_Array is array (Haswell_HDMI_Range) of HDMI_Buf_Trans; |
| 28 | |
| 29 | ---------------------------------------------------------------------------- |
| 30 | |
| 31 | Haswell_Trans_DP : constant Buf_Trans_Array := |
| 32 | (16#00ff_ffff#, 16#0006_000e#, |
| 33 | 16#00d7_5fff#, 16#0005_000a#, |
| 34 | 16#00c3_0fff#, 16#0004_0006#, |
| 35 | 16#80aa_afff#, 16#000b_0000#, |
| 36 | 16#00ff_ffff#, 16#0005_000a#, |
| 37 | 16#00d7_5fff#, 16#000c_0004#, |
| 38 | 16#80c3_0fff#, 16#000b_0000#, |
| 39 | 16#00ff_ffff#, 16#0004_0006#, |
| 40 | 16#80d7_5fff#, 16#000b_0000#, |
| 41 | others => 0); |
| 42 | |
| 43 | Haswell_Trans_FDI : constant Buf_Trans_Array := |
| 44 | (16#00ff_ffff#, 16#0007_000e#, |
| 45 | 16#00d7_5fff#, 16#000f_000a#, |
| 46 | 16#00c3_0fff#, 16#0006_0006#, |
| 47 | 16#00aa_afff#, 16#001e_0000#, |
| 48 | 16#00ff_ffff#, 16#000f_000a#, |
| 49 | 16#00d7_5fff#, 16#0016_0004#, |
| 50 | 16#00c3_0fff#, 16#001e_0000#, |
| 51 | 16#00ff_ffff#, 16#0006_0006#, |
| 52 | 16#00d7_5fff#, 16#001e_0000#, |
| 53 | others => 0); |
| 54 | |
| 55 | Haswell_Trans_HDMI : constant HDMI_Buf_Trans_Array := |
| 56 | ((16#00ff_ffff#, 16#0006_000e#), |
| 57 | (16#00e7_9fff#, 16#000e_000c#), |
| 58 | (16#00d7_5fff#, 16#0005_000a#), |
| 59 | (16#00ff_ffff#, 16#0005_000a#), |
| 60 | (16#00e7_9fff#, 16#001d_0007#), |
| 61 | (16#00d7_5fff#, 16#000c_0004#), |
| 62 | (16#00ff_ffff#, 16#0004_0006#), |
| 63 | (16#80e7_9fff#, 16#0003_0002#), |
| 64 | (16#00ff_ffff#, 16#0014_0005#), |
| 65 | (16#00ff_ffff#, 16#000c_0004#), |
| 66 | (16#00ff_ffff#, 16#001c_0003#), |
| 67 | (16#80ff_ffff#, 16#0003_0002#)); |
| 68 | |
| 69 | Broadwell_Trans_EDP : constant Buf_Trans_Array := |
| 70 | (16#00ff_ffff#, 16#0000_0012#, |
| 71 | 16#00eb_afff#, 16#0002_0011#, |
| 72 | 16#00c7_1fff#, 16#0006_000f#, |
| 73 | 16#00aa_afff#, 16#000e_000a#, |
| 74 | 16#00ff_ffff#, 16#0002_0011#, |
| 75 | 16#00db_6fff#, 16#0005_000f#, |
| 76 | 16#00be_efff#, 16#000a_000c#, |
| 77 | 16#00ff_ffff#, 16#0005_000f#, |
| 78 | 16#00db_6fff#, 16#000a_000c#, |
| 79 | others => 0); |
| 80 | |
| 81 | Broadwell_Trans_DP : constant Buf_Trans_Array := |
| 82 | (16#00ff_ffff#, 16#0007_000e#, |
| 83 | 16#00d7_5fff#, 16#000e_000a#, |
| 84 | 16#00be_ffff#, 16#0014_0006#, |
| 85 | 16#80b2_cfff#, 16#001b_0002#, |
| 86 | 16#00ff_ffff#, 16#000e_000a#, |
| 87 | 16#00db_6fff#, 16#0016_0005#, |
| 88 | 16#80c7_1fff#, 16#001a_0002#, |
| 89 | 16#00f7_dfff#, 16#0018_0004#, |
| 90 | 16#80d7_5fff#, 16#001b_0002#, |
| 91 | others => 0); |
| 92 | |
| 93 | Broadwell_Trans_FDI : constant Buf_Trans_Array := |
| 94 | (16#00ff_ffff#, 16#0001_000e#, |
| 95 | 16#00d7_5fff#, 16#0004_000a#, |
| 96 | 16#00c3_0fff#, 16#0007_0006#, |
| 97 | 16#00aa_afff#, 16#000c_0000#, |
| 98 | 16#00ff_ffff#, 16#0004_000a#, |
| 99 | 16#00d7_5fff#, 16#0009_0004#, |
| 100 | 16#00c3_0fff#, 16#000c_0000#, |
| 101 | 16#00ff_ffff#, 16#0007_0006#, |
| 102 | 16#00d7_5fff#, 16#000c_0000#, |
| 103 | others => 0); |
| 104 | |
| 105 | Broadwell_Trans_HDMI : constant HDMI_Buf_Trans_Array := |
| 106 | ((16#00ff_ffff#, 16#0007_000e#), |
| 107 | (16#00d7_5fff#, 16#000e_000a#), |
| 108 | (16#00be_ffff#, 16#0014_0006#), |
| 109 | (16#00ff_ffff#, 16#0009_000d#), |
| 110 | (16#00ff_ffff#, 16#000e_000a#), |
| 111 | (16#00d7_ffff#, 16#0014_0006#), |
| 112 | (16#80cb_2fff#, 16#001b_0002#), |
| 113 | (16#00ff_ffff#, 16#0014_0006#), |
| 114 | (16#80e7_9fff#, 16#001b_0002#), |
| 115 | (16#80ff_ffff#, 16#001b_0002#), |
| 116 | others => (0, 0)); |
| 117 | |
| 118 | ---------------------------------------------------------------------------- |
| 119 | |
| 120 | procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port) |
| 121 | is |
| 122 | HDMI_Trans : constant DDI_HDMI_Buf_Trans_Range := |
| 123 | (if (Config.CPU = Broadwell and |
| 124 | Config.DDI_HDMI_Buffer_Translation in Broadwell_HDMI_Range) |
| 125 | or |
| 126 | (Config.CPU /= Broadwell and |
| 127 | Config.DDI_HDMI_Buffer_Translation in Haswell_HDMI_Range) |
| 128 | then Config.DDI_HDMI_Buffer_Translation |
| 129 | else Config.Default_DDI_HDMI_Buffer_Translation); |
| 130 | begin |
| 131 | Trans := |
| 132 | (case Config.CPU is |
| 133 | when Broadwell => |
| 134 | (case Port is |
| 135 | when DIGI_A => |
| 136 | (if Config.EDP_Low_Voltage_Swing |
| 137 | then Broadwell_Trans_EDP |
| 138 | else Broadwell_Trans_DP), |
| 139 | when DIGI_B .. DIGI_D => Broadwell_Trans_DP, |
| 140 | when DIGI_E => Broadwell_Trans_FDI), |
| 141 | when others => |
| 142 | (case Port is |
| 143 | when DIGI_A .. DIGI_D => Haswell_Trans_DP, |
| 144 | when DIGI_E => Haswell_Trans_FDI)); |
| 145 | case Config.CPU is |
| 146 | when Broadwell => |
| 147 | Trans (18) := Broadwell_Trans_HDMI (HDMI_Trans).Trans1; |
| 148 | Trans (19) := Broadwell_Trans_HDMI (HDMI_Trans).Trans2; |
| 149 | when others => |
| 150 | Trans (18) := Haswell_Trans_HDMI (HDMI_Trans).Trans1; |
| 151 | Trans (19) := Haswell_Trans_HDMI (HDMI_Trans).Trans2; |
| 152 | end case; |
| 153 | end Translations; |
| 154 | |
| 155 | end HW.GFX.GMA.Connectors.DDI.Buffers; |