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 "mem.h"␊ |
14 | #include "spd.h"␊ |
15 | #include "dram_controllers.h"␊ |
16 | ␊ |
17 | #ifndef DEBUG_PLATFORM␊ |
18 | #define DEBUG_PLATFORM 0␊ |
19 | #endif␊ |
20 | ␊ |
21 | #if DEBUG_PLATFORM␊ |
22 | #define DBG(x...)␉printf(x)␊ |
23 | #else␊ |
24 | #define DBG(x...)␊ |
25 | #endif␊ |
26 | ␊ |
27 | PlatformInfo_t Platform;␊ |
28 | pci_dt_t * dram_controller_dev = NULL;␊ |
29 | ␊ |
30 | /** Return if a CPU feature specified by feature is activated (true) or not (false) */␊ |
31 | bool platformCPUFeature(uint32_t feature)␊ |
32 | {␊ |
33 | ␉if (Platform.CPU.Features & feature) {␊ |
34 | ␉␉return true;␊ |
35 | ␉} else {␊ |
36 | ␉␉return false;␊ |
37 | ␉}␊ |
38 | }␊ |
39 | ␊ |
40 | /** scan mem for memory autodection purpose */␊ |
41 | void scan_mem() {␊ |
42 | static bool done = false;␊ |
43 | ␉if (done) return;␊ |
44 | ␉␊ |
45 | ␉bool useAutodetection = true;␊ |
46 | getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig);␊ |
47 | ␊ |
48 | if (useAutodetection) {␊ |
49 | ␉␉if (dram_controller_dev!=NULL) {␊ |
50 | ␉␉␉scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...␊ |
51 | ␉␉}␊ |
52 | scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed␊ |
53 | scan_spd(&Platform);␊ |
54 | ␉␉//getc();␊ |
55 | }␊ |
56 | ␉done = true;␊ |
57 | }␊ |
58 | ␊ |
59 | /** ␊ |
60 | Scan platform hardware information, called by the main entry point (common_boot() ) ␊ |
61 | _before_ bootConfig xml parsing settings are loaded␊ |
62 | */␊ |
63 | void scan_platform(void)␊ |
64 | {␊ |
65 | ␉memset(&Platform, 0, sizeof(Platform));␊ |
66 | ␉build_pci_dt();␊ |
67 | ␉scan_cpu(&Platform);␊ |
68 | ␉//scan_mem(); Rek: called after pci devs init in fake_efi now ...␊ |
69 | }␊ |
70 | |