Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
1 | /*␊ |
2 | * DRAM Controller Module␊ |
3 | * Scans the dram controller 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 "pci.h"␊ |
10 | #include "platform.h"␊ |
11 | #include "dram_controllers.h"␊ |
12 | #include "spd.h"␊ |
13 | #include "mem.h"␊ |
14 | #include "boot.h"␊ |
15 | #include "bootstruct.h"␊ |
16 | #include "modules.h"␊ |
17 | ␊ |
18 | pci_dt_t * dram_controller_dev = NULL;␊ |
19 | pci_dt_t * smbus_controller_dev = NULL;␊ |
20 | ␊ |
21 | ␊ |
22 | void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
23 | void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
24 | ␊ |
25 | ␊ |
26 | void Memory_start()␊ |
27 | {␊ |
28 | ␉register_hook_callback("PCIDevice", &Memory_PCIDevice_hook);␊ |
29 | ␉register_hook_callback("ScanMemory", &Memory_hook);␊ |
30 | ␉␊ |
31 | }␊ |
32 | ␊ |
33 | void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
34 | {␊ |
35 | ␉pci_dt_t* current = arg1;␊ |
36 | ␉if(current->class_id == PCI_CLASS_BRIDGE_HOST)␊ |
37 | ␉{␊ |
38 | ␉␉dram_controller_dev = current;␊ |
39 | ␉}␊ |
40 | ␉else if(is_smbus_controller(current))␊ |
41 | ␉{␊ |
42 | ␉␉smbus_controller_dev = current;␊ |
43 | ␉}␊ |
44 | ␊ |
45 | }␊ |
46 | ␊ |
47 | void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
48 | {␊ |
49 | ␉bool useAutodetection = true;␊ |
50 | getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig);␊ |
51 | ␉␊ |
52 | ␉␊ |
53 | if (useAutodetection) {␊ |
54 | ␉␉␊ |
55 | ␉␉if (dram_controller_dev!=NULL) {␊ |
56 | ␉␉␉scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...␊ |
57 | ␉␉}␊ |
58 | ␉␉scan_memory(Platform); // unfortunately still necesary for some comp where spd cant read correct speed␊ |
59 | ␉␉␊ |
60 | ␉␉if(smbus_controller_dev)␊ |
61 | ␉␉{␊ |
62 | ␉␉␉scan_spd(Platform, smbus_controller_dev);␊ |
63 | ␉␉}␊ |
64 | }␊ |
65 | ␉␊ |
66 | } |