coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mainboard.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <cpu/x86/msr.h>
4 #include <cpu/amd/msr.h>
5 #include <device/device.h>
7 
8 static const u8 mainboard_picr_data[] = {
9  0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x0A, 0xF1, 0x00, 0x00, 0x1F, 0x1F,
10  0x1F, 0x1F, 0x09, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00,
11  0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00,
12  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00,
13  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00,
14  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F,
15 };
16 static const u8 mainboard_intr_data[84] = {
17  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F,
18  0x1F, 0x1F, 0x09, 0x1F, 0x1F, 0x10, 0x1F, 0x10, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00,
19  0x00, 0x00, 0x00, 0x00, 0x05, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00,
20  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x11, 0x12, 0x11, 0x12, 0x11, 0x12, 0x00,
21  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x13, 0x00, 0x00, 0x00, 0x00,
22  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13,
23 };
24 
25 /* PIRQ Setup */
26 static void pirq_setup(void)
27 {
30 }
31 
32 /* dedicated "enable" function (taken from thatcher) */
33 static void mainboard_enable(struct device *dev)
34 {
35  msr_t msr;
36 
37  pirq_setup();
38 
39  msr = rdmsr(LS_CFG_MSR);
40  /* Enable streaming store functionality. */
41  msr.lo &= ~(1 << 28);
42  wrmsr(LS_CFG_MSR, msr);
43 
44  msr = rdmsr(DC_CFG_MSR);
45  /* Enable speculative TLB preloads. */
46  msr.lo &= ~(1 << 4);
47  /* Enable the DC hardware prefetcher. */
48  msr.lo &= ~(1 << 13);
49  wrmsr(DC_CFG_MSR, msr);
50 
51  msr = rdmsr(BU_CFG_MSR);
52  /* Disable the L2 way lock. */
53  msr.lo &= ~(1 << 23);
54  wrmsr(BU_CFG_MSR, msr);
55 }
56 
59 };
struct chip_operations mainboard_ops
Definition: mainboard.c:19
static const u8 mainboard_intr_data[84]
Definition: mainboard.c:16
static const u8 mainboard_picr_data[]
Definition: mainboard.c:8
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:33
static void pirq_setup(void)
Definition: mainboard.c:26
#define DC_CFG_MSR
Definition: msr.h:71
#define LS_CFG_MSR
Definition: msr.h:69
#define BU_CFG_MSR
Definition: msr.h:72
static __always_inline msr_t rdmsr(unsigned int index)
Definition: msr.h:146
static __always_inline void wrmsr(unsigned int index, msr_t msr)
Definition: msr.h:157
const u8 * intr_data_ptr
Definition: amd_pci_util.c:13
const u8 * picr_data_ptr
Definition: amd_pci_util.c:14
uint8_t u8
Definition: stdint.h:45
void(* enable_dev)(struct device *dev)
Definition: device.h:24
Definition: device.h:107
unsigned int lo
Definition: msr.h:111