Root/
Source at commit 1163 created 13 years 12 days ago. By mozodojo, mistakes fixes in new _CST SSDT code (P.S. If you have better variables/keys naming option you welcome to change them) | |
---|---|
1 | /*␊ |
2 | * platform.c␊ |
3 | *␊ |
4 | * AsereBLN: cleanup␊ |
5 | */␊ |
6 | ␊ |
7 | #include "libsaio.h"␊ |
8 | #include "boot.h"␊ |
9 | #include "bootstruct.h"␊ |
10 | #include "pci.h"␊ |
11 | #include "platform.h"␊ |
12 | #include "cpu.h"␊ |
13 | #include "modules.h"␊ |
14 | ␊ |
15 | #ifndef DEBUG_PLATFORM␊ |
16 | #define DEBUG_PLATFORM 0␊ |
17 | #endif␊ |
18 | ␊ |
19 | #if DEBUG_PLATFORM␊ |
20 | #define DBG(x...)␉printf(x)␊ |
21 | #else␊ |
22 | #define DBG(x...)␊ |
23 | #endif␊ |
24 | ␊ |
25 | PlatformInfo_t* Platform;␊ |
26 | ␊ |
27 | /** Return if a CPU feature specified by feature is activated (true) or not (false) */␊ |
28 | inline bool platformCPUFeature(uint32_t feature)␊ |
29 | {␊ |
30 | ␉return (Platform->CPU.Features & feature);␊ |
31 | }␊ |
32 | ␊ |
33 | /** scan mem for memory autodection purpose */␊ |
34 | void scan_mem() {␊ |
35 | static bool done = false;␊ |
36 | if (done) return;␊ |
37 | ␊ |
38 | ␉execute_hook("ScanMemory", NULL, NULL, NULL, NULL);␊ |
39 | done = true;␊ |
40 | }␊ |
41 | ␊ |
42 | /** ␊ |
43 | Scan platform hardware information, called by the main entry point (common_boot() ) ␊ |
44 | _before_ bootConfig xml parsing settings are loaded␊ |
45 | */␊ |
46 | void scan_platform(void)␊ |
47 | {␉␊ |
48 | ␉Platform = malloc(sizeof(Platform));␊ |
49 | ␉memset(Platform, 0, sizeof(Platform));␊ |
50 | ␉build_pci_dt();␊ |
51 | ␉scan_cpu(Platform);␊ |
52 | ␉//scan_mem(); Rek: called after pci devs init in fake_efi now ...␊ |
53 | }␊ |
54 |