Revision 3f84865a hw/acpi.c
b/hw/acpi.c | ||
---|---|---|
694 | 694 |
|
695 | 695 |
static void pciej_write(void *opaque, uint32_t addr, uint32_t val) |
696 | 696 |
{ |
697 |
#if defined (TARGET_I386) |
|
697 |
BusState *bus = opaque; |
|
698 |
DeviceState *qdev; |
|
699 |
PCIDevice *dev; |
|
698 | 700 |
int slot = ffs(val) - 1; |
699 | 701 |
|
700 |
pci_device_hot_remove_success(0, slot); |
|
702 |
QLIST_FOREACH(qdev, &bus->children, sibling) { |
|
703 |
dev = DO_UPCAST(PCIDevice, qdev, qdev); |
|
704 |
if (PCI_SLOT(dev->devfn) == slot) { |
|
705 |
#if defined (TARGET_I386) |
|
706 |
pci_device_hot_remove_success(dev); |
|
701 | 707 |
#endif |
708 |
qdev_free(qdev); |
|
709 |
} |
|
710 |
} |
|
711 |
|
|
702 | 712 |
|
703 | 713 |
#if defined(DEBUG) |
704 | 714 |
printf("pciej write %x <== %d\n", addr, val); |
705 | 715 |
#endif |
706 | 716 |
} |
707 | 717 |
|
708 |
static void piix4_device_hot_add(int bus, int slot, int state);
|
|
718 |
static int piix4_device_hotplug(PCIDevice *dev, int state);
|
|
709 | 719 |
|
710 |
void piix4_acpi_system_hot_add_init(void)
|
|
720 |
void piix4_acpi_system_hot_add_init(PCIBus *bus)
|
|
711 | 721 |
{ |
712 | 722 |
register_ioport_write(GPE_BASE, 4, 1, gpe_writeb, &gpe); |
713 | 723 |
register_ioport_read(GPE_BASE, 4, 1, gpe_readb, &gpe); |
... | ... | |
715 | 725 |
register_ioport_write(PCI_BASE, 8, 4, pcihotplug_write, &pci0_status); |
716 | 726 |
register_ioport_read(PCI_BASE, 8, 4, pcihotplug_read, &pci0_status); |
717 | 727 |
|
718 |
register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, NULL);
|
|
719 |
register_ioport_read(PCI_EJ_BASE, 4, 4, pciej_read, NULL);
|
|
728 |
register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, bus);
|
|
729 |
register_ioport_read(PCI_EJ_BASE, 4, 4, pciej_read, bus);
|
|
720 | 730 |
|
721 |
qemu_system_device_hot_add_register(piix4_device_hot_add);
|
|
731 |
pci_bus_hotplug(bus, piix4_device_hotplug);
|
|
722 | 732 |
} |
723 | 733 |
|
724 | 734 |
static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot) |
... | ... | |
733 | 743 |
p->down |= (1 << slot); |
734 | 744 |
} |
735 | 745 |
|
736 |
static void piix4_device_hot_add(int bus, int slot, int state)
|
|
746 |
static int piix4_device_hotplug(PCIDevice *dev, int state)
|
|
737 | 747 |
{ |
748 |
int slot = PCI_SLOT(dev->devfn); |
|
749 |
|
|
738 | 750 |
pci0_status.up = 0; |
739 | 751 |
pci0_status.down = 0; |
740 | 752 |
if (state) |
... | ... | |
745 | 757 |
qemu_set_irq(pm_state->irq, 1); |
746 | 758 |
qemu_set_irq(pm_state->irq, 0); |
747 | 759 |
} |
748 |
} |
|
749 |
|
|
750 |
static qemu_system_device_hot_add_t device_hot_add_callback; |
|
751 |
void qemu_system_device_hot_add_register(qemu_system_device_hot_add_t callback) |
|
752 |
{ |
|
753 |
device_hot_add_callback = callback; |
|
754 |
} |
|
755 |
|
|
756 |
void qemu_system_device_hot_add(int pcibus, int slot, int state) |
|
757 |
{ |
|
758 |
if (device_hot_add_callback) |
|
759 |
device_hot_add_callback(pcibus, slot, state); |
|
760 |
return 0; |
|
760 | 761 |
} |
761 | 762 |
|
762 | 763 |
struct acpi_table_header |
Also available in: Unified diff