1 | /*␊ |
2 | * platform.c␊ |
3 | *␊ |
4 | * AsereBLN: cleanup␊ |
5 | */␊ |
6 | ␊ |
7 | //#include "libsaio.h"␊ |
8 | //#include "bootstruct.h"␊ |
9 | #include "boot.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 | pci_dt_t * dram_controller_dev = NULL;␊ |
27 | ␊ |
28 | /** Return if a CPU feature specified by feature is activated (true) or not (false) */␊ |
29 | bool platformCPUFeature(uint32_t feature)␊ |
30 | {␊ |
31 | ␉if (Platform.CPU.Features & feature) {␊ |
32 | ␉␉return true;␊ |
33 | ␉} else {␊ |
34 | ␉␉return false;␊ |
35 | ␉}␊ |
36 | }␊ |
37 | ␊ |
38 | /** scan mem for memory autodection purpose */␊ |
39 | void scan_mem()␊ |
40 | {␊ |
41 | static bool done = false;␊ |
42 | if (done) return;␊ |
43 | ␊ |
44 | bool useAutodetection = true;␊ |
45 | getBoolForKey(kUseMemDetectKey, &useAutodetection, &bootInfo->bootConfig);␊ |
46 | ␊ |
47 | if (useAutodetection)␊ |
48 | ␉{␊ |
49 | ␉␉execute_hook("ScanMemory", NULL, NULL, NULL, NULL);␊ |
50 | ␉␉//getc();␊ |
51 | ␉}␊ |
52 | done = true;␊ |
53 | }␊ |
54 | ␊ |
55 | /**␊ |
56 | Scan platform hardware information, called by the main entry point (common_boot() ) ␊ |
57 | _before_ bootConfig xml parsing settings are loaded␊ |
58 | */␊ |
59 | void scan_platform(void)␊ |
60 | {␊ |
61 | ␉memset(&Platform, 0, sizeof(Platform));␊ |
62 | ␉build_pci_dt();␊ |
63 | ␉scan_cpu(&Platform);␊ |
64 | ␉//scan_mem(); Rek: called after pci devs init in fake_efi now ...␊ |
65 | }␊ |
66 | |