xref: /openbmc/qemu/include/hw/misc/mips_cmgcr.h (revision 19494f811a43c6bc226aa272d86300d9229224fe)
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 
103994215dSYongbok Kim #ifndef _MIPS_GCR_H
113994215dSYongbok Kim #define _MIPS_GCR_H
123994215dSYongbok Kim 
133994215dSYongbok Kim #define TYPE_MIPS_GCR "mips-gcr"
143994215dSYongbok Kim #define MIPS_GCR(obj) OBJECT_CHECK(MIPSGCRState, (obj), TYPE_MIPS_GCR)
153994215dSYongbok Kim 
163994215dSYongbok Kim #define GCR_BASE_ADDR           0x1fbf8000ULL
173994215dSYongbok Kim #define GCR_ADDRSPACE_SZ        0x8000
183994215dSYongbok Kim 
193994215dSYongbok Kim /* Offsets to register blocks */
203994215dSYongbok Kim #define MIPS_GCB_OFS        0x0000 /* Global Control Block */
213994215dSYongbok Kim #define MIPS_CLCB_OFS       0x2000 /* Core Local Control Block */
223994215dSYongbok Kim #define MIPS_COCB_OFS       0x4000 /* Core Other Control Block */
233994215dSYongbok Kim #define MIPS_GDB_OFS        0x6000 /* Global Debug Block */
243994215dSYongbok Kim 
253994215dSYongbok Kim /* Global Control Block Register Map */
263994215dSYongbok Kim #define GCR_CONFIG_OFS      0x0000
273994215dSYongbok Kim #define GCR_BASE_OFS        0x0008
283994215dSYongbok Kim #define GCR_REV_OFS         0x0030
29*19494f81SLeon Alrae #define GCR_GIC_BASE_OFS    0x0080
302edd5261SLeon Alrae #define GCR_CPC_BASE_OFS    0x0088
31*19494f81SLeon Alrae #define GCR_GIC_STATUS_OFS  0x00D0
322edd5261SLeon Alrae #define GCR_CPC_STATUS_OFS  0x00F0
333994215dSYongbok Kim #define GCR_L2_CONFIG_OFS   0x0130
343994215dSYongbok Kim 
353994215dSYongbok Kim /* Core Local and Core Other Block Register Map */
363994215dSYongbok Kim #define GCR_CL_CONFIG_OFS   0x0010
373994215dSYongbok Kim #define GCR_CL_OTHER_OFS    0x0018
383994215dSYongbok Kim 
393994215dSYongbok Kim /* GCR_L2_CONFIG register fields */
403994215dSYongbok Kim #define GCR_L2_CONFIG_BYPASS_SHF    20
413994215dSYongbok Kim #define GCR_L2_CONFIG_BYPASS_MSK    ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF)
423994215dSYongbok Kim 
43*19494f81SLeon Alrae /* GCR_GIC_BASE register fields */
44*19494f81SLeon Alrae #define GCR_GIC_BASE_GICEN_MSK   1
45*19494f81SLeon Alrae #define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL
46*19494f81SLeon Alrae #define GCR_GIC_BASE_MSK (GCR_GIC_BASE_GICEN_MSK | GCR_GIC_BASE_GICBASE_MSK)
47*19494f81SLeon Alrae 
482edd5261SLeon Alrae /* GCR_CPC_BASE register fields */
492edd5261SLeon Alrae #define GCR_CPC_BASE_CPCEN_MSK   1
502edd5261SLeon Alrae #define GCR_CPC_BASE_CPCBASE_MSK 0xFFFFFFFF8000ULL
512edd5261SLeon Alrae #define GCR_CPC_BASE_MSK (GCR_CPC_BASE_CPCEN_MSK | GCR_CPC_BASE_CPCBASE_MSK)
522edd5261SLeon Alrae 
533994215dSYongbok Kim typedef struct MIPSGCRState MIPSGCRState;
543994215dSYongbok Kim struct MIPSGCRState {
553994215dSYongbok Kim     SysBusDevice parent_obj;
563994215dSYongbok Kim 
573994215dSYongbok Kim     int32_t gcr_rev;
583994215dSYongbok Kim     int32_t num_vps;
593994215dSYongbok Kim     hwaddr gcr_base;
603994215dSYongbok Kim     MemoryRegion iomem;
612edd5261SLeon Alrae     MemoryRegion *cpc_mr;
62*19494f81SLeon Alrae     MemoryRegion *gic_mr;
632edd5261SLeon Alrae 
642edd5261SLeon Alrae     uint64_t cpc_base;
65*19494f81SLeon Alrae     uint64_t gic_base;
663994215dSYongbok Kim };
673994215dSYongbok Kim 
683994215dSYongbok Kim #endif /* _MIPS_GCR_H */
69