|
|
1.1 ! root 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: #define _ASM_ ! 13: #include "macros.h" ! 14: #include "southbridge.h" ! 15: #include "nvramlog.h" ! 16: ! 17: #define bootmsg_area_size 128 ! 18: ! 19: .text ! 20: .align 3 ! 21: ! 22: // Declare the warning level for all 128 possibilities of AC/pCKG kombinations ! 23: WRNG_LVL: ! 24: .rept bootmsg_area_size ! 25: .byte 0x0 ! 26: .endr ! 27: ! 28: ! 29: //***************************************************************************** ! 30: // Check UserWarningLevel against SystemWarningLevel ! 31: // input : r3=cp-id, r5=level ! 32: // change: r6,r7 ! 33: // output: CR0 ( compared user vs system level ) ! 34: // example: ! 35: // bl GET_WRNG_LVL ! 36: // ble print_warning ! 37: // bgt do_not_print_warning ! 38: ENTRY(GET_WRNG_LVL) ! 39: mflr r7 // save linkage register ! 40: bl 0f // get current ! 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 ! 47: blr ! 48: ! 49: //***************************************************************************** ! 50: // Print CheckPoint ! 51: // input : r3=cp-id ! 52: // change: r3, r4, r5, r6, r7, r11 ! 53: // output: none ! 54: ENTRY(bootmsg_cp) ! 55: mflr r11 ! 56: mr r9, r3 // save checkpoint ID ! 57: li r3, 'C' ! 58: bl io_putchar // print character ! 59: mr r3, r9 ! 60: bl io_printhex16 // print checkpoint ID ! 61: .rept 5 ! 62: li r3,'\b' ! 63: bl io_putchar // print backspaces ! 64: .endr ! 65: mtlr r11 ! 66: blr ! 67: ! 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 ! 72: // output: none ! 73: ENTRY(print_msg) ! 74: mflr r11 // Save linkage register ! 75: mr r9, r3 // Save ID ! 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 ! 79: bl io_putchar ! 80: li r3, '\r' ! 81: bl io_putchar ! 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 ! 87: bl io_putchar ! 88: mr r3, r10 // restore ptr to string ! 89: bl io_print // print message ! 90: li r3, '\n' // add a new line ! 91: bl io_putchar ! 92: li r3, '\r' ! 93: bl io_putchar ! 94: mtlr r11 // restore linkage register ! 95: blr ! 96: ! 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 ! 101: // output : none ! 102: ENTRY(bootmsg_error) ! 103: li r5, 'E' // E is for Error ! 104: b print_msg // and print this message ! 105: ! 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 ! 110: // output : none ! 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 ! 117: blr // else return ! 118: ! 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 ! 123: // output : none ! 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 ! 132: blr // else return ! 133: ! 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) ! 141: mflr r11 ! 142: mr r5, r4 ! 143: slwi r3, r3, 8 ! 144: bl GET_WRNG_LVL // check UserLevel against SystemLevel ! 145: li r3, 0 // return 0 ! 146: bgt 0f // IF ( UserLevel < SystemLevel ) ! 147: li r3, 1 // | return 1 ! 148: 0: mtlr r11 // FI ! 149: blr ! 150: ! 151: // r3=area|pkg, r4=level ! 152: ENTRY(bootmsg_setlevel) ! 153: mflr r5 ! 154: bl WarningMsg // calc current IA ! 155: WarningMsg: ! 156: mflr r6 // get current IA ! 157: addi r6,r6,WRNG_LVL-WarningMsg ! 158: andi. r3, r3, 0x7F ! 159: add r6,r3,r6 // address | ! 160: stb r4,0(r6) // store level |_ stwbrx r4,r3,r6 ! 161: #ifndef DISABLE_NVRAM ! 162: LOAD64(r6, SB_NVRAM_FWONLY_adr + 8 ) ! 163: add r6,r6,r3 ! 164: stb r4,0(r6) ! 165: #endif ! 166: mtlr r5 ! 167: blr ! 168: ! 169: ENTRY(bootmsg_nvupdate) ! 170: #ifndef DISABLE_NVRAM ! 171: mflr r10 ! 172: LOAD64(r3, SB_NVRAM_FWONLY_adr) ! 173: lwz r4, 0(r3) ! 174: cmpwi r4, 0x424E // find bootmsg area header ! 175: bne 0f ! 176: ! 177: LOAD64(r5, bootmsg_area_size/8) ! 178: mtctr r5 ! 179: bl WngMsg ! 180: WngMsg: ! 181: mflr r5 ! 182: addi r5,r5,WRNG_LVL-WngMsg-8 ! 183: ! 184: 1: ! 185: ldu r4, 8(r3) ! 186: stdu r4, 8(r5) ! 187: bdnz+ 1b ! 188: b 2f ! 189: ! 190: 0: ! 191: LOAD64(r5, bootmsg_area_size) ! 192: mtctr r5 ! 193: li r4, 0x424E // clear bootmsg log area ! 194: stw r4, 0(r3) ! 195: li r4, 0 ! 196: ! 197: 1: stdu r4, 8(r3) ! 198: bdnz+ 1b ! 199: ! 200: 2: // the end ! 201: mtlr r10 ! 202: #endif ! 203: blr
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.