[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [patch 1/2] Use test_pci_slot() to test if a php slot is valid, in use or free
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |