Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / llfw / boot_abort.S
1 /******************************************************************************
2  * Copyright (c) 2004, 2008 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 #include "macros.h"
13 #include "termctrl.h"
14 #include "boot_abort.h"
15 #include <cpu.h>
16
17 #define MSG_LOOK_HDR TERM_CTRL_BRIGHT, TERM_BG_RED, TERM_FG_WHITE
18
19 ASM_ENTRY(msg_e_crc)
20         .ascii  MSG_LOOK_HDR
21         .ascii  "\n\r\n\rE1001 - Boot ROM CRC failure\n\r"
22         .ascii  TERM_CTRL_RESET, "\0"
23         .align  2
24
25 ASM_ENTRY(msg_e_nomem)
26         .ascii  MSG_LOOK_HDR
27         .ascii  "\n\r\n\rE1002 - Memory could not be initialized\n\r"
28         .ascii  TERM_CTRL_RESET, "\0"
29         .align  2
30
31 ASM_ENTRY(msg_e_nofile)
32         .ascii  MSG_LOOK_HDR
33         .ascii  "\n\r\n\rE1003 - Firmware image incomplete"
34         .ascii  TERM_CTRL_RESET
35         .ascii      "\n\r       internal FLS1-FFS-0.\0"
36         .align  2
37
38 ASM_ENTRY(msg_e_ierror)
39         .ascii  MSG_LOOK_HDR
40         .ascii  "\n\r\n\rE1004 - Unspecified Internal Firmware Error"
41         .ascii  TERM_CTRL_RESET
42         .ascii      "\n\r       internal FLSX-SE-0.\0"
43         .align  2
44
45 /* E1005 : used in memory init code */
46
47 /*****************************************************************************
48  * Boot Abort Handler
49  *
50  * Input:
51  *        R3 - capability informatin (i/o etc.)
52  *        R4 - handling suggestion
53  *        R5 - error string reference
54  *        R6 - error number
55  * 
56  * Return: 
57  *        if possible input to H8 and NVRAM log and console , then reboot/halt
58  *
59  * Input definitions:
60  *
61  * R3 bits: 63 (h8/console possible) ... add more
62  * R4 bits: 63 (do not attempt reboot)
63  * R5 reference to error message string
64  * R6 32-bit error enumerator
65  *
66  ******************************************************************************/
67 ASM_ENTRY(boot_abort)
68         /* save arguments */
69         mr      r31, r3
70         mr      r30, r4
71         mr      r29, r5
72         mr      r28, r6
73         
74         /* check if i/o is possible, if yes then print message */
75         li      r10, ABORT_CANIO
76         andi.   r3, r31, r10
77         bne     abort_noio
78
79         /* use i/o ..., first print reference message */
80         /* then add internal number if != 0           */
81         mr      r3, r29
82         mfspr   r4, HSPRG0 /* get runbase */
83         or      r3, r3, r4
84         bl      io_print
85         mr      r3, r28
86         li      r28, 0
87         cmpd    r3, r28
88         beq     0f
89         bl      io_printhex32
90 0:
91
92   abort_noio:
93         b       $       // FIXME
94         /* never reached */
95