diff options
-rw-r--r-- | hw/acpi.h | 48 |
1 files changed, 23 insertions, 25 deletions
@@ -73,9 +73,11 @@ /* PM2_CNT */ #define ACPI_BITMASK_ARB_DISABLE 0x0001 -/* PM_TMR */ -struct ACPIPMTimer; +/* structs */ typedef struct ACPIPMTimer ACPIPMTimer; +typedef struct ACPIPM1EVT ACPIPM1EVT; +typedef struct ACPIPM1CNT ACPIPM1CNT; +typedef struct ACPIGPE ACPIGPE; typedef void (*acpi_update_sci_fn)(ACPIPMTimer *tmr); @@ -86,6 +88,25 @@ struct ACPIPMTimer { acpi_update_sci_fn update_sci; }; +struct ACPIPM1EVT { + uint16_t sts; + uint16_t en; +}; + +struct ACPIPM1CNT { + uint16_t cnt; + qemu_irq cmos_s3; +}; + +struct ACPIGPE { + uint32_t blk; + uint8_t len; + + uint8_t *sts; + uint8_t *en; +}; + +/* PM_TMR */ void acpi_pm_tmr_update(ACPIPMTimer *tmr, bool enable); void acpi_pm_tmr_calc_overflow_time(ACPIPMTimer *tmr); uint32_t acpi_pm_tmr_get(ACPIPMTimer *tmr); @@ -100,26 +121,12 @@ static inline int64_t acpi_pm_tmr_get_clock(void) } /* PM1a_EVT: piix and ich9 don't implement PM1b. */ -struct ACPIPM1EVT -{ - uint16_t sts; - uint16_t en; -}; -typedef struct ACPIPM1EVT ACPIPM1EVT; - uint16_t acpi_pm1_evt_get_sts(ACPIPM1EVT *pm1, int64_t overflow_time); void acpi_pm1_evt_write_sts(ACPIPM1EVT *pm1, ACPIPMTimer *tmr, uint16_t val); void acpi_pm1_evt_power_down(ACPIPM1EVT *pm1, ACPIPMTimer *tmr); void acpi_pm1_evt_reset(ACPIPM1EVT *pm1); /* PM1a_CNT: piix and ich9 don't implement PM1b CNT. */ -struct ACPIPM1CNT { - uint16_t cnt; - - qemu_irq cmos_s3; -}; -typedef struct ACPIPM1CNT ACPIPM1CNT; - void acpi_pm1_cnt_init(ACPIPM1CNT *pm1_cnt, qemu_irq cmos_s3); void acpi_pm1_cnt_write(ACPIPM1EVT *pm1a, ACPIPM1CNT *pm1_cnt, uint16_t val); void acpi_pm1_cnt_update(ACPIPM1CNT *pm1_cnt, @@ -127,15 +134,6 @@ void acpi_pm1_cnt_update(ACPIPM1CNT *pm1_cnt, void acpi_pm1_cnt_reset(ACPIPM1CNT *pm1_cnt); /* GPE0 */ -struct ACPIGPE { - uint32_t blk; - uint8_t len; - - uint8_t *sts; - uint8_t *en; -}; -typedef struct ACPIGPE ACPIGPE; - void acpi_gpe_init(ACPIGPE *gpe, uint8_t len); void acpi_gpe_blk(ACPIGPE *gpe, uint32_t blk); void acpi_gpe_reset(ACPIGPE *gpe); |