fw_cfg: add generic non-DMA read method
commit38bf20931afe761fccda6e1eb91d64c7498ed9c9
authorGabriel L. Somlo <somlo@cmu.edu>
Thu, 5 Nov 2015 14:32:51 +0000 (5 09:32 -0500)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 15 Dec 2015 10:45:59 +0000 (15 11:45 +0100)
tree5ec403d6462051ec06961da5aafeda072e8d3d36
parent66f8fd9dda312191b78d2a2ba2848bcee76127a2
fw_cfg: add generic non-DMA read method

Introduce fw_cfg_data_read(), a generic read method which works
on all access widths (1 through 8 bytes, inclusive), and can be
used during both IOPort and MMIO read accesses.

To maintain legibility, only fw_cfg_data_mem_read() (the MMIO
data read method) is replaced by this patch. The new method
essentially unwinds the fw_cfg_data_mem_read() + fw_cfg_read()
combo, but without unnecessarily repeating all the validity
checks performed by the latter on each byte being read.

This patch also modifies the trace_fw_cfg_read prototype to
accept a 64-bit value argument, allowing it to work properly
with the new read method, but also remain backward compatible
with existing call sites.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc MarĂ­ <markmb@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1446733972-1602-6-git-send-email-somlo@cmu.edu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/nvram/fw_cfg.c
trace-events