Chameleon

Chameleon Commit Details

Date:2017-05-22 15:48:53 (6 years 11 months ago)
Author:ErmaC
Commit:2882
Parents: 2881
Message:minor update (for 10.12.5)
Changes:
R/branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.c → /branches/ErmaC/Enoch/i386/libsaio/gfx_helper.c
R/branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.h → /branches/ErmaC/Enoch/i386/libsaio/gfx_helper.h
M/branches/ErmaC/Enoch/i386/libsaio/Makefile
M/branches/ErmaC/Enoch/i386/boot2/options.c
M/branches/ErmaC/Enoch/i386/boot2/drivers.c
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/libsaio/bootstruct.c
M/branches/ErmaC/Enoch/i386/libsaio/fake_efi.c
M/branches/ErmaC/Enoch/i386/libsaio/nvidia.c

File differences

branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright (c) 2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#include "libsaio.h"
#include "bootstruct.h"
#include "xml.h"
#include "nvidia_helper.h"
#include "pci.h"
#include "nvidia.h"
/*
NVIDIA card injection usage e.g (to be placed in the boot.plist):
<key>NVIDIA</key>
<array>
<dict>
<key>Chipset Name</key>
<string>Quadro FX 380</string>
<key>IOPCIPrimaryMatch</key>
<string>0x10DE0658</string>
<key>VRam Size</key>
<string>256</string>
</dict>
<dict>
<key>Chipset Name</key>
<string>YOUR_CARD_NAME</string>
<key>IOPCIPrimaryMatch</key>
<string>YOUR_CARD_ID</string>
<key>IOPCISubDevId</key>
<string>YOUR_CARD_SUB_ID(if necessary)</string>
<key>VRam Size</key>
<string>YOUR_CARD_VRAM_SIZE</string>
</dict>
<dict>
<key>Chipset Name</key>
<string>YOUR_SECOND_CARD_NAME</string>
<key>IOPCIPrimaryMatch</key>
<string>YOUR_SECOND_CARD_ID</string>
<key>IOPCISubDevId</key>
<string>YOUR_SECOND_CARD_SUB_ID(if necessary)</string>
<key>VRam Size</key>
<string>YOUR_SECOND_CARD_VRAM_SIZE</string>
</dict>
.
.
.
.
</array>
*/
cardList_t *cardList = NULL;
void add_card(char *model, uint32_t id, uint32_t subid, uint64_t videoRam)
{
cardList_t *new_card = malloc(sizeof(cardList_t));
if (new_card)
{
new_card->next = cardList;
cardList = new_card;
new_card->id= id;
new_card->subid= subid;
new_card->videoRam= videoRam;
new_card->model= model;
}
}
cardList_t *FindCardWithIds(uint32_t id, uint32_t subid)
{
cardList_t *entry = cardList;
while(entry)
{
if((entry->id == id) && (entry->subid == subid))
{
return entry;
}
else
{
entry = entry->next;
}
}
// LET A SECOND CHANCE by seaching only for the device-id
entry = cardList;
while(entry)
{
if(entry->id == id)
{
return entry;
}
else
{
entry = entry->next;
}
}
return NULL;
}
void fill_card_list(void)
{
unsigned inti, count;
TagPtrNVDIATag;
char*model_name = NULL;
char*match_id = NULL;
char*sub_id = NULL;
char*vram_size = NULL;
uint32_tdev_id = 0;
uint32_tsubdev_id = 0;
uint64_tVramSize = 0;
if ((NVDIATag = XMLCastArray(XMLGetProperty(bootInfo->chameleonConfig.dictionary, (const char *)"NVIDIA"))))
{
count = XMLTagCount(NVDIATag);
for (i=0; i<count; i++)
{
TagPtr element = XMLGetElement( NVDIATag, i );
if (element)
{
match_id = XMLCastString(XMLGetProperty(element, (const char*)"IOPCIPrimaryMatch")); //device-id
sub_id = XMLCastString(XMLGetProperty(element, (const char*)"IOPCISubDevId")); //sub device-id
model_name = XMLCastString(XMLGetProperty(element, (const char*)"Chipset Name"));
vram_size = XMLCastString(XMLGetProperty(element, (const char*)"VRam Size"));
if (match_id)
{
dev_id = strtoul(match_id, NULL, 16);
}
if (sub_id)
{
subdev_id = strtoul(sub_id, NULL, 16);
}
if (vram_size)
{
VramSize = strtoul(vram_size, NULL, 10);
}
add_card(model_name, dev_id, subdev_id, VramSize);
}
}
}
}
branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
* Copyright (c) 2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#ifndef __LIBSAIO_NVIDIA_HELPER_H
#define __LIBSAIO_NVIDIA_HELPER_H
typedef struct cardList_t
{
char*model;
uint32_tid;
uint32_tsubid;
uint64_tvideoRam;
struct cardList_t*next;
} cardList_t;
void add_card(char *model, uint32_t id, uint32_t subid, uint64_t videoRam);
void fill_card_list(void);
cardList_t *FindCardWithIds(uint32_t id, uint32_t subid);
#endif //__LIBSAIO_NVIDIA_HELPER_H
branches/ErmaC/Enoch/i386/libsaio/bootstruct.c
140140
141141
142142
143
143144
144145
145146
bcopy(oldAddr, bootArgs, sizeof(boot_args));
}
// 10.12 and 10.13 new bootArgs?
}
//==============================================================================
branches/ErmaC/Enoch/i386/libsaio/Makefile
3737
3838
3939
40
40
4141
4242
4343
smbios.o smbios_getters.o smbios_decode.o \
fake_efi.o ext2fs.o \
hpet.o dram_controllers.o spd.o usb.o pci_setup.o \
device_inject.o networking.o nvidia_helper.o nvidia.o ati.o gma.o hda.o pci_root.o \
device_inject.o networking.o gfx_helper.o nvidia.o ati.o gma.o hda.o pci_root.o \
convert.o aml_generator.o console.o exfat.o base64-decode.o
SAIO_OBJS := $(addprefix $(OBJROOT)/, $(SAIO_OBJS))
branches/ErmaC/Enoch/i386/libsaio/gfx_helper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright (c) 2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#include "libsaio.h"
#include "bootstruct.h"
#include "xml.h"
#include "gfx_helper.h"
#include "pci.h"
#include "nvidia.h"
/*
NVIDIA card injection usage e.g (to be placed in the boot.plist):
<key>NVIDIA</key>
<array>
<dict>
<key>Chipset Name</key>
<string>Quadro FX 380</string>
<key>IOPCIPrimaryMatch</key>
<string>0x10DE0658</string>
<key>VRam Size</key>
<string>256</string>
</dict>
<dict>
<key>Chipset Name</key>
<string>YOUR_CARD_NAME</string>
<key>IOPCIPrimaryMatch</key>
<string>YOUR_CARD_ID</string>
<key>IOPCISubDevId</key>
<string>YOUR_CARD_SUB_ID(if necessary)</string>
<key>VRam Size</key>
<string>YOUR_CARD_VRAM_SIZE</string>
</dict>
<dict>
<key>Chipset Name</key>
<string>YOUR_SECOND_CARD_NAME</string>
<key>IOPCIPrimaryMatch</key>
<string>YOUR_SECOND_CARD_ID</string>
<key>IOPCISubDevId</key>
<string>YOUR_SECOND_CARD_SUB_ID(if necessary)</string>
<key>VRam Size</key>
<string>YOUR_SECOND_CARD_VRAM_SIZE</string>
</dict>
.
.
.
.
</array>
*/
cardList_t *cardList = NULL;
void add_card(char *model, uint32_t id, uint32_t subid, uint64_t videoRam)
{
cardList_t *new_card = malloc(sizeof(cardList_t));
if (new_card)
{
new_card->next = cardList;
cardList = new_card;
new_card->id= id;
new_card->subid= subid;
new_card->videoRam= videoRam;
new_card->model= model;
}
}
cardList_t *FindCardWithIds(uint32_t id, uint32_t subid)
{
cardList_t *entry = cardList;
while(entry)
{
if((entry->id == id) && (entry->subid == subid))
{
return entry;
}
else
{
entry = entry->next;
}
}
// LET A SECOND CHANCE by seaching only for the device-id
entry = cardList;
while(entry)
{
if(entry->id == id)
{
return entry;
}
else
{
entry = entry->next;
}
}
return NULL;
}
void fill_card_list(void)
{
unsigned inti, count;
TagPtrNVDIATag;
char*model_name = NULL;
char*match_id = NULL;
char*sub_id = NULL;
char*vram_size = NULL;
uint32_tdev_id = 0;
uint32_tsubdev_id = 0;
uint64_tVramSize = 0;
if ((NVDIATag = XMLCastArray(XMLGetProperty(bootInfo->chameleonConfig.dictionary, (const char *)"NVIDIA"))))
{
count = XMLTagCount(NVDIATag);
for (i=0; i<count; i++)
{
TagPtr element = XMLGetElement( NVDIATag, i );
if (element)
{
match_id = XMLCastString(XMLGetProperty(element, (const char*)"IOPCIPrimaryMatch")); //device-id
sub_id = XMLCastString(XMLGetProperty(element, (const char*)"IOPCISubDevId")); //sub device-id
model_name = XMLCastString(XMLGetProperty(element, (const char*)"Chipset Name"));
vram_size = XMLCastString(XMLGetProperty(element, (const char*)"VRam Size"));
if (match_id)
{
dev_id = strtoul(match_id, NULL, 16);
}
if (sub_id)
{
subdev_id = strtoul(sub_id, NULL, 16);
}
if (vram_size)
{
VramSize = strtoul(vram_size, NULL, 10);
}
add_card(model_name, dev_id, subdev_id, VramSize);
}
}
}
}
branches/ErmaC/Enoch/i386/libsaio/gfx_helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* Copyright (c) 2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#ifndef __LIBSAIO_GFX_HELPER_H
#define __LIBSAIO_GFX_HELPER_H
typedef struct cardList_t
{
char*model;
uint32_tid;
uint32_tsubid;
uint64_tvideoRam;
struct cardList_t*next;
} cardList_t;
void add_card(char *model, uint32_t id, uint32_t subid, uint64_t videoRam);
void fill_card_list(void);
cardList_t *FindCardWithIds(uint32_t id, uint32_t subid);
#endif //__LIBSAIO_GFX_HELPER_H
branches/ErmaC/Enoch/i386/libsaio/nvidia.c
5555
5656
5757
58
58
5959
6060
6161
#include "device_inject.h"
#include "convert.h"
#include "nvidia.h"
#include "nvidia_helper.h"
#include "gfx_helper.h"
#if DEBUG_NVIDIA
#define DBG(x...)printf(x)
branches/ErmaC/Enoch/i386/libsaio/fake_efi.c
633633
634634
635635
636
636
637637
638
638
639639
640640
641641
......
830830
831831
832832
833
833834
834
835
835
836
836837
837
838
838839
839
840
840
841
841842
842843
843844
DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &Platform.CPU.CPUFrequency);
}
DT__AddProperty(efiPlatformNode,START_POWER_EV, sizeof(STARTUP_POWER_EVENTS), (EFI_UINT8 *) &STARTUP_POWER_EVENTS);
DT__AddProperty(efiPlatformNode, START_POWER_EV, sizeof(STARTUP_POWER_EVENTS), (EFI_UINT8 *) &STARTUP_POWER_EVENTS);
DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(DEVICE_PATHS_SUPPORTED), (EFI_UINT8 *) &DEVICE_PATHS_SUPPORTED);
DT__AddProperty(efiPlatformNode, DEV_PATH_SUP, sizeof(DEVICE_PATHS_SUPPORTED), (EFI_UINT8 *) &DEVICE_PATHS_SUPPORTED);
DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32 *)Platform.UUID);
// Micky1979 : MIMIC booter entry for El Capitan
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan
{
verbose("Adding booter spec to the Platform Expert \n");
// booter-build-time (Fri May 22 19:06:42 PDT 2015) DP1
// booter-build-time (Fri Jul 24 17:39:22 PDT 2015) DP7
// booter-build-time (Fri Apr 14 16:21:16 PDT 2017) 10.12.5
DT__AddProperty(chosenNode, "booter-build-time", sizeof(I386BOOT_BUILDDATE), I386BOOT_BUILDDATE);
// booter-name (boot.efi)
// booter-name
DT__AddProperty(chosenNode, "booter-name", sizeof("Enoch"), "Enoch");
// booter-version (version:295.0.0.1.1) DP1
// booter-version (version:304) DP7
// booter-version (version:324.50.13) 10.12.5
DT__AddProperty(chosenNode, "booter-version", sizeof(I386BOOT_CHAMELEONREVISION), I386BOOT_CHAMELEONREVISION);
}
}
branches/ErmaC/Enoch/i386/boot2/drivers.c
967967
968968
969969
970
970
971971
972972
973973
......
15311531
15321532
15331533
1534
1534
1535
1536
15351537
15361538
15371539
1538
1539
1540
1541
15401542
15411543
15421544
......
15951597
15961598
15971599
1600
1601
15981602
1599
1603
16001604
16011605
16021606
snprintf(gFileSpec, 4096, "%s%s", module->executablePath, fileName);
#if FAKESMC_SUPPORT
if (!strcmp(fileName, "EmbeddedFakeSMC"))
if (!strcmp(fileName, "EmbeddedFakeSMC"))
{
verbose("\t Loading embedded FakeSMC: ");
embedded = malloc(FakeSMC_un_len);
case 3: kernelOSVer = 0xA0C0200; break;
case 4: kernelOSVer = 0xA0C0300; break;
case 5: kernelOSVer = 0xA0C0400; break;
default:kernelOSVer = 0xA0C0400; break; //Last known kernel (add here updates)
case 6: kernelOSVer = 0xA0C0500; break;
//case 7: kernelOSVer = 0xA0C0600; break;
default:kernelOSVer = 0xA0C0500; break; //Last known kernel (add here updates)
}
break;
default:
kernelOSVer = 0xA0C0400;
break; //Last known kernel is Sierra 10.12.4
kernelOSVer = 0xA0C0500;
break; //Last known kernel is Sierra 10.12.5
}
}
else
case 0xA0C0200: gDarwinMajor = 16; gDarwinMinor = 3; gDarwinRev = 0; break; // 10.12.2
case 0xA0C0300: gDarwinMajor = 16; gDarwinMinor = 4; gDarwinRev = 0; break; // 10.12.3
case 0xA0C0400: gDarwinMajor = 16; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.12.4
case 0xA0C0500: gDarwinMajor = 16; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.12.5
//case 0xA0C0600: gDarwinMajor = 16; gDarwinMinor = x; gDarwinRev = x; break; // 10.12.6
// default = last known kernel
default: gDarwinMajor = 16; gDarwinMinor = 5; gDarwinRev = 0; break; // 10.12.4;
default: gDarwinMajor = 16; gDarwinMinor = 6; gDarwinRev = 0; break; // 10.12.5;
}
}
branches/ErmaC/Enoch/i386/boot2/boot.c
13411341
13421342
13431343
1344
1345
1344
1345
13461346
13471347
13481348
// ===============================================================================
bootArgs->csrCapabilities= CSR_VALID_FLAGS;
bootArgs->boot_SMC_plimit= 0;
bootArgs->csrCapabilities= CSR_VALID_FLAGS;
bootArgs->boot_SMC_plimit= 0;
}
}
branches/ErmaC/Enoch/i386/boot2/options.c
377377
378378
379379
380
380
381381
382382
383383
......
13871387
13881388
13891389
1390
1390
13911391
13921392
13931393
//==========================================================================
static const MenuItem * gMenuItems = NULL;
static const MenuItem *gMenuItems = NULL;
static int gMenuItemCount;
static int gMenuRow;
gOverrideKernel = true;
}
// Ermac : Inject "kext-dev-mode=1" if OS X 10.10 is detected
// ErmaC: Inject "kext-dev-mode=1" if OS X 10.10 is detected
if ( (gMacOSVersion[3] == '1') && (gMacOSVersion[4] == '0') ) // OS X is 10.10
{
verbose("Added: kext-dev-mode=1\n");

Archive Download the corresponding diff file

Revision: 2882