pc87312.c (4ceb193d30fe9b1cda0dc73bddb8051659926fb9) | pc87312.c (db895a1e6a97e919f9b86d60c969377357b05066) |
---|---|
1/* 2 * QEMU National Semiconductor PC87312 (Super I/O) 3 * 4 * Copyright (c) 2010-2012 Herve Poussineau 5 * Copyright (c) 2011-2012 Andreas Färber 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 250 unchanged lines hidden (view full) --- 259 260static void pc87312_reset(DeviceState *d) 261{ 262 PC87312State *s = PC87312(d); 263 264 pc87312_soft_reset(s); 265} 266 | 1/* 2 * QEMU National Semiconductor PC87312 (Super I/O) 3 * 4 * Copyright (c) 2010-2012 Herve Poussineau 5 * Copyright (c) 2011-2012 Andreas Färber 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 250 unchanged lines hidden (view full) --- 259 260static void pc87312_reset(DeviceState *d) 261{ 262 PC87312State *s = PC87312(d); 263 264 pc87312_soft_reset(s); 265} 266 |
267static int pc87312_init(ISADevice *dev) | 267static void pc87312_realize(DeviceState *dev, Error **errp) |
268{ 269 PC87312State *s; 270 DeviceState *d; 271 ISADevice *isa; 272 ISABus *bus; 273 CharDriverState *chr; 274 DriveInfo *drive; 275 char name[5]; 276 int i; 277 278 s = PC87312(dev); | 268{ 269 PC87312State *s; 270 DeviceState *d; 271 ISADevice *isa; 272 ISABus *bus; 273 CharDriverState *chr; 274 DriveInfo *drive; 275 char name[5]; 276 int i; 277 278 s = PC87312(dev); |
279 bus = isa_bus_from_device(dev); | 279 isa = ISA_DEVICE(dev); 280 bus = isa_bus_from_device(isa); 281 isa_register_ioport(isa, &s->io, s->iobase); |
280 pc87312_hard_reset(s); | 282 pc87312_hard_reset(s); |
281 isa_register_ioport(dev, &s->io, s->iobase); | |
282 283 if (is_parallel_enabled(s)) { 284 chr = parallel_hds[0]; 285 if (chr == NULL) { 286 chr = qemu_chr_new("par0", "null", NULL); 287 } 288 isa = isa_create(bus, "isa-parallel"); 289 d = DEVICE(isa); --- 50 unchanged lines hidden (view full) --- 340 d = DEVICE(isa); 341 qdev_prop_set_uint32(d, "iobase", get_ide_iobase(s)); 342 qdev_prop_set_uint32(d, "iobase2", get_ide_iobase(s) + 0x206); 343 qdev_prop_set_uint32(d, "irq", 14); 344 qdev_init_nofail(d); 345 s->ide.dev = isa; 346 trace_pc87312_info_ide(get_ide_iobase(s)); 347 } | 283 284 if (is_parallel_enabled(s)) { 285 chr = parallel_hds[0]; 286 if (chr == NULL) { 287 chr = qemu_chr_new("par0", "null", NULL); 288 } 289 isa = isa_create(bus, "isa-parallel"); 290 d = DEVICE(isa); --- 50 unchanged lines hidden (view full) --- 341 d = DEVICE(isa); 342 qdev_prop_set_uint32(d, "iobase", get_ide_iobase(s)); 343 qdev_prop_set_uint32(d, "iobase2", get_ide_iobase(s) + 0x206); 344 qdev_prop_set_uint32(d, "irq", 14); 345 qdev_init_nofail(d); 346 s->ide.dev = isa; 347 trace_pc87312_info_ide(get_ide_iobase(s)); 348 } |
348 349 return 0; | |
350} 351 352static void pc87312_initfn(Object *obj) 353{ 354 PC87312State *s = PC87312(obj); 355 356 memory_region_init_io(&s->io, &pc87312_io_ops, s, "pc87312", 2); 357} --- 15 unchanged lines hidden (view full) --- 373 DEFINE_PROP_HEX32("iobase", PC87312State, iobase, 0x398), 374 DEFINE_PROP_UINT8("config", PC87312State, config, 1), 375 DEFINE_PROP_END_OF_LIST() 376}; 377 378static void pc87312_class_init(ObjectClass *klass, void *data) 379{ 380 DeviceClass *dc = DEVICE_CLASS(klass); | 349} 350 351static void pc87312_initfn(Object *obj) 352{ 353 PC87312State *s = PC87312(obj); 354 355 memory_region_init_io(&s->io, &pc87312_io_ops, s, "pc87312", 2); 356} --- 15 unchanged lines hidden (view full) --- 372 DEFINE_PROP_HEX32("iobase", PC87312State, iobase, 0x398), 373 DEFINE_PROP_UINT8("config", PC87312State, config, 1), 374 DEFINE_PROP_END_OF_LIST() 375}; 376 377static void pc87312_class_init(ObjectClass *klass, void *data) 378{ 379 DeviceClass *dc = DEVICE_CLASS(klass); |
381 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); | |
382 | 380 |
383 ic->init = pc87312_init; | 381 dc->realize = pc87312_realize; |
384 dc->reset = pc87312_reset; 385 dc->vmsd = &vmstate_pc87312; 386 dc->props = pc87312_properties; 387} 388 389static const TypeInfo pc87312_type_info = { 390 .name = TYPE_PC87312, 391 .parent = TYPE_ISA_DEVICE, 392 .instance_size = sizeof(PC87312State), 393 .instance_init = pc87312_initfn, 394 .class_init = pc87312_class_init, 395}; 396 397static void pc87312_register_types(void) 398{ 399 type_register_static(&pc87312_type_info); 400} 401 402type_init(pc87312_register_types) | 382 dc->reset = pc87312_reset; 383 dc->vmsd = &vmstate_pc87312; 384 dc->props = pc87312_properties; 385} 386 387static const TypeInfo pc87312_type_info = { 388 .name = TYPE_PC87312, 389 .parent = TYPE_ISA_DEVICE, 390 .instance_size = sizeof(PC87312State), 391 .instance_init = pc87312_initfn, 392 .class_init = pc87312_class_init, 393}; 394 395static void pc87312_register_types(void) 396{ 397 type_register_static(&pc87312_type_info); 398} 399 400type_init(pc87312_register_types) |