Chameleon

Chameleon Svn Source Tree

Root/branches/slice/trunkM/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...)verbose(x)
22#else
23#define DBG(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) */
30inline bool platformCPUFeature(uint32_t feature)
31{
32return (Platform->CPU.Features & feature);
33}
34
35/** scan mem for memory autodection purpose */
36void scan_mem() {
37 static bool done = false;
38 if (done) return;
39
40/* our code only works on Intel chipsets so make sure here */
41if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086)
42bootInfo->memDetect = false;
43 else
44bootInfo->memDetect = true;
45/* manually */
46 getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->chameleonConfig);
47
48 if (bootInfo->memDetect) {
49if (dram_controller_dev != NULL) {
50scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...
51}
52 scan_spd(Platform);
53 }
54 done = true;
55}
56
57/**
58 Scan platform hardware information, called by the main entry point (common_boot() )
59 _before_ bootConfig xml parsing settings are loaded
60*/
61void scan_platform(void)
62{
63Platform = malloc(sizeof(PlatformInfo_t));
64memset(Platform, 0, sizeof(PlatformInfo_t));
65gPlatform = (void*)Platform;
66//BootOrder = malloc(sizeof(BLESS_EFI_LOAD_OPTION));
67//memset(BootOrder, 0, sizeof(BLESS_EFI_LOAD_OPTION));
68//gBootOrder = (void*)BootOrder;
69
70build_pci_dt();
71scan_cpu(Platform);
72//scan_mem(); Rek: called after pci devs init in fake_efi now ...
73}
74

Archive Download this file

Revision: 1171