| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * QEMU ACPI hotplug utilities | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2016 Red Hat Inc | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Authors: | 
					
						
							|  |  |  |  *   Igor Mammedov <imammedo@redhat.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This work is licensed under the terms of the GNU GPL, version 2 or later. | 
					
						
							|  |  |  |  * See the COPYING file in the top-level directory. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #ifndef ACPI_CPU_H
 | 
					
						
							|  |  |  | #define ACPI_CPU_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "hw/qdev-core.h"
 | 
					
						
							|  |  |  | #include "hw/acpi/acpi.h"
 | 
					
						
							|  |  |  | #include "hw/acpi/aml-build.h"
 | 
					
						
							|  |  |  | #include "hw/hotplug.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct AcpiCpuStatus { | 
					
						
							|  |  |  |     struct CPUState *cpu; | 
					
						
							|  |  |  |     uint64_t arch_id; | 
					
						
							| 
									
										
										
										
											2016-06-14 16:13:32 +02:00
										 |  |  |     bool is_inserting; | 
					
						
							| 
									
										
										
										
											2016-06-14 16:14:02 +02:00
										 |  |  |     bool is_removing; | 
					
						
							| 
									
										
										
										
											2020-12-07 09:07:33 -05:00
										 |  |  |     bool fw_remove; | 
					
						
							| 
									
										
										
										
											2016-04-22 19:06:36 +02:00
										 |  |  |     uint32_t ost_event; | 
					
						
							|  |  |  |     uint32_t ost_status; | 
					
						
							| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  | } AcpiCpuStatus; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct CPUHotplugState { | 
					
						
							|  |  |  |     MemoryRegion ctrl_reg; | 
					
						
							|  |  |  |     uint32_t selector; | 
					
						
							| 
									
										
										
										
											2016-06-14 16:13:32 +02:00
										 |  |  |     uint8_t command; | 
					
						
							| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  |     uint32_t dev_count; | 
					
						
							|  |  |  |     AcpiCpuStatus *devs; | 
					
						
							|  |  |  | } CPUHotplugState; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, | 
					
						
							|  |  |  |                       CPUHotplugState *cpu_st, DeviceState *dev, Error **errp); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-14 16:14:02 +02:00
										 |  |  | void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, | 
					
						
							|  |  |  |                                 CPUHotplugState *cpu_st, | 
					
						
							|  |  |  |                                 DeviceState *dev, Error **errp); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, | 
					
						
							|  |  |  |                         DeviceState *dev, Error **errp); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  | void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, | 
					
						
							|  |  |  |                          CPUHotplugState *state, hwaddr base_addr); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct CPUHotplugFeatures { | 
					
						
							| 
									
										
										
										
											2019-01-25 09:40:46 +00:00
										 |  |  |     bool acpi_1_compatible; | 
					
						
							| 
									
										
										
										
											2016-06-15 11:25:23 +02:00
										 |  |  |     bool has_legacy_cphp; | 
					
						
							| 
									
										
										
										
											2020-12-07 09:07:36 -05:00
										 |  |  |     bool fw_unplugs_cpu; | 
					
						
							| 
									
										
										
										
											2020-09-23 05:46:47 -04:00
										 |  |  |     const char *smi_path; | 
					
						
							| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  | } CPUHotplugFeatures; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, | 
					
						
							|  |  |  |                     hwaddr io_base, | 
					
						
							| 
									
										
										
										
											2016-06-14 16:13:32 +02:00
										 |  |  |                     const char *res_root, | 
					
						
							|  |  |  |                     const char *event_handler_method); | 
					
						
							| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-22 19:06:36 +02:00
										 |  |  | void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-14 16:02:06 +02:00
										 |  |  | extern const VMStateDescription vmstate_cpu_hotplug; | 
					
						
							|  |  |  | #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
 | 
					
						
							|  |  |  |     VMSTATE_STRUCT(cpuhp, state, 1, \ | 
					
						
							|  |  |  |                    vmstate_cpu_hotplug, CPUHotplugState) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |