forked from seL4/seL4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request seL4#5 from adanis/a15errata
arm: Add work around for errata on some Cortex-A15 boards
- Loading branch information
Showing
5 changed files
with
120 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
#include <config.h> | ||
#include <api/types.h> | ||
#include <arch/machine.h> | ||
#include <arch/machine/hardware.h> | ||
|
||
/* Prototyped here as this is referenced from assembly */ | ||
void arm_errata(void); | ||
|
||
#ifdef ARM1136_WORKAROUND | ||
/* | ||
* Potentially work around ARM1136 errata #364296, which can cause data | ||
* cache corruption. | ||
* | ||
* The fix involves disabling hit-under-miss via an undocumented bit in | ||
* the aux control register, as well as the FI bit in the control | ||
* register. The result of enabling these two bits is for fast | ||
* interrupts to *not* be enabled, but hit-under-miss to be disabled. We | ||
* only need to do this for a particular revision of the ARM1136. | ||
*/ | ||
BOOT_CODE static void | ||
errata_arm1136(void) | ||
{ | ||
/* See if we are affected by the errata. */ | ||
if ((getProcessorID() & ~0xf) == ARM1136_R0PX) { | ||
|
||
/* Enable the Fast Interrupts bit in the control register. */ | ||
writeSystemControlRegister( | ||
readSystemControlRegister() | BIT(CONTROL_FI)); | ||
|
||
/* Set undocumented bit 31 in the auxiliary control register */ | ||
writeAuxiliaryControlRegister( | ||
readAuxiliaryControlRegister() | BIT(31)); | ||
} | ||
} | ||
#endif | ||
|
||
#ifdef CONFIG_ARM_ERRATA_773022 | ||
/* | ||
* There is an errata for Cortex-A15 up to r0p4 where the loop buffer | ||
* may deliver incorrect instructions. The work around is to disable | ||
* the loop buffer. Errata is number 773022. | ||
*/ | ||
BOOT_CODE static void errata_armA15_773022(void) | ||
{ | ||
/* Fetch the processor primary part number. */ | ||
uint32_t proc_id = getProcessorID(); | ||
uint32_t variant = (proc_id >> 20) & MASK(4); | ||
uint32_t revision = proc_id & MASK(4); | ||
uint32_t part = (proc_id >> 4) & MASK(12); | ||
|
||
/* Check that we are running A15 and a revision upto r0p4. */ | ||
if (part == 0xc0f && variant == 0 && revision <= 4) { | ||
/* Disable loop buffer in the auxiliary control register */ | ||
writeAuxiliaryControlRegister( | ||
readAuxiliaryControlRegister() | BIT(1)); | ||
} | ||
} | ||
#endif | ||
|
||
BOOT_CODE void __attribute__((externally_visible)) arm_errata(void) | ||
{ | ||
#ifdef ARM1136_WORKAROUND | ||
errata_arm1136(); | ||
#endif | ||
#ifdef CONFIG_ARM_ERRATA_773022 | ||
(void)errata_armA15_773022; | ||
errata_armA15_773022(); | ||
#endif | ||
} | ||
|