Skip to content

Commit

Permalink
Arm Packages: Fixed coding style/Line endings to follow EDK2 coding c…
Browse files Browse the repository at this point in the history
…onvention

Arm Packages: Fixed mispelling

Arm Packages: Reduced warnings all over the code




git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12407 6f19259b-4bc3-4df7-8a09-765794883524
  • Loading branch information
oliviermartin committed Sep 22, 2011
1 parent 5439ccd commit 11c20f4
Show file tree
Hide file tree
Showing 39 changed files with 2,305 additions and 2,448 deletions.
2 changes: 1 addition & 1 deletion ArmPkg/ArmPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
ArmLib|Include/Library/ArmLib.h
SemihostLib|Include/Library/Semihosting.h
UncachedMemoryAllocationLib|Include/Library/UncachedMemoryAllocationLib.h
DefaultExceptioHandlerLib|Include/Library/DefaultExceptioHandlerLib.h
DefaultExceptionHandlerLib|Include/Library/DefaultExceptionHandlerLib.h
ArmDisassemblerLib|Include/Library/ArmDisassemblerLib.h

[Guids.common]
Expand Down
2 changes: 1 addition & 1 deletion ArmPkg/ArmPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
DefaultExceptioHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf

ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
Expand Down
8 changes: 3 additions & 5 deletions ArmPkg/Drivers/CpuDxe/CpuDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,12 @@
[LibraryClasses]
BaseMemoryLib
CacheMaintenanceLib
UefiDriverEntryPoint
ArmLib
CpuLib
DebugLib
DefaultExceptionHandlerLib
DxeServicesTableLib
PeCoffGetEntryPointLib
UefiLib
CpuLib
DefaultExceptioHandlerLib
DebugLib

[Protocols]
gEfiCpuArchProtocolGuid
Expand Down
43 changes: 22 additions & 21 deletions ArmPkg/Drivers/CpuDxe/Mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,49 +543,49 @@ UpdatePageEntries (
return EFI_UNSUPPORTED;
}

// obtain page table base
// Obtain page table base
FirstLevelTable = (ARM_FIRST_LEVEL_DESCRIPTOR *)ArmGetTTBR0BaseAddress ();

// calculate number of 4KB page table entries to change
// Calculate number of 4KB page table entries to change
NumPageEntries = Length / TT_DESCRIPTOR_PAGE_SIZE;

// iterate for the number of 4KB pages to change
// Iterate for the number of 4KB pages to change
Offset = 0;
for(p=0; p<NumPageEntries; p++) {
// calculate index into first level translation table for page table value
for(p = 0; p < NumPageEntries; p++) {
// Calculate index into first level translation table for page table value

FirstLevelIdx = TT_DESCRIPTOR_SECTION_BASE_ADDRESS(BaseAddress + Offset) >> TT_DESCRIPTOR_SECTION_BASE_SHIFT;
ASSERT (FirstLevelIdx < TRANSLATION_TABLE_SECTION_COUNT);

// read the descriptor from the first level page table
// Read the descriptor from the first level page table
Descriptor = FirstLevelTable[FirstLevelIdx];

// does this descriptor need to be converted from section entry to 4K pages?
// Does this descriptor need to be converted from section entry to 4K pages?
if (!TT_DESCRIPTOR_SECTION_TYPE_IS_PAGE_TABLE(Descriptor)) {
Status = ConvertSectionToPages (FirstLevelIdx << TT_DESCRIPTOR_SECTION_BASE_SHIFT);
if (EFI_ERROR(Status)) {
// exit for loop
// Exit for loop
break;
}

// re-read descriptor
// Re-read descriptor
Descriptor = FirstLevelTable[FirstLevelIdx];
}

// obtain page table base address
// Obtain page table base address
PageTable = (ARM_PAGE_TABLE_ENTRY *)TT_DESCRIPTOR_PAGE_BASE_ADDRESS(Descriptor);

// calculate index into the page table
// Calculate index into the page table
PageTableIndex = ((BaseAddress + Offset) & TT_DESCRIPTOR_PAGE_INDEX_MASK) >> TT_DESCRIPTOR_PAGE_BASE_SHIFT;
ASSERT (PageTableIndex < TRANSLATION_TABLE_PAGE_COUNT);

// get the entry
// Get the entry
CurrentPageTableEntry = PageTable[PageTableIndex];

// mask off appropriate fields
// Mask off appropriate fields
PageTableEntry = CurrentPageTableEntry & ~EntryMask;

// mask in new attributes and/or permissions
// Mask in new attributes and/or permissions
PageTableEntry |= EntryValue;

if (VirtualMask != 0) {
Expand All @@ -609,7 +609,7 @@ UpdatePageEntries (
Status = EFI_SUCCESS;
Offset += TT_DESCRIPTOR_PAGE_SIZE;

} // end first level translation table loop
} // End first level translation table loop

return Status;
}
Expand Down Expand Up @@ -815,23 +815,24 @@ SetMemoryAttributes (
EFI_STATUS Status;

if(((BaseAddress & 0xFFFFF) == 0) && ((Length & 0xFFFFF) == 0)) {
// is the base and length a multiple of 1 MB?
// Is the base and length a multiple of 1 MB?
DEBUG ((EFI_D_PAGE, "SetMemoryAttributes(): MMU section 0x%x length 0x%x to %lx\n", (UINTN)BaseAddress, (UINTN)Length, Attributes));
Status = UpdateSectionEntries (BaseAddress, Length, Attributes, VirtualMask);
} else {
// base and/or length is not a multiple of 1 MB
// Base and/or length is not a multiple of 1 MB
DEBUG ((EFI_D_PAGE, "SetMemoryAttributes(): MMU page 0x%x length 0x%x to %lx\n", (UINTN)BaseAddress, (UINTN)Length, Attributes));
Status = UpdatePageEntries (BaseAddress, Length, Attributes, VirtualMask);
}

// flush d-cache so descriptors make it back to uncached memory for subsequent table walks
// Flush d-cache so descriptors make it back to uncached memory for subsequent table walks
// flush and invalidate pages
//TODO: Do we really need to invalidate the caches everytime we change the memory attributes ?
ArmCleanInvalidateDataCache ();

ArmInvalidateInstructionCache ();

// invalidate all TLB entries so changes are synced
ArmInvalidateTlb ();
// Invalidate all TLB entries so changes are synced
ArmInvalidateTlb ();

return Status;
}
Expand Down
Loading

0 comments on commit 11c20f4

Please sign in to comment.