1 /** @file
2 *  Main file supporting the transition to PEI Core in Normal World for Versatile Express
3 *
4 *  Copyright (c) 2012, ARM Limited. All rights reserved.
5 *
6 *  This program and the accompanying materials
7 *  are licensed and made available under the terms and conditions of the BSD License
8 *  which accompanies this distribution.  The full text of the license may be found at
9 *  http://opensource.org/licenses/bsd-license.php
10 *
11 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 *
14 **/
15 
16 #include <Library/PrintLib.h>
17 #include <Library/SerialPortLib.h>
18 
19 #include "PrePeiCore.h"
20 
21 VOID
PeiCommonExceptionEntry(IN UINT32 Entry,IN UINTN LR)22 PeiCommonExceptionEntry (
23   IN UINT32 Entry,
24   IN UINTN LR
25   )
26 {
27   CHAR8           Buffer[100];
28   UINTN           CharCount;
29 
30   switch (Entry) {
31   case 0:
32     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reset Exception at 0x%X\n\r",LR);
33     break;
34   case 1:
35     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Undefined Exception at 0x%X\n\r",LR);
36     break;
37   case 2:
38     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SWI Exception at 0x%X\n\r",LR);
39     break;
40   case 3:
41     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"PrefetchAbort Exception at 0x%X\n\r",LR);
42     break;
43   case 4:
44     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"DataAbort Exception at 0x%X\n\r",LR);
45     break;
46   case 5:
47     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reserved Exception at 0x%X\n\r",LR);
48     break;
49   case 6:
50     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r",LR);
51     break;
52   case 7:
53     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r",LR);
54     break;
55   default:
56     CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r",LR);
57     break;
58   }
59   SerialPortWrite ((UINT8 *) Buffer, CharCount);
60   while(1);
61 }
62 
63