13cbee15bSj_mayer /* 23cbee15bSj_mayer * QEMU PowerMac emulation shared definitions and prototypes 33cbee15bSj_mayer * 43cbee15bSj_mayer * Copyright (c) 2004-2007 Fabrice Bellard 53cbee15bSj_mayer * Copyright (c) 2007 Jocelyn Mayer 63cbee15bSj_mayer * 73cbee15bSj_mayer * Permission is hereby granted, free of charge, to any person obtaining a copy 83cbee15bSj_mayer * of this software and associated documentation files (the "Software"), to deal 93cbee15bSj_mayer * in the Software without restriction, including without limitation the rights 103cbee15bSj_mayer * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 113cbee15bSj_mayer * copies of the Software, and to permit persons to whom the Software is 123cbee15bSj_mayer * furnished to do so, subject to the following conditions: 133cbee15bSj_mayer * 143cbee15bSj_mayer * The above copyright notice and this permission notice shall be included in 153cbee15bSj_mayer * all copies or substantial portions of the Software. 163cbee15bSj_mayer * 173cbee15bSj_mayer * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 183cbee15bSj_mayer * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 193cbee15bSj_mayer * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 203cbee15bSj_mayer * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 213cbee15bSj_mayer * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 223cbee15bSj_mayer * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 233cbee15bSj_mayer * THE SOFTWARE. 243cbee15bSj_mayer */ 252a6a4076SMarkus Armbruster 262a6a4076SMarkus Armbruster #ifndef PPC_MAC_H 272a6a4076SMarkus Armbruster #define PPC_MAC_H 283cbee15bSj_mayer 29022c62cbSPaolo Bonzini #include "exec/memory.h" 3006fe3a5bSMark Cave-Ayland #include "hw/boards.h" 3195ed3b7cSAndreas Färber #include "hw/sysbus.h" 3207a7484eSAndreas Färber #include "hw/ide/internal.h" 330d09e41aSPaolo Bonzini #include "hw/input/adb.h" 3409a57347SMark Cave-Ayland #include "hw/misc/mos6522.h" 350f4b5415SMark Cave-Ayland #include "hw/pci/pci_host.h" 360f4b5415SMark Cave-Ayland #include "hw/pci-host/uninorth.h" 371e39101cSAvi Kivity 383cbee15bSj_mayer /* SMP is not enabled, for now */ 393cbee15bSj_mayer #define MAX_CPUS 1 403cbee15bSj_mayer 41bba831e8SPaul Brook #define BIOS_SIZE (1024 * 1024) 423cbee15bSj_mayer #define NVRAM_SIZE 0x2000 43e5d01b06Saurel32 #define PROM_FILENAME "openbios-ppc" 44992e5acdSblueswir1 #define PROM_ADDR 0xfff00000 453cbee15bSj_mayer 463cbee15bSj_mayer #define KERNEL_LOAD_ADDR 0x01000000 47b9e17a34SAlexander Graf #define KERNEL_GAP 0x00100000 483cbee15bSj_mayer 497fa9ae1aSblueswir1 #define ESCC_CLOCK 3686400 507fa9ae1aSblueswir1 51ab1244b5SMark Cave-Ayland /* Old World IRQs */ 52ab1244b5SMark Cave-Ayland #define OLDWORLD_CUDA_IRQ 0x12 53ab1244b5SMark Cave-Ayland #define OLDWORLD_ESCCB_IRQ 0x10 54ab1244b5SMark Cave-Ayland #define OLDWORLD_ESCCA_IRQ 0xf 55ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE0_IRQ 0xd 56ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE0_DMA_IRQ 0x2 57ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE1_IRQ 0xe 58ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE1_DMA_IRQ 0x3 5909a57347SMark Cave-Ayland 60040b27c0SMark Cave-Ayland /* New World IRQs */ 61040b27c0SMark Cave-Ayland #define NEWWORLD_CUDA_IRQ 0x19 62040b27c0SMark Cave-Ayland #define NEWWORLD_ESCCB_IRQ 0x24 63040b27c0SMark Cave-Ayland #define NEWWORLD_ESCCA_IRQ 0x25 64040b27c0SMark Cave-Ayland #define NEWWORLD_IDE0_IRQ 0xd 65040b27c0SMark Cave-Ayland #define NEWWORLD_IDE0_DMA_IRQ 0x2 66040b27c0SMark Cave-Ayland #define NEWWORLD_IDE1_IRQ 0xe 67040b27c0SMark Cave-Ayland #define NEWWORLD_IDE1_DMA_IRQ 0x3 68040b27c0SMark Cave-Ayland 6906fe3a5bSMark Cave-Ayland /* Core99 machine */ 7006fe3a5bSMark Cave-Ayland #define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99") 7106fe3a5bSMark Cave-Ayland #define CORE99_MACHINE(obj) OBJECT_CHECK(Core99MachineState, (obj), \ 7206fe3a5bSMark Cave-Ayland TYPE_CORE99_MACHINE) 7306fe3a5bSMark Cave-Ayland 74f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_CUDA 0x0 75f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_PMU 0x1 76f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_PMU_ADB 0x2 77f1114c17SMark Cave-Ayland 7806fe3a5bSMark Cave-Ayland typedef struct Core99MachineState { 7906fe3a5bSMark Cave-Ayland /*< private >*/ 8006fe3a5bSMark Cave-Ayland MachineState parent; 81f1114c17SMark Cave-Ayland 82f1114c17SMark Cave-Ayland uint8_t via_config; 8306fe3a5bSMark Cave-Ayland } Core99MachineState; 8406fe3a5bSMark Cave-Ayland 853cbee15bSj_mayer /* MacIO */ 8607a7484eSAndreas Färber #define TYPE_MACIO_IDE "macio-ide" 8707a7484eSAndreas Färber #define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) 8807a7484eSAndreas Färber 8907a7484eSAndreas Färber typedef struct MACIOIDEState { 9007a7484eSAndreas Färber /*< private >*/ 9107a7484eSAndreas Färber SysBusDevice parent_obj; 9207a7484eSAndreas Färber /*< public >*/ 930fc84331SMark Cave-Ayland uint32_t channel; 944f7265ffSBenjamin Herrenschmidt qemu_irq real_ide_irq; 954f7265ffSBenjamin Herrenschmidt qemu_irq real_dma_irq; 964f7265ffSBenjamin Herrenschmidt qemu_irq ide_irq; 9707a7484eSAndreas Färber qemu_irq dma_irq; 9807a7484eSAndreas Färber 9907a7484eSAndreas Färber MemoryRegion mem; 10007a7484eSAndreas Färber IDEBus bus; 1014aa3510fSAlexander Graf IDEDMA dma; 1024aa3510fSAlexander Graf void *dbdma; 103cae32357SAlexander Graf bool dma_active; 1044f7265ffSBenjamin Herrenschmidt uint32_t timing_reg; 1054f7265ffSBenjamin Herrenschmidt uint32_t irq_reg; 10607a7484eSAndreas Färber } MACIOIDEState; 10707a7484eSAndreas Färber 10807a7484eSAndreas Färber void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); 109e451b85fSMark Cave-Ayland void macio_ide_register_dma(MACIOIDEState *ide); 11007a7484eSAndreas Färber 1113cbee15bSj_mayer /* Grackle PCI */ 1120e655047SAndreas Färber #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" 1133cbee15bSj_mayer 1143cbee15bSj_mayer /* Mac NVRAM */ 11595ed3b7cSAndreas Färber #define TYPE_MACIO_NVRAM "macio-nvram" 11695ed3b7cSAndreas Färber #define MACIO_NVRAM(obj) \ 11795ed3b7cSAndreas Färber OBJECT_CHECK(MacIONVRAMState, (obj), TYPE_MACIO_NVRAM) 1183cbee15bSj_mayer 11995ed3b7cSAndreas Färber typedef struct MacIONVRAMState { 12095ed3b7cSAndreas Färber /*< private >*/ 12195ed3b7cSAndreas Färber SysBusDevice parent_obj; 12295ed3b7cSAndreas Färber /*< public >*/ 12395ed3b7cSAndreas Färber 12495ed3b7cSAndreas Färber uint32_t size; 12595ed3b7cSAndreas Färber uint32_t it_shift; 12695ed3b7cSAndreas Färber 12795ed3b7cSAndreas Färber MemoryRegion mem; 12895ed3b7cSAndreas Färber uint8_t *data; 12995ed3b7cSAndreas Färber } MacIONVRAMState; 13095ed3b7cSAndreas Färber 1313cbee15bSj_mayer void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len); 1322a6a4076SMarkus Armbruster #endif /* PPC_MAC_H */ 133