1 | /*␊ |
2 | * Copyright (c) 2009 Evan Lojewski. All rights reserved.␊ |
3 | *␊ |
4 | */␊ |
5 | ␊ |
6 | /*␊ |
7 | * Copyright (c) 2010 cparm <armelcadetpetit@gmail.com>. All rights reserved.␊ |
8 | *␊ |
9 | */␊ |
10 | ␊ |
11 | #include "libsaio.h"␊ |
12 | #include "modules.h"␊ |
13 | #include "boot.h"␊ |
14 | #include "bootstruct.h"␊ |
15 | #include "pci_root.h"␊ |
16 | #include "acpi_patcher.h"␊ |
17 | ␊ |
18 | #define kEnableAcpi␉"EnableAcpiModule"␊ |
19 | ␊ |
20 | void AcpiPatcher_setupEfiConfigurationTable_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
21 | {␊ |
22 | ␉EFI_STATUS *ret = (EFI_STATUS *)arg1;␉␊ |
23 | ␉ ␊ |
24 | ␉// Setup ACPI (mackerintel's patch)␊ |
25 | ␉*ret = setupAcpi();␊ |
26 | ␊ |
27 | }␊ |
28 | ␊ |
29 | void is_ACPI_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){}␊ |
30 | ␊ |
31 | void AcpiPatcher_start()␊ |
32 | {␉␊ |
33 | ␉bool enable = true;␊ |
34 | ␊ |
35 | ␉getBoolForKey(kEnableAcpi, &enable, &bootInfo->bootConfig);␊ |
36 | ␉␊ |
37 | enable = (execute_hook("isACPIRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS);␊ |
38 | ␊ |
39 | ␉if (enable) {␉␉␊ |
40 | ␉␉register_hook_callback("setupAcpiEfi", &AcpiPatcher_setupEfiConfigurationTable_hook);␊ |
41 | register_hook_callback("isACPIRegistred", &is_ACPI_Patcher_Registred_Hook);␊ |
42 | ␊ |
43 | ␉}␊ |
44 | } |