[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 7/9] macio: Add dummy screamer register area
From: |
BALATON Zoltan |
Subject: |
[PATCH v4 7/9] macio: Add dummy screamer register area |
Date: |
Sun, 14 Jun 2020 20:13:19 +0200 |
The only thing this returns is an idle status so the firmware
continues, otherwise just ignores and logs access for debugging. This
is a stop gap until proper implementation of this device lands.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
This could be reverted as the first patch of a series adding real
implementation so it should not cause much trouble. Or in case it's
found that firmware continues once SPD data is available this patch
may not be needed.
hw/misc/macio/macio.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 3779865ab2..dbc3df9ab1 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
+#include "qemu/log.h"
#include "hw/ppc/mac.h"
#include "hw/misc/macio/cuda.h"
#include "hw/pci/pci.h"
@@ -103,6 +104,33 @@ static void macio_init_child_obj(MacIOState *s, const char
*childname,
qdev_set_parent_bus(DEVICE(child), BUS(&s->macio_bus));
}
+#define AWAC_CODEC_STATUS_REG 0x20
+
+#define AWAC_MAKER_CRYSTAL 1
+#define AWAC_REV_SCREAMER 3
+#define AWAC_VALID_DATA 0x40
+
+static uint64_t screamer_read(void *opaque, hwaddr addr, unsigned size)
+{
+ qemu_log_mask(LOG_UNIMP,
+ "macio: screamer read %" HWADDR_PRIx " %d\n", addr, size);
+ return (addr == AWAC_CODEC_STATUS_REG ? AWAC_VALID_DATA << 8 |
+ AWAC_MAKER_CRYSTAL << 16 | AWAC_REV_SCREAMER << 20 : 0);
+}
+
+static void screamer_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
+{
+ qemu_log_mask(LOG_UNIMP,
+ "macio: screamer write %" HWADDR_PRIx " %d = %"PRIx64"\n",
+ addr, size, val);
+}
+
+const MemoryRegionOps screamer_ops = {
+ .read = screamer_read,
+ .write = screamer_write,
+};
+
static void macio_common_realize(PCIDevice *d, Error **errp)
{
MacIOState *s = MACIO(d);
@@ -158,6 +186,7 @@ static void macio_oldworld_realize(PCIDevice *d, Error
**errp)
DeviceState *pic_dev = DEVICE(os->pic);
Error *err = NULL;
SysBusDevice *sysbus_dev;
+ MemoryRegion *screamer = g_new(MemoryRegion, 1);
macio_common_realize(d, &err);
if (err) {
@@ -217,6 +246,11 @@ static void macio_oldworld_realize(PCIDevice *d, Error
**errp)
error_propagate(errp, err);
return;
}
+
+ /* Dummy screamer sound device */
+ memory_region_init_io(screamer, OBJECT(d), &screamer_ops, NULL,
+ "screamer", 0x2000);
+ memory_region_add_subregion(&s->bar, 0x14000, screamer);
}
static void macio_init_ide(MacIOState *s, MACIOIDEState *ide, size_t ide_size,
--
2.21.3
- [PATCH v4 0/9] Mac Old World ROM experiment, BALATON Zoltan, 2020/06/14
- [PATCH v4 6/9] mac_oldworld: Add machine ID register, BALATON Zoltan, 2020/06/14
- [PATCH v4 5/9] mac_oldworld: Map macio to expected address at reset, BALATON Zoltan, 2020/06/14
- [PATCH v4 1/9] mac_oldworld: Allow loading binary ROM image, BALATON Zoltan, 2020/06/14
- [PATCH v4 4/9] mac_oldworld: Rename ppc_heathrow_reset to ppc_heathrow_cpu_reset, BALATON Zoltan, 2020/06/14
- [PATCH v4 2/9] mac_newworld: Allow loading binary ROM image, BALATON Zoltan, 2020/06/14
- [PATCH v4 9/9] mac_oldworld: Add SPD data to cover RAM, BALATON Zoltan, 2020/06/14
- [PATCH v4 7/9] macio: Add dummy screamer register area,
BALATON Zoltan <=
- [PATCH v4 8/9] WIP RFC macio/cuda: Attempt to add i2c support, BALATON Zoltan, 2020/06/14
- [PATCH v4 3/9] grackle: Set revision in PCI config to match hardware, BALATON Zoltan, 2020/06/14