copy_and_run: drop boot_complete parameter
[gnutoo-for-coreboot:coreboot.git] / src / mainboard / amd / torpedo / romstage.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 Advanced Micro Devices, Inc.
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 as published by
8  * the Free Software Foundation; version 2 of the License.
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 <stdint.h>
21 #include <string.h>
22 #include <device/pci_def.h>
23 #include <device/pci_ids.h>
24 #include <arch/io.h>
25 #include <arch/stages.h>
26 #include <device/pnp_def.h>
27 #include <cpu/x86/lapic.h>
28 #include <console/console.h>
29 #include <console/loglevel.h>
30 #include "agesawrapper.h"
31 #include "cpu/x86/bist.h"
32 #include "superio/smsc/kbc1100/kbc1100_early_init.c"
33 #include "cpu/x86/lapic/boot_cpu.c"
34 #include "drivers/pc80/i8254.c"
35 #include "drivers/pc80/i8259.c"
36 #include "SbEarly.h"
37 #include "SbPlatform.h"
38 #include <arch/cpu.h>
39 #include "platform_cfg.h"
40
41 void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx);
42
43 void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
44 {
45         u32 val;
46
47         post_code(0x35);
48         printk(BIOS_DEBUG, "agesawrapper_amdinitmmio ");
49         val = agesawrapper_amdinitmmio();
50         if (val)
51                 printk(BIOS_DEBUG, "error level: %x \n", val);
52         else
53                 printk(BIOS_DEBUG, "passed.\n");
54
55         if (!cpu_init_detectedx && boot_cpu()) {
56                 post_code(0x30);
57                 gpioEarlyInit();
58                 sb_poweron_init();
59
60                 post_code(0x31);
61
62                 kbc1100_early_init(CONFIG_SIO_PORT);
63
64                 post_code(0x32);
65                 uart_init();
66                 post_code(0x33);
67                 console_init();
68         }
69
70         /* Halt if there was a built in self test failure */
71         post_code(0x34);
72         report_bist_failure(bist);
73
74         // Load MPB
75         val = cpuid_eax(1);
76         printk(BIOS_DEBUG, "BSP Family_Model: %08x \n", val);
77         printk(BIOS_DEBUG, "cpu_init_detectedx = %08lx \n", cpu_init_detectedx);
78
79         post_code(0x36);
80         printk(BIOS_DEBUG, "agesawrapper_amdinitreset ");
81         val = agesawrapper_amdinitreset();
82         if (val)
83                 printk(BIOS_DEBUG, "error level: %x \n", val);
84         else
85                 printk(BIOS_DEBUG, "passed.\n");
86
87         post_code(0x37);
88         printk(BIOS_DEBUG, "agesawrapper_amdinitearly ");
89         val = agesawrapper_amdinitearly();
90         if (val)
91                 printk(BIOS_DEBUG, "error level: %x \n", val);
92         else
93                 printk(BIOS_DEBUG, "passed.\n");
94
95         post_code(0x38);
96         printk(BIOS_DEBUG, "agesawrapper_amdinitpost ");
97         val = agesawrapper_amdinitpost();
98         if (val)
99                 printk(BIOS_DEBUG, "error level: %x \n", val);
100         else
101                 printk(BIOS_DEBUG, "passed.\n");
102
103         post_code(0x39);
104         printk(BIOS_DEBUG, "sb_before_pci_init ");
105         sb_before_pci_init();
106         printk(BIOS_DEBUG, "passed.\n");
107
108         post_code(0x40);
109         printk(BIOS_DEBUG, "agesawrapper_amdinitenv ");
110         val = agesawrapper_amdinitenv();
111         if (val)
112                 printk(BIOS_DEBUG, "error level: %x \n", val);
113         else
114                 printk(BIOS_DEBUG, "passed.\n");
115
116         /* Initialize i8259 pic */
117         post_code(0x41);
118         printk(BIOS_DEBUG, "setup_i8259\n");
119         setup_i8259();
120
121         /* Initialize i8254 timers */
122         post_code(0x42);
123         printk(BIOS_DEBUG, "setup_i8254\n");
124         setup_i8254();
125
126
127         post_code(0x43);
128         copy_and_run();
129         printk(BIOS_ERR, "Error: copy_and_run returned!\n");
130
131         post_code(0x44);        // Should never see this post code.
132 }