]> Git Repo - qemu.git/blob - tests/libqos/fw_cfg-pc.c
libqos/pci: Enable bus mastering
[qemu.git] / tests / libqos / fw_cfg-pc.c
1 /*
2  * libqos fw_cfg support for PC
3  *
4  * Copyright IBM, Corp. 2012-2013
5  *
6  * Authors:
7  *  Anthony Liguori   <[email protected]>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  */
12
13 #include "libqos/fw_cfg-pc.h"
14 #include "libqtest.h"
15 #include <glib.h>
16
17 static void pc_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
18 {
19     outw(0x510, key);
20 }
21
22 static void pc_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)
23 {
24     uint8_t *ptr = data;
25     int i;
26
27     for (i = 0; i < len; i++) {
28         ptr[i] = inb(0x511);
29     }
30 }
31
32 QFWCFG *pc_fw_cfg_init(void)
33 {
34     QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));
35
36     fw_cfg->select = pc_fw_cfg_select;
37     fw_cfg->read = pc_fw_cfg_read;
38
39     return fw_cfg;
40 }
This page took 0.026542 seconds and 4 git commands to generate.