From patchwork Mon Oct 12 09:59:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 53087 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9CA73rc018388 for ; Mon, 12 Oct 2009 10:07:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755774AbZJLKCP (ORCPT ); Mon, 12 Oct 2009 06:02:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755666AbZJLKCP (ORCPT ); Mon, 12 Oct 2009 06:02:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27987 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754588AbZJLKCO (ORCPT ); Mon, 12 Oct 2009 06:02:14 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9CA1amt017359; Mon, 12 Oct 2009 06:01:36 -0400 Received: from redhat.com (vpn-10-53.str.redhat.com [10.32.10.53]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9CA1XoT006144; Mon, 12 Oct 2009 06:01:34 -0400 Date: Mon, 12 Oct 2009 11:59:29 +0200 From: "Michael S. Tsirkin" To: "Kevin O'Connor" Cc: avi@redhat.com, Anthony Liguori , "qemu-devel@nongnu.org" , kvm-devel Subject: [PATCHv2] seabios: enable io/memory unconditionally Message-ID: <20091012095929.GA12330@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/src/pciinit.c b/src/pciinit.c index 0d558a9..db70560 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -28,7 +28,6 @@ static u8 pci_irqs[4] = { static void pci_set_io_region_addr(u16 bdf, int region_num, u32 addr) { - u16 cmd; u32 ofs, old_addr; if (region_num == PCI_ROM_SLOT) { @@ -41,16 +40,6 @@ static void pci_set_io_region_addr(u16 bdf, int region_num, u32 addr) pci_config_writel(bdf, ofs, addr); dprintf(1, "region %d: 0x%08x\n", region_num, addr); - - /* enable memory mappings */ - cmd = pci_config_readw(bdf, PCI_COMMAND); - if (region_num == PCI_ROM_SLOT) - cmd |= PCI_COMMAND_MEMORY; - else if (old_addr & PCI_BASE_ADDRESS_SPACE_IO) - cmd |= PCI_COMMAND_IO; - else - cmd |= PCI_COMMAND_MEMORY; - pci_config_writew(bdf, PCI_COMMAND, cmd); } /* return the global irq number corresponding to a given device irq @@ -95,6 +84,7 @@ static void pci_bios_init_device(u16 bdf) { int class; u32 *paddr; + u16 cmd; int i, pin, pic_irq, vendor_id, device_id; class = pci_config_readw(bdf, PCI_CLASS_DEVICE); @@ -165,6 +155,11 @@ static void pci_bios_init_device(u16 bdf) break; } + /* enable memory mappings */ + cmd = pci_config_readw(bdf, PCI_COMMAND); + cmd |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY; + pci_config_writew(bdf, PCI_COMMAND, cmd); + /* map the interrupt */ pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN); if (pin != 0) {