blob: 5da453b527a0d7ae56cc882e71945767b26e9cb2 [file] [log] [blame]
Angel Pons0612b272020-04-05 15:46:56 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Subrata Banik03e971c2017-03-07 14:02:23 +05302
3#include <commonlib/helpers.h>
4#include <cpu/x86/cache.h>
5#include <cpu/x86/cr.h>
Elyes HAOUAS419bfbc2018-10-01 08:47:51 +02006#include <cpu/x86/msr.h>
Subrata Banik03e971c2017-03-07 14:02:23 +05307#include <cpu/x86/mtrr.h>
8#include <cpu/x86/post_code.h>
9#include <rules.h>
10#include <intelblocks/msr.h>
11
Kyösti Mälkki7522a8f2020-11-20 16:47:38 +020012.section .init, "ax", @progbits
13
Patrick Rudolph2b771122020-11-30 13:52:42 +010014.code32
Arthur Heymans64c9c6d2019-11-25 09:45:40 +010015
16/*
17 * macro: find_free_mtrr
18 * Clobbers: %eax, %ebx, %ecx, %edx.
19 * Returns:
20 * %ebx contains the number of freely available MTRR's.
21 * It should be checked against 0.
22 * %ecx holds the MTRR_BASE of the free MTRR.
23 */
24.macro find_free_mtrr
25 /* Figure out how many MTRRs we have */
26 mov $MTRR_CAP_MSR, %ecx
27 rdmsr
28 movzb %al, %ebx /* Number of variable MTRRs */
29
30 /* Find a free variable MTRR */
31 movl $MTRR_PHYS_MASK(0), %ecx
321:
33 rdmsr
34 test $MTRR_PHYS_MASK_VALID, %eax
35 jz 2f
36 addl $2, %ecx
37 dec %ebx
38 jnz 1b
392:
40 /* %ecx needs to hold the MTRR_BASE */
41 decl %ecx
42.endm
43
Arthur Heymans99a48bc2019-11-25 09:56:20 +010044/*
45 * macro: clear_car
46 * Clears the region between CONFIG_DCACHE_RAM_BASE and
47 * CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE to populate
48 * cachelines.
49 * Clobbers %eax, %ecx, %edi.
50 */
51.macro clear_car
52 /* Clear the cache memory region. This will also fill up the cache */
53 movl $CONFIG_DCACHE_RAM_BASE, %edi
54 movl $CONFIG_DCACHE_RAM_SIZE, %ecx
55 shr $0x02, %ecx
56 xor %eax, %eax
57 cld
58 rep stosl
59.endm
60
Subrata Banik03e971c2017-03-07 14:02:23 +053061.global bootblock_pre_c_entry
62bootblock_pre_c_entry:
63
64 post_code(0x20)
65
Arthur Heymansc4772b92019-04-14 18:38:35 +020066 movl $no_reset, %esp /* return address */
67 jmp check_mtrr /* Check if CPU properly reset */
Subrata Banik03e971c2017-03-07 14:02:23 +053068
69no_reset:
70 post_code(0x21)
71
72 /* Clear/disable fixed MTRRs */
73 mov $fixed_mtrr_list_size, %ebx
74 xor %eax, %eax
75 xor %edx, %edx
76
77clear_fixed_mtrr:
78 add $-2, %ebx
79 movzwl fixed_mtrr_list(%ebx), %ecx
80 wrmsr
81 jnz clear_fixed_mtrr
82
83 post_code(0x22)
84
Arthur Heymansc57d3032021-06-16 09:56:26 +020085 /* Figure out how many MTRRs we have, and clear them out */
Subrata Banik03e971c2017-03-07 14:02:23 +053086 mov $MTRR_CAP_MSR, %ecx
87 rdmsr
88 movzb %al, %ebx /* Number of variable MTRRs */
89 mov $MTRR_PHYS_BASE(0), %ecx
90 xor %eax, %eax
91 xor %edx, %edx
92
93clear_var_mtrr:
94 wrmsr
95 inc %ecx
96 wrmsr
97 inc %ecx
98 dec %ebx
99 jnz clear_var_mtrr
100
101 post_code(0x23)
102
103 /* Configure default memory type to uncacheable (UC) */
104 mov $MTRR_DEF_TYPE_MSR, %ecx
105 rdmsr
106 /* Clear enable bits and set default type to UC. */
107 and $~(MTRR_DEF_TYPE_MASK | MTRR_DEF_TYPE_EN | \
108 MTRR_DEF_TYPE_FIX_EN), %eax
109 wrmsr
110
111 /* Configure MTRR_PHYS_MASK_HIGH for proper addressing above 4GB
112 * based on the physical address size supported for this processor
113 * This is based on read from CPUID EAX = 080000008h, EAX bits [7:0]
114 *
115 * Examples:
116 * MTRR_PHYS_MASK_HIGH = 00000000Fh For 36 bit addressing
117 * MTRR_PHYS_MASK_HIGH = 0000000FFh For 40 bit addressing
118 */
119
Elyes HAOUAS05498a22018-05-28 16:26:43 +0200120 movl $0x80000008, %eax /* Address sizes leaf */
Subrata Banik03e971c2017-03-07 14:02:23 +0530121 cpuid
122 sub $32, %al
123 movzx %al, %eax
124 xorl %esi, %esi
125 bts %eax, %esi
126 dec %esi /* esi <- MTRR_PHYS_MASK_HIGH */
127
128 post_code(0x24)
129
130#if ((CONFIG_DCACHE_RAM_SIZE & (CONFIG_DCACHE_RAM_SIZE - 1)) == 0)
Arthur Heymans64c9c6d2019-11-25 09:45:40 +0100131 find_free_mtrr
132 test %ebx, %ebx
133 jz .halt_forever
134
Subrata Banik03e971c2017-03-07 14:02:23 +0530135 /* Configure CAR region as write-back (WB) */
Subrata Banik03e971c2017-03-07 14:02:23 +0530136 mov $CONFIG_DCACHE_RAM_BASE, %eax
137 or $MTRR_TYPE_WRBACK, %eax
138 xor %edx,%edx
139 wrmsr
140
141 /* Configure the MTRR mask for the size region */
Arthur Heymans64c9c6d2019-11-25 09:45:40 +0100142 inc %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530143 mov $CONFIG_DCACHE_RAM_SIZE, %eax /* size mask */
144 dec %eax
145 not %eax
146 or $MTRR_PHYS_MASK_VALID, %eax
147 movl %esi, %edx /* edx <- MTRR_PHYS_MASK_HIGH */
148 wrmsr
149#elif (CONFIG_DCACHE_RAM_SIZE == 768 * KiB) /* 768 KiB */
Arthur Heymans64c9c6d2019-11-25 09:45:40 +0100150 find_free_mtrr
151 test %ebx, %ebx
152 jz .halt_forever
153
Subrata Banik03e971c2017-03-07 14:02:23 +0530154 /* Configure CAR region as write-back (WB) */
Subrata Banik03e971c2017-03-07 14:02:23 +0530155 mov $CONFIG_DCACHE_RAM_BASE, %eax
156 or $MTRR_TYPE_WRBACK, %eax
157 xor %edx,%edx
158 wrmsr
159
Arthur Heymans64c9c6d2019-11-25 09:45:40 +0100160 incl %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530161 mov $(512 * KiB), %eax /* size mask */
162 dec %eax
163 not %eax
164 or $MTRR_PHYS_MASK_VALID, %eax
165 movl %esi, %edx /* edx <- MTRR_PHYS_MASK_HIGH */
166 wrmsr
167
Arthur Heymans64c9c6d2019-11-25 09:45:40 +0100168 find_free_mtrr
169 test %ebx, %ebx
170 jz .halt_forever
1711:
Subrata Banik03e971c2017-03-07 14:02:23 +0530172 mov $(CONFIG_DCACHE_RAM_BASE + 512 * KiB), %eax
173 or $MTRR_TYPE_WRBACK, %eax
174 xor %edx,%edx
175 wrmsr
176
Arthur Heymans64c9c6d2019-11-25 09:45:40 +0100177 incl %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530178 mov $(256 * KiB), %eax /* size mask */
179 dec %eax
180 not %eax
181 or $MTRR_PHYS_MASK_VALID, %eax
182 movl %esi, %edx /* edx <- MTRR_PHYS_MASK_HIGH */
183 wrmsr
184#else
185#error "DCACHE_RAM_SIZE is not a power of 2 and setup code is missing"
186#endif
187 post_code(0x25)
188
189 /* Enable variable MTRRs */
190 mov $MTRR_DEF_TYPE_MSR, %ecx
191 rdmsr
192 or $MTRR_DEF_TYPE_EN, %eax
193 wrmsr
194
195 /* Enable caching */
196 mov %cr0, %eax
197 and $~(CR0_CD | CR0_NW), %eax
198 invd
199 mov %eax, %cr0
200
Julius Wernercd49cce2019-03-05 16:53:33 -0800201#if CONFIG(INTEL_CAR_NEM)
Subrata Banik03e971c2017-03-07 14:02:23 +0530202 jmp car_nem
Julius Wernercd49cce2019-03-05 16:53:33 -0800203#elif CONFIG(INTEL_CAR_CQOS)
Subrata Banik03e971c2017-03-07 14:02:23 +0530204 jmp car_cqos
Julius Wernercd49cce2019-03-05 16:53:33 -0800205#elif CONFIG(INTEL_CAR_NEM_ENHANCED)
Subrata Banik03e971c2017-03-07 14:02:23 +0530206 jmp car_nem_enhanced
207#else
208 jmp .halt_forever /* In case nothing has selected */
209#endif
210
211.global car_init_done
212car_init_done:
213
214 post_code(0x29)
215
216 /* Setup bootblock stack */
Arthur Heymansdf9cdcf2019-11-09 06:50:20 +0100217 mov $_ecar_stack, %esp
Subrata Banik03e971c2017-03-07 14:02:23 +0530218
Aaron Durbin028e18f2017-06-23 11:14:58 -0500219 /* Need to align stack to 16 bytes at call instruction. Account for
220 the two pushes below. */
221 andl $0xfffffff0, %esp
Patrick Rudolph2b771122020-11-30 13:52:42 +0100222
223#if ENV_X86_64
224 #include <cpu/x86/64bit/entry64.inc>
225 movd %mm2, %rdi
226 shlq $32, %rdi
227 movd %mm1, %rsi
228 or %rsi, %rdi
229 movd %mm0, %rsi
230#else
Aaron Durbin028e18f2017-06-23 11:14:58 -0500231 sub $8, %esp
232
Subrata Banik5885ffe2019-11-14 11:08:51 +0530233 /* push TSC value to stack */
Subrata Banik03e971c2017-03-07 14:02:23 +0530234 movd %mm2, %eax
235 pushl %eax /* tsc[63:32] */
236 movd %mm1, %eax
Elyes HAOUAS05498a22018-05-28 16:26:43 +0200237 pushl %eax /* tsc[31:0] */
Patrick Rudolph2b771122020-11-30 13:52:42 +0100238#endif
Subrata Banik03e971c2017-03-07 14:02:23 +0530239
240before_carstage:
241 post_code(0x2A)
242
243 call bootblock_c_entry
244 /* Never reached */
245
246.halt_forever:
247 post_code(POST_DEAD_CODE)
248 hlt
249 jmp .halt_forever
250
251fixed_mtrr_list:
252 .word MTRR_FIX_64K_00000
253 .word MTRR_FIX_16K_80000
254 .word MTRR_FIX_16K_A0000
255 .word MTRR_FIX_4K_C0000
256 .word MTRR_FIX_4K_C8000
257 .word MTRR_FIX_4K_D0000
258 .word MTRR_FIX_4K_D8000
259 .word MTRR_FIX_4K_E0000
260 .word MTRR_FIX_4K_E8000
261 .word MTRR_FIX_4K_F0000
262 .word MTRR_FIX_4K_F8000
263fixed_mtrr_list_size = . - fixed_mtrr_list
264
Julius Wernercd49cce2019-03-05 16:53:33 -0800265#if CONFIG(INTEL_CAR_NEM)
Subrata Banik03e971c2017-03-07 14:02:23 +0530266.global car_nem
267car_nem:
268 /* Disable cache eviction (setup stage) */
269 mov $MSR_EVICT_CTL, %ecx
270 rdmsr
271 or $0x1, %eax
272 wrmsr
273
274 post_code(0x26)
275
Arthur Heymans99a48bc2019-11-25 09:56:20 +0100276 clear_car
Subrata Banik03e971c2017-03-07 14:02:23 +0530277
278 post_code(0x27)
279
280 /* Disable cache eviction (run stage) */
281 mov $MSR_EVICT_CTL, %ecx
282 rdmsr
283 or $0x2, %eax
284 wrmsr
285
286 post_code(0x28)
287
288 jmp car_init_done
289
Julius Wernercd49cce2019-03-05 16:53:33 -0800290#elif CONFIG(INTEL_CAR_CQOS)
Subrata Banik03e971c2017-03-07 14:02:23 +0530291.global car_cqos
292car_cqos:
293 /*
Naresh G Solankif329f0c2017-09-27 14:21:18 +0530294 * Create CBM_LEN_MASK based on CBM_LEN
295 * Get CPUID.(EAX=10H, ECX=2H):EAX.CBM_LEN[bits 4:0]
296 */
297 mov $0x10, %eax
298 mov $0x2, %ecx
299 cpuid
300 and $0x1F, %eax
301 add $1, %al
302
303 mov $1, %ebx
304 mov %al, %cl
305 shl %cl, %ebx
306 sub $1, %ebx
307
308 /* Store the CBM_LEN_MASK in mm3 for later use. */
309 movd %ebx, %mm3
310
311 /*
Subrata Banik03e971c2017-03-07 14:02:23 +0530312 * Disable both L1 and L2 prefetcher. For yet-to-understood reason,
313 * prefetchers slow down filling cache with rep stos in CQOS mode.
314 */
315 mov $MSR_PREFETCH_CTL, %ecx
316 rdmsr
317 or $(PREFETCH_L1_DISABLE | PREFETCH_L2_DISABLE), %eax
318 wrmsr
319
320#if (CONFIG_DCACHE_RAM_SIZE == CONFIG_L2_CACHE_SIZE)
321/*
322 * If CAR size is set to full L2 size, mask is calculated as all-zeros.
323 * This is not supported by the CPU/uCode.
324 */
325#error "CQOS CAR may not use whole L2 cache area"
326#endif
327
328 /* Calculate how many bits to be used for CAR */
329 xor %edx, %edx
330 mov $CONFIG_DCACHE_RAM_SIZE, %eax /* dividend */
331 mov $CONFIG_CACHE_QOS_SIZE_PER_BIT, %ecx /* divisor */
332 div %ecx /* result is in eax */
333 mov %eax, %ecx /* save to ecx */
334 mov $1, %ebx
335 shl %cl, %ebx
336 sub $1, %ebx /* resulting mask is is in ebx */
337
338 /* Set this mask for initial cache fill */
339 mov $MSR_L2_QOS_MASK(0), %ecx
340 rdmsr
Naresh G Solankif329f0c2017-09-27 14:21:18 +0530341 mov %ebx, %eax
Subrata Banik03e971c2017-03-07 14:02:23 +0530342 wrmsr
343
344 /* Set CLOS selector to 0 */
Elyes HAOUAS419bfbc2018-10-01 08:47:51 +0200345 mov $IA32_PQR_ASSOC, %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530346 rdmsr
347 and $~IA32_PQR_ASSOC_MASK, %edx /* select mask 0 */
348 wrmsr
349
350 /* We will need to block CAR region from evicts */
351 mov $MSR_L2_QOS_MASK(1), %ecx
352 rdmsr
353 /* Invert bits that are to be used for cache */
Naresh G Solankif329f0c2017-09-27 14:21:18 +0530354 mov %ebx, %eax
355 xor $~0, %eax /* invert 32 bits */
356
357 /*
358 * Use CBM_LEN_MASK stored in mm3 to set bits based on Capacity Bit
359 * Mask Length.
360 */
361 movd %mm3, %ebx
362 and %ebx, %eax
Subrata Banik03e971c2017-03-07 14:02:23 +0530363 wrmsr
364
365 post_code(0x26)
366
Arthur Heymans99a48bc2019-11-25 09:56:20 +0100367 clear_car
Subrata Banik03e971c2017-03-07 14:02:23 +0530368
369 post_code(0x27)
370
371 /* Cache is populated. Use mask 1 that will block evicts */
Elyes HAOUAS419bfbc2018-10-01 08:47:51 +0200372 mov $IA32_PQR_ASSOC, %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530373 rdmsr
374 and $~IA32_PQR_ASSOC_MASK, %edx /* clear index bits first */
375 or $1, %edx /* select mask 1 */
376 wrmsr
377
378 /* Enable prefetchers */
379 mov $MSR_PREFETCH_CTL, %ecx
380 rdmsr
381 and $~(PREFETCH_L1_DISABLE | PREFETCH_L2_DISABLE), %eax
382 wrmsr
383
384 post_code(0x28)
385
386 jmp car_init_done
387
Julius Wernercd49cce2019-03-05 16:53:33 -0800388#elif CONFIG(INTEL_CAR_NEM_ENHANCED)
Subrata Banik03e971c2017-03-07 14:02:23 +0530389.global car_nem_enhanced
390car_nem_enhanced:
391 /* Disable cache eviction (setup stage) */
392 mov $MSR_EVICT_CTL, %ecx
393 rdmsr
394 or $0x1, %eax
395 wrmsr
396 post_code(0x26)
397
398 /* Create n-way set associativity of cache */
399 xorl %edi, %edi
400find_llc_subleaf:
401 movl %edi, %ecx
402 movl $0x04, %eax
403 cpuid
404 inc %edi
405 and $0xe0, %al /* EAX[7:5] = Cache Level */
406 cmp $0x60, %al /* Check to see if it is LLC */
407 jnz find_llc_subleaf
408
409 /*
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530410 * Calculate the total LLC size
411 * (Line_Size + 1) * (Sets + 1) * (Partitions + 1) * (Ways + 1)
412 * (EBX[11:0] + 1) * (ECX + 1) * (EBX[21:12] + 1) * EBX[31:22] + 1)
413 */
414
415 mov %ebx, %eax
416 and $0xFFF, %eax
417 inc %eax
418 inc %ecx
419 mul %ecx
420 mov %eax, %ecx
421 mov %ebx, %eax
422 shr $12, %eax
423 and $0x3FF, %eax
424 inc %eax
425 mul %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530426 shr $22, %ebx
427 inc %ebx
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530428 mov %ebx, %edx
429 mul %ebx /* eax now holds total LLC size */
Subrata Banik03e971c2017-03-07 14:02:23 +0530430
431 /*
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530432 * The number of the ways that we want to protect from eviction
433 * can be calculated as RW data stack size / way size where way
434 * size is Total LLC size / Total number of LLC ways.
Subrata Banik03e971c2017-03-07 14:02:23 +0530435 */
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530436 div %ebx /* way size */
437 mov %eax, %ecx
438
Subrata Banik03e971c2017-03-07 14:02:23 +0530439 /*
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530440 * Check if way size if bigger than the cache ram size.
441 * Then we need to allocate just one way for non-eviction
442 * of RW data.
443 */
Subrata Banik06039022021-03-09 14:40:39 +0530444 movl $0x01, %eax
445 cmp $CONFIG_DCACHE_RAM_SIZE, %ecx
446 jnc set_eviction_mask
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530447
448 /*
449 * RW data size / way size is equal to number of
450 * ways to be configured for non-eviction
451 */
Subrata Banik06039022021-03-09 14:40:39 +0530452 mov $CONFIG_DCACHE_RAM_SIZE, %eax
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530453 div %ecx
454 mov %eax, %ecx
455 movl $0x01, %eax
456 shl %cl, %eax
457 subl $0x01, %eax
458
459set_eviction_mask:
Shreesh Chhabbi860c6842020-12-03 15:06:20 -0800460 mov %ebx, %ecx /* back up number of ways */
461 mov %eax, %ebx /* back up the non-eviction mask*/
462#if CONFIG(CAR_HAS_SF_MASKS)
463 mov %ecx, %edi /* use number of ways to prepare SF mask */
464 /*
465 * SF mask is programmed with the double number of bits than
466 * the number of ways
467 */
468 mov $0x01, %eax
469 shl %cl, %eax
470 shl %cl, %eax
471 subl $0x01, %eax /* contains SF mask */
472 /*
473 * Program MSR 0x1891 IA32_CR_SF_QOS_MASK_1 with
474 * total number of LLC ways
475 */
476 movl $IA32_CR_SF_QOS_MASK_1, %ecx
477 xorl %edx, %edx
478 wrmsr
479 mov %edi, %ecx /* restore number of ways */
480#endif
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530481 /*
Shreesh Chhabbi87c7ec72020-12-03 14:07:15 -0800482 * Program MSR 0xC91 IA32_L3_MASK_1
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530483 * This MSR contain one bit per each way of LLC
Subrata Banik03e971c2017-03-07 14:02:23 +0530484 * - If this bit is '0' - the way is protected from eviction
485 * - If this bit is '1' - the way is not protected from eviction
486 */
Subrata Banik06039022021-03-09 14:40:39 +0530487 mov $0x1, %eax
488 shl %cl, %eax
489 subl $0x01, %eax
490 mov %eax, %ecx
491 mov %ebx, %eax
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530492
493 xor $~0, %eax /* invert 32 bits */
494 and %ecx, %eax
Elyes HAOUAS419bfbc2018-10-01 08:47:51 +0200495 movl $IA32_L3_MASK_1, %ecx
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530496 xorl %edx, %edx
497 wrmsr
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530498 /*
Shreesh Chhabbi87c7ec72020-12-03 14:07:15 -0800499 * Program MSR 0xC92 IA32_L3_MASK_2
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530500 * This MSR contain one bit per each way of LLC
501 * - If this bit is '0' - the way is protected from eviction
502 * - If this bit is '1' - the way is not protected from eviction
503 */
504 mov %ebx, %eax
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530505 movl $IA32_L3_MASK_2, %ecx
Subrata Banik03e971c2017-03-07 14:02:23 +0530506 xorl %edx, %edx
507 wrmsr
508 /*
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530509 * Set IA32_PQR_ASSOC
Subrata Banik03e971c2017-03-07 14:02:23 +0530510 *
511 * Possible values:
512 * 0: Default value, no way mask should be applied
513 * 1: Apply way mask 1 to LLC
514 * 2: Apply way mask 2 to LLC
515 * 3: Shouldn't be use in NEM Mode
516 */
Elyes HAOUAS419bfbc2018-10-01 08:47:51 +0200517 movl $IA32_PQR_ASSOC, %ecx
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530518 xorl %eax, %eax
Subrata Banik03e971c2017-03-07 14:02:23 +0530519 xorl %edx, %edx
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530520#if CONFIG(COS_MAPPED_TO_MSB)
521 movl $0x02, %edx
522#else
523 movl $0x02, %eax
524#endif
Subrata Banik03e971c2017-03-07 14:02:23 +0530525 wrmsr
Arthur Heymans99a48bc2019-11-25 09:56:20 +0100526
527 clear_car
528
Subrata Banik03e971c2017-03-07 14:02:23 +0530529 /*
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530530 * Set IA32_PQR_ASSOC
Subrata Banik03e971c2017-03-07 14:02:23 +0530531 * At this stage we apply LLC_WAY_MASK_1 to the cache.
Subrata Banik03e971c2017-03-07 14:02:23 +0530532 */
Elyes HAOUAS419bfbc2018-10-01 08:47:51 +0200533 movl $IA32_PQR_ASSOC, %ecx
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530534 xorl %eax, %eax
Subrata Banik03e971c2017-03-07 14:02:23 +0530535 xorl %edx, %edx
Aamir Bohrac1d227d2020-07-16 09:03:06 +0530536#if CONFIG(COS_MAPPED_TO_MSB)
537 movl $0x01, %edx
538#else
539 movl $0x01, %eax
540#endif
Subrata Banik03e971c2017-03-07 14:02:23 +0530541 wrmsr
542
543 post_code(0x27)
544 /*
545 * Enable No-Eviction Mode Run State by setting
546 * NO_EVICT_MODE MSR 2E0h bit [1] = '1'.
547 */
548
549 movl $MSR_EVICT_CTL, %ecx
550 rdmsr
551 orl $0x02, %eax
552 wrmsr
553
554 post_code(0x28)
555
556 jmp car_init_done
557#endif