1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
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
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
14 #include "southbridge.h"
17 #define bootmsg_area_size 128
22 // Declare the warning level for all 128 possibilities of AC/pCKG kombinations
24 .rept bootmsg_area_size
29 //*****************************************************************************
30 // Check UserWarningLevel against SystemWarningLevel
31 // input : r3=cp-id, r5=level
33 // output: CR0 ( compared user vs system level )
37 // bgt do_not_print_warning
39 mflr r7 // save linkage register
41 0: mflr r6 // Instruction Address
42 mtlr r7 // restore linkage register
43 addi r6,r6,WRNG_LVL-0b // calc addr of WRNG_LVL array
44 rldic r7,r3,56,57 // calc index into array
45 lbzux r7,r6,r7 // read the warning level
46 cmpw r5,r7 // and compare it
49 //*****************************************************************************
52 // change: r3, r4, r5, r6, r7, r11
56 mr r9, r3 // save checkpoint ID
58 bl io_putchar // print character
60 bl io_printhex16 // print checkpoint ID
63 bl io_putchar // print backspaces
68 //*****************************************************************************
69 // Print a general BootMessage
70 // input : r3=cp-id, r4=string, r5=char (type C,W,E)
71 // change: r3,r4,r5,r6,r7,r9,r10,r11,r12
74 mflr r11 // Save linkage register
76 mr r10, r4 // Save ptr to string
77 mr r12, r5 // Save type (char [CWE])
78 li r3, '\n' // make it a new line
82 mr r3, r12 // restore type
83 bl io_putchar // print character
84 mr r3, r9 // restore ID
85 bl io_printhex16 // print checkpoint ID
86 li r3, ' ' // print a space
88 mr r3, r10 // restore ptr to string
89 bl io_print // print message
90 li r3, '\n' // add a new line
94 mtlr r11 // restore linkage register
97 //*****************************************************************************
98 // Print an Error Boot Message
99 // input : r3=cp-id, r4=string-ptr
100 // change : r3,r4,r5,r6,r7,r9,r10,r11,r12
103 li r5, 'E' // E is for Error
104 b print_msg // and print this message
106 //*****************************************************************************
107 // Print a Warning Boot Message
108 // input : r3=cp-id, r4=string-ptr, r5=level
109 // change : r3,r4,r5,r6,r7,r9,r10,r11,r12
111 ENTRY(bootmsg_warning)
112 mflr r11 // save linkage register
113 bl GET_WRNG_LVL // check UserLevel against SystemLevel
114 mtlr r11 // restore linkage register
115 li r5, 'W' // 'W' is for Warning
116 ble print_msg // if UserLevel<=SystemLevel print and return
119 //*****************************************************************************
120 // Print a Debug Checkpoint
121 // input : r3=cp-id, r4=string-ptr, r5=level
122 // change : r3,r4,r5,r6,r7,r9,r10,r11,r12
124 // r3=cp-id, r4=string, r5=level
125 ENTRY(bootmsg_debugcp)
126 mflr r11 // save linkage register
127 addi r5,r5,0x20 // add checkpoint offset
128 bl GET_WRNG_LVL // check UserLevel against SystemLevel
129 mtlr r11 // restore linkage register
130 li r5, 'D' // 'D' is for Debug CheckPoint
131 ble print_msg // if UserLevel<=SystemLevel print and return
134 //*****************************************************************************
135 // Check warning level
136 // input : r3=cp-id, r4=level
137 // change : r3,r4,r5,r6,r7,r9,r10,r11
138 // output : r3 (true, false)
139 // r3=cp-id, r4=level
140 ENTRY(bootmsg_checklevel)
144 bl GET_WRNG_LVL // check UserLevel against SystemLevel
146 bgt 0f // IF ( UserLevel < SystemLevel )
147 li r3, 1 // | return 1
151 // r3=area|pkg, r4=level
152 ENTRY(bootmsg_setlevel)
154 bl WarningMsg // calc current IA
156 mflr r6 // get current IA
157 addi r6,r6,WRNG_LVL-WarningMsg
159 add r6,r3,r6 // address |
160 stb r4,0(r6) // store level |_ stwbrx r4,r3,r6
162 #if !defined(DISABLE_NVRAM) && !defined(RTAS_NVRAM)
163 LOAD64(r6, SB_NVRAM_FWONLY_adr + 8 )
170 ENTRY(bootmsg_nvupdate)
171 #if !defined(DISABLE_NVRAM) && !defined(RTAS_NVRAM)
173 LOAD64(r3, SB_NVRAM_FWONLY_adr)
175 cmpwi r4, 0x424E // find bootmsg area header
178 LOAD64(r5, bootmsg_area_size/8)
183 addi r5,r5,WRNG_LVL-WngMsg-8
192 LOAD64(r5, bootmsg_area_size)
194 li r4, 0x424E // clear bootmsg log area