Commit 8b35ab27 authored by Igor Mammedov's avatar Igor Mammedov Committed by Michael S. Tsirkin
Browse files

memhp: merge build_memory_devices() into build_memory_hotplug_aml()



It consolidates memory hotplug AML in one place within DSDT

Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 8dfba500
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -310,9 +310,11 @@ const VMStateDescription vmstate_memory_hotplug = {
void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
                              uint16_t io_base, uint16_t io_len)
{
    int i;
    Aml *ifctx;
    Aml *method;
    Aml *pci_scope;
    Aml *sb_scope;
    Aml *mem_ctrl_dev;

    /* scope for memory hotplug controller device node */
@@ -610,19 +612,12 @@ void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
    }
    aml_append(pci_scope, mem_ctrl_dev);
    aml_append(table, pci_scope);
}

void build_memory_devices(Aml *sb_scope, int nr_mem,
                          uint16_t io_base, uint16_t io_len)
{
    int i;
    Aml *dev;
    Aml *method;
    Aml *ifctx;

    sb_scope = aml_scope("_SB");
    /* build memory devices */
    for (i = 0; i < nr_mem; i++) {
        #define BASEPATH "\\_SB.PCI0." MEMORY_HOTPLUG_DEVICE "."
        Aml *dev;
        const char *s;

        dev = aml_device("MP%02X", i);
@@ -673,4 +668,5 @@ void build_memory_devices(Aml *sb_scope, int nr_mem,
        aml_append(method, ifctx);
    }
    aml_append(sb_scope, method);
    aml_append(table, sb_scope);
}
+28 −33
Original line number Diff line number Diff line
@@ -2196,10 +2196,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
    }

    sb_scope = aml_scope("\\_SB");
    {
        build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
                             pm->mem_hp_io_len);

    {
        Object *pci_host;
        PCIBus *bus = NULL;
@@ -2235,7 +2231,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
        }
    }
    aml_append(dsdt, sb_scope);
    }

    /* copy AML table into ACPI tables blob and patch header there */
    g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
+0 −2
Original line number Diff line number Diff line
@@ -54,6 +54,4 @@ void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);

void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
                              uint16_t io_base, uint16_t io_len);
void build_memory_devices(Aml *sb_scope, int nr_mem,
                          uint16_t io_base, uint16_t io_len);
#endif