xref: /openbmc/qemu/include/hw/misc/mips_cmgcr.h (revision 10997f2d)
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 
13ec150c7eSMarkus Armbruster #include "hw/sysbus.h"
14db1015e9SEduardo Habkost #include "qom/object.h"
15ec150c7eSMarkus Armbruster 
163994215dSYongbok Kim #define TYPE_MIPS_GCR "mips-gcr"
178063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(MIPSGCRState, MIPS_GCR)
183994215dSYongbok Kim 
193994215dSYongbok Kim #define GCR_BASE_ADDR           0x1fbf8000ULL
203994215dSYongbok Kim #define GCR_ADDRSPACE_SZ        0x8000
213994215dSYongbok Kim 
223994215dSYongbok Kim /* Offsets to register blocks */
233994215dSYongbok Kim #define MIPS_GCB_OFS        0x0000 /* Global Control Block */
243994215dSYongbok Kim #define MIPS_CLCB_OFS       0x2000 /* Core Local Control Block */
253994215dSYongbok Kim #define MIPS_COCB_OFS       0x4000 /* Core Other Control Block */
263994215dSYongbok Kim #define MIPS_GDB_OFS        0x6000 /* Global Debug Block */
273994215dSYongbok Kim 
283994215dSYongbok Kim /* Global Control Block Register Map */
293994215dSYongbok Kim #define GCR_CONFIG_OFS      0x0000
303994215dSYongbok Kim #define GCR_BASE_OFS        0x0008
313994215dSYongbok Kim #define GCR_REV_OFS         0x0030
3219494f81SLeon Alrae #define GCR_GIC_BASE_OFS    0x0080
332edd5261SLeon Alrae #define GCR_CPC_BASE_OFS    0x0088
3419494f81SLeon Alrae #define GCR_GIC_STATUS_OFS  0x00D0
352edd5261SLeon Alrae #define GCR_CPC_STATUS_OFS  0x00F0
363994215dSYongbok Kim #define GCR_L2_CONFIG_OFS   0x0130
373994215dSYongbok Kim 
383994215dSYongbok Kim /* Core Local and Core Other Block Register Map */
393994215dSYongbok Kim #define GCR_CL_CONFIG_OFS   0x0010
403994215dSYongbok Kim #define GCR_CL_OTHER_OFS    0x0018
41c09199feSLeon Alrae #define GCR_CL_RESETBASE_OFS 0x0020
423994215dSYongbok Kim 
433994215dSYongbok Kim /* GCR_L2_CONFIG register fields */
443994215dSYongbok Kim #define GCR_L2_CONFIG_BYPASS_SHF    20
453994215dSYongbok Kim #define GCR_L2_CONFIG_BYPASS_MSK    ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF)
463994215dSYongbok Kim 
4708944be1SPaul Burton /* GCR_BASE register fields */
4808944be1SPaul Burton #define GCR_BASE_GCRBASE_MSK     0xffffffff8000ULL
4908944be1SPaul Burton 
5019494f81SLeon Alrae /* GCR_GIC_BASE register fields */
5119494f81SLeon Alrae #define GCR_GIC_BASE_GICEN_MSK   1
5219494f81SLeon Alrae #define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL
5319494f81SLeon Alrae #define GCR_GIC_BASE_MSK (GCR_GIC_BASE_GICEN_MSK | GCR_GIC_BASE_GICBASE_MSK)
5419494f81SLeon Alrae 
552edd5261SLeon Alrae /* GCR_CPC_BASE register fields */
562edd5261SLeon Alrae #define GCR_CPC_BASE_CPCEN_MSK   1
572edd5261SLeon Alrae #define GCR_CPC_BASE_CPCBASE_MSK 0xFFFFFFFF8000ULL
582edd5261SLeon Alrae #define GCR_CPC_BASE_MSK (GCR_CPC_BASE_CPCEN_MSK | GCR_CPC_BASE_CPCBASE_MSK)
592edd5261SLeon Alrae 
60c09199feSLeon Alrae /* GCR_CL_OTHER_OFS register fields */
61c09199feSLeon Alrae #define GCR_CL_OTHER_VPOTHER_MSK 0x7
62c09199feSLeon Alrae #define GCR_CL_OTHER_MSK GCR_CL_OTHER_VPOTHER_MSK
63c09199feSLeon Alrae 
64c09199feSLeon Alrae /* GCR_CL_RESETBASE_OFS register fields */
65c09199feSLeon Alrae #define GCR_CL_RESET_BASE_RESETBASE_MSK 0xFFFFF000U
66c09199feSLeon Alrae #define GCR_CL_RESET_BASE_MSK GCR_CL_RESET_BASE_RESETBASE_MSK
67c09199feSLeon Alrae 
68c09199feSLeon Alrae typedef struct MIPSGCRVPState MIPSGCRVPState;
69c09199feSLeon Alrae struct MIPSGCRVPState {
70c09199feSLeon Alrae     uint32_t other;
71c09199feSLeon Alrae     uint64_t reset_base;
72c09199feSLeon Alrae };
73c09199feSLeon Alrae 
743994215dSYongbok Kim struct MIPSGCRState {
753994215dSYongbok Kim     SysBusDevice parent_obj;
763994215dSYongbok Kim 
773994215dSYongbok Kim     int32_t gcr_rev;
78*10997f2dSPhilippe Mathieu-Daudé     uint32_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