Root/
Source at commit 550 created 13 years 6 months ago. By meklort, Removed static keyword from moduels. Fixed a few issues. NOTE: ACPI module is currently required for a proper boot. | |
---|---|
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 "boot.h"␊ |
14 | #include "bootstruct.h"␊ |
15 | #include "modules.h"␊ |
16 | ␊ |
17 | pci_dt_t * dram_controller_dev = NULL;␊ |
18 | ␊ |
19 | ␊ |
20 | void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
21 | void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
22 | ␊ |
23 | ␊ |
24 | void Memory_start()␊ |
25 | {␊ |
26 | ␉register_hook_callback("PCIDevice", &Memory_PCIDevice_hook);␊ |
27 | ␉register_hook_callback("ScanMemory", &Memory_hook);␊ |
28 | ␉␊ |
29 | }␊ |
30 | ␊ |
31 | void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
32 | {␊ |
33 | ␉pci_dt_t* current = arg1;␊ |
34 | ␉if(current->class_id == PCI_CLASS_BRIDGE_HOST)␊ |
35 | ␉{␊ |
36 | ␉␉dram_controller_dev = current;␊ |
37 | ␉}␊ |
38 | }␊ |
39 | ␊ |
40 | void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
41 | {␊ |
42 | ␉␊ |
43 | ␉␊ |
44 | ␉bool useAutodetection = true;␊ |
45 | getBoolForKey(kUseMemDetect, &useAutodetection, &bootInfo->bootConfig);␊ |
46 | ␉␊ |
47 | ␉␊ |
48 | if (useAutodetection) {␊ |
49 | ␉␉␊ |
50 | ␉␉if (dram_controller_dev!=NULL) {␊ |
51 | ␉␉␉scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...␊ |
52 | ␉␉}␊ |
53 | ␉␉scan_memory(Platform); // unfortunately still necesary for some comp where spd cant read correct speed␊ |
54 | ␉␉scan_spd(Platform);␊ |
55 | ␉␉//getc();␊ |
56 | }␊ |
57 | ␉␊ |
58 | } |