On 3/9/21 9:28 PM, BALATON Zoltan wrote:
> Collect superio functionality and its controlling config registers
> handling in an abstract VIA_SUPERIO class that is a subclass of
> ISA_SUPERIO and put vt82c686b specific parts in a subclass of this
> abstract class.
>
> Signed-off-by: BALATON Zoltan <[email protected]>
> ---
> hw/isa/vt82c686.c | 240 ++++++++++++++++++++++++--------------
> include/hw/isa/vt82c686.h | 1 -
> 2 files changed, 150 insertions(+), 91 deletions(-)
> static MemoryRegion *find_subregion(ISADevice *d, MemoryRegion *parent,
> int offs)
> @@ -270,10 +279,76 @@ static MemoryRegion *find_subregion(ISADevice *d,
> MemoryRegion *parent,
> return mr;
> }
>
> -static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,
> - unsigned size)
> +static void via_superio_realize(DeviceState *d, Error **errp)
> +{
> + ViaSuperIOState *s = VIA_SUPERIO(d);
> + ISASuperIOClass *ic = ISA_SUPERIO_GET_CLASS(s);
> + int i;
> +
> + assert(s->io_ops);
> + ic->parent_realize(d, errp);
> + if (*errp) {
Unfortunately this doesn't work because errp can be NULL...
This is described in "qapi/error.h". You have to use a local_err.
> + return;
> + }