Chameleon

Chameleon Commit Details

Date:2012-09-24 16:32:11 (6 years 8 months ago)
Author:ErmaC
Commit:2063
Parents: 2062
Message:Add nvidia ID 11C0 http://www.insanelymac.com/forum/topic/278702-nvidia-sub-vendor-sub-d evice-injection-for-chameleon/page__st__40#entry1855011
Changes:
M/trunk/i386/libsaio/nvidia.c

File differences

trunk/i386/libsaio/nvidia.c
10241024
10251025
10261026
1027
10271028
10281029
10291030
......
15881589
15891590
15901591
1591
1592
15921593
15931594
15941595
......
16201621
16211622
16221623
1624
16231625
16241626
16251627
......
16951697
16961698
16971699
1698
1700
16991701
17001702
17011703
......
27032705
27042706
27052707
2708
27062709
27072710
27082711
......
27252728
27262729
27272730
2728
2731
27292732
2730
2733
27312734
27322735
27332736
......
27502753
27512754
27522755
2753
2756
27542757
27552758
27562759
......
27602763
27612764
27622765
2763
2766
27642767
27652768
27662769
......
28112814
28122815
28132816
2814
2817
28152818
28162819
28172820
......
28332836
28342837
28352838
2836
2839
28372840
28382841
28392842
......
28422845
28432846
28442847
2845
2848
28462849
28472850
28482851
......
29722975
29732976
29742977
2975
2978
29762979
29772980
29782981
......
29822985
29832986
29842987
2985
2988
29862989
29872990
29882991
......
31003103
31013104
31023105
3103
3106
31043107
31053108
31063109
3107
3108
3110
31093111
31103112
31113113
31123114
31133115
31143116
3115
3116
3117
3117
3118
3119
31183120
31193121
31203122
......
31303132
31313133
31323134
3133
3135
31343136
31353137
31363138
......
31503152
31513153
31523154
3153
3155
31543156
31553157
31563158
......
31793181
31803182
31813183
3182
3184
31833185
3184
3186
31853187
31863188
31873189
3188
3190
31893191
31903192
31913193
......
31933195
31943196
31953197
3196
3198
31973199
31983200
31993201
......
32783280
32793281
32803282
3281
3283
32823284
32833285
32843286
......
32883290
32893291
32903292
3291
3293
32923294
32933295
32943296
......
33313333
33323334
33333335
3334
3336
33353337
33363338
33373339
33383340
33393341
33403342
3341
3343
33423344
33433345
33443346
......
33603362
33613363
33623364
3363
3365
33643366
33653367
33663368
......
33753377
33763378
33773379
3378
3380
33793381
33803382
33813383
33823384
33833385
3384
3386
33853387
33863388
33873389
......
34133415
34143416
34153417
3416
34173418
34183419
34193420
{ 0x10DE0DC4,0x1ACC4513,"Point of View GeForce GTS 450" },
{ 0x10DE0DC4,0x1ACC4523,"Point of View GeForce GTS 450" },
{ 0x10DE0DC4,0x1ACC45C2,"Point of View GeForce GTS 450" },
{ 0x10DE0DC4,0x38421351,"EVGA GeForce GTS 450" },
{ 0x10DE0DC4,0x38421452,"EVGA GeForce GTS 450" },
{ 0x10DE0DCD,0x10280491,"Dell GeForce GT 555M" },
{ 0x10DE1183,0x10DE1000,"nVidia GTX 660 Ti" },
{ 0x10DE1183,0x14622843,"MSi GTX 660 Ti" },
{ 0x10DE1183,0x19DA1280,"Zoac GTX 660 Ti" },
{ 0x10DE1183,0x19DA1280,"Zotac GTX 660 Ti" },
{ 0x10DE1185,0x174B2260,"PC Partner GeForce GTX 660" },
{ 0x10DE11BE,0x15585105,"Clevo Quadro K3000M" },
{ 0x10DE11BE,0x15587102,"Clevo Quadro K3000M" },
// 11C0 - 11CF
{ 0x10DE11C0,0x10DE0995,"Inno3D GeForce GTX660" },
// 11D0 - 11DF
// 11E0 - 11EF
// 11F0 - 11FF
{ 0x10DE1246,0x10280571,"Dell GeForce GT 550M" },
{ 0x10DE1247,0x10431407,"Asus GeForce GT 555M" },
{ 0x10DE1247,0x10431752,"Asus GeForce GT 635M" },
{ 0x10DE1247,0x10431752,"Asus GeForce GT 555M" },
{ 0x10DE1247,0x10432050,"Asus GeForce GT 555M" },
{ 0x10DE1247,0x10432051,"Asus GeForce GT 555M" },
{ 0x10DE1247,0x10432119,"Asus GeForce GT 670M" },
{ 0x10DE11BD,NV_SUB_IDS,"Quadro K4000M" },
{ 0x10DE11BE,NV_SUB_IDS,"Quadro K3000M" },
// 11C0 - 11CF
{ 0x10DE11C0,NV_SUB_IDS,"GeForce GTX 660" },
// 11D0 - 11DF
// 11E0 - 11EF
// 11F0 - 11FF
{ 0x10DE1244,NV_SUB_IDS,"GeForce GTX 550 Ti" },
{ 0x10DE1245,NV_SUB_IDS,"GeForce GTS 450" },
{ 0x10DE1246,NV_SUB_IDS,"GeForce GTX 550M" },
{ 0x10DE1247,NV_SUB_IDS,"GeForce GT 635M" }, // 555M ?
{ 0x10DE1247,NV_SUB_IDS,"GeForce GT 555M" },
{ 0x10DE1248,NV_SUB_IDS,"GeForce GTX 555M" },
{ 0x10DE1249,NV_SUB_IDS,"GeForce GTS 450M" }, // no M?
{ 0x10DE1249,NV_SUB_IDS,"GeForce GTS 450" }, // 450M?
{ 0x10DE124B,NV_SUB_IDS,"GeForce GT 640" },
{ 0x10DE124D,NV_SUB_IDS,"GeForce GTX 555M" },
// { 0x10DE1250,NV_SUB_IDS,"GF116-INT" },
printf("False ROM signature: 0x%02x%02x\n", rom[0], rom[1]);
return PATCH_ROM_FAILED;
}
uint16_t dcbptr = READ_LE_SHORT(rom, 0x36);
if (!dcbptr) {
//else
//printf("dcb table at offset 0x%04x\n", dcbptr);
uint8_t *dcbtable = &rom[dcbptr];
uint8_t *dcbtable = &rom[dcbptr];
uint8_t dcbtable_version = dcbtable[0];
uint8_t headerlength = 0;
uint8_t numentries = 0;
if (numentries >= MAX_NUM_DCB_ENTRIES)
numentries = MAX_NUM_DCB_ENTRIES;
uint8_t num_outputs = 0, i = 0;
struct dcbentry
continue;
if ((connection & 0xf) == 0x6) /* we skip type 6 as it doesnt appear on macbook nvcaps */
continue;
entries[num_outputs].type = connection & 0xf;
entries[num_outputs].index = num_outputs;
entries[num_outputs++].heads = (uint8_t*)&(dcbtable[(headerlength + recordlength * i) + 1]);
int has_lvds = false;
uint8_t channel1 = 0, channel2 = 0;
for (i = 0; i < num_outputs; i++)
{
if (entries[i].type == 3)
static char *get_nvidia_model(uint32_t device_id, uint32_t subsys_id)
{
int i;
// First check in the plist, (for e.g this can override any hardcoded devices)
cardList_t * nvcard = FindCardWithIds(device_id, subsys_id);
if (nvcard)
return nvcard->model;
}
}
for (i = 1; i < (sizeof(nvidia_cards) / sizeof(nvidia_cards[0])); i++) // size of nvidia_cards array for-loop
{
if ((nvidia_cards[i].device == device_id) && (nvidia_cards[i].subdev == subsys_id))
if (nvcard->videoRam > 0)
{
vram_size = nvcard->videoRam * 1024 * 1024;
return vram_size;
}
}
// Then, Workaround for 9600M GT, GT 210/420/430/440/525M/540M & GTX 560M
switch (nvda_dev->device_id)
{
case 0x0647: // 9600M GT 0647
vram_size = 512*1024*1024;
break;
/*case 0x0649:// 9600M GT 0649
vram_size = 1024*1024*1024;
break;*/
/*case 0x0649:// 9600M GT 0649
vram_size = 1024*1024*1024;
break;*/
case 0x0A65: // GT 210
case 0x0DE0: // GT 440
case 0x0DE1: // GT 430
default:
break;
}
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(NVC0_MEM_CTRLR_COUNT);
}
}
return vram_size;
}
char*model;
const char*value;
booldoit;
fill_card_list();
devicepath = get_pci_dev_path(nvda_dev);
bar[0] = pci_config_read32(nvda_dev->dev.addr, 0x10 );
regs = (uint8_t *) (bar[0] & ~0x0f);
// get card type
nvCardType = (REG32(0) >> 20) & 0x1ff;
// Amount of VRAM in kilobytes
videoRam = mem_detect(regs, nvCardType, nvda_dev,((nvda_dev->vendor_id << 16) | nvda_dev->device_id),((nvda_dev->subsys_id.subsys.vendor_id << 16) | nvda_dev->subsys_id.subsys.device_id) );
rom = malloc(NVIDIA_ROM_SIZE);
sprintf(nvFilename, "/Extra/%04x_%04x.rom", (uint16_t)nvda_dev->vendor_id,
(uint16_t)nvda_dev->device_id);
{
// Get Model from the OpROM
model = get_nvidia_model(((rom_pci_header->vendor_id << 16) | rom_pci_header->device_id), NV_SUB_IDS);
// Get VRAM again
videoRam = mem_detect(regs, nvCardType, nvda_dev,((rom_pci_header->vendor_id << 16) | rom_pci_header->device_id), NV_SUB_IDS );
printf("nVidia incorrect PCI ROM signature: 0x%x\n", rom_pci_header->signature);
}
}
verbose("%s %dMB NV%02x [%04x:%04x]-[%04x:%04x] :: %s device number: %d\n",
model, (uint32_t)(videoRam / 1024 / 1024),
(REG32(0) >> 20) & 0x1ff, nvda_dev->vendor_id, nvda_dev->device_id,
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--)
{
// find start
if (rom[version_start] == 0x00)
{
version_start++;
// strip "Version "
if (strncmp((const char*)rom+version_start, "Version ", 8) == 0)
{
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)
{
verbose("Using user supplied NVCAP for %s :: %s\n", model, devicepath);
if (hex2bin(value, new_dcfg0, DCFG0_LEN) == 0)
{
memcpy(default_dcfg_0, new_dcfg0, DCFG0_LEN);
verbose("Using user supplied @0,display-cfg\n");
printf("@0,display-cfg: %02x%02x%02x%02x\n",
default_dcfg_0[0], default_dcfg_0[1], default_dcfg_0[2], default_dcfg_0[3]);
}
}
if (getValueForKey(kDcfg1, &value, &len, &bootInfo->chameleonConfig) && len == DCFG1_LEN * 2)
{
uint8_t new_dcfg1[DCFG1_LEN];
devprop_add_value(device, "rom-revision", (uint8_t*)biosVersion, strlen(biosVersion) + 1);
devprop_add_value(device, "@0,display-cfg", default_dcfg_0, DCFG0_LEN);
devprop_add_value(device, "@1,display-cfg", default_dcfg_1, DCFG1_LEN);
if (getBoolForKey(kVBIOS, &doit, &bootInfo->chameleonConfig) && doit)
{

Archive Download the corresponding diff file

Revision: 2063