qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 3/4] pci: pci_default_config_write() clean up.


From: Michael S. Tsirkin
Subject: [Qemu-devel] Re: [PATCH 3/4] pci: pci_default_config_write() clean up.
Date: Mon, 25 May 2009 10:09:47 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, May 20, 2009 at 11:25:33AM +0900, Isaku Yamahata wrote:
> diff --git a/hw/pci.h b/hw/pci.h
> index 7f7842f..6bb1c5c 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> +struct PCIConfigReg {
> +    uint8_t wmask;
> +    uint8_t shift;

I am not sure I understand what shift is.
Document fields in this structure?

> +    pci_config_written_t callback;
> +};
>  
>  struct PCIDevice {
>      DeviceState qdev;
>      /* PCI config space */
>      uint8_t config[PCI_CONFIG_SPACE_SIZE];
> -
> -    /* Used to implement R/W bytes */
> -    uint8_t mask[PCI_CONFIG_SPACE_SIZE];
> +    struct PCIConfigReg config_regs[PCI_CONFIG_SPACE_SIZE];

I think that life will be much easier if you'll keep
separate arrays of masks and an array of callbacks.
Then two simple memset calls can initialize a range or registers
to a sane default (readonly, no side effects for head,
writeable, no side effects for the rest of config space),
and you'll only need to set up callbacks and masks for when
something special is needed.

-- 
MST




reply via email to

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