summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Library/EblCmdLib
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-11 11:15:55 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-11 11:15:55 +0000
commit9e2b420ee9602b82530ad5d6933098fc92ac1190 (patch)
tree551d670e245a76b86b772484f6e477ebb2e650ad /ArmPlatformPkg/Library/EblCmdLib
parent838725abd776c709d1033df137064c4f05d31b63 (diff)
downloadedk2-platforms-9e2b420ee9602b82530ad5d6933098fc92ac1190.tar.xz
ArmPkg: Fix coding style to follow EDK2 coding convention
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11789 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Library/EblCmdLib')
-rw-r--r--ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c476
1 files changed, 257 insertions, 219 deletions
diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c
index fba4741699..4b001eaef3 100644
--- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c
+++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdMmu.c
@@ -67,247 +67,285 @@
typedef enum { Level0, Level1,Level2 } MMU_LEVEL;
typedef struct {
- MMU_LEVEL Level;
- UINT32 Value;
- UINT32 Index;
- UINT32* Table;
+ MMU_LEVEL Level;
+ UINT32 Value;
+ UINT32 Index;
+ UINT32* Table;
} MMU_ENTRY;
-MMU_ENTRY MmuEntryCreate(MMU_LEVEL Level,UINT32* Table,UINT32 Index) {
- MMU_ENTRY Entry;
- Entry.Level = Level;
- Entry.Value = Table[Index];
- Entry.Table = Table;
- Entry.Index = Index;
- return Entry;
+MMU_ENTRY
+MmuEntryCreate (
+ IN MMU_LEVEL Level,
+ IN UINT32* Table,
+ IN UINT32 Index
+ )
+{
+ MMU_ENTRY Entry;
+ Entry.Level = Level;
+ Entry.Value = Table[Index];
+ Entry.Table = Table;
+ Entry.Index = Index;
+ return Entry;
}
-UINT32 MmuEntryIsValidAddress(MMU_LEVEL Level, UINT32 Entry) {
- if (Level == Level0) {
- return 0;
- } else if (Level == Level1) {
- if ((Entry & 0x3) == 0) { // Ignored
- return 0;
- } else if ((Entry & 0x3) == 2) { // Section Type
- return 1;
- } else { // Page Type
- return 0;
- }
- } else if (Level == Level2){
- if ((Entry & 0x3) == 0) { // Ignored
- return 0;
- } else { // Page Type
- return 1;
- }
- } else {
- DEBUG((EFI_D_ERROR,"MmuEntryIsValidAddress: Level:%d Entry:0x%X\n",(UINT32)Level,(UINT32)Entry));
- ASSERT(0);
- return 0;
+UINT32
+MmuEntryIsValidAddress (
+ IN MMU_LEVEL Level,
+ IN UINT32 Entry
+ )
+{
+ if (Level == Level0) {
+ return 0;
+ } else if (Level == Level1) {
+ if ((Entry & 0x3) == 0) { // Ignored
+ return 0;
+ } else if ((Entry & 0x3) == 2) { // Section Type
+ return 1;
+ } else { // Page Type
+ return 0;
+ }
+ } else if (Level == Level2){
+ if ((Entry & 0x3) == 0) { // Ignored
+ return 0;
+ } else { // Page Type
+ return 1;
}
+ } else {
+ DEBUG((EFI_D_ERROR,"MmuEntryIsValidAddress: Level:%d Entry:0x%X\n",(UINT32)Level,(UINT32)Entry));
+ ASSERT(0);
+ return 0;
+ }
}
-UINT32 MmuEntryGetAddress(MMU_ENTRY Entry) {
- if (Entry.Level == Level1) {
- if ((Entry.Value & 0x3) == 0) {
- return 0;
- } else if ((Entry.Value & 0x3) == 2) { // Section Type
- return Entry.Value & TT_DESCRIPTOR_SECTION_BASE_ADDRESS_MASK;
- } else if ((Entry.Value & 0x3) == 1) { // Level2 Table
- MMU_ENTRY Entry = MmuEntryCreate(Level2,(UINT32*)(Entry.Value & 0xFFFFC000),0);
- return MmuEntryGetAddress(Entry);
- } else { // Page Type
- return 0;
- }
- } else if (Entry.Level == Level2) {
- if ((Entry.Value & 0x3) == 0) { // Ignored
- return 0;
- } else if ((Entry.Value & 0x3) == 1) { // Large Page
- return Entry.Value & 0xFFFF0000;
- } else if ((Entry.Value & 0x2) == 2) { // Small Page
- return Entry.Value & 0xFFFFF000;
- } else {
- return 0;
- }
+UINT32
+MmuEntryGetAddress (
+ IN MMU_ENTRY Entry
+ )
+{
+ if (Entry.Level == Level1) {
+ if ((Entry.Value & 0x3) == 0) {
+ return 0;
+ } else if ((Entry.Value & 0x3) == 2) { // Section Type
+ return Entry.Value & TT_DESCRIPTOR_SECTION_BASE_ADDRESS_MASK;
+ } else if ((Entry.Value & 0x3) == 1) { // Level2 Table
+ MMU_ENTRY Entry = MmuEntryCreate(Level2,(UINT32*)(Entry.Value & 0xFFFFC000),0);
+ return MmuEntryGetAddress(Entry);
+ } else { // Page Type
+ return 0;
+ }
+ } else if (Entry.Level == Level2) {
+ if ((Entry.Value & 0x3) == 0) { // Ignored
+ return 0;
+ } else if ((Entry.Value & 0x3) == 1) { // Large Page
+ return Entry.Value & 0xFFFF0000;
+ } else if ((Entry.Value & 0x2) == 2) { // Small Page
+ return Entry.Value & 0xFFFFF000;
} else {
- ASSERT(0);
- return 0;
+ return 0;
}
+ } else {
+ ASSERT(0);
+ return 0;
+ }
}
-UINT32 MmuEntryGetSize(MMU_ENTRY Entry) {
- if (Entry.Level == Level1) {
- if ((Entry.Value & 0x3) == 0) {
- return 0;
- } else if ((Entry.Value & 0x3) == 2) {
- if (Entry.Value & (1 << 18))
- return 16*SIZE_1MB;
- else
- return SIZE_1MB;
- } else if ((Entry.Value & 0x3) == 1) { // Level2 Table split 1MB section
- return SIZE_1MB;
- } else {
- DEBUG((EFI_D_ERROR, "MmuEntryGetSize: Value:0x%X",Entry.Value));
- ASSERT(0);
- return 0;
- }
- } else if (Entry.Level == Level2) {
- if ((Entry.Value & 0x3) == 0) { // Ignored
- return 0;
- } else if ((Entry.Value & 0x3) == 1) { // Large Page
- return SIZE_64KB;
- } else if ((Entry.Value & 0x2) == 2) { // Small Page
- return SIZE_4KB;
- } else {
- ASSERT(0);
- return 0;
- }
+UINT32
+MmuEntryGetSize (
+ IN MMU_ENTRY Entry
+ )
+{
+ if (Entry.Level == Level1) {
+ if ((Entry.Value & 0x3) == 0) {
+ return 0;
+ } else if ((Entry.Value & 0x3) == 2) {
+ if (Entry.Value & (1 << 18))
+ return 16*SIZE_1MB;
+ else
+ return SIZE_1MB;
+ } else if ((Entry.Value & 0x3) == 1) { // Level2 Table split 1MB section
+ return SIZE_1MB;
} else {
- ASSERT(0);
- return 0;
+ DEBUG((EFI_D_ERROR, "MmuEntryGetSize: Value:0x%X",Entry.Value));
+ ASSERT(0);
+ return 0;
}
+ } else if (Entry.Level == Level2) {
+ if ((Entry.Value & 0x3) == 0) { // Ignored
+ return 0;
+ } else if ((Entry.Value & 0x3) == 1) { // Large Page
+ return SIZE_64KB;
+ } else if ((Entry.Value & 0x2) == 2) { // Small Page
+ return SIZE_4KB;
+ } else {
+ ASSERT(0);
+ return 0;
+ }
+ } else {
+ ASSERT(0);
+ return 0;
+ }
}
-CONST CHAR8* MmuEntryGetAttributesName(MMU_ENTRY Entry) {
- if (Entry.Level == Level1) {
- if (GET_TT_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_SECTION_WRITE_BACK(0))
- return "TT_DESCRIPTOR_SECTION_WRITE_BACK";
- else if (GET_TT_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0))
- return "TT_DESCRIPTOR_SECTION_WRITE_THROUGH";
- else if (GET_TT_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_SECTION_DEVICE(0))
- return "TT_DESCRIPTOR_SECTION_DEVICE";
- else if (GET_TT_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_SECTION_UNCACHED(0))
- return "TT_DESCRIPTOR_SECTION_UNCACHED";
- else if (GET_TT_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_SECTION_STRONGLY_ORDER)
- return "TT_DESCRIPTOR_SECTION_STRONGLY_ORDERED";
- else {
- return "SectionUnknown";
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x2) == 2)) { //Small Page
- if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_BACK)
- return "TT_DESCRIPTOR_PAGE_WRITE_BACK";
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_THROUGH)
- return "TT_DESCRIPTOR_PAGE_WRITE_THROUGH";
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_DEVICE)
- return "TT_DESCRIPTOR_PAGE_DEVICE";
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_UNCACHED)
- return "TT_DESCRIPTOR_PAGE_UNCACHED";
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_STRONGLY_ORDER)
- return "TT_DESCRIPTOR_PAGE_STRONGLY_ORDERED";
- else {
- return "PageUnknown";
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x3) == 1)) { //Large Page
- if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK)
- return "TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK";
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH)
- return "TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH";
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_DEVICE)
- return "TT_DESCRIPTOR_LARGEPAGE_DEVICE";
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_UNCACHED)
- return "TT_DESCRIPTOR_LARGEPAGE_UNCACHED";
- else {
- return "LargePageUnknown";
- }
- } else {
- ASSERT(0);
- return "";
+CONST CHAR8*
+MmuEntryGetAttributesName (
+ IN MMU_ENTRY Entry
+ )
+{
+ UINT32 Value;
+
+ if (Entry.Level == Level1) {
+ Value = GET_TT_ATTRIBUTES(Entry.Value) | TT_DESCRIPTOR_SECTION_NS_MASK;
+ if (Value == TT_DESCRIPTOR_SECTION_WRITE_BACK(0))
+ return "TT_DESCRIPTOR_SECTION_WRITE_BACK";
+ else if (Value == TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0))
+ return "TT_DESCRIPTOR_SECTION_WRITE_THROUGH";
+ else if (Value == TT_DESCRIPTOR_SECTION_DEVICE(0))
+ return "TT_DESCRIPTOR_SECTION_DEVICE";
+ else if (Value == TT_DESCRIPTOR_SECTION_UNCACHED(0))
+ return "TT_DESCRIPTOR_SECTION_UNCACHED";
+ else if (Value == TT_DESCRIPTOR_SECTION_STRONGLY_ORDER)
+ return "TT_DESCRIPTOR_SECTION_STRONGLY_ORDERED";
+ else {
+ return "SectionUnknown";
+ }
+ } else if ((Entry.Level == Level2) && ((Entry.Value & 0x2) == 2)) { //Small Page
+ Value = GET_TT_PAGE_ATTRIBUTES(Entry.Value);
+ if (Value == TT_DESCRIPTOR_PAGE_WRITE_BACK)
+ return "TT_DESCRIPTOR_PAGE_WRITE_BACK";
+ else if (Value == TT_DESCRIPTOR_PAGE_WRITE_THROUGH)
+ return "TT_DESCRIPTOR_PAGE_WRITE_THROUGH";
+ else if (Value == TT_DESCRIPTOR_PAGE_DEVICE)
+ return "TT_DESCRIPTOR_PAGE_DEVICE";
+ else if (Value == TT_DESCRIPTOR_PAGE_UNCACHED)
+ return "TT_DESCRIPTOR_PAGE_UNCACHED";
+ else if (Value == TT_DESCRIPTOR_PAGE_STRONGLY_ORDER)
+ return "TT_DESCRIPTOR_PAGE_STRONGLY_ORDERED";
+ else {
+ return "PageUnknown";
+ }
+ } else if ((Entry.Level == Level2) && ((Entry.Value & 0x3) == 1)) { //Large Page
+ Value = GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value);
+ if (Value == TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK)
+ return "TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK";
+ else if (Value == TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH)
+ return "TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH";
+ else if (Value == TT_DESCRIPTOR_LARGEPAGE_DEVICE)
+ return "TT_DESCRIPTOR_LARGEPAGE_DEVICE";
+ else if (Value == TT_DESCRIPTOR_LARGEPAGE_UNCACHED)
+ return "TT_DESCRIPTOR_LARGEPAGE_UNCACHED";
+ else {
+ return "LargePageUnknown";
}
+ } else {
+ ASSERT(0);
+ return "";
+ }
}
-UINT32 MmuEntryGetAttributes(MMU_ENTRY Entry) {
- if (Entry.Level == Level1) {
- if ((Entry.Value & 0x3) == 0) {
- return 0;
- } else if ((Entry.Value & 0x3) == 2) {
- return GET_TT_ATTRIBUTES(Entry.Value);
- } else {
- return 0;
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x2) == 2)) { //Small Page
- if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_BACK)
- return TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_THROUGH)
- return TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_DEVICE)
- return TT_DESCRIPTOR_SECTION_DEVICE(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_UNCACHED)
- return TT_DESCRIPTOR_SECTION_UNCACHED(0);
- else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_STRONGLY_ORDER)
- return TT_DESCRIPTOR_SECTION_STRONGLY_ORDER;
- else {
- return 0;
- }
- } else if ((Entry.Level == Level2) && ((Entry.Value & 0x3) == 1)) { //Large Page
- if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK)
- return TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH)
- return TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_DEVICE)
- return TT_DESCRIPTOR_SECTION_DEVICE(0);
- else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_UNCACHED)
- return TT_DESCRIPTOR_SECTION_UNCACHED(0);
- else {
- return 0;
- }
+UINT32
+MmuEntryGetAttributes (
+ IN MMU_ENTRY Entry
+ )
+{
+ if (Entry.Level == Level1) {
+ if ((Entry.Value & 0x3) == 0) {
+ return 0;
+ } else if ((Entry.Value & 0x3) == 2) {
+ return GET_TT_ATTRIBUTES(Entry.Value);
} else {
- return 0;
+ return 0;
+ }
+ } else if ((Entry.Level == Level2) && ((Entry.Value & 0x2) == 2)) { //Small Page
+ if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_BACK)
+ return TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
+ else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_WRITE_THROUGH)
+ return TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);
+ else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_DEVICE)
+ return TT_DESCRIPTOR_SECTION_DEVICE(0);
+ else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_UNCACHED)
+ return TT_DESCRIPTOR_SECTION_UNCACHED(0);
+ else if (GET_TT_PAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_PAGE_STRONGLY_ORDER)
+ return TT_DESCRIPTOR_SECTION_STRONGLY_ORDER;
+ else {
+ return 0;
+ }
+ } else if ((Entry.Level == Level2) && ((Entry.Value & 0x3) == 1)) { //Large Page
+ if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_BACK)
+ return TT_DESCRIPTOR_SECTION_WRITE_BACK(0);
+ else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_WRITE_THROUGH)
+ return TT_DESCRIPTOR_SECTION_WRITE_THROUGH(0);
+ else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_DEVICE)
+ return TT_DESCRIPTOR_SECTION_DEVICE(0);
+ else if (GET_TT_LARGEPAGE_ATTRIBUTES(Entry.Value) == TT_DESCRIPTOR_LARGEPAGE_UNCACHED)
+ return TT_DESCRIPTOR_SECTION_UNCACHED(0);
+ else {
+ return 0;
}
+ } else {
+ return 0;
+ }
}
-MMU_ENTRY DumpMmuLevel(MMU_LEVEL Level, UINT32* Table, MMU_ENTRY PreviousEntry) {
- UINT32 Index = 0, Count;
- MMU_ENTRY LastEntry, Entry;
+MMU_ENTRY
+DumpMmuLevel (
+ IN MMU_LEVEL Level,
+ IN UINT32* Table,
+ IN MMU_ENTRY PreviousEntry
+ )
+{
+ UINT32 Index = 0, Count;
+ MMU_ENTRY LastEntry, Entry;
ASSERT((Level == Level1) || (Level == Level2));
- if (Level == Level1) Count = 4096;
- else Count = 256;
+ if (Level == Level1) Count = 4096;
+ else Count = 256;
- // At Level1, we will get into this function because PreviousEntry is not valid
- if (!MmuEntryIsValidAddress((MMU_LEVEL)(Level-1),PreviousEntry.Value)) {
- // Find the first valid address
- for (; (Index < Count) && (!MmuEntryIsValidAddress(Level,Table[Index])); Index++);
+ // At Level1, we will get into this function because PreviousEntry is not valid
+ if (!MmuEntryIsValidAddress((MMU_LEVEL)(Level-1),PreviousEntry.Value)) {
+ // Find the first valid address
+ for (; (Index < Count) && (!MmuEntryIsValidAddress(Level,Table[Index])); Index++);
- LastEntry = MmuEntryCreate(Level,Table,Index);
- Index++;
- } else {
- LastEntry = PreviousEntry;
- }
+ LastEntry = MmuEntryCreate(Level,Table,Index);
+ Index++;
+ } else {
+ LastEntry = PreviousEntry;
+ }
- for (; Index < Count; Index++) {
- Entry = MmuEntryCreate(Level,Table,Index);
- if ((Level == Level1) && ((Entry.Value & 0x3) == 1)) { // We have got a Level2 table redirection
- LastEntry = DumpMmuLevel(Level2,(UINT32*)(Entry.Value & 0xFFFFFC00),LastEntry);
- } else if (!MmuEntryIsValidAddress(Level,Table[Index])) {
- if (MmuEntryIsValidAddress(LastEntry.Level,LastEntry.Value)) {
- AsciiPrint("0x%08X-0x%08X\t%a\n",
- MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
- MmuEntryGetAttributesName(LastEntry));
- }
- LastEntry = Entry;
- } else {
- if (MmuEntryGetAttributes(LastEntry) != MmuEntryGetAttributes(Entry)) {
- if (MmuEntryIsValidAddress(Level,LastEntry.Value)) {
- AsciiPrint("0x%08X-0x%08X\t%a\n",
- MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
- MmuEntryGetAttributesName(LastEntry));
- }
- LastEntry = Entry;
- } else {
- ASSERT(LastEntry.Value != 0);
- }
- }
- PreviousEntry = Entry;
+ for (; Index < Count; Index++) {
+ Entry = MmuEntryCreate(Level,Table,Index);
+ if ((Level == Level1) && ((Entry.Value & 0x3) == 1)) { // We have got a Level2 table redirection
+ LastEntry = DumpMmuLevel(Level2,(UINT32*)(Entry.Value & 0xFFFFFC00),LastEntry);
+ } else if (!MmuEntryIsValidAddress(Level,Table[Index])) {
+ if (MmuEntryIsValidAddress(LastEntry.Level,LastEntry.Value)) {
+ AsciiPrint("0x%08X-0x%08X\t%a\n",
+ MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
+ MmuEntryGetAttributesName(LastEntry));
+ }
+ LastEntry = Entry;
+ } else {
+ if (MmuEntryGetAttributes(LastEntry) != MmuEntryGetAttributes(Entry)) {
+ if (MmuEntryIsValidAddress(Level,LastEntry.Value)) {
+ AsciiPrint("0x%08X-0x%08X\t%a\n",
+ MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
+ MmuEntryGetAttributesName(LastEntry));
+ }
+ LastEntry = Entry;
+ } else {
+ ASSERT(LastEntry.Value != 0);
+ }
}
+ PreviousEntry = Entry;
+ }
- if ((Level == Level1) && (LastEntry.Index != Index) && MmuEntryIsValidAddress(Level,LastEntry.Value)) {
- AsciiPrint("0x%08X-0x%08X\t%a\n",
- MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
- MmuEntryGetAttributesName(LastEntry));
- }
+ if ((Level == Level1) && (LastEntry.Index != Index) && MmuEntryIsValidAddress(Level,LastEntry.Value)) {
+ AsciiPrint("0x%08X-0x%08X\t%a\n",
+ MmuEntryGetAddress(LastEntry),MmuEntryGetAddress(PreviousEntry)+MmuEntryGetSize(PreviousEntry)-1,
+ MmuEntryGetAttributesName(LastEntry));
+ }
- return LastEntry;
+ return LastEntry;
}
@@ -317,17 +355,17 @@ EblDumpMmu (
IN CHAR8 **Argv
)
{
- UINT32 *TTEntry;
- MMU_ENTRY NoEntry;
+ UINT32 *TTEntry;
+ MMU_ENTRY NoEntry;
+
+ TTEntry = ArmGetTTBR0BaseAddress();
- TTEntry = ArmGetTTBR0BaseAddress();
+ AsciiPrint ("\nTranslation Table:0x%X\n",TTEntry);
+ AsciiPrint ("Address Range\t\tAttributes\n");
+ AsciiPrint ("____________________________________________________\n");
- AsciiPrint ("\nTranslation Table:0x%X\n",TTEntry);
- AsciiPrint ("Address Range\t\tAttributes\n");
- AsciiPrint ("____________________________________________________\n");
-
- NoEntry.Level = (MMU_LEVEL)200;
- DumpMmuLevel(Level1,TTEntry,NoEntry);
+ NoEntry.Level = (MMU_LEVEL)200;
+ DumpMmuLevel(Level1,TTEntry,NoEntry);
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
}