blob: 67c4a74f4bef728bcff29fb278c7b53bed8accce [file] [log] [blame]
Huacai Chen313d1e92020-09-22 10:49:25 +08001/*
2 * QEMU fw_cfg helpers (MIPS specific)
3 *
4 * Copyright (c) 2020 Lemote, Inc.
5 *
6 * Author:
7 * Huacai Chen (chenhc@lemote.com)
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 *
11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
12 * See the COPYING file in the top-level directory.
13 */
14
15#include "qemu/osdep.h"
16#include "hw/mips/fw_cfg.h"
17#include "hw/nvram/fw_cfg.h"
18
19const char *fw_cfg_arch_key_name(uint16_t key)
20{
21 static const struct {
22 uint16_t key;
23 const char *name;
24 } fw_cfg_arch_wellknown_keys[] = {
25 {FW_CFG_MACHINE_VERSION, "machine_version"},
26 {FW_CFG_CPU_FREQ, "cpu_frequency"},
27 };
28
29 for (size_t i = 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) {
30 if (fw_cfg_arch_wellknown_keys[i].key == key) {
31 return fw_cfg_arch_wellknown_keys[i].name;
32 }
33 }
34 return NULL;
35}