PPC: Fix rldcl
[qemu/agraf.git] / tests / libqos / fw_cfg-pc.c
blob613604db775e71a6166bcd8659657ee61351b38a
1 /*
2 * libqos fw_cfg support for PC
4 * Copyright IBM, Corp. 2012-2013
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
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.
13 #include "libqos/fw_cfg-pc.h"
14 #include "libqtest.h"
15 #include <glib.h>
17 static void pc_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
19 outw(0x510, key);
22 static void pc_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)
24 uint8_t *ptr = data;
25 int i;
27 for (i = 0; i < len; i++) {
28 ptr[i] = inb(0x511);
32 QFWCFG *pc_fw_cfg_init(void)
34 QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));
36 fw_cfg->select = pc_fw_cfg_select;
37 fw_cfg->read = pc_fw_cfg_read;
39 return fw_cfg;