commit f3460ff8f6c53f822c00556c64e5cdc65cf87724
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date: Thu Jun 25 18:31:24 2009 +0100
passthrough: rename slot to devfn
This is the noisy companion to the previous patch "qemu-xen: pass-through:
use devfn instead of slots as the unit for pass-through". It just renames
slot to devfn in various places.
Cc: Dexuan Cui <dexuan.cui@xxxxxxxxx>
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
[4/8; cross-compatibility issues with xen-unstable.hg]
---
hw/pass-through.c | 92 ++++++++++++++++++++++++++--------------------------
hw/pci.h | 10 +++---
hw/piix4acpi.c | 8 ++--
xen-vl-extra.c | 14 ++++----
4 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/hw/pass-through.c b/hw/pass-through.c
index d19fb82..7aa4771 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -831,7 +831,7 @@ static int token_value(char *token)
}
static int parse_bdf(char **str, int *seg, int *bus, int *dev, int *func,
- char **opt, int *vslot)
+ char **opt, int *vdevfn)
{
char *token, *endptr;
const char *delim = ":.";
@@ -855,11 +855,11 @@ static int parse_bdf(char **str, int *seg, int *bus, int
*dev, int *func,
if (*opt)
{
*(*opt)++ = '\0';
- *vslot = token_value(*opt);
+ *vdevfn = token_value(*opt);
}
else
{
- *vslot = AUTO_PHP_DEVFN;
+ *vdevfn = AUTO_PHP_DEVFN;
*opt = token;
}
@@ -892,24 +892,24 @@ static int get_next_keyval(char **option, char **key,
char **val)
return 0;
}
-static int pci_slot_match(int bus, int dev, int func, int slot)
+static int pci_devfn_match(int bus, int dev, int func, int devfn)
{
- if (test_pci_slot(slot) == 1 &&
- dpci_infos.php_devs[slot].r_bus == bus &&
- dpci_infos.php_devs[slot].r_dev == dev &&
- dpci_infos.php_devs[slot].r_func == func )
+ if (test_pci_devfn(devfn) == 1 &&
+ dpci_infos.php_devs[devfn].r_bus == bus &&
+ dpci_infos.php_devs[devfn].r_dev == dev &&
+ dpci_infos.php_devs[devfn].r_func == func )
return 1;
return 0;
}
-/* Insert a new pass-through device into a specific pci slot.
- * input dom:bus:dev.func@slot, chose free one if slot == AUTO_PHP_DEVFN
- * return -2: requested slot not available
- * -1: no free slots
- * >=0: the new hotplug slot
+/* Insert a new pass-through device into a specific pci devfn.
+ * input dom:bus:dev.func@devfn, chose free one if devfn == AUTO_PHP_DEVFN
+ * return -2: requested devfn not available
+ * -1: no free devfns
+ * >=0: the new hotplug devfn
*/
-static int __insert_to_pci_slot(int bus, int dev, int func, int devfn,
- char *opt)
+static int __insert_to_pci_devfn(int bus, int dev, int func, int devfn,
+ char *opt)
{
PCIBus *e_bus = dpci_infos.e_bus;
int slot;
@@ -917,7 +917,7 @@ static int __insert_to_pci_slot(int bus, int dev, int func,
int devfn,
/* preferred virt pci devfn */
if ( devfn != AUTO_PHP_DEVFN )
{
- if ( !test_pci_slot(devfn) && !pci_devfn_in_use(e_bus, devfn) )
+ if ( !test_pci_devfn(devfn) && !pci_devfn_in_use(e_bus, devfn) )
goto found;
return -2;
}
@@ -926,7 +926,7 @@ static int __insert_to_pci_slot(int bus, int dev, int func,
int devfn,
for ( slot = 0; slot < NR_PCI_DEV; slot++ )
{
devfn = PCI_DEVFN(slot, 0);
- if ( !test_pci_slot(devfn) && !pci_devfn_in_use(e_bus, devfn) )
+ if ( !test_pci_devfn(devfn) && !pci_devfn_in_use(e_bus, devfn) )
goto found;
}
@@ -942,54 +942,54 @@ found:
return devfn;
}
-/* Insert a new pass-through device into a specific pci slot.
- * input dom:bus:dev.func@slot
+/* Insert a new pass-through device into a specific pci devfn.
+ * input dom:bus:dev.func@devfn
*/
-int insert_to_pci_slot(char *bdf_slt)
+int insert_to_pci_devfn(char *bdf_slt)
{
- int seg, bus, dev, func, slot;
+ int seg, bus, dev, func, devfn;
char *opt;
- if ( !parse_bdf(&bdf_slt, &seg, &bus, &dev, &func, &opt, &slot) )
+ if ( !parse_bdf(&bdf_slt, &seg, &bus, &dev, &func, &opt, &devfn) )
{
return -1;
}
- return __insert_to_pci_slot(bus, dev, func, slot, opt);
+ return __insert_to_pci_devfn(bus, dev, func, devfn, opt);
}
-/* Test if a pci slot has a PHP device
+/* Test if a pci devfn has a PHP device
* 1: present
* 0: not present
- * -1: invalid pci slot input
+ * -1: invalid pci devfn input
*/
-int test_pci_slot(int slot)
+int test_pci_devfn(int devfn)
{
- if ( slot < 0 || slot >= NR_PCI_DEVFN )
+ if ( devfn < 0 || devfn >= NR_PCI_DEVFN )
return -1;
- if ( dpci_infos.php_devs[slot].valid )
+ if ( dpci_infos.php_devs[devfn].valid )
return 1;
return 0;
}
-/* find the pci slot for pass-through dev with specified BDF */
-int bdf_to_slot(char *bdf_str)
+/* find the pci devfn for pass-through dev with specified BDF */
+int bdf_to_devfn(char *bdf_str)
{
- int seg, bus, dev, func, slot, i;
+ int seg, bus, dev, func, devfn, i;
char *opt;
- if ( !parse_bdf(&bdf_str, &seg, &bus, &dev, &func, &opt, &slot))
+ if ( !parse_bdf(&bdf_str, &seg, &bus, &dev, &func, &opt, &devfn))
{
return -1;
}
- /* locate the virtual pci slot for this VTd device */
+ /* locate the virtual pci devfn for this VTd device */
for ( i = 0; i < NR_PCI_DEVFN; i++ )
{
- if ( pci_slot_match(bus, dev, func, i) )
+ if ( pci_devfn_match(bus, dev, func, i) )
return i;
}
@@ -3960,7 +3960,7 @@ static int pt_pmcsr_reg_restore(struct pt_dev *ptdev,
}
static struct pt_dev * register_real_device(PCIBus *e_bus,
- const char *e_dev_name, int e_slot, uint8_t r_bus, uint8_t r_dev,
+ const char *e_dev_name, int e_devfn, uint8_t r_bus, uint8_t r_dev,
uint8_t r_func, uint32_t machine_irq, struct pci_access *pci_access,
char *opt)
{
@@ -4037,7 +4037,7 @@ static struct pt_dev * register_real_device(PCIBus *e_bus,
/* Register device */
assigned_device = (struct pt_dev *) pci_register_device(e_bus, e_dev_name,
- sizeof(struct pt_dev), e_slot,
+ sizeof(struct pt_dev), e_devfn,
pt_pci_read_config, pt_pci_write_config);
if ( assigned_device == NULL )
{
@@ -4045,7 +4045,7 @@ static struct pt_dev * register_real_device(PCIBus *e_bus,
return NULL;
}
- dpci_infos.php_devs[e_slot].pt_dev = assigned_device;
+ dpci_infos.php_devs[e_devfn].pt_dev = assigned_device;
assigned_device->pci_dev = pci_dev;
assigned_device->msi_trans_cap = msi_translate;
@@ -4145,7 +4145,7 @@ out:
return assigned_device;
}
-static int unregister_real_device(int slot)
+static int unregister_real_device(int devfn)
{
struct php_dev *php_dev;
struct pci_dev *pci_dev;
@@ -4155,10 +4155,10 @@ static int unregister_real_device(int slot)
uint32_t bdf = 0;
int rc = -1;
- if ( test_pci_slot(slot) != 1 )
+ if ( test_pci_devfn(devfn) != 1 )
return -1;
- php_dev = &dpci_infos.php_devs[slot];
+ php_dev = &dpci_infos.php_devs[devfn];
assigned_device = php_dev->pt_dev;
if ( !assigned_device )
@@ -4209,7 +4209,7 @@ static int unregister_real_device(int slot)
pt_iomul_free(assigned_device);
- /* mark this slot as free */
+ /* mark this devfn as free */
php_dev->valid = 0;
php_dev->pt_dev = NULL;
qemu_free(assigned_device);
@@ -4217,14 +4217,14 @@ static int unregister_real_device(int slot)
return 0;
}
-int power_on_php_slot(int slot)
+int power_on_php_devfn(int devfn)
{
- struct php_dev *php_dev = &dpci_infos.php_devs[slot];
+ struct php_dev *php_dev = &dpci_infos.php_devs[devfn];
struct pt_dev *pt_dev;
pt_dev =
register_real_device(dpci_infos.e_bus,
"DIRECT PCI",
- slot,
+ devfn,
php_dev->r_bus,
php_dev->r_dev,
php_dev->r_func,
@@ -4238,9 +4238,9 @@ int power_on_php_slot(int slot)
}
-int power_off_php_slot(int php_slot)
+int power_off_php_devfn(int php_devfn)
{
- return unregister_real_device(php_slot);
+ return unregister_real_device(php_devfn);
}
int pt_init(PCIBus *e_bus)
diff --git a/hw/pci.h b/hw/pci.h
index b5947f3..f9660dc 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -261,11 +261,11 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t
vid, uint16_t did,
#define AUTO_PHP_SLOT NR_PCI_DEV
#define AUTO_PHP_DEVFN NR_PCI_DEVFN
-int insert_to_pci_slot(char*);
-int test_pci_slot(int);
-int bdf_to_slot(char*);
-int power_on_php_slot(int);
-int power_off_php_slot(int);
+int insert_to_pci_devfn(char *bdf_devfn);
+int test_pci_devfn(int devfn);
+int bdf_to_devfn(char *bdf_str);
+int power_on_php_devfn(int devfn);
+int power_off_php_devfn(int devfn);
/* pci_emulation.c */
#include "hw/pci_emulation.h"
diff --git a/hw/piix4acpi.c b/hw/piix4acpi.c
index 836abd5..49c5204 100644
--- a/hw/piix4acpi.c
+++ b/hw/piix4acpi.c
@@ -278,7 +278,7 @@ static void acpi_php_writeb(void *opaque, uint32_t addr,
uint32_t val)
hotplug_slots->plug_slot = 0;
/* power off the slot */
- power_off_php_slot(PCI_DEVFN(slot, 0));
+ power_off_php_devfn(PCI_DEVFN(slot, 0));
/* signal the CP ACPI hot remove done. */
xenstore_record_dm_state("pci-removed");
@@ -318,7 +318,7 @@ static void php_slots_init(void)
/* update the pci slot status */
for ( i = 0; i < NR_PCI_DEV; i++ ) {
- if ( test_pci_slot(i) )
+ if ( test_pci_devfn(i) )
php_slots.status[i] = 0xf;
}
@@ -469,7 +469,7 @@ void acpi_php_del(int devfn)
slot = PCI_SLOT(devfn);
func = PCI_FUNC(devfn);
- if ( test_pci_slot(devfn) < 0 ) {
+ if ( test_pci_devfn(devfn) < 0 ) {
fprintf(logfile, "hot remove: pci slot 0x%02x, function 0x%x "
"is not used by a hotplug device.\n", slot, func);
@@ -537,7 +537,7 @@ void acpi_php_add(int devfn)
}
/* power on the function */
- power_on_php_slot(devfn);
+ power_on_php_devfn(devfn);
/* tell Control panel which slot for the new pass-throgh dev */
sprintf(ret_str, "0x%02x", devfn);
diff --git a/xen-vl-extra.c b/xen-vl-extra.c
index 7beb6ef..206ac65 100644
--- a/xen-vl-extra.c
+++ b/xen-vl-extra.c
@@ -102,31 +102,31 @@ struct qemu_alarm_timer;
#ifdef CONFIG_PASSTHROUGH
void do_pci_del(char *devname)
{
- int pci_slot;
+ int devfn;
char *devname_cpy;
devname_cpy = strdup(devname);
if (!devname_cpy)
return;
- pci_slot = bdf_to_slot(devname);
+ devfn = bdf_to_devfn(devname);
- if (pci_slot < 0)
+ if (devfn < 0)
fprintf(logfile, "Device \"%s\" is not used by a hotplug device.\n",
devname_cpy);
else
- acpi_php_del(pci_slot);
+ acpi_php_del(devfn);
free(devname_cpy);
}
void do_pci_add(char *devname)
{
- int pci_slot;
+ int devfn;
- pci_slot = insert_to_pci_slot(devname);
+ devfn = insert_to_pci_devfn(devname);
- acpi_php_add(pci_slot);
+ acpi_php_add(devfn);
}
int pci_emulation_add(char *config_text)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|