blob: 0fec20c1f2d5a18f72f14fdaad8aa936f881c2d1 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Georgi2efc8802012-11-06 11:03:53 +01002
3#ifndef __NORTHBRIDGE_INTEL_GM45_GM45_H__
Edward O'Callaghan089a5102015-01-06 02:48:57 +11004#define __NORTHBRIDGE_INTEL_GM45_GM45_H__
Patrick Georgi2efc8802012-11-06 11:03:53 +01005
Elyes HAOUAS21b71ce62018-06-16 18:43:52 +02006#include <southbridge/intel/i82801ix/i82801ix.h>
Patrick Georgi2efc8802012-11-06 11:03:53 +01007
8#ifndef __ACPI__
9
10#include <stdint.h>
11
12typedef enum {
Angel Ponsac4e4b42020-09-16 01:13:00 +020013 FSB_CLOCK_1067MHz = 0,
14 FSB_CLOCK_800MHz = 1,
15 FSB_CLOCK_667MHz = 2,
Patrick Georgi2efc8802012-11-06 11:03:53 +010016} fsb_clock_t;
17
18typedef enum { /* Steppings below B1 were pre-production,
Angel Ponsc88a4792020-09-16 13:11:52 +020019 conversion stepping A1 is a newer GL40 with support for 800 MT/s on FSB/DDR.
Patrick Georgi2efc8802012-11-06 11:03:53 +010020 We'll support B1, B2, B3, and conversion stepping A1. */
21 STEPPING_A0 = 0,
22 STEPPING_A1 = 1,
23 STEPPING_A2 = 2,
24 STEPPING_A3 = 3,
25 STEPPING_B0 = 4,
26 STEPPING_B1 = 5,
27 STEPPING_B2 = 6,
28 STEPPING_B3 = 7,
29 STEPPING_CONVERSION_A1 = 9,
30} stepping_t;
31
32typedef enum {
33 GMCH_GM45 = 0,
34 GMCH_GM47,
35 GMCH_GM49,
36 GMCH_GE45,
37 GMCH_GL40,
38 GMCH_GL43,
39 GMCH_GS40,
40 GMCH_GS45,
41 GMCH_PM45,
42 GMCH_UNKNOWN
43} gmch_gfx_t;
44
45typedef enum {
Angel Ponsac4e4b42020-09-16 01:13:00 +020046 MEM_CLOCK_533MHz = 0,
47 MEM_CLOCK_400MHz = 1,
48 MEM_CLOCK_333MHz = 2,
49 MEM_CLOCK_1067MT = 0,
50 MEM_CLOCK_800MT = 1,
51 MEM_CLOCK_667MT = 2,
Patrick Georgi2efc8802012-11-06 11:03:53 +010052} mem_clock_t;
53
54typedef enum {
55 DDR1 = 1,
56 DDR2 = 2,
57 DDR3 = 3,
58} ddr_t;
59
60typedef enum {
61 CHANNEL_MODE_SINGLE,
62 CHANNEL_MODE_DUAL_ASYNC,
63 CHANNEL_MODE_DUAL_INTERLEAVED,
64} channel_mode_t;
65
66typedef enum { /* as in DDR3 spd */
67 CHIP_WIDTH_x4 = 0,
68 CHIP_WIDTH_x8 = 1,
69 CHIP_WIDTH_x16 = 2,
70 CHIP_WIDTH_x32 = 3,
71} chip_width_t;
72
73typedef enum { /* as in DDR3 spd */
74 CHIP_CAP_256M = 0,
75 CHIP_CAP_512M = 1,
76 CHIP_CAP_1G = 2,
77 CHIP_CAP_2G = 3,
78 CHIP_CAP_4G = 4,
79 CHIP_CAP_8G = 5,
80 CHIP_CAP_16G = 6,
81} chip_capacity_t;
82
83typedef struct {
84 unsigned int CAS;
85 fsb_clock_t fsb_clock;
86 mem_clock_t mem_clock;
87 channel_mode_t channel_mode;
88 unsigned int tRAS;
89 unsigned int tRP;
90 unsigned int tRCD;
91 unsigned int tRFC;
92 unsigned int tWR;
93 unsigned int tRD;
94 unsigned int tRRD;
95 unsigned int tFAW;
96 unsigned int tWL;
97} timings_t;
98
99typedef struct {
100 unsigned int card_type; /* 0x0: unpopulated,
101 0xa - 0xf: raw card type A - F */
102 chip_width_t chip_width;
103 chip_capacity_t chip_capacity;
104 unsigned int page_size; /* of whole DIMM in Bytes (4096 or 8192) */
105 unsigned int banks;
106 unsigned int ranks;
Martin Roth128c1042016-11-18 09:29:03 -0700107 unsigned int rank_capacity_mb; /* per rank in Megabytes */
Patrick Georgi2efc8802012-11-06 11:03:53 +0100108} dimminfo_t;
109
110/* The setup is one DIMM per channel, so there's no need to find a
111 common timing setup between multiple chips (but chip and controller
112 still need to be coordinated */
113typedef struct {
114 stepping_t stepping;
115 int txt_enabled;
116 int cores;
117 gmch_gfx_t gfx_type;
Patrick Georgi2efc8802012-11-06 11:03:53 +0100118 int max_ddr2_mhz;
119 int max_ddr3_mt;
120 fsb_clock_t max_fsb;
121 int max_fsb_mhz;
122 int max_render_mhz;
Vladimir Serbinenko56ae8a02014-08-16 10:59:02 +0200123 int enable_igd;
124 int enable_peg;
125 u16 ggc;
Patrick Georgi2efc8802012-11-06 11:03:53 +0100126
Nico Huber5aaeb272015-12-30 00:17:27 +0100127 /* to be filled in romstage main: */
Patrick Georgi2efc8802012-11-06 11:03:53 +0100128 int spd_type;
129 timings_t selected_timings;
130 dimminfo_t dimms[2];
Vladimir Serbinenkoc4d89482014-06-05 09:14:48 +0200131 u8 spd_map[4];
Nico Huber5aaeb272015-12-30 00:17:27 +0100132 int gs45_low_power_mode; /* low power mode of GMCH_GS45 */
133 int sff; /* small form factor option (soldered down DIMM) */
Patrick Georgi2efc8802012-11-06 11:03:53 +0100134} sysinfo_t;
Angel Ponsac4e4b42020-09-16 01:13:00 +0200135
Patrick Georgi2efc8802012-11-06 11:03:53 +0100136#define TOTAL_CHANNELS 2
137#define CHANNEL_IS_POPULATED(dimms, idx) (dimms[idx].card_type != 0)
138#define CHANNEL_IS_CARDF(dimms, idx) (dimms[idx].card_type == 0xf)
139#define IF_CHANNEL_POPULATED(dimms, idx) if (dimms[idx].card_type != 0)
140#define FOR_EACH_CHANNEL(idx) \
141 for (idx = 0; idx < TOTAL_CHANNELS; ++idx)
142#define FOR_EACH_POPULATED_CHANNEL(dimms, idx) \
143 FOR_EACH_CHANNEL(idx) IF_CHANNEL_POPULATED(dimms, idx)
144
145#define RANKS_PER_CHANNEL 4 /* Only two may be populated */
146#define IF_RANK_POPULATED(dimms, ch, r) \
147 if (dimms[ch].card_type && ((r) < dimms[ch].ranks))
148#define FOR_EACH_RANK_IN_CHANNEL(r) \
149 for (r = 0; r < RANKS_PER_CHANNEL; ++r)
150#define FOR_EACH_POPULATED_RANK_IN_CHANNEL(dimms, ch, r) \
151 FOR_EACH_RANK_IN_CHANNEL(r) IF_RANK_POPULATED(dimms, ch, r)
152#define FOR_EACH_RANK(ch, r) \
153 FOR_EACH_CHANNEL(ch) FOR_EACH_RANK_IN_CHANNEL(r)
154#define FOR_EACH_POPULATED_RANK(dimms, ch, r) \
155 FOR_EACH_RANK(ch, r) IF_RANK_POPULATED(dimms, ch, r)
156
157#define DDR3_MAX_CAS 18
158
159enum {
160 VCO_2666 = 4,
161 VCO_3200 = 0,
162 VCO_4000 = 1,
163 VCO_5333 = 2,
164};
165
166#endif
167
168/* Offsets of read/write training results in CMOS.
169 They will be restored upon S3 resumes. */
170#define CMOS_READ_TRAINING 0x80 /* 16 bytes */
Angel Ponsac4e4b42020-09-16 01:13:00 +0200171#define CMOS_WRITE_TRAINING 0x90 /* 16 bytes (could be reduced to 10 bytes) */
Patrick Georgi2efc8802012-11-06 11:03:53 +0100172
Patrick Georgi2efc8802012-11-06 11:03:53 +0100173#define DEFAULT_MCHBAR 0xfed14000
174#define DEFAULT_DMIBAR 0xfed18000
175#define DEFAULT_EPBAR 0xfed19000
Patrick Georgi2efc8802012-11-06 11:03:53 +0100176
Angel Ponsac4e4b42020-09-16 01:13:00 +0200177#define IOMMU_BASE1 0xfed90000
178#define IOMMU_BASE2 0xfed91000
179#define IOMMU_BASE3 0xfed92000
180#define IOMMU_BASE4 0xfed93000
Patrick Georgi2efc8802012-11-06 11:03:53 +0100181
182/*
183 * D0:F0
184 */
Angel Ponsac4e4b42020-09-16 01:13:00 +0200185#define D0F0_EPBAR_LO 0x40
186#define D0F0_EPBAR_HI 0x44
187#define D0F0_MCHBAR_LO 0x48
188#define D0F0_MCHBAR_HI 0x4c
189#define D0F0_GGC 0x52
190#define D0F0_DEVEN 0x54
191#define D0F0_PCIEXBAR_LO 0x60
192#define D0F0_PCIEXBAR_HI 0x64
193#define D0F0_DMIBAR_LO 0x68
194#define D0F0_DMIBAR_HI 0x6c
195#define D0F0_PMBASE 0x78
196#define D0F0_PAM(x) (0x90 + (x)) /* 0-6 */
197#define D0F0_REMAPBASE 0x98
198#define D0F0_REMAPLIMIT 0x9a
199#define D0F0_SMRAM 0x9d
200#define D0F0_ESMRAMC 0x9e
201#define D0F0_TOM 0xa0
202#define D0F0_TOUUD 0xa2
203#define D0F0_TOLUD 0xb0
204#define D0F0_SKPD 0xdc /* Scratchpad Data */
205#define D0F0_CAPID0 0xe0
Patrick Georgi2efc8802012-11-06 11:03:53 +0100206
207/*
208 * D1:F0 PEG
209 */
Angel Ponsac4e4b42020-09-16 01:13:00 +0200210#define PEG_CAP 0xa2
211#define SLOTCAP 0xb4
212#define PEGLC 0xec
213#define D1F0_VCCAP 0x104
214#define D1F0_VC0RCTL 0x114
Patrick Georgi2efc8802012-11-06 11:03:53 +0100215
216/*
217 * Graphics frequencies
218 */
219#define GCFGC_PCIDEV PCI_DEV(0, 2, 0)
220#define GCFGC_OFFSET 0xf0
221#define GCFGC_CR_SHIFT 0
222#define GCFGC_CR_MASK (0xf << GCFGC_CR_SHIFT)
223#define GCFGC_CS_SHIFT 8
224#define GCFGC_CS_MASK (0xf << GCFGC_CS_SHIFT)
225#define GCFGC_CD_SHIFT 12
226#define GCFGC_CD_MASK (0x1 << GCFGC_CD_SHIFT)
227#define GCFGC_UPDATE_SHIFT 5
228#define GCFGC_UPDATE (0x1 << GCFGC_UPDATE_SHIFT)
229
230/*
231 * MCHBAR
232 */
233
Angel Ponsac4e4b42020-09-16 01:13:00 +0200234#define MCHBAR8(x) *((volatile u8 *)(DEFAULT_MCHBAR + x))
Patrick Georgi2efc8802012-11-06 11:03:53 +0100235#define MCHBAR16(x) *((volatile u16 *)(DEFAULT_MCHBAR + x))
236#define MCHBAR32(x) *((volatile u32 *)(DEFAULT_MCHBAR + x))
237
Nico Huberd85a71a2016-11-27 14:43:12 +0100238#define HPLLVCO_MCHBAR 0x0c0f
239
Patrick Georgi2efc8802012-11-06 11:03:53 +0100240#define PMSTS_MCHBAR 0x0f14 /* Self refresh channel status */
241#define PMSTS_WARM_RESET (1 << 1)
242#define PMSTS_BOTH_SELFREFRESH (1 << 0)
243
244#define CLKCFG_MCHBAR 0x0c00
245#define CLKCFG_FSBCLK_SHIFT 0
246#define CLKCFG_FSBCLK_MASK (7 << CLKCFG_FSBCLK_SHIFT)
247#define CLKCFG_MEMCLK_SHIFT 4
248#define CLKCFG_MEMCLK_MASK (7 << CLKCFG_MEMCLK_SHIFT)
249#define CLKCFG_UPDATE (1 << 12)
250
251#define SSKPD_MCHBAR 0x0c1c
252#define SSKPD_CLK_SHIFT 0
253#define SSKPD_CLK_MASK (7 << SSKPD_CLK_SHIFT)
254
255#define DCC_MCHBAR 0x200
256#define DCC_NO_CHANXOR (1 << 10)
257#define DCC_INTERLEAVED (1 << 1)
258#define DCC_CMD_SHIFT 16
259#define DCC_CMD_MASK (7 << DCC_CMD_SHIFT)
260#define DCC_CMD_NOP (1 << DCC_CMD_SHIFT)
261 /* For mode register mr0: */
262#define DCC_SET_MREG (3 << DCC_CMD_SHIFT)
263 /* For extended mode registers mr1 to mr3: */
264#define DCC_SET_EREG (4 << DCC_CMD_SHIFT)
265#define DCC_SET_EREG_SHIFT 21
266#define DCC_SET_EREG_MASK (DCC_CMD_MASK | (3 << DCC_SET_EREG_SHIFT))
267#define DCC_SET_EREGx(x) ((DCC_SET_EREG | \
268 ((x - 1) << DCC_SET_EREG_SHIFT)) & \
269 DCC_SET_EREG_MASK)
270
271/* Per channel DRAM Row Attribute registers (32-bit) */
272#define CxDRA_MCHBAR(x) (0x1208 + (x * 0x0100))
273#define CxDRA_PAGESIZE_SHIFT(r) (r * 4) /* Per rank r */
274#define CxDRA_PAGESIZE_MASKr(r) (0x7 << CxDRA_PAGESIZE_SHIFT(r))
275#define CxDRA_PAGESIZE_MASK 0x0000ffff
276#define CxDRA_PAGESIZE(r, p) /* for log2(dimm page size in bytes) p */ \
277 (((p - 10) << CxDRA_PAGESIZE_SHIFT(r)) & CxDRA_PAGESIZE_MASKr(r))
278#define CxDRA_BANKS_SHIFT(r) ((r * 3) + 16)
279#define CxDRA_BANKS_MASKr(r) (0x3 << CxDRA_BANKS_SHIFT(r))
280#define CxDRA_BANKS_MASK 0x07ff0000
281#define CxDRA_BANKS(r, b) /* for number of banks b */ \
282 ((b << (CxDRA_BANKS_SHIFT(r) - 3)) & CxDRA_BANKS_MASKr(r))
283
284/*
285 * Per channel DRAM Row Boundary registers (32-bit)
286 * Every two ranks share one register and must be programmed at the same time.
287 * All registers (4 ranks per channel) have to be set.
288 */
Angel Ponsac4e4b42020-09-16 01:13:00 +0200289#define CxDRBy_MCHBAR(x, r) (0x1200 + (x * 0x0100) + ((r / 2) * 4))
Patrick Georgi2efc8802012-11-06 11:03:53 +0100290#define CxDRBy_BOUND_SHIFT(r) ((r % 2) * 16)
291#define CxDRBy_BOUND_MASK(r) (0x1fc << CxDRBy_BOUND_SHIFT(r))
292#define CxDRBy_BOUND_MB(r, b) /* for boundary in MB b */ \
293 (((b >> 5) << CxDRBy_BOUND_SHIFT(r)) & CxDRBy_BOUND_MASK(r))
294
295#define CxDRC0_MCHBAR(x) (0x1230 + (x * 0x0100))
296#define CxDRC0_RANKEN0 (1 << 24) /* Rank Enable */
297#define CxDRC0_RANKEN1 (1 << 25)
298#define CxDRC0_RANKEN2 (1 << 26)
299#define CxDRC0_RANKEN3 (1 << 27)
300#define CxDRC0_RANKEN(r) (1 << (24 + r))
301#define CxDRC0_RANKEN_MASK (0xf << 24)
302#define CxDRC0_RMS_SHIFT 8 /* Refresh Mode Select */
303#define CxDRC0_RMS_MASK (7 << CxDRC0_RMS_SHIFT)
304#define CxDRC0_RMS_78US (2 << CxDRC0_RMS_SHIFT)
305#define CxDRC0_RMS_39US (3 << CxDRC0_RMS_SHIFT)
306
307#define CxDRC1_MCHBAR(x) (0x1234 + (x * 0x0100))
308#define CxDRC1_SSDS_SHIFT 24
309#define CxDRC1_SSDS_MASK (0xff << CxDRC1_SSDS_SHIFT)
310#define CxDRC1_DS (0x91 << CxDRC1_SSDS_SHIFT)
311#define CxDRC1_SS (0xb1 << CxDRC1_SSDS_SHIFT)
312#define CxDRC1_NOTPOP(r) (1 << (16 + r)) /* Write 1 for Not Populated */
313#define CxDRC1_NOTPOP_MASK (0xf << 16)
314#define CxDRC1_MUSTWR (3 << 11)
315
316#define CxDRC2_MCHBAR(x) (0x1238 + (x * 0x0100))
317#define CxDRC2_NOTPOP(r) (1 << (24 + r)) /* Write 1 for Not Populated */
318#define CxDRC2_NOTPOP_MASK (0xf << 24)
319#define CxDRC2_MUSTWR (1 << 12)
320#define CxDRC2_CLK1067MT (1 << 0)
321
322/* DRAM Timing registers (32-bit each) */
323#define CxDRT0_MCHBAR(x) (0x1210 + (x * 0x0100))
324#define CxDRT0_BtB_WtP_SHIFT 26
325#define CxDRT0_BtB_WtP_MASK (0x1f << CxDRT0_BtB_WtP_SHIFT)
326#define CxDRT0_BtB_WtR_SHIFT 20
327#define CxDRT0_BtB_WtR_MASK (0x1f << CxDRT0_BtB_WtR_SHIFT)
328#define CxDRT1_MCHBAR(x) (0x1214 + (x * 0x0100))
329#define CxDRT2_MCHBAR(x) (0x1218 + (x * 0x0100))
330#define CxDRT3_MCHBAR(x) (0x121c + (x * 0x0100))
331#define CxDRT4_MCHBAR(x) (0x1220 + (x * 0x0100))
332#define CxDRT5_MCHBAR(x) (0x1224 + (x * 0x0100))
333#define CxDRT6_MCHBAR(x) (0x1228 + (x * 0x0100))
334
335/* Clock disable registers (32-bit each) */
336#define CxDCLKDIS_MCHBAR(x) (0x120c + (x * 0x0100))
337#define CxDCLKDIS_MASK 3
338#define CxDCLKDIS_ENABLE 3 /* Always enable both clock pairs. */
339
340/* On-Die-Termination registers (2x 32-bit per channel) */
341#define CxODT_HIGH(x) (0x124c + (x * 0x0100))
342#define CxODT_LOW(x) (0x1248 + (x * 0x0100))
343
344/* Write Training registers. */
345#define CxWRTy_MCHBAR(ch, s) (0x1470 + (ch * 0x0100) + ((3 - s) * 4))
346
Angel Ponsac4e4b42020-09-16 01:13:00 +0200347#define CxGTEW(x) (0x1270 + (x * 0x100))
348#define CxGTC(x) (0x1274 + (x * 0x100))
349#define CxDTPEW(x) (0x1278 + (x * 0x100))
350#define CxDTAEW(x) (0x1280 + (x * 0x100))
351#define CxDTC(x) (0x1288 + (x * 0x100))
Patrick Georgi2efc8802012-11-06 11:03:53 +0100352
Angel Pons3378de12020-09-15 14:30:13 +0200353
Patrick Georgi2efc8802012-11-06 11:03:53 +0100354/*
355 * DMIBAR
356 */
357
Angel Ponsac4e4b42020-09-16 01:13:00 +0200358#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x))
Patrick Georgi2efc8802012-11-06 11:03:53 +0100359#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x))
360#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x))
361
Angel Pons3e33be22020-09-16 12:50:59 +0200362#define DMIVCECH 0x000 /* 32bit */
363#define DMIPVCCAP1 0x004 /* 32bit */
364
365#define DMIVC0RCAP 0x010 /* 32bit */
366#define DMIVC0RCTL 0x014 /* 32bit */
367#define DMIVC0RSTS 0x01a /* 16bit */
368#define VC0NP (1 << 1)
369
370#define DMIVC1RCAP 0x01c /* 32bit */
371#define DMIVC1RCTL 0x020 /* 32bit */
372#define DMIVC1RSTS 0x026 /* 16bit */
373#define VC1NP (1 << 1)
374
375#define DMIESD 0x044 /* 32bit */
376
377#define DMILE1D 0x050 /* 32bit */
378#define DMILE1A 0x058 /* 64bit */
379#define DMILE2D 0x060 /* 32bit */
380#define DMILE2A 0x068 /* 64bit */
381
382#define DMILCAP 0x084 /* 32bit */
383#define DMILCTL 0x088 /* 16bit */
384#define DMILSTS 0x08a /* 16bit */
Patrick Georgi2efc8802012-11-06 11:03:53 +0100385
Patrick Georgi2efc8802012-11-06 11:03:53 +0100386/*
387 * EPBAR
388 */
389
Angel Ponsac4e4b42020-09-16 01:13:00 +0200390#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x))
Patrick Georgi2efc8802012-11-06 11:03:53 +0100391#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x))
392#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x))
393
Angel Pons3e33be22020-09-16 12:50:59 +0200394#define EPPVCCAP1 0x004 /* 32bit */
395#define EPPVCCTL 0x00c /* 32bit */
396
397#define EPVC0RCAP 0x010 /* 32bit */
398#define EPVC0RCTL 0x014 /* 32bit */
399#define EPVC0RSTS 0x01a /* 16bit */
400
401#define EPVC1RCAP 0x01c /* 32bit */
402#define EPVC1RCTL 0x020 /* 32bit */
403#define EPVC1RSTS 0x026 /* 16bit */
404
405#define EPVC1MTS 0x028 /* 32bit */
406#define EPVC1ITC 0x02c /* 32bit */
407
408#define EPVC1IST 0x038 /* 64bit */
409
410#define EPESD 0x044 /* 32bit */
411
412#define EPLE1D 0x050 /* 32bit */
413#define EPLE1A 0x058 /* 64bit */
414#define EPLE2D 0x060 /* 32bit */
415#define EPLE2A 0x068 /* 64bit */
416
417#define EP_PORTARB(x) (0x100 + 4 * (x)) /* 256bit */
Patrick Georgi2efc8802012-11-06 11:03:53 +0100418
Patrick Georgi2efc8802012-11-06 11:03:53 +0100419#ifndef __ACPI__
Angel Ponsac4e4b42020-09-16 01:13:00 +0200420
Patrick Georgi2efc8802012-11-06 11:03:53 +0100421void gm45_early_init(void);
422void gm45_early_reset(void);
423
424void enter_raminit_or_reset(void);
425void get_gmch_info(sysinfo_t *);
426void raminit(sysinfo_t *, int s3resume);
427void raminit_thermal(const sysinfo_t *);
Vladimir Serbinenko56ae8a02014-08-16 10:59:02 +0200428void init_igd(const sysinfo_t *const);
Vladimir Serbinenko020dc0e2014-08-12 22:50:40 +0200429void init_pm(const sysinfo_t *, int do_freq_scaling_cfg);
Vladimir Serbinenko56ae8a02014-08-16 10:59:02 +0200430void igd_compute_ggc(sysinfo_t *const sysinfo);
Patrick Georgi2efc8802012-11-06 11:03:53 +0100431
432int raminit_read_vco_index(void);
433u32 raminit_get_rank_addr(unsigned int channel, unsigned int rank);
434
435void raminit_rcomp_calibration(stepping_t stepping);
436void raminit_reset_readwrite_pointers(void);
437void raminit_receive_enable_calibration(const timings_t *, const dimminfo_t *);
438void raminit_write_training(const mem_clock_t, const dimminfo_t *, int s3resume);
439void raminit_read_training(const dimminfo_t *, int s3resume);
440
441void gm45_late_init(stepping_t);
442
443u32 decode_igd_memory_size(u32 gms);
444u32 decode_igd_gtt_size(u32 gsm);
Arthur Heymans8b766052018-01-24 23:25:13 +0100445u32 decode_tseg_size(u8 esmramc);
Patrick Georgi2efc8802012-11-06 11:03:53 +0100446
447void init_iommu(void);
Vladimir Serbinenko33769a52014-08-30 22:39:20 +0200448
Arthur Heymans3b0eb602019-01-31 22:47:09 +0100449/* romstage mainboard hookups */
Arthur Heymans3b0eb602019-01-31 22:47:09 +0100450void mb_setup_superio(void); /* optional */
451void get_mb_spd_addrmap(u8 spd_addrmap[4]);
452void mb_pre_raminit_setup(sysinfo_t *); /* optional */
453void mb_post_raminit_setup(void); /* optional */
454
Arthur Heymans20cb85f2017-04-29 14:31:32 +0200455struct blc_pwm_t {
456 char ascii_string[13];
457 int pwm_freq; /* In Hz */
458};
459int get_blc_values(const struct blc_pwm_t **entries);
Arthur Heymans4d2d1712018-11-29 12:25:31 +0100460u16 get_blc_pwm_freq_value(const char *edid_ascii_string);
Arthur Heymans20cb85f2017-04-29 14:31:32 +0200461
Angel Ponsc0c95162020-08-03 13:55:18 +0200462int decode_pcie_bar(u32 *const base, u32 *const len);
Arthur Heymans20cb85f2017-04-29 14:31:32 +0200463
Alexander Couzens83fc32f2015-04-12 22:28:37 +0200464#include <device/device.h>
465
Vladimir Serbinenko33769a52014-08-30 22:39:20 +0200466struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -0700467unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
468 struct acpi_rsdp *rsdp);
Patrick Georgi2efc8802012-11-06 11:03:53 +0100469
Alexander Couzens83fc32f2015-04-12 22:28:37 +0200470#endif /* !__ACPI__ */
Edward O'Callaghan089a5102015-01-06 02:48:57 +1100471#endif /* __NORTHBRIDGE_INTEL_GM45_GM45_H__ */