Chameleon

Chameleon Svn Source Tree

Root/branches/JrCs/i386/libsaio/platform.c

1/*
2 * platform.c
3 *
4 */
5
6#include "libsaio.h"
7#include "boot.h"
8#include "bootstruct.h"
9#include "pci.h"
10#include "platform.h"
11#include "cpu.h"
12#include "mem.h"
13#include "spd.h"
14
15#ifndef DEBUG_PLATFORM
16#define DEBUG_PLATFORM 0
17#endif
18
19#if DEBUG_PLATFORM
20#define DBG(x...)printf(x)
21#else
22#define DBG(x...)
23#endif
24
25PlatformInfo_t Platform;
26
27bool platformCPUFeature(uint32_t feature)
28{
29if (Platform.CPU.Features & feature) {
30return true;
31} else {
32return false;
33}
34}
35
36void scan_platform(void)
37{
38const char*value;
39int len;
40
41memset(&Platform, 0, sizeof(Platform));
42build_pci_dt();
43scan_cpu(&Platform);
44scan_memory(&Platform);
45scan_spd(&Platform);
46
47Platform.Type = 1; /* Desktop */
48if (getValueForKey(kSystemType, &value, &len, &bootInfo->bootConfig) && value != NULL) {
49Platform.Type = (unsigned char) strtoul(value, NULL, 10);
50if (Platform.Type > 6) {
51verbose("Error: system-type must be between 0 to 6. Defaulting to 1 !\n");
52Platform.Type = 1;
53}
54}
55}
56

Archive Download this file

Revision: 20