ArmLib.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /** @file
  2. Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
  3. Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
  4. This program and the accompanying materials
  5. are licensed and made available under the terms and conditions of the BSD License
  6. which accompanies this distribution. The full text of the license may be found at
  7. http://opensource.org/licenses/bsd-license.php
  8. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  10. **/
  11. #include <Base.h>
  12. #include <Library/ArmLib.h>
  13. #include <Library/DebugLib.h>
  14. #include <Library/PcdLib.h>
  15. #include "ArmLibPrivate.h"
  16. VOID
  17. EFIAPI
  18. ArmCacheInformation (
  19. OUT ARM_CACHE_INFO *CacheInfo
  20. )
  21. {
  22. if (CacheInfo != NULL) {
  23. CacheInfo->Type = ArmCacheType();
  24. CacheInfo->Architecture = ArmCacheArchitecture();
  25. CacheInfo->DataCachePresent = ArmDataCachePresent();
  26. CacheInfo->DataCacheSize = ArmDataCacheSize();
  27. CacheInfo->DataCacheAssociativity = ArmDataCacheAssociativity();
  28. CacheInfo->DataCacheLineLength = ArmDataCacheLineLength();
  29. CacheInfo->InstructionCachePresent = ArmInstructionCachePresent();
  30. CacheInfo->InstructionCacheSize = ArmInstructionCacheSize();
  31. CacheInfo->InstructionCacheAssociativity = ArmInstructionCacheAssociativity();
  32. CacheInfo->InstructionCacheLineLength = ArmInstructionCacheLineLength();
  33. }
  34. }
  35. VOID
  36. EFIAPI
  37. ArmSetAuxCrBit (
  38. IN UINT32 Bits
  39. )
  40. {
  41. UINT32 val = ArmReadAuxCr();
  42. val |= Bits;
  43. ArmWriteAuxCr(val);
  44. }
  45. VOID
  46. EFIAPI
  47. ArmUnsetAuxCrBit (
  48. IN UINT32 Bits
  49. )
  50. {
  51. UINT32 val = ArmReadAuxCr();
  52. val &= ~Bits;
  53. ArmWriteAuxCr(val);
  54. }
  55. //
  56. // Helper functions for accessing CPUACTLR
  57. //
  58. VOID
  59. EFIAPI
  60. ArmSetCpuActlrBit (
  61. IN UINTN Bits
  62. )
  63. {
  64. UINTN Value;
  65. Value = ArmReadCpuActlr ();
  66. Value |= Bits;
  67. ArmWriteCpuActlr (Value);
  68. }
  69. VOID
  70. EFIAPI
  71. ArmUnsetCpuActlrBit (
  72. IN UINTN Bits
  73. )
  74. {
  75. UINTN Value;
  76. Value = ArmReadCpuActlr ();
  77. Value &= ~Bits;
  78. ArmWriteCpuActlr (Value);
  79. }