Chameleon

Chameleon Commit Details

Date:2011-06-20 09:10:08 (12 years 10 months ago)
Author:Azimutz
Commit:1029
Parents: 1028
Message:Remove a pair of brackets wrongly added by me; was tricked by poor code readability. Add "display_0", "display_1" keys/code, plus NVIDIA HDMI AUDIO references (revs 984/5/6/8/91/92, 1001/2).
Changes:
M/branches/azimutz/Chazi/i386/modules/GraphicsEnabler/NVIDIAGraphicsEnabler/nvidia.c

File differences

branches/azimutz/Chazi/i386/modules/GraphicsEnabler/NVIDIAGraphicsEnabler/nvidia.c
6868
6969
7070
71
72
7173
7274
7375
......
8688
8789
8890
91
8992
9093
9194
......
9598
9699
97100
101
102
103
104
105
106
98107
99108
100109
......
897906
898907
899908
900
909
901910
902911
903912
......
911920
912921
913922
923
914924
915925
916926
......
13711381
13721382
13731383
1374
1384
1385
1386
1387
1388
1389
1390
1391
1392
13751393
1376
1394
1395
13771396
1378
1379
1397
1398
1399
1400
13801401
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1402
13911403
1404
1405
1406
13921407
13931408
13941409
......
14101425
14111426
14121427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
14131462
14141463
14151464
......
14241473
14251474
14261475
1476
1477
14271478
1479
1480
1481
1482
1483
1484
14281485
14291486
14301487
#define kUseNvidiaROM"UseNvidiaROM"
#define kVBIOS"VBIOS"
#define kdcfg0"display_0"
#define kdcfg1"display_1"
#define NVIDIA_ROM_SIZE0x10000
#define PATCH_ROM_SUCCESS1
const char *nvidia_name_0[]={ "@0,name","NVDA,Display-A" };
const char *nvidia_name_1[]={ "@1,name","NVDA,Display-B" };
const char *nvidia_slot_name[]={ "AAPL,slot-name", "Slot-1" };
//const char *nvidia_display_cfg_0[] = { "@0,display-cfg
static uint8_t default_NVCAP[]= {
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00,
#define NVCAP_LEN ( sizeof(default_NVCAP) / sizeof(uint8_t) )
static uint8_t default_dcfg_0[]={0xff, 0xff, 0xff, 0xff};
static uint8_t default_dcfg_1[]={0xff, 0xff, 0xff, 0xff};
#define DCFG0_LEN ( sizeof(default_dcfg_0) / sizeof(uint8_t) )
#define DCFG1_LEN ( sizeof(default_dcfg_1) / sizeof(uint8_t) )
static struct nv_chipsets_t NVKnownChipsets[] = {
{ 0x00000000, "Unknown" },
// 0040 - 004F
if (sig != 0x4edcbdcb)
{
//Azi: match this with one below and add line number
//Azi: match this with one below and add line number ?
printf("Bad display config block signature (0x%8x)\n", sig);
return PATCH_ROM_FAILED;
}
if (strcmp(sig, "DEV_REC"))
{
//Azi: match this with one above and add line number ?? hum... this is string.. check before change!!
printf("Bad Display Configuration Block signature (%s)\n", sig);
return PATCH_ROM_FAILED;
}
// second 0x0D0A was found, extract bios version
if (crlf_count == 2)
{
if (rom[i-1] == 0x20) i--; // strip last " "
//Azi: i had this stuff fucked up because of:
// if (rom[i-1] == 0x20) i--; // strip last " "
// i didn't noticed the "little" guy in the end because no {} used
// and being "glued" to the "for".. perfect example of poor readability!! :-/
// I did noticed something... the reminder is down there ;)
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)
{
// find start
if (rom[version_start] == 0x00)
version_start++;
// strip "Version "
if (strncmp((const char*)rom+version_start, "Version ", 8) == 0)
{
version_start++;
// strip "Version "
if (strncmp((const char*)rom+version_start, "Version ", 8) == 0)
{
version_start += 8;
}
strncpy(version_str, (const char*)rom+version_start, i-version_start);
break;
version_start += 8;
}
strncpy(version_str, (const char*)rom+version_start, i-version_start);
break;
}
}
break; //Azi: reminder
}
}
if (getValueForKey(kdcfg0, &value, &len, &bootInfo->bootConfig) && len == DCFG0_LEN * 2){
uint8_t new_dcfg0[DCFG0_LEN];
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->bootConfig) && len == DCFG1_LEN * 2){
uint8_t new_dcfg1[DCFG1_LEN];
if (hex2bin(value, new_dcfg1, DCFG1_LEN) == 0)
{
memcpy(default_dcfg_1, new_dcfg1, DCFG1_LEN);
verbose("Using user supplied @1,display-cfg\n");
printf("@1,display-cfg: %02x%02x%02x%02x\n",
default_dcfg_1[0], default_dcfg_1[1], default_dcfg_1[2], default_dcfg_1[3]);
}
}
#if DEBUG_NVCAP
printf("NVCAP: %02x%02x%02x%02x-%02x%02x%02x%02x-%02x%02x%02x%02x-%02x%02x%02x%02x-%02x%02x%02x%02x\n",
default_NVCAP[0], default_NVCAP[1], default_NVCAP[2], default_NVCAP[3],
devprop_add_value(device, "VRAM,totalsize", (uint8_t*)&videoRam, 4);
devprop_add_value(device, "model", (uint8_t*)model, strlen(model) + 1);
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);
//add HDMI Audio back to nvidia
//http://forge.voodooprojects.org/p/chameleon/issues/67/
//uint8_t connector_type_1[]= {0x00, 0x08, 0x00, 0x00};
//devprop_add_value(device, "@1,connector-type",connector_type_1, 4);
//end Nvidia HDMI Audio
if (getBoolForKey(kVBIOS, &doit, &bootInfo->bootConfig) && doit)
{
devprop_add_value(device, "vbios", rom, (nvBiosOveride > 0) ? nvBiosOveride : (rom[2] * 512));

Archive Download the corresponding diff file

Revision: 1029