Chameleon

Chameleon Svn Source Tree

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

1/*
2 * platform.c
3 *
4 * AsereBLN: cleanup
5 */
6
7//#include "libsaio.h"
8//#include "bootstruct.h"
9#include "boot.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 static bool done = false;
43 if (done) return;
44
45 bool useAutodetection = true;
46 getBoolForKey(kUseMemDetectKey, &useAutodetection, &bootInfo->bootConfig);
47
48 if (useAutodetection) {
49if (dram_controller_dev!=NULL) {
50scan_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*/
63void scan_platform(void)
64{
65memset(&Platform, 0, sizeof(Platform));
66build_pci_dt();
67scan_cpu(&Platform);
68//scan_mem(); Rek: called after pci devs init in fake_efi now ...
69}
70

Archive Download this file

Revision: 515