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" 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" 37db1015e9SEduardo Habkost #include "qom/object.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") 75db1015e9SEduardo Habkost typedef struct Core99MachineState Core99MachineState; 7606fe3a5bSMark Cave-Ayland #define CORE99_MACHINE(obj) OBJECT_CHECK(Core99MachineState, (obj), \ 7706fe3a5bSMark Cave-Ayland TYPE_CORE99_MACHINE) 7806fe3a5bSMark Cave-Ayland 79f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_CUDA 0x0 80f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_PMU 0x1 81f1114c17SMark Cave-Ayland #define CORE99_VIA_CONFIG_PMU_ADB 0x2 82f1114c17SMark Cave-Ayland 83db1015e9SEduardo Habkost struct Core99MachineState { 8406fe3a5bSMark Cave-Ayland /*< private >*/ 8506fe3a5bSMark Cave-Ayland MachineState parent; 86f1114c17SMark Cave-Ayland 87f1114c17SMark Cave-Ayland uint8_t via_config; 88db1015e9SEduardo Habkost }; 8906fe3a5bSMark Cave-Ayland 903cbee15bSj_mayer /* Grackle PCI */ 910e655047SAndreas Färber #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" 923cbee15bSj_mayer 933cbee15bSj_mayer /* Mac NVRAM */ 9495ed3b7cSAndreas Färber #define TYPE_MACIO_NVRAM "macio-nvram" 95db1015e9SEduardo Habkost typedef struct MacIONVRAMState MacIONVRAMState; 9695ed3b7cSAndreas Färber #define MACIO_NVRAM(obj) \ 9795ed3b7cSAndreas Färber OBJECT_CHECK(MacIONVRAMState, (obj), TYPE_MACIO_NVRAM) 983cbee15bSj_mayer 99db1015e9SEduardo Habkost struct MacIONVRAMState { 10095ed3b7cSAndreas Färber /*< private >*/ 10195ed3b7cSAndreas Färber SysBusDevice parent_obj; 10295ed3b7cSAndreas Färber /*< public >*/ 10395ed3b7cSAndreas Färber 10495ed3b7cSAndreas Färber uint32_t size; 10595ed3b7cSAndreas Färber uint32_t it_shift; 10695ed3b7cSAndreas Färber 10795ed3b7cSAndreas Färber MemoryRegion mem; 10895ed3b7cSAndreas Färber uint8_t *data; 109db1015e9SEduardo Habkost }; 11095ed3b7cSAndreas Färber 1113cbee15bSj_mayer void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len); 1122a6a4076SMarkus Armbruster #endif /* PPC_MAC_H */ 113