acpi.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef KVM_ACPI_H
  2. #define KVM_ACPI_H 1
  3. #include "libcflat.h"
  4. #define ACPI_SIGNATURE(c1, c2, c3, c4) \
  5. ((c1) | ((c2) << 8) | ((c3) << 16) | ((c4) << 24))
  6. #define RSDP_SIGNATURE ACPI_SIGNATURE('R','S','D','P')
  7. #define RSDT_SIGNATURE ACPI_SIGNATURE('R','S','D','T')
  8. #define FACP_SIGNATURE ACPI_SIGNATURE('F','A','C','P')
  9. #define FACS_SIGNATURE ACPI_SIGNATURE('F','A','C','S')
  10. struct rsdp_descriptor { /* Root System Descriptor Pointer */
  11. u64 signature; /* ACPI signature, contains "RSD PTR " */
  12. u8 checksum; /* To make sum of struct == 0 */
  13. u8 oem_id [6]; /* OEM identification */
  14. u8 revision; /* Must be 0 for 1.0, 2 for 2.0 */
  15. u32 rsdt_physical_address; /* 32-bit physical address of RSDT */
  16. u32 length; /* XSDT Length in bytes including hdr */
  17. u64 xsdt_physical_address; /* 64-bit physical address of XSDT */
  18. u8 extended_checksum; /* Checksum of entire table */
  19. u8 reserved [3]; /* Reserved field must be 0 */
  20. };
  21. #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
  22. u32 signature; /* ACPI signature (4 ASCII characters) */ \
  23. u32 length; /* Length of table, in bytes, including header */ \
  24. u8 revision; /* ACPI Specification minor version # */ \
  25. u8 checksum; /* To make sum of entire table == 0 */ \
  26. u8 oem_id [6]; /* OEM identification */ \
  27. u8 oem_table_id [8]; /* OEM table identification */ \
  28. u32 oem_revision; /* OEM revision number */ \
  29. u8 asl_compiler_id [4]; /* ASL compiler vendor ID */ \
  30. u32 asl_compiler_revision; /* ASL compiler revision number */
  31. struct acpi_table {
  32. ACPI_TABLE_HEADER_DEF
  33. char data[0];
  34. };
  35. struct rsdt_descriptor_rev1 {
  36. ACPI_TABLE_HEADER_DEF
  37. u32 table_offset_entry[0];
  38. };
  39. struct fadt_descriptor_rev1
  40. {
  41. ACPI_TABLE_HEADER_DEF /* ACPI common table header */
  42. u32 firmware_ctrl; /* Physical address of FACS */
  43. u32 dsdt; /* Physical address of DSDT */
  44. u8 model; /* System Interrupt Model */
  45. u8 reserved1; /* Reserved */
  46. u16 sci_int; /* System vector of SCI interrupt */
  47. u32 smi_cmd; /* Port address of SMI command port */
  48. u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
  49. u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
  50. u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
  51. u8 reserved2; /* Reserved - must be zero */
  52. u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */
  53. u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */
  54. u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
  55. u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
  56. u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
  57. u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
  58. u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */
  59. u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */
  60. u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */
  61. u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */
  62. u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
  63. u8 pm_tmr_len; /* Byte Length of ports at pm_tm_blk */
  64. u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
  65. u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
  66. u8 gpe1_base; /* Offset in gpe model where gpe1 events start */
  67. u8 reserved3; /* Reserved */
  68. u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */
  69. u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */
  70. u16 flush_size; /* Size of area read to flush caches */
  71. u16 flush_stride; /* Stride used in flushing caches */
  72. u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */
  73. u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */
  74. u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */
  75. u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */
  76. u8 century; /* Index to century in RTC CMOS RAM */
  77. u8 reserved4; /* Reserved */
  78. u8 reserved4a; /* Reserved */
  79. u8 reserved4b; /* Reserved */
  80. };
  81. struct facs_descriptor_rev1
  82. {
  83. u32 signature; /* ACPI Signature */
  84. u32 length; /* Length of structure, in bytes */
  85. u32 hardware_signature; /* Hardware configuration signature */
  86. u32 firmware_waking_vector; /* ACPI OS waking vector */
  87. u32 global_lock; /* Global Lock */
  88. u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */
  89. u32 reserved1 : 31; /* Must be 0 */
  90. u8 reserved3 [40]; /* Reserved - must be zero */
  91. };
  92. void* find_acpi_table_addr(u32 sig);
  93. #endif