Index: trunk/doc/BootHelp.txt =================================================================== --- trunk/doc/BootHelp.txt (revision 453) +++ trunk/doc/BootHelp.txt (revision 454) @@ -90,11 +90,10 @@ DropSSDT=Yes Skip the SSDT tables while relocating the ACPI tables. DSDT= 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= Use an alternate smbios.plist file - (default path: /smbios.plist /Extra/smbios.plist - bt(0,0)/Extra/smbios.plist). + SMBIOS= 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 Index: trunk/i386/libsaio/acpi_patcher.c =================================================================== --- trunk/i386/libsaio/acpi_patcher.c (revision 453) +++ trunk/i386/libsaio/acpi_patcher.c (revision 454) @@ -89,72 +89,36 @@ /** 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; @@ -706,9 +670,23 @@ { 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) { Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 453) +++ trunk/i386/libsaio/fake_efi.c (revision 454) @@ -628,37 +628,36 @@ { char dirSpecSMBIOS[128] = ""; const char *override_pathname = NULL; - int len = 0, fd = 0; + int len = 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