1 |
/* |
/* |
2 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2007 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine_macppc.c,v 1.4 2006/03/24 05:53:17 debug Exp $ |
* $Id: machine_macppc.c,v 1.16 2007/06/15 18:08:10 debug Exp $ |
29 |
* |
* |
30 |
* NOTE: Currently, these are skeletons for generic PowerMac G3, G4, and G5 |
* COMMENT: Generic PowerPC-based Macintosh machines |
31 |
* systems. They do not model real PowerMacs, but should be enough to |
* |
32 |
* begin experimenting with NetBSD/macppc and OpenBSD/macppc. |
* See also: |
33 |
|
* |
34 |
|
* NetBSD/macppc (http://www.netbsd.org/ports/macppc/) |
35 |
|
* OpenBSD/macppc (http://www.openbsd.org/macppc.html) |
36 |
|
* |
37 |
|
* Currently, these are skeletons for generic PowerMac G3, G4, and G5 systems. |
38 |
|
* They do not model real PowerMacs, but should be enough to begin |
39 |
|
* experimenting with running NetBSD/macppc and OpenBSD/macppc. |
40 |
*/ |
*/ |
41 |
|
|
42 |
#include <stdio.h> |
#include <stdio.h> |
43 |
|
#include <stdlib.h> |
44 |
#include <string.h> |
#include <string.h> |
45 |
|
|
46 |
|
#include "bus_pci.h" |
47 |
#include "cpu.h" |
#include "cpu.h" |
48 |
#include "device.h" |
#include "device.h" |
49 |
#include "devices.h" |
#include "devices.h" |
50 |
#include "machine.h" |
#include "machine.h" |
|
#include "machine_interrupts.h" |
|
51 |
#include "memory.h" |
#include "memory.h" |
52 |
#include "misc.h" |
#include "misc.h" |
53 |
#include "of.h" |
#include "of.h" |
55 |
|
|
56 |
MACHINE_SETUP(macppc) |
MACHINE_SETUP(macppc) |
57 |
{ |
{ |
58 |
|
char tmpstr[300]; |
59 |
struct pci_data *pci_data; |
struct pci_data *pci_data; |
60 |
struct vfb_data *fb; |
struct vfb_data *fb; |
61 |
uint64_t b, a; |
uint64_t b, a; |
62 |
int i; |
int i; |
63 |
|
|
|
/* |
|
|
* NetBSD/macppc (http://www.netbsd.org/Ports/macppc/) |
|
|
* OpenBSD/macppc (http://www.openbsd.org/macppc.html) |
|
|
*/ |
|
64 |
machine->machine_name = "Macintosh (PPC)"; |
machine->machine_name = "Macintosh (PPC)"; |
65 |
if (machine->emulated_hz == 0) |
if (machine->emulated_hz == 0) |
66 |
machine->emulated_hz = 40000000; |
machine->emulated_hz = 40000000; |
67 |
|
|
68 |
machine->md_int.gc_data = dev_gc_init(machine, machine->memory, |
device_add(machine, "gc addr=0xf3000000"); |
|
0xf3000000, 64); |
|
|
machine->md_interrupt = gc_interrupt; |
|
69 |
|
|
70 |
pci_data = dev_uninorth_init(machine, machine->memory, 0xe2000000, |
pci_data = dev_uninorth_init(machine, machine->memory, 0xe2000000, |
71 |
64 /* isa irq base */, 0 /* pci irq: TODO */); |
64 /* isa irq base */, 0 /* pci irq: TODO */); |
72 |
|
|
73 |
bus_pci_add(machine, pci_data, machine->memory, 0, 12, 0, "dec21143"); |
/* bus_pci_add( |
74 |
|
machine, pci_data, machine->memory, 0, 12, 0, "dec21143"); */ |
75 |
bus_pci_add(machine, pci_data, machine->memory, 0, 15, 0, "gc_obio"); |
bus_pci_add(machine, pci_data, machine->memory, 0, 15, 0, "gc_obio"); |
76 |
|
|
77 |
if (machine->use_x11) |
if (machine->x11_md.in_use) |
78 |
bus_pci_add(machine, pci_data, machine->memory, 0, 16, 0, |
bus_pci_add(machine, pci_data, machine->memory, 0, 16, 0, |
79 |
"ati_radeon_9200_2"); |
"ati_radeon_9200_2"); |
80 |
|
|
81 |
machine->main_console_handle = (size_t)device_add(machine, |
snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0xf3013000 irq=" |
82 |
"z8530 addr=0xf3013000 irq=23 dma_irq=8 addr_mult=0x10"); |
"%s.cpu[%i].gc.lo.23 addr_mult=0x10", |
83 |
|
machine->path, machine->bootstrap_cpu); |
84 |
|
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
85 |
|
|
86 |
fb = dev_fb_init(machine, machine->memory, 0xf1000000, |
fb = dev_fb_init(machine, machine->memory, 0xf1000000, |
87 |
VFB_GENERIC | VFB_REVERSE_START, 1024,768, 1024,768, 8, "ofb"); |
VFB_GENERIC | VFB_REVERSE_START, 1024,768, 1024,768, 8, "ofb"); |
88 |
|
|
89 |
device_add(machine, "hammerhead addr=0xf2800000"); |
device_add(machine, "hammerhead addr=0xf2800000"); |
90 |
|
|
91 |
device_add(machine, "adb addr=0xf3016000 irq=1"); |
snprintf(tmpstr, sizeof(tmpstr), "adb addr=0xf3016000 irq=" |
92 |
|
"%s.cpu[%i].gc.lo.1", machine->path, machine->bootstrap_cpu); |
93 |
|
device_add(machine, tmpstr); |
94 |
|
|
95 |
if (!machine->prom_emulation) |
if (!machine->prom_emulation) |
96 |
return; |
return; |
101 |
of_emul_init(machine, fb, 0xf1000000, 1024, 768); |
of_emul_init(machine, fb, 0xf1000000, 1024, 768); |
102 |
of_emul_init_uninorth(machine); |
of_emul_init_uninorth(machine); |
103 |
|
|
104 |
if (machine->use_x11) |
if (machine->x11_md.in_use) |
105 |
of_emul_init_adb(machine); |
of_emul_init_adb(machine); |
106 |
else |
else |
107 |
of_emul_init_zs(machine); |
of_emul_init_zs(machine); |
187 |
|
|
188 |
MACHINE_REGISTER(macppc) |
MACHINE_REGISTER(macppc) |
189 |
{ |
{ |
190 |
MR_DEFAULT(macppc, "Macintosh", ARCH_PPC, MACHINE_MACPPC, 1, 3); |
MR_DEFAULT(macppc, "Macintosh", ARCH_PPC, MACHINE_MACPPC); |
191 |
me->aliases[0] = "macppc"; |
|
192 |
me->subtype[0] = machine_entry_subtype_new("MacPPC G3", |
machine_entry_add_alias(me, "macppc"); |
193 |
MACHINE_MACPPC_G3, 1); |
|
194 |
me->subtype[0]->aliases[0] = "g3"; |
machine_entry_add_subtype(me, "MacPPC G3", MACHINE_MACPPC_G3, |
195 |
me->subtype[1] = machine_entry_subtype_new("MacPPC G4", |
"g3", NULL); |
196 |
MACHINE_MACPPC_G4, 1); |
|
197 |
me->subtype[1]->aliases[0] = "g4"; |
machine_entry_add_subtype(me, "MacPPC G4", MACHINE_MACPPC_G4, |
198 |
me->subtype[2] = machine_entry_subtype_new("MacPPC G5", |
"g4", NULL); |
199 |
MACHINE_MACPPC_G5, 1); |
|
200 |
me->subtype[2]->aliases[0] = "g5"; |
machine_entry_add_subtype(me, "MacPPC G5", MACHINE_MACPPC_G5, |
201 |
|
"g5", NULL); |
202 |
|
|
203 |
me->set_default_ram = machine_default_ram_macppc; |
me->set_default_ram = machine_default_ram_macppc; |
|
machine_entry_add(me, ARCH_PPC); |
|
204 |
} |
} |
205 |
|
|