Statistics
| Branch: | Revision:

root / hw / ppc_mac.h @ 098d314a

History | View | Annotate | Download (4.1 kB)

1 3cbee15b j_mayer
/*
2 3cbee15b j_mayer
 * QEMU PowerMac emulation shared definitions and prototypes
3 3cbee15b j_mayer
 *
4 3cbee15b j_mayer
 * Copyright (c) 2004-2007 Fabrice Bellard
5 3cbee15b j_mayer
 * Copyright (c) 2007 Jocelyn Mayer
6 3cbee15b j_mayer
 *
7 3cbee15b j_mayer
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 3cbee15b j_mayer
 * of this software and associated documentation files (the "Software"), to deal
9 3cbee15b j_mayer
 * in the Software without restriction, including without limitation the rights
10 3cbee15b j_mayer
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 3cbee15b j_mayer
 * copies of the Software, and to permit persons to whom the Software is
12 3cbee15b j_mayer
 * furnished to do so, subject to the following conditions:
13 3cbee15b j_mayer
 *
14 3cbee15b j_mayer
 * The above copyright notice and this permission notice shall be included in
15 3cbee15b j_mayer
 * all copies or substantial portions of the Software.
16 3cbee15b j_mayer
 *
17 3cbee15b j_mayer
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 3cbee15b j_mayer
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 3cbee15b j_mayer
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 3cbee15b j_mayer
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 3cbee15b j_mayer
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 3cbee15b j_mayer
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 3cbee15b j_mayer
 * THE SOFTWARE.
24 3cbee15b j_mayer
 */
25 3cbee15b j_mayer
#if !defined(__PPC_MAC_H__)
26 3cbee15b j_mayer
#define __PPC_MAC_H__
27 3cbee15b j_mayer
28 1e39101c Avi Kivity
#include "memory.h"
29 1e39101c Avi Kivity
30 3cbee15b j_mayer
/* SMP is not enabled, for now */
31 3cbee15b j_mayer
#define MAX_CPUS 1
32 3cbee15b j_mayer
33 bba831e8 Paul Brook
#define BIOS_SIZE     (1024 * 1024)
34 3cbee15b j_mayer
#define BIOS_FILENAME "ppc_rom.bin"
35 3cbee15b j_mayer
#define NVRAM_SIZE        0x2000
36 e5d01b06 aurel32
#define PROM_FILENAME    "openbios-ppc"
37 992e5acd blueswir1
#define PROM_ADDR         0xfff00000
38 3cbee15b j_mayer
39 3cbee15b j_mayer
#define KERNEL_LOAD_ADDR 0x01000000
40 b9e17a34 Alexander Graf
#define KERNEL_GAP       0x00100000
41 3cbee15b j_mayer
42 7fa9ae1a blueswir1
#define ESCC_CLOCK 3686400
43 7fa9ae1a blueswir1
44 3cbee15b j_mayer
/* Cuda */
45 23c5e4ca Avi Kivity
void cuda_init (MemoryRegion **cuda_mem, qemu_irq irq);
46 3cbee15b j_mayer
47 3cbee15b j_mayer
/* MacIO */
48 23c5e4ca Avi Kivity
void macio_init (PCIBus *bus, int device_id, int is_oldworld,
49 23c5e4ca Avi Kivity
                 MemoryRegion *pic_mem, MemoryRegion *dbdma_mem,
50 23c5e4ca Avi Kivity
                 MemoryRegion *cuda_mem, void *nvram,
51 23c5e4ca Avi Kivity
                 int nb_ide, MemoryRegion **ide_mem, MemoryRegion *escc_mem);
52 3cbee15b j_mayer
53 3cbee15b j_mayer
/* Heathrow PIC */
54 23c5e4ca Avi Kivity
qemu_irq *heathrow_pic_init(MemoryRegion **pmem,
55 3cbee15b j_mayer
                            int nb_cpus, qemu_irq **irqs);
56 3cbee15b j_mayer
57 3cbee15b j_mayer
/* Grackle PCI */
58 1e39101c Avi Kivity
PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic,
59 aee97b84 Avi Kivity
                         MemoryRegion *address_space_mem,
60 aee97b84 Avi Kivity
                         MemoryRegion *address_space_io);
