1bad56236SAndrew Baumann /* 2bad56236SAndrew Baumann * Raspberry Pi emulation (c) 2012 Gregory Estrade 3bad56236SAndrew Baumann * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous 4bad56236SAndrew Baumann * 5bad56236SAndrew Baumann * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft 6bad56236SAndrew Baumann * Written by Andrew Baumann 7bad56236SAndrew Baumann * 86111a0c0SPhilippe Mathieu-Daudé * This work is licensed under the terms of the GNU GPL, version 2 or later. 96111a0c0SPhilippe Mathieu-Daudé * See the COPYING file in the top-level directory. 10bad56236SAndrew Baumann */ 11bad56236SAndrew Baumann 12bad56236SAndrew Baumann #ifndef BCM2836_H 13bad56236SAndrew Baumann #define BCM2836_H 14bad56236SAndrew Baumann 15bad56236SAndrew Baumann #include "hw/arm/bcm2835_peripherals.h" 16bad56236SAndrew Baumann #include "hw/intc/bcm2836_control.h" 17ec150c7eSMarkus Armbruster #include "target/arm/cpu.h" 18db1015e9SEduardo Habkost #include "qom/object.h" 19bad56236SAndrew Baumann 20f932093aSSergey Kambalin #define TYPE_BCM283X_BASE "bcm283x-base" 21f932093aSSergey Kambalin OBJECT_DECLARE_TYPE(BCM283XBaseState, BCM283XBaseClass, BCM283X_BASE) 22926dcdf0SPeter Maydell #define TYPE_BCM283X "bcm283x" 23f932093aSSergey Kambalin OBJECT_DECLARE_SIMPLE_TYPE(BCM283XState, BCM283X) 24bad56236SAndrew Baumann 25926dcdf0SPeter Maydell #define BCM283X_NCPUS 4 26bad56236SAndrew Baumann 270fd74f03SPeter Maydell /* These type names are for specific SoCs; other than instantiating 280fd74f03SPeter Maydell * them, code using these devices should always handle them via the 290fd74f03SPeter Maydell * BCM283x base class, so they have no BCM2836(obj) etc macros. 300fd74f03SPeter Maydell */ 31df6cf08dSPhilippe Mathieu-Daudé #define TYPE_BCM2835 "bcm2835" 320fd74f03SPeter Maydell #define TYPE_BCM2836 "bcm2836" 330fd74f03SPeter Maydell #define TYPE_BCM2837 "bcm2837" 340fd74f03SPeter Maydell 35f932093aSSergey Kambalin struct BCM283XBaseState { 36bad56236SAndrew Baumann /*< private >*/ 37bad56236SAndrew Baumann DeviceState parent_obj; 38bad56236SAndrew Baumann /*< public >*/ 39bad56236SAndrew Baumann 40bad56236SAndrew Baumann uint32_t enabled_cpus; 41bad56236SAndrew Baumann 425e5e9ed6SPhilippe Mathieu-Daudé struct { 435e5e9ed6SPhilippe Mathieu-Daudé ARMCPU core; 445e5e9ed6SPhilippe Mathieu-Daudé } cpu[BCM283X_NCPUS]; 45bad56236SAndrew Baumann BCM2836ControlState control; 46f932093aSSergey Kambalin }; 47f932093aSSergey Kambalin 48f932093aSSergey Kambalin struct BCM283XBaseClass { 49f932093aSSergey Kambalin /*< private >*/ 50f932093aSSergey Kambalin DeviceClass parent_class; 51f932093aSSergey Kambalin /*< public >*/ 52f932093aSSergey Kambalin const char *name; 53f932093aSSergey Kambalin const char *cpu_type; 54f932093aSSergey Kambalin unsigned core_count; 55f932093aSSergey Kambalin hwaddr peri_base; /* Peripheral base address seen by the CPU */ 56f932093aSSergey Kambalin hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ 57f932093aSSergey Kambalin int clusterid; 58f932093aSSergey Kambalin }; 59f932093aSSergey Kambalin 60f932093aSSergey Kambalin struct BCM283XState { 61f932093aSSergey Kambalin /*< private >*/ 62f932093aSSergey Kambalin BCM283XBaseState parent_obj; 63f932093aSSergey Kambalin /*< public >*/ 64bad56236SAndrew Baumann BCM2835PeripheralState peripherals; 65db1015e9SEduardo Habkost }; 66bad56236SAndrew Baumann 67*7d04d630SSergey Kambalin bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps, 68*7d04d630SSergey Kambalin Error **errp); 69f932093aSSergey Kambalin 70bad56236SAndrew Baumann #endif /* BCM2836_H */ 71