13994215dSYongbok Kim /* 23994215dSYongbok Kim * This file is subject to the terms and conditions of the GNU General Public 33994215dSYongbok Kim * License. See the file "COPYING" in the main directory of this archive 43994215dSYongbok Kim * for more details. 53994215dSYongbok Kim * 63994215dSYongbok Kim * Copyright (C) 2015 Imagination Technologies 73994215dSYongbok Kim * 83994215dSYongbok Kim */ 93994215dSYongbok Kim 10121d0712SMarkus Armbruster #ifndef MIPS_CMGCR_H 11121d0712SMarkus Armbruster #define MIPS_CMGCR_H 123994215dSYongbok Kim 13*ec150c7eSMarkus Armbruster #include "hw/sysbus.h" 14*ec150c7eSMarkus Armbruster 153994215dSYongbok Kim #define TYPE_MIPS_GCR "mips-gcr" 163994215dSYongbok Kim #define MIPS_GCR(obj) OBJECT_CHECK(MIPSGCRState, (obj), TYPE_MIPS_GCR) 173994215dSYongbok Kim 183994215dSYongbok Kim #define GCR_BASE_ADDR 0x1fbf8000ULL 193994215dSYongbok Kim #define GCR_ADDRSPACE_SZ 0x8000 203994215dSYongbok Kim 213994215dSYongbok Kim /* Offsets to register blocks */ 223994215dSYongbok Kim #define MIPS_GCB_OFS 0x0000 /* Global Control Block */ 233994215dSYongbok Kim #define MIPS_CLCB_OFS 0x2000 /* Core Local Control Block */ 243994215dSYongbok Kim #define MIPS_COCB_OFS 0x4000 /* Core Other Control Block */ 253994215dSYongbok Kim #define MIPS_GDB_OFS 0x6000 /* Global Debug Block */ 263994215dSYongbok Kim 273994215dSYongbok Kim /* Global Control Block Register Map */ 283994215dSYongbok Kim #define GCR_CONFIG_OFS 0x0000 293994215dSYongbok Kim #define GCR_BASE_OFS 0x0008 303994215dSYongbok Kim #define GCR_REV_OFS 0x0030 3119494f81SLeon Alrae #define GCR_GIC_BASE_OFS 0x0080 322edd5261SLeon Alrae #define GCR_CPC_BASE_OFS 0x0088 3319494f81SLeon Alrae #define GCR_GIC_STATUS_OFS 0x00D0 342edd5261SLeon Alrae #define GCR_CPC_STATUS_OFS 0x00F0 353994215dSYongbok Kim #define GCR_L2_CONFIG_OFS 0x0130 363994215dSYongbok Kim 373994215dSYongbok Kim /* Core Local and Core Other Block Register Map */ 383994215dSYongbok Kim #define GCR_CL_CONFIG_OFS 0x0010 393994215dSYongbok Kim #define GCR_CL_OTHER_OFS 0x0018 40c09199feSLeon Alrae #define GCR_CL_RESETBASE_OFS 0x0020 413994215dSYongbok Kim 423994215dSYongbok Kim /* GCR_L2_CONFIG register fields */ 433994215dSYongbok Kim #define GCR_L2_CONFIG_BYPASS_SHF 20 443994215dSYongbok Kim #define GCR_L2_CONFIG_BYPASS_MSK ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF) 453994215dSYongbok Kim 4608944be1SPaul Burton /* GCR_BASE register fields */ 4708944be1SPaul Burton #define GCR_BASE_GCRBASE_MSK 0xffffffff8000ULL 4808944be1SPaul Burton 4919494f81SLeon Alrae /* GCR_GIC_BASE register fields */ 5019494f81SLeon Alrae #define GCR_GIC_BASE_GICEN_MSK 1 5119494f81SLeon Alrae #define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL 5219494f81SLeon Alrae #define GCR_GIC_BASE_MSK (GCR_GIC_BASE_GICEN_MSK | GCR_GIC_BASE_GICBASE_MSK) 5319494f81SLeon Alrae 542edd5261SLeon Alrae /* GCR_CPC_BASE register fields */ 552edd5261SLeon Alrae #define GCR_CPC_BASE_CPCEN_MSK 1 562edd5261SLeon Alrae #define GCR_CPC_BASE_CPCBASE_MSK 0xFFFFFFFF8000ULL 572edd5261SLeon Alrae #define GCR_CPC_BASE_MSK (GCR_CPC_BASE_CPCEN_MSK | GCR_CPC_BASE_CPCBASE_MSK) 582edd5261SLeon Alrae 59c09199feSLeon Alrae /* GCR_CL_OTHER_OFS register fields */ 60c09199feSLeon Alrae #define GCR_CL_OTHER_VPOTHER_MSK 0x7 61c09199feSLeon Alrae #define GCR_CL_OTHER_MSK GCR_CL_OTHER_VPOTHER_MSK 62c09199feSLeon Alrae 63c09199feSLeon Alrae /* GCR_CL_RESETBASE_OFS register fields */ 64c09199feSLeon Alrae #define GCR_CL_RESET_BASE_RESETBASE_MSK 0xFFFFF000U 65c09199feSLeon Alrae #define GCR_CL_RESET_BASE_MSK GCR_CL_RESET_BASE_RESETBASE_MSK 66c09199feSLeon Alrae 67c09199feSLeon Alrae typedef struct MIPSGCRVPState MIPSGCRVPState; 68c09199feSLeon Alrae struct MIPSGCRVPState { 69c09199feSLeon Alrae uint32_t other; 70c09199feSLeon Alrae uint64_t reset_base; 71c09199feSLeon Alrae }; 72c09199feSLeon Alrae 733994215dSYongbok Kim typedef struct MIPSGCRState MIPSGCRState; 743994215dSYongbok Kim struct MIPSGCRState { 753994215dSYongbok Kim SysBusDevice parent_obj; 763994215dSYongbok Kim 773994215dSYongbok Kim int32_t gcr_rev; 783994215dSYongbok Kim int32_t num_vps; 793994215dSYongbok Kim hwaddr gcr_base; 803994215dSYongbok Kim MemoryRegion iomem; 812edd5261SLeon Alrae MemoryRegion *cpc_mr; 8219494f81SLeon Alrae MemoryRegion *gic_mr; 832edd5261SLeon Alrae 842edd5261SLeon Alrae uint64_t cpc_base; 8519494f81SLeon Alrae uint64_t gic_base; 86c09199feSLeon Alrae 87c09199feSLeon Alrae /* VP Local/Other Registers */ 88c09199feSLeon Alrae MIPSGCRVPState *vps; 893994215dSYongbok Kim }; 903994215dSYongbok Kim 91121d0712SMarkus Armbruster #endif /* MIPS_CMGCR_H */ 92