Chameleon

Chameleon Svn Source Tree

Root/trunk/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
28bool platformCPUFeature(uint32_t feature)
29{
30if (Platform.CPU.Features & feature) {
31return true;
32} else {
33return false;
34}
35}
36
37void scan_platform(void)
38{
39const char*value;
40intlen;
41
42memset(&Platform, 0, sizeof(Platform));
43build_pci_dt();
44scan_cpu(&Platform);
45scan_memory(&Platform);
46scan_spd(&Platform);
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 0..6. Defaulting to 1!\n");
52Platform.Type = 1;
53}
54}
55}
56

Archive Download this file

Revision: 42