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" 3095ed3b7cSAndreas Färber #include "hw/sysbus.h" 3107a7484eSAndreas Färber #include "hw/ide/internal.h" 320d09e41aSPaolo Bonzini #include "hw/input/adb.h" 3309a57347SMark Cave-Ayland #include "hw/misc/mos6522.h" 340f4b5415SMark Cave-Ayland #include "hw/pci/pci_host.h" 350f4b5415SMark Cave-Ayland #include "hw/pci-host/uninorth.h" 361e39101cSAvi Kivity 373cbee15bSj_mayer /* SMP is not enabled, for now */ 383cbee15bSj_mayer #define MAX_CPUS 1 393cbee15bSj_mayer 40bba831e8SPaul Brook #define BIOS_SIZE (1024 * 1024) 413cbee15bSj_mayer #define NVRAM_SIZE 0x2000 42e5d01b06Saurel32 #define PROM_FILENAME "openbios-ppc" 43992e5acdSblueswir1 #define PROM_ADDR 0xfff00000 443cbee15bSj_mayer 453cbee15bSj_mayer #define KERNEL_LOAD_ADDR 0x01000000 46b9e17a34SAlexander Graf #define KERNEL_GAP 0x00100000 473cbee15bSj_mayer 487fa9ae1aSblueswir1 #define ESCC_CLOCK 3686400 497fa9ae1aSblueswir1 50ab1244b5SMark Cave-Ayland /* Old World IRQs */ 51ab1244b5SMark Cave-Ayland #define OLDWORLD_CUDA_IRQ 0x12 52ab1244b5SMark Cave-Ayland #define OLDWORLD_ESCCB_IRQ 0x10 53ab1244b5SMark Cave-Ayland #define OLDWORLD_ESCCA_IRQ 0xf 54ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE0_IRQ 0xd 55ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE0_DMA_IRQ 0x2 56ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE1_IRQ 0xe 57ab1244b5SMark Cave-Ayland #define OLDWORLD_IDE1_DMA_IRQ 0x3 5809a57347SMark Cave-Ayland 593cbee15bSj_mayer /* MacIO */ 6007a7484eSAndreas Färber #define TYPE_MACIO_IDE "macio-ide" 6107a7484eSAndreas Färber #define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) 6207a7484eSAndreas Färber 6307a7484eSAndreas Färber typedef struct MACIOIDEState { 6407a7484eSAndreas Färber /*< private >*/ 6507a7484eSAndreas Färber SysBusDevice parent_obj; 6607a7484eSAndreas Färber /*< public >*/ 670fc84331SMark Cave-Ayland uint32_t channel; 684f7265ffSBenjamin Herrenschmidt qemu_irq real_ide_irq; 694f7265ffSBenjamin Herrenschmidt qemu_irq real_dma_irq; 704f7265ffSBenjamin Herrenschmidt qemu_irq ide_irq; 7107a7484eSAndreas Färber qemu_irq dma_irq; 7207a7484eSAndreas Färber 7307a7484eSAndreas Färber MemoryRegion mem; 7407a7484eSAndreas Färber IDEBus bus; 754aa3510fSAlexander Graf IDEDMA dma; 764aa3510fSAlexander Graf void *dbdma; 77cae32357SAlexander Graf bool dma_active; 784f7265ffSBenjamin Herrenschmidt uint32_t timing_reg; 794f7265ffSBenjamin Herrenschmidt uint32_t irq_reg; 8007a7484eSAndreas Färber } MACIOIDEState; 8107a7484eSAndreas Färber 8207a7484eSAndreas Färber void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); 83e451b85fSMark Cave-Ayland void macio_ide_register_dma(MACIOIDEState *ide); 8407a7484eSAndreas Färber 85d037834aSAndreas Färber void macio_init(PCIDevice *dev, 86343bd85aSMark Cave-Ayland MemoryRegion *pic_mem); 873cbee15bSj_mayer 883cbee15bSj_mayer /* Grackle PCI */ 890e655047SAndreas Färber #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" 903cbee15bSj_mayer 913cbee15bSj_mayer /* UniNorth PCI */ 920f4b5415SMark Cave-Ayland UNINState *pci_pmac_init(qemu_irq *pic, 93aee97b84SAvi Kivity MemoryRegion *address_space_mem, 94aee97b84SAvi Kivity MemoryRegion *address_space_io); 950f4b5415SMark Cave-Ayland UNINState *pci_pmac_u3_init(qemu_irq *pic, 96aee97b84SAvi Kivity MemoryRegion *address_space_mem, 97aee97b84SAvi Kivity MemoryRegion *address_space_io); 983cbee15bSj_mayer 993cbee15bSj_mayer /* Mac NVRAM */ 10095ed3b7cSAndreas Färber #define TYPE_MACIO_NVRAM "macio-nvram" 10195ed3b7cSAndreas Färber #define MACIO_NVRAM(obj) \ 10295ed3b7cSAndreas Färber OBJECT_CHECK(MacIONVRAMState, (obj), TYPE_MACIO_NVRAM) 1033cbee15bSj_mayer 10495ed3b7cSAndreas Färber typedef struct MacIONVRAMState { 10595ed3b7cSAndreas Färber /*< private >*/ 10695ed3b7cSAndreas Färber SysBusDevice parent_obj; 10795ed3b7cSAndreas Färber /*< public >*/ 10895ed3b7cSAndreas Färber 10995ed3b7cSAndreas Färber uint32_t size; 11095ed3b7cSAndreas Färber uint32_t it_shift; 11195ed3b7cSAndreas Färber 11295ed3b7cSAndreas Färber MemoryRegion mem; 11395ed3b7cSAndreas Färber uint8_t *data; 11495ed3b7cSAndreas Färber } MacIONVRAMState; 11595ed3b7cSAndreas Färber 1163cbee15bSj_mayer void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len); 1172a6a4076SMarkus Armbruster #endif /* PPC_MAC_H */ 118