xref: /qemu/include/hw/misc/mips_cpc.h (revision e3a6e0da)
1 /*
2  * Cluster Power Controller emulation
3  *
4  * Copyright (c) 2016 Imagination Technologies
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef MIPS_CPC_H
21 #define MIPS_CPC_H
22 
23 #include "hw/sysbus.h"
24 #include "qom/object.h"
25 
26 #define CPC_ADDRSPACE_SZ    0x6000
27 
28 /* CPC blocks offsets relative to base address */
29 #define CPC_CL_BASE_OFS     0x2000
30 #define CPC_CO_BASE_OFS     0x4000
31 
32 /* CPC register offsets relative to block offsets */
33 #define CPC_VP_STOP_OFS     0x20
34 #define CPC_VP_RUN_OFS      0x28
35 #define CPC_VP_RUNNING_OFS  0x30
36 
37 #define TYPE_MIPS_CPC "mips-cpc"
38 typedef struct MIPSCPCState MIPSCPCState;
39 DECLARE_INSTANCE_CHECKER(MIPSCPCState, MIPS_CPC,
40                          TYPE_MIPS_CPC)
41 
42 struct MIPSCPCState {
43     SysBusDevice parent_obj;
44 
45     uint32_t num_vp;
46     uint64_t vp_start_running; /* VPs running from restart */
47 
48     MemoryRegion mr;
49     uint64_t vp_running; /* Indicates which VPs are in the run state */
50 };
51 
52 #endif /* MIPS_CPC_H */
53