[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 1/5] fw_cfg: expose control register size in
From: |
Laszlo Ersek |
Subject: |
Re: [Qemu-devel] [PATCH v4 1/5] fw_cfg: expose control register size in fw_cfg.h |
Date: |
Tue, 29 Sep 2015 12:10:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 09/27/15 23:28, Gabriel L. Somlo wrote:
> Expose the size of the control register (FW_CFG_SIZE, renamed to
> FW_CFG_CTL_SIZE) in fw_cfg.h.
> Add comment to fw_cfg_io_realize() pointing out that since the
> 8-bit data register is always subsumed by the 16-bit control
> register in the port I/O case, we use the control register width
> as the *total* width of the port I/O region reserved for the device.
>
> Suggested-by: Marc MarĂ <address@hidden>
> Signed-off-by: Gabriel Somlo <address@hidden>
> ---
> hw/nvram/fw_cfg.c | 8 +++++---
> include/hw/nvram/fw_cfg.h | 3 +++
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 658f8c4..9dd95c7 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -30,7 +30,6 @@
> #include "qemu/error-report.h"
> #include "qemu/config-file.h"
>
> -#define FW_CFG_SIZE 2
> #define FW_CFG_NAME "fw_cfg"
> #define FW_CFG_PATH "/machine/" FW_CFG_NAME
>
> @@ -672,8 +671,11 @@ static void fw_cfg_io_realize(DeviceState *dev, Error
> **errp)
> FWCfgIoState *s = FW_CFG_IO(dev);
> SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> + /* when using port i/o, the 8-bit data register ALWAYS overlaps
> + * with half of the 16-bit control register. Hence, the total size
> + * of the i/o region used is FW_CFG_CTL_SIZE */
> memory_region_init_io(&s->comb_iomem, OBJECT(s), &fw_cfg_comb_mem_ops,
> - FW_CFG(s), "fwcfg", FW_CFG_SIZE);
> + FW_CFG(s), "fwcfg", FW_CFG_CTL_SIZE);
> sysbus_add_io(sbd, s->iobase, &s->comb_iomem);
> }
>
> @@ -705,7 +707,7 @@ static void fw_cfg_mem_realize(DeviceState *dev, Error
> **errp)
> const MemoryRegionOps *data_ops = &fw_cfg_data_mem_ops;
>
> memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops,
> - FW_CFG(s), "fwcfg.ctl", FW_CFG_SIZE);
> + FW_CFG(s), "fwcfg.ctl", FW_CFG_CTL_SIZE);
> sysbus_init_mmio(sbd, &s->ctl_iomem);
>
> if (s->data_width > data_ops->valid.max_access_size) {
> diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
> index e60d3ca..5008270 100644
> --- a/include/hw/nvram/fw_cfg.h
> +++ b/include/hw/nvram/fw_cfg.h
> @@ -46,6 +46,9 @@
>
> #define FW_CFG_INVALID 0xffff
>
> +/* width in bytes of fw_cfg control port */
Suggest to say "control register" here, rather than "control port".
Other than that,
Reviewed-by: Laszlo Ersek <address@hidden>
> +#define FW_CFG_CTL_SIZE 0x02
> +
> #define FW_CFG_MAX_FILE_PATH 56
>
> #ifndef NO_QEMU_PROTOS
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v4 1/5] fw_cfg: expose control register size in fw_cfg.h,
Laszlo Ersek <=