From patchwork Tue Sep 11 19:10:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 183190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B6B602C0088 for ; Wed, 12 Sep 2012 06:11:13 +1000 (EST) Received: from localhost ([::1]:46219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBWnf-0005wt-M0 for incoming@patchwork.ozlabs.org; Tue, 11 Sep 2012 16:11:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBWnQ-0005qk-1k for qemu-devel@nongnu.org; Tue, 11 Sep 2012 16:10:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBWnJ-0006o3-NE for qemu-devel@nongnu.org; Tue, 11 Sep 2012 16:10:55 -0400 Received: from hall.aurel32.net ([88.191.126.93]:45853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBWnJ-0006nw-ER for qemu-devel@nongnu.org; Tue, 11 Sep 2012 16:10:49 -0400 Received: from [37.160.6.220] (helo=ohm.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TBWVj-0005ZT-Hg; Tue, 11 Sep 2012 21:52:39 +0200 Received: from aurel32 by ohm.aurel32.net with local (Exim 4.80) (envelope-from ) id 1TBVrB-0004sn-6N; Tue, 11 Sep 2012 21:10:45 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Tue, 11 Sep 2012 21:10:31 +0200 Message-Id: <1347390642-17434-7-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1347390642-17434-1-git-send-email-aurelien@aurel32.net> References: <1347390642-17434-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.126.93 Cc: Anthony Liguori , Aurelien Jarno Subject: [Qemu-devel] [PATCH v3 06/17] pci: add a pci_vga_init() 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 This function create a PCI VGA device according to the value of vga_interface_type. It returns a PCIDevice (and not a DeviceState). Cc: Anthony Liguori Signed-off-by: Aurelien Jarno --- hw/pci.c | 18 ++++++++++++++++++ hw/pci.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/hw/pci.c b/hw/pci.c index f855cf3..e5cee87 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1474,6 +1474,24 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model, return res; } +PCIDevice *pci_vga_init(PCIBus *bus) +{ + switch (vga_interface_type) { + case VGA_CIRRUS: + return pci_create_simple(bus, -1, "cirrus-vga"); + case VGA_QXL: + return pci_create_simple(bus, -1, "qxl-vga"); + case VGA_STD: + return pci_create_simple(bus, -1, "VGA"); + case VGA_VMWARE: + return pci_create_simple(bus, -1, "vmware-svga"); + case VGA_NONE: + default: /* Other non-PCI types. Checking for unsupported types is already + done in vl.c. */ + return NULL; + } +} + /* Whether a given bus number is in range of the secondary * bus of the given bridge device. */ static bool pci_secondary_bus_in_range(PCIDevice *dev, int bus_num) diff --git a/hw/pci.h b/hw/pci.h index 4b6ab3d..d50d26c 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -334,6 +334,9 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model, const char *default_devaddr); PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model, const char *default_devaddr); + +PCIDevice *pci_vga_init(PCIBus *bus); + int pci_bus_num(PCIBus *s); void pci_for_each_device(PCIBus *bus, int bus_num, void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque),