Fix some builds with Kconfig.
[coreboot.git] / src / arch / ppc / lib / ppc.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2000 AG Electronics Ltd.
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 "ppc.h"
21 #include "ppcreg.h"
22
23 unsigned ppc_getmsr(void)
24 {
25         unsigned result;   
26         __asm__ volatile ("mfmsr %0" : "=r" (result));
27         return result;
28 }
29
30 unsigned ppc_gethid0(void)
31 {
32         unsigned result;
33         __asm__ volatile ("mfspr %0,1008" : "=r" (result));
34         return result;
35 }
36
37 unsigned ppc_gethid1(void)
38 {
39         unsigned result;
40         __asm__ volatile ("mfspr %0,1009" : "=r" (result));
41         return result;
42 }
43
44 void ppc_sethid0(unsigned value)
45 {
46         __asm__ volatile ("mtspr 1008,%0" : : "r" (value));
47 }
48
49 unsigned ppc_getpvr(void)
50 {
51         unsigned result;
52         __asm__("mfspr %0, 287" : "=r" (result));
53         return result;
54 }
55
56 void ppc_setmsr(unsigned value)
57 {
58         __asm__ volatile ("mtmsr %0; sync" :: "r" (value));   
59 }
60
61 void ppc_set1015(unsigned value)
62 {
63         __asm__ volatile ("mtspr 1015,%0" : : "r" (value));
64 }
65