Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / slof / ofw.S
1 /******************************************************************************
2  * Copyright (c) 2004, 2011 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12
13 #include <cpu.h>
14 #include <xvect.h>
15
16         .section ".slof.loader","ax"
17
18         /* this only works if paflof is running below 4GB */
19         lis     r31, fdt_start@h        /* save address of */
20         ori     r31, r31, fdt_start@l   /* flattened device */
21         std     r3, 0(r31)              /* tree */
22
23         /* this only works if paflof is running below 4GB */
24         lis     r31, romfs_base@h       /* save address of */
25         ori     r31, r31, romfs_base@l  /* the romfs */
26         std     r4, 0(r31)
27
28         /* this only works if paflof is running below 4GB */
29         lis     r31, epapr_magic@h      /* if it is an epapr compliant */
30         ori     r31, r31, epapr_magic@l /* low level firmware; then r6 */
31         std     r6, 0(r31)              /* contains the epapr magic */
32
33         /* this only works if paflof is running below 4GB */
34         lis     r31, epapr_ima_size@h
35         ori     r31, r31, epapr_ima_size@l
36         std     r7, 0(r31)              /* r7 contains the IMA size */
37
38         /* fill in handler address */
39
40         /* this only works if paflof is running below 4GB */
41         mfmsr   r0
42         mtsrr1  r0
43         lis     r3, _slof_text@h
44         ori     r3, r3, _slof_text@l
45         ld      r3, 0(r3)
46         std     r3, XVECT_M_HANDLER(0)
47
48 #ifdef BROKEN_SC1
49         /* Patch potentially broken sc 1 instructions */
50         lis     r3, _slof_text@h
51         ori     r3, r3, _slof_text@l
52         lis     r4, _slof_text_end@h
53         ori     r4, r4, _slof_text_end@l
54         li      r5, 0
55         bl      .patch_broken_sc1
56 #endif
57
58         /* GO! */
59         ba      0x100