Chameleon

Chameleon Commit Details

Date:2014-11-20 00:56:47 (9 years 5 months ago)
Author:ErmaC
Commit:2490
Parents: 2489
Message:Typo
Changes:
M/trunk/i386/libsaio/console.c
M/trunk/i386/libsaio/msdos.c
M/trunk/i386/libsaio/smbios_getters.c
M/trunk/i386/modules/AcpiCodec/acpi_codec.c
M/trunk/i386/libsaio/nvidia.c
M/trunk/CHANGES
M/trunk/i386/libsaio/sys.c

File differences

trunk/i386/libsaio/console.c
175175
176176
177177
178
178
179
179180
180
181
182
183
181184
182185
183186
......
207210
208211
209212
210
211
213
214
215
216
212217
213
218
219
220
214221
215222
216223
......
241248
242249
243250
244
251
252
245253
246
254
255
256
247257
248258
249259
......
275285
276286
277287
278
288
289
279290
280
291
292
293
281294
282295
283296
{
va_list ap;
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
prf(fmt, ap, putchar, 0);
} else {
}
else
{
vprf(fmt, ap);
}
va_list ap;
va_start(ap, fmt);
if (gVerboseMode) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
if (gVerboseMode)
{
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
prf(fmt, ap, putchar, 0);
} else {
}
else
{
vprf(fmt, ap);
}
}
va_list ap;
gErrors = true;
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
prf(fmt, ap, putchar, 0);
} else {
}
else
{
vprf(fmt, ap);
}
printf("\n");
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
prf(fmt, ap, putchar, 0);
} else {
}
else
{
vprf(fmt, ap);
}
va_end(ap);
trunk/i386/libsaio/nvidia.c
17601760
17611761
17621762
1763
1764
1763
1764
1765
1766
17651767
1766
1768
1769
1770
17671771
17681772
17691773
......
17761780
17771781
17781782
1779
1780
1783
1784
1785
1786
17811787
17821788
17831789
17841790
17851791
1786
1792
1793
17871794
17881795
1789
1790
1796
1797
1798
1799
17911800
17921801
17931802
......
17951804
17961805
17971806
1798
1799
1800
1807
1808
1809
1810
1811
1812
18011813
18021814
18031815
18041816
18051817
18061818
1807
1808
1809
1810
1811
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
18121829
18131830
18141831
......
18261843
18271844
18281845
1829
1846
1847
18301848
18311849
18321850
18331851
18341852
1835
1853
1854
18361855
18371856
18381857
......
18491868
18501869
18511870
1871
18521872
1873
1874
18531875
1876
18541877
1878
1879
18551880
1881
18561882
1883
1884
18571885
1886
18581887
1888
1889
18591890
1891
18601892
1893
1894
18611895
1896
18621897
1863
1898
1899
1900
1901
18641902
1903
18651904
1866
1905
1906
1907
1908
18671909
1910
18681911
1912
18691913
18701914
18711915
......
19281972
19291973
19301974
1931
1975
19321976
19331977
19341978
......
19451989
19461990
19471991
1948
1949
1992
1993
1994
1995
19501996
19511997
1952
1998
1999
2000
19532001
19542002
19552003
1956
2004
2005
2006
19572007
19582008
19592009
......
20082058
20092059
20102060
2011
2061
2062
20122063
20132064
2014
2065
2066
2067
20152068
20162069
20172070
20182071
2019
2072
2073
2074
20202075
20212076
20222077
......
20292084
20302085
20312086
2032
2087
2088
20332089
20342090
2035
2091
2092
2093
20362094
20372095
20382096
......
20402098
20412099
20422100
2043
2101
2102
20442103
20452104
2046
2105
2106
2107
20472108
20482109
20492110
20502111
2051
2112
2113
20522114
20532115
2054
2116
2117
2118
20552119
20562120
20572121
20582122
20592123
20602124
2061
2125
2126
20622127
20632128
20642129
......
20672132
20682133
20692134
2070
2071
2135
2136
2137
2138
20722139
20732140
20742141
20752142
20762143
20772144
2078
2145
2146
2147
20792148
20802149
20812150
......
20862155
20872156
20882157
2089
2158
2159
20902160
20912161
20922162
20932163
20942164
20952165
2096
2097
2166
2167
2168
20982169
20992170
2100
2171
2172
21012173
21022174
21032175
......
21122184
21132185
21142186
2115
2116
2187
2188
2189
2190
21172191
21182192
2119
2193
2194
21202195
21212196
2122
2197
2198
21232199
2124
2200
2201
21252202
21262203
21272204
2128
2205
2206
21292207
21302208
21312209
......
21412219
21422220
21432221
2144
2222
2223
21452224
21462225
2147
2226
2227
21482228
21492229
21502230
21512231
21522232
2153
2233
2234
21542235
21552236
2156
2237
2238
21572239
21582240
21592241
......
21622244
21632245
21642246
2165
2247
2248
21662249
21672250
2168
2251
2252
21692253
21702254
21712255
......
21952279
21962280
21972281
2198
2282
2283
21992284
22002285
22012286
......
22072292
22082293
22092294
2210
2295
2296
22112297
22122298
22132299
......
22162302
22172303
22182304
2219
2305
2306
22202307
2221
2308
22222309
2223
2224
2310
2311
22252312
22262313
22272314
2228
2315
2316
22292317
22302318
22312319
default_NVCAP[8] = channel2;
// patching HEADS
for (i = 0; i < num_outputs; i++) {
if (channel1 & (1 << i)) {
for (i = 0; i < num_outputs; i++)
{
if (channel1 & (1 << i))
{
*entries[i].heads = 1;
} else if(channel2 & (1 << i)) {
}
else if(channel2 & (1 << i))
{
*entries[i].heads = 2;
}
}
// First check in the plist, (for e.g this can override any hardcoded devices)
cardList_t * nvcard = FindCardWithIds(device_id, subsys_id);
if (nvcard) {
if (nvcard->model) {
if (nvcard)
{
if (nvcard->model)
{
return nvcard->model;
}
}
//ErmaC added selector for Chameleon "old" style in System Profiler
if (getBoolForKey(kNvidiaGeneric, &showGeneric, &bootInfo->chameleonConfig)) {
if (getBoolForKey(kNvidiaGeneric, &showGeneric, &bootInfo->chameleonConfig))
{
verbose("NvidiaGeneric = Yes\n");
for (i = 1; i < (sizeof(nvidia_card_generic) / sizeof(nvidia_card_generic[0])); i++) {
if (nvidia_card_generic[i].device == device_id) {
for (i = 1; i < (sizeof(nvidia_card_generic) / sizeof(nvidia_card_generic[0])); i++)
{
if (nvidia_card_generic[i].device == device_id)
{
return nvidia_card_generic[i].name;
}
}
}
// Then check the exceptions table
if (subsys_id) {
for (i = 0; i < (sizeof(nvidia_card_exceptions) / sizeof(nvidia_card_exceptions[0])); i++) {
if ((nvidia_card_exceptions[i].device == device_id) && (nvidia_card_exceptions[i].subdev == subsys_id)){
if (subsys_id)
{
for (i = 0; i < (sizeof(nvidia_card_exceptions) / sizeof(nvidia_card_exceptions[0])); i++)
{
if ((nvidia_card_exceptions[i].device == device_id) && (nvidia_card_exceptions[i].subdev == subsys_id))
{
return nvidia_card_exceptions[i].name;
}
}
}
// At last try the generic names
for (i = 1; i < (sizeof(nvidia_card_generic) / sizeof(nvidia_card_generic[0])); i++) {
if (nvidia_card_generic[i].device == device_id) {
if (subsys_id) {
for (j = 0; j < (sizeof(nvidia_card_vendors) / sizeof(nvidia_card_vendors[0])); j++) {
if (nvidia_card_vendors[j].device == (subsys_id & 0xffff0000)) {
for (i = 1; i < (sizeof(nvidia_card_generic) / sizeof(nvidia_card_generic[0])); i++)
{
if (nvidia_card_generic[i].device == device_id)
{
if (subsys_id)
{
for (j = 0; j < (sizeof(nvidia_card_vendors) / sizeof(nvidia_card_vendors[0])); j++)
{
if (nvidia_card_vendors[j].device == (subsys_id & 0xffff0000))
{
snprintf(generic_name, 128, "%s %s", // sizeof(generic_name), "%s %s",
nvidia_card_vendors[j].name, nvidia_card_generic[i].name);
return &generic_name[0];
int fd;
int size;
if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) {
if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0)
{
return 0;
}
size = file_size(fd);
if (size) {
if (size)
{
*buf = malloc(size);
size = read(fd, (char *)buf, size);
}
return 0;
if (!DP_ADD_TEMP_VAL(device, nvidia_compatible_0))
{
return 0;
}
if (!DP_ADD_TEMP_VAL(device, nvidia_device_type_0))
{
return 0;
}
if (!DP_ADD_TEMP_VAL(device, nvidia_name_0))
{
return 0;
}
if (!DP_ADD_TEMP_VAL(device, nvidia_compatible_1))
{
return 0;
}
if (!DP_ADD_TEMP_VAL(device, nvidia_device_type_1))
{
return 0;
}
if (!DP_ADD_TEMP_VAL(device, nvidia_name_1))
{
return 0;
if (devices_number == 1) {
}
if (devices_number == 1)
{
if (!DP_ADD_TEMP_VAL(device, nvidia_device_type_parent))
{
return 0;
} else {
}
}
else
{
if (!DP_ADD_TEMP_VAL(device, nvidia_device_type_child))
{
return 0;
}
}
// Rek : Dont use sprintf return, it does not WORK !! our custom sprintf() always return 0!
// 10DE0F0014583544 2GB VRAM
//if (((nvda_dev->subsys_id.subsys.vendor_id << 16) | nvda_dev->subsys_id.subsys.device_id) == 0x14583544 )
//{
vram_size = -2147483648UL;//2147483648;
vram_size = -2147483648UL; // 2147483648;
//}
break;
case 0x11C6:// GTX650TI 11C6
break;
}
if (!vram_size){ // Finally, if vram_size still not set do the calculation with our own method
if (nvCardType < NV_ARCH_50) {
if (!vram_size)
{ // Finally, if vram_size still not set do the calculation with our own method
if (nvCardType < NV_ARCH_50)
{
vram_size = REG32(NV04_PFB_FIFO_DATA);
vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK;
} else if (nvCardType < NV_ARCH_C0) {
}
else if (nvCardType < NV_ARCH_C0)
{
vram_size = REG32(NV04_PFB_FIFO_DATA);
vram_size |= (vram_size & 0xff) << 32;
vram_size &= 0xffffffff00ll;
} else { // >= NV_ARCH_C0
}
else
{ // >= NV_ARCH_C0
vram_size = REG32(NVC0_MEM_CTRLR_RAM_AMOUNT) << 20;
vram_size *= REG32(NVC0_MEM_CTRLR_COUNT);
}
verbose("Looking for nvidia video bios file %s\n", nvFilename);
nvBiosOveride = load_nvidia_bios_file(nvFilename, &rom);
if (nvBiosOveride > 0) {
if (nvBiosOveride > 0)
{
verbose("Using nVidia Video BIOS File %s (%d Bytes)\n", nvFilename, nvBiosOveride);
DBG("%s Signature 0x%02x%02x %d bytes\n", nvFilename, rom[0], rom[1], nvBiosOveride);
} else {
}
else
{
printf("ERROR: unable to open nVidia Video BIOS File %s\n", nvFilename);
free(rom);
return false;
}
} else {
}
else
{
uint8_t*nvRom;
rom = malloc(NVIDIA_ROM_SIZE);
// Otherwise read bios from card
nvRom = (uint8_t*)&regs[NV_PROM_OFFSET];
// Valid Signature ?
if (checkNvRomSig(nvRom)) {
if (checkNvRomSig(nvRom))
{
bcopy((uint8_t *)nvRom, rom, NVIDIA_ROM_SIZE);
DBG("PROM Address 0x%x Signature 0x%02x%02x\n", nvRom, rom[0], rom[1]);
} else {
}
else
{
// disable PROM access
(REG32(NV_PBUS_PCI_NV_20)) = NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED;
//PRAM next
nvRom = (uint8_t*)&regs[NV_PRAMIN_OFFSET];
if(checkNvRomSig(nvRom)) {
if(checkNvRomSig(nvRom))
{
bcopy((uint32_t *)nvRom, rom, NVIDIA_ROM_SIZE);
DBG("PRAM Address 0x%x Signature 0x%02x%02x\n", nvRom, rom[0], rom[1]);
} else {
}
else
{
// 0xC0000 last
bcopy((char *)0xc0000, rom, NVIDIA_ROM_SIZE);
// Valid Signature ?
if (!checkNvRomSig(rom)) {
if (!checkNvRomSig(rom))
{
printf("ERROR: Unable to locate nVidia Video BIOS\n");
return false;
} else {
}
else
{
DBG("ROM Address 0x%x Signature 0x%02x%02x\n", nvRom, rom[0], rom[1]);
}
}//end PRAM check
}//end PROM check
}//end load rom from bios
if ((nvPatch = patch_nvidia_rom(rom)) == PATCH_ROM_FAILED) {
if ((nvPatch = patch_nvidia_rom(rom)) == PATCH_ROM_FAILED)
{
printf("ERROR: nVidia ROM Patching Failed!\n");
free(rom);
return false;
rom_pci_header = (option_rom_pci_header_t*)(rom + *(uint16_t *)&rom[24]);
// check for 'PCIR' sig
if (rom_pci_header->signature == 0x50434952) {
if (rom_pci_header->device_id != nvda_dev->device_id) {
if (rom_pci_header->signature == 0x50434952)
{
if (rom_pci_header->device_id != nvda_dev->device_id)
{
// Get Model from the OpROM
model = get_nvidia_model(((rom_pci_header->vendor_id << 16) | rom_pci_header->device_id), 0);
// Get VRAM again
videoRam = mem_detect(regs, nvCardType, nvda_dev, ((rom_pci_header->vendor_id << 16) | rom_pci_header->device_id), 0);
} else {
}
else
{
printf("nVidia incorrect PCI ROM signature: 0x%x\n", rom_pci_header->signature);
}
}
nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id,
devicepath, devices_number);
if (!string) {
if (!string)
{
string = devprop_create_string();
}
device = devprop_add_device(string, devicepath);
/* FIXME: for primary graphics card only */
boot_display = 1;
if (devices_number == 1) {
devprop_add_value(device, "@0,AAPL,boot-display", (uint8_t*)&boot_display, 4);
if (devices_number == 1)
{
devprop_add_value(device, "@0,AAPL,boot-display", (uint8_t *)&boot_display, 4);
}
if (nvPatch == PATCH_ROM_SUCCESS_HAS_LVDS) {
if (nvPatch == PATCH_ROM_SUCCESS_HAS_LVDS)
{
uint8_t built_in = 0x01;
devprop_add_value(device, "@0,built-in", &built_in, 1);
}
int crlf_count = 0;
// only search the first 384 bytes
for (i = 0; i < 0x180; i++) {
if (rom[i] == 0x0D && rom[i+1] == 0x0A) {
for (i = 0; i < 0x180; i++)
{
if (rom[i] == 0x0D && rom[i+1] == 0x0A)
{
crlf_count++;
// second 0x0D0A was found, extract bios version
if (crlf_count == 2) {
if (crlf_count == 2)
{
if (rom[i-1] == 0x20) i--; // strip last " "
for (version_start = i; version_start > (i-MAX_BIOS_VERSION_LENGTH); version_start--) {
for (version_start = i; version_start > (i-MAX_BIOS_VERSION_LENGTH); version_start--)
{
// find start
if (rom[version_start] == 0x00) {
if (rom[version_start] == 0x00)
{
version_start++;
// strip "Version "
if (strncmp((const char*)rom+version_start, "Version ", 8) == 0) {
if (strncmp((const char*)rom+version_start, "Version ", 8) == 0)
{
version_start += 8;
}
snprintf(biosVersion, sizeof(biosVersion), "%s", (nvBiosOveride > 0) ? nvFilename : version_str);
snprintf(kNVCAP, sizeof(kNVCAP), "NVCAP_%04x", nvda_dev->device_id);
if (getValueForKey(kNVCAP, &value, &len, &bootInfo->chameleonConfig) && len == NVCAP_LEN * 2) {
if (getValueForKey(kNVCAP, &value, &len, &bootInfo->chameleonConfig) && len == NVCAP_LEN * 2)
{
uint8_t new_NVCAP[NVCAP_LEN];
if (hex2bin(value, new_NVCAP, NVCAP_LEN) == 0) {
if (hex2bin(value, new_NVCAP, NVCAP_LEN) == 0)
{
verbose("Using user supplied NVCAP for %s :: %s\n", model, devicepath);
memcpy(default_NVCAP, new_NVCAP, NVCAP_LEN);
}
}
if (getValueForKey(kDcfg0, &value, &len, &bootInfo->chameleonConfig) && len == DCFG0_LEN * 2) {
if (getValueForKey(kDcfg0, &value, &len, &bootInfo->chameleonConfig) && len == DCFG0_LEN * 2)
{
uint8_t new_dcfg0[DCFG0_LEN];
if (hex2bin(value, new_dcfg0, DCFG0_LEN) == 0) {
if (hex2bin(value, new_dcfg0, DCFG0_LEN) == 0)
{
memcpy(default_dcfg_0, new_dcfg0, DCFG0_LEN);
verbose("Using user supplied @0,display-cfg\n");
}
}
if (getValueForKey(kDcfg1, &value, &len, &bootInfo->chameleonConfig) && len == DCFG1_LEN * 2) {
if (getValueForKey(kDcfg1, &value, &len, &bootInfo->chameleonConfig) && len == DCFG1_LEN * 2)
{
uint8_t new_dcfg1[DCFG1_LEN];
if (hex2bin(value, new_dcfg1, DCFG1_LEN) == 0) {
if (hex2bin(value, new_dcfg1, DCFG1_LEN) == 0)
{
memcpy(default_dcfg_1, new_dcfg1, DCFG1_LEN);
verbose("Using user supplied @1,display-cfg\n");
/******************** Added Marchrius.**********************/
// For the AppleBacklightDisplay //
/***********************************************************/
if (getBoolForKey(kEnableBacklight, &doit, &bootInfo->chameleonConfig) && doit){
if (getBoolForKey(kEnableBacklight, &doit, &bootInfo->chameleonConfig) && doit)
{
uint8_t AAPL_value[] = {0x01, 0x00, 0x00, 0x00}; //Is the same for all
devprop_add_value(device, "AAPL,HasPanel", AAPL_value, 4);
devprop_add_value(device, "AAPL,Haslid", AAPL_value, 4);
/***********************************************************/
// For the DualLink //
/***********************************************************/
if (getBoolForKey(kEnableDualLink, &doit, &bootInfo->chameleonConfig) && doit) {
if (getBoolForKey(kEnableDualLink, &doit, &bootInfo->chameleonConfig) && doit)
{
uint8_t AAPL00_value[] = {0x01, 0x00, 0x00, 0x00};
devprop_add_value(device, "AAPL00,DualLink", AAPL00_value, 4);
}
/************************ HDMI Audio ***********************/
doit = false;
//http://forge.voodooprojects.org/p/chameleon/issues/67/
if(getBoolForKey(kEnableHDMIAudio, &doit, &bootInfo->chameleonConfig) && doit) {
if(getBoolForKey(kEnableHDMIAudio, &doit, &bootInfo->chameleonConfig) && doit)
{
static uint8_t connector_type_1[]= {0x00, 0x08, 0x00, 0x00};
devprop_add_value(device, "@0,connector-type",connector_type_1, 4);
//devprop_add_value(device, "@0,connector-type",connector_type_1, 4);
devprop_add_value(device, "@1,connector-type",connector_type_1, 4);
devprop_add_value(device, "@2,connector-type",connector_type_1, 4);
devprop_add_value(device, "@3,connector-type",connector_type_1, 4);
//devprop_add_value(device, "@2,connector-type",connector_type_1, 4);
//devprop_add_value(device, "@3,connector-type",connector_type_1, 4);
}
/************************ End Audio *************************/
if (getBoolForKey(kVBIOS, &doit, &bootInfo->chameleonConfig) && doit) {
if (getBoolForKey(kVBIOS, &doit, &bootInfo->chameleonConfig) && doit)
{
devprop_add_value(device, "vbios", rom, (nvBiosOveride > 0) ? nvBiosOveride : (rom[2] * 512));
}
trunk/i386/libsaio/sys.c
961961
962962
963963
964
964
965
966
967
965968
966969
967970
{
if (multiboot_skip_partition_set)
{
if (bvr->part_no == multiboot_skip_partition) continue;
if (bvr->part_no == multiboot_skip_partition)
{
continue;
}
}
if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev )
{
trunk/i386/libsaio/msdos.c
666666
667667
668668
669
669670
671
672
670673
674
671675
676
677
672678
673679
674680
......
699705
700706
701707
708
702709
710
711
703712
704713
705714
......
738747
739748
740749
750
741751
752
753
742754
743755
744756
745757
746758
747759
760
748761
749
762
763
750764
751765
752766
......
759773
760774
761775
776
762777
778
763779
780
764781
782
765783
766
784
785
767786
768787
769788
770789
790
771791
792
772793
773794
774795
......
787808
788809
789810
811
790812
813
814
791815
816
792817
818
793819
794820
795821
......
804830
805831
806832
833
807834
835
836
808837
809838
810839
......
817846
818847
819848
849
820850
851
852
821853
822854
823855
......
832864
833865
834866
867
835868
869
836870
871
837872
873
838874
839875
840
841
876
842877
843878
844879
......
898933
899934
900935
901
902
936
903937
904938
905939
......
925959
926960
927961
928
929
962
930963
931964
932965
struct direntry *dirp;
uint16_tvfatname[WIN_MAXLEN+2*WIN_CHARS];
if (MSDOSInitPartition (ih)<0)
{
return -1;
}
if (dirPath[0] == '/')
{
dirPath++;
}
st = (struct msdosdirstate *)(long) *dirIndex;
if (!st)
{
st->cluster = OSReadLittleInt16 ((dirp->deStartCluster),0);
st->vfatnumber = 0;
if (msdosfatbits == 32)
{
st->cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;
}
}
else
initRoot (st);
}
for (i=7;i>=0;i--)
if (dirp->deName[i]!=' ')
{
break;
}
j=i+1;
tmp[i+1]=0;
for(;i>=0;i--)
tmp[i]=(dirp->deName[i]>=128)?cp850[dirp->deName[i]-128][0]:tolower(dirp->deName[i]);
for (i=2;i>=0;i--)
if (dirp->deName[8+i]!=' ')
{
break;
}
if (i>=0)
{
tmp[j++]='.';
utf_encodestr(tmp, j, (uint8_t*)*name, 25, OSHostByteOrder() );
}
if (dirp->deAttributes & ATTR_DIRECTORY)
{
*flags = kFileTypeDirectory;
}
else
{
*flags = kFileTypeFlat;
}
// Calculate a fake timestamp using modification date and time values.
*time = ((dirp->deMDate & 0x7FFF) << 16) + dirp->deMTime;
if (infoValid)
{
*infoValid = 1;
}
return 0;
}
char devStr[12];
if (MSDOSInitPartition (ih)<0)
{
return -1;
}
if (filePath[0] == '/')
{
filePath++;
}
buf = malloc(msdosclustersize);
if (!buf)
{
}
cluster = OSReadLittleInt16 ((dirp->deStartCluster),0);
if (msdosfatbits == 32)
{
cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;
}
size = (uint32_t)OSReadLittleInt32 ((dirp->deFileSize),0);
if (size<=offset)
{
msdosreadcluster (ih, buf, msdosclustersize, &cluster);
toread=length;
if (length==0 || length>size-offset)
{
toread=size-offset;
}
wastoread=toread;
bcopy (buf+(offset%msdosclustersize),ptr,MIN((msdosclustersize-(offset%msdosclustersize)),(unsigned)toread));
ptr+=msdosclustersize-(offset%msdosclustersize);
verbose("Read FAT%d file: [%s/%s] %d bytes.\n", msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread);
free (buf);
if (toread<0)
{
return wastoread;
}
else
{
return wastoread-toread;
}
}
long
MSDOSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock)
long MSDOSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock)
{
uint8_t *buf;
off_t cluster;
}
/* Fix up volume label. */
static void
fixLabel(uint8_t *label, char *str, long strMaxLen)
static void fixLabel(uint8_t *label, char *str, long strMaxLen)
{
inti, len;
uint16_tlabelucs[13];
}
void
MSDOSGetDescription(CICell ih, char *str, long strMaxLen)
void MSDOSGetDescription(CICell ih, char *str, long strMaxLen)
{
struct direntry*dirp;
uint8_tlabel[LABEL_LENGTH+1];
trunk/i386/libsaio/smbios_getters.c
2929
3030
3131
32
33
32
33
3434
3535
3636
......
7777
7878
7979
80
81
82
83
84
80
81
82
83
84
8585
8686
8787
88
89
88
89
9090
91
92
93
94
95
96
97
91
92
93
94
95
96
97
9898
9999
100100
......
180180
181181
182182
183
183
184184
185185
186186
......
196196
197197
198198
199
200
199
200
201201
202202
203203
204
204
205205
206206
207207
208208
209
209
210
211
210212
211213
212214
......
216218
217219
218220
219
220
221
222
223
221
222
223
224
225
226
224227
225228
226
229
230
227231
228232
229233
230
234
235
231236
232237
233238
234
239
240
235241
236242
237243
238
244
245
239246
240247
241248
......
243250
244251
245252
246
253
254
247255
248256
249257
250
258
259
251260
252261
253262
254
263
264
255265
256266
257267
258
268
269
259270
260271
261272
262
273
274
263275
264276
265277
266278
267279
268280
269
281
282
270283
271284
272285
273
286
287
274288
275289
276290
277
291
292
278293
279294
280295
281
296
297
282298
283299
284300
285
301
302
286303
287304
288305
289306
290307
291
308
309
292310
293311
294312
295
313
314
296315
297316
298317
299
318
319
300320
301321
302322
303
323
324
304325
305326
306327
307
328
329
308330
309331
310332
......
313335
314336
315337
316
338
317339
318340
319341
320
342
343
321344
322345
323346
324
347
348
325349
326350
327351
328
352
353
329354
330355
331356
332
357
358
333359
334360
335361
336
362
363
337364
338365
339366
......
347374
348375
349376
350
377
351378
352379
353380
......
397424
398425
399426
400
427
428
401429
402430
403431
404432
405
433
434
406435
407
436
437
408438
409439
410440
......
422452
423453
424454
425
455
456
426457
427458
428459
......
447478
448479
449480
450
481
482
451483
452484
453485
......
475507
476508
477509
478
510
511
479512
480513
481514
{
switch (Platform.CPU.Model)
{
// set external clock to 0 for SANDY
// removes FSB info from system profiler as on real mac's.
// set external clock to 0 for SANDY
// removes FSB info from system profiler as on real mac's.
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_JAKETOWN:
case CPUID_MODEL_IVYBRIDGE_XEON:
switch (Platform.CPU.Model)
{
case CPUID_MODEL_PENTIUM_M:
case CPUID_MODEL_DOTHAN:// Intel Pentium M
case CPUID_MODEL_YONAH:// Intel Mobile Core Solo, Duo
case CPUID_MODEL_MEROM:// Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPUID_MODEL_PENRYN:// Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
case CPUID_MODEL_ATOM:// Intel Atom (45nm)
case CPUID_MODEL_DOTHAN:// Intel Pentium M
case CPUID_MODEL_YONAH:// Intel Mobile Core Solo, Duo
case CPUID_MODEL_MEROM:// Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPUID_MODEL_PENRYN:// Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
case CPUID_MODEL_ATOM:// Intel Atom (45nm)
return false;
case 0x19:
case CPUID_MODEL_NEHALEM:// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPUID_MODEL_FIELDS:// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPUID_MODEL_NEHALEM:// Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPUID_MODEL_FIELDS:// Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPUID_MODEL_DALES:
case CPUID_MODEL_DALES_32NM:// Intel Core i3, i5 LGA1156 (32nm)
case CPUID_MODEL_WESTMERE:// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPUID_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
case CPUID_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPUID_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPUID_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPUID_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPUID_MODEL_DALES_32NM:// Intel Core i3, i5 LGA1156 (32nm)
case CPUID_MODEL_WESTMERE:// Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPUID_MODEL_NEHALEM_EX:// Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x
case CPUID_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPUID_MODEL_SANDYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (32nm)
case CPUID_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPUID_MODEL_IVYBRIDGE:// Intel Core i3, i5, i7 LGA1155 (22nm)
case CPUID_MODEL_IVYBRIDGE_XEON:
case CPUID_MODEL_HASWELL:
{
switch (Platform.CPU.Model)
{
case CPUID_MODEL_PENTIUM_M:
case CPUID_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
case CPUID_MODEL_DOTHAN:// 0x0D - Intel Pentium M model D
case CPUID_MODEL_PRESCOTT:
case CPUID_MODEL_NOCONA:
if (strstr(Platform.CPU.BrandString, "Xeon"))
return true;
case CPUID_MODEL_MEROM:// 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx
case CPUID_MODEL_XEON_MP:// 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm
case CPUID_MODEL_PENRYN:// 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
case CPUID_MODEL_XEON_MP:// 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm
case CPUID_MODEL_PENRYN:// 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
value->word = 0x402;// 1026 - Xeon
return true;
return true;
}
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x301;// 769 - Core 2 Duo
} else {
}
else
{
value->word = 0x402;// 1026 - Core 2 Quad as Xeon
}
return true;
return true;
case CPUID_MODEL_NEHALEM_EX:// 0x2E - Nehalem-ex, "Beckton", 45nm
case CPUID_MODEL_NEHALEM:// 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPUID_MODEL_FIELDS:// 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPUID_MODEL_DALES:// 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale)
if (strstr(Platform.CPU.BrandString, "Xeon")) {
value->word = 0x501;// 1281 - Lynnfiled Quad-Core Xeon
case CPUID_MODEL_NEHALEM:// 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm)
case CPUID_MODEL_FIELDS:// 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm)
case CPUID_MODEL_DALES:// 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale)
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
value->word = 0x501;// 1281 - Lynnfiled Quad-Core Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x901;// 2305 - Core i3
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x601;// Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x701;// 1793 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x901;// - Core i3
}
return true;
case CPUID_MODEL_DALES_32NM:// 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale)
case CPUID_MODEL_WESTMERE:// 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core
case CPUID_MODEL_WESTMERE_EX:// 0x2F - Intel Xeon E7
if (strstr(Platform.CPU.BrandString, "Xeon")) {
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
value->word = 0x501;// 1281 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x901;// 2305 - Core i3
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x602;// 1538 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x702;// 1794 -Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x901;// - Core i3
}
return true;
case CPUID_MODEL_JAKETOWN:// 0x2D - Intel Core i7, Xeon E5-xxxx LGA2011 (32nm)
case CPUID_MODEL_SANDYBRIDGE:// 0x2A - Intel Core i3, i5, i7 LGA1155 (32nm)
if (strstr(Platform.CPU.BrandString, "Xeon")) {
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
value->word = 0x501;// 1281 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x902;// 2306 -Core i3
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x603;// 1539 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x703;// 1795 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x902;// - Core i5
}
return true;
case CPUID_MODEL_IVYBRIDGE:// 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm)
if (strstr(Platform.CPU.BrandString, "Xeon")) {
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
value->word = 0xA01;// 2561 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x903;// 2307 - Core i3 - Apple doesn't use it
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x604;// 1540 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x704;// 1796 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x903;// - Core i5
}
return true;
value->word = 0xA01;// 2561 - Xeon
return true;
case CPUID_MODEL_HASWELL:// 0x3C -
case CPUID_MODEL_HASWELL:// 0x3C -
case CPUID_MODEL_HASWELL_SVR:// 0x3F -
case CPUID_MODEL_HASWELL_ULT:// 0x45 -
case CPUID_MODEL_CRYSTALWELL:// 0x46
if (strstr(Platform.CPU.BrandString, "Xeon")) {
if (strstr(Platform.CPU.BrandString, "Xeon"))
{
value->word = 0xA01;// 2561 - Xeon
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i3"))
{
value->word = 0x904;// 2308 - Core i3 - Apple doesn't use it - but we yes:-)
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i5"))
{
value->word = 0x605;// 1541 - Core i5
return true;
}
if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) {
if (strstr(Platform.CPU.BrandString, "Core(TM) i7"))
{
value->word = 0x705;// 1797 - Core i7
return true;
}
if (Platform.CPU.NoCores <= 2) {
if (Platform.CPU.NoCores <= 2)
{
value->word = 0x904;// - Core i3
}
return true;
value->word = 0x601;// 1537 - Core i5
return true;
default:
break; //Unsupported CPU type
break; // Unsupported CPU type
}
}
default:
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
if (!bootInfo->memDetect)
{
return false;
}
idx++;
if (idx < MAX_RAM_SLOTS) {
if (idx < MAX_RAM_SLOTS)
{
map = Platform.DMI.DIMM[idx];
if (Platform.RAM.DIMM[map].InUse && Platform.RAM.DIMM[map].Frequency != 0) {
if (Platform.RAM.DIMM[map].InUse && Platform.RAM.DIMM[map].Frequency != 0)
{
DBG("RAM Detected Freq = %d Mhz\n", Platform.RAM.DIMM[map].Frequency);
value->dword = Platform.RAM.DIMM[map].Frequency;
return true;
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
if (!bootInfo->memDetect)
{
return false;
}
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
if (!bootInfo->memDetect)
{
return false;
}
static int idx = -1;
intmap;
if (!bootInfo->memDetect) {
if (!bootInfo->memDetect)
{
return false;
}
trunk/i386/modules/AcpiCodec/acpi_codec.c
47574757
47584758
47594759
4760
4760
47614761
47624762
47634763
......
47764776
47774777
47784778
4779
4779
47804780
47814781
47824782
......
47844784
47854785
47864786
4787
4788
4789
4790
4787
4788
4789
4790
47914791
47924792
4793
4794
4795
4793
4794
4795
4796
47964797
4797
4798
47984799
47994800
48004801
{
sprintf(dirspec, "rd(0,0)/Extra/Acpi/");
acpidir_found = true;
}
else
{
{
sprintf(dirspec, "bt(0,0)/Extra/Acpi/");
acpidir_found = true;
}
}
}
if (acpidir_found == true)
{
#if ACPISGN
if (checkOem == true)
{
MakeAcpiSgn();
}
if (checkOem == true)
{
MakeAcpiSgn();
}
#endif
while (1) {
ret = GetDirEntry(dirspec, &index, &name, &flags, &time);
if (ret == -1) break;
while (1)
{
ret = GetDirEntry(dirspec, &index, &name, &flags, &time);
if (ret == -1) break;
#if DEBUG_ACPI
printf("testing %s\n", name);
printf("testing %s\n", name);
#endif
// Make sure this is a directory.
if ((flags & kFileTypeMask) == kFileTypeDirectory) continue;
trunk/CHANGES
2424
2525
2626
27
27
2828
2929
3030
Special thanks: Alex J, viv xix, zenith432 from http://forge.voodooprojects.org/p/chameleon/issues/375/
Testing and improvements: Pike R. Alpha, ErmaC, Bungo, blackosx, Micky1979, crazybirdy, oldnapalm, janek202, MinusZwei and Andy Vandijck.
- Pike R. Alpha : dinamic "random-seed" implementation ( http://www.insanelymac.com/forum/topic/301350-lets-make-random-seed-really-random/ )
- Pike R. Alpha : dynamic "random-seed" implementation ( http://www.insanelymac.com/forum/topic/301350-lets-make-random-seed-really-random/ )
- ErmaC : getCPUTick() helper function ( http://www.insanelymac.com/forum/topic/301350-lets-make-random-seed-really-random/ )
- ErmaC : Add Yosemite Icons detection for chameleon UI
- blackosx : Add chameleon UI Icons for Yosemite

Archive Download the corresponding diff file

Revision: 2490