pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR

... removes dependency of mmio handler on PCI_HOTPLUG_ADDR.
It will be needed in case of Q35 where base could be different.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Igor Mammedov 2014-02-03 11:44:58 +01:00 committed by Michael S. Tsirkin
parent 8f5001f9ed
commit a7b613cf68
1 changed files with 12 additions and 12 deletions

View File

@ -48,11 +48,11 @@
#define PCI_HOTPLUG_ADDR 0xae00 #define PCI_HOTPLUG_ADDR 0xae00
#define PCI_HOTPLUG_SIZE 0x0014 #define PCI_HOTPLUG_SIZE 0x0014
#define PCI_UP_BASE 0xae00 #define PCI_UP_BASE 0x0000
#define PCI_DOWN_BASE 0xae04 #define PCI_DOWN_BASE 0x0004
#define PCI_EJ_BASE 0xae08 #define PCI_EJ_BASE 0x0008
#define PCI_RMV_BASE 0xae0c #define PCI_RMV_BASE 0x000c
#define PCI_SEL_BASE 0xae10 #define PCI_SEL_BASE 0x0010
typedef struct AcpiPciHpFind { typedef struct AcpiPciHpFind {
int bsel; int bsel;
@ -213,24 +213,24 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
} }
switch (addr) { switch (addr) {
case PCI_UP_BASE - PCI_HOTPLUG_ADDR: case PCI_UP_BASE:
val = s->acpi_pcihp_pci_status[bsel].up; val = s->acpi_pcihp_pci_status[bsel].up;
s->acpi_pcihp_pci_status[bsel].up = 0; s->acpi_pcihp_pci_status[bsel].up = 0;
ACPI_PCIHP_DPRINTF("pci_up_read %" PRIu32 "\n", val); ACPI_PCIHP_DPRINTF("pci_up_read %" PRIu32 "\n", val);
break; break;
case PCI_DOWN_BASE - PCI_HOTPLUG_ADDR: case PCI_DOWN_BASE:
val = s->acpi_pcihp_pci_status[bsel].down; val = s->acpi_pcihp_pci_status[bsel].down;
ACPI_PCIHP_DPRINTF("pci_down_read %" PRIu32 "\n", val); ACPI_PCIHP_DPRINTF("pci_down_read %" PRIu32 "\n", val);
break; break;
case PCI_EJ_BASE - PCI_HOTPLUG_ADDR: case PCI_EJ_BASE:
/* No feature defined yet */ /* No feature defined yet */
ACPI_PCIHP_DPRINTF("pci_features_read %" PRIu32 "\n", val); ACPI_PCIHP_DPRINTF("pci_features_read %" PRIu32 "\n", val);
break; break;
case PCI_RMV_BASE - PCI_HOTPLUG_ADDR: case PCI_RMV_BASE:
val = s->acpi_pcihp_pci_status[bsel].hotplug_enable; val = s->acpi_pcihp_pci_status[bsel].hotplug_enable;
ACPI_PCIHP_DPRINTF("pci_rmv_read %" PRIu32 "\n", val); ACPI_PCIHP_DPRINTF("pci_rmv_read %" PRIu32 "\n", val);
break; break;
case PCI_SEL_BASE - PCI_HOTPLUG_ADDR: case PCI_SEL_BASE:
val = s->hotplug_select; val = s->hotplug_select;
ACPI_PCIHP_DPRINTF("pci_sel_read %" PRIu32 "\n", val); ACPI_PCIHP_DPRINTF("pci_sel_read %" PRIu32 "\n", val);
default: default:
@ -245,7 +245,7 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,
{ {
AcpiPciHpState *s = opaque; AcpiPciHpState *s = opaque;
switch (addr) { switch (addr) {
case PCI_EJ_BASE - PCI_HOTPLUG_ADDR: case PCI_EJ_BASE:
if (s->hotplug_select >= ACPI_PCIHP_MAX_HOTPLUG_BUS) { if (s->hotplug_select >= ACPI_PCIHP_MAX_HOTPLUG_BUS) {
break; break;
} }
@ -253,7 +253,7 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,
ACPI_PCIHP_DPRINTF("pciej write %" HWADDR_PRIx " <== %" PRIu64 "\n", ACPI_PCIHP_DPRINTF("pciej write %" HWADDR_PRIx " <== %" PRIu64 "\n",
addr, data); addr, data);
break; break;
case PCI_SEL_BASE - PCI_HOTPLUG_ADDR: case PCI_SEL_BASE:
s->hotplug_select = data; s->hotplug_select = data;
ACPI_PCIHP_DPRINTF("pcisel write %" HWADDR_PRIx " <== %" PRIu64 "\n", ACPI_PCIHP_DPRINTF("pcisel write %" HWADDR_PRIx " <== %" PRIu64 "\n",
addr, data); addr, data);