Revision 477a72a1 hw/s390x/event-facility.c

b/hw/s390x/event-facility.c
26 26
} SCLPEventsBus;
27 27

  
28 28
struct SCLPEventFacility {
29
    SysBusDevice parent_obj;
29 30
    SCLPEventsBus sbus;
30
    DeviceState *qdev;
31 31
    /* guest' receive mask */
32 32
    unsigned int receive_mask;
33 33
};
......
315 315
    }
316 316
}
317 317

  
318
static int init_event_facility(S390SCLPDevice *sdev)
318
static int init_event_facility(SCLPEventFacility *event_facility)
319 319
{
320
    SCLPEventFacility *event_facility;
320
    DeviceState *sdev = DEVICE(event_facility);
321 321
    DeviceState *quiesce;
322 322

  
323
    event_facility = g_malloc0(sizeof(SCLPEventFacility));
324
    sdev->ef = event_facility;
325
    sdev->sclp_command_handler = command_handler;
326
    sdev->event_pending = event_pending;
327

  
328
    /* Spawn a new sclp-events facility */
323
    /* Spawn a new bus for SCLP events */
329 324
    qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus),
330
                        TYPE_SCLP_EVENTS_BUS, DEVICE(sdev), NULL);
325
                        TYPE_SCLP_EVENTS_BUS, sdev, NULL);
331 326
    event_facility->sbus.qbus.allow_hotplug = 0;
332
    event_facility->qdev = (DeviceState *) sdev;
333 327

  
334 328
    quiesce = qdev_create(&event_facility->sbus.qbus, "sclpquiesce");
335 329
    if (!quiesce) {
......
346 340

  
347 341
static void reset_event_facility(DeviceState *dev)
348 342
{
349
    S390SCLPDevice *sdev = SCLP_S390_DEVICE(dev);
343
    SCLPEventFacility *sdev = EVENT_FACILITY(dev);
350 344

  
351
    sdev->ef->receive_mask = 0;
345
    sdev->receive_mask = 0;
352 346
}
353 347

  
354 348
static void init_event_facility_class(ObjectClass *klass, void *data)
355 349
{
356
    DeviceClass *dc = DEVICE_CLASS(klass);
357
    S390SCLPDeviceClass *k = SCLP_S390_DEVICE_CLASS(klass);
350
    SysBusDeviceClass *sbdc = SYS_BUS_DEVICE_CLASS(klass);
351
    DeviceClass *dc = DEVICE_CLASS(sbdc);
352
    SCLPEventFacilityClass *k = EVENT_FACILITY_CLASS(dc);
358 353

  
359 354
    dc->reset = reset_event_facility;
360 355
    k->init = init_event_facility;
356
    k->command_handler = command_handler;
357
    k->event_pending = event_pending;
361 358
}
362 359

  
363 360
static const TypeInfo sclp_event_facility_info = {
364
    .name          = "s390-sclp-event-facility",
365
    .parent        = TYPE_DEVICE_S390_SCLP,
366
    .instance_size = sizeof(S390SCLPDevice),
361
    .name          = TYPE_SCLP_EVENT_FACILITY,
362
    .parent        = TYPE_SYS_BUS_DEVICE,
363
    .instance_size = sizeof(SCLPEventFacility),
367 364
    .class_init    = init_event_facility_class,
365
    .class_size    = sizeof(SCLPEventFacilityClass),
368 366
};
369 367

  
370 368
static int event_qdev_init(DeviceState *qdev)

Also available in: Unified diff