1 | /*␊ |
2 | * Copyright 2011,2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.␊ |
3 | */␊ |
4 | #include "libsaio.h"␊ |
5 | #include "bootstruct.h"␊ |
6 | #include "modules.h"␊ |
7 | #include "Platform.h"␊ |
8 | #include "efi.h"␊ |
9 | #include "mysmbios.h"␊ |
10 | ␊ |
11 | void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);␊ |
12 | void getProductName_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);␊ |
13 | void getboardproduct_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);␊ |
14 | ␊ |
15 | void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
16 | {␉␊ |
17 | readSMBIOSInfo(getSmbiosOriginal());␊ |
18 | ␊ |
19 | ␉execute_hook("ScanMemory", NULL, NULL, NULL, NULL, NULL, NULL);␊ |
20 | ␉SMBEntryPoint *patched_smb = setupSMBIOSTable(getSmbiosOriginal());␊ |
21 | ␊ |
22 | ␉if (patched_smb != NULL)␊ |
23 | Register_Smbios_Efi(patched_smb);␊ |
24 | ␉else␊ |
25 | {␊ |
26 | ␉␉verbose("Error: Could not get patched SMBIOS, fallback to original SMBIOS !!\n");␊ |
27 | ␊ |
28 | Register_Smbios_Efi(getSmbiosOriginal());␊ |
29 | ␊ |
30 | } ␊ |
31 | ␊ |
32 | }␊ |
33 | ␊ |
34 | void getProductName_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
35 | {␉␊ |
36 | ␉setupSmbiosConfigFile("SMBIOS.plist");␊ |
37 | ␉int len = 0;␊ |
38 | ␉const char *val = 0;␊ |
39 | ␉␊ |
40 | ␉if (getValueForKey("SMproductname", &val, &len, DEFAULT_SMBIOS_CONFIG)) {␊ |
41 | SetgPlatformName(val);␊ |
42 | ␊ |
43 | ␉} else {␊ |
44 | SetgPlatformName(getDefaultSMBproductName());␊ |
45 | ␊ |
46 | ␉}␉␊ |
47 | ␊ |
48 | }␊ |
49 | ␊ |
50 | void getboardproduct_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
51 | {␉␊ |
52 | ␉setupSmbiosConfigFile("SMBIOS.plist");␊ |
53 | ␉int len = 0;␊ |
54 | ␉const char *val = 0;␊ |
55 | ␉␊ |
56 | ␉if (getValueForKey("SMboardproduct", &val, &len, DEFAULT_SMBIOS_CONFIG)) {␊ |
57 | Setgboardproduct(val);␊ |
58 | ␊ |
59 | ␉} else {␊ |
60 | Setgboardproduct(getDefaultSMBBoardProduct());␊ |
61 | }␉␊ |
62 | ␉␊ |
63 | }␊ |
64 | ␊ |
65 | void SMBiosGetters_start(void);␊ |
66 | void SMBiosGetters_start(void)␊ |
67 | {␉␊ |
68 | register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook);␉␉␊ |
69 | register_hook_callback("getProductNamePatched", &getProductName_hook);␊ |
70 | register_hook_callback("getboardproductPatched", &getboardproduct_hook);␊ |
71 | }␊ |
72 | |