Root/
Source at commit 429 created 13 years 9 months ago. By meklort, Updated module system. Hooks can now be used within modules when cetaion functions are called in chameleon. Note that onle two hooks currently exist, more need to be added. I also updated the HelloWorld module to use a hook instead of print out right away. | |
---|---|
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 | ␊ |
16 | #ifndef DEBUG_PLATFORM␊ |
17 | #define DEBUG_PLATFORM 0␊ |
18 | #endif␊ |
19 | ␊ |
20 | #if DEBUG_PLATFORM␊ |
21 | #define DBG(x...)␉printf(x)␊ |
22 | #else␊ |
23 | #define DBG(x...)␊ |
24 | #endif␊ |
25 | ␊ |
26 | PlatformInfo_t Platform;␊ |
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 | bool useAutodetection = false;␊ |
41 | getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig);␊ |
42 | ␊ |
43 | if (useAutodetection) {␊ |
44 | scan_memory(&Platform);␊ |
45 | scan_spd(&Platform);␊ |
46 | }␊ |
47 | }␊ |
48 | ␊ |
49 | /** ␊ |
50 | Scan platform hardware information, called by the main entry point (common_boot() ) ␊ |
51 | _before_ bootConfig xml parsing settings are loaded␊ |
52 | */␊ |
53 | void scan_platform(void)␊ |
54 | {␊ |
55 | ␊ |
56 | ␉memset(&Platform, 0, sizeof(Platform));␊ |
57 | ␉build_pci_dt();␊ |
58 | ␉scan_cpu(&Platform);␊ |
59 | // disabled for now as options can't be read yet here: ␊ |
60 | // scan_mem();␊ |
61 | ␊ |
62 | }␊ |
63 |