2018-03-09 01:39:22 +03:00
|
|
|
/*
|
|
|
|
* QEMU Parallel PORT (ISA bus helpers)
|
|
|
|
*
|
2019-03-11 12:50:54 +03:00
|
|
|
* These functions reside in a separate file since they also might be
|
|
|
|
* required for linking when compiling QEMU without CONFIG_PARALLEL.
|
|
|
|
*
|
2018-03-09 01:39:22 +03:00
|
|
|
* Copyright (c) 2003 Fabrice Bellard
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
2019-08-12 08:23:51 +03:00
|
|
|
|
2018-03-09 01:39:22 +03:00
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#include "sysemu/sysemu.h"
|
|
|
|
#include "hw/isa/isa.h"
|
2019-08-12 08:23:51 +03:00
|
|
|
#include "hw/qdev-properties.h"
|
2018-03-09 01:39:22 +03:00
|
|
|
#include "hw/char/parallel.h"
|
isa: Convert uses of isa_create() with Coccinelle
Replace
dev = isa_create(bus, type_name);
...
qdev_init_nofail(dev);
by
dev = isa_new(type_name);
...
isa_realize_and_unref(dev, bus, &error_fatal);
Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains
why.
Coccinelle script:
@@
expression dev, bus, expr;
expression list args;
expression d;
@@
- dev = isa_create(bus, args);
+ dev = isa_new(args);
(
d = &dev->qdev;
|
d = DEVICE(dev);
)
... when != dev = expr
- qdev_init_nofail(d);
+ isa_realize_and_unref(dev, bus, &error_fatal);
@@
expression dev, bus, expr;
expression list args;
@@
- dev = isa_create(bus, args);
+ dev = isa_new(args);
... when != dev = expr
- qdev_init_nofail(DEVICE(dev));
+ isa_realize_and_unref(dev, bus, &error_fatal);
@@
expression dev, bus, expr;
expression list args;
@@
- dev = DEVICE(isa_create(bus, args));
+ ISADevice *isa_dev; // TODO move
+ isa_dev = isa_new(args);
+ dev = DEVICE(isa_dev);
... when != dev = expr
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, bus, &error_fatal);
Missing #include "qapi/error.h" added manually, whitespace changes
minimized manually.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-20-armbru@redhat.com>
2020-06-10 08:32:08 +03:00
|
|
|
#include "qapi/error.h"
|
2018-03-09 01:39:22 +03:00
|
|
|
|
|
|
|
static void parallel_init(ISABus *bus, int index, Chardev *chr)
|
|
|
|
{
|
|
|
|
DeviceState *dev;
|
|
|
|
ISADevice *isadev;
|
|
|
|
|
isa: Convert uses of isa_create() with Coccinelle
Replace
dev = isa_create(bus, type_name);
...
qdev_init_nofail(dev);
by
dev = isa_new(type_name);
...
isa_realize_and_unref(dev, bus, &error_fatal);
Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains
why.
Coccinelle script:
@@
expression dev, bus, expr;
expression list args;
expression d;
@@
- dev = isa_create(bus, args);
+ dev = isa_new(args);
(
d = &dev->qdev;
|
d = DEVICE(dev);
)
... when != dev = expr
- qdev_init_nofail(d);
+ isa_realize_and_unref(dev, bus, &error_fatal);
@@
expression dev, bus, expr;
expression list args;
@@
- dev = isa_create(bus, args);
+ dev = isa_new(args);
... when != dev = expr
- qdev_init_nofail(DEVICE(dev));
+ isa_realize_and_unref(dev, bus, &error_fatal);
@@
expression dev, bus, expr;
expression list args;
@@
- dev = DEVICE(isa_create(bus, args));
+ ISADevice *isa_dev; // TODO move
+ isa_dev = isa_new(args);
+ dev = DEVICE(isa_dev);
... when != dev = expr
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, bus, &error_fatal);
Missing #include "qapi/error.h" added manually, whitespace changes
minimized manually.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-20-armbru@redhat.com>
2020-06-10 08:32:08 +03:00
|
|
|
isadev = isa_new("isa-parallel");
|
2018-03-09 01:39:22 +03:00
|
|
|
dev = DEVICE(isadev);
|
|
|
|
qdev_prop_set_uint32(dev, "index", index);
|
|
|
|
qdev_prop_set_chr(dev, "chardev", chr);
|
isa: Convert uses of isa_create() with Coccinelle
Replace
dev = isa_create(bus, type_name);
...
qdev_init_nofail(dev);
by
dev = isa_new(type_name);
...
isa_realize_and_unref(dev, bus, &error_fatal);
Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains
why.
Coccinelle script:
@@
expression dev, bus, expr;
expression list args;
expression d;
@@
- dev = isa_create(bus, args);
+ dev = isa_new(args);
(
d = &dev->qdev;
|
d = DEVICE(dev);
)
... when != dev = expr
- qdev_init_nofail(d);
+ isa_realize_and_unref(dev, bus, &error_fatal);
@@
expression dev, bus, expr;
expression list args;
@@
- dev = isa_create(bus, args);
+ dev = isa_new(args);
... when != dev = expr
- qdev_init_nofail(DEVICE(dev));
+ isa_realize_and_unref(dev, bus, &error_fatal);
@@
expression dev, bus, expr;
expression list args;
@@
- dev = DEVICE(isa_create(bus, args));
+ ISADevice *isa_dev; // TODO move
+ isa_dev = isa_new(args);
+ dev = DEVICE(isa_dev);
... when != dev = expr
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, bus, &error_fatal);
Missing #include "qapi/error.h" added manually, whitespace changes
minimized manually.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-20-armbru@redhat.com>
2020-06-10 08:32:08 +03:00
|
|
|
isa_realize_and_unref(isadev, bus, &error_fatal);
|
2018-03-09 01:39:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void parallel_hds_isa_init(ISABus *bus, int n)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
assert(n <= MAX_PARALLEL_PORTS);
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
if (parallel_hds[i]) {
|
|
|
|
parallel_init(bus, i, parallel_hds[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|