mirror of https://github.com/xemu-project/xemu.git
qemu-macppc updates for 7.2
-----BEGIN PGP SIGNATURE----- iQFSBAABCgA8FiEEzGIauY6CIA2RXMnEW8LFb64PMh8FAmNgIqAeHG1hcmsuY2F2 ZS1heWxhbmRAaWxhbmRlLmNvLnVrAAoJEFvCxW+uDzIfWU0H/iG6k04L9jrKJ4ao wA/CQlvRxG+gRSj1I5oeuLJEqoMSzU5d5flQNPpfv068wngIS/0gHM7UNRGDAOIj 8Gu6lf+eB0lwOlmF0Gq2o9/RV6ZWEZtziX3s7G6CYQK0tkQsKZBD36P3Mssr3pWt 2XX44eV1qULreFEHWT6I97zV9gFTEuHXJ3j8YDuz7fpqW1B38WUq1TOftiMi9JP4 PEVhfTOwi6MhsrRpt2uouGPLhmANLucvaXgKgMFRHyy0xOlzYKxjKXbq6nbAFSRd 8xEbnLaMWHUKtsmsxtjPJnCV9obO7YzPLXJBLbg2CxhEc/ktDC7YjKL5EXLT2mHC s7kVfyM= =rc9K -----END PGP SIGNATURE----- Merge tag 'qemu-macppc-20221031' of https://github.com/mcayland/qemu into staging qemu-macppc updates for 7.2 # -----BEGIN PGP SIGNATURE----- # # iQFSBAABCgA8FiEEzGIauY6CIA2RXMnEW8LFb64PMh8FAmNgIqAeHG1hcmsuY2F2 # ZS1heWxhbmRAaWxhbmRlLmNvLnVrAAoJEFvCxW+uDzIfWU0H/iG6k04L9jrKJ4ao # wA/CQlvRxG+gRSj1I5oeuLJEqoMSzU5d5flQNPpfv068wngIS/0gHM7UNRGDAOIj # 8Gu6lf+eB0lwOlmF0Gq2o9/RV6ZWEZtziX3s7G6CYQK0tkQsKZBD36P3Mssr3pWt # 2XX44eV1qULreFEHWT6I97zV9gFTEuHXJ3j8YDuz7fpqW1B38WUq1TOftiMi9JP4 # PEVhfTOwi6MhsrRpt2uouGPLhmANLucvaXgKgMFRHyy0xOlzYKxjKXbq6nbAFSRd # 8xEbnLaMWHUKtsmsxtjPJnCV9obO7YzPLXJBLbg2CxhEc/ktDC7YjKL5EXLT2mHC # s7kVfyM= # =rc9K # -----END PGP SIGNATURE----- # gpg: Signature made Mon 31 Oct 2022 15:31:44 EDT # gpg: using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F # gpg: issuer "mark.cave-ayland@ilande.co.uk" # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full] # Primary key fingerprint: CC62 1AB9 8E82 200D 915C C9C4 5BC2 C56F AE0F 321F * tag 'qemu-macppc-20221031' of https://github.com/mcayland/qemu: mac_newworld: Turn CORE99_VIA_CONFIG defines into an enum mac_{old|new}world: Code style fix adding missing braces to if-s mac_nvram: Use NVRAM_SIZE constant hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h hw/ppc/mac.h: Move PROM and KERNEL defines to board code hw/ppc/mac.h: Move grackle-pcihost type declaration out to a header hw/ppc/mac.h: Move macio specific parts out from shared header hw/ppc/mac.h: Move newworld specific parts out from shared header mac_{old|new}world: Reduce number of QOM casts mac_newworld: Clean up creation of Uninorth devices mac_{old|new}world: Avoid else branch by setting default value mac_{old|new}world: Set tbfreq at declaration mac_oldworld: Drop some more variables mac_newworld: Drop some variables Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
7ef1d48763
|
@ -1327,6 +1327,7 @@ F: hw/nvram/mac_nvram.c
|
|||
F: hw/input/adb*
|
||||
F: include/hw/misc/macio/
|
||||
F: include/hw/misc/mos6522.h
|
||||
F: include/hw/nvram/mac_nvram.h
|
||||
F: include/hw/ppc/mac_dbdma.h
|
||||
F: include/hw/pci-host/uninorth.h
|
||||
F: include/hw/input/adb*
|
||||
|
@ -1344,6 +1345,7 @@ F: hw/intc/heathrow_pic.c
|
|||
F: hw/input/adb*
|
||||
F: include/hw/intc/heathrow_pic.h
|
||||
F: include/hw/input/adb*
|
||||
F: include/hw/pci-host/grackle.h
|
||||
F: pc-bios/qemu_vga.ndrv
|
||||
|
||||
PReP
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/ppc/mac_dbdma.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/module.h"
|
||||
#include "hw/intc/heathrow_pic.h"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/ppc/openpic.h"
|
||||
#include "hw/ppc/ppc_e500.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "hw/input/adb.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "hw/misc/macio/macio.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/module.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/misc/macio/cuda.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/ppc/mac_dbdma.h"
|
||||
|
@ -37,8 +36,9 @@
|
|||
#include "hw/intc/heathrow_pic.h"
|
||||
#include "trace.h"
|
||||
|
||||
/* Note: this code is strongly inspirated from the corresponding code
|
||||
* in PearPC */
|
||||
#define ESCC_CLOCK 3686400
|
||||
|
||||
/* Note: this code is strongly inspired by the corresponding code in PearPC */
|
||||
|
||||
/*
|
||||
* The mac-io has two interfaces to the ESCC. One is called "escc-legacy",
|
||||
|
@ -226,7 +226,7 @@ static void macio_oldworld_init(Object *obj)
|
|||
|
||||
object_initialize_child(OBJECT(s), "nvram", &os->nvram, TYPE_MACIO_NVRAM);
|
||||
dev = DEVICE(&os->nvram);
|
||||
qdev_prop_set_uint32(dev, "size", 0x2000);
|
||||
qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 4);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "hw/input/adb.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/nvram/chrp_nvram.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/nvram/mac_nvram.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/pci/pci_host.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/irq.h"
|
||||
|
@ -33,18 +31,7 @@
|
|||
#include "qemu/module.h"
|
||||
#include "trace.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(GrackleState, GRACKLE_PCI_HOST_BRIDGE)
|
||||
|
||||
struct GrackleState {
|
||||
PCIHostState parent_obj;
|
||||
|
||||
uint32_t ofw_addr;
|
||||
qemu_irq irqs[4];
|
||||
MemoryRegion pci_mmio;
|
||||
MemoryRegion pci_hole;
|
||||
MemoryRegion pci_io;
|
||||
};
|
||||
#include "hw/pci-host/grackle.h"
|
||||
|
||||
/* Don't know if this matches real hardware, but it agrees with OHW. */
|
||||
static int pci_grackle_map_irq(PCIDevice *pci_dev, int irq_num)
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "qemu/module.h"
|
||||
#include "hw/pci/pci.h"
|
||||
|
|
105
hw/ppc/mac.h
105
hw/ppc/mac.h
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* QEMU PowerMac emulation shared definitions and prototypes
|
||||
*
|
||||
* Copyright (c) 2004-2007 Fabrice Bellard
|
||||
* Copyright (c) 2007 Jocelyn Mayer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PPC_MAC_H
|
||||
#define PPC_MAC_H
|
||||
|
||||
#include "qemu/units.h"
|
||||
#include "exec/memory.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "hw/pci/pci_host.h"
|
||||
#include "hw/pci-host/uninorth.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define NVRAM_SIZE 0x2000
|
||||
#define PROM_FILENAME "openbios-ppc"
|
||||
|
||||
#define KERNEL_LOAD_ADDR 0x01000000
|
||||
#define KERNEL_GAP 0x00100000
|
||||
|
||||
#define ESCC_CLOCK 3686400
|
||||
|
||||
/* Old World IRQs */
|
||||
#define OLDWORLD_CUDA_IRQ 0x12
|
||||
#define OLDWORLD_ESCCB_IRQ 0x10
|
||||
#define OLDWORLD_ESCCA_IRQ 0xf
|
||||
#define OLDWORLD_IDE0_IRQ 0xd
|
||||
#define OLDWORLD_IDE0_DMA_IRQ 0x2
|
||||
#define OLDWORLD_IDE1_IRQ 0xe
|
||||
#define OLDWORLD_IDE1_DMA_IRQ 0x3
|
||||
|
||||
/* New World IRQs */
|
||||
#define NEWWORLD_CUDA_IRQ 0x19
|
||||
#define NEWWORLD_PMU_IRQ 0x19
|
||||
#define NEWWORLD_ESCCB_IRQ 0x24
|
||||
#define NEWWORLD_ESCCA_IRQ 0x25
|
||||
#define NEWWORLD_IDE0_IRQ 0xd
|
||||
#define NEWWORLD_IDE0_DMA_IRQ 0x2
|
||||
#define NEWWORLD_IDE1_IRQ 0xe
|
||||
#define NEWWORLD_IDE1_DMA_IRQ 0x3
|
||||
#define NEWWORLD_EXTING_GPIO1 0x2f
|
||||
#define NEWWORLD_EXTING_GPIO9 0x37
|
||||
|
||||
/* Core99 machine */
|
||||
#define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99")
|
||||
typedef struct Core99MachineState Core99MachineState;
|
||||
DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE,
|
||||
TYPE_CORE99_MACHINE)
|
||||
|
||||
#define CORE99_VIA_CONFIG_CUDA 0x0
|
||||
#define CORE99_VIA_CONFIG_PMU 0x1
|
||||
#define CORE99_VIA_CONFIG_PMU_ADB 0x2
|
||||
|
||||
struct Core99MachineState {
|
||||
/*< private >*/
|
||||
MachineState parent;
|
||||
|
||||
uint8_t via_config;
|
||||
};
|
||||
|
||||
/* Grackle PCI */
|
||||
#define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
|
||||
|
||||
/* Mac NVRAM */
|
||||
#define TYPE_MACIO_NVRAM "macio-nvram"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM)
|
||||
|
||||
struct MacIONVRAMState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
/*< public >*/
|
||||
|
||||
uint32_t size;
|
||||
uint32_t it_shift;
|
||||
|
||||
MemoryRegion mem;
|
||||
uint8_t *data;
|
||||
};
|
||||
|
||||
void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len);
|
||||
#endif /* PPC_MAC_H */
|
|
@ -48,10 +48,13 @@
|
|||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/datadir.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/ppc/ppc.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/nvram/mac_nvram.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/pci-host/uninorth.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/ppc/mac_dbdma.h"
|
||||
#include "hw/pci/pci.h"
|
||||
|
@ -80,9 +83,31 @@
|
|||
|
||||
#define NDRV_VGA_FILENAME "qemu_vga.ndrv"
|
||||
|
||||
#define PROM_FILENAME "openbios-ppc"
|
||||
#define PROM_BASE 0xfff00000
|
||||
#define PROM_SIZE (1 * MiB)
|
||||
|
||||
#define KERNEL_LOAD_ADDR 0x01000000
|
||||
#define KERNEL_GAP 0x00100000
|
||||
|
||||
#define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99")
|
||||
typedef struct Core99MachineState Core99MachineState;
|
||||
DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE,
|
||||
TYPE_CORE99_MACHINE)
|
||||
|
||||
typedef enum {
|
||||
CORE99_VIA_CONFIG_CUDA = 0,
|
||||
CORE99_VIA_CONFIG_PMU,
|
||||
CORE99_VIA_CONFIG_PMU_ADB
|
||||
} Core99ViaConfig;
|
||||
|
||||
struct Core99MachineState {
|
||||
/*< private >*/
|
||||
MachineState parent;
|
||||
|
||||
Core99ViaConfig via_config;
|
||||
};
|
||||
|
||||
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -106,45 +131,32 @@ static void ppc_core99_reset(void *opaque)
|
|||
/* PowerPC Mac99 hardware initialisation */
|
||||
static void ppc_core99_init(MachineState *machine)
|
||||
{
|
||||
ram_addr_t ram_size = machine->ram_size;
|
||||
const char *bios_name = machine->firmware ?: PROM_FILENAME;
|
||||
const char *kernel_filename = machine->kernel_filename;
|
||||
const char *kernel_cmdline = machine->kernel_cmdline;
|
||||
const char *initrd_filename = machine->initrd_filename;
|
||||
const char *boot_device = machine->boot_config.order;
|
||||
Core99MachineState *core99_machine = CORE99_MACHINE(machine);
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
char *filename;
|
||||
IrqLines *openpic_irqs;
|
||||
int linux_boot, i, j, k;
|
||||
int i, j, k, ppc_boot_device, machine_arch, bios_size = -1;
|
||||
const char *bios_name = machine->firmware ?: PROM_FILENAME;
|
||||
MemoryRegion *bios = g_new(MemoryRegion, 1);
|
||||
hwaddr kernel_base, initrd_base, cmdline_base = 0;
|
||||
long kernel_size, initrd_size;
|
||||
UNINHostState *uninorth_pci;
|
||||
hwaddr kernel_base = 0, initrd_base = 0, cmdline_base = 0;
|
||||
long kernel_size = 0, initrd_size = 0;
|
||||
PCIBus *pci_bus;
|
||||
PCIDevice *macio;
|
||||
ESCCState *escc;
|
||||
bool has_pmu, has_adb;
|
||||
Object *macio;
|
||||
MACIOIDEState *macio_ide;
|
||||
BusState *adb_bus;
|
||||
MacIONVRAMState *nvr;
|
||||
int bios_size;
|
||||
int ppc_boot_device;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
void *fw_cfg;
|
||||
int machine_arch;
|
||||
SysBusDevice *s;
|
||||
DeviceState *dev, *pic_dev;
|
||||
DeviceState *dev, *pic_dev, *uninorth_pci_dev;
|
||||
DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
|
||||
hwaddr nvram_addr = 0xFFF04000;
|
||||
uint64_t tbfreq;
|
||||
unsigned int smp_cpus = machine->smp.cpus;
|
||||
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
|
||||
|
||||
/* init CPUs */
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
for (i = 0; i < machine->smp.cpus; i++) {
|
||||
cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
|
||||
env = &cpu->env;
|
||||
|
||||
|
@ -176,68 +188,62 @@ static void ppc_core99_init(MachineState *machine)
|
|||
bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
|
||||
}
|
||||
g_free(filename);
|
||||
} else {
|
||||
bios_size = -1;
|
||||
}
|
||||
if (bios_size < 0 || bios_size > PROM_SIZE) {
|
||||
error_report("could not load PowerPC bios '%s'", bios_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (linux_boot) {
|
||||
int bswap_needed;
|
||||
if (machine->kernel_filename) {
|
||||
int bswap_needed = 0;
|
||||
|
||||
#ifdef BSWAP_NEEDED
|
||||
bswap_needed = 1;
|
||||
#else
|
||||
bswap_needed = 0;
|
||||
#endif
|
||||
kernel_base = KERNEL_LOAD_ADDR;
|
||||
|
||||
kernel_size = load_elf(kernel_filename, NULL,
|
||||
kernel_size = load_elf(machine->kernel_filename, NULL,
|
||||
translate_kernel_address, NULL, NULL, NULL,
|
||||
NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
if (kernel_size < 0)
|
||||
kernel_size = load_aout(kernel_filename, kernel_base,
|
||||
ram_size - kernel_base, bswap_needed,
|
||||
TARGET_PAGE_SIZE);
|
||||
if (kernel_size < 0)
|
||||
kernel_size = load_image_targphys(kernel_filename,
|
||||
kernel_base,
|
||||
ram_size - kernel_base);
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s'", kernel_filename);
|
||||
kernel_size = load_aout(machine->kernel_filename, kernel_base,
|
||||
machine->ram_size - kernel_base,
|
||||
bswap_needed, TARGET_PAGE_SIZE);
|
||||
}
|
||||
if (kernel_size < 0) {
|
||||
kernel_size = load_image_targphys(machine->kernel_filename,
|
||||
kernel_base,
|
||||
machine->ram_size - kernel_base);
|
||||
}
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s'",
|
||||
machine->kernel_filename);
|
||||
exit(1);
|
||||
}
|
||||
/* load initrd */
|
||||
if (initrd_filename) {
|
||||
if (machine->initrd_filename) {
|
||||
initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
|
||||
initrd_size = load_image_targphys(initrd_filename, initrd_base,
|
||||
ram_size - initrd_base);
|
||||
initrd_size = load_image_targphys(machine->initrd_filename,
|
||||
initrd_base,
|
||||
machine->ram_size - initrd_base);
|
||||
if (initrd_size < 0) {
|
||||
error_report("could not load initial ram disk '%s'",
|
||||
initrd_filename);
|
||||
machine->initrd_filename);
|
||||
exit(1);
|
||||
}
|
||||
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
|
||||
} else {
|
||||
initrd_base = 0;
|
||||
initrd_size = 0;
|
||||
cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
|
||||
}
|
||||
ppc_boot_device = 'm';
|
||||
} else {
|
||||
kernel_base = 0;
|
||||
kernel_size = 0;
|
||||
initrd_base = 0;
|
||||
initrd_size = 0;
|
||||
ppc_boot_device = '\0';
|
||||
/* We consider that NewWorld PowerMac never have any floppy drive
|
||||
* For now, OHW cannot boot from the network.
|
||||
*/
|
||||
for (i = 0; boot_device[i] != '\0'; i++) {
|
||||
if (boot_device[i] >= 'c' && boot_device[i] <= 'f') {
|
||||
ppc_boot_device = boot_device[i];
|
||||
for (i = 0; machine->boot_config.order[i] != '\0'; i++) {
|
||||
if (machine->boot_config.order[i] >= 'c' &&
|
||||
machine->boot_config.order[i] <= 'f') {
|
||||
ppc_boot_device = machine->boot_config.order[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -247,45 +253,39 @@ static void ppc_core99_init(MachineState *machine)
|
|||
}
|
||||
}
|
||||
|
||||
/* UniN init */
|
||||
dev = qdev_new(TYPE_UNI_NORTH);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
memory_region_add_subregion(get_system_memory(), 0xf8000000,
|
||||
sysbus_mmio_get_region(s, 0));
|
||||
|
||||
openpic_irqs = g_new0(IrqLines, smp_cpus);
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
openpic_irqs = g_new0(IrqLines, machine->smp.cpus);
|
||||
dev = DEVICE(cpu);
|
||||
for (i = 0; i < machine->smp.cpus; i++) {
|
||||
/* Mac99 IRQ connection between OpenPIC outputs pins
|
||||
* and PowerPC input pins
|
||||
*/
|
||||
switch (PPC_INPUT(env)) {
|
||||
case PPC_FLAGS_INPUT_6xx:
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT);
|
||||
qdev_get_gpio_in(dev, PPC6xx_INPUT_INT);
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT);
|
||||
qdev_get_gpio_in(dev, PPC6xx_INPUT_INT);
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_MCP);
|
||||
qdev_get_gpio_in(dev, PPC6xx_INPUT_MCP);
|
||||
/* Not connected ? */
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL;
|
||||
/* Check this */
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET);
|
||||
qdev_get_gpio_in(dev, PPC6xx_INPUT_HRESET);
|
||||
break;
|
||||
#if defined(TARGET_PPC64)
|
||||
case PPC_FLAGS_INPUT_970:
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT);
|
||||
qdev_get_gpio_in(dev, PPC970_INPUT_INT);
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT);
|
||||
qdev_get_gpio_in(dev, PPC970_INPUT_INT);
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_MCP);
|
||||
qdev_get_gpio_in(dev, PPC970_INPUT_MCP);
|
||||
/* Not connected ? */
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL;
|
||||
/* Check this */
|
||||
openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] =
|
||||
qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_HRESET);
|
||||
qdev_get_gpio_in(dev, PPC970_INPUT_HRESET);
|
||||
break;
|
||||
#endif /* defined(TARGET_PPC64) */
|
||||
default:
|
||||
|
@ -294,24 +294,29 @@ static void ppc_core99_init(MachineState *machine)
|
|||
}
|
||||
}
|
||||
|
||||
/* UniN init */
|
||||
s = SYS_BUS_DEVICE(qdev_new(TYPE_UNI_NORTH));
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
memory_region_add_subregion(get_system_memory(), 0xf8000000,
|
||||
sysbus_mmio_get_region(s, 0));
|
||||
|
||||
if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
|
||||
machine_arch = ARCH_MAC99_U3;
|
||||
/* 970 gets a U3 bus */
|
||||
/* Uninorth AGP bus */
|
||||
dev = qdev_new(TYPE_U3_AGP_HOST_BRIDGE);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
uninorth_pci = U3_AGP_HOST_BRIDGE(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
uninorth_pci_dev = qdev_new(TYPE_U3_AGP_HOST_BRIDGE);
|
||||
s = SYS_BUS_DEVICE(uninorth_pci_dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, 0xf0800000);
|
||||
sysbus_mmio_map(s, 1, 0xf0c00000);
|
||||
/* PCI hole */
|
||||
memory_region_add_subregion(get_system_memory(), 0x80000000ULL,
|
||||
memory_region_add_subregion(get_system_memory(), 0x80000000,
|
||||
sysbus_mmio_get_region(s, 2));
|
||||
/* Register 8 MB of ISA IO space */
|
||||
memory_region_add_subregion(get_system_memory(), 0xf2000000,
|
||||
sysbus_mmio_get_region(s, 3));
|
||||
sysbus_mmio_map(s, 0, 0xf0800000);
|
||||
sysbus_mmio_map(s, 1, 0xf0c00000);
|
||||
|
||||
machine_arch = ARCH_MAC99_U3;
|
||||
} else {
|
||||
machine_arch = ARCH_MAC99;
|
||||
/* Use values found on a real PowerMac */
|
||||
/* Uninorth AGP bus */
|
||||
uninorth_agp_dev = qdev_new(TYPE_UNI_NORTH_AGP_HOST_BRIDGE);
|
||||
|
@ -328,22 +333,19 @@ static void ppc_core99_init(MachineState *machine)
|
|||
sysbus_mmio_map(s, 0, 0xf4800000);
|
||||
sysbus_mmio_map(s, 1, 0xf4c00000);
|
||||
|
||||
/* Uninorth main bus */
|
||||
dev = qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE);
|
||||
qdev_prop_set_uint32(dev, "ofw-addr", 0xf2000000);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
uninorth_pci = UNI_NORTH_PCI_HOST_BRIDGE(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
/* Uninorth main bus - this must be last to make it the default */
|
||||
uninorth_pci_dev = qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE);
|
||||
qdev_prop_set_uint32(uninorth_pci_dev, "ofw-addr", 0xf2000000);
|
||||
s = SYS_BUS_DEVICE(uninorth_pci_dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, 0xf2800000);
|
||||
sysbus_mmio_map(s, 1, 0xf2c00000);
|
||||
/* PCI hole */
|
||||
memory_region_add_subregion(get_system_memory(), 0x80000000ULL,
|
||||
memory_region_add_subregion(get_system_memory(), 0x80000000,
|
||||
sysbus_mmio_get_region(s, 2));
|
||||
/* Register 8 MB of ISA IO space */
|
||||
memory_region_add_subregion(get_system_memory(), 0xf2000000,
|
||||
sysbus_mmio_get_region(s, 3));
|
||||
sysbus_mmio_map(s, 0, 0xf2800000);
|
||||
sysbus_mmio_map(s, 1, 0xf2c00000);
|
||||
|
||||
machine_arch = ARCH_MAC99;
|
||||
}
|
||||
|
||||
machine->usb |= defaults_enabled() && !machine->usb_disabled;
|
||||
|
@ -351,32 +353,25 @@ static void ppc_core99_init(MachineState *machine)
|
|||
has_adb = (core99_machine->via_config == CORE99_VIA_CONFIG_CUDA ||
|
||||
core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB);
|
||||
|
||||
/* Timebase Frequency */
|
||||
if (kvm_enabled()) {
|
||||
tbfreq = kvmppc_get_tbfreq();
|
||||
} else {
|
||||
tbfreq = TBFREQ;
|
||||
}
|
||||
|
||||
/* init basic PC hardware */
|
||||
pci_bus = PCI_HOST_BRIDGE(uninorth_pci)->bus;
|
||||
pci_bus = PCI_HOST_BRIDGE(uninorth_pci_dev)->bus;
|
||||
|
||||
/* MacIO */
|
||||
macio = pci_new(-1, TYPE_NEWWORLD_MACIO);
|
||||
macio = OBJECT(pci_new(-1, TYPE_NEWWORLD_MACIO));
|
||||
dev = DEVICE(macio);
|
||||
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
||||
qdev_prop_set_bit(dev, "has-pmu", has_pmu);
|
||||
qdev_prop_set_bit(dev, "has-adb", has_adb);
|
||||
|
||||
escc = ESCC(object_resolve_path_component(OBJECT(macio), "escc"));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1));
|
||||
dev = DEVICE(object_resolve_path_component(macio, "escc"));
|
||||
qdev_prop_set_chr(dev, "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(dev, "chrB", serial_hd(1));
|
||||
|
||||
pci_realize_and_unref(macio, pci_bus, &error_fatal);
|
||||
pci_realize_and_unref(PCI_DEVICE(macio), pci_bus, &error_fatal);
|
||||
|
||||
pic_dev = DEVICE(object_resolve_path_component(OBJECT(macio), "pic"));
|
||||
pic_dev = DEVICE(object_resolve_path_component(macio, "pic"));
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(DEVICE(uninorth_pci), i,
|
||||
qdev_connect_gpio_out(uninorth_pci_dev, i,
|
||||
qdev_get_gpio_in(pic_dev, 0x1b + i));
|
||||
}
|
||||
|
||||
|
@ -398,7 +393,7 @@ static void ppc_core99_init(MachineState *machine)
|
|||
/* OpenPIC */
|
||||
s = SYS_BUS_DEVICE(pic_dev);
|
||||
k = 0;
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
for (i = 0; i < machine->smp.cpus; i++) {
|
||||
for (j = 0; j < OPENPIC_OUTPUT_NB; j++) {
|
||||
sysbus_connect_irq(s, k++, openpic_irqs[i].irq[j]);
|
||||
}
|
||||
|
@ -408,19 +403,17 @@ static void ppc_core99_init(MachineState *machine)
|
|||
/* We only emulate 2 out of 3 IDE controllers for now */
|
||||
ide_drive_get(hd, ARRAY_SIZE(hd));
|
||||
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
"ide[0]"));
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(macio, "ide[0]"));
|
||||
macio_ide_init_drives(macio_ide, hd);
|
||||
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
"ide[1]"));
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(macio, "ide[1]"));
|
||||
macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);
|
||||
|
||||
if (has_adb) {
|
||||
if (has_pmu) {
|
||||
dev = DEVICE(object_resolve_path_component(OBJECT(macio), "pmu"));
|
||||
dev = DEVICE(object_resolve_path_component(macio, "pmu"));
|
||||
} else {
|
||||
dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
|
||||
dev = DEVICE(object_resolve_path_component(macio, "cuda"));
|
||||
}
|
||||
|
||||
adb_bus = qdev_get_child_bus(dev, "adb.0");
|
||||
|
@ -461,12 +454,12 @@ static void ppc_core99_init(MachineState *machine)
|
|||
nvram_addr = 0xFFE00000;
|
||||
}
|
||||
dev = qdev_new(TYPE_MACIO_NVRAM);
|
||||
qdev_prop_set_uint32(dev, "size", 0x2000);
|
||||
qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 1);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr);
|
||||
nvr = MACIO_NVRAM(dev);
|
||||
pmac_format_nvram_partition(nvr, 0x2000);
|
||||
pmac_format_nvram_partition(nvr, MACIO_NVRAM_SIZE);
|
||||
/* No PCI init: the BIOS will do it */
|
||||
|
||||
dev = qdev_new(TYPE_FW_CFG_MEM);
|
||||
|
@ -480,15 +473,16 @@ static void ppc_core99_init(MachineState *machine)
|
|||
sysbus_mmio_map(s, 0, CFG_ADDR);
|
||||
sysbus_mmio_map(s, 1, CFG_ADDR + 2);
|
||||
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)machine->smp.cpus);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)machine->smp.max_cpus);
|
||||
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
|
||||
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
|
||||
if (kernel_cmdline) {
|
||||
if (machine->kernel_cmdline) {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base);
|
||||
pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline);
|
||||
pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE,
|
||||
machine->kernel_cmdline);
|
||||
} else {
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
|
||||
}
|
||||
|
|
|
@ -30,13 +30,14 @@
|
|||
#include "qapi/error.h"
|
||||
#include "hw/ppc/ppc.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "mac.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "net/net.h"
|
||||
#include "hw/isa/isa.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pci_host.h"
|
||||
#include "hw/pci-host/grackle.h"
|
||||
#include "hw/nvram/fw_cfg.h"
|
||||
#include "hw/char/escc.h"
|
||||
#include "hw/misc/macio/macio.h"
|
||||
|
@ -56,10 +57,15 @@
|
|||
|
||||
#define NDRV_VGA_FILENAME "qemu_vga.ndrv"
|
||||
|
||||
#define GRACKLE_BASE 0xfec00000
|
||||
#define PROM_FILENAME "openbios-ppc"
|
||||
#define PROM_BASE 0xffc00000
|
||||
#define PROM_SIZE (4 * MiB)
|
||||
|
||||
#define KERNEL_LOAD_ADDR 0x01000000
|
||||
#define KERNEL_GAP 0x00100000
|
||||
|
||||
#define GRACKLE_BASE 0xfec00000
|
||||
|
||||
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -80,33 +86,28 @@ static void ppc_heathrow_reset(void *opaque)
|
|||
|
||||
static void ppc_heathrow_init(MachineState *machine)
|
||||
{
|
||||
ram_addr_t ram_size = machine->ram_size;
|
||||
const char *bios_name = machine->firmware ?: PROM_FILENAME;
|
||||
const char *boot_device = machine->boot_config.order;
|
||||
PowerPCCPU *cpu = NULL;
|
||||
CPUPPCState *env = NULL;
|
||||
char *filename;
|
||||
int i;
|
||||
int i, bios_size = -1;
|
||||
MemoryRegion *bios = g_new(MemoryRegion, 1);
|
||||
uint32_t kernel_base, initrd_base, cmdline_base = 0;
|
||||
int32_t kernel_size, initrd_size;
|
||||
uint64_t bios_addr;
|
||||
uint32_t kernel_base = 0, initrd_base = 0, cmdline_base = 0;
|
||||
int32_t kernel_size = 0, initrd_size = 0;
|
||||
PCIBus *pci_bus;
|
||||
PCIDevice *macio;
|
||||
Object *macio;
|
||||
MACIOIDEState *macio_ide;
|
||||
ESCCState *escc;
|
||||
SysBusDevice *s;
|
||||
DeviceState *dev, *pic_dev, *grackle_dev;
|
||||
BusState *adb_bus;
|
||||
uint64_t bios_addr;
|
||||
int bios_size;
|
||||
unsigned int smp_cpus = machine->smp.cpus;
|
||||
uint16_t ppc_boot_device;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
void *fw_cfg;
|
||||
uint64_t tbfreq;
|
||||
uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
|
||||
|
||||
/* init CPUs */
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
for (i = 0; i < machine->smp.cpus; i++) {
|
||||
cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
|
||||
env = &cpu->env;
|
||||
|
||||
|
@ -116,9 +117,9 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
}
|
||||
|
||||
/* allocate RAM */
|
||||
if (ram_size > 2047 * MiB) {
|
||||
if (machine->ram_size > 2047 * MiB) {
|
||||
error_report("Too much memory for this machine: %" PRId64 " MB, "
|
||||
"maximum 2047 MB", ram_size / MiB);
|
||||
"maximum 2047 MB", machine->ram_size / MiB);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -143,8 +144,6 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
bios_addr = PROM_BASE;
|
||||
}
|
||||
g_free(filename);
|
||||
} else {
|
||||
bios_size = -1;
|
||||
}
|
||||
if (bios_size < 0 || bios_addr - PROM_BASE + bios_size > PROM_SIZE) {
|
||||
error_report("could not load PowerPC bios '%s'", bios_name);
|
||||
|
@ -152,25 +151,25 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
}
|
||||
|
||||
if (machine->kernel_filename) {
|
||||
int bswap_needed;
|
||||
int bswap_needed = 0;
|
||||
|
||||
#ifdef BSWAP_NEEDED
|
||||
bswap_needed = 1;
|
||||
#else
|
||||
bswap_needed = 0;
|
||||
#endif
|
||||
kernel_base = KERNEL_LOAD_ADDR;
|
||||
kernel_size = load_elf(machine->kernel_filename, NULL,
|
||||
translate_kernel_address, NULL, NULL, NULL,
|
||||
NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
|
||||
if (kernel_size < 0)
|
||||
if (kernel_size < 0) {
|
||||
kernel_size = load_aout(machine->kernel_filename, kernel_base,
|
||||
ram_size - kernel_base, bswap_needed,
|
||||
TARGET_PAGE_SIZE);
|
||||
if (kernel_size < 0)
|
||||
machine->ram_size - kernel_base,
|
||||
bswap_needed, TARGET_PAGE_SIZE);
|
||||
}
|
||||
if (kernel_size < 0) {
|
||||
kernel_size = load_image_targphys(machine->kernel_filename,
|
||||
kernel_base,
|
||||
ram_size - kernel_base);
|
||||
machine->ram_size - kernel_base);
|
||||
}
|
||||
if (kernel_size < 0) {
|
||||
error_report("could not load kernel '%s'",
|
||||
machine->kernel_filename);
|
||||
|
@ -182,7 +181,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
KERNEL_GAP);
|
||||
initrd_size = load_image_targphys(machine->initrd_filename,
|
||||
initrd_base,
|
||||
ram_size - initrd_base);
|
||||
machine->ram_size - initrd_base);
|
||||
if (initrd_size < 0) {
|
||||
error_report("could not load initial ram disk '%s'",
|
||||
machine->initrd_filename);
|
||||
|
@ -190,30 +189,27 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
}
|
||||
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
|
||||
} else {
|
||||
initrd_base = 0;
|
||||
initrd_size = 0;
|
||||
cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
|
||||
}
|
||||
ppc_boot_device = 'm';
|
||||
} else {
|
||||
kernel_base = 0;
|
||||
kernel_size = 0;
|
||||
initrd_base = 0;
|
||||
initrd_size = 0;
|
||||
ppc_boot_device = '\0';
|
||||
for (i = 0; boot_device[i] != '\0'; i++) {
|
||||
/* TOFIX: for now, the second IDE channel is not properly
|
||||
for (i = 0; machine->boot_config.order[i] != '\0'; i++) {
|
||||
/*
|
||||
* TOFIX: for now, the second IDE channel is not properly
|
||||
* used by OHW. The Mac floppy disk are not emulated.
|
||||
* For now, OHW cannot boot from the network.
|
||||
*/
|
||||
#if 0
|
||||
if (boot_device[i] >= 'a' && boot_device[i] <= 'f') {
|
||||
ppc_boot_device = boot_device[i];
|
||||
if (machine->boot_config.order[i] >= 'a' &&
|
||||
machine->boot_config.order[i] <= 'f') {
|
||||
ppc_boot_device = machine->boot_config.order[i];
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (boot_device[i] >= 'c' && boot_device[i] <= 'd') {
|
||||
ppc_boot_device = boot_device[i];
|
||||
if (machine->boot_config.order[i] >= 'c' &&
|
||||
machine->boot_config.order[i] <= 'd') {
|
||||
ppc_boot_device = machine->boot_config.order[i];
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -224,13 +220,6 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
}
|
||||
}
|
||||
|
||||
/* Timebase Frequency */
|
||||
if (kvm_enabled()) {
|
||||
tbfreq = kvmppc_get_tbfreq();
|
||||
} else {
|
||||
tbfreq = TBFREQ;
|
||||
}
|
||||
|
||||
/* Grackle PCI host bridge */
|
||||
grackle_dev = qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE);
|
||||
qdev_prop_set_uint32(grackle_dev, "ofw-addr", 0x80000000);
|
||||
|
@ -249,24 +238,23 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
pci_bus = PCI_HOST_BRIDGE(grackle_dev)->bus;
|
||||
|
||||
/* MacIO */
|
||||
macio = pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO);
|
||||
dev = DEVICE(macio);
|
||||
qdev_prop_set_uint64(dev, "frequency", tbfreq);
|
||||
macio = OBJECT(pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO));
|
||||
qdev_prop_set_uint64(DEVICE(macio), "frequency", tbfreq);
|
||||
|
||||
escc = ESCC(object_resolve_path_component(OBJECT(macio), "escc"));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1));
|
||||
dev = DEVICE(object_resolve_path_component(macio, "escc"));
|
||||
qdev_prop_set_chr(dev, "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(dev, "chrB", serial_hd(1));
|
||||
|
||||
pci_realize_and_unref(macio, pci_bus, &error_fatal);
|
||||
pci_realize_and_unref(PCI_DEVICE(macio), pci_bus, &error_fatal);
|
||||
|
||||
pic_dev = DEVICE(object_resolve_path_component(OBJECT(macio), "pic"));
|
||||
pic_dev = DEVICE(object_resolve_path_component(macio, "pic"));
|
||||
for (i = 0; i < 4; i++) {
|
||||
qdev_connect_gpio_out(grackle_dev, i,
|
||||
qdev_get_gpio_in(pic_dev, 0x15 + i));
|
||||
}
|
||||
|
||||
/* Connect the heathrow PIC outputs to the 6xx bus */
|
||||
for (i = 0; i < smp_cpus; i++) {
|
||||
for (i = 0; i < machine->smp.cpus; i++) {
|
||||
switch (PPC_INPUT(env)) {
|
||||
case PPC_FLAGS_INPUT_6xx:
|
||||
/* XXX: we register only 1 output pin for heathrow PIC */
|
||||
|
@ -287,16 +275,14 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
|
||||
/* MacIO IDE */
|
||||
ide_drive_get(hd, ARRAY_SIZE(hd));
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
"ide[0]"));
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(macio, "ide[0]"));
|
||||
macio_ide_init_drives(macio_ide, hd);
|
||||
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
"ide[1]"));
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(macio, "ide[1]"));
|
||||
macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);
|
||||
|
||||
/* MacIO CUDA/ADB */
|
||||
dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
|
||||
dev = DEVICE(object_resolve_path_component(macio, "cuda"));
|
||||
adb_bus = qdev_get_child_bus(dev, "adb.0");
|
||||
dev = qdev_new(TYPE_ADB_KEYBOARD);
|
||||
qdev_realize_and_unref(dev, adb_bus, &error_fatal);
|
||||
|
@ -307,8 +293,9 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
pci_create_simple(pci_bus, -1, "pci-ohci");
|
||||
}
|
||||
|
||||
if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
|
||||
if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
|
||||
graphic_depth = 15;
|
||||
}
|
||||
|
||||
/* No PCI init: the BIOS will do it */
|
||||
|
||||
|
@ -323,9 +310,9 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
sysbus_mmio_map(s, 0, CFG_ADDR);
|
||||
sysbus_mmio_map(s, 1, CFG_ADDR + 2);
|
||||
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)machine->smp.cpus);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)machine->smp.max_cpus);
|
||||
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
|
||||
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
|
||||
|
|
|
@ -33,11 +33,32 @@
|
|||
#include "hw/misc/macio/cuda.h"
|
||||
#include "hw/misc/macio/gpio.h"
|
||||
#include "hw/misc/macio/pmu.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/nvram/mac_nvram.h"
|
||||
#include "hw/ppc/mac_dbdma.h"
|
||||
#include "hw/ppc/openpic.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/* Old World IRQs */
|
||||
#define OLDWORLD_CUDA_IRQ 0x12
|
||||
#define OLDWORLD_ESCCB_IRQ 0x10
|
||||
#define OLDWORLD_ESCCA_IRQ 0xf
|
||||
#define OLDWORLD_IDE0_IRQ 0xd
|
||||
#define OLDWORLD_IDE0_DMA_IRQ 0x2
|
||||
#define OLDWORLD_IDE1_IRQ 0xe
|
||||
#define OLDWORLD_IDE1_DMA_IRQ 0x3
|
||||
|
||||
/* New World IRQs */
|
||||
#define NEWWORLD_CUDA_IRQ 0x19
|
||||
#define NEWWORLD_PMU_IRQ 0x19
|
||||
#define NEWWORLD_ESCCB_IRQ 0x24
|
||||
#define NEWWORLD_ESCCA_IRQ 0x25
|
||||
#define NEWWORLD_IDE0_IRQ 0xd
|
||||
#define NEWWORLD_IDE0_DMA_IRQ 0x2
|
||||
#define NEWWORLD_IDE1_IRQ 0xe
|
||||
#define NEWWORLD_IDE1_DMA_IRQ 0x3
|
||||
#define NEWWORLD_EXTING_GPIO1 0x2f
|
||||
#define NEWWORLD_EXTING_GPIO9 0x37
|
||||
|
||||
/* MacIO virtual bus */
|
||||
#define TYPE_MACIO_BUS "macio-bus"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MacIOBusState, MACIO_BUS)
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* PowerMac NVRAM emulation
|
||||
*
|
||||
* Copyright (c) 2004-2007 Fabrice Bellard
|
||||
* Copyright (c) 2007 Jocelyn Mayer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MAC_NVRAM_H
|
||||
#define MAC_NVRAM_H
|
||||
|
||||
#include "exec/memory.h"
|
||||
#include "hw/sysbus.h"
|
||||
|
||||
#define MACIO_NVRAM_SIZE 0x2000
|
||||
|
||||
#define TYPE_MACIO_NVRAM "macio-nvram"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM)
|
||||
|
||||
struct MacIONVRAMState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
/*< public >*/
|
||||
|
||||
uint32_t size;
|
||||
uint32_t it_shift;
|
||||
|
||||
MemoryRegion mem;
|
||||
uint8_t *data;
|
||||
};
|
||||
|
||||
void pmac_format_nvram_partition(MacIONVRAMState *nvr, int len);
|
||||
|
||||
#endif /* MAC_NVRAM_H */
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* QEMU Grackle PCI host (heathrow OldWorld PowerMac)
|
||||
*
|
||||
* Copyright (c) 2006-2007 Fabrice Bellard
|
||||
* Copyright (c) 2007 Jocelyn Mayer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef GRACKLE_H
|
||||
#define GRACKLE_H
|
||||
|
||||
#include "hw/pci/pci_host.h"
|
||||
|
||||
#define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(GrackleState, GRACKLE_PCI_HOST_BRIDGE)
|
||||
|
||||
struct GrackleState {
|
||||
PCIHostState parent_obj;
|
||||
|
||||
uint32_t ofw_addr;
|
||||
qemu_irq irqs[4];
|
||||
MemoryRegion pci_mmio;
|
||||
MemoryRegion pci_hole;
|
||||
MemoryRegion pci_io;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue