EcCommands.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /** @file
  2. Definition for supported EC commands.
  3. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef EC_COMMANDS_H_
  7. #define EC_COMMANDS_H_
  8. //
  9. // Timeout if EC command/data fails
  10. //
  11. #define EC_TIME_OUT 0x20000
  12. //
  13. // The EC implements an embedded controller interface at ports 0x60/0x64 and a ACPI compliant
  14. // system management controller at ports 0x62/0x66. Port 0x66 is the command and status port,
  15. // port 0x62 is the data port.
  16. //
  17. #define EC_D_PORT 0x62
  18. #define EC_C_PORT 0x66
  19. //
  20. // Status Port 0x62
  21. //
  22. // FIXME: Some bits may be reserved
  23. #define EC_S_OVR_TMP 0x80 // Current CPU temperature exceeds the threshold
  24. #define EC_S_SMI_EVT 0x40 // SMI event is pending
  25. #define EC_S_SCI_EVT 0x20 // SCI event is pending
  26. #define EC_S_BURST 0x10 // EC is in burst mode or normal mode
  27. #define EC_S_CMD 0x08 // Byte in data register is command/data
  28. #define EC_S_IGN 0x04 // Ignored
  29. #define EC_S_IBF 0x02 // Input buffer is full/empty
  30. #define EC_S_OBF 0x01 // Output buffer is full/empty
  31. //
  32. // EC commands that are issued to the EC through the command port (0x66).
  33. // New commands and command parameters should only be written by the host when IBF=0.
  34. // Data read from the EC data port is valid only when OBF=1.
  35. //
  36. // TODO: It's unclear if the EC has such a command. Currently, we read model ID from ADCs.
  37. // As a definition is required for build, use a known safe command: EC query will do nicely.
  38. #define EC_C_FAB_ID 0x84 // Get the board fab ID in the lower 3 bits
  39. #define EC_C_ACPI_READ 0x80 // Read a byte of EC RAM
  40. #define EC_C_ACPI_WRITE 0x81 // Write a byte of EC RAM
  41. #endif // EC_COMMANDS_H_