Fix the indent and whitespace to match LinuxBIOS standards
[coreboot.git] / src / mainboard / amd / norwich / mainboard.c
1 /*
2 * This file is part of the LinuxBIOS project.
3 *
4 * Copyright (C) 2007 Advanced Micro Devices
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA      02110-1301 USA
18 */
19
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <arch/io.h>
23 #include <cpu/x86/msr.h>
24 #include <cpu/amd/lxdef.h>
25 #include <device/pci_def.h>
26 #include "../../../southbridge/amd/cs5536/cs5536.h"
27 #include "chip.h"
28
29 /* Print the platform configuration - do before PCI init or it will not work right */
30 void print_conf(void)
31 {
32 #if DEFAULT_CONSOLE_LOGLEVEL >= BIOS_ERR
33         int i;
34         unsigned long iol;
35         msr_t msr;
36
37         int cpu_msr_defs[] = { CPU_BC_L2_CONF, CPU_IM_CONFIG,
38                 CPU_DM_CONFIG0, CPU_RCONF_DEFAULT,
39                 CPU_RCONF_BYPASS, CPU_RCONF_A0_BF, CPU_RCONF_C0_DF,
40                     CPU_RCONF_E0_FF,
41                 CPU_RCONF_SMM, CPU_RCONF_DMM, GLCP_DELAY_CONTROLS, GL_END
42         };
43
44         int gliu0_msr_defs[] =
45             { MSR_GLIU0_BASE1, MSR_GLIU0_BASE2, MSR_GLIU0_BASE4,
46  MSR_GLIU0_BASE5, MSR_GLIU0_BASE6,
47                 GLIU0_P2D_BMO_0, GLIU0_P2D_BMO_1, MSR_GLIU0_SYSMEM,
48                 GLIU0_P2D_RO_0, GLIU0_P2D_RO_1, GLIU0_P2D_RO_2,
49                     MSR_GLIU0_SHADOW,
50                 GLIU0_IOD_BM_0, GLIU0_IOD_BM_1, GLIU0_IOD_BM_2,
51                 GLIU0_IOD_SC_0, GLIU0_IOD_SC_1, GLIU0_IOD_SC_2, GLIU0_IOD_SC_3,
52                     GLIU0_IOD_SC_4, GLIU0_IOD_SC_5,
53                 GLIU0_GLD_MSR_COH, GL_END
54         };
55
56         int gliu1_msr_defs[] =
57             { MSR_GLIU1_BASE1, MSR_GLIU1_BASE2, MSR_GLIU1_BASE3,
58  MSR_GLIU1_BASE4, MSR_GLIU1_BASE5, MSR_GLIU1_BASE6,
59                 MSR_GLIU1_BASE7, MSR_GLIU1_BASE8, MSR_GLIU1_BASE9,
60                     MSR_GLIU1_BASE10,
61                 GLIU1_P2D_R_0, GLIU1_P2D_R_1, GLIU1_P2D_R_2, GLIU1_P2D_R_3,
62                     MSR_GLIU1_SHADOW,
63                 GLIU1_IOD_BM_0, GLIU1_IOD_BM_1, GLIU1_IOD_BM_2,
64                 GLIU1_IOD_SC_0, GLIU1_IOD_SC_1, GLIU1_IOD_SC_2, GLIU1_IOD_SC_3,
65                 GLIU1_GLD_MSR_COH, GL_END
66         };
67
68         int rconf_msr[] =
69             { CPU_RCONF0, CPU_RCONF1, CPU_RCONF2, CPU_RCONF3, CPU_RCONF4,
70                 CPU_RCONF5, CPU_RCONF6, CPU_RCONF7, GL_END
71         };
72
73         int cs5536_msr[] =
74             { MDD_LBAR_GPIO, MDD_LBAR_FLSH0, MDD_LBAR_FLSH1, MDD_LEG_IO,
75      MDD_PIN_OPT,
76                 MDD_IRQM_ZLOW, MDD_IRQM_ZHIGH, MDD_IRQM_PRIM, GL_END
77         };
78
79         int pci_msr[] =
80             { GLPCI_CTRL, GLPCI_ARB, GLPCI_REN, GLPCI_A0_BF, GLPCI_C0_DF,
81         GLPCI_E0_FF,
82                 GLPCI_RC0, GLPCI_RC1, GLPCI_RC2, GLPCI_RC3, GLPCI_ExtMSR,
83                     GLPCI_SPARE,
84                 GL_END
85         };
86
87         int dma_msr[] =
88             { MDD_DMA_MAP, MDD_DMA_SHAD1, MDD_DMA_SHAD2, MDD_DMA_SHAD3,
89         MDD_DMA_SHAD4,
90                 MDD_DMA_SHAD5, MDD_DMA_SHAD6, MDD_DMA_SHAD7, MDD_DMA_SHAD8,
91                 MDD_DMA_SHAD9, GL_END
92         };
93
94         printk_debug("---------- CPU ------------\n");
95
96         for (i = 0; cpu_msr_defs[i] != GL_END; i++) {
97                 msr = rdmsr(cpu_msr_defs[i]);
98                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n",
99                              cpu_msr_defs[i], msr.hi, msr.lo);
100         }
101
102         printk_debug("---------- GLIU 0 ------------\n");
103
104         for (i = 0; gliu0_msr_defs[i] != GL_END; i++) {
105                 msr = rdmsr(gliu0_msr_defs[i]);
106                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n",
107                              gliu0_msr_defs[i], msr.hi, msr.lo);
108         }
109
110         printk_debug("---------- GLIU 1 ------------\n");
111
112         for (i = 0; gliu1_msr_defs[i] != GL_END; i++) {
113                 msr = rdmsr(gliu1_msr_defs[i]);
114                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n",
115                              gliu1_msr_defs[i], msr.hi, msr.lo);
116         }
117
118         printk_debug("---------- RCONF ------------\n");
119
120         for (i = 0; rconf_msr[i] != GL_END; i++) {
121                 msr = rdmsr(rconf_msr[i]);
122                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", rconf_msr[i],
123                              msr.hi, msr.lo);
124         }
125
126         printk_debug("---------- VARIA ------------\n");
127         msr = rdmsr(0x51300010);
128         printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", 0x51300010, msr.hi,
129                      msr.lo);
130
131         msr = rdmsr(0x51400015);
132         printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", 0x51400015, msr.hi,
133                      msr.lo);
134
135         printk_debug("---------- DIVIL IRQ ------------\n");
136         msr = rdmsr(MDD_IRQM_YLOW);
137         printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", MDD_IRQM_YLOW, msr.hi,
138                      msr.lo);
139         msr = rdmsr(MDD_IRQM_YHIGH);
140         printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", MDD_IRQM_YHIGH,
141                      msr.hi, msr.lo);
142         msr = rdmsr(MDD_IRQM_ZLOW);
143         printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", MDD_IRQM_ZLOW, msr.hi,
144                      msr.lo);
145         msr = rdmsr(MDD_IRQM_ZHIGH);
146         printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", MDD_IRQM_ZHIGH,
147                      msr.hi, msr.lo);
148
149         printk_debug("---------- PCI ------------\n");
150
151         for (i = 0; pci_msr[i] != GL_END; i++) {
152                 msr = rdmsr(pci_msr[i]);
153                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", pci_msr[i],
154                              msr.hi, msr.lo);
155         }
156
157         printk_debug("---------- LPC/UART DMA ------------\n");
158
159         for (i = 0; dma_msr[i] != GL_END; i++) {
160                 msr = rdmsr(dma_msr[i]);
161                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", dma_msr[i],
162                              msr.hi, msr.lo);
163         }
164
165         printk_debug("---------- CS5536 ------------\n");
166
167         for (i = 0; cs5536_msr[i] != GL_END; i++) {
168                 msr = rdmsr(cs5536_msr[i]);
169                 printk_debug("MSR 0x%08X is now 0x%08X:0x%08X\n", cs5536_msr[i],
170                              msr.hi, msr.lo);
171         }
172
173         iol = inl(GPIO_IO_BASE + GPIOL_INPUT_ENABLE);
174         printk_debug("IOR 0x%08X is now 0x%08X\n",
175                      GPIO_IO_BASE + GPIOL_INPUT_ENABLE, iol);
176         iol = inl(GPIOL_EVENTS_ENABLE);
177         printk_debug("IOR 0x%08X is now 0x%08X\n",
178                      GPIO_IO_BASE + GPIOL_EVENTS_ENABLE, iol);
179         iol = inl(GPIOL_INPUT_INVERT_ENABLE);
180         printk_debug("IOR 0x%08X is now 0x%08X\n",
181                      GPIO_IO_BASE + GPIOL_INPUT_INVERT_ENABLE, iol);
182         iol = inl(GPIO_MAPPER_X);
183         printk_debug("IOR 0x%08X is now 0x%08X\n", GPIO_IO_BASE + GPIO_MAPPER_X,
184                      iol);
185 #endif                          //DEFAULT_CONSOLE_LOGLEVEL >= BIOS_ERR
186 }
187
188 static void init(struct device *dev)
189 {
190         printk_debug("Norwich ENTER %s\n", __FUNCTION__);
191         printk_debug("Norwich EXIT %s\n", __FUNCTION__);
192 }
193
194 static void enable_dev(struct device *dev)
195 {
196         dev->ops->init = init;
197 }
198
199 struct chip_operations mainboard_amd_norwich_ops = {
200         CHIP_NAME("AMD Norwich Mainboard")
201             .enable_dev = enable_dev,
202
203 };