From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKzzy-0004gy-1p for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:52:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKzzx-0004gZ-Gf for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:52:53 -0500 Received: from [199.232.76.173] (port=56692 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKzzx-0004gW-CS for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:52:53 -0500 Received: from savannah.gnu.org ([199.232.41.3]:45470 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LKzzx-0007bs-1h for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:52:53 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LKzzw-0004SU-J7 for qemu-devel@nongnu.org; Thu, 08 Jan 2009 18:52:52 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LKzzw-0004SQ-DJ for qemu-devel@nongnu.org; Thu, 08 Jan 2009 18:52:52 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Thu, 08 Jan 2009 18:52:52 +0000 Subject: [Qemu-devel] [6234] Improve PCI debug support Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6234 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6234 Author: blueswir1 Date: 2009-01-08 18:52:52 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Improve PCI debug support Modified Paths: -------------- trunk/hw/pci_host.h Modified: trunk/hw/pci_host.h =================================================================== --- trunk/hw/pci_host.h 2009-01-08 18:48:12 UTC (rev 6233) +++ trunk/hw/pci_host.h 2009-01-08 18:52:52 UTC (rev 6234) @@ -25,6 +25,16 @@ /* Worker routines for a PCI host controller that uses an {address,data} register pair to access PCI configuration space. */ +/* debug PCI */ +//#define DEBUG_PCI + +#ifdef DEBUG_PCI +#define PCI_DPRINTF(fmt, args...) \ +do { printf("pci_host_data: " fmt , ##args); } while (0) +#else +#define PCI_DPRINTF(fmt, args...) +#endif + typedef struct { uint32_t config_reg; PCIBus *bus; @@ -33,6 +43,9 @@ static void pci_host_data_writeb(void* opaque, pci_addr_t addr, uint32_t val) { PCIHostState *s = opaque; + + PCI_DPRINTF("writeb addr " TARGET_FMT_plx " val %x\n", + (target_phys_addr_t)addr, val); if (s->config_reg & (1u << 31)) pci_data_write(s->bus, s->config_reg | (addr & 3), val, 1); } @@ -43,6 +56,8 @@ #ifdef TARGET_WORDS_BIGENDIAN val = bswap16(val); #endif + PCI_DPRINTF("writew addr " TARGET_FMT_plx " val %x\n", + (target_phys_addr_t)addr, val); if (s->config_reg & (1u << 31)) pci_data_write(s->bus, s->config_reg | (addr & 3), val, 2); } @@ -53,6 +68,8 @@ #ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val); #endif + PCI_DPRINTF("writel addr " TARGET_FMT_plx " val %x\n", + (target_phys_addr_t)addr, val); if (s->config_reg & (1u << 31)) pci_data_write(s->bus, s->config_reg, val, 4); } @@ -60,9 +77,14 @@ static uint32_t pci_host_data_readb(void* opaque, pci_addr_t addr) { PCIHostState *s = opaque; + uint32_t val; + if (!(s->config_reg & (1 << 31))) return 0xff; - return pci_data_read(s->bus, s->config_reg | (addr & 3), 1); + val = pci_data_read(s->bus, s->config_reg | (addr & 3), 1); + PCI_DPRINTF("readb addr " TARGET_FMT_plx " val %x\n", + (target_phys_addr_t)addr, val); + return val; } static uint32_t pci_host_data_readw(void* opaque, pci_addr_t addr) @@ -72,6 +94,8 @@ if (!(s->config_reg & (1 << 31))) return 0xffff; val = pci_data_read(s->bus, s->config_reg | (addr & 3), 2); + PCI_DPRINTF("readw addr " TARGET_FMT_plx " val %x\n", + (target_phys_addr_t)addr, val); #ifdef TARGET_WORDS_BIGENDIAN val = bswap16(val); #endif @@ -85,6 +109,8 @@ if (!(s->config_reg & (1 << 31))) return 0xffffffff; val = pci_data_read(s->bus, s->config_reg | (addr & 3), 4); + PCI_DPRINTF("readl addr " TARGET_FMT_plx " val %x\n", + (target_phys_addr_t)addr, val); #ifdef TARGET_WORDS_BIGENDIAN val = bswap32(val); #endif