5d7640b526f198978ea450d9b8f15e0f747ec064
[oweals/u-boot.git] / arch / x86 / cpu / ivybridge / cpu.c
1 /*
2  * Copyright (c) 2014 Google, Inc
3  * (C) Copyright 2008
4  * Graeme Russ, graeme.russ@gmail.com.
5  *
6  * Some portions from coreboot src/mainboard/google/link/romstage.c
7  * Copyright (C) 2007-2010 coresystems GmbH
8  * Copyright (C) 2011 Google Inc.
9  *
10  * SPDX-License-Identifier:     GPL-2.0
11  */
12
13 #include <common.h>
14 #include <errno.h>
15 #include <fdtdec.h>
16 #include <asm/cpu.h>
17 #include <asm/pci.h>
18 #include <asm/post.h>
19 #include <asm/processor.h>
20 #include <asm/arch/pch.h>
21
22 DECLARE_GLOBAL_DATA_PTR;
23
24 int arch_cpu_init(void)
25 {
26         const void *blob = gd->fdt_blob;
27         struct pci_controller *hose;
28         int node;
29         int ret;
30
31         post_code(POST_CPU_INIT);
32         timer_set_base(rdtsc());
33
34         ret = x86_cpu_init_f();
35         if (ret)
36                 return ret;
37
38         ret = pci_early_init_hose(&hose);
39         if (ret)
40                 return ret;
41
42         node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_LPC);
43         if (node < 0)
44                 return -ENOENT;
45         ret = lpc_early_init(gd->fdt_blob, node, PCH_LPC_DEV);
46         if (ret)
47                 return ret;
48
49         return 0;
50 }
51
52 int print_cpuinfo(void)
53 {
54         char processor_name[CPU_MAX_NAME_LEN];
55         const char *name;
56
57         /* Print processor name */
58         name = cpu_get_name(processor_name);
59         printf("CPU:   %s\n", name);
60
61         return 0;
62 }