From patchwork Sat Nov 2 16:03:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 288010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CA0652C0082 for ; Sun, 3 Nov 2013 03:06:26 +1100 (EST) Received: from localhost ([::1]:42545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcdiS-0007wm-S9 for incoming@patchwork.ozlabs.org; Sat, 02 Nov 2013 12:06:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vcdhx-0007ny-1H for qemu-devel@nongnu.org; Sat, 02 Nov 2013 12:05:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vcdhq-00086W-4U for qemu-devel@nongnu.org; Sat, 02 Nov 2013 12:05:52 -0400 Received: from p15195424.pureserver.info ([82.165.34.74]:51364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vcdhp-00086R-Rn for qemu-devel@nongnu.org; Sat, 02 Nov 2013 12:05:46 -0400 Received: from [149.241.34.189] (helo=kentang.lan) by p15195424.pureserver.info with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.43) id 1Vcdho-0004cc-Nw; Sat, 02 Nov 2013 16:05:45 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org Date: Sat, 2 Nov 2013 16:03:52 +0000 Message-Id: <1383408232-22540-4-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1383408232-22540-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1383408232-22540-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 149.241.34.189 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.1 (built Wed, 05 Jan 2005 10:54:05 -0500) X-SA-Exim-Scanned: Yes (on p15195424.pureserver.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 82.165.34.74 Cc: Blue Swirl , Bob Breuer , Mark Cave-Ayland , Artyom Tarasenko , aliguori@amazon.com Subject: [Qemu-devel] [PATCH for-1.7 3/3] sun4m: Add Sun CG3 framebuffer initialisation function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In order to allow the user to choose the framebuffer for sparc-softmmu, add -vga tcx and -vga cg3 options to the QEMU command line. If no option is specified, the default TCX framebuffer is used. Signed-off-by: Mark Cave-Ayland CC: Blue Swirl CC: Bob Breuer CC: Artyom Tarasenko --- hw/sparc/sun4m.c | 60 +++++++++++++++++++++++++++++++++++++++++++++-- include/sysemu/sysemu.h | 1 + vl.c | 24 +++++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 94f7950..4c6c450 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -561,6 +561,31 @@ static void tcx_init(hwaddr addr, int vram_size, int width, } } +static void cg3_init(hwaddr addr, qemu_irq irq, int vram_size, int width, + int height, int depth) +{ + DeviceState *dev; + SysBusDevice *s; + + dev = qdev_create(NULL, "SUNW,cgthree"); + qdev_prop_set_uint32(dev, "vram_size", vram_size); + qdev_prop_set_uint16(dev, "width", width); + qdev_prop_set_uint16(dev, "height", height); + qdev_prop_set_uint16(dev, "depth", depth); + qdev_prop_set_uint64(dev, "prom_addr", addr); + qdev_init_nofail(dev); + s = SYS_BUS_DEVICE(dev); + + /* FCode ROM */ + sysbus_mmio_map(s, 0, addr); + /* DAC */ + sysbus_mmio_map(s, 1, addr + 0x400000ULL); + /* 8-bit plane */ + sysbus_mmio_map(s, 2, addr + 0x800000ULL); + + sysbus_connect_irq(s, 0, irq); +} + /* NCR89C100/MACIO Internal ID register */ #define TYPE_MACIO_ID_REGISTER "macio_idreg" @@ -918,8 +943,39 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, } num_vsimms = 0; if (num_vsimms == 0) { - tcx_init(hwdef->tcx_base, 0x00100000, graphic_width, graphic_height, - graphic_depth); + if (vga_interface_type == VGA_CG3) { + if (graphic_depth != 8) { + fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth); + exit(1); + } + + if (!(graphic_width == 1024 && graphic_height == 768) && + !(graphic_width == 1152 && graphic_height == 900)) { + fprintf(stderr, "qemu: Unsupported resolution: %d x %d\n", + graphic_width, graphic_height); + exit(1); + } + + /* sbus irq 5 */ + cg3_init(hwdef->tcx_base, slavio_irq[11], 0x00100000, + graphic_width, graphic_height, graphic_depth); + } else { + /* If no display specified, default to TCX */ + if (graphic_depth != 8 && graphic_depth != 24) { + fprintf(stderr, "qemu: Unsupported depth: %d\n", + graphic_depth); + exit(1); + } + + if (!(graphic_width == 1024 && graphic_height == 768)) { + fprintf(stderr, "qemu: Unsupported resolution: %d x %d\n", + graphic_width, graphic_height); + exit(1); + } + + tcx_init(hwdef->tcx_base, 0x00100000, graphic_width, graphic_height, + graphic_depth); + } } for (i = num_vsimms; i < MAX_VSIMMS; i++) { diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index cd5791e..2698f6d 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -104,6 +104,7 @@ extern int autostart; typedef enum { VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, + VGA_TCX, VGA_CG3, } VGAInterfaceType; extern int vga_interface_type; diff --git a/vl.c b/vl.c index efbff65..e11f4cf 100644 --- a/vl.c +++ b/vl.c @@ -2082,6 +2082,16 @@ static bool qxl_vga_available(void) return object_class_by_name("qxl-vga"); } +static bool tcx_vga_available(void) +{ + return object_class_by_name("SUNW,tcx"); +} + +static bool cg3_vga_available(void) +{ + return object_class_by_name("SUNW,cgthree"); +} + static void select_vgahw (const char *p) { const char *opts; @@ -2117,6 +2127,20 @@ static void select_vgahw (const char *p) fprintf(stderr, "Error: QXL VGA not available\n"); exit(0); } + } else if (strstart(p, "tcx", &opts)) { + if (tcx_vga_available()) { + vga_interface_type = VGA_TCX; + } else { + fprintf(stderr, "Error: TCX framebuffer not available\n"); + exit(0); + } + } else if (strstart(p, "cg3", &opts)) { + if (cg3_vga_available()) { + vga_interface_type = VGA_CG3; + } else { + fprintf(stderr, "Error: CG3 framebuffer not available\n"); + exit(0); + } } else if (!strstart(p, "none", &opts)) { invalid_vga: fprintf(stderr, "Unknown vga type: %s\n", p);