1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
/******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
* which accompanies this distribution, and is available at
* http://www.opensource.org/licenses/bsd-license.php
*
* Contributors:
* IBM Corporation - initial implementation
*****************************************************************************/
#define _ASM_
#include "macros.h"
#include "southbridge.h"
#include "nvramlog.h"
#define bootmsg_area_size 128
.text
.align 3
// Declare the warning level for all 128 possibilities of AC/pCKG kombinations
WRNG_LVL:
.rept bootmsg_area_size
.byte 0x0
.endr
//*****************************************************************************
// Check UserWarningLevel against SystemWarningLevel
// input : r3=cp-id, r5=level
// change: r6,r7
// output: CR0 ( compared user vs system level )
// example:
// bl GET_WRNG_LVL
// ble print_warning
// bgt do_not_print_warning
ENTRY(GET_WRNG_LVL)
mflr r7 // save linkage register
bl 0f // get current
0: mflr r6 // Instruction Address
mtlr r7 // restore linkage register
addi r6,r6,WRNG_LVL-0b // calc addr of WRNG_LVL array
rldic r7,r3,56,57 // calc index into array
lbzux r7,r6,r7 // read the warning level
cmpw r5,r7 // and compare it
blr
//*****************************************************************************
// Print CheckPoint
// input : r3=cp-id
// change: r3, r4, r5, r6, r7, r11
// output: none
ENTRY(bootmsg_cp)
mflr r11
mr r9, r3 // save checkpoint ID
li r3, 'C'
bl io_putchar // print character
mr r3, r9
bl io_printhex16 // print checkpoint ID
li r3,'\r'
bl io_putchar // go back
mtlr r11
blr
//*****************************************************************************
// Print a general BootMessage
// input : r3=cp-id, r4=string, r5=char (type C,W,E)
// change: r3,r4,r5,r6,r7,r9,r10,r11,r12
// output: none
ENTRY(print_msg)
mflr r11 // Save linkage register
mr r9, r3 // Save ID
mr r10, r4 // Save ptr to string
mr r12, r5 // Save type (char [CWE])
li r3, '\n' // make it a new line
bl io_putchar
li r3, '\r'
bl io_putchar
mr r3, r12 // restore type
bl io_putchar // print character
mr r3, r9 // restore ID
bl io_printhex16 // print checkpoint ID
li r3, ' ' // print a space
bl io_putchar
mr r3, r10 // restore ptr to string
bl io_print // print message
li r3, '\n' // add a new line
bl io_putchar
li r3, '\r'
bl io_putchar
mtlr r11 // restore linkage register
blr
//*****************************************************************************
// Print an Error Boot Message
// input : r3=cp-id, r4=string-ptr
// change : r3,r4,r5,r6,r7,r9,r10,r11,r12
// output : none
ENTRY(bootmsg_error)
li r5, 'E' // E is for Error
b print_msg // and print this message
//*****************************************************************************
// Print a Warning Boot Message
// input : r3=cp-id, r4=string-ptr, r5=level
// change : r3,r4,r5,r6,r7,r9,r10,r11,r12
// output : none
ENTRY(bootmsg_warning)
mflr r11 // save linkage register
bl GET_WRNG_LVL // check UserLevel against SystemLevel
mtlr r11 // restore linkage register
li r5, 'W' // 'W' is for Warning
ble print_msg // if UserLevel<=SystemLevel print and return
blr // else return
//*****************************************************************************
// Print a Debug Checkpoint
// input : r3=cp-id, r4=string-ptr, r5=level
// change : r3,r4,r5,r6,r7,r9,r10,r11,r12
// output : none
// r3=cp-id, r4=string, r5=level
ENTRY(bootmsg_debugcp)
mflr r11 // save linkage register
addi r5,r5,0x20 // add checkpoint offset
bl GET_WRNG_LVL // check UserLevel against SystemLevel
mtlr r11 // restore linkage register
li r5, 'D' // 'D' is for Debug CheckPoint
ble print_msg // if UserLevel<=SystemLevel print and return
blr // else return
//*****************************************************************************
// Check warning level
// input : r3=cp-id, r4=level
// change : r3,r4,r5,r6,r7,r9,r10,r11
// output : r3 (true, false)
// r3=cp-id, r4=level
ENTRY(bootmsg_checklevel)
mflr r11
mr r5, r4
slwi r3, r3, 8
bl GET_WRNG_LVL // check UserLevel against SystemLevel
li r3, 0 // return 0
bgt 0f // IF ( UserLevel < SystemLevel )
li r3, 1 // | return 1
0: mtlr r11 // FI
blr
// r3=area|pkg, r4=level
ENTRY(bootmsg_setlevel)
mflr r5
bl WarningMsg // calc current IA
WarningMsg:
mflr r6 // get current IA
addi r6,r6,WRNG_LVL-WarningMsg
andi. r3, r3, 0x7F
add r6,r3,r6 // address |
stb r4,0(r6) // store level |_ stwbrx r4,r3,r6
#if !defined(DISABLE_NVRAM) && !defined(RTAS_NVRAM)
LOAD64(r6, SB_NVRAM_FWONLY_adr + 8 )
add r6,r6,r3
stb r4,0(r6)
#endif
mtlr r5
blr
ENTRY(bootmsg_nvupdate)
#if !defined(DISABLE_NVRAM) && !defined(RTAS_NVRAM)
mflr r10
LOAD64(r3, SB_NVRAM_FWONLY_adr)
lwz r4, 0(r3)
cmpwi r4, 0x424E // find bootmsg area header
bne 0f
LOAD64(r5, bootmsg_area_size/8)
mtctr r5
bl WngMsg
WngMsg:
mflr r5
addi r5,r5,WRNG_LVL-WngMsg-8
1:
ldu r4, 8(r3)
stdu r4, 8(r5)
bdnz+ 1b
b 2f
0:
LOAD64(r5, bootmsg_area_size)
mtctr r5
li r4, 0x424E // clear bootmsg log area
stw r4, 0(r3)
li r4, 0
1: stdu r4, 8(r3)
bdnz+ 1b
2: // the end
mtlr r10
#endif
blr
|