Revision a2e0b863
b/hw/input/pckbd.c | ||
---|---|---|
431 | 431 |
qemu_register_reset(kbd_reset, s); |
432 | 432 |
} |
433 | 433 |
|
434 |
#define TYPE_I8042 "i8042" |
|
435 |
#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) |
|
436 |
|
|
434 | 437 |
typedef struct ISAKBDState { |
435 |
ISADevice dev; |
|
438 |
ISADevice parent_obj; |
|
439 |
|
|
436 | 440 |
KBDState kbd; |
437 | 441 |
MemoryRegion io[2]; |
438 | 442 |
} ISAKBDState; |
... | ... | |
440 | 444 |
void i8042_isa_mouse_fake_event(void *opaque) |
441 | 445 |
{ |
442 | 446 |
ISADevice *dev = opaque; |
443 |
KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd); |
|
447 |
ISAKBDState *isa = I8042(dev); |
|
448 |
KBDState *s = &isa->kbd; |
|
444 | 449 |
|
445 | 450 |
ps2_mouse_fake_event(s->mouse); |
446 | 451 |
} |
447 | 452 |
|
448 | 453 |
void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out) |
449 | 454 |
{ |
450 |
KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd); |
|
455 |
ISAKBDState *isa = I8042(dev); |
|
456 |
KBDState *s = &isa->kbd; |
|
451 | 457 |
|
452 | 458 |
s->a20_out = a20_out; |
453 | 459 |
} |
... | ... | |
485 | 491 |
|
486 | 492 |
static int i8042_initfn(ISADevice *dev) |
487 | 493 |
{ |
488 |
ISAKBDState *isa_s = DO_UPCAST(ISAKBDState, dev, dev);
|
|
494 |
ISAKBDState *isa_s = I8042(dev);
|
|
489 | 495 |
KBDState *s = &isa_s->kbd; |
490 | 496 |
|
491 | 497 |
isa_init_irq(dev, &s->irq_kbd, 1); |
... | ... | |
513 | 519 |
} |
514 | 520 |
|
515 | 521 |
static const TypeInfo i8042_info = { |
516 |
.name = "i8042",
|
|
522 |
.name = TYPE_I8042,
|
|
517 | 523 |
.parent = TYPE_ISA_DEVICE, |
518 | 524 |
.instance_size = sizeof(ISAKBDState), |
519 | 525 |
.class_init = i8042_class_initfn, |
Also available in: Unified diff