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.11 2007/02/18 09:19:47 debug Exp $ |
29 |
* |
* |
30 |
* NOTE: Currently, these are skeletons for generic PowerMac G3, G4, and G5 |
* See also: |
31 |
* systems. They do not model real PowerMacs, but should be enough to |
* |
32 |
* begin experimenting with NetBSD/macppc and OpenBSD/macppc. |
* NetBSD/macppc (http://www.netbsd.org/Ports/macppc/) |
33 |
|
* OpenBSD/macppc (http://www.openbsd.org/macppc.html) |
34 |
|
* |
35 |
|
* Currently, these are skeletons for generic PowerMac G3, G4, and G5 systems. |
36 |
|
* They do not model real PowerMacs, but should be enough to begin |
37 |
|
* experimenting with running NetBSD/macppc and OpenBSD/macppc. |
38 |
*/ |
*/ |
39 |
|
|
40 |
#include <stdio.h> |
#include <stdio.h> |
41 |
|
#include <stdlib.h> |
42 |
#include <string.h> |
#include <string.h> |
43 |
|
|
44 |
#include "cpu.h" |
#include "cpu.h" |
45 |
#include "device.h" |
#include "device.h" |
46 |
#include "devices.h" |
#include "devices.h" |
47 |
#include "machine.h" |
#include "machine.h" |
|
#include "machine_interrupts.h" |
|
48 |
#include "memory.h" |
#include "memory.h" |
49 |
#include "misc.h" |
#include "misc.h" |
50 |
#include "of.h" |
#include "of.h" |
52 |
|
|
53 |
MACHINE_SETUP(macppc) |
MACHINE_SETUP(macppc) |
54 |
{ |
{ |
55 |
|
char tmpstr[300]; |
56 |
struct pci_data *pci_data; |
struct pci_data *pci_data; |
57 |
struct vfb_data *fb; |
struct vfb_data *fb; |
58 |
uint64_t b, a; |
uint64_t b, a; |
59 |
int i; |
int i; |
60 |
|
|
|
/* |
|
|
* NetBSD/macppc (http://www.netbsd.org/Ports/macppc/) |
|
|
* OpenBSD/macppc (http://www.openbsd.org/macppc.html) |
|
|
*/ |
|
61 |
machine->machine_name = "Macintosh (PPC)"; |
machine->machine_name = "Macintosh (PPC)"; |
62 |
if (machine->emulated_hz == 0) |
if (machine->emulated_hz == 0) |
63 |
machine->emulated_hz = 40000000; |
machine->emulated_hz = 40000000; |
64 |
|
|
65 |
machine->md_int.gc_data = dev_gc_init(machine, machine->memory, |
/* NetBSD/macppc works on the "G4" machine type: */ |
66 |
0xf3000000, 64); |
switch (machine->machine_subtype) { |
67 |
machine->md_interrupt = gc_interrupt; |
case MACHINE_MACPPC_G4: |
68 |
|
machine->stable = 1; |
69 |
|
} |
70 |
|
|
71 |
|
device_add(machine, "gc addr=0xf3000000"); |
72 |
|
|
73 |
pci_data = dev_uninorth_init(machine, machine->memory, 0xe2000000, |
pci_data = dev_uninorth_init(machine, machine->memory, 0xe2000000, |
74 |
64 /* isa irq base */, 0 /* pci irq: TODO */); |
64 /* isa irq base */, 0 /* pci irq: TODO */); |
75 |
|
|
76 |
bus_pci_add(machine, pci_data, machine->memory, 0, 12, 0, "dec21143"); |
/* bus_pci_add( |
77 |
|
machine, pci_data, machine->memory, 0, 12, 0, "dec21143"); */ |
78 |
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"); |
79 |
|
|
80 |
if (machine->use_x11) |
if (machine->use_x11) |
81 |
bus_pci_add(machine, pci_data, machine->memory, 0, 16, 0, |
bus_pci_add(machine, pci_data, machine->memory, 0, 16, 0, |
82 |
"ati_radeon_9200_2"); |
"ati_radeon_9200_2"); |
83 |
|
|
84 |
machine->main_console_handle = (size_t)device_add(machine, |
snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0xf3013000 irq=" |
85 |
"z8530 addr=0xf3013000 irq=23 dma_irq=8 addr_mult=0x10"); |
"%s.cpu[%i].gc.lo.23 addr_mult=0x10", |
86 |
|
machine->path, machine->bootstrap_cpu); |
87 |
|
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
88 |
|
|
89 |
fb = dev_fb_init(machine, machine->memory, 0xf1000000, |
fb = dev_fb_init(machine, machine->memory, 0xf1000000, |
90 |
VFB_GENERIC | VFB_REVERSE_START, 1024,768, 1024,768, 8, "ofb"); |
VFB_GENERIC | VFB_REVERSE_START, 1024,768, 1024,768, 8, "ofb"); |
91 |
|
|
92 |
device_add(machine, "hammerhead addr=0xf2800000"); |
device_add(machine, "hammerhead addr=0xf2800000"); |
93 |
|
|
94 |
device_add(machine, "adb addr=0xf3016000 irq=1"); |
snprintf(tmpstr, sizeof(tmpstr), "adb addr=0xf3016000 irq=" |
95 |
|
"%s.cpu[%i].gc.lo.1", machine->path, machine->bootstrap_cpu); |
96 |
|
device_add(machine, tmpstr); |
97 |
|
|
98 |
if (!machine->prom_emulation) |
if (!machine->prom_emulation) |
99 |
return; |
return; |
190 |
|
|
191 |
MACHINE_REGISTER(macppc) |
MACHINE_REGISTER(macppc) |
192 |
{ |
{ |
193 |
MR_DEFAULT(macppc, "Macintosh", ARCH_PPC, MACHINE_MACPPC, 1, 3); |
MR_DEFAULT(macppc, "Macintosh", ARCH_PPC, MACHINE_MACPPC); |
194 |
me->aliases[0] = "macppc"; |
|
195 |
me->subtype[0] = machine_entry_subtype_new("MacPPC G3", |
machine_entry_add_alias(me, "macppc"); |
196 |
MACHINE_MACPPC_G3, 1); |
|
197 |
me->subtype[0]->aliases[0] = "g3"; |
machine_entry_add_subtype(me, "MacPPC G3", MACHINE_MACPPC_G3, |
198 |
me->subtype[1] = machine_entry_subtype_new("MacPPC G4", |
"g3", NULL); |
199 |
MACHINE_MACPPC_G4, 1); |
|
200 |
me->subtype[1]->aliases[0] = "g4"; |
machine_entry_add_subtype(me, "MacPPC G4", MACHINE_MACPPC_G4, |
201 |
me->subtype[2] = machine_entry_subtype_new("MacPPC G5", |
"g4", NULL); |
202 |
MACHINE_MACPPC_G5, 1); |
|
203 |
me->subtype[2]->aliases[0] = "g5"; |
machine_entry_add_subtype(me, "MacPPC G5", MACHINE_MACPPC_G5, |
204 |
|
"g5", NULL); |
205 |
|
|
206 |
me->set_default_ram = machine_default_ram_macppc; |
me->set_default_ram = machine_default_ram_macppc; |
|
machine_entry_add(me, ARCH_PPC); |
|
207 |
} |
} |
208 |
|
|