memhp: merge build_memory_devices() into build_memory_hotplug_aml()
It consolidates memory hotplug AML in one place within DSDT 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:
		
							parent
							
								
									8dfba500af
								
							
						
					
					
						commit
						8b35ab271c
					
				| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue