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