mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
libqos: Generalize I/O-mapped fw_cfg
Provide a constructor that takes the base address in addition to the PC-specific one. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-12-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
f88dc7dd4d
commit
26491a388c
7 changed files with 35 additions and 63 deletions
|
@ -79,3 +79,29 @@ QFWCFG *mm_fw_cfg_init(uint64_t base)
|
|||
|
||||
return fw_cfg;
|
||||
}
|
||||
|
||||
static void io_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
|
||||
{
|
||||
outw(fw_cfg->base, key);
|
||||
}
|
||||
|
||||
static void io_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)
|
||||
{
|
||||
uint8_t *ptr = data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
ptr[i] = inb(fw_cfg->base + 1);
|
||||
}
|
||||
}
|
||||
|
||||
QFWCFG *io_fw_cfg_init(uint16_t base)
|
||||
{
|
||||
QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));
|
||||
|
||||
fw_cfg->base = base;
|
||||
fw_cfg->select = io_fw_cfg_select;
|
||||
fw_cfg->read = io_fw_cfg_read;
|
||||
|
||||
return fw_cfg;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue