From: Ian Jackson Date: Thu, 25 Jun 2009 17:40:33 +0000 (+0100) Subject: Merge branch 'pt.multifn' X-Git-Tag: xen-3.4.3-rc5-broken~77 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d67e46f6860bfbd8991b7691efc1f67b7bc413bc;p=qemu-xen-3.4-testing.git Merge branch 'pt.multifn' Conflicts: hw/piix4acpi.c --- d67e46f6860bfbd8991b7691efc1f67b7bc413bc diff --cc hw/piix4acpi.c index dc52b42f,996e36a6..9c5fdeea --- a/hw/piix4acpi.c +++ b/hw/piix4acpi.c @@@ -34,12 -33,8 +34,14 @@@ #include #include +#define PIIX4ACPI_LOG_ERROR 0 +#define PIIX4ACPI_LOG_INFO 1 +#define PIIX4ACPI_LOG_DEBUG 2 +#define PIIX4ACPI_LOGLEVEL PIIX4ACPI_LOG_INFO +#define PIIX4ACPI_LOG(level, fmt, ...) do { if (level <= PIIX4ACPI_LOGLEVEL) qemu_log(fmt, ## __VA_ARGS__); } while (0) + + #include + /* PM1a_CNT bits, as defined in the ACPI specification. */ #define SCI_EN (1 << 0) #define GBL_RLS (1 << 2) @@@ -247,10 -275,10 +279,11 @@@ static uint32_t acpi_php_readb(void *op break; default: num = addr - ACPI_PHP_IO_ADDR - 2; - val = hotplug_slots->status[num]; + val = hotplug_devfn->status[num]; } - PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, "ACPI PCI hotplug: read addr=0x%x, val=0x%x.\n", - fprintf(logfile, "ACPI PCI hotplug: read addr=0x%x, val=0x%02x.\n", ++ PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, ++ "ACPI PCI hotplug: read addr=0x%x, val=0x%02x.\n", addr, val); return val; @@@ -258,10 -286,10 +291,11 @@@ static void acpi_php_writeb(void *opaque, uint32_t addr, uint32_t val) { - PHPSlots *hotplug_slots = opaque; - int slot; + PHPDevFn *hotplug_devfn = opaque; + int devfn, num, func, i; - PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, "ACPI PCI hotplug: write addr=0x%x, val=0x%x.\n", - fprintf(logfile, "ACPI PCI hotplug: write addr=0x%x, val=0x%02x.\n", ++ PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, ++ "ACPI PCI hotplug: write addr=0x%x, val=0x%02x.\n", addr, val); switch (addr) @@@ -463,14 -513,29 +519,29 @@@ static void acpi_sci_intr(GPEState *s } } - void acpi_php_del(int slot) + void acpi_php_del(int devfn) { GPEState *s = &gpe_state; + int slot, func; - if ( test_pci_slot(slot) < 0 ) { - PIIX4ACPI_LOG(PIIX4ACPI_LOG_ERROR, "hot remove: pci slot %d " - "is not used by a hotplug device.\n", slot); + slot = PCI_SLOT(devfn); + func = PCI_FUNC(devfn); + if ( test_pci_devfn(devfn) < 0 ) { - fprintf(logfile, "hot remove: pci slot 0x%02x, function 0x%x " ++ PIIX4ACPI_LOG(PIIX4ACPI_LOG_ERROR, ++ "hot remove: pci slot 0x%02x, function 0x%x " + "is not used by a hotplug device.\n", slot, func); - + return; + } + + /* ACPI PHP can only work on slots + * So only remove zero-functions - + * which will remove all other fucntions of the same device in the + * guest. + */ + if ( func ) { + fprintf(logfile, "hot remove: Attempt to remove non-zero function " + "slot=0x%02x func=0x%0x.\n", slot, func); return; } @@@ -486,14 -551,15 +557,16 @@@ void acpi_php_add(int devfn { GPEState *s = &gpe_state; char ret_str[30]; + int slot, func; - if ( slot < 0 ) { - PIIX4ACPI_LOG(PIIX4ACPI_LOG_ERROR, "hot add pci slot %d exceed.\n", slot); + if ( devfn < 0 ) { - fprintf(logfile, "hot add pci devfn %d exceed.\n", devfn); ++ PIIX4ACPI_LOG(PIIX4ACPI_LOG_ERROR, ++ "hot add pci devfn %d exceed.\n", devfn); - if ( slot == -1 ) - sprintf(ret_str, "no free hotplug slots"); - else if ( slot == -2 ) - sprintf(ret_str, "wrong bdf or vslot"); + if ( devfn == -1 ) + sprintf(ret_str, "no free hotplug devfn"); + else if ( devfn == -2 ) + sprintf(ret_str, "wrong bdf or vdevfn"); if ( strlen(ret_str) > 0 ) xenstore_record_dm("parameter", ret_str); @@@ -580,8 -661,8 +668,9 @@@ i2c_bus *piix4_pm_init(PCIBus *bus, in } void qemu_system_hot_add_init() { } - void qemu_system_device_hot_add(int bus, int slot, int state) { - PIIX4ACPI_LOG(PIIX4ACPI_LOG_ERROR, "qemu-upstream PCI hotplug not supported in qemu-dm\n"); + void qemu_system_device_hot_add(int bus, int devfn, int state) { - fputs("qemu-upstream PCI hotplug not supported in qemu-dm\n",stderr); ++ PIIX4ACPI_LOG(PIIX4ACPI_LOG_ERROR, ++ "qemu-upstream PCI hotplug not supported in qemu-dm\n"); exit(-1); }