* [PATCH v6 01/11] mac_oldworld: Allow loading binary ROM image
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 09/11] i2c: Match parameters of i2c_start_transfer and i2c_send_recv BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 07/11] mac_oldworld: Map macio to expected address at reset BALATON Zoltan
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
The beige G3 Power Macintosh has a 4MB firmware ROM. Fix the size of
the rom region and fall back to loading a binary image with -bios if
loading ELF image failed. This allows testing emulation with a ROM
image from real hardware as well as using an ELF OpenBIOS image.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
v4: use load address from ELF to check if ROM is too big
hw/ppc/mac_oldworld.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index f8c204ead7..baf3da6f90 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -59,6 +59,8 @@
#define NDRV_VGA_FILENAME "qemu_vga.ndrv"
#define GRACKLE_BASE 0xfec00000
+#define PROM_BASE 0xffc00000
+#define PROM_SIZE (4 * MiB)
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
Error **errp)
@@ -99,6 +101,7 @@ static void ppc_heathrow_init(MachineState *machine)
SysBusDevice *s;
DeviceState *dev, *pic_dev;
BusState *adb_bus;
+ uint64_t bios_addr;
int bios_size;
unsigned int smp_cpus = machine->smp.cpus;
uint16_t ppc_boot_device;
@@ -127,24 +130,32 @@ static void ppc_heathrow_init(MachineState *machine)
memory_region_add_subregion(sysmem, 0, machine->ram);
- /* allocate and load BIOS */
- memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE,
+ /* allocate and load firmware ROM */
+ memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", PROM_SIZE,
&error_fatal);
+ memory_region_add_subregion(sysmem, PROM_BASE, bios);
- if (bios_name == NULL)
+ if (!bios_name) {
bios_name = PROM_FILENAME;
+ }
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
- memory_region_add_subregion(sysmem, PROM_ADDR, bios);
-
- /* Load OpenBIOS (ELF) */
if (filename) {
- bios_size = load_elf(filename, NULL, 0, NULL, NULL, NULL, NULL, NULL,
- 1, PPC_ELF_MACHINE, 0, 0);
+ /* Load OpenBIOS (ELF) */
+ bios_size = load_elf(filename, NULL, NULL, NULL, NULL, &bios_addr,
+ NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
+ if (bios_size <= 0) {
+ /* or load binary ROM image */
+ bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
+ bios_addr = PROM_BASE;
+ } else {
+ /* load_elf sets high 32 bits for some reason, strip those */
+ bios_addr &= 0xffffffffULL;
+ }
g_free(filename);
} else {
bios_size = -1;
}
- if (bios_size < 0 || bios_size > BIOS_SIZE) {
+ if (bios_size < 0 || bios_addr - PROM_BASE + bios_size > PROM_SIZE) {
error_report("could not load PowerPC bios '%s'", bios_name);
exit(1);
}
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 00/11] Mac Old World ROM experiment
@ 2020-06-28 18:03 BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 09/11] i2c: Match parameters of i2c_start_transfer and i2c_send_recv BALATON Zoltan
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
Latest version of this series with addressing review comments, adding
review tags and tweaks to the WIP CUDA I2C support so with this on top
of Mark's screaper patches (with a small fix) the ROM now plays the
startup sound but then gets confused about some memory addresses. I
don't want to debug this further so either some hints are needed what
may be needed or someone could take over and finish these.
I think at least up to patch 8 this could be merged already, the rest
needs more work.
Regards,
BALATON Zoltan
BALATON Zoltan (11):
mac_oldworld: Allow loading binary ROM image
mac_newworld: Allow loading binary ROM image
mac_oldworld: Drop a variable, use get_system_memory() directly
mac_oldworld: Drop some variables
grackle: Set revision in PCI config to match hardware
mac_oldworld: Rename ppc_heathrow_reset to ppc_heathrow_cpu_reset
mac_oldworld: Map macio to expected address at reset
mac_oldworld: Add machine ID register
i2c: Match parameters of i2c_start_transfer and i2c_send_recv
WIP macio/cuda: Attempt to add i2c support
mac_oldworld: Add SPD data to cover RAM
hw/display/sm501.c | 2 +-
hw/i2c/core.c | 34 +++++-----
hw/i2c/ppc4xx_i2c.c | 2 +-
hw/misc/macio/cuda.c | 76 ++++++++++++++++++++-
hw/pci-host/grackle.c | 2 +-
hw/ppc/mac.h | 15 ++++-
hw/ppc/mac_newworld.c | 22 +++---
hw/ppc/mac_oldworld.c | 127 ++++++++++++++++++++++++++---------
include/hw/i2c/i2c.h | 4 +-
include/hw/misc/macio/cuda.h | 1 +
10 files changed, 220 insertions(+), 65 deletions(-)
--
2.21.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v6 02/11] mac_newworld: Allow loading binary ROM image
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (9 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 04/11] mac_oldworld: Drop some variables BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
Fall back to load binary ROM image if loading ELF fails. This also
moves PROM_BASE and PROM_SIZE defines to board as these are matching
the ROM size and address on this board and removes the now unused
PROM_ADDR and BIOS_SIZE defines from common mac.h.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
Unlike mac_oldworld where the openbios-ppc image loads at end of ROM
region here we only check size and assume ELF image is loaded from
PROM_BASE, Checking the load addr here is tricky because this board is
also be compiled both 64 and 32 bit and load_elf seems to always
return 64 bit value so handling that could become a mess. If this is a
problem then it's a preexisting one so should be fixed in a separate
patch. This one just allows loading ROM binary too otherwise
preserving previous behaviour.
hw/ppc/mac.h | 2 --
hw/ppc/mac_newworld.c | 22 ++++++++++++++--------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 04e498bc57..195967facd 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -40,10 +40,8 @@
/* SMP is not enabled, for now */
#define MAX_CPUS 1
-#define BIOS_SIZE (1 * MiB)
#define NVRAM_SIZE 0x2000
#define PROM_FILENAME "openbios-ppc"
-#define PROM_ADDR 0xfff00000
#define KERNEL_LOAD_ADDR 0x01000000
#define KERNEL_GAP 0x00100000
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 828c5992ae..c88142af57 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -82,6 +82,8 @@
#define NDRV_VGA_FILENAME "qemu_vga.ndrv"
+#define PROM_BASE 0xfff00000
+#define PROM_SIZE (1 * MiB)
static void fw_cfg_boot_set(void *opaque, const char *boot_device,
Error **errp)
@@ -100,7 +102,7 @@ static void ppc_core99_reset(void *opaque)
cpu_reset(CPU(cpu));
/* 970 CPUs want to get their initial IP as part of their boot protocol */
- cpu->env.nip = PROM_ADDR + 0x100;
+ cpu->env.nip = PROM_BASE + 0x100;
}
/* PowerPC Mac99 hardware initialisation */
@@ -153,25 +155,29 @@ static void ppc_core99_init(MachineState *machine)
/* allocate RAM */
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
- /* allocate and load BIOS */
- memory_region_init_rom(bios, NULL, "ppc_core99.bios", BIOS_SIZE,
+ /* allocate and load firmware ROM */
+ memory_region_init_rom(bios, NULL, "ppc_core99.bios", PROM_SIZE,
&error_fatal);
+ memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
- if (bios_name == NULL)
+ if (!bios_name) {
bios_name = PROM_FILENAME;
+ }
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
- memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios);
-
- /* Load OpenBIOS (ELF) */
if (filename) {
+ /* Load OpenBIOS (ELF) */
bios_size = load_elf(filename, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0);
+ if (bios_size <= 0) {
+ /* or load binary ROM image */
+ bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
+ }
g_free(filename);
} else {
bios_size = -1;
}
- if (bios_size < 0 || bios_size > BIOS_SIZE) {
+ if (bios_size < 0 || bios_size > PROM_SIZE) {
error_report("could not load PowerPC bios '%s'", bios_name);
exit(1);
}
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 04/11] mac_oldworld: Drop some variables
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (8 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 06/11] mac_oldworld: Rename ppc_heathrow_reset to ppc_heathrow_cpu_reset BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 02/11] mac_newworld: Allow loading binary ROM image BALATON Zoltan
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
Values not used frequently enough may not worth putting in a local
variable, especially with names almost as long as the original value
because that does not improve readability, to the contrary it makes it
harder to see what value is used. Drop a few such variables.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/ppc/mac_oldworld.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index d1c4244b1e..4200008851 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -83,14 +83,11 @@ static void ppc_heathrow_reset(void *opaque)
static void ppc_heathrow_init(MachineState *machine)
{
ram_addr_t ram_size = machine->ram_size;
- 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_order;
PowerPCCPU *cpu = NULL;
CPUPPCState *env = NULL;
char *filename;
- int linux_boot, i;
+ int i;
MemoryRegion *bios = g_new(MemoryRegion, 1);
uint32_t kernel_base, initrd_base, cmdline_base = 0;
int32_t kernel_size, initrd_size;
@@ -108,8 +105,6 @@ static void ppc_heathrow_init(MachineState *machine)
void *fw_cfg;
uint64_t tbfreq;
- linux_boot = (kernel_filename != NULL);
-
/* init CPUs */
for (i = 0; i < smp_cpus; i++) {
cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
@@ -159,7 +154,7 @@ static void ppc_heathrow_init(MachineState *machine)
exit(1);
}
- if (linux_boot) {
+ if (machine->kernel_filename) {
uint64_t lowaddr = 0;
int bswap_needed;
@@ -169,30 +164,33 @@ static void ppc_heathrow_init(MachineState *machine)
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, &lowaddr, NULL, NULL, 1, PPC_ELF_MACHINE,
0, 0);
if (kernel_size < 0)
- kernel_size = load_aout(kernel_filename, kernel_base,
+ kernel_size = load_aout(machine->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_size = load_image_targphys(machine->kernel_filename,
kernel_base,
ram_size - kernel_base);
if (kernel_size < 0) {
- error_report("could not load kernel '%s'", kernel_filename);
+ error_report("could not load kernel '%s'",
+ machine->kernel_filename);
exit(1);
}
/* load initrd */
- if (initrd_filename) {
- initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
- initrd_size = load_image_targphys(initrd_filename, initrd_base,
+ if (machine->initrd_filename) {
+ initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
+ KERNEL_GAP);
+ initrd_size = load_image_targphys(machine->initrd_filename,
+ initrd_base,
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);
@@ -336,9 +334,10 @@ static void ppc_heathrow_init(MachineState *machine)
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);
- 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);
}
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 03/11] mac_oldworld: Drop a variable, use get_system_memory() directly
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (6 preceding siblings ...)
2020-06-28 18:03 ` [RFC PATCH v6 10/11] WIP macio/cuda: Attempt to add i2c support BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 06/11] mac_oldworld: Rename ppc_heathrow_reset to ppc_heathrow_cpu_reset BALATON Zoltan
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
Half of the occurances already use get_system_memory() directly
instead of sysmem variable, convert the two other uses to
get_system_memory() too which seems to be more common and drop the
variable.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/ppc/mac_oldworld.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index baf3da6f90..d1c4244b1e 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -87,7 +87,6 @@ static void ppc_heathrow_init(MachineState *machine)
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
const char *boot_device = machine->boot_order;
- MemoryRegion *sysmem = get_system_memory();
PowerPCCPU *cpu = NULL;
CPUPPCState *env = NULL;
char *filename;
@@ -128,12 +127,12 @@ static void ppc_heathrow_init(MachineState *machine)
exit(1);
}
- memory_region_add_subregion(sysmem, 0, machine->ram);
+ memory_region_add_subregion(get_system_memory(), 0, machine->ram);
/* allocate and load firmware ROM */
memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", PROM_SIZE,
&error_fatal);
- memory_region_add_subregion(sysmem, PROM_BASE, bios);
+ memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
if (!bios_name) {
bios_name = PROM_FILENAME;
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 05/11] grackle: Set revision in PCI config to match hardware
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (4 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 08/11] mac_oldworld: Add machine ID register BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [RFC PATCH v6 10/11] WIP macio/cuda: Attempt to add i2c support BALATON Zoltan
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/pci-host/grackle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index 4b3af0c704..48d11f13ab 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -130,7 +130,7 @@ static void grackle_pci_class_init(ObjectClass *klass, void *data)
k->realize = grackle_pci_realize;
k->vendor_id = PCI_VENDOR_ID_MOTOROLA;
k->device_id = PCI_DEVICE_ID_MOTOROLA_MPC106;
- k->revision = 0x00;
+ k->revision = 0x40;
k->class_id = PCI_CLASS_BRIDGE_HOST;
/*
* PCI-facing part of the host bridge, not usable without the
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 07/11] mac_oldworld: Map macio to expected address at reset
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 09/11] i2c: Match parameters of i2c_start_transfer and i2c_send_recv BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 01/11] mac_oldworld: Allow loading binary ROM image BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 11/11] mac_oldworld: Add SPD data to cover RAM BALATON Zoltan
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
Add a reset function that maps macio to the address expected by the
firmware of the board at startup.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/ppc/mac.h | 12 ++++++++++++
hw/ppc/mac_oldworld.c | 15 ++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 195967facd..58ae5a2226 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -60,6 +60,18 @@
#define OLDWORLD_SCREAMER_TX_DMA_IRQ 0x08
#define OLDWORLD_SCREAMER_RX_IRQ 0x09
+/* g3beige machine */
+#define TYPE_HEATHROW_MACHINE MACHINE_TYPE_NAME("g3beige")
+#define HEATHROW_MACHINE(obj) OBJECT_CHECK(HeathrowMachineState, (obj), \
+ TYPE_HEATHROW_MACHINE)
+
+typedef struct HeathrowMachineState {
+ /*< private >*/
+ MachineState parent;
+
+ PCIDevice *macio;
+} HeathrowMachineState;
+
/* New World IRQs */
#define NEWWORLD_CUDA_IRQ 0x19
#define NEWWORLD_PMU_IRQ 0x19
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index f97f241e0c..13562e26e6 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -73,6 +73,15 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
}
+static void ppc_heathrow_reset(MachineState *machine)
+{
+ HeathrowMachineState *m = HEATHROW_MACHINE(machine);
+
+ qemu_devices_reset();
+ pci_default_write_config(m->macio, PCI_COMMAND, PCI_COMMAND_MEMORY, 2);
+ pci_default_write_config(m->macio, PCI_BASE_ADDRESS_0, 0xf3000000, 4);
+}
+
static void ppc_heathrow_cpu_reset(void *opaque)
{
PowerPCCPU *cpu = opaque;
@@ -82,6 +91,7 @@ static void ppc_heathrow_cpu_reset(void *opaque)
static void ppc_heathrow_init(MachineState *machine)
{
+ HeathrowMachineState *hm = HEATHROW_MACHINE(machine);
ram_addr_t ram_size = machine->ram_size;
const char *boot_device = machine->boot_order;
PowerPCCPU *cpu = NULL;
@@ -287,6 +297,7 @@ static void ppc_heathrow_init(MachineState *machine)
/* MacIO */
macio = pci_new(-1, TYPE_OLDWORLD_MACIO);
+ hm->macio = macio;
dev = DEVICE(macio);
qdev_prop_set_uint64(dev, "frequency", tbfreq);
object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic",
@@ -439,6 +450,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
mc->desc = "Heathrow based PowerMAC";
mc->init = ppc_heathrow_init;
+ mc->reset = ppc_heathrow_reset;
mc->block_default_type = IF_IDE;
mc->max_cpus = MAX_CPUS;
#ifndef TARGET_PPC64
@@ -455,9 +467,10 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
}
static const TypeInfo ppc_heathrow_machine_info = {
- .name = MACHINE_TYPE_NAME("g3beige"),
+ .name = TYPE_HEATHROW_MACHINE,
.parent = TYPE_MACHINE,
.class_init = heathrow_class_init,
+ .instance_size = sizeof(HeathrowMachineState),
.interfaces = (InterfaceInfo[]) {
{ TYPE_FW_PATH_PROVIDER },
{ }
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [RFC PATCH v6 10/11] WIP macio/cuda: Attempt to add i2c support
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (5 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 05/11] grackle: Set revision in PCI config to match hardware BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 03/11] mac_oldworld: Drop a variable, use get_system_memory() directly BALATON Zoltan
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
This is not a final, RFC patch attempt to implement i2c bus in CUDA
needed for firmware to access SPD data of installed RAM. The skeleton
is there but actual implementation of I2C commands need to be refined
because I don't know how this is supposed to work. In my understanding
after an I2C command (at least for combined transfer) CUDA should
enter a mode where reading subsequent values from VIA[SR] should
return bytes received from the i2C device but not sure what ends this
mode or how to model it correctly. So this patch just returns fixed
amount of bytes expected by reading SPD eeproms just to make testing
the firmware ROM possible. Help fixing and finishing this is welcome,
I don't plan to spend more time with this so just submitted it for
whoever picks this up.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/misc/macio/cuda.c | 76 +++++++++++++++++++++++++++++++++++-
include/hw/misc/macio/cuda.h | 1 +
2 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 5bbc7770fa..3fc9773717 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -28,6 +28,7 @@
#include "hw/ppc/mac.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
+#include "hw/i2c/i2c.h"
#include "hw/input/adb.h"
#include "hw/misc/mos6522.h"
#include "hw/misc/macio/cuda.h"
@@ -370,6 +371,75 @@ static bool cuda_cmd_set_time(CUDAState *s,
return true;
}
+static bool cuda_cmd_get_set_iic(CUDAState *s,
+ const uint8_t *in_data, int in_len,
+ uint8_t *out_data, int *out_len)
+{
+ int i;
+
+ qemu_log_mask(LOG_UNIMP, "CUDA: unimplemented GET_SET_IIC %s 0x%x %d\n",
+ (in_data[0] & 1 ? "read" : "write"), in_data[0] >> 1,
+ in_len);
+ if (i2c_start_transfer(s->i2c_bus, in_data[0] >> 1, in_data[0] & 1)) {
+ return false;
+ }
+ for (i = 0; i < in_len - 3; i++) {
+ if (i2c_send(s->i2c_bus, in_data[i])) {
+ i2c_end_transfer(s->i2c_bus);
+ return false;
+ }
+ }
+ return true;
+}
+
+static bool cuda_cmd_combined_iic(CUDAState *s,
+ const uint8_t *in_data, int in_len,
+ uint8_t *out_data, int *out_len)
+{
+ int i;
+
+ if (in_len < 3) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "CUDA: COMBINED_FORMAT_IIC too few input bytes\n");
+ return false;
+ }
+ if ((in_data[0] & 0xfe) != (in_data[2] & 0xfe)) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "CUDA: COMBINED_FORMAT_IIC address mismatch\n");
+ return false;
+ }
+
+ uint8_t data = in_data[1];
+ if (i2c_start_transfer(s->i2c_bus, in_data[0] >> 1, in_data[0] & 1) ||
+ i2c_send_recv(s->i2c_bus, &data, in_data[0] & 1)) {
+ return false;
+ }
+ i2c_end_transfer(s->i2c_bus);
+ if (in_data[2] & 1) {
+ if (i2c_start_transfer(s->i2c_bus, in_data[2] >> 1, in_data[2] & 1)) {
+ i2c_end_transfer(s->i2c_bus);
+ return false;
+ }
+ for (i = 0; i < 5; i++) {
+ if (i2c_send_recv(s->i2c_bus, &out_data[i], in_data[2] & 1)) {
+ i2c_end_transfer(s->i2c_bus);
+ return false;
+ }
+ }
+ *out_len = i;
+ i2c_end_transfer(s->i2c_bus);
+ } else {
+ for (i = 0; i < in_len - 3; i++) {
+ data = in_data[3 + i];
+ if (i2c_send_recv(s->i2c_bus, &data, in_data[2] & 1)) {
+ i2c_end_transfer(s->i2c_bus);
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
static const CudaCommand handlers[] = {
{ CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
{ CUDA_SET_AUTO_RATE, "SET_AUTO_RATE", cuda_cmd_set_autorate },
@@ -382,6 +452,8 @@ static const CudaCommand handlers[] = {
cuda_cmd_set_power_message },
{ CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
{ CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time },
+ { CUDA_GET_SET_IIC, "GET_SET_IIC", cuda_cmd_get_set_iic },
+ { CUDA_COMBINED_FORMAT_IIC, "COMBINED_FORMAT_IIC", cuda_cmd_combined_iic },
};
static void cuda_receive_packet(CUDAState *s,
@@ -549,6 +621,7 @@ static void cuda_init(Object *obj)
{
CUDAState *s = CUDA(obj);
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+ DeviceState *dev = DEVICE(obj);
object_initialize_child(obj, "mos6522-cuda", &s->mos6522_cuda,
TYPE_MOS6522_CUDA);
@@ -557,7 +630,8 @@ static void cuda_init(Object *obj)
sysbus_init_mmio(sbd, &s->mem);
qbus_create_inplace(&s->adb_bus, sizeof(s->adb_bus), TYPE_ADB_BUS,
- DEVICE(obj), "adb.0");
+ dev, "adb.0");
+ s->i2c_bus = i2c_init_bus(dev, "i2c");
}
static Property cuda_properties[] = {
diff --git a/include/hw/misc/macio/cuda.h b/include/hw/misc/macio/cuda.h
index a8cf0be1ec..6856ed7704 100644
--- a/include/hw/misc/macio/cuda.h
+++ b/include/hw/misc/macio/cuda.h
@@ -79,6 +79,7 @@ typedef struct CUDAState {
ADBBusState adb_bus;
MOS6522CUDAState mos6522_cuda;
+ I2CBus *i2c_bus;
uint32_t tick_offset;
uint64_t tb_frequency;
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 08/11] mac_oldworld: Add machine ID register
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (3 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 11/11] mac_oldworld: Add SPD data to cover RAM BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 05/11] grackle: Set revision in PCI config to match hardware BALATON Zoltan
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
The G3 beige machine has a machine ID register that is accessed by the
firmware to deternine the board config. Add basic emulation of it.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
v6: Make MemoryRegionOps static const
v4: Move MermoryRegion to MachineState, use constants
hw/ppc/mac.h | 1 +
hw/ppc/mac_oldworld.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 58ae5a2226..75f1853a7b 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -69,6 +69,7 @@ typedef struct HeathrowMachineState {
/*< private >*/
MachineState parent;
+ MemoryRegion machine_id;
PCIDevice *macio;
} HeathrowMachineState;
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 13562e26e6..8fbddba4eb 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -52,6 +52,9 @@
#define MAX_IDE_BUS 2
#define CFG_ADDR 0xf0000510
+#define MACHINE_ID_ADDR 0xff000004
+#define MACHINE_ID_VAL 0x3d8c
+
#define TBFREQ 16600000UL
#define CLOCKFREQ 266000000UL
#define BUSFREQ 66000000UL
@@ -89,6 +92,22 @@ static void ppc_heathrow_cpu_reset(void *opaque)
cpu_reset(CPU(cpu));
}
+static uint64_t machine_id_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return (addr == 0 && size == 2 ? MACHINE_ID_VAL : 0);
+}
+
+static void machine_id_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+ return;
+}
+
+static const MemoryRegionOps machine_id_reg_ops = {
+ .read = machine_id_read,
+ .write = machine_id_write,
+};
+
static void ppc_heathrow_init(MachineState *machine)
{
HeathrowMachineState *hm = HEATHROW_MACHINE(machine);
@@ -239,6 +258,11 @@ static void ppc_heathrow_init(MachineState *machine)
}
}
+ memory_region_init_io(&hm->machine_id, OBJECT(machine),
+ &machine_id_reg_ops, NULL, "machine_id", 2);
+ memory_region_add_subregion(get_system_memory(), MACHINE_ID_ADDR,
+ &hm->machine_id);
+
/* XXX: we register only 1 output pin for heathrow PIC */
pic_dev = qdev_new(TYPE_HEATHROW);
sysbus_realize_and_unref(SYS_BUS_DEVICE(pic_dev), &error_fatal);
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 09/11] i2c: Match parameters of i2c_start_transfer and i2c_send_recv
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 01/11] mac_oldworld: Allow loading binary ROM image BALATON Zoltan
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
These functions have a parameter that decides the direction of
transfer but totally confusingly they don't match but inverted sense.
To avoid frequent mistakes when using these functions change
i2c_send_recv to match i2c_start_transfer. Also use bool in
i2c_start_transfer instead of int to match i2c_send_recv.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
This probably won't be the solution accepted as Philippe has an
alternative series fixing this problem here:
https://lists.nongnu.org/archive/html/qemu-devel/2020-06/msg07022.html
but until that or something else is merged this will do for the next
patch. When this gets sorted out I'll send a rebased version.
hw/display/sm501.c | 2 +-
hw/i2c/core.c | 34 +++++++++++++++++-----------------
hw/i2c/ppc4xx_i2c.c | 2 +-
include/hw/i2c/i2c.h | 4 ++--
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index a7fc08c52b..e714674681 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1041,7 +1041,7 @@ static void sm501_i2c_write(void *opaque, hwaddr addr, uint64_t value,
s->i2c_byte_count + 1, s->i2c_addr >> 1);
for (i = 0; i <= s->i2c_byte_count; i++) {
res = i2c_send_recv(s->i2c_bus, &s->i2c_data[i],
- !(s->i2c_addr & 1));
+ s->i2c_addr & 1);
if (res) {
SM501_DPRINTF("sm501 i2c : transfer failed"
" i=%d, res=%d\n", i, res);
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index acf34a12d6..0303fefeaf 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -91,7 +91,7 @@ int i2c_bus_busy(I2CBus *bus)
* without releasing the bus. If that fails, the bus is still
* in a transaction.
*/
-int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)
+int i2c_start_transfer(I2CBus *bus, uint8_t address, bool recv)
{
BusChild *kid;
I2CSlaveClass *sc;
@@ -175,26 +175,14 @@ void i2c_end_transfer(I2CBus *bus)
bus->broadcast = false;
}
-int i2c_send_recv(I2CBus *bus, uint8_t *data, bool send)
+int i2c_send_recv(I2CBus *bus, uint8_t *data, bool recv)
{
I2CSlaveClass *sc;
I2CSlave *s;
I2CNode *node;
int ret = 0;
- if (send) {
- QLIST_FOREACH(node, &bus->current_devs, next) {
- s = node->elt;
- sc = I2C_SLAVE_GET_CLASS(s);
- if (sc->send) {
- trace_i2c_send(s->address, *data);
- ret = ret || sc->send(s, *data);
- } else {
- ret = -1;
- }
- }
- return ret ? -1 : 0;
- } else {
+ if (recv) {
ret = 0xff;
if (!QLIST_EMPTY(&bus->current_devs) && !bus->broadcast) {
sc = I2C_SLAVE_GET_CLASS(QLIST_FIRST(&bus->current_devs)->elt);
@@ -206,19 +194,31 @@ int i2c_send_recv(I2CBus *bus, uint8_t *data, bool send)
}
*data = ret;
return 0;
+ } else {
+ QLIST_FOREACH(node, &bus->current_devs, next) {
+ s = node->elt;
+ sc = I2C_SLAVE_GET_CLASS(s);
+ if (sc->send) {
+ trace_i2c_send(s->address, *data);
+ ret = ret || sc->send(s, *data);
+ } else {
+ ret = -1;
+ }
+ }
+ return ret ? -1 : 0;
}
}
int i2c_send(I2CBus *bus, uint8_t data)
{
- return i2c_send_recv(bus, &data, true);
+ return i2c_send_recv(bus, &data, false);
}
uint8_t i2c_recv(I2CBus *bus)
{
uint8_t data = 0xff;
- i2c_send_recv(bus, &data, false);
+ i2c_send_recv(bus, &data, true);
return data;
}
diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c
index c0a8e04567..d3899203a4 100644
--- a/hw/i2c/ppc4xx_i2c.c
+++ b/hw/i2c/ppc4xx_i2c.c
@@ -239,7 +239,7 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr addr, uint64_t value,
}
}
if (!(i2c->sts & IIC_STS_ERR) &&
- i2c_send_recv(i2c->bus, &i2c->mdata[i], !recv)) {
+ i2c_send_recv(i2c->bus, &i2c->mdata[i], recv)) {
i2c->sts |= IIC_STS_ERR;
i2c->extsts |= IIC_EXTSTS_XFRA;
break;
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index d6e3d85faf..ad2475d6a2 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -72,10 +72,10 @@ struct I2CBus {
I2CBus *i2c_init_bus(DeviceState *parent, const char *name);
void i2c_set_slave_address(I2CSlave *dev, uint8_t address);
int i2c_bus_busy(I2CBus *bus);
-int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv);
+int i2c_start_transfer(I2CBus *bus, uint8_t address, bool recv);
void i2c_end_transfer(I2CBus *bus);
void i2c_nack(I2CBus *bus);
-int i2c_send_recv(I2CBus *bus, uint8_t *data, bool send);
+int i2c_send_recv(I2CBus *bus, uint8_t *data, bool recv);
int i2c_send(I2CBus *bus, uint8_t data);
uint8_t i2c_recv(I2CBus *bus);
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 06/11] mac_oldworld: Rename ppc_heathrow_reset to ppc_heathrow_cpu_reset
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (7 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 03/11] mac_oldworld: Drop a variable, use get_system_memory() directly BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 04/11] mac_oldworld: Drop some variables BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 02/11] mac_newworld: Allow loading binary ROM image BALATON Zoltan
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
This function resets a CPU not the whole machine so reflect that in
its name.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/ppc/mac_oldworld.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 4200008851..f97f241e0c 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -73,7 +73,7 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
}
-static void ppc_heathrow_reset(void *opaque)
+static void ppc_heathrow_cpu_reset(void *opaque)
{
PowerPCCPU *cpu = opaque;
@@ -112,7 +112,7 @@ static void ppc_heathrow_init(MachineState *machine)
/* Set time-base frequency to 16.6 Mhz */
cpu_ppc_tb_init(env, TBFREQ);
- qemu_register_reset(ppc_heathrow_reset, cpu);
+ qemu_register_reset(ppc_heathrow_cpu_reset, cpu);
}
/* allocate RAM */
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 11/11] mac_oldworld: Add SPD data to cover RAM
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
` (2 preceding siblings ...)
2020-06-28 18:03 ` [PATCH v6 07/11] mac_oldworld: Map macio to expected address at reset BALATON Zoltan
@ 2020-06-28 18:03 ` BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 08/11] mac_oldworld: Add machine ID register BALATON Zoltan
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BALATON Zoltan @ 2020-06-28 18:03 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Howard Spoelstra, Mark Cave-Ayland, David Gibson
OpenBIOS gets RAM size via fw_cfg but rhe original board firmware
detects RAM using SPD data so generate and add SDP eeproms to cover as
much RAM as possible to describe with SPD (this may be less than the
actual ram_size due to SDRAM size constraints).
This patch is more complex as it should be which I intend to fix once
agreement can be made on how to get back the necessary functionality
removed by previous patches. See in this thread:
https://lists.nongnu.org/archive/html/qemu-devel/2020-06/msg08710.html
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/ppc/mac_oldworld.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 8fbddba4eb..5ad54370d0 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -34,6 +34,7 @@
#include "hw/input/adb.h"
#include "sysemu/sysemu.h"
#include "net/net.h"
+#include "hw/i2c/smbus_eeprom.h"
#include "hw/isa/isa.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_host.h"
@@ -133,6 +134,8 @@ static void ppc_heathrow_init(MachineState *machine)
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
void *fw_cfg;
uint64_t tbfreq;
+ uint8_t *spd_data[3] = {};
+ I2CBus *i2c_bus;
/* init CPUs */
for (i = 0; i < smp_cpus; i++) {
@@ -150,8 +153,16 @@ static void ppc_heathrow_init(MachineState *machine)
"maximum 2047 MB", ram_size / MiB);
exit(1);
}
-
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
+ for (i = 0; i < 3; i++) {
+ int size_left = ram_size - i * 512 * MiB;
+ if (size_left > 0) {
+ uint32_t s = size_left / MiB;
+ s = (s > 512 ? 512 : s);
+ s = 1U << (31 - clz32(s));
+ spd_data[i] = spd_data_generate(SDR, s * MiB);
+ }
+ }
/* allocate and load firmware ROM */
memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", PROM_SIZE,
@@ -337,6 +348,12 @@ static void ppc_heathrow_init(MachineState *machine)
macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);
dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
+ i2c_bus = I2C_BUS(qdev_get_child_bus(dev, "i2c"));
+ for (i = 0; i < 3; i++) {
+ if (spd_data[i]) {
+ smbus_eeprom_init_one(i2c_bus, 0x50 + i, spd_data[i]);
+ }
+ }
adb_bus = qdev_get_child_bus(dev, "adb.0");
dev = qdev_new(TYPE_ADB_KEYBOARD);
qdev_realize_and_unref(dev, adb_bus, &error_fatal);
--
2.21.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-06-28 18:28 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-28 18:03 [PATCH v6 00/11] Mac Old World ROM experiment BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 09/11] i2c: Match parameters of i2c_start_transfer and i2c_send_recv BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 01/11] mac_oldworld: Allow loading binary ROM image BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 07/11] mac_oldworld: Map macio to expected address at reset BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 11/11] mac_oldworld: Add SPD data to cover RAM BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 08/11] mac_oldworld: Add machine ID register BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 05/11] grackle: Set revision in PCI config to match hardware BALATON Zoltan
2020-06-28 18:03 ` [RFC PATCH v6 10/11] WIP macio/cuda: Attempt to add i2c support BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 03/11] mac_oldworld: Drop a variable, use get_system_memory() directly BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 06/11] mac_oldworld: Rename ppc_heathrow_reset to ppc_heathrow_cpu_reset BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 04/11] mac_oldworld: Drop some variables BALATON Zoltan
2020-06-28 18:03 ` [PATCH v6 02/11] mac_newworld: Allow loading binary ROM image BALATON Zoltan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).