Continue.
9.
i386/libsaio/acpi_patcher.hCODE
+//Slice - it's bullshit to define variables in header file
+//uint64_t acpi10_p;
+//uint64_t acpi20_p;
+//uint64_t smbios_p;
If a header file are included in two different c files then variables will be different.
10.
i386/libsaio/cpu.cCODE
- DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0));
+ DBG("msr(0x%04x): platform_info %08x-%08x\n", MSR_PLATFORM_INFO,
+ (msr >> 32) & 0xffffffff, msr & 0xffffffff);
What do you want to see in bdmesg.log, source line number or number of used MSR?
CODE
- /* Mobile CPU */
- if (rdmsr64(MSR_IA32_PLATFORM_ID) & (1<<28)) {
+ /* Mobile CPU ? */
+//Slice
+ msr = rdmsr64(MSR_IA32_PLATFORM_ID);
+ DBG("msr(0x%04x): MSR_IA32_PLATFORM_ID 0x%08x\n", MSR_IA32_PLATFORM_ID, msr & 0xffffffff); //__LINE__ - source line number :)
+ if (msr) {
+ p->CPU.Mobile = FALSE;
+ switch (p->CPU.Model) {
+ case 0x0D:
+ p->CPU.Mobile = TRUE; // CPU_FEATURE_MOBILE;
+ break;
+ case 0x0F:
+ p->CPU.Mobile = FALSE; // CPU_FEATURE_MOBILE;
+ break;
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x06:
+ p->CPU.Mobile = (rdmsr64(MSR_P4_EBC_FREQUENCY_ID) && (1 << 21));
+ break;
+ default:
+ p->CPU.Mobile = (rdmsr64(MSR_IA32_PLATFORM_ID) && (1<<28));
+ break;
+ }
+ if (p->CPU.Mobile) {
p->CPU.Features |= CPU_FEATURE_MOBILE;
}
The mobility calculation is not common for any CPU.
11.
i386/libsaio/device_inject.cCODE
- verbose("efi_inject_get_devprop_string NULL trying stringdata\n");
+// verbose("efi_inject_get_devprop_string NULL trying stringdata\n");
The spam.
CODE
- uint32_t strlength;
- char *string = efi_inject_get_devprop_string(&strlength);
+// uint32_t strlength;
+ char *string = efi_inject_get_devprop_string(&stringlength);
- cnt = strlength * 2;
+ cnt = stringlength * 2;
Reusing variable instead of creating new one. Is it a bug?
12.
i386/libsaio/disk.cCODE
+ case FDISK_LINUX:
+ bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap,
+ 0, 0, 0, 0, 0, 0, EX2GetDescription,
+ (BVFree)free, 0, kBIOSDevTypeHardDrive, 0);
+ break;
An attempt to detect Linux.
http://forum.voodooprojects.org/index.php/topic,1832.0.htmlCODE
BVRef diskScanBootVolumes( int biosdev, int * countPtr )
{
- struct DiskBVMap * map;
+ struct DiskBVMap * map = NULL;
The variable may be used uninitialized.
13.
i386/libsaio/fake_efi.cCODE
-#include "smbios.h"
+#include "smbios_getters.h"
I need more relations between SMBIOS and EFI.
CODE
+ smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED); // process smbios asap
+ bool useDMIinfoCPU = true;
+ getBoolForKey("GetCPUfromBIOS", &useDMIinfoCPU, &bootInfo->bootConfig);
+ if (useDMIinfoCPU) {
+ scan_cpu_DMI(); //Platform);
+ }
Here I want to explain more.
For example. Intel Core 2 Duo E6300. Native BusSpeed=266MHz, default CPU speed=266*6=1600MHz. It is very low and I can easy to overclock it.
366*7=2562MHz. But coeff=7 is turbo, MSR inform us about max=6 turbo=7. So what Chameleon will calculate?
TSC speed=2560Mhz ratio=6 and follow FSB=467MHz with following system bugs.
On the other hand, if we took FSB from MSR it will be 266 but not 366 as we set.
Other user report
http://forum.voodooprojects.org/index.php/topic,1912.0.htmlSo I suppose to not calculate CPU and FSB speed and just take them from DMI. So some additional codes in SMBIOS_patcher needed.
CODE
// Generate efi device strings
+ //Slice - remember globals
+ Platform = (PlatformInfo_t *)gPlatform;
+ root_pci_dev = (pci_dt_t*)gRootPCIDev;
setup_pci_devs(root_pci_dev);
+ smbios_p = (EFI_PTR32)getSmbios(SMBIOS_ORIGINAL);
+#if DEBUG
+ verbose("SMBIOS_ORIGINAL=%x \n", smbios_p);
+#endif
- readSMBIOSInfo(getSmbios(SMBIOS_ORIGINAL));
+ getSmbiosTableStructure((void*)(EFI_PTR32)smbios_p);
+ readSMBIOSInfo((void*)(EFI_PTR32)smbios_p);
+ getSmbiosProductName();
+ getSmbiosMacModel();
+ setupAcpi();
These codes appears to do the work.
14.
i386/libsaio/gma.cCODE
+#include "graphics.h"
Remember globals.
CODE
-uint8_t GMAX3100_vals[22][4] = {
- { 0x01,0x00,0x00,0x00 },
....
+//Slice - correct all values, still not sure
+uint8_t GMAX3100_vals[23][4] = {
+ { 0x01,0x00,0x00,0x00 }, //0 "AAPL,HasPanel"
I correct these values according to my working X3100.
CODE
+ devprop_add_value(device, "AAPL01,DualLink", &gDualLink, 1); //GMAX3100_vals[10]
As calculated by Resolution module.
CODE
+// devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
What is the Currency?
15.
i386/libsaio/hfs.cCODE
- verbose("Read HFS%s file: [%s/%s] %d bytes.\n",
- (gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length);
+// verbose("Read HFS%s file: [%s/%s] %d bytes.\n",
+// (gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length);
I consider this as a main patch to Chameleon

I do not want to see 200 lines about loading kexts in IgnoreCache mode. 5 minutes to see them !!!
16.
i386/libsaio/msdos.cCODE
- verbose("Read FAT%d file: [%s/%s] %d bytes.\n",
- msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread);
+// verbose("Read FAT%d file: [%s/%s] %d bytes.\n",
+// msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread);
Same here.
17.
i386/libsaio/nvidia.cCODE
-static uint8_t default_dcfg_0[] = {0xff, 0xff, 0xff, 0xff};
-static uint8_t default_dcfg_1[] = {0xff, 0xff, 0xff, 0xff};
+static uint8_t default_dcfg_0[]= {0x03, 0x01, 0x03, 0x00};
+static uint8_t default_dcfg_1[]= {0xff, 0xff, 0x00, 0x01};
Default values should be reliable for users who can't set own values.
CODE
+static uint8_t default_NVPM[]= {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
This is useful setting.
CODE
+ delay(50);
Wait for PCI bus.
18.
i386/libsaio/pci.cCODE
+ new->subclass = pci_config_read8(pci_addr, PCI_CLASS_PROG);
I want to see more info about PCI devices.
CODE
+
+ if (!root_pci_dev)
+ return;
+ gRootPCIDev = (void*)root_pci_dev;
Safety. The reason is losing pci pointer in some cases.
CODE
- printf("%02x:%02x.%x [%04x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n",
+ msglog("%02x:%02x.%x [%04x%02x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n",
current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func,
- current->class_id, current->vendor_id, current->device_id,
+ current->class_id, current->subclass, current->vendor_id, current->device_id,
Dump more PCI infos.
19.
i386/libsaio/pci.hCODE
- } subsys_id;
-
+ }subsys_id;
+ uint8_t revision;
+ uint8_t subclass;
Required change in definition.
20.
i386/libsaio/pci_setup.cCODE
+uint16_t vgaVendor;
......
- switch (current->vendor_id)
+ {
+ vgaVendor = current->vendor_id;
+ switch (vgaVendor)
{
The variable needed for SMBIOS patch.