From patchwork Fri Oct 9 06:28:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 35566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B4DDEB7B8E for ; Fri, 9 Oct 2009 17:54:52 +1100 (EST) Received: from localhost ([127.0.0.1]:47383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw9NI-0000cg-P0 for incoming@patchwork.ozlabs.org; Fri, 09 Oct 2009 02:54:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mw90J-00049q-5A for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:31:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mw908-0003w3-4i for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:57 -0400 Received: from [199.232.76.173] (port=55757 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mw907-0003vB-TH for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:51 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:36134) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mw904-0001Q7-Q2 for qemu-devel@nongnu.org; Fri, 09 Oct 2009 02:30:50 -0400 Received: from nm.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with ESMTP id 097DF49E23; Fri, 9 Oct 2009 15:30:40 +0900 (JST) Received: from yamahata by nm.local.valinux.co.jp with local (Exim 4.69) (envelope-from ) id 1Mw8yM-00046k-T7; Fri, 09 Oct 2009 15:29:02 +0900 From: Isaku Yamahata To: qemu-devel@nongnu.org, mst@redhat.com Date: Fri, 9 Oct 2009 15:28:48 +0900 Message-Id: <1255069742-15724-16-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1255069742-15724-1-git-send-email-yamahata@valinux.co.jp> References: <1255069742-15724-1-git-send-email-yamahata@valinux.co.jp> X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH V5 15/29] pci: typedef pcibus_t as uint64_t instead of uint32_t. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch is preliminary for 64bit bar. For 64bit bar support, change pcibus_t which represents pci bus addr/size from uint32_t to uint64_t. And also change FMT_pcibus for printf. In pci_update_mapping() checks 32bit overflow. So the check must be updated too. Signed-off-by: Isaku Yamahata --- hw/pci.c | 9 ++++++++- hw/pci.h | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index c0ae66a..e7f8fb4 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -524,7 +524,14 @@ static void pci_update_mappings(PCIDevice *d) mappings, we handle specific values as invalid mappings. */ if (last_addr <= new_addr || new_addr == 0 || - last_addr == PCI_BAR_UNMAPPED) { + last_addr == PCI_BAR_UNMAPPED || + + /* Now pcibus_t is 64bit. + * Check if 32 bit BAR wrap around explicitly. + * Without this, PC ide doesn't work well. + * TODO: remove this work around. + */ + last_addr >= UINT32_MAX) { new_addr = PCI_BAR_UNMAPPED; } } else { diff --git a/hw/pci.h b/hw/pci.h index 8a187c2..8fbd45e 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -71,8 +71,8 @@ extern target_phys_addr_t pci_mem_base; #define PCI_DEVICE_ID_VIRTIO_BALLOON 0x1002 #define PCI_DEVICE_ID_VIRTIO_CONSOLE 0x1003 -typedef uint32_t pcibus_t; -#define FMT_PCIBUS PRIx32 +typedef uint64_t pcibus_t; +#define FMT_PCIBUS PRIx64 typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, uint32_t address, uint32_t data, int len);