hpet_emul.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * QEMU Emulated HPET support
  3. *
  4. * Copyright IBM, Corp. 2008
  5. *
  6. * Authors:
  7. * Beth Kon <bkon@us.ibm.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2. See
  10. * the COPYING file in the top-level directory.
  11. *
  12. */
  13. #ifndef QEMU_HPET_EMUL_H
  14. #define QEMU_HPET_EMUL_H
  15. #define HPET_BASE 0xfed00000
  16. #define HPET_CLK_PERIOD 10000000ULL /* 10000000 femtoseconds == 10ns*/
  17. #define FS_PER_NS 1000000
  18. #define HPET_MIN_TIMERS 3
  19. #define HPET_MAX_TIMERS 32
  20. #define HPET_NUM_IRQ_ROUTES 32
  21. #define HPET_CFG_ENABLE 0x001
  22. #define HPET_CFG_LEGACY 0x002
  23. #define HPET_ID 0x000
  24. #define HPET_PERIOD 0x004
  25. #define HPET_CFG 0x010
  26. #define HPET_STATUS 0x020
  27. #define HPET_COUNTER 0x0f0
  28. #define HPET_TN_CFG 0x000
  29. #define HPET_TN_CMP 0x008
  30. #define HPET_TN_ROUTE 0x010
  31. #define HPET_CFG_WRITE_MASK 0x3
  32. #define HPET_ID_NUM_TIM_SHIFT 8
  33. #define HPET_ID_NUM_TIM_MASK 0x1f00
  34. #define HPET_TN_TYPE_LEVEL 0x002
  35. #define HPET_TN_ENABLE 0x004
  36. #define HPET_TN_PERIODIC 0x008
  37. #define HPET_TN_PERIODIC_CAP 0x010
  38. #define HPET_TN_SIZE_CAP 0x020
  39. #define HPET_TN_SETVAL 0x040
  40. #define HPET_TN_32BIT 0x100
  41. #define HPET_TN_INT_ROUTE_MASK 0x3e00
  42. #define HPET_TN_FSB_ENABLE 0x4000
  43. #define HPET_TN_FSB_CAP 0x8000
  44. #define HPET_TN_CFG_WRITE_MASK 0x7f4e
  45. #define HPET_TN_INT_ROUTE_SHIFT 9
  46. #define HPET_TN_INT_ROUTE_CAP_SHIFT 32
  47. #define HPET_TN_CFG_BITS_READONLY_OR_RESERVED 0xffff80b1U
  48. struct hpet_fw_entry
  49. {
  50. uint32_t event_timer_block_id;
  51. uint64_t address;
  52. uint16_t min_tick;
  53. uint8_t page_prot;
  54. } QEMU_PACKED;
  55. struct hpet_fw_config
  56. {
  57. uint8_t count;
  58. struct hpet_fw_entry hpet[8];
  59. } QEMU_PACKED;
  60. extern struct hpet_fw_config hpet_cfg;
  61. #endif