WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch 1/2] Use test_pci_slot() to test if a php slot is val

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 1/2] Use test_pci_slot() to test if a php slot is valid, in use or free
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Fri, 20 Mar 2009 11:38:43 +1100
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Delivery-date: Thu, 19 Mar 2009 17:48:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090320003842.921703273@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

--- 

 hw/pass-through.c |    8 ++++----
 hw/piix4acpi.c    |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

Index: ioemu-remote/hw/pass-through.c
===================================================================
--- ioemu-remote.orig/hw/pass-through.c 2009-03-12 20:29:06.000000000 +1100
+++ ioemu-remote/hw/pass-through.c      2009-03-13 17:51:06.000000000 +1100
@@ -833,7 +833,7 @@ static int __insert_to_pci_slot(int bus,
     if ( slot >= PHP_SLOT_START && slot < PHP_SLOT_END )
     {
         php_slot = PCI_TO_PHP_SLOT(slot);
-        if ( !dpci_infos.php_devs[php_slot].valid )
+        if ( !test_pci_slot(slot) )
         {
             goto found;
         }
@@ -847,7 +847,7 @@ static int __insert_to_pci_slot(int bus,
     /* slot == 0, pick up a free one */
     for ( i = 0; i < PHP_SLOT_LEN; i++ )
     {
-        if ( !dpci_infos.php_devs[i].valid )
+        if ( !test_pci_slot(PHP_TO_PCI_SLOT(i)) )
         {
             php_slot = i;
             goto found;
@@ -3728,13 +3728,13 @@ int unregister_real_device(int php_slot)
     uint32_t bdf = 0;
     int rc = -1;
 
-    if ( php_slot < 0 || php_slot >= PHP_SLOT_LEN )
+    if ( test_pci_slot(PHP_TO_PCI_SLOT(php_slot)) != 1 )
        return -1;
 
     php_dev = &dpci_infos.php_devs[php_slot];
     assigned_device = php_dev->pt_dev;
 
-    if ( !assigned_device || !php_dev->valid )
+    if ( !assigned_device )
         return -1;
 
     pci_dev = assigned_device->pci_dev;
Index: ioemu-remote/hw/piix4acpi.c
===================================================================
--- ioemu-remote.orig/hw/piix4acpi.c    2009-03-12 20:29:06.000000000 +1100
+++ ioemu-remote/hw/piix4acpi.c 2009-03-13 17:49:44.000000000 +1100
@@ -454,7 +454,7 @@ void acpi_php_del(int pci_slot)
     GPEState *s = &gpe_state;
     int php_slot = PCI_TO_PHP_SLOT(pci_slot);
 
-    if ( pci_slot < PHP_SLOT_START || pci_slot >= PHP_SLOT_END ) {
+    if ( test_pci_slot(pci_slot) < 0 ) {
         fprintf(logfile, "not find the pci slot %d when hot remove.\n", 
pci_slot);
 
         return;

-- 

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>