xref: /qemu/include/hw/nvram/mac_nvram.h (revision 0f4b5415c31ed1fee02f5826fe0d2d585806fa95)
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 
5009a57347SMark Cave-Ayland 
513cbee15bSj_mayer /* MacIO */
5207a7484eSAndreas Färber #define TYPE_MACIO_IDE "macio-ide"
5307a7484eSAndreas Färber #define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE)
5407a7484eSAndreas Färber 
5507a7484eSAndreas Färber typedef struct MACIOIDEState {
5607a7484eSAndreas Färber     /*< private >*/
5707a7484eSAndreas Färber     SysBusDevice parent_obj;
5807a7484eSAndreas Färber     /*< public >*/
590fc84331SMark Cave-Ayland     uint32_t channel;
604f7265ffSBenjamin Herrenschmidt     qemu_irq real_ide_irq;
614f7265ffSBenjamin Herrenschmidt     qemu_irq real_dma_irq;
624f7265ffSBenjamin Herrenschmidt     qemu_irq ide_irq;
6307a7484eSAndreas Färber     qemu_irq dma_irq;
6407a7484eSAndreas Färber 
6507a7484eSAndreas Färber     MemoryRegion mem;
6607a7484eSAndreas Färber     IDEBus bus;
674aa3510fSAlexander Graf     IDEDMA dma;
684aa3510fSAlexander Graf     void *dbdma;
69cae32357SAlexander Graf     bool dma_active;
704f7265ffSBenjamin Herrenschmidt     uint32_t timing_reg;
714f7265ffSBenjamin Herrenschmidt     uint32_t irq_reg;
7207a7484eSAndreas Färber } MACIOIDEState;
7307a7484eSAndreas Färber 
7407a7484eSAndreas Färber void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table);
75e451b85fSMark Cave-Ayland void macio_ide_register_dma(MACIOIDEState *ide);
7607a7484eSAndreas Färber 
77d037834aSAndreas Färber void macio_init(PCIDevice *dev,
78343bd85aSMark Cave-Ayland                 MemoryRegion *pic_mem);
793cbee15bSj_mayer 
803cbee15bSj_mayer /* Heathrow PIC */
81c2964600SMark Cave-Ayland DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs,
82c2964600SMark Cave-Ayland                                qemu_irq **pic_irqs);
833cbee15bSj_mayer 
843cbee15bSj_mayer /* Grackle PCI */
850e655047SAndreas Färber #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
861e39101cSAvi Kivity PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic,
87aee97b84SAvi Kivity                          MemoryRegion *address_space_mem,
88aee97b84SAvi Kivity                          MemoryRegion *address_space_io);
893cbee15bSj_mayer 
903cbee15bSj_mayer /* UniNorth PCI */
910f4b5415SMark Cave-Ayland UNINState *pci_pmac_init(qemu_irq *pic,
92aee97b84SAvi Kivity                          MemoryRegion *address_space_mem,
93aee97b84SAvi Kivity                          MemoryRegion *address_space_io);
940f4b5415SMark Cave-Ayland UNINState *pci_pmac_u3_init(qemu_irq *pic,
95aee97b84SAvi Kivity                             MemoryRegion *address_space_mem,
96aee97b84SAvi Kivity                             MemoryRegion *address_space_io);
973cbee15bSj_mayer 
983cbee15bSj_mayer /* Mac NVRAM */
9995ed3b7cSAndreas Färber #define TYPE_MACIO_NVRAM "macio-nvram"
10095ed3b7cSAndreas Färber #define MACIO_NVRAM(obj) \
10195ed3b7cSAndreas Färber     OBJECT_CHECK(MacIONVRAMState, (obj), TYPE_MACIO_NVRAM)
1023cbee15bSj_mayer 
10395ed3b7cSAndreas Färber typedef struct MacIONVRAMState {
10495ed3b7cSAndreas Färber     /*< private >*/
10595ed3b7cSAndreas Färber     SysBusDevice parent_obj;
10695ed3b7cSAndreas Färber     /*< public >*/
10795ed3b7cSAndreas Färber 
10895ed3b7cSAndreas Färber     uint32_t size;
10995ed3b7cSAndreas Färber     uint32_t it_shift;
11095ed3b7cSAndreas Färber 
11195ed3b7cSAndreas Färber     MemoryRegion mem;
11295ed3b7cSAndreas Färber     uint8_t *data;
11395ed3b7cSAndreas Färber } MacIONVRAMState;
11495ed3b7cSAndreas Färber 
1153cbee15bSj_mayer void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len);
1162a6a4076SMarkus Armbruster #endif /* PPC_MAC_H */
117