2
0

fw_cfg.c 885 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  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. #include "qemu/osdep.h"
  15. #include "hw/mips/fw_cfg.h"
  16. #include "hw/nvram/fw_cfg.h"
  17. const char *fw_cfg_arch_key_name(uint16_t key)
  18. {
  19. static const struct {
  20. uint16_t key;
  21. const char *name;
  22. } fw_cfg_arch_wellknown_keys[] = {
  23. {FW_CFG_MACHINE_VERSION, "machine_version"},
  24. {FW_CFG_CPU_FREQ, "cpu_frequency"},
  25. };
  26. for (size_t i = 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) {
  27. if (fw_cfg_arch_wellknown_keys[i].key == key) {
  28. return fw_cfg_arch_wellknown_keys[i].name;
  29. }
  30. }
  31. return NULL;
  32. }