Chameleon

Chameleon Svn Source Tree

Root/branches/mozodojo/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
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
26PlatformInfo_t Platform;
27
28/** Return if a CPU feature specified by feature is activated (true) or not (false) */
29bool platformCPUFeature(uint32_t feature)
30{
31if (Platform.CPU.Features & feature) {
32return true;
33} else {
34return false;
35}
36}
37
38/** scan mem for memory autodection purpose */
39void scan_mem() {
40 static bool done = false;
41if (done) return;
42
43bool useAutodetection = true;
44 getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig);
45
46 if (useAutodetection) {
47 scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed
48 scan_spd(&Platform);
49 }
50done = true;
51}
52
53/**
54 Scan platform hardware information, called by the main entry point (common_boot() )
55 _before_ bootConfig xml parsing settings are loaded
56*/
57void scan_platform(void)
58{
59memset(&Platform, 0, sizeof(Platform));
60build_pci_dt();
61scan_cpu(&Platform);
62// It's working after some changes in strdup
63scan_mem();
64}
65

Archive Download this file

Revision: 214