Chameleon

Chameleon Commit Details

Date:2011-05-26 05:19:23 (12 years 10 months ago)
Author:Azimutz
Commit:880
Parents: 879
Message:Move "UseMemDetect" key to Memory module. Remove __udivdi3 (resides on klibc).
Changes:
M/branches/azimutz/Chazi/i386/libsaio/platform.c
M/branches/azimutz/Chazi/i386/modules/Memory/Memory.c
M/branches/azimutz/Chazi/i386/boot2/boot.h

File differences

branches/azimutz/Chazi/i386/libsaio/platform.c
3838
3939
4040
41
42
43
44
45
46
47
48
49
50
51
52
41
42
43
44
45
46
5347
5448
5549
/** scan mem for memory autodection purpose */
void scan_mem()
{
static bool done = false;
if (done) return;
bool useAutodetection = true;
getBoolForKey(kUseMemDetectKey, &useAutodetection, &bootInfo->bootConfig);
if (useAutodetection)
{
execute_hook("ScanMemory", NULL, NULL, NULL, NULL);
//getc();
}
done = true;
static bool done = false;
if (done) return;
execute_hook("ScanMemory", NULL, NULL, NULL, NULL);
done = true;
}
/**
branches/azimutz/Chazi/i386/boot2/boot.h
128128
129129
130130
131
131
132132
133133
134134
#define kEnableC2StatesKey "EnableC2State" // acpi_patcher.cgetBoolFK
#define kEnableC3StatesKey "EnableC3State" // acpi_patcher.cgetBoolFK
#define kEnableC4StatesKey "EnableC4State" // acpi_patcher.cgetBoolFK
#define kUseMemDetectKey "UseMemDetect" // platform.cgetBoolFK
//#define kUseMemDetectKey "UseMemDetect" // platform.cgetBoolFK
#define kSMBIOSdefaultsKey "SMBIOSdefaults" // smbios_patcher.cgetBoolFK
#define kSMBIOSKey "SMBIOS" // fake_efi.cgetValFK
//Azi: should this be changed to "SystemID"? BootHelp.txt matches SystemId
branches/azimutz/Chazi/i386/modules/Memory/Memory.c
11
2
3
2
3
44
55
66
77
8
8
9
910
1011
1112
......
1314
1415
1516
17
18
1619
1720
1821
......
3235
3336
3437
35
38
3639
3740
3841
3942
4043
4144
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
45
46
47
6048
61
49
6250
63
51
6452
65
66
53
54
6755
68
69
70
71
72
73
74
75
76
77
78
79
80
8156
82
83
84
85
57
58
59
8660
61
8762
/*
* DRAM Controller Module
* Scans the dram controller and notifies OS X of the memory modules.
* Memory Module
* Scans the dram controller and(/or spd), and notifies OS X of the memory modules.
*This was converted from boot2 code to a boot2 module.
*
*/
#include "libsaio.h"
//#include "libsaio.h"
#include "boot.h"
#include "pci.h"
#include "platform.h"
#include "dram_controllers.h"
//#include "mem.h"
#include "modules.h"
#define kUseMemDetectKey "UseMemDetect"
pci_dt_t *dram_controller_dev;
pci_dt_t* current = arg1;
if (current->class_id == PCI_CLASS_BRIDGE_HOST
&& (current->dev.addr == PCIADDR(0, 0, 0))
&& (current->dev.addr == PCIADDR(0, 0, 0)))
{
dram_controller_dev = current;
}
}
void Memory_hook(void* arg1, void* arg2, void* arg3, void* arg4)
{
if (dram_controller_dev!=NULL) {
scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ...
}
//Azi: gone on Kabyl's...???
//scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed
scan_spd(&Platform);
}
/* Nedded to devide 64bit numbers correctly. TODO: look into why the module needs this
* And why it isn't needed when compiled into boot2
*/
uint64_t __udivdi3(uint64_t numerator, uint64_t denominator)
{
uint64_t quotient = 0, qbit = 1;
{
bool useAutodetection = true;
getBoolForKey(kUseMemDetectKey, &useAutodetection, &bootInfo->bootConfig);
if (denominator)
if (useAutodetection)
{
while ((int64_t) denominator >= 0)
if (dram_controller_dev != NULL)
{
denominator <<= 1;
qbit <<= 1;
// Rek: pci dev ram controller direct and fully informative scan ...
scan_dram_controller(dram_controller_dev);
}
while (denominator)
{
if (denominator <= numerator)
{
numerator -= denominator;
quotient += qbit;
}
denominator >>= 1;
qbit >>= 1;
}
return quotient;
}
else {
stop("Divide by 0");
return 0;
}
//Azi: gone on Kabyl's smbios update...???
// unfortunately still necesary for some comp where spd cant read correct speed
//scan_memory(&Platform);
scan_spd(&Platform); // check Mek's implementation!
}

Archive Download the corresponding diff file

Revision: 880