mips_cmgcr.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2015 Imagination Technologies
  7. *
  8. */
  9. #ifndef MIPS_CMGCR_H
  10. #define MIPS_CMGCR_H
  11. #define TYPE_MIPS_GCR "mips-gcr"
  12. #define MIPS_GCR(obj) OBJECT_CHECK(MIPSGCRState, (obj), TYPE_MIPS_GCR)
  13. #define GCR_BASE_ADDR 0x1fbf8000ULL
  14. #define GCR_ADDRSPACE_SZ 0x8000
  15. /* Offsets to register blocks */
  16. #define MIPS_GCB_OFS 0x0000 /* Global Control Block */
  17. #define MIPS_CLCB_OFS 0x2000 /* Core Local Control Block */
  18. #define MIPS_COCB_OFS 0x4000 /* Core Other Control Block */
  19. #define MIPS_GDB_OFS 0x6000 /* Global Debug Block */
  20. /* Global Control Block Register Map */
  21. #define GCR_CONFIG_OFS 0x0000
  22. #define GCR_BASE_OFS 0x0008
  23. #define GCR_REV_OFS 0x0030
  24. #define GCR_GIC_BASE_OFS 0x0080
  25. #define GCR_CPC_BASE_OFS 0x0088
  26. #define GCR_GIC_STATUS_OFS 0x00D0
  27. #define GCR_CPC_STATUS_OFS 0x00F0
  28. #define GCR_L2_CONFIG_OFS 0x0130
  29. /* Core Local and Core Other Block Register Map */
  30. #define GCR_CL_CONFIG_OFS 0x0010
  31. #define GCR_CL_OTHER_OFS 0x0018
  32. #define GCR_CL_RESETBASE_OFS 0x0020
  33. /* GCR_L2_CONFIG register fields */
  34. #define GCR_L2_CONFIG_BYPASS_SHF 20
  35. #define GCR_L2_CONFIG_BYPASS_MSK ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF)
  36. /* GCR_GIC_BASE register fields */
  37. #define GCR_GIC_BASE_GICEN_MSK 1
  38. #define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL
  39. #define GCR_GIC_BASE_MSK (GCR_GIC_BASE_GICEN_MSK | GCR_GIC_BASE_GICBASE_MSK)
  40. /* GCR_CPC_BASE register fields */
  41. #define GCR_CPC_BASE_CPCEN_MSK 1
  42. #define GCR_CPC_BASE_CPCBASE_MSK 0xFFFFFFFF8000ULL
  43. #define GCR_CPC_BASE_MSK (GCR_CPC_BASE_CPCEN_MSK | GCR_CPC_BASE_CPCBASE_MSK)
  44. /* GCR_CL_OTHER_OFS register fields */
  45. #define GCR_CL_OTHER_VPOTHER_MSK 0x7
  46. #define GCR_CL_OTHER_MSK GCR_CL_OTHER_VPOTHER_MSK
  47. /* GCR_CL_RESETBASE_OFS register fields */
  48. #define GCR_CL_RESET_BASE_RESETBASE_MSK 0xFFFFF000U
  49. #define GCR_CL_RESET_BASE_MSK GCR_CL_RESET_BASE_RESETBASE_MSK
  50. typedef struct MIPSGCRVPState MIPSGCRVPState;
  51. struct MIPSGCRVPState {
  52. uint32_t other;
  53. uint64_t reset_base;
  54. };
  55. typedef struct MIPSGCRState MIPSGCRState;
  56. struct MIPSGCRState {
  57. SysBusDevice parent_obj;
  58. int32_t gcr_rev;
  59. int32_t num_vps;
  60. hwaddr gcr_base;
  61. MemoryRegion iomem;
  62. MemoryRegion *cpc_mr;
  63. MemoryRegion *gic_mr;
  64. uint64_t cpc_base;
  65. uint64_t gic_base;
  66. /* VP Local/Other Registers */
  67. MIPSGCRVPState *vps;
  68. };
  69. #endif /* MIPS_CMGCR_H */