From patchwork Tue Jun 16 13:47:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 1310431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=eik.bme.hu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49mVCW4Snpz9sTZ for ; Tue, 16 Jun 2020 23:58:15 +1000 (AEST) Received: from localhost ([::1]:43588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlC6P-0002Tm-9y for incoming@patchwork.ozlabs.org; Tue, 16 Jun 2020 09:58:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlC1o-00024q-4Y; Tue, 16 Jun 2020 09:53:28 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:36216) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlC1l-0002Py-GR; Tue, 16 Jun 2020 09:53:27 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 60546748DCB; Tue, 16 Jun 2020 15:53:18 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id D0C40748DD8; Tue, 16 Jun 2020 15:53:17 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v5 09/11] macio: Add dummy screamer register area Date: Tue, 16 Jun 2020 15:47:06 +0200 MIME-Version: 1.0 To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org X-Spam-Probability: 8% Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 09:53:23 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Howard Spoelstra , Mark Cave-Ayland , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 8ba7af073c..c7e8556ca6 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" @@ -94,6 +95,33 @@ static void macio_bar_setup(MacIOState *s) macio_escc_legacy_setup(s); } +#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); @@ -149,6 +177,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) { @@ -208,6 +237,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, int index)