- UINTN ArmCacheLineLength = ArmDataCacheLineLength();\r
- UINTN ArmCacheLineAlignmentMask = ArmCacheLineLength - 1;\r
- UINTN ArmCacheOperationThreshold = PcdGet32(PcdArmCacheOperationThreshold);\r
- \r
- if ((CacheOperation != NULL) && (Length >= ArmCacheOperationThreshold)) {\r
- ArmDrainWriteBuffer ();\r
- CacheOperation ();\r
- } else {\r
- // Align address (rounding down)\r
- UINTN AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);\r
- UINTN EndAddress = (UINTN)Start + Length;\r
-\r
- // Perform the line operation on an address in each cache line\r
- while (AlignedAddress < EndAddress) {\r
- LineOperation(AlignedAddress);\r
- AlignedAddress += ArmCacheLineLength;\r
- }\r
+ UINTN ArmCacheLineAlignmentMask;\r
+ // Align address (rounding down)\r
+ UINTN AlignedAddress;\r
+ UINTN EndAddress;\r
+\r
+ ArmCacheLineAlignmentMask = LineLength - 1;\r
+ AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);\r
+ EndAddress = (UINTN)Start + Length;\r
+\r
+ // Perform the line operation on an address in each cache line\r
+ while (AlignedAddress < EndAddress) {\r
+ LineOperation (AlignedAddress);\r
+ AlignedAddress += LineLength;\r