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 29ab3dd749SPhilippe Mathieu-Daudé #include "qemu/units.h" 30022c62cbSPaolo Bonzini #include "exec/memory.h" 3106fe3a5bSMark Cave-Ayland #include "hw/boards.h" 3295ed3b7cSAndreas Färber #include "hw/sysbus.h" 3307a7484eSAndreas Färber #include "hw/ide/internal.h" 340d09e41aSPaolo Bonzini #include "hw/input/adb.h" 3509a57347SMark Cave-Ayland #include "hw/misc/mos6522.h" 360f4b5415SMark Cave-Ayland #include "hw/pci/pci_host.h" 370f4b5415SMark Cave-Ayland #include "hw/pci-host/uninorth.h" 381e39101cSAvi Kivity 393cbee15bSj_mayer /* SMP is not enabled, for now */ 403cbee15bSj_mayer #define MAX_CPUS 1 413cbee15bSj_mayer 42ab3dd749SPhilippe Mathieu-Daudé #define BIOS_SIZE (1 * MiB) 433cbee15bSj_mayer #define NVRAM_SIZE 0x2000 44e5d01b06Saurel32 #define PROM_FILENAME "openbios-ppc" 45992e5acdSblueswir1 #define PROM_ADDR 0xfff00000 463cbee15bSj_mayer 473cbee15bSj_mayer #define KERNEL_LOAD_ADDR 0x01000000 48b9e17a34SAlexander Graf #define KERNEL_GAP 0x00100000 493cbee15bSj_mayer 507fa9ae1aSblueswir1 #define ESCC_CLOCK 3686400 517fa9ae1aSblueswir1 52ab1244b5SMark Cave-Ayland /* Old World IRQs */ 53ab1244b5SMark Cave-Ayland #define OLDWORLD_CUDA_IRQ 0x12 54ab1244b5SMark Cave-Ayland #define OLDWORLD_ESCCB_IRQ 0x10 55ab1244b5SMark Cave-Ayland #define OLDWORLD_ESCCA_IRQ 0xf 56ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE0_IRQ 0xd 57ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE0_DMA_IRQ 0x2 58ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE1_IRQ 0xe 59ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE1_DMA_IRQ 0x3 6009a57347SMark Cave-Ayland 61040b27c0SMark Cave-Ayland /* New World IRQs */ 62040b27c0SMark Cave-Ayland #define NEWWORLD_CUDA_IRQ 0x19 63d811d61fSMark Cave-Ayland #define NEWWORLD_PMU_IRQ 0x19 64040b27c0SMark Cave-Ayland #define NEWWORLD_ESCCB_IRQ 0x24 65040b27c0SMark Cave-Ayland #define NEWWORLD_ESCCA_IRQ 0x25 66040b27c0SMark Cave-Ayland #define NEWWORLD_IDE0_IRQ 0xd 67040b27c0SMark Cave-Ayland #define NEWWORLD_IDE0_DMA_IRQ 0x2 68040b27c0SMark Cave-Ayland #define NEWWORLD_IDE1_IRQ 0xe 69040b27c0SMark Cave-Ayland #define NEWWORLD_IDE1_DMA_IRQ 0x3 707c4166a9SMark Cave-Ayland #define NEWWORLD_EXTING_GPIO1 0x2f 717c4166a9SMark Cave-Ayland #define NEWWORLD_EXTING_GPIO9 0x37 72040b27c0SMark Cave-Ayland 7306fe3a5bSMark Cave-Ayland /* Core99 machine */ 7406fe3a5bSMark Cave-Ayland #define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99") 7506fe3a5bSMark Cave-Ayland #define CORE99_MACHINE(obj) OBJECT_CHECK(Core99MachineState, (obj), \ 7606fe3a5bSMark Cave-Ayland TYPE_CORE99_MACHINE) 7706fe3a5bSMark Cave-Ayland 78f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_CUDA 0x0 79f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_PMU 0x1 80f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_PMU_ADB 0x2 81f1114c17SMark Cave-Ayland 8206fe3a5bSMark Cave-Ayland typedef struct Core99MachineState { 8306fe3a5bSMark Cave-Ayland /*< private >*/ 8406fe3a5bSMark Cave-Ayland MachineState parent; 85f1114c17SMark Cave-Ayland 86f1114c17SMark Cave-Ayland uint8_t via_config; 8706fe3a5bSMark Cave-Ayland } Core99MachineState; 8806fe3a5bSMark Cave-Ayland 893cbee15bSj_mayer /* MacIO */ 9007a7484eSAndreas Färber #define TYPE_MACIO_IDE "macio-ide" 9107a7484eSAndreas Färber #define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) 9207a7484eSAndreas Färber 9307a7484eSAndreas Färber typedef struct MACIOIDEState { 9407a7484eSAndreas Färber /*< private >*/ 9507a7484eSAndreas Färber SysBusDevice parent_obj; 9607a7484eSAndreas Färber /*< public >*/ 970fc84331SMark Cave-Ayland uint32_t channel; 984f7265ffSBenjamin Herrenschmidt qemu_irq real_ide_irq; 994f7265ffSBenjamin Herrenschmidt qemu_irq real_dma_irq; 1004f7265ffSBenjamin Herrenschmidt qemu_irq ide_irq; 10107a7484eSAndreas Färber qemu_irq dma_irq; 10207a7484eSAndreas Färber 10307a7484eSAndreas Färber MemoryRegion mem; 10407a7484eSAndreas Färber IDEBus bus; 1054aa3510fSAlexander Graf IDEDMA dma; 1064aa3510fSAlexander Graf void *dbdma; 107cae32357SAlexander Graf bool dma_active; 1084f7265ffSBenjamin Herrenschmidt uint32_t timing_reg; 1094f7265ffSBenjamin Herrenschmidt uint32_t irq_reg; 11007a7484eSAndreas Färber } MACIOIDEState; 11107a7484eSAndreas Färber 11207a7484eSAndreas Färber void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); 113e451b85fSMark Cave-Ayland void macio_ide_register_dma(MACIOIDEState *ide); 11407a7484eSAndreas Färber 1153cbee15bSj_mayer /* Grackle PCI */ 1160e655047SAndreas Färber #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" 1173cbee15bSj_mayer 1183cbee15bSj_mayer /* Mac NVRAM */ 11995ed3b7cSAndreas Färber #define TYPE_MACIO_NVRAM "macio-nvram" 12095ed3b7cSAndreas Färber #define MACIO_NVRAM(obj) \ 12195ed3b7cSAndreas Färber OBJECT_CHECK(MacIONVRAMState, (obj), TYPE_MACIO_NVRAM) 1223cbee15bSj_mayer 12395ed3b7cSAndreas Färber typedef struct MacIONVRAMState { 12495ed3b7cSAndreas Färber /*< private >*/ 12595ed3b7cSAndreas Färber SysBusDevice parent_obj; 12695ed3b7cSAndreas Färber /*< public >*/ 12795ed3b7cSAndreas Färber 12895ed3b7cSAndreas Färber uint32_t size; 12995ed3b7cSAndreas Färber uint32_t it_shift; 13095ed3b7cSAndreas Färber 13195ed3b7cSAndreas Färber MemoryRegion mem; 13295ed3b7cSAndreas Färber uint8_t *data; 13395ed3b7cSAndreas Färber } MacIONVRAMState; 13495ed3b7cSAndreas Färber 1353cbee15bSj_mayer void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len); 1362a6a4076SMarkus Armbruster #endif /* PPC_MAC_H */ 137