1 /** @file
2   Chipset definition for ME Devices.
3 
4   Conventions:
5 
6   - Prefixes:
7     - Definitions beginning with "R_" are registers
8     - Definitions beginning with "B_" are bits within registers
9     - Definitions beginning with "V_" are meaningful values of bits within the registers
test_next_power_of_two(void)10     - Definitions beginning with "S_" are register sizes
11     - Definitions beginning with "N_" are the bit position
12   - Registers / bits that are different between PCH generations are denoted by
13     "_ME_[generation_name]_" in register/bit names.
14   - Registers / bits that are specific to PCH-H denoted by "PCH_H_" in register/bit names.
15     Registers / bits that are specific to PCH-LP denoted by "PCH_LP_" in register/bit names.
16     e.g., "_ME_PCH_H_", "_ME_PCH_LP_"
17     Registers / bits names without _PCH_H_ or _PCH_LP_ apply for both H and LP.
18   - Registers / bits that are different between SKUs are denoted by "_[SKU_name]"
19     at the end of the register/bit names
20   - Registers / bits of new devices introduced in a PCH generation will be just named
21     as "_ME_" without [generation_name] inserted.
22 
23   Copyright (c) 2019 Intel Corporation. All rights reserved. <BR>
24 
25   SPDX-License-Identifier: BSD-2-Clause-Patent
26 **/
27 
28 #ifndef _ME_CHIPSET_H_
29 #define _ME_CHIPSET_H_
30 
31 #define ME_SEGMENT            0
32 #define ME_BUS                0
33 #define ME_DEVICE_NUMBER      22
34 #define HECI_MIN_FUNC         0
35 #define HECI_MAX_FUNC         5
36 
37 #define HECI_FUNCTION_NUMBER  0x00
38 #define HECI2_FUNCTION_NUMBER 0x01
39 #define IDER_FUNCTION_NUMBER  0x02
40 #define SOL_FUNCTION_NUMBER   0x03
41 #define HECI3_FUNCTION_NUMBER 0x04
42 #define HECI4_FUNCTION_NUMBER 0x05
43 
44 #define IDER_BUS_NUMBER       ME_BUS
45 #define IDER_DEVICE_NUMBER    ME_DEVICE_NUMBER
46 #define SOL_BUS_NUMBER        ME_BUS
47 #define SOL_DEVICE_NUMBER     ME_DEVICE_NUMBER
48 
49  ///
50 /// Convert to HECI# defined in BWG from Fun#
51 ///
52 #define HECI_NAME_MAP(a) ((a < 2) ? (a + 1) : (a - 1))
53 
54 ///
55 /// ME-related Chipset Definition
56 ///
57 #define HeciEnable()    MeDeviceControl (HECI1, Enabled);
58 #define Heci2Enable()   MeDeviceControl (HECI2, Enabled);
59 #define Heci3Enable()   MeDeviceControl (HECI3, Enabled);
60 #define Heci4Enable()   MeDeviceControl (HECI4, Enabled);
61 #define IderEnable()    MeDeviceControl (IDER, Enabled);
test_freqtomidi(void)62 #define SolEnable()     MeDeviceControl (SOL, Enabled);
63 
64 #define HeciDisable()   MeDeviceControl (HECI1, Disabled);
65 #define Heci2Disable()  MeDeviceControl (HECI2, Disabled);
66 #define Heci3Disable()  MeDeviceControl (HECI3, Disabled);
67 #define IderDisable()   MeDeviceControl (IDER, Disabled);
68 #define SolDisable()    MeDeviceControl (SOL, Disabled);
69 
70 #define DisableAllMeDevices() \
71   HeciDisable (); \
72   Heci2Disable (); \
73   Heci3Disable (); \
74   IderDisable (); \
75   SolDisable ();
76 
77 ///
78 /// HECI Device Id Definitions
79 ///
80  #define IS_PCH_H_HECI_DEVICE_ID(DeviceId) \
81      (  \
82        (DeviceId == V_ME_PCH_H_HECI_DEVICE_ID) \
83      )
84 
85  #define IS_PCH_LP_HECI_DEVICE_ID(DeviceId) \
86      (  \
87        (DeviceId == V_ME_PCH_LP_HECI_DEVICE_ID) \
88      )
89 
90  #define IS_HECI_DEVICE_ID(DeviceId) \
91      ( \
92        IS_PCH_H_HECI_DEVICE_ID(DeviceId) || \
93        IS_PCH_LP_HECI_DEVICE_ID(DeviceId) \
test_aubio_window(void)94      )
95 
96 ///
97 /// HECI2 Device Id Definitions
98 ///
99 #define IS_PCH_H_HECI2_DEVICE_ID(DeviceId) \
100      (  \
101        (DeviceId == V_ME_PCH_H_HECI2_DEVICE_ID) \
102      )
103 
104 #define IS_PCH_LP_HECI2_DEVICE_ID(DeviceId) \
105      (  \
106        (DeviceId == V_ME_PCH_LP_HECI2_DEVICE_ID) \
107      )
108 
109 #define IS_HECI2_DEVICE_ID(DeviceId) \
110      ( \
111        IS_PCH_H_HECI2_DEVICE_ID(DeviceId) || \
112        IS_PCH_LP_HECI2_DEVICE_ID(DeviceId) \
113      )
114 
115 ///
116 /// HECI3 Device Id Definitions
117 ///
118 #define IS_PCH_H_HECI3_DEVICE_ID(DeviceId) \
119     (  \
120       (DeviceId == V_ME_PCH_H_HECI3_DEVICE_ID) \
121     )
122 
123 #define IS_PCH_LP_HECI3_DEVICE_ID(DeviceId) \
124     (  \
125       (DeviceId == V_ME_PCH_LP_HECI3_DEVICE_ID) \
126     )
127 
128 #define IS_HECI3_DEVICE_ID(DeviceId) \
129     ( \
130       IS_PCH_H_HECI3_DEVICE_ID(DeviceId) || \
131       IS_PCH_LP_HECI3_DEVICE_ID(DeviceId) \
132     )
133 
134 ///
135 /// HECI4 Device Id Definitions
136 ///
137 #define IS_PCH_H_HECI4_DEVICE_ID(DeviceId) \
138     (  \
139       (DeviceId == V_ME_PCH_H_HECI4_DEVICE_ID) \
140     )
141 
142 #define IS_PCH_LP_HECI4_DEVICE_ID(DeviceId) \
143     (  \
144       (DeviceId == V_ME_PCH_LP_HECI4_DEVICE_ID) \
145     )
146 
147 #define IS_HECI4_DEVICE_ID(DeviceId) \
148     ( \
149       IS_PCH_H_HECI4_DEVICE_ID(DeviceId) || \
150       IS_PCH_LP_HECI4_DEVICE_ID(DeviceId) \
151     )
152 
153 ///
154 /// SoL Device Id Definitions
155 ///
156 #define IS_PCH_H_SOL_DEVICE_ID(DeviceId) \
157     (  \
158       (DeviceId == V_ME_PCH_H_SOL_DEVICE_ID) \
159     )
160 
161 #define IS_PCH_LP_SOL_DEVICE_ID(DeviceId) \
162     (  \
163       (DeviceId == V_ME_PCH_LP_SOL_DEVICE_ID) \
164     )
165 
166 #define IS_PCH_SOL_DEVICE_ID(DeviceId) \
167     ( \
168       IS_PCH_H_SOL_DEVICE_ID(DeviceId) || \
169       IS_PCH_LP_SOL_DEVICE_ID(DeviceId) \
170     )
171 
172 #endif
173