Chameleon

Chameleon Svn Source Tree

Root/tags/2.0/i386/libsaio/platform.c

Source at commit 1753 created 12 years 6 months ago.
By blackosx, Merge recent package installer changes from my branch in to trunk. Includes updates to Credits, installation log messages and localizable strings. Check for existence of EFI system partition before running the check for previous Chameleon installations. Only backup /Extra folder if necessary when running upgrade install.
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...)
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 static bool done = false;
42 if (done) return;
43
44/* our code only works on Intel chipsets so make sure here */
45if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086)
46bootInfo->memDetect = false;
47 else
48bootInfo->memDetect = true;
49/* manually */
50 getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->chameleonConfig);
51
52 if (bootInfo->memDetect) {
53if (dram_controller_dev != NULL) {
54scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...
55}
56 scan_spd(&Platform);
57 }
58 done = true;
59}
60
61/**
62 Scan platform hardware information, called by the main entry point (common_boot() )
63 _before_ bootConfig xml parsing settings are loaded
64*/
65void scan_platform(void)
66{
67memset(&Platform, 0, sizeof(Platform));
68build_pci_dt();
69scan_cpu(&Platform);
70//scan_mem(); Rek: called after pci devs init in fake_efi now ...
71}
72

Archive Download this file

Revision: 1753