Chameleon

Chameleon Commit Details

Date:2010-08-15 11:07:43 (13 years 7 months ago)
Author:Azimutz
Commit:365
Parents: 364
Message:Restoring needed code to avoid dsdt loading as ssdt, when the path is specified by the user plus, cached patch search code with verbose enabled.
Changes:
M/branches/azimutz/CleanCut/i386/libsaio/acpi_patcher.c

File differences

branches/azimutz/CleanCut/i386/libsaio/acpi_patcher.c
9090
9191
9292
93
93
94
9495
9596
9697
9798
98
99
99
100
101
100102
101103
102104
......
104106
105107
106108
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
107136
108137
109138
......
125154
126155
127156
128
129
157
158
159
130160
131
132161
162
133163
134164
135165
166
136167
137168
138169
/** The following ACPI Table search algo, should be reused anywhere needed: */
int search_and_get_acpi_fd(const char * filename, const char ** outDirspec)
{
chardirSpecDSDT[128] = "";
static bool first_time = true;
static chardirSpecDSDT[128] = "";
const char *override_pathname = NULL; // full path to a file.
intlen = 0, fd = 0;
extern char gMacOSVersion;
// Take in account user overriding
if (getValueForKey(kDSDTKey, &override_pathname, &len, &bootInfo->bootConfig))
// Take in account user overriding if it's DSDT only
if (strstr(filename, "DSDT") &&
getValueForKey(kDSDTKey, &override_pathname, &len, &bootInfo->bootConfig))
{
// Specify a path to a file, e.g. DSDT=/Extra/test.aml
sprintf(dirSpecDSDT, override_pathname);
if (fd >= 0) goto success_fd;
}
// Check that dirSpecDSDT is not already assigned with a path
if (!first_time && *dirSpecDSDT)
{ // it is so start searching this cached patch first
//extract path
for (len = strlen(dirSpecDSDT)-1; len; len--)
{
if (dirSpecDSDT[len] == '/' || len == 0)
{
dirSpecDSDT[len] = '\0';
break;
}
}
// now concat with the filename
strncat(dirSpecDSDT, "/", sizeof(dirSpecDSDT));
strncat(dirSpecDSDT, filename, sizeof(dirSpecDSDT));
// and test to see if we don't have our big boy here:
fd = open(dirSpecDSDT,0);
if (fd >= 0)
{
printf("ACPI file search cache hit: file found at %s\n", dirSpecDSDT);
goto success_fd;
}
}
// Start searching any potential location for ACPI Table
// Check rd's root.
sprintf(dirSpecDSDT, "rd(0,0)/%s", filename);
fd = open(dirSpecDSDT, 0);
//if (fd>=0) goto success_fd;
// NOT FOUND:
//Azi: a reminder - handling this only on pci_root.c, getPciRootUID() (it's enough to check if .aml file exists),
// to reduce number of printed messages and the confusion caused by them on users.
//Azi: a reminder - handling this verbose only on pci_root.c, getPciRootUID()
// (it's enough to check if *.aml file exists), to reduce number of printed messages
// and the confusion caused by them on users.
//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 = dirSpecDSDT;
return fd;
}

Archive Download the corresponding diff file

Revision: 365