147b43a1fSPaolo Bonzini /* 247b43a1fSPaolo Bonzini * QEMU PowerPC 405 shared definitions 347b43a1fSPaolo Bonzini * 447b43a1fSPaolo Bonzini * Copyright (c) 2007 Jocelyn Mayer 547b43a1fSPaolo Bonzini * 647b43a1fSPaolo Bonzini * Permission is hereby granted, free of charge, to any person obtaining a copy 747b43a1fSPaolo Bonzini * of this software and associated documentation files (the "Software"), to deal 847b43a1fSPaolo Bonzini * in the Software without restriction, including without limitation the rights 947b43a1fSPaolo Bonzini * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 1047b43a1fSPaolo Bonzini * copies of the Software, and to permit persons to whom the Software is 1147b43a1fSPaolo Bonzini * furnished to do so, subject to the following conditions: 1247b43a1fSPaolo Bonzini * 1347b43a1fSPaolo Bonzini * The above copyright notice and this permission notice shall be included in 1447b43a1fSPaolo Bonzini * all copies or substantial portions of the Software. 1547b43a1fSPaolo Bonzini * 1647b43a1fSPaolo Bonzini * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1747b43a1fSPaolo Bonzini * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1847b43a1fSPaolo Bonzini * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1947b43a1fSPaolo Bonzini * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2047b43a1fSPaolo Bonzini * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2147b43a1fSPaolo Bonzini * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 2247b43a1fSPaolo Bonzini * THE SOFTWARE. 2347b43a1fSPaolo Bonzini */ 2447b43a1fSPaolo Bonzini 25121d0712SMarkus Armbruster #ifndef PPC405_H 26121d0712SMarkus Armbruster #define PPC405_H 2747b43a1fSPaolo Bonzini 283b758ca2SCédric Le Goater #include "qom/object.h" 2947b43a1fSPaolo Bonzini #include "hw/ppc/ppc4xx.h" 30e9d20f37SCédric Le Goater #include "hw/intc/ppc-uic.h" 31111913fbSCédric Le Goater #include "hw/i2c/ppc4xx_i2c.h" 3247b43a1fSPaolo Bonzini 332841430eSCédric Le Goater /* PLB to OPB bridge */ 342841430eSCédric Le Goater #define TYPE_PPC405_POB "ppc405-pob" 352841430eSCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405PobState, PPC405_POB); 362841430eSCédric Le Goater struct Ppc405PobState { 372841430eSCédric Le Goater Ppc4xxDcrDeviceState parent_obj; 382841430eSCédric Le Goater 392841430eSCédric Le Goater uint32_t bear; 402841430eSCédric Le Goater uint32_t besr0; 412841430eSCédric Le Goater uint32_t besr1; 422841430eSCédric Le Goater }; 432841430eSCédric Le Goater 4472beecc2SCédric Le Goater /* OPB arbitrer */ 4572beecc2SCédric Le Goater #define TYPE_PPC405_OPBA "ppc405-opba" 4672beecc2SCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405OpbaState, PPC405_OPBA); 4772beecc2SCédric Le Goater struct Ppc405OpbaState { 4872beecc2SCédric Le Goater SysBusDevice parent_obj; 4972beecc2SCédric Le Goater 5072beecc2SCédric Le Goater MemoryRegion io; 5172beecc2SCédric Le Goater uint8_t cr; 5272beecc2SCédric Le Goater uint8_t pr; 5372beecc2SCédric Le Goater }; 5472beecc2SCédric Le Goater 5582c86e30SCédric Le Goater /* DMA controller */ 5682c86e30SCédric Le Goater #define TYPE_PPC405_DMA "ppc405-dma" 5782c86e30SCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405DmaState, PPC405_DMA); 5882c86e30SCédric Le Goater struct Ppc405DmaState { 5982c86e30SCédric Le Goater Ppc4xxDcrDeviceState parent_obj; 6082c86e30SCédric Le Goater 6182c86e30SCédric Le Goater qemu_irq irqs[4]; 6282c86e30SCédric Le Goater uint32_t cr[4]; 6382c86e30SCédric Le Goater uint32_t ct[4]; 6482c86e30SCédric Le Goater uint32_t da[4]; 6582c86e30SCédric Le Goater uint32_t sa[4]; 6682c86e30SCédric Le Goater uint32_t sg[4]; 6782c86e30SCédric Le Goater uint32_t sr; 6882c86e30SCédric Le Goater uint32_t sgc; 6982c86e30SCédric Le Goater uint32_t slp; 7082c86e30SCédric Le Goater uint32_t pol; 7182c86e30SCédric Le Goater }; 7282c86e30SCédric Le Goater 73125277c6SCédric Le Goater /* GPIO */ 74125277c6SCédric Le Goater #define TYPE_PPC405_GPIO "ppc405-gpio" 75125277c6SCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405GpioState, PPC405_GPIO); 76125277c6SCédric Le Goater struct Ppc405GpioState { 77125277c6SCédric Le Goater SysBusDevice parent_obj; 78125277c6SCédric Le Goater 79125277c6SCédric Le Goater MemoryRegion io; 80125277c6SCédric Le Goater uint32_t or; 81125277c6SCédric Le Goater uint32_t tcr; 82125277c6SCédric Le Goater uint32_t osrh; 83125277c6SCédric Le Goater uint32_t osrl; 84125277c6SCédric Le Goater uint32_t tsrh; 85125277c6SCédric Le Goater uint32_t tsrl; 86125277c6SCédric Le Goater uint32_t odr; 87125277c6SCédric Le Goater uint32_t ir; 88125277c6SCédric Le Goater uint32_t rr1; 89125277c6SCédric Le Goater uint32_t isr1h; 90125277c6SCédric Le Goater uint32_t isr1l; 91125277c6SCédric Le Goater }; 92125277c6SCédric Le Goater 932847eb40SCédric Le Goater /* On Chip Memory */ 942847eb40SCédric Le Goater #define TYPE_PPC405_OCM "ppc405-ocm" 952847eb40SCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405OcmState, PPC405_OCM); 962847eb40SCédric Le Goater struct Ppc405OcmState { 972847eb40SCédric Le Goater Ppc4xxDcrDeviceState parent_obj; 982847eb40SCédric Le Goater 992847eb40SCédric Le Goater MemoryRegion ram; 1002847eb40SCédric Le Goater MemoryRegion isarc_ram; 1012847eb40SCédric Le Goater MemoryRegion dsarc_ram; 1022847eb40SCédric Le Goater uint32_t isarc; 1032847eb40SCédric Le Goater uint32_t isacntl; 1042847eb40SCédric Le Goater uint32_t dsarc; 1052847eb40SCédric Le Goater uint32_t dsacntl; 1062847eb40SCédric Le Goater }; 1072847eb40SCédric Le Goater 108269fbb5bSCédric Le Goater /* General purpose timers */ 109269fbb5bSCédric Le Goater #define TYPE_PPC405_GPT "ppc405-gpt" 110269fbb5bSCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405GptState, PPC405_GPT); 111269fbb5bSCédric Le Goater struct Ppc405GptState { 112269fbb5bSCédric Le Goater SysBusDevice parent_obj; 113269fbb5bSCédric Le Goater 114269fbb5bSCédric Le Goater MemoryRegion iomem; 115269fbb5bSCédric Le Goater 116269fbb5bSCédric Le Goater int64_t tb_offset; 117269fbb5bSCédric Le Goater uint32_t tb_freq; 118269fbb5bSCédric Le Goater QEMUTimer *timer; 119269fbb5bSCédric Le Goater qemu_irq irqs[5]; 120269fbb5bSCédric Le Goater uint32_t oe; 121269fbb5bSCédric Le Goater uint32_t ol; 122269fbb5bSCédric Le Goater uint32_t im; 123269fbb5bSCédric Le Goater uint32_t is; 124269fbb5bSCédric Le Goater uint32_t ie; 125269fbb5bSCédric Le Goater uint32_t comp[5]; 126269fbb5bSCédric Le Goater uint32_t mask[5]; 127269fbb5bSCédric Le Goater }; 128269fbb5bSCédric Le Goater 1294a7d2b7eSCédric Le Goater #define TYPE_PPC405_CPC "ppc405-cpc" 1304a7d2b7eSCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405CpcState, PPC405_CPC); 1314a7d2b7eSCédric Le Goater 1324a7d2b7eSCédric Le Goater enum { 1334a7d2b7eSCédric Le Goater PPC405EP_CPU_CLK = 0, 1344a7d2b7eSCédric Le Goater PPC405EP_PLB_CLK = 1, 1354a7d2b7eSCédric Le Goater PPC405EP_OPB_CLK = 2, 1364a7d2b7eSCédric Le Goater PPC405EP_EBC_CLK = 3, 1374a7d2b7eSCédric Le Goater PPC405EP_MAL_CLK = 4, 1384a7d2b7eSCédric Le Goater PPC405EP_PCI_CLK = 5, 1394a7d2b7eSCédric Le Goater PPC405EP_UART0_CLK = 6, 1404a7d2b7eSCédric Le Goater PPC405EP_UART1_CLK = 7, 1414a7d2b7eSCédric Le Goater PPC405EP_CLK_NB = 8, 1424a7d2b7eSCédric Le Goater }; 1434a7d2b7eSCédric Le Goater 1444a7d2b7eSCédric Le Goater struct Ppc405CpcState { 1454a7d2b7eSCédric Le Goater Ppc4xxDcrDeviceState parent_obj; 1464a7d2b7eSCédric Le Goater 1474a7d2b7eSCédric Le Goater uint32_t sysclk; 1484a7d2b7eSCédric Le Goater clk_setup_t clk_setup[PPC405EP_CLK_NB]; 1494a7d2b7eSCédric Le Goater uint32_t boot; 1504a7d2b7eSCédric Le Goater uint32_t epctl; 1514a7d2b7eSCédric Le Goater uint32_t pllmr[2]; 1524a7d2b7eSCédric Le Goater uint32_t ucr; 1534a7d2b7eSCédric Le Goater uint32_t srr; 1544a7d2b7eSCédric Le Goater uint32_t jtagid; 1554a7d2b7eSCédric Le Goater uint32_t pci; 1564a7d2b7eSCédric Le Goater /* Clock and power management */ 1574a7d2b7eSCédric Le Goater uint32_t er; 1584a7d2b7eSCédric Le Goater uint32_t fr; 1594a7d2b7eSCédric Le Goater uint32_t sr; 1604a7d2b7eSCédric Le Goater }; 1614a7d2b7eSCédric Le Goater 1623b758ca2SCédric Le Goater #define TYPE_PPC405_SOC "ppc405-soc" 1633b758ca2SCédric Le Goater OBJECT_DECLARE_SIMPLE_TYPE(Ppc405SoCState, PPC405_SOC); 1643b758ca2SCédric Le Goater 1653b758ca2SCédric Le Goater struct Ppc405SoCState { 1663b758ca2SCédric Le Goater /* Private */ 1673b758ca2SCédric Le Goater DeviceState parent_obj; 1683b758ca2SCédric Le Goater 1693b758ca2SCédric Le Goater /* Public */ 170b42ad437SCédric Le Goater PowerPCCPU cpu; 171e9d20f37SCédric Le Goater PPCUIC uic; 1724a7d2b7eSCédric Le Goater Ppc405CpcState cpc; 173269fbb5bSCédric Le Goater Ppc405GptState gpt; 1742847eb40SCédric Le Goater Ppc405OcmState ocm; 175125277c6SCédric Le Goater Ppc405GpioState gpio; 17682c86e30SCédric Le Goater Ppc405DmaState dma; 177111913fbSCédric Le Goater PPC4xxI2CState i2c; 178cba58aa7SBALATON Zoltan Ppc4xxEbcState ebc; 17972beecc2SCédric Le Goater Ppc405OpbaState opba; 1802841430eSCédric Le Goater Ppc405PobState pob; 181052c779bSBALATON Zoltan Ppc4xxPlbState plb; 182da116a8aSCédric Le Goater Ppc4xxMalState mal; 183*4fc30e15SBALATON Zoltan Ppc4xxSdramDdrState sdram; 1843b758ca2SCédric Le Goater }; 1853b758ca2SCédric Le Goater 186121d0712SMarkus Armbruster #endif /* PPC405_H */ 187