Index: branches/rekursor/version =================================================================== --- branches/rekursor/version (revision 60) +++ branches/rekursor/version (revision 61) @@ -1 +1 @@ -2.0-RC5pre6 \ No newline at end of file +2.0-RC5pre7 \ No newline at end of file Index: branches/rekursor/CHANGES =================================================================== --- branches/rekursor/CHANGES (revision 60) +++ branches/rekursor/CHANGES (revision 61) @@ -1,3 +1,5 @@ +- Nvidia injection fix +- pciroot would not always return correct uuid in autodection mode - Fixed the hibernation problem in boot2/resume.c - Fixed all new booter versions with SystemType would override the facp value even if correct, now keeps the facp value if correct and no override has been done, implemented a best effort algo. Index: branches/rekursor/i386/libsaio/pci_root.c =================================================================== --- branches/rekursor/i386/libsaio/pci_root.c (revision 60) +++ branches/rekursor/i386/libsaio/pci_root.c (revision 61) @@ -7,7 +7,7 @@ #include "bootstruct.h" #ifndef DEBUG_PCIROOT -#define DEBUG_PCIROOT 0 +#define DEBUG_PCIROOT 1 #endif #if DEBUG_PCIROOT @@ -46,50 +46,43 @@ int getPciRootUID(void) { void *new_dsdt; - const char *dsdt_filename; const char *val; - int fd; - int dsdt_uid; int len,fsize; + const char * dsdt_filename=NULL; + extern int search_and_get_acpi_fd(const char *, const char **); - if (rootuid < 10) { - return rootuid; - } + if (rootuid < 10) return rootuid; rootuid = 0; /* default uid = 0 */ if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->bootConfig)) { - if (isdigit(val[0])) { - rootuid = val[0] - '0'; - } + if (isdigit(val[0])) rootuid = val[0] - '0'; goto out; } -#if 1 /* Chameleon compatibility */ - if (getValueForKey("PciRoot", &val, &len, &bootInfo->bootConfig)) { - if (isdigit(val[0])) { - rootuid = val[0] - '0'; - } + else if (getValueForKey("PciRoot", &val, &len, &bootInfo->bootConfig)) { + if (isdigit(val[0])) rootuid = val[0] - '0'; goto out; } - /* PCEFI compatibility */ - if (getValueForKey("-pci0", &val, &len, &bootInfo->bootConfig)) { + else if (getValueForKey("-pci0", &val, &len, &bootInfo->bootConfig)) { rootuid = 0; goto out; } - if (getValueForKey("-pci1", &val, &len, &bootInfo->bootConfig)) { + else if (getValueForKey("-pci1", &val, &len, &bootInfo->bootConfig)) { rootuid = 1; goto out; } -#endif - if (!getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->bootConfig)) { - dsdt_filename="/Extra/DSDT.aml"; - } - if ((fd = open_bvdev("bt(0,0)", dsdt_filename, 0)) < 0) { - verbose("[WARNING] %s not found\n", dsdt_filename); - goto out; + int fd = search_and_get_acpi_fd("DSDT.aml", &dsdt_filename); + + // Check booting partition + if (fd<0) + { + verbose("No DSDT found, using 0 as uid value.\n"); + rootuid = 0; + return rootuid; } + fsize = file_size(fd); if ((new_dsdt = malloc(fsize)) == NULL) { @@ -104,15 +97,15 @@ } close (fd); - dsdt_uid = findpciroot(new_dsdt, fsize); + rootuid = findpciroot(new_dsdt, fsize); free(new_dsdt); - if(dsdt_uid == 11) dsdt_uid=0; //usually when _UID isnt present, it means uid is zero - else if (dsdt_uid < 0 || dsdt_uid > 9) + // make sure it really works: + if (rootuid == 11) rootuid=0; //usually when _UID isnt present, it means uid is zero + else if (rootuid < 0 || rootuid > 9) { printf("PciRoot uid value wasnt found, using 0, if you want it to be 1, use -PciRootUID flag"); - dsdt_uid = 0; - //if(dsdt_uid == 10) //algo failed, PCI0 wasnt found + rootuid = 0; } out: verbose("Using PCI-Root-UID value: %d\n", rootuid); Index: branches/rekursor/i386/libsaio/dsdt_patcher.c =================================================================== --- branches/rekursor/i386/libsaio/dsdt_patcher.c (revision 60) +++ branches/rekursor/i386/libsaio/dsdt_patcher.c (revision 61) @@ -12,7 +12,7 @@ #include "platform.h" #ifndef DEBUG_DSDT -#define DEBUG_DSDT 1 +#define DEBUG_DSDT 0 #endif #if DEBUG_DSDT==2 @@ -72,66 +72,78 @@ } return NULL; } - -void *loadACPITable () +/** The folowing ACPI Table search algo. should be reused anywhere needed:*/ +int search_and_get_acpi_fd(const char * filename, const char ** outDirspec) { - void *tableAddr; - int fd = -1; - char dirspec[512]; - const char * const filename = "DSDT.aml"; - const char * overriden_pathname=NULL; - int len=0; + int fd=0; + const char * overriden_pathname=NULL; + static char dirspec[512]=""; + int len=0; - // Check booting partition - - // Rek: if user specified a full path name then take it in consideration - if (getValueForKey(kDSDT, &overriden_pathname, &len, + /// 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); // start searching root - //printf("Using custom DSDT path %s\n", dirspec); - //getc(); - } - else - sprintf(dirspec, "/%s", filename); // start searching root + { + sprintf(dirspec, "%s", overriden_pathname); // start searching root + fd=open (dirspec,0); + if (fd>=0) goto success_fd; + } - fd=open (dirspec,0); + // Start searching any potential location for ACPI Table + sprintf(dirspec, "/%s", filename); // start searching root + fd=open (dirspec,0); + if (fd>=0) goto success_fd; - if (fd<0) - { // Check Extra on booting partition - //verbose("Searching for DSDT.aml file ...\n"); - sprintf(dirspec,"/Extra/%s",filename); - fd=open (dirspec,0); - if (fd<0) - { // Fall back to booter partition - sprintf(dirspec,"bt(0,0)/Extra/%s",filename); - fd=open (dirspec,0); - if (fd<0) - { - verbose("ACPI Table not found: %s\n", filename); - return NULL; - } - } - } + sprintf(dirspec, "%s", filename); // start current dir + fd=open (dirspec,0); + if (fd>=0) goto success_fd; - tableAddr=(void*)AllocateKernelMemory(file_size (fd)); - if (tableAddr) - { - if (read (fd, tableAddr, file_size (fd))!=file_size (fd)) - { - printf("Couldn't read table %s\n",dirspec); - free (tableAddr); - close (fd); - return NULL; - } + sprintf(dirspec,"/Extra/%s",filename); + fd=open (dirspec,0); + if (fd>=0) goto success_fd; - DBG("Table %s read and stored at: %x\n", dirspec, tableAddr); - close (fd); - return tableAddr; - } + sprintf(dirspec,"bt(0,0)/Extra/%s",filename); + fd=open (dirspec,0); + if (fd>=0) goto success_fd; + // NOT FOUND: + verbose("ACPI Table not found: %s\n", filename); + if (outDirspec) *outDirspec = ""; + return -1; + // FOUND +success_fd: + if (outDirspec) *outDirspec = dirspec; + return fd; +} + +void *loadACPITable (const char * filename) +{ + void *tableAddr; + const char * dirspec=NULL; + + int fd = search_and_get_acpi_fd(filename, &dirspec); + + if (fd>=0) + { + tableAddr=(void*)AllocateKernelMemory(file_size (fd)); + if (tableAddr) + { + if (read (fd, tableAddr, file_size (fd))!=file_size (fd)) + { + printf("Couldn't read table %s\n",dirspec); + free (tableAddr); + close (fd); + return NULL; + } + + DBG("Table %s read and stored at: %x\n", dirspec, tableAddr); + close (fd); + return tableAddr; + } + close (fd); + } printf("Couldn't allocate memory for table %s\n", dirspec); - close (fd); return NULL; } @@ -253,7 +265,7 @@ bool drop_ssdt; // Load replacement DSDT - new_dsdt=loadACPITable(); + new_dsdt=loadACPITable("DSDT.aml"); if (!new_dsdt) { return setupAcpiNoMod(); Index: branches/rekursor/i386/libsaio/nvidia.c =================================================================== --- branches/rekursor/i386/libsaio/nvidia.c (revision 60) +++ branches/rekursor/i386/libsaio/nvidia.c (revision 61) @@ -594,7 +594,6 @@ static int devprop_add_nvidia_template(struct DevPropDevice *device) { char tmp[16]; - int len; if(!device) return 0; @@ -616,7 +615,7 @@ // Rek : Dont use sprintf return, it does not WORK !! our custom sprintf() always return 0! // len = sprintf(tmp, "Slot-%x", devices_number); sprintf(tmp, "Slot-%x",devices_number); - devprop_add_value(device, "AAPL,slot-name", tmp, strlen(tmp)); + devprop_add_value(device, "AAPL,slot-name", (uint8_t *) tmp, strlen(tmp)); devices_number++; return 1; @@ -662,7 +661,7 @@ verbose("Using nVidia Video BIOS File %s (%d Bytes)\n", nvFilename, nvBiosOveride); DBG("%s Signature 0x%02x%02x %d bytes\n", nvFilename, rom[0], rom[1], nvBiosOveride); } else { - printf("ERROR: unable to open Vidia Video BIOS File %s\n", nvFilename); + printf("ERROR: unable to open nVidia Video BIOS File %s\n", nvFilename); return false; } } else { Index: branches/rekursor/i386/libsaio/pci.c =================================================================== --- branches/rekursor/i386/libsaio/pci.c (revision 60) +++ branches/rekursor/i386/libsaio/pci.c (revision 61) @@ -7,9 +7,10 @@ #include "libsaio.h" #include "bootstruct.h" #include "pci.h" +#include "pci_root.h" #ifndef DEBUG_PCI -#define DEBUG_PCI 0 +#define DEBUG_PCI 1 #endif #if DEBUG_PCI @@ -149,14 +150,22 @@ dev_path[0] = 0; end = root_pci_dev; - while (end != pci_dt) { + + int uid = getPciRootUID(); + while (end != pci_dt) + { current = pci_dt; - while (current->parent != end) current = current->parent; + while (current->parent != end) + current = current->parent; end = current; - if (current->parent == root_pci_dev) - sprintf(tmp, "PciRoot(0x%x)/Pci(0x%x,0x%x)", getPciRootUID(), current->dev.bits.dev, current->dev.bits.func); - else - sprintf(tmp, "/Pci(0x%x,0x%x)", current->dev.bits.dev, current->dev.bits.func); + if (current->parent == root_pci_dev) + { + sprintf(tmp, "PciRoot(0x%x)/Pci(0x%x,0x%x)", uid, + current->dev.bits.dev, current->dev.bits.func); + } else { + sprintf(tmp, "/Pci(0x%x,0x%x)", + current->dev.bits.dev, current->dev.bits.func); + } strcat(dev_path, tmp); } return dev_path; Index: branches/rekursor/i386/libsaio/biosfn.c =================================================================== --- branches/rekursor/i386/libsaio/biosfn.c (revision 60) +++ branches/rekursor/i386/libsaio/biosfn.c (revision 61) @@ -168,7 +168,7 @@ MemoryRange * range = (MemoryRange *)BIOS_ADDR; unsigned long count = 0; - unsigned long rerangedCount; + // unsigned long rerangedCount; unsigned long long conMemSize = 0; unsigned long long extMemSize = 0; Property changes on: branches/rekursor ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r57-60