On 3/7/22 22:39, Mark Cave-Ayland wrote:
static void nios2_10m50_ghrd_init(MachineState *machine)
{
+ Nios2MachineState *nms = NIOS2_MACHINE(machine);
Nios2CPU *cpu;
DeviceState *dev;
MemoryRegion *address_space_mem = get_system_memory();
@@ -101,15 +109,29 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
cpu->exception_addr = 0xc8000120;
cpu->fast_tlb_miss_addr = 0xc0000100;
- nios2_load_kernel(cpu, ram_base, ram_size, machine->initrd_filename,
+ nios2_load_kernel(cpu, ram_base, ram_size, nms->parent_obj.initrd_filename,
BINARY_DEVICE_TREE_FILE, NULL);
I think you should be able to keep this as machine->initrd_filename? Certainly there
should be no direct access to parent_obj here, and if you did need it a QOM cast macro
would be the way to do this.
Ok.
+static const TypeInfo nios2_10m50_ghrd_type_info = {
+ .name = TYPE_NIOS2_MACHINE,
+ .parent = TYPE_MACHINE,
+ .instance_size = sizeof(Nios2MachineState),
+ .class_size = sizeof(MachineClass),
Technically you can drop .class_size here since this should be inherited automatically
from MachineClass.
Ok. This is a leftover from an intermediate when Nios2MachineClass existed.
r~