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 | #include "efi.h"␊ |
15 | ␊ |
16 | #ifndef DEBUG_PLATFORM␊ |
17 | #define DEBUG_PLATFORM 0␊ |
18 | #endif␊ |
19 | ␊ |
20 | #if DEBUG_PLATFORM␊ |
21 | #define DBG(x...)␉verbose(x)␊ |
22 | #else␊ |
23 | #define DBG(x...)␊ |
24 | #endif␊ |
25 | ␊ |
26 | PlatformInfo_t* Platform;␊ |
27 | BLESS_EFI_LOAD_OPTION* BootOrder;␊ |
28 | /** Return if a CPU feature specified by feature is activated (true) or not (false) */␊ |
29 | inline bool platformCPUFeature(uint32_t feature)␊ |
30 | {␊ |
31 | ␉return (Platform->CPU.Features & feature);␊ |
32 | }␊ |
33 | ␊ |
34 | /** scan mem for memory autodection purpose */␊ |
35 | void scan_mem() {␊ |
36 | static bool done = false;␊ |
37 | if (done) return;␊ |
38 | ␊ |
39 | ␉execute_hook("ScanMemory", NULL, NULL, NULL, NULL);␊ |
40 | done = true;␊ |
41 | }␊ |
42 | ␊ |
43 | /** ␊ |
44 | Scan platform hardware information, called by the main entry point (common_boot() ) ␊ |
45 | _before_ bootConfig xml parsing settings are loaded␊ |
46 | */␊ |
47 | void scan_platform(void)␊ |
48 | {␉␊ |
49 | ␉Platform = malloc(sizeof(PlatformInfo_t));␊ |
50 | ␉memset(Platform, 0, sizeof(PlatformInfo_t));␊ |
51 | ␉gPlatform = (void*)Platform;␊ |
52 | ␉BootOrder = malloc(sizeof(BLESS_EFI_LOAD_OPTION));␊ |
53 | ␉memset(BootOrder, 0, sizeof(BLESS_EFI_LOAD_OPTION));␊ |
54 | ␉gBootOrder = (void*)BootOrder;␊ |
55 | ␉␊ |
56 | ␉build_pci_dt();␊ |
57 | ␉scan_cpu(); //Platform);␊ |
58 | ␉//scan_mem(); Rek: called after pci devs init in fake_efi now ...␊ |
59 | }␊ |
60 | |