Chameleon

Chameleon Commit Details

Date:2010-08-30 22:30:10 (8 years 11 months ago)
Author:Tamás Kosárszky
Commit:454
Parents: 453
Message:Changed loading mechanism of *SDT and SMBIOS.plist files. Using SMBIOS=<filename> option won't fall back to default location/filename lookup if the user configured SMBIOS file was not found. Using DSDT=<filename> still permits to load SSDT files.
Changes:
M/trunk/i386/libsaio/acpi_patcher.c
M/trunk/doc/BootHelp.txt
M/trunk/i386/libsaio/fake_efi.c

File differences

trunk/doc/BootHelp.txt
9090
9191
9292
93
93
9494
95
96
97
95
96
9897
9998
10099
DropSSDT=Yes Skip the SSDT tables while relocating the ACPI tables.
DSDT=<file> Use an alternate DSDT.aml file
(default path: /DSDT.aml /Extra/DSDT.aml).
(default path: /DSDT.aml /Extra/DSDT.aml bt(0,0)/Extra/DSDT.aml).
SMBIOS=<file> Use an alternate smbios.plist file
(default path: /smbios.plist /Extra/smbios.plist
bt(0,0)/Extra/smbios.plist).
SMBIOS=<file> Use an alternate SMBIOS.plist file
(default path: /Extra/SMBIOS.plist bt(0,0)/Extra/SMBIOS.plist).
SMBIOSdefaults=No Don't use the Default values for SMBIOS overriding
if smbios.plist doesn't exist, factory
trunk/i386/libsaio/acpi_patcher.c
8989
9090
9191
92
93
94
95
96
92
93
9794
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
95
96
97
98
99
100
101
102
103
123104
124
125
105
106
126107
127108
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
154
109
110
111
112
113
114
115
116
117
155118
156119
157120
121
158122
159123
160124
......
706670
707671
708672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
709687
710688
711
689
712690
713691
714692
/** The folowing ACPI Table search algo. should be reused anywhere needed:*/
int search_and_get_acpi_fd(const char * filename, const char ** outDirspec)
{
int fd=0;
const char * overriden_pathname=NULL;
static char dirspec[512]="";
static bool first_time =true;
int len=0;
int fd = 0;
char dirSpec[512] = "";
/// Take in accound user overriding if it's DSDT only
if (strstr(filename, "DSDT") &&
getValueForKey(kDSDT, &overriden_pathname, &len,
&bootInfo->bootConfig))
{
sprintf(dirspec, "%s", overriden_pathname);
fd=open (dirspec,0);
if (fd>=0) goto success_fd;
}
// Check that dirspec is not already assigned with a path
if (!first_time && *dirspec)
{ // it is so start searching this cached patch first
//extract path
for (len=strlen(dirspec)-1; len; len--)
if (dirspec[len]=='/' || len==0)
{
dirspec[len]='\0';
break;
}
// now concat with the filename
strncat(dirspec, "/", sizeof(dirspec));
strncat(dirspec, filename, sizeof(dirspec));
// and test to see if we don't have our big boy here:
fd=open (dirspec,0);
if (fd>=0)
// Try finding 'filename' in the usual places
// Start searching any potential location for ACPI Table
sprintf(dirSpec, "%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
sprintf(dirSpec, "/Extra/%s", filename);
fd = open(dirSpec, 0);
if (fd < 0)
{
// printf("ACPI file search cache hit: file found at %s\n", dirspec);
goto success_fd;
sprintf(dirSpec, "bt(0,0)/Extra/%s", filename);
fd = open(dirSpec, 0);
}
}
// Start searching any potential location for ACPI Table
// search the Extra folders first
sprintf(dirspec,"/Extra/%s",filename);
fd=open (dirspec,0);
if (fd>=0) goto success_fd;
sprintf(dirspec,"bt(0,0)/Extra/%s",filename);
fd=open (dirspec,0);
if (fd>=0) goto success_fd;
sprintf(dirspec, "%s", filename); // search current dir
fd=open (dirspec,0);
if (fd>=0) goto success_fd;
sprintf(dirspec, "/%s", filename); // search root
fd=open (dirspec,0);
if (fd>=0) goto success_fd;
// NOT FOUND:
//verbose("ACPI Table not found: %s\n", filename);
if (outDirspec) *outDirspec = "";
first_time = false;
return -1;
// FOUND
success_fd:
first_time = false;
if (outDirspec) *outDirspec = dirspec;
if (fd < 0)
{
// NOT FOUND:
verbose("ACPI table not found: %s\n", filename);
*dirSpec = '\0';
}
if (outDirspec) *outDirspec = dirSpec;
return fd;
}
void *loadACPITable (const char * filename)
{
void *tableAddr;
{
int version;
void *new_dsdt;
const char *filename;
char dirSpec[128];
int len = 0;
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->bootConfig))
{
sprintf(dirSpec, filename);
}
else
{
sprintf(dirSpec, "DSDT.aml");
}
// Load replacement DSDT
new_dsdt=loadACPITable("DSDT.aml");
new_dsdt = loadACPITable(dirSpec);
// Mozodojo: going to patch FACP and load SSDT's even if DSDT.aml is not present
/*if (!new_dsdt)
{
trunk/i386/libsaio/fake_efi.c
628628
629629
630630
631
631
632632
633633
634634
635
635
636636
637637
638638
639
640
639
641640
642
643
644
645
646
647
648
649
650
651
652
653
641
654642
655
643
644
645
646
647
648
649
650
656651
657
652
653
654
655
656
657
658658
659659
660660
661
662661
663662
664663
{
chardirSpecSMBIOS[128] = "";
const char *override_pathname = NULL;
intlen = 0, fd = 0;
intlen = 0, err = 0;
extern void scan_mem();
// Take in account user overriding
if (getValueForKey(kSMBIOSKey, &override_pathname, &len, &bootInfo->bootConfig))
if (getValueForKey(kSMBIOSKey, &override_pathname, &len, &bootInfo->bootConfig) && len > 0)
{
// Specify a path to a file, e.g. SMBIOS=/Extra/macProXY.plist
sprintf(dirSpecSMBIOS, override_pathname);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
}
// Check selected volume's Extra.
sprintf(dirSpecSMBIOS, "/Extra/%s", filename);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
// Check booter volume/rdbt Extra.
sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
if (loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig) == -1)
else
{
verbose("No SMBIOS replacement provided.\n");
// Check selected volume's Extra.
sprintf(dirSpecSMBIOS, "/Extra/%s", filename);
if (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig))
{
// Check booter volume/rdbt Extra.
sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename);
err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
}
}
if (err)
{
verbose("No SMBIOS replacement found.\n");
}
// get a chance to scan mem dynamically if user asks for it while having the config options loaded as well,
// as opposed to when it was in scan_platform(); also load the orig. smbios so that we can access dmi info without
// patching the smbios yet
success_fd:
getSmbios(SMBIOS_ORIGINAL);
scan_mem();
smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED);// process smbios asap

Archive Download the corresponding diff file

Revision: 454