61 3cbee15b j_mayer
62 3cbee15b j_mayer
/* UniNorth PCI */
63 aee97b84 Avi Kivity
PCIBus *pci_pmac_init(qemu_irq *pic,
64 aee97b84 Avi Kivity
                      MemoryRegion *address_space_mem,
65 aee97b84 Avi Kivity
                      MemoryRegion *address_space_io);
66 aee97b84 Avi Kivity
PCIBus *pci_pmac_u3_init(qemu_irq *pic,
67 aee97b84 Avi Kivity
                         MemoryRegion *address_space_mem,
68 aee97b84 Avi Kivity
                         MemoryRegion *address_space_io);
69 3cbee15b j_mayer
70 3cbee15b j_mayer
/* Mac NVRAM */
71 3cbee15b j_mayer
typedef struct MacIONVRAMState MacIONVRAMState;
72 3cbee15b j_mayer
73 23c5e4ca Avi Kivity
MacIONVRAMState *macio_nvram_init (target_phys_addr_t size,
74 68af3f24 blueswir1
                                   unsigned int it_shift);
75 23c5e4ca Avi Kivity
void macio_nvram_setup_bar(MacIONVRAMState *s, MemoryRegion *bar,
76 23c5e4ca Avi Kivity
                           target_phys_addr_t mem_base);
77 3cbee15b j_mayer
void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len);
78 3cbee15b j_mayer
uint32_t macio_nvram_read (void *opaque, uint32_t addr);
79 3cbee15b j_mayer
void macio_nvram_write (void *opaque, uint32_t addr, uint32_t val);
80 3cbee15b j_mayer
81 87ecb68b pbrook
/* adb.c */
82 87ecb68b pbrook
83 87ecb68b pbrook
#define MAX_ADB_DEVICES 16
84 87ecb68b pbrook
85 87ecb68b pbrook
#define ADB_MAX_OUT_LEN 16
86 87ecb68b pbrook
87 87ecb68b pbrook
typedef struct ADBDevice ADBDevice;
88 87ecb68b pbrook
89 87ecb68b pbrook
/* buf = NULL means polling */
90 87ecb68b pbrook
typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out,
91 87ecb68b pbrook
                              const uint8_t *buf, int len);
92 87ecb68b pbrook
typedef int ADBDeviceReset(ADBDevice *d);
93 87ecb68b pbrook
94 87ecb68b pbrook
struct ADBDevice {
95 87ecb68b pbrook
    struct ADBBusState *bus;
96 87ecb68b pbrook
    int devaddr;
97 87ecb68b pbrook
    int handler;
98 87ecb68b pbrook
    ADBDeviceRequest *devreq;
99 87ecb68b pbrook
    ADBDeviceReset *devreset;
100 87ecb68b pbrook
    void *opaque;
101 87ecb68b pbrook
};
102 87ecb68b pbrook
103 87ecb68b pbrook
typedef struct ADBBusState {
104 87ecb68b pbrook
    ADBDevice devices[MAX_ADB_DEVICES];
105 87ecb68b pbrook
    int nb_devices;
106 87ecb68b pbrook
    int poll_index;
107 87ecb68b pbrook
} ADBBusState;
108 87ecb68b pbrook
109 87ecb68b pbrook
int adb_request(ADBBusState *s, uint8_t *buf_out,
110 87ecb68b pbrook
                const uint8_t *buf, int len);
111 87ecb68b pbrook
int adb_poll(ADBBusState *s, uint8_t *buf_out);
112 87ecb68b pbrook
113 87ecb68b pbrook
ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
114 87ecb68b pbrook
                               ADBDeviceRequest *devreq,
115 87ecb68b pbrook
                               ADBDeviceReset *devreset,
116 87ecb68b pbrook
                               void *opaque);
117 87ecb68b pbrook
void adb_kbd_init(ADBBusState *bus);
118 87ecb68b pbrook
void adb_mouse_init(ADBBusState *bus);
119 87ecb68b pbrook
120 87ecb68b pbrook
extern ADBBusState adb_bus;
121 87ecb68b pbrook
122 3cbee15b j_mayer
#endif /* !defined(__PPC_MAC_H__) */