Root/
Source at commit 522 created 13 years 6 months ago. By meklort, Temperary bug fix. NOTE: GUI and Memory modules currently do not work corretly. If you want the goot screen, you can include teh GUI module, however you cannot include a theme directory ye, otherwise it'll just reboot | |
---|---|
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 "modules.h"␊ |
15 | ␊ |
16 | pci_dt_t *dram_controller_dev;␊ |
17 | ␊ |
18 | ␊ |
19 | void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
20 | void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
21 | ␊ |
22 | void Memory_start()␊ |
23 | {␊ |
24 | ␉register_hook_callback("PCIDevice", &Memory_PCIDevice_hook);␊ |
25 | ␉register_hook_callback("ScanMemory", &Memory_hook);␊ |
26 | ␊ |
27 | }␊ |
28 | ␊ |
29 | void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
30 | {␊ |
31 | ␉printf("PCIDevice hook\n");␊ |
32 | ␉pci_dt_t* current = arg1;␊ |
33 | ␉if(current->class_id == PCI_CLASS_BRIDGE_HOST)␊ |
34 | ␉{␊ |
35 | ␉␉printf(" PCI_CLASS_BRIDGE_HOST located\n");␊ |
36 | ␊ |
37 | ␉␉dram_controller_dev = current;␊ |
38 | ␉}␊ |
39 | }␊ |
40 | ␊ |
41 | void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
42 | {␊ |
43 | ␉printf("ScanMemory hook\n");␊ |
44 | ␉if (dram_controller_dev!=NULL) {␊ |
45 | ␉␉printf(" scan_dram_controller\n");␊ |
46 | ␊ |
47 | ␉␉scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...␊ |
48 | ␉}␊ |
49 | ␉scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed␊ |
50 | ␉scan_spd(&Platform);␊ |
51 | }␊ |
52 |