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 | ␊ |
14 | #ifndef DEBUG_PLATFORM␊ |
15 | #define DEBUG_PLATFORM 0␊ |
16 | #endif␊ |
17 | ␊ |
18 | #if DEBUG_PLATFORM␊ |
19 | #define DBG(x...)␉printf(x)␊ |
20 | #else␊ |
21 | #define DBG(x...)␊ |
22 | #endif␊ |
23 | ␊ |
24 | PlatformInfo_t *Platform;␊ |
25 | ␊ |
26 | /** Return if a CPU feature specified by feature is activated (true) or not (false) */␊ |
27 | inline bool platformCPUFeature(uint32_t feature)␊ |
28 | {␊ |
29 | ␉return (Platform->CPU.Features & feature);␊ |
30 | }␊ |
31 | ␊ |
32 | /** Return if a CPU Extended feature specified by feature is activated (true) or not (false) */␊ |
33 | inline bool platformCPUExtFeature(uint32_t feature)␊ |
34 | {␊ |
35 | ␉return (Platform->CPU.ExtFeatures & feature);␊ |
36 | }␊ |
37 | ␊ |
38 | /** ␊ |
39 | Scan platform hardware information, called by the main entry point (common_boot() ) ␊ |
40 | _before_ bootConfig xml parsing settings are loaded␊ |
41 | */␊ |
42 | void scan_platform(void)␊ |
43 | {␉␊ |
44 | ␉Platform = malloc(sizeof(Platform));␊ |
45 | ␉memset(Platform, 0, sizeof(Platform));␊ |
46 | ␉build_pci_dt();␊ |
47 | ␉scan_cpu(Platform);␊ |
48 | }␊ |
49 | |