Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazileon/i386/libsaio/platform.c

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
27PlatformInfo_t Platform;
28pci_dt_t * dram_controller_dev = NULL;
29
30/** Return if a CPU feature specified by feature is activated (true) or not (false) */
31bool platformCPUFeature(uint32_t feature)
32{
33if (Platform.CPU.Features & feature) {
34return true;
35} else {
36return false;
37}
38}
39
40/** scan mem for memory autodection purpose */
41void scan_mem()
42{
43 static bool done = false;
44
45 if (done)
46return;
47
48 bool useAutodetection = true; //Azi:default
49
50 getBoolForKey(kUseMemDetectKey, &useAutodetection, &bootInfo->bootConfig);
51
52 if (useAutodetection)
53{
54if (dram_controller_dev != NULL)
55{
56scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...
57}
58 scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed
59 scan_spd(&Platform);
60//pause(); //Azi:---
61 }
62 done = true;
63}
64
65/**
66 Scan platform hardware information, called by the main entry point (common_boot() )
67 _before_ bootConfig xml parsing settings are loaded
68*/
69void scan_platform(void)
70{
71memset(&Platform, 0, sizeof(Platform));
72build_pci_dt();
73scan_cpu(&Platform);
74//scan_mem(); Rek: called after pci devs init in fake_efi now ...
75}
76

Archive Download this file

Revision: 296