Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/i386/modules/Memory/Memory.c

1/*
2 * Memory Module
3 * Scans the dram controller and(/or spd), and notifies OS X of the memory modules.
4 *This was converted from boot2 code to a boot2 module.
5 *
6 */
7
8//#include "libsaio.h"
9#include "boot.h"
10#include "pci.h"
11#include "platform.h"
12#include "dram_controllers.h"
13#include "spd.h"
14//#include "mem.h"
15#include "modules.h"
16
17#define kUseMemDetectKey "UseMemDetect"
18
19pci_dt_t *dram_controller_dev;
20
21
22void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4);
23void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4);
24
25
26void Memory_start()
27{
28register_hook_callback("PCIDevice", &Memory_PCIDevice_hook);
29register_hook_callback("ScanMemory", &Memory_hook);
30
31}
32
33void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4)
34{
35pci_dt_t* current = arg1;
36
37if (current->class_id == PCI_CLASS_BRIDGE_HOST
38&& (current->dev.addr == PCIADDR(0, 0, 0)))
39{
40dram_controller_dev = current;
41}
42}
43
44void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4)
45{
46bool useAutodetection = true;
47getBoolForKey(kUseMemDetectKey, &useAutodetection, &bootInfo->bootConfig);
48
49if (useAutodetection)
50{
51if (dram_controller_dev != NULL)
52{
53// Rek: pci dev ram controller direct and fully informative scan ...
54scan_dram_controller(dram_controller_dev);
55}
56}
57//Azi: gone on Kabyl's smbios update...???
58// unfortunately still necesary for some comp where spd cant read correct speed
59//scan_memory(&Platform);
60
61scan_spd(&Platform); // check Mek's implementation!
62}
63

Archive Download this file

Revision: 983