driver: eSPI: unify the bit fields of ACPI/KBC event data

The KBC/ACPI event data is 4-byte in width and composed of
event/data/type fields. However, the field position is defined by each
chip vendor via macro and not unified in the current implementation.
The commit uses the structure bit field to define and unify the field
position. It helps the application access it with a common approach.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
This commit is contained in:
Jun Lin 2021-07-26 11:11:09 +08:00 committed by Christopher Friedt
commit c51a4ecd42
3 changed files with 47 additions and 32 deletions

View file

@ -253,6 +253,29 @@ enum lpc_peripheral_opcode {
#endif /* CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE */
};
/* KBC 8042 event: Input Buffer Full */
#define HOST_KBC_EVT_IBF BIT(0)
/* KBC 8042 event: Output Buffer Empty */
#define HOST_KBC_EVT_OBE BIT(1)
/**
* @brief Bit field definition of evt_data in struct espi_event for KBC.
*/
struct espi_evt_data_kbc {
uint32_t type:8;
uint32_t data:8;
uint32_t evt:8;
uint32_t reserved:8;
};
/**
* @brief Bit field definition of evt_data in struct espi_event for ACPI.
*/
struct espi_evt_data_acpi {
uint32_t type:8;
uint32_t data:8;
uint32_t reserved:16;
};
/**
* @brief eSPI event
*/