qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v4 04/12] isa: Allow to un-assign I/O ports


From: Markus Armbruster
Subject: Re: [Qemu-devel] [RFC v4 04/12] isa: Allow to un-assign I/O ports
Date: Thu, 09 Jun 2011 17:03:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Andreas Färber <address@hidden> writes:

> Signed-off-by: Andreas Färber <address@hidden>
> ---
>  hw/isa-bus.c |   14 ++++++++++++++
>  hw/isa.h     |    1 +
>  2 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/hw/isa-bus.c b/hw/isa-bus.c
> index d258932..1f64673 100644
> --- a/hw/isa-bus.c
> +++ b/hw/isa-bus.c
> @@ -105,6 +105,20 @@ void isa_init_ioport(ISADevice *dev, uint16_t ioport)
>      isa_init_ioport_range(dev, ioport, 1);
>  }
>  
> +void isa_discard_ioport_range(ISADevice *dev, uint16_t start, uint16_t 
> length)
> +{
> +    int i, j;
> +    for (i = 0; i < dev->nioports; i++) {
> +        if (dev->ioports[i] == start) {
> +            for (j = 0; j < dev->nioports - i; j++) {
> +                dev->ioports[i + j] = dev->ioports[i + length + j];
> +            }
> +            dev->nioports -= length;
> +            break;
> +        }
> +    }
> +}
> +

"discard"?  It's the opposite of isa_init_ioport_range(), name should
make that obvious.  "uninit"?

Note: this only affects the I/O-port bookkeeping within ISADevice, not
the actual I/O port handler registration.  Any use must be accompanied
by a matching handler de-registration.  Just like any use of
isa_init_ioport_range() must be accompanied by matching
register_ioport_FOO()s.  You can thank Gleb for this mess.

[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]