Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/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 "spd.h"
14#include "dram_controllers.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...)msglog(x)
24#endif
25
26PlatformInfo_t Platform;
27pci_dt_t * dram_controller_dev = NULL;
28
29/** Return if a CPU feature specified by feature is activated (true) or not (false) */
30bool platformCPUFeature(uint32_t feature)
31{
32if (Platform.CPU.Features & feature) {
33return true;
34} else {
35return false;
36}
37}
38
39/** scan mem for memory autodection purpose */
40void scan_mem()
41{
42static bool done = false;
43if (done) {
44return;
45}
46
47/* our code only works on Intel chipsets so make sure here */
48if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086) {
49bootInfo->memDetect = false;
50} else {
51bootInfo->memDetect = true;
52}
53/* manually */
54getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->chameleonConfig);
55
56if (bootInfo->memDetect) {
57if (dram_controller_dev != NULL) {
58scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...
59}
60scan_spd(&Platform);
61}
62done = 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: HEAD