SmmAspireVn7Dash572GAcpiEnableLib.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /** @file
  2. Acer Aspire VN7-572G SMM Board ACPI Enable library
  3. Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include <Base.h>
  7. #include <PiDxe.h>
  8. #include <Library/DebugLib.h>
  9. #include <Library/EcLib.h>
  10. EFI_STATUS
  11. EFIAPI
  12. AspireVn7Dash572GBoardEnableAcpi (
  13. IN BOOLEAN EnableSci
  14. )
  15. {
  16. EFI_STATUS Status;
  17. /* Tests at runtime show this re-enables charging and battery reporting
  18. * - Obtained somewhere from somewhere in vendor's SmmKbcDriver (or RtKbcDriver).
  19. * Further reversing will be performed */
  20. Status = SendEcCommand (0xE9); /* Vendor implements using ACPI "CMDB" register" */
  21. if (EFI_ERROR (Status)) {
  22. DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0xE9) failed!\n", __FUNCTION__));
  23. return EFI_DEVICE_ERROR;
  24. }
  25. Status = SendEcData (0x81);
  26. if (EFI_ERROR (Status)) {
  27. DEBUG ((DEBUG_ERROR, "%a(): SendEcData(0x81) failed!\n", __FUNCTION__));
  28. return EFI_DEVICE_ERROR;
  29. }
  30. /* TODO: Set touchpad GPP owner to ACPI? */
  31. return EFI_SUCCESS;
  32. }
  33. EFI_STATUS
  34. EFIAPI
  35. AspireVn7Dash572GBoardDisableAcpi (
  36. IN BOOLEAN DisableSci
  37. )
  38. {
  39. EFI_STATUS Status;
  40. /* Tests at runtime show this disables charging and battery reporting
  41. * - Obtained somewhere from somewhere in vendor's SmmKbcDriver (or RtKbcDriver).
  42. * Further reversing will be performed */
  43. Status = SendEcCommand (0xE9); /* Vendor implements using ACPI "CMDB" register" */
  44. if (EFI_ERROR (Status)) {
  45. DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0xE9) failed!\n", __FUNCTION__));
  46. return EFI_DEVICE_ERROR;
  47. }
  48. Status = SendEcData (0x80);
  49. if (EFI_ERROR (Status)) {
  50. DEBUG ((DEBUG_ERROR, "%a(): SendEcData(0x80) failed!\n", __FUNCTION__));
  51. return EFI_DEVICE_ERROR;
  52. }
  53. /* TODO: Set touchpad GPP owner to GPIO? */
  54. return EFI_SUCCESS;
  55. }