From patchwork Mon Nov 30 14:17:22 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: 63700 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 nAUEK6BH020629 for ; Mon, 30 Nov 2009 14:20:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752596AbZK3OT6 (ORCPT ); Mon, 30 Nov 2009 09:19:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752546AbZK3OT6 (ORCPT ); Mon, 30 Nov 2009 09:19:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32823 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752042AbZK3OT6 (ORCPT ); Mon, 30 Nov 2009 09:19:58 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAUEK2ax029116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 30 Nov 2009 09:20:02 -0500 Received: from redhat.com (vpn-6-53.tlv.redhat.com [10.35.6.53]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nAUEJx7q019423; Mon, 30 Nov 2009 09:20:00 -0500 Date: Mon, 30 Nov 2009 16:17:22 +0200 From: "Michael S. Tsirkin" To: Avi Kivity Cc: Anthony Liguori , "qemu-devel@nongnu.org" , kvm-devel Subject: [PATCHv2-repost] pcbios: enable io/memory unconditionally Message-ID: <20091130141722.GB25613@redhat.com> References: <20091008155256.GA13660@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091008155256.GA13660@redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/rombios32.c b/rombios32.c index 624f39f..d01b61d 100644 --- a/rombios32.c +++ b/rombios32.c @@ -693,6 +693,7 @@ void smp_probe(void) #define PCI_COMMAND 0x04 /* 16 bits */ #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ +#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ #define PCI_CLASS_DEVICE 0x0a /* Device class */ #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ @@ -760,7 +761,6 @@ static uint32_t pci_config_readb(PCIDevice *d, uint32_t addr) static void pci_set_io_region_addr(PCIDevice *d, int region_num, uint32_t addr) { - uint16_t cmd; uint32_t ofs, old_addr; if ( region_num == PCI_ROM_SLOT ) { @@ -773,16 +773,6 @@ static void pci_set_io_region_addr(PCIDevice *d, int region_num, uint32_t addr) pci_config_writel(d, ofs, addr); BX_INFO("region %d: 0x%08x\n", region_num, addr); - - /* enable memory mappings */ - cmd = pci_config_readw(d, PCI_COMMAND); - if ( region_num == PCI_ROM_SLOT ) - cmd |= 2; - else if (old_addr & PCI_ADDRESS_SPACE_IO) - cmd |= 1; - else - cmd |= 2; - pci_config_writew(d, PCI_COMMAND, cmd); } /* return the global irq number corresponding to a given device irq @@ -939,6 +929,7 @@ static void pci_bios_init_device(PCIDevice *d) { int class; uint32_t *paddr; + uint16_t cmd; int i, pin, pic_irq, vendor_id, device_id; class = pci_config_readw(d, PCI_CLASS_DEVICE); @@ -1016,6 +1007,11 @@ static void pci_bios_init_device(PCIDevice *d) break; } + /* enable memory mappings */ + cmd = pci_config_readw(d, PCI_COMMAND); + cmd |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY; + pci_config_writew(d, PCI_COMMAND, cmd); + /* map the interrupt */ pin = pci_config_readb(d, PCI_INTERRUPT_PIN); if (pin != 0) {