macio.c: include parent PCIDevice state in VMStateDescription
This ensures that the macio PCI device is correctly configured when restoring from a VM snapshot. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
		
							parent
							
								
									21e5d28a47
								
							
						
					
					
						commit
						026359238b
					
				@ -336,20 +336,44 @@ static void macio_instance_init(Object *obj)
 | 
				
			|||||||
    memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem);
 | 
					    memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const VMStateDescription vmstate_macio_oldworld = {
 | 
				
			||||||
 | 
					    .name = "macio-oldworld",
 | 
				
			||||||
 | 
					    .version_id = 0,
 | 
				
			||||||
 | 
					    .minimum_version_id = 0,
 | 
				
			||||||
 | 
					    .fields = (VMStateField[]) {
 | 
				
			||||||
 | 
					        VMSTATE_PCI_DEVICE(parent_obj.parent, OldWorldMacIOState),
 | 
				
			||||||
 | 
					        VMSTATE_END_OF_LIST()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void macio_oldworld_class_init(ObjectClass *oc, void *data)
 | 
					static void macio_oldworld_class_init(ObjectClass *oc, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc);
 | 
					    PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc);
 | 
				
			||||||
 | 
					    DeviceClass *dc = DEVICE_CLASS(oc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pdc->init = macio_oldworld_initfn;
 | 
					    pdc->init = macio_oldworld_initfn;
 | 
				
			||||||
    pdc->device_id = PCI_DEVICE_ID_APPLE_343S1201;
 | 
					    pdc->device_id = PCI_DEVICE_ID_APPLE_343S1201;
 | 
				
			||||||
 | 
					    dc->vmsd = &vmstate_macio_oldworld;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const VMStateDescription vmstate_macio_newworld = {
 | 
				
			||||||
 | 
					    .name = "macio-newworld",
 | 
				
			||||||
 | 
					    .version_id = 0,
 | 
				
			||||||
 | 
					    .minimum_version_id = 0,
 | 
				
			||||||
 | 
					    .fields = (VMStateField[]) {
 | 
				
			||||||
 | 
					        VMSTATE_PCI_DEVICE(parent_obj.parent, NewWorldMacIOState),
 | 
				
			||||||
 | 
					        VMSTATE_END_OF_LIST()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void macio_newworld_class_init(ObjectClass *oc, void *data)
 | 
					static void macio_newworld_class_init(ObjectClass *oc, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc);
 | 
					    PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc);
 | 
				
			||||||
 | 
					    DeviceClass *dc = DEVICE_CLASS(oc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pdc->init = macio_newworld_initfn;
 | 
					    pdc->init = macio_newworld_initfn;
 | 
				
			||||||
    pdc->device_id = PCI_DEVICE_ID_APPLE_UNI_N_KEYL;
 | 
					    pdc->device_id = PCI_DEVICE_ID_APPLE_UNI_N_KEYL;
 | 
				
			||||||
 | 
					    dc->vmsd = &vmstate_macio_newworld;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Property macio_properties[] = {
 | 
					static Property macio_properties[] = {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user