Index: branches/ErmaC/Enoch/i386/libsaio/asm.s =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/asm.s (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/asm.s (revision 2542) @@ -548,4 +548,4 @@ popl %edx ret - +// computeRand() end function - - - - - - - - - - - - - - - - - - - - - - - - Index: branches/ErmaC/Enoch/i386/libsaio/console.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/console.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/console.c (revision 2542) @@ -67,6 +67,18 @@ char *msgbuf = 0; char *cursor = 0; +// Bungo: +typedef struct { + uint16_t year; + uint8_t mon; + uint8_t day; + uint8_t hour; + uint8_t mins; + uint8_t secs; + uint8_t dlight; +} datetime_t; +static datetime_t datetime; + struct putc_info //Azi: exists on gui.c & printf.c { char * str; @@ -86,6 +98,31 @@ return c; } +uint64_t getRTCdatetime() // 0xYYYYMMDDHHMMSS0L in decimal +{ + biosBuf_t bb; + + bb.intno = 0x1a; + bb.eax.r.h = 0x04; // get RTC date + //bb.flags.cf = 0; + bios(&bb); + if (bb.flags.cf) return 0; + datetime.year = (bb.ecx.r.h >> 4) * 1000 + (bb.ecx.r.h & 0x0F) * 100 + (bb.ecx.r.l >> 4) * 10 + (bb.ecx.r.l & 0x0F) * 1; + datetime.mon = (bb.edx.r.h >> 4) * 10 + (bb.edx.r.h & 0x0F) * 1; + datetime.day = (bb.edx.r.l >> 4) * 10 + (bb.edx.r.l & 0x0F) * 1; + + bb.intno = 0x1a; + bb.eax.r.h = 0x02; // get RTC time + //bb.flags.cf = 0; + bios(&bb); + if (bb.flags.cf) return 0; + datetime.dlight = bb.edx.r.l & 0x0F; + datetime.hour = (bb.ecx.r.h >> 4) * 10 + (bb.ecx.r.h & 0x0F) * 1; + datetime.mins = (bb.ecx.r.l >> 4) * 10 + (bb.ecx.r.l & 0x0F) * 1; + datetime.secs = (bb.edx.r.h >> 4) * 10 + (bb.edx.r.h & 0x0F) * 1; + return *(uint64_t *)&datetime; +} + void initBooterLog(void) { msgbuf = malloc(BOOTER_LOG_SIZE); @@ -99,11 +136,13 @@ va_list ap; struct putc_info pi; - if (!msgbuf) { + if (!msgbuf) + { return; } - if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) { + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) + { return; } @@ -117,7 +156,8 @@ void setupBooterLog(void) { - if (!msgbuf) { + if (!msgbuf) + { return; } @@ -174,6 +214,7 @@ int printf(const char * fmt, ...) { va_list ap; + va_start(ap, fmt); if (bootArgs->Video.v_display == VGA_TEXT_MODE) { @@ -300,8 +341,8 @@ } /** Print a "Press a key to continue..." message and wait for a key press. */ -void pause() +void pause() { - printf("Press a key to continue...\n"); + printf("Press a key to continue...\n"); getchar(); // replace getchar() by pause() were useful. } Index: branches/ErmaC/Enoch/i386/libsaio/bootstruct.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bootstruct.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/bootstruct.c (revision 2542) @@ -97,6 +97,7 @@ if (node == 0) { stop("Couldn't create root node"); } + getPlatformName(platformName); nameLen = strlen(platformName) + 1; DT__AddProperty(node, "compatible", nameLen, platformName); Index: branches/ErmaC/Enoch/i386/libsaio/ntfs_private.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/ntfs_private.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/ntfs_private.h (revision 2542) @@ -94,6 +94,7 @@ }; #define NTFS_AF_INRUN 0x00000001 + struct attrhdr { u_int32_t a_type; u_int32_t reclen; @@ -105,16 +106,18 @@ u_int8_t reserved2; u_int16_t a_index; }; -#define NTFS_A_STD 0x10 -#define NTFS_A_ATTRLIST 0x20 -#define NTFS_A_NAME 0x30 + +#define NTFS_A_STD 0x10 +#define NTFS_A_ATTRLIST 0x20 +#define NTFS_A_NAME 0x30 #define NTFS_A_VOLUMENAME 0x60 -#define NTFS_A_DATA 0x80 -#define NTFS_A_INDXROOT 0x90 -#define NTFS_A_INDX 0xA0 -#define NTFS_A_INDXBITMAP 0xB0 +#define NTFS_A_DATA 0x80 +#define NTFS_A_INDXROOT 0x90 +#define NTFS_A_INDX 0xA0 +#define NTFS_A_INDXBITMAP 0xB0 #define NTFS_MAXATTRNAME 255 + struct attr { struct attrhdr a_hdr; union { @@ -144,7 +147,7 @@ u_int64_t t_write; u_int64_t t_mftwrite; u_int64_t t_access; -} ntfs_times_t; +} ntfs_times_t; #define NTFS_FFLAG_RDONLY 0x01LL #define NTFS_FFLAG_HIDDEN 0x02LL @@ -266,7 +269,7 @@ u_int8_t bf_spc; /* sectors per cluster */ u_int8_t reserved2[7]; /* unused (zeroed) */ u_int8_t bf_media; /* media desc. (0xF8) */ - u_int8_t reserved3[2]; + u_int8_t reserved3[2]; /* always 0 */ u_int16_t bf_spt; /* sectors per track */ u_int16_t bf_heads; /* number of heads */ u_int8_t reserver4[12]; @@ -275,9 +278,9 @@ cn_t bf_mftmirrcn; /* $MFTMirr cn */ u_int8_t bf_mftrecsz; /* MFT record size (clust) */ /* 0xF6 inducates 1/4 */ - u_int8_t reserved5[3]; + u_int8_t reserved5[3]; u_int8_t bf_ibsz; /* index buffer size */ - u_int8_t reserved6[3]; + u_int8_t reserved6[3]; u_int64_t bf_volsn; /* volume ser. num. */ }; Index: branches/ErmaC/Enoch/i386/libsaio/vbe.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/vbe.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/vbe.c (revision 2542) @@ -69,7 +69,7 @@ #endif /* UNUSED */ //============================================================================== -int getVBEInfo( void * infoBlock ) +int getVBEInfo( void *infoBlock ) { bb.intno = 0x10; bb.eax.rr = funcGetControllerInfo; @@ -81,7 +81,7 @@ //============================================================================== -int getVBEModeInfo( int mode, void * minfo_p ) +int getVBEModeInfo( int mode, void *minfo_p ) { bb.intno = 0x10; bb.eax.rr = funcGetModeInfo; @@ -268,68 +268,69 @@ int setVBEMode(unsigned short mode, const VBECRTCInfoBlock * timing) { - bb.intno = 0x10; - bb.eax.rr = funcSetMode; - bb.ebx.rr = mode; - if (timing) { - bb.es = SEG(timing); - bb.edi.rr = OFF(timing); - } - bios(&bb); - return(bb.eax.r.h); + bb.intno = 0x10; + bb.eax.rr = funcSetMode; + bb.ebx.rr = mode; + if (timing) + { + bb.es = SEG(timing); + bb.edi.rr = OFF(timing); + } + bios(&bb); + return(bb.eax.r.h); } //============================================================================== int setVBEPalette(void *palette) { - bb.intno = 0x10; - bb.eax.rr = funcGetSetPaletteData; - bb.ebx.r.l = subfuncSet; - bb.ecx.rr = 256; - bb.edx.rr = 0; - bb.es = SEG(palette); - bb.edi.rr = OFF(palette); - bios(&bb); - return(bb.eax.r.h); + bb.intno = 0x10; + bb.eax.rr = funcGetSetPaletteData; + bb.ebx.r.l = subfuncSet; + bb.ecx.rr = 256; + bb.edx.rr = 0; + bb.es = SEG(palette); + bb.edi.rr = OFF(palette); + bios(&bb); + return(bb.eax.r.h); } //============================================================================== int getVBEPalette(void *palette) { - bb.intno = 0x10; - bb.eax.rr = funcGetSetPaletteData; - bb.ebx.r.l = subfuncGet; - bb.ecx.rr = 256; - bb.edx.rr = 0; - bb.es = SEG(palette); - bb.edi.rr = OFF(palette); - bios(&bb); - return(bb.eax.r.h); + bb.intno = 0x10; + bb.eax.rr = funcGetSetPaletteData; + bb.ebx.r.l = subfuncGet; + bb.ecx.rr = 256; + bb.edx.rr = 0; + bb.es = SEG(palette); + bb.edi.rr = OFF(palette); + bios(&bb); + return(bb.eax.r.h); } //============================================================================== int getVBECurrentMode(unsigned short *mode) { - bb.intno = 0x10; - bb.eax.rr = funcGetCurrentMode; - bios(&bb); - *mode = bb.ebx.rr; - return(bb.eax.r.h); + bb.intno = 0x10; + bb.eax.rr = funcGetCurrentMode; + bios(&bb); + *mode = bb.ebx.rr; + return(bb.eax.r.h); } //============================================================================== int getVBEPixelClock(unsigned short mode, unsigned long * pixelClock) { - bb.intno = 0x10; - bb.eax.rr = funcGetSetPixelClock; - bb.ebx.r.l = 0; - bb.ecx.rx = *pixelClock; - bb.edx.rr = mode; - bios(&bb); - *pixelClock = bb.ecx.rx; - return(bb.eax.r.h); + bb.intno = 0x10; + bb.eax.rr = funcGetSetPixelClock; + bb.ebx.r.l = 0; + bb.ecx.rx = *pixelClock; + bb.edx.rr = mode; + bios(&bb); + *pixelClock = bb.ecx.rx; + return(bb.eax.r.h); } Index: branches/ErmaC/Enoch/i386/libsaio/device_tree.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/device_tree.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/device_tree.c (revision 2542) @@ -87,13 +87,13 @@ { Property *prop; - DPRINTF("DT__AddProperty([Node '%s'], '%s', %d, 0x%x)\n", DT__GetName(node), name, length, value); + DPRINTF("DT__AddProperty([Node '%s'], '%s', %d, 0x%X)\n", DT__GetName(node), name, length, value); if (freeProperties == NULL) { void *buf = malloc(kAllocSize); int i; - DPRINTF("Allocating more free properties\n"); + DPRINTF("DT__AddProperty: Allocating more free properties\n"); if (buf == 0) { return 0; @@ -159,7 +159,7 @@ int i; - DPRINTF("Allocating more free nodes\n"); + DPRINTF("DT__AddChild: Allocating more free nodes\n"); bzero(buf, kAllocSize); node = (Node *)buf; @@ -183,8 +183,8 @@ node = freeNodes; freeNodes = node->next; - DPRINTF("Got free node 0x%x\n", node); - DPRINTF("prop = 0x%x, children = 0x%x, next = 0x%x\n", node->properties, node->children, node->next); + DPRINTF("DT__AddChild: Got free node 0x%x\n", node); + DPRINTF("DT__AddChild: prop = 0x%x, children = 0x%x, next = 0x%x\n", node->properties, node->children, node->next); if (parent == NULL) { @@ -239,7 +239,7 @@ DTInfo.totalPropertySize = 0; rootNode = DT__AddChild(NULL, "/"); - DPRINTF("DT__Initialize done\n"); + DPRINTF("DT__Initialize: done\n"); } //============================================================================== @@ -256,6 +256,7 @@ for (prop = allocedProperties; prop != NULL; prop = prop->next) { + free((void *)(prop->name)); free(prop->value); } @@ -430,11 +431,11 @@ // Start at root node = rootNode; - DPRINTF("root = 0x%x\n", rootNode); + DPRINTF("DT__FindNode: root = 0x%x\n", rootNode); while (node) { - // Skip leading slash + // Skip leading slash(es) while (*path == '/') { path++; @@ -447,35 +448,34 @@ *bp = '\0'; - if (nameBuf[0] == '\0') - { - // last path entry - break; - } + if (nameBuf[0] == '\0') + { + // last path entry + break; + } - DPRINTF("Node '%s'\n", nameBuf); + DPRINTF("DT__FindNode: Node '%s'\n", nameBuf); - for (child = node->children; child != 0; child = child->next) - { - DPRINTF("Child 0x%x\n", child); + for (child = node->children; child != 0; child = child->next) + { + DPRINTF("DT__FindNode: Child 0x%x\n", child); - if (strcmp(DT__GetName(child), nameBuf) == 0) - { - break; + if (strcmp(DT__GetName(child), nameBuf) == 0) + { + break; + } } - } - if (child == 0 && createIfMissing) - { - DPRINTF("Creating node\n"); + if (child == 0 && createIfMissing) + { + char *str = malloc(strlen(nameBuf) + 1); + // XXX this will leak + strcpy(str, nameBuf); - char *str = malloc(strlen(nameBuf) + 1); - // XXX this will leak - strcpy(str, nameBuf); + child = DT__AddChild(node, str); + DPRINTF("DT__FindNode: Creating node: %s\n", str); + } - child = DT__AddChild(node, str); - } - node = child; } Index: branches/ErmaC/Enoch/i386/libsaio/hfs.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/hfs.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/hfs.c (revision 2542) @@ -290,7 +290,7 @@ return HFSReadFile(ih, filePath, (void *)gFSLoadAddress, 0, 0); } -long HFSReadFile(CICell ih, char * filePath, void *base, u_int64_t offset, u_int64_t length) +long HFSReadFile(CICell ih, char *filePath, void *base, u_int64_t offset, u_int64_t length) { char entry[512]; char devStr[12]; @@ -453,7 +453,7 @@ nodeSize = SWAP_BE16(gBTHeaders[kBTreeCatalog]->nodeSize); firstLeafNode = SWAP_BE32(gBTHeaders[kBTreeCatalog]->firstLeafNode); - dirIndex = (long long) firstLeafNode * nodeSize; + dirIndex = (long long)firstLeafNode * nodeSize; GetCatalogEntry(&dirIndex, &name, &flags, &time, 0, 0); @@ -505,7 +505,7 @@ if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - printf("HFS: Resolve path %s failed\n", filePath); + printf("HFS: Resolve path '%s' failed\n", filePath); return -1; } @@ -568,7 +568,7 @@ if (offset > fileLength) { - printf("Offset is too large.\n"); + printf("ReadFile(HFS%c): Offset is too large.\n", gIsHFSPlus ? "+" : ""); return -1; } Index: branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c (revision 2542) @@ -42,7 +42,7 @@ } /* Gets the ACPI 1.0 RSDP address */ -static struct acpi_2_rsdp* getAddressOfAcpiTable() +static struct acpi_2_rsdp *getAddressOfAcpiTable() { /* TODO: Before searching the BIOS space we are supposed to search the first 1K of the EBDA */ @@ -65,13 +65,13 @@ } /* Gets the ACPI 2.0 RSDP address */ -static struct acpi_2_rsdp* getAddressOfAcpi20Table() +static struct acpi_2_rsdp *getAddressOfAcpi20Table() { /* TODO: Before searching the BIOS space we are supposed to search the first 1K of the EBDA */ - void *acpi_addr = (void*)ACPI_RANGE_START; + void *acpi_addr = (void *)ACPI_RANGE_START; - for(; acpi_addr <= (void*)ACPI_RANGE_END; acpi_addr += 16) + for(; acpi_addr <= (void *)ACPI_RANGE_END; acpi_addr += 16) { if(*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE) { @@ -97,14 +97,14 @@ /* The folowing ACPI Table search algo. should be reused anywhere needed:*/ /* WARNING: outDirspec string will be overwritten by subsequent calls! */ -int search_and_get_acpi_fd(const char * filename, const char ** outDirspec) +int search_and_get_acpi_fd(const char *filename, const char **outDirspec) { int fd = 0; static char dirSpec[512]; // Try finding 'filename' in the usual places // Start searching any potential location for ACPI Table - snprintf(dirSpec, sizeof(dirSpec), "%s", filename); + snprintf(dirSpec, sizeof(dirSpec), "%s", filename); fd = open(dirSpec, 0); if (fd < 0) { @@ -127,51 +127,51 @@ return fd; } -void *loadACPITable (const char * filename) +void *loadACPITable (const char *filename) { - const char * dirspec=NULL; + const char *dirspec = NULL; int fd = search_and_get_acpi_fd(filename, &dirspec); if (fd >= 0) { - void *tableAddr = (void*)AllocateKernelMemory(file_size (fd)); + void *tableAddr = (void*)AllocateKernelMemory(file_size(fd)); if (tableAddr) { - if (read (fd, tableAddr, file_size (fd))!=file_size (fd)) + if (read(fd, tableAddr, file_size(fd)) != file_size(fd)) { DBG("Couldn't read table %s\n",dirspec); - free (tableAddr); - close (fd); + free(tableAddr); + close(fd); return NULL; } DBG("Table %s read and stored at: %x\n", dirspec, tableAddr); - close (fd); + close(fd); return tableAddr; } - close (fd); + close(fd); DBG("Couldn't allocate memory for table \n", dirspec); } //printf("Couldn't find table %s\n", filename); return NULL; } -uint8_t acpi_cpu_count = 0; -char* acpi_cpu_name[32]; -uint32_t acpi_cpu_p_blk = 0; +uint8_t acpi_cpu_count = 0; +uint32_t acpi_cpu_p_blk = 0; +char *acpi_cpu_name[32]; -void get_acpi_cpu_names(unsigned char* dsdt, uint32_t length) +void get_acpi_cpu_names(unsigned char *dsdt, uint32_t length) { uint32_t i; - DBG("Start finding cpu names. length %d\n", length); + DBG("ACPIpatcher: start finding cpu names. Length %d\n", length); for (i=0; i> 6); @@ -186,7 +186,7 @@ if (!aml_isvalidchar(c)) { add_name = false; - DBG("Invalid character found in ProcessorOP 0x%x!\n", c); + DBG("ACPIpatcher: invalid character found in ProcessorOP '0x%X'!\n", c); break; } } @@ -202,7 +202,7 @@ acpi_cpu_p_blk = dsdt[i] | (dsdt[i+1] << 8); } - DBG("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]); + DBG("ACPIpatcher: found ACPI CPU [%c%c%c%c]\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]); if (++acpi_cpu_count == 32) { @@ -212,12 +212,12 @@ } } - DBG("End finding cpu names: cpu names found: %d\n", acpi_cpu_count); + DBG("ACPIpatcher: finished finding cpu names. Found: %d.\n", acpi_cpu_count); } struct acpi_2_fadt *patch_fadt(struct acpi_2_fadt *fadt, struct acpi_2_dsdt *new_dsdt) { - extern void setupSystemType(); + extern void setupSystemType(); struct acpi_2_fadt *fadt_mod = NULL; bool fadt_rev2_needed = false; @@ -253,14 +253,14 @@ // Allocate new fadt table if (fadt->Length < 0x84 && fadt_rev2_needed) { - fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(0x84); + fadt_mod = (struct acpi_2_fadt *)AllocateKernelMemory(0x84); memcpy(fadt_mod, fadt, fadt->Length); fadt_mod->Length = 0x84; fadt_mod->Revision = 0x02; // FADT rev 2 (ACPI 1.0B MS extensions) } else { - fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length); + fadt_mod = (struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length); memcpy(fadt_mod, fadt, fadt->Length); } // Determine system type / PM_Model @@ -511,7 +511,7 @@ int ssdt_count=0; // SSDT Options - bool drop_ssdt=false, generate_pstates=false, generate_cstates=false; + bool drop_ssdt = false, generate_pstates = false, generate_cstates = false; getBoolForKey(kDropSSDT, &drop_ssdt, &bootInfo->chameleonConfig); getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig); @@ -550,7 +550,7 @@ int rsdplength; // Find original rsdp - rsdp=(struct acpi_2_rsdp *)(version ? getAddressOfAcpi20Table() : getAddressOfAcpiTable()); + rsdp = (struct acpi_2_rsdp *)(version ? getAddressOfAcpi20Table() : getAddressOfAcpiTable()); if (!rsdp) { DBG("No ACPI version %d found. Ignoring\n", version+1); @@ -564,7 +564,7 @@ } continue; } - rsdplength=version ? rsdp->Length : 20; + rsdplength = version ? rsdp->Length : 20; DBG("RSDP version %d found @%x. Length=%d\n",version+1,rsdp,rsdplength); @@ -573,26 +573,26 @@ * For more info see ACPI Specification pages 110 and following */ - rsdp_mod=(struct acpi_2_rsdp *) AllocateKernelMemory(rsdplength); + rsdp_mod = (struct acpi_2_rsdp *) AllocateKernelMemory(rsdplength); memcpy(rsdp_mod, rsdp, rsdplength); - rsdt=(struct acpi_2_rsdt *)(rsdp->RsdtAddress); + rsdt = (struct acpi_2_rsdt *)rsdp->RsdtAddress; DBG("RSDT @%x, Length %d\n",rsdt, rsdt ? rsdt->Length : 0); - - if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000) + + if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length < 0x10000) { uint32_t *rsdt_entries; int rsdt_entries_num; int dropoffset=0, i; // mozo: using malloc cos I didn't found how to free already allocated kernel memory - rsdt_mod=(struct acpi_2_rsdt *)malloc(rsdt->Length); - memcpy (rsdt_mod, rsdt, rsdt->Length); - rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod; - rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4; - rsdt_entries=(uint32_t *)(rsdt_mod+1); - for (i=0;iLength); + memcpy(rsdt_mod, rsdt, rsdt->Length); + rsdp_mod->RsdtAddress = (uint32_t)rsdt_mod; + rsdt_entries_num = (rsdt_mod->Length - sizeof(struct acpi_2_rsdt)) / 4; + rsdt_entries = (uint32_t *)(rsdt_mod + 1); + for (i = 0;i < rsdt_entries_num;i++) { char *table=(char *)(rsdt_entries[i]); if (!table) @@ -616,7 +616,7 @@ DBG("OEM HPET table was dropped\n"); dropoffset++; continue; - } + } if (drop_slic && tableSign(table, "SLIC")) { @@ -756,7 +756,7 @@ } fadt_mod = patch_fadt(fadt, new_dsdt); - rsdt_entries[i-dropoffset]=(uint32_t)fadt_mod; + rsdt_entries[i-dropoffset] = (uint32_t)fadt_mod; // Generate _CST SSDT if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod))) @@ -781,11 +781,12 @@ // Allocate rsdt in Kernel memory area rsdt_mod->Length += 4*ssdt_count - 4*dropoffset; struct acpi_2_rsdt *rsdt_copy = (struct acpi_2_rsdt *)AllocateKernelMemory(rsdt_mod->Length); - memcpy (rsdt_copy, rsdt_mod, rsdt_mod->Length); - free(rsdt_mod); rsdt_mod = rsdt_copy; - rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod; - rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4; - rsdt_entries=(uint32_t *)(rsdt_mod+1); + memcpy(rsdt_copy, rsdt_mod, rsdt_mod->Length); + free(rsdt_mod); + rsdt_mod = rsdt_copy; + rsdp_mod->RsdtAddress = (uint32_t)rsdt_mod; + rsdt_entries_num = (rsdt_mod->Length-sizeof(struct acpi_2_rsdt)) / 4; + rsdt_entries = (uint32_t *)(rsdt_mod + 1); // Mozodojo: Insert additional SSDTs into RSDT if(ssdt_count > 0) @@ -832,20 +833,20 @@ int dropoffset=0; // mozo: using malloc cos I didn't found how to free already allocated kernel memory - xsdt_mod=(struct acpi_2_xsdt*)malloc(xsdt->Length); + xsdt_mod=(struct acpi_2_xsdt*)malloc(xsdt->Length); memcpy(xsdt_mod, xsdt, xsdt->Length); - rsdp_mod->XsdtAddress=(uint32_t)xsdt_mod; - xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8; - xsdt_entries=(uint64_t *)(xsdt_mod+1); - for (i=0;iXsdtAddress = (uint32_t)xsdt_mod; + xsdt_entries_num = (xsdt_mod->Length - sizeof(struct acpi_2_xsdt)) / 8; + xsdt_entries = (uint64_t *)(xsdt_mod + 1); + for (i = 0;i < xsdt_entries_num;i++) { - char *table=(char *)((uint32_t)(xsdt_entries[i])); + char *table = (char *)((uint32_t)(xsdt_entries[i])); if (!table) { continue; } - xsdt_entries[i-dropoffset]=xsdt_entries[i]; + xsdt_entries[i - dropoffset] = xsdt_entries[i]; if (drop_ssdt && tableSign(table, "SSDT")) { @@ -1060,10 +1061,11 @@ xsdt_mod->Length += 8*ssdt_count - 8*dropoffset; struct acpi_2_xsdt *xsdt_copy = (struct acpi_2_xsdt *)AllocateKernelMemory(xsdt_mod->Length); memcpy(xsdt_copy, xsdt_mod, xsdt_mod->Length); - free(xsdt_mod); xsdt_mod = xsdt_copy; - rsdp_mod->XsdtAddress=(uint32_t)xsdt_mod; - xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8; - xsdt_entries=(uint64_t *)(xsdt_mod+1); + free(xsdt_mod); + xsdt_mod = xsdt_copy; + rsdp_mod->XsdtAddress = (uint32_t)xsdt_mod; + xsdt_entries_num = (xsdt_mod->Length - sizeof(struct acpi_2_xsdt)) / 8; + xsdt_entries = (uint64_t *)(xsdt_mod + 1); // Mozodojo: Insert additional SSDTs into XSDT if(ssdt_count > 0) Index: branches/ErmaC/Enoch/i386/libsaio/spd.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/spd.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/spd.c (revision 2542) @@ -69,6 +69,19 @@ #define SMBHSTDAT 5 #define SBMBLKDAT 7 +int spd_indexes[] = { + SPD_MEMORY_TYPE, + SPD_DDR3_MEMORY_BANK, + SPD_DDR3_MEMORY_CODE, + SPD_NUM_ROWS, + SPD_NUM_COLUMNS, + SPD_NUM_DIMM_BANKS, + SPD_NUM_BANKS_PER_SDRAM, + 4,7,8,9,12,64, /* TODO: give names to these values */ + 95,96,97,98, 122,123,124,125 /* UIS */ +}; +#define SPD_INDEXES_SIZE (sizeof(spd_indexes) / sizeof(int)) + /** Read one byte from the intel i2c, used for reading SPD on intel chipsets only. */ unsigned char smb_read_byte_intel(uint32_t base, uint8_t adr, uint8_t cmd) @@ -111,30 +124,18 @@ /* SPD i2c read optimization: prefetch only what we need, read non prefetcheable bytes on the fly */ #define READ_SPD(spd, base, slot, x) spd[x] = smb_read_byte_intel(base, 0x50 + slot, x) -int spd_indexes[] = { - SPD_MEMORY_TYPE, - SPD_DDR3_MEMORY_BANK, - SPD_DDR3_MEMORY_CODE, - SPD_NUM_ROWS, - SPD_NUM_COLUMNS, - SPD_NUM_DIMM_BANKS, - SPD_NUM_BANKS_PER_SDRAM, - 4,7,8,9,12,64, /* TODO: give names to these values */ - 95,96,97,98, 122,123,124,125 /* UIS */ -}; -#define SPD_INDEXES_SIZE (sizeof(spd_indexes) / sizeof(int)) - /** Read from spd *used* values only*/ static void init_spd(char * spd, uint32_t base, int slot) { int i; - for (i=0; i< SPD_INDEXES_SIZE; i++) { + for (i = 0; i < SPD_INDEXES_SIZE; i++) + { READ_SPD(spd, base, slot, spd_indexes[i]); } } -/** Get Vendor Name from spd, 2 cases handled DDR3 and DDR2, - have different formats, always return a valid ptr.*/ +// Get Vendor Name from spd, 2 cases handled DDR3 and DDR2, +// have different formats, always return a valid ptr. const char * getVendorName(RamSlotInfo_t* slot, uint32_t base, int slot_num) { uint8_t bank = 0; @@ -142,29 +143,41 @@ int i = 0; uint8_t * spd = (uint8_t *) slot->spd; - if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) - { // DDR3 + if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3 + { + bank = (spd[SPD_DDR3_MEMORY_BANK] & 0x07f); // constructors like Patriot use b7=1 code = spd[SPD_DDR3_MEMORY_CODE]; - for (i=0; i < VEN_MAP_SIZE; i++) { - if (bank==vendorMap[i].bank && code==vendorMap[i].code) { + for (i=0; i < VEN_MAP_SIZE; i++) + { + if (bank==vendorMap[i].bank && code==vendorMap[i].code) + { return vendorMap[i].name; } } - } else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { - if(spd[64]==0x7f) { - for (i=64; i<72 && spd[i]==0x7f;i++) { + } + else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) + { + if(spd[64]==0x7f) + { + for (i=64; i<72 && spd[i]==0x7f;i++) + { bank++; READ_SPD(spd, base, slot_num, (uint8_t)(i+1)); // prefetch next spd byte to read for next loop } READ_SPD(spd, base, slot_num,(uint8_t)i); code = spd[i]; - } else { - code = spd[64]; + } + else + { + code = spd[64]; bank = 0; } - for (i=0; i < VEN_MAP_SIZE; i++) { - if (bank==vendorMap[i].bank && code==vendorMap[i].code) { + + for (i=0; i < VEN_MAP_SIZE; i++) + { + if (bank==vendorMap[i].bank && code==vendorMap[i].code) + { return vendorMap[i].name; } } @@ -179,8 +192,10 @@ /* Get Default Memory Module Speed (no overclocking handled) */ int getDDRspeedMhz(const char * spd) { - if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { - switch(spd[12]) { + if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3) + { + switch(spd[12]) + { case 0x0f: return 1066; case 0x0c: @@ -191,8 +206,11 @@ default: return 800; } - } else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { - switch(spd[9]) { + } + else if ((spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR2) || (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR)) + { + switch(spd[9]) + { case 0x50: return 400; case 0x3d: @@ -215,44 +233,53 @@ /* Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */ const char *getDDRSerial(const char* spd) { - static char asciiSerial[16]; + static char asciiSerial[17]; - if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3 + if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3 { - snprintf(asciiSerial, sizeof(asciiSerial), "%X%X%X%X%X%X%X%X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125)); + snprintf(asciiSerial, sizeof(asciiSerial), "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125)); } - else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) // DDR2 or DDR + else if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR) // DDR2 or DDR { - snprintf(asciiSerial, sizeof(asciiSerial), "%X%X%X%X%X%X%X%X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98)); - } else { - sprintf(asciiSerial, "000000000000000"); + snprintf(asciiSerial, sizeof(asciiSerial), "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98)); } + else + { + sprintf(asciiSerial, "0000000000000000"); + } return strdup(asciiSerial); } /* Get DDR3 or DDR2 Part Number, always return a valid ptr */ -const char * getDDRPartNum(char* spd, uint32_t base, int slot) +const char *getDDRPartNum(char *spd, uint32_t base, int slot) { + int i, start = 0, index = 0; + char c; static char asciiPartNo[32]; - int i, start=0, index = 0; - if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { + if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3) + { start = 128; - } else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { + } + else if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR) + { start = 73; } // Check that the spd part name is zero terminated and that it is ascii: bzero(asciiPartNo, sizeof(asciiPartNo)); - char c; - for (i=start; i < start + sizeof(asciiPartNo); i++) { - READ_SPD(spd, base, slot, i); // only read once the corresponding model part (ddr3 or ddr2) + for (i = start; i < start + sizeof(asciiPartNo); i++) + { + READ_SPD(spd, base, slot, (uint8_t)i); // only read once the corresponding model part (ddr3 or ddr2) c = spd[i]; - if (isalpha(c) || isdigit(c) || ispunct(c)) { + if (isalpha(c) || isdigit(c) || ispunct(c)) + { // It seems that System Profiler likes only letters and digits... asciiPartNo[index++] = c; - } else if (!isascii(c)) { + } + else if (!isascii(c)) + { break; } } @@ -262,25 +289,27 @@ int mapping []= {0,2,1,3,4,6,5,7,8,10,9,11}; - /* Read from smbus the SPD content and interpret it for detecting memory attributes */ -static void read_smb_intel(pci_dt_t *smbus_dev) { - int i, speed; - uint8_t spd_size, spd_type; - uint32_t base, mmio, hostc; -// bool dump = false; - RamSlotInfo_t* slot; +static void read_smb_intel(pci_dt_t *smbus_dev) +{ + int i, speed; + uint8_t spd_size, spd_type; + uint32_t base, mmio, hostc; + uint16_t cmd; +// bool dump = false; + RamSlotInfo_t *slot; - uint16_t cmd = pci_config_read16(smbus_dev->dev.addr, 0x04); + cmd = pci_config_read16(smbus_dev->dev.addr, 0x04); DBG("SMBus CmdReg: 0x%x\n", cmd); pci_config_write16(smbus_dev->dev.addr, 0x04, cmd | 1); mmio = pci_config_read32(smbus_dev->dev.addr, 0x10);// & ~0x0f; base = pci_config_read16(smbus_dev->dev.addr, 0x20) & 0xFFFE; hostc = pci_config_read8(smbus_dev->dev.addr, 0x40); - verbose("Scanning SMBus [%04x:%04x], mmio: 0x%x, ioport: 0x%x, hostc: 0x%x\n", - smbus_dev->vendor_id, smbus_dev->device_id, mmio, base, hostc); + verbose("Scanning SMBus [%04x:%04x], mmio: 0x%x, ioport: 0x%x, hostc: 0x%x\n", + smbus_dev->vendor_id, smbus_dev->device_id, mmio, base, hostc); + //Azi: no use for this! // getBoolForKey("DumpSPD", &dump, &bootInfo->chameleonConfig); // needed at least for laptops @@ -288,13 +317,14 @@ char spdbuf[MAX_SPD_SIZE]; // Search MAX_RAM_SLOTS slots - for (i = 0; i < MAX_RAM_SLOTS; i++) { + for (i = 0; i < MAX_RAM_SLOTS; i++) + { slot = &Platform.RAM.DIMM[i]; spd_size = smb_read_byte_intel(base, 0x50 + i, 0); DBG("SPD[0] (size): %d @0x%x\n", spd_size, 0x50 + i); // Check spd is present - if (spd_size && (spd_size != 0xff)) { - + if (spd_size && (spd_size != 0xff)) + { slot->spd = spdbuf; slot->InUse = true; @@ -305,13 +335,14 @@ //for (x = 0; x < spd_size; x++) slot->spd[x] = smb_read_byte_intel(base, 0x50 + i, x); init_spd(slot->spd, base, i); - switch (slot->spd[SPD_MEMORY_TYPE]) { + switch (slot->spd[SPD_MEMORY_TYPE]) + { case SPD_MEMORY_TYPE_SDRAM_DDR: slot->ModuleSize = (((1 << ((slot->spd[SPD_NUM_ROWS] & 0x0f) - + (slot->spd[SPD_NUM_COLUMNS] & 0x0f) - 17)) * - ((slot->spd[SPD_NUM_DIMM_BANKS] & 0x7) + 1) * - slot->spd[SPD_NUM_BANKS_PER_SDRAM])/3)*2; + + (slot->spd[SPD_NUM_COLUMNS] & 0x0f) - 17)) * + ((slot->spd[SPD_NUM_DIMM_BANKS] & 0x7) + 1) * + slot->spd[SPD_NUM_BANKS_PER_SDRAM])/3)*2; break; case SPD_MEMORY_TYPE_SDRAM_DDR2: @@ -327,11 +358,17 @@ slot->ModuleSize = ((1 << slot->ModuleSize) * (((slot->spd[7] >> 3) & 0x1f) + 1)); break; + + default: + slot->ModuleSize = 0; + break; + } spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((char) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0); slot->Type = spd_mem_to_smbios[spd_type]; - if (slot->Type == UNKNOWN_MEM_TYPE) { + if (slot->Type == UNKNOWN_MEM_TYPE) + { continue; } slot->PartNo = getDDRPartNum(slot->spd, base, i); @@ -339,17 +376,20 @@ slot->SerialNo = getDDRSerial(slot->spd); // determine spd speed - speed = getDDRspeedMhz(slot->spd); - if (slot->Frequency < speed) { + speed = (uint16_t)getDDRspeedMhz(slot->spd); + if (slot->Frequency < speed) + { slot->Frequency = speed; } // pci memory controller if available, is more reliable - if (Platform.RAM.Frequency > 0) { + if (Platform.RAM.Frequency > 0) + { uint32_t freq = (uint32_t)Platform.RAM.Frequency / 500000; // now round off special cases uint32_t fmod100 = freq %100; - switch(fmod100) { + switch(fmod100) + { case 1: freq--; break; case 32: freq++; break; case 65: freq++; break; @@ -359,22 +399,22 @@ slot->Frequency = freq; } - verbose("Slot: %d Type %d %dMB (%s) %dMHz Vendor=%s\n PartNo=%s SerialNo=%s\n", - i, - (int)slot->Type, - slot->ModuleSize, - spd_memory_types[spd_type], - slot->Frequency, - slot->Vendor, - slot->PartNo, - slot->SerialNo); - slot->InUse = true; + verbose("Slot: %d Type %d %dMB (%s) %dMHz Vendor=%s\n PartNo=%s SerialNo=%s\n", + i, + (int)slot->Type, + slot->ModuleSize, + spd_memory_types[spd_type], + slot->Frequency, + slot->Vendor, + slot->PartNo, + slot->SerialNo); + slot->InUse = true; } // laptops sometimes show slot 0 and 2 with slot 1 empty when only 2 slots are presents so: Platform.DMI.DIMM[i]= - (uint32_t)((i>0 && Platform.RAM.DIMM[1].InUse==false && fullBanks && Platform.DMI.CntMemorySlots == 2) ? - mapping[i] : i); // for laptops case, mapping setup would need to be more generic than this + (uint32_t)((i > 0 && Platform.RAM.DIMM[1].InUse == false && fullBanks && Platform.DMI.CntMemorySlots == 2) ? mapping[i] : i); // for laptops case, mapping setup would need to be more generic than this + slot->spd = NULL; } // for @@ -420,15 +460,18 @@ pci_dt_t *current = pci_dt; int i; - while (current) { + while (current) + { #if 0 printf("%02x:%02x.%x [%04x] [%04x:%04x] :: %s\n", current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func, current->class_id, current->vendor_id, current->device_id, get_pci_dev_path(current)); #endif - for ( i = 0; i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ ) { - if (current->vendor_id == smbus_controllers[i].vendor && current->device_id == smbus_controllers[i].device) { + for ( i = 0; i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ ) + { + if (current->vendor_id == smbus_controllers[i].vendor && current->device_id == smbus_controllers[i].device) + { smbus_controllers[i].read_smb(current); // read smb return true; } Index: branches/ErmaC/Enoch/i386/libsaio/gma.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/gma.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/gma.c (revision 2542) @@ -396,7 +396,7 @@ struct DevPropDevice *device = devprop_add_device(string, devicepath); if (!device) { - printf("Failed initializing dev-prop string dev-entry.\n"); + printf("[setup_gma_devprop] Failed initializing dev-prop string dev-entry!\n"); pause(); return false; } @@ -716,7 +716,7 @@ stringdata = malloc(sizeof(uint8_t) * string->length); if (!stringdata) { - printf("No stringdata.\n"); + printf("[setup_gma_devprop] No stringdata!\n"); pause(); return false; } Index: branches/ErmaC/Enoch/i386/libsaio/pci_root.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/pci_root.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/pci_root.c (revision 2542) @@ -53,24 +53,40 @@ 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->chameleonConfig)) { - if (isdigit(val[0])) rootuid = val[0] - '0'; + if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->chameleonConfig)) + { + if (isdigit(val[0])) + { + rootuid = val[0] - '0'; + } + goto out; } /* Chameleon compatibility */ - else if (getValueForKey("PciRoot", &val, &len, &bootInfo->chameleonConfig)) { - if (isdigit(val[0])) rootuid = val[0] - '0'; + else if (getValueForKey("PciRoot", &val, &len, &bootInfo->chameleonConfig)) + { + if (isdigit(val[0])) + { + rootuid = val[0] - '0'; + } + goto out; } /* PCEFI compatibility */ - else if (getValueForKey("-pci0", &val, &len, &bootInfo->chameleonConfig)) { + else if (getValueForKey("-pci0", &val, &len, &bootInfo->chameleonConfig)) + { rootuid = 0; goto out; } - else if (getValueForKey("-pci1", &val, &len, &bootInfo->chameleonConfig)) { + else if (getValueForKey("-pci1", &val, &len, &bootInfo->chameleonConfig)) + { rootuid = 1; goto out; } @@ -84,25 +100,27 @@ { sprintf(dsdt_dirSpec, "DSDT.aml"); } - + int fd = search_and_get_acpi_fd(dsdt_dirSpec, &dsdt_filename); // Check booting partition if (fd<0) { - verbose("No DSDT found, using 0 as uid value.\n"); - rootuid = 0; - goto out; + verbose("No DSDT found, using 0 as uid value.\n"); + rootuid = 0; + goto out; } - + fsize = file_size(fd); - if (!(new_dsdt = malloc(fsize))) { + if (!(new_dsdt = malloc(fsize))) + { verbose("[ERROR] alloc DSDT memory failed\n"); close (fd); goto out; } - if (read (fd, new_dsdt, fsize) != fsize) { + if (read (fd, new_dsdt, fsize) != fsize) + { verbose("[ERROR] read %s failed\n", dsdt_filename); free(new_dsdt); close (fd); @@ -114,7 +132,10 @@ free(new_dsdt); // make sure it really works: - if (rootuid == 11) rootuid=0; //usually when _UID isnt present, it means uid is zero + 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"); Index: branches/ErmaC/Enoch/i386/libsaio/device_inject.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/device_inject.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/device_inject.c (revision 2542) @@ -23,10 +23,10 @@ #define DBG(x...) msglog(x) #endif -uint32_t devices_number = 1; -DevPropString *string = NULL; -uint8_t *stringdata = NULL; -uint32_t stringlength = 0; +uint32_t devices_number = 1; +DevPropString *string = NULL; +uint8_t *stringdata = NULL; +uint32_t stringlength = 0; char *efi_inject_get_devprop_string(uint32_t *len) { @@ -54,24 +54,29 @@ /* Use the static "device-properties" boot config key contents if available, * otheriwse use the generated one. */ - if (!getValueForKey(kDeviceProperties, &val, &cnt, &bootInfo->chameleonConfig) && string) { + if (!getValueForKey(kDeviceProperties, &val, &cnt, &bootInfo->chameleonConfig) && string) + { val = (const char*)string; cnt = strlength * 2; } - if (cnt > 1) { + if (cnt > 1) + { binStr = convertHexStr2Binary(val, &cnt2); - if (cnt2 > 0) { + if (cnt2 > 0) + { DT__AddProperty(node, DEVICE_PROPERTIES_PROP, cnt2, binStr); + DBG("Adding device-properties string to DT"); } } } DevPropString *devprop_create_string(void) { - string = (struct DevPropString*)malloc(sizeof(struct DevPropString)); + string = (struct DevPropString *)malloc(sizeof(struct DevPropString)); - if(string == NULL) { + if(string == NULL) + { return NULL; } @@ -83,20 +88,24 @@ DevPropDevice *devprop_add_device(DevPropString *string, char *path) { - DevPropDevice *device = NULL; - const char pciroot_string[] = "PciRoot(0x"; - const char pci_device_string[] = "Pci(0x"; + DevPropDevice *device = NULL; + const char pciroot_string[] = "PciRoot(0x"; + const char pci_device_string[] = "Pci(0x"; - if (string == NULL || path == NULL) { + if (string == NULL || path == NULL) + { printf("ERROR null device path\n"); return NULL; } - if (strncmp(path, pciroot_string, strlen(pciroot_string))) { + if (strncmp(path, pciroot_string, strlen(pciroot_string))) + { printf("ERROR parsing device path\n"); return NULL; } - if (!(device = malloc(sizeof(DevPropDevice)))) { + + if (!(device = malloc(sizeof(DevPropDevice)))) + { printf("ERROR malloc failed\n"); return NULL; } @@ -108,16 +117,23 @@ int x, curr = 0; char buff[] = "00"; - for (x = 0; x < strlen(path); x++) { - if (!strncmp(&path[x], pci_device_string, strlen(pci_device_string))) { + for (x = 0; x < strlen(path); x++) + { + if (!strncmp(&path[x], pci_device_string, strlen(pci_device_string))) + { x+=strlen(pci_device_string); curr=x; while(path[++x] != ','); - if(x-curr == 2) { + if(x-curr == 2) + { sprintf(buff, "%c%c", path[curr], path[curr+1]); - } else if(x-curr == 1) { + } + else if(x-curr == 1) + { sprintf(buff, "%c", path[curr]); - } else { + } + else + { printf("ERROR parsing device path\n"); numpaths = 0; break; @@ -127,11 +143,16 @@ x += 3; // 0x curr = x; while(path[++x] != ')'); - if(x-curr == 2) { + if(x-curr == 2) + { sprintf(buff, "%c%c", path[curr], path[curr+1]); - } else if(x-curr == 1) { + } + else if(x-curr == 1) + { sprintf(buff, "%c", path[curr]); - } else { + } + else + { printf("ERROR parsing device path\n"); numpaths = 0; break; @@ -142,24 +163,26 @@ } } - if(!numpaths) { + if(!numpaths) + { free(device); return NULL; } device->numentries = 0x00; - device->acpi_dev_path.length = 0x0c; - device->acpi_dev_path.type = 0x02; - device->acpi_dev_path.subtype = 0x01; - device->acpi_dev_path._HID = 0xd041030a; + device->acpi_dev_path.length = 0x0c; + device->acpi_dev_path.type = 0x02; + device->acpi_dev_path.subtype = 0x01; + device->acpi_dev_path._HID = 0xd041030a; device->num_pci_devpaths = numpaths; device->length = 24 + (6*numpaths); int i; - for(i = 0; i < numpaths; i++) { + for(i = 0; i < numpaths; i++) + { device->pci_dev_path[i].length = 0x06; device->pci_dev_path[i].type = 0x01; device->pci_dev_path[i].subtype = 0x01; @@ -172,8 +195,10 @@ device->string = string; device->data = NULL; - if(!string->entries) { - if (!(string->entries = (struct DevPropDevice**) malloc(sizeof(device) * DEV_PROP_DEVICE_MAX_ENTRIES))) { + if(!string->entries) + { + if (!(string->entries = (struct DevPropDevice**) malloc(sizeof(device) * DEV_PROP_DEVICE_MAX_ENTRIES))) + { free(device); return NULL; } @@ -190,24 +215,27 @@ int devprop_add_value(DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len) { - if(!nm || !vl || !len) { + if(!nm || !vl || !len) + { return 0; } - uint32_t length = ((strlen(nm) * 2) + len + (2 * sizeof(uint32_t)) + 2); - uint8_t *data = (uint8_t*)malloc(length); + uint32_t length = ((strlen(nm) * 2) + len + (2 * sizeof(uint32_t)) + 2); + uint8_t *data = (uint8_t*)malloc(length); - if(!data) { + if(!data) + { return 0; } memset(data, 0, length); - uint32_t off= 0; + uint32_t off = 0; data[off+1] = ((strlen(nm) * 2) + 6) >> 8; data[off] = ((strlen(nm) * 2) + 6) & 0x00FF; off += 4; uint32_t i=0, l = strlen(nm); - for(i = 0 ; i < l ; i++, off += 2) { + for(i = 0 ; i < l ; i++, off += 2) + { data[off] = *nm++; } @@ -216,31 +244,39 @@ uint32_t *datalength = (uint32_t*)&data[off]; *datalength = (uint32_t)(l + 4); off += 4; - for(i = 0 ; i < l ; i++, off++) { + for(i = 0 ; i < l ; i++, off++) + { data[off] = *vl++; } uint32_t offset = device->length - (24 + (6 * device->num_pci_devpaths)); uint8_t *newdata = (uint8_t*)malloc((length + offset)); - if(!newdata) { + if(!newdata) + { return 0; } - if(device->data) { - if(offset > 1) { + + if(device->data) + { + if(offset > 1) + { memcpy(newdata, device->data, offset); } } memcpy(newdata + offset, data, length); - + device->length += length; device->string->length += length; device->numentries++; - if(!device->data) { + if(!device->data) + { device->data = (uint8_t*)malloc(sizeof(uint8_t)); - } else { + } + else + { free(device->data); } @@ -343,9 +379,12 @@ } int i; - for(i = 0; i < string->numentries; i++) { - if(string->entries[i]) { - if(string->entries[i]->data) { + for(i = 0; i < string->numentries; i++) + { + if(string->entries[i]) + { + if(string->entries[i]->data) + { free(string->entries[i]->data); string->entries[i]->data = NULL; } @@ -371,7 +410,8 @@ int i; char buf[3]; - if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) { + if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) + { printf("[ERROR] bin2hex input error\n"); return -1; } @@ -379,8 +419,10 @@ buf[2] = '\0'; p = (char *) hex; - for (i = 0; i < len; i++) { - if (p[0] == '\0' || p[1] == '\0' || !isxdigit(p[0]) || !isxdigit(p[1])) { + for (i = 0; i < len; i++) + { + if (p[0] == '\0' || p[1] == '\0' || !isxdigit(p[0]) || !isxdigit(p[1])) + { printf("[ERROR] bin2hex '%s' syntax error\n", hex); return -2; } Index: branches/ErmaC/Enoch/i386/libsaio/fdisk.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/fdisk.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/fdisk.h (revision 2542) @@ -41,22 +41,30 @@ #define DISK_SIGNATURE 0xAA55 /* signature of the boot record */ #define FDISK_NPART 4 /* number of entries in fdisk table */ #define FDISK_ACTIVE 0x80 /* indicator of active partition */ -#define FDISK_NEXTNAME 0xA7 /* indicator of NeXT partition */ + + #define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ #define FDISK_DOS16S 0x04 /* 16-bit fat < 32MB dos partition */ #define FDISK_DOSEXT 0x05 /* extended DOS partition */ #define FDISK_DOS16B 0x06 /* 16-bit fat >= 32MB dos partition */ #define FDISK_NTFS 0x07 /* NTFS partition */ -#define FDISK_SMALLFAT32 0x0b /* FAT32 partition */ -#define FDISK_FAT32 0x0c /* FAT32 partition */ -#define FDISK_DOS16SLBA 0x0e /* 16-bit FAT, LBA-mapped */ +#define FDISK_SMALLFAT32 0x0B /* DOS FAT32 partition */ +#define FDISK_FAT32 0x0C /* Win FAT32 partition */ +#define FDISK_DOS16SLBA 0x0E /* Win 16-bit FAT, LBA-mapped */ +#define FDISK_WIN_LDM 0x42 /* NTFS partition */ +#define FDISK_LINUX_SWAP 0x82 /* Linux swap */ #define FDISK_LINUX 0x83 /* Linux native */ -#define FDISK_OPENBSD 0xa6 /* OpenBSD FFS partition */ -#define FDISK_FREEBSD 0xa5 /* FreeBSD UFS2 partition */ -#define FDISK_BEFS 0xeb /* Haiku BeFS partition */ -#define FDISK_UFS 0xa8 /* Apple UFS partition */ -#define FDISK_HFS 0xaf /* Apple HFS partition */ -#define FDISK_BOOTER 0xab /* Apple booter partition */ +#define FDISK_LINUX_LVM 0x8E /* Linux LVM */ +#define FDISK_FREEBSD 0xA5 /* FreeBSD UFS2 partition */ +#define FDISK_OPENBSD 0xA6 /* OpenBSD FFS partition */ +#define FDISK_NEXTNAME 0xA7 /* Indicator of NeXT partition */ +#define FDISK_UFS 0xA8 /* Apple UFS partition */ +#define FDISK_NETBSD 0xA9 /* NetBSD disk label */ +#define FDISK_BOOTER 0xAB /* Apple booter partition */ +#define FDISK_ENCRYPTED 0xAE /* Apple encrypted */ +#define FDISK_HFS 0xAF /* Apple HFS partition */ +#define FDISK_BEFS 0xEB /* Haiku BeFS partition */ +#define FDISK_LINUX_RAID 0xFD /* Linux RAID */ #define FDISK_PSEUDO_EXFAT 0x107 /* Shared with FDISK_NTFS */ /* Index: branches/ErmaC/Enoch/i386/libsaio/ntfs.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/ntfs.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/ntfs.c (revision 2542) @@ -31,7 +31,7 @@ */ #include "exfat.h" -#define BYTE_ORDER_MARK 0xFEFF +#define BYTE_ORDER_MARK 0xFEFF #include "ntfs_private.h" @@ -41,14 +41,14 @@ #define MAX_BLOCK_SIZE 2048 #define MAX_CLUSTER_SIZE 32768 -#define LABEL_LENGTH 1024 -#define UNKNOWN_LABEL "Untitled NTFS" +#define LABEL_LENGTH 1024 +#define UNKNOWN_LABEL "Untitled NTFS" -#define FSUR_IO_FAIL -1 -#define FSUR_UNRECOGNIZED -1 -#define FSUR_RECOGNIZED 0 +#define FSUR_IO_FAIL -1 +#define FSUR_UNRECOGNIZED -1 +#define FSUR_RECOGNIZED 0 -#define ERROR -1 +#define ERROR -1 /* * Process per-sector "fixups" that NTFS uses to detect corruption of @@ -347,11 +347,11 @@ return 0; } -bool NTFSProbe(const void * buffer) +bool NTFSProbe(const void *buffer) { bool result = false; - const struct bootfile * part_bootfile = buffer; // NTFS boot sector structure + const struct bootfile *part_bootfile = buffer; // NTFS boot sector structure // Looking for NTFS signature. if (strncmp((const char *)part_bootfile->bf_sysid, NTFS_BBID, NTFS_BBIDLEN) == 0) Index: branches/ErmaC/Enoch/i386/libsaio/sys.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2542) @@ -85,7 +85,7 @@ struct devsw { - const char * name; + const char *name; // size increased from char to short to handle non-BIOS internal devices unsigned short biosdev; int type; @@ -386,12 +386,12 @@ // GetFileInfo - LOW-LEVEL FILESYSTEM FUNCTION. // Get attributes for the specified file. -static char* gMakeDirSpec; +static char *gMakeDirSpec; -long GetFileInfo(const char * dirSpec, const char * name, long * flags, u_int32_t * time) +long GetFileInfo(const char *dirSpec, const char *name, long *flags, u_int32_t *time) { long long index = 0; - const char * entryName; + const char *entryName; if (gMakeDirSpec == 0) { @@ -499,10 +499,10 @@ //========================================================================== // openmem() -int openmem(char * buf, int len) +int openmem(char *buf, int len) { int fdesc; - struct iob * io; + struct iob *io; fdesc = GetFreeFd(); io = &iob[fdesc]; @@ -823,16 +823,16 @@ //========================================================================== -struct dirstuff * opendir(const char * path) +struct dirstuff *opendir(const char *path) { - struct dirstuff * dirp = 0; - const char * dirPath; - BVRef bvr; + struct dirstuff *dirp = 0; + const char *dirPath; + BVRef bvr; if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL) goto error; - dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); + dirp = (struct dirstuff *)malloc(sizeof(struct dirstuff)); if (dirp == NULL) goto error; @@ -949,7 +949,7 @@ //========================================================================== -BVRef selectBootVolume( BVRef chain ) +BVRef selectBootVolume(BVRef chain) { bool filteredChain = false; bool foundPrimary = false; @@ -968,7 +968,8 @@ { break; } - if ( bvr->part_no == multiboot_partition && bvr->biosdev == gBIOSDev ) + + if ( (bvr->part_no == multiboot_partition) && (bvr->biosdev == gBIOSDev) ) { return bvr; } @@ -989,6 +990,7 @@ { break; } + if (matchVolumeToString(bvr, val, false)) { free(val); @@ -999,7 +1001,7 @@ } /* - * Scannig the volume chain backwards and trying to find + * Scannig the volume chain backwards and trying to find * a HFS+ volume with valid boot record signature. * If not found any active partition then we will * select this volume as the boot volume. @@ -1019,26 +1021,26 @@ } } - if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) + if ( (bvr->flags & kBVFlagPrimary) && (bvr->biosdev == gBIOSDev) ) { foundPrimary = true; } // zhell -- Undo a regression that was introduced from r491 to 492. // if gBIOSBootVolume is set already, no change is required - if ( bvr->flags & (kBVFlagBootable|kBVFlagSystemVolume) + if ( (bvr->flags & (kBVFlagBootable | kBVFlagSystemVolume)) && gBIOSBootVolume && (!filteredChain || (filteredChain && bvr->visible)) - && bvr->biosdev == gBIOSDev ) + && (bvr->biosdev == gBIOSDev) ) { bvr2 = bvr; } // zhell -- if gBIOSBootVolume is NOT set, we use the "if" statement // from r491, - if ( bvr->flags & kBVFlagBootable - && ! gBIOSBootVolume - && bvr->biosdev == gBIOSDev ) + if ( (bvr->flags & kBVFlagBootable) + && !gBIOSBootVolume + && (bvr->biosdev == gBIOSDev) ) { bvr2 = bvr; } @@ -1055,11 +1057,12 @@ { break; } - if ( bvr->flags & kBVFlagNativeBoot && bvr->biosdev == gBIOSDev ) + + if ( (bvr->flags & kBVFlagNativeBoot) && (bvr->biosdev == gBIOSDev) ) { bvr1 = bvr; } - if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) + if ( (bvr->flags & kBVFlagPrimary) && (bvr->biosdev == gBIOSDev) ) { bvr2 = bvr; } @@ -1120,7 +1123,7 @@ is changed to the selected volume unless the volume selector is that of a ramdisk. */ -BVRef getBootVolumeRef( const char * path, const char ** outPath ) +BVRef getBootVolumeRef(const char *path, const char **outPath) { const char *cp; BVRef bvr = gRootVolume; @@ -1148,8 +1151,8 @@ } else if ((cp - path) == 2) // found "xx(" { - const struct devsw * dp; - const char * xp = path; + const struct devsw *dp; + const char *xp = path; int i; int unit = -1; Index: branches/ErmaC/Enoch/i386/libsaio/acpi.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/acpi.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/acpi.h (revision 2542) @@ -22,11 +22,13 @@ // TODO Migrate struct acpi_2_rsdp { + // 1.0 char Signature[8]; uint8_t Checksum; char OEMID[6]; uint8_t Revision; uint32_t RsdtAddress; + // 2.0 uint32_t Length; uint64_t XsdtAddress; uint8_t ExtendedChecksum; @@ -141,6 +143,7 @@ /* Begin Asere */ //Reset Fix uint32_t Flags; + // Reset Register uint8_t Reset_SpaceID; uint8_t Reset_BitWidth; uint8_t Reset_BitOffset; Index: branches/ErmaC/Enoch/i386/libsaio/cpu.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/cpu.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/cpu.c (revision 2542) @@ -152,8 +152,8 @@ lastValue = timerValue; } while (timerValue > 5); printf("timerValue %d\n",timerValue); - printf("intermediate 0x%016llx\n",intermediate); - printf("saveTime 0x%016llx\n",saveTime); + printf("intermediate 0x%016llX\n",intermediate); + printf("saveTime 0x%016llX\n",saveTime); intermediate -= saveTime; // raw count for about 1/20 second intermediate *= scale[timerValue]; // rescale measured time spent Index: branches/ErmaC/Enoch/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2542) @@ -89,6 +89,7 @@ #define UFS_FRONT_PORCH 0 #define kAPMSector 2 /* Sector number of Apple partition map */ #define kAPMCDSector 8 /* Translated sector of Apple partition map on a CD */ +#define ECC_CORRECTED_ERR 0x11 /* * IORound and IOTrunc convenience functions, in the spirit @@ -100,7 +101,25 @@ #define IOTrunc(value,multiple) \ (((value) / (multiple)) * (multiple)); +//========================================================================== +// Maps (E)BIOS return codes to message strings. + +struct NamedValue { + unsigned char value; + const char *name; +}; + /* + * Map a disk drive to bootable volumes contained within. + */ +struct DiskBVMap { + int biosdev; // BIOS device number (unique) + BVRef bvr; // chain of boot volumes on the disk + int bvrcnt; // number of boot volumes + struct DiskBVMap *next; // linkage to next mapping +}; + +/* * trackbuf points to the start of the track cache. Biosread() * will store the sectors read from disk to this memory area. * @@ -110,19 +129,9 @@ static char * const trackbuf = (char *) ptov(BIOS_ADDR); static char * biosbuf; -/* - * Map a disk drive to bootable volumes contained within. - */ -struct DiskBVMap { - int biosdev; // BIOS device number (unique) - BVRef bvr; // chain of boot volumes on the disk - int bvrcnt; // number of boot volumes - struct DiskBVMap * next; // linkage to next mapping -}; +static struct DiskBVMap *gDiskBVMap = NULL; +static struct disk_blk0 *gBootSector = NULL; -static struct DiskBVMap * gDiskBVMap = NULL; -static struct disk_blk0 * gBootSector = NULL; - // Function pointers to be filled in if ramdisks are available: int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno, unsigned int byteoff, @@ -130,7 +139,48 @@ int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip) = NULL; static bool getOSVersion(BVRef bvr, char *str); +static bool cache_valid = false; +static const struct NamedValue bios_errors[] = +{ + { 0x10, "Media error" }, + { 0x11, "Corrected ECC error" }, + { 0x20, "Controller or device error" }, + { 0x40, "Seek failed" }, + { 0x80, "Device timeout" }, + { 0xAA, "Drive not ready" }, + { 0x00, NULL } +}; + +static const struct NamedValue fdiskTypes[] = +{ + { FDISK_DOS12, "DOS_FAT_12" }, // 0x01 + { FDISK_DOS16S, "DOS_FAT_16_S" }, // 0x04 + { FDISK_DOS16B, "DOS_FAT_16" }, // 0x06 + { FDISK_NTFS, "Windows NTFS" }, // 0x07 + { FDISK_SMALLFAT32, "DOS_FAT_32" }, // 0x0B + { FDISK_FAT32, "Windows FAT_32" }, // 0x0C + { FDISK_DOS16SLBA, "Windows FAT_16" }, // 0x0E + { FDISK_WIN_LDM, "Windows_LDM" }, // 0x42 + { FDISK_LINUX_SWAP, "Linux_Swap" }, // 0x82 + { FDISK_LINUX, "Linux" }, // 0x83 + { FDISK_LINUX_LVM, "Linux_LVM" }, // 0x8E + { FDISK_FREEBSD, "FreeBSD" }, // 0xA5 + { FDISK_OPENBSD, "OpenBSD" }, // 0xA6 + { FDISK_NEXTNAME, "Apple_Rhapsody_UFS" }, // 0xA7 + { FDISK_UFS, "Apple UFS" }, // 0xA8 + { FDISK_NETBSD, "NetBSD" }, // 0xA9 + { FDISK_BOOTER, "Apple_Boot" }, // 0xAB + { FDISK_ENCRYPTED, "Apple_Encrypted" }, // 0xAE + { FDISK_HFS, "Apple HFS" }, // 0xAF + { 0xCD, "CD-ROM" }, // 0xCD + { FDISK_BEFS, "Haiku" }, // 0xEB + { FDISK_LINUX_RAID, "Linux_RAID" }, // 0xFD + { 0x00, NULL } /* must be last */ +}; + +//============================================================================== + extern void spinActivityIndicator(int sectors); //========================================================================== @@ -182,19 +232,11 @@ } //========================================================================== -// Maps (E)BIOS return codes to message strings. -struct NamedValue { - unsigned char value; - const char * name; -}; - -//========================================================================== - static const char * getNameForValue( const struct NamedValue * nameTable, unsigned char value ) { - const struct NamedValue * np; + const struct NamedValue *np; for ( np = nameTable; np->value; np++) { @@ -207,20 +249,6 @@ return NULL; } -#define ECC_CORRECTED_ERR 0x11 - -static const struct NamedValue bios_errors[] = -{ - { 0x10, "Media error" }, - { 0x11, "Corrected ECC error" }, - { 0x20, "Controller or device error" }, - { 0x40, "Seek failed" }, - { 0x80, "Device timeout" }, - { 0xAA, "Drive not ready" }, - { 0x00, 0 } -}; - - //============================================================================== static const char * bios_error(int errnum) @@ -247,8 +275,6 @@ // Return: // 0 on success, or an error code from INT13/F2 or INT13/F42 BIOS call. -static bool cache_valid = false; - static int Biosread( int biosdev, unsigned long long secno ) { static int xbiosdev, xcyl, xhead; @@ -366,7 +392,6 @@ return rc; } - //============================================================================== int testBiosread(int biosdev, unsigned long long secno) @@ -388,7 +413,7 @@ int error; int copy_len; - DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__, biosdev, blkno, byteCount, (unsigned)cbuf)); + DEBUG_DISK(("%s: dev %X block %X [%d] -> 0x%X...", __FUNCTION__, biosdev, blkno, byteCount, (unsigned)cbuf)); for (; byteCount; cbuf += copy_len, blkno++) { @@ -414,7 +439,7 @@ //============================================================================== -static int isExtendedFDiskPartition( const struct fdisk_part * part ) +static int isExtendedFDiskPartition( const struct fdisk_part *part ) { static unsigned char extParts[] = { @@ -437,16 +462,15 @@ //============================================================================== -static int getNextFDiskPartition( int biosdev, int * partno, - const struct fdisk_part ** outPart ) +static int getNextFDiskPartition( int biosdev, int *partno, const struct fdisk_part **outPart ) { static int sBiosdev = -1; static int sNextPartNo; static unsigned int sFirstBase; static unsigned int sExtBase; static unsigned int sExtDepth; - static struct fdisk_part * sExtPart; - struct fdisk_part * part; + static struct fdisk_part *sExtPart; + struct fdisk_part *part; if ( sBiosdev != biosdev || *partno < 0 ) { @@ -529,9 +553,104 @@ //============================================================================== -static BVRef newFDiskBVRef( int biosdev, int partno, unsigned int blkoff, - const struct fdisk_part * part, - FSInit initFunc, FSLoadFile loadFunc, +/* + * Trying to figure out the filsystem type of a given partition. + * X = fdisk partition type + * 0 = Unknown/Unused + * -1 = error + */ +static int probeFileSystem(int biosdev, unsigned int blkoff) +{ + // detected filesystem type; + int result = -1; + int fatbits = 0; + + // Allocating buffer for 4 sectors. + const void *probeBuffer = malloc(PROBEFS_SIZE); + if (probeBuffer == NULL) + { + goto exit; + } + + // Reading first 4 sectors of current partition + int error = readBytes(biosdev, blkoff, 0, PROBEFS_SIZE, (void *)probeBuffer); + + if (error) + { + goto exit; + } + + if (HFSProbe(probeBuffer)) + { + result = FDISK_HFS; + } + else if (EX2Probe(probeBuffer)) + { + result = FDISK_LINUX; + } + else if (FreeBSDProbe(probeBuffer)) + { + result = FDISK_FREEBSD; + } + else if (OpenBSDProbe(probeBuffer)) + { + result = FDISK_OPENBSD; + } + else if (BeFSProbe(probeBuffer)) + { + result = FDISK_BEFS; + } + else if (NTFSProbe(probeBuffer)) + { + result = FDISK_NTFS; + } + + else if (EXFATProbe(probeBuffer)) + { + result = FDISK_PSEUDO_EXFAT; + } + + else if ((fatbits = MSDOSProbe(probeBuffer))) + { + switch (fatbits) + { + case 12: + result = FDISK_DOS12; + break; + + case 16: + result = FDISK_DOS16B; + break; + + case 32: + default: + result = FDISK_FAT32; + break; + } + } + else + { + // Couldn't detect filesystem type + result = 0; + } + +exit: + if (probeBuffer) + { + free((void *)probeBuffer); + } + + return result; +} + +//============================================================================== + +static BVRef newFDiskBVRef( int biosdev, + int partno, + unsigned int blkoff, + const struct fdisk_part *part, + FSInit initFunc, + FSLoadFile loadFunc, FSReadFile readFunc, FSGetDirEntry getdirFunc, FSGetFileBlock getBlockFunc, @@ -540,7 +659,7 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); + BVRef bvr = (BVRef)malloc(sizeof(*bvr)); if ( bvr ) { bzero(bvr, sizeof(*bvr)); @@ -573,7 +692,7 @@ { // filesystem probe failed. - DEBUG_DISK(("%s: failed probe on dev %x part %d\n", __FUNCTION__, biosdev, partno)); + DEBUG_DISK(("%s: failed probe on dev %X part %d\n", __FUNCTION__, biosdev, partno)); (*bvr->bv_free)(bvr); bvr = NULL; @@ -613,10 +732,12 @@ } } - if (bvr) bvr->flags |= bvrFlags; + if ( bvr ) { - return bvr; + bvr->flags |= bvrFlags; } + + return bvr; } //============================================================================== @@ -632,7 +753,7 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); + BVRef bvr = (BVRef)malloc(sizeof(*bvr)); if ( bvr ) { bzero(bvr, sizeof(*bvr)); @@ -668,7 +789,7 @@ { // filesystem probe failed. - DEBUG_DISK(("%s: failed probe on dev %x part %d\n", __FUNCTION__, biosdev, partno)); + DEBUG_DISK(("%s: failed probe on dev %X part %d\n", __FUNCTION__, biosdev, partno)); (*bvr->bv_free)(bvr); bvr = NULL; @@ -686,10 +807,12 @@ bvr = NULL; } } - if (bvr) + + if ( bvr ) { bvr->flags |= bvrFlags; } + return bvr; } @@ -721,33 +844,38 @@ // same as Apple ZFS //EFI_GUID const GPT_ZFS_GUID = { 0x6A898CC3, 0x1DD2, 0x11B2, { 0x99, 0xA6, 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }; // 0xBF01 "Solaris /usr & Apple ZFS -BVRef newGPTBVRef( int biosdev, int partno, unsigned int blkoff, - const gpt_ent * part, - FSInit initFunc, FSLoadFile loadFunc, +BVRef newGPTBVRef( int biosdev, + int partno, + unsigned int blkoff, + const gpt_ent *part, + FSInit initFunc, + FSLoadFile loadFunc, FSReadFile readFunc, FSGetDirEntry getdirFunc, FSGetFileBlock getBlockFunc, FSGetUUID getUUIDFunc, BVGetDescription getDescriptionFunc, BVFree bvFreeFunc, - int probe, int type, unsigned int bvrFlags ) + int probe, + int type, + unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); + BVRef bvr = (BVRef)malloc(sizeof(*bvr)); if ( bvr ) { bzero(bvr, sizeof(*bvr)); - bvr->biosdev = biosdev; - bvr->part_no = partno; - bvr->part_boff = blkoff; - bvr->fs_loadfile = loadFunc; - bvr->fs_readfile = readFunc; - bvr->fs_getdirentry = getdirFunc; - bvr->fs_getfileblock= getBlockFunc; - bvr->fs_getuuid = getUUIDFunc; - bvr->description = getDescriptionFunc; - bvr->type = type; - bvr->bv_free = bvFreeFunc; + bvr->biosdev = biosdev; + bvr->part_no = partno; + bvr->part_boff = blkoff; + bvr->fs_loadfile = loadFunc; + bvr->fs_readfile = readFunc; + bvr->fs_getdirentry = getdirFunc; + bvr->fs_getfileblock = getBlockFunc; + bvr->fs_getuuid = getUUIDFunc; + bvr->description = getDescriptionFunc; + bvr->type = type; + bvr->bv_free = bvFreeFunc; // FIXME: UCS-2 -> UTF-8 the name strlcpy(bvr->name, "----", DPISTRLEN); if ( (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const*)part->ent_type) == 0) || (efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const*)part->ent_type) == 0) ) @@ -796,10 +924,12 @@ bvr = NULL; } } - if (bvr) + + if ( bvr ) { bvr->flags |= bvrFlags; } + return bvr; } @@ -812,18 +942,18 @@ * one extended partition they will be numbered 1, 2, 5. */ -static BVRef diskScanFDiskBootVolumes( int biosdev, int * countPtr ) +static BVRef diskScanFDiskBootVolumes( int biosdev, int *countPtr ) { - const struct fdisk_part * part; - struct DiskBVMap * map; - int partno = -1; - BVRef bvr; + const struct fdisk_part *part; + struct DiskBVMap *map; + int partno = -1; + BVRef bvr; #if UFS_SUPPORT - BVRef booterUFS = NULL; + BVRef booterUFS = NULL; #endif - int spc; - struct driveInfo di; - boot_drive_info_t *dp; + int spc; + struct driveInfo di; + boot_drive_info_t *dp; /* Initialize disk info */ @@ -841,10 +971,11 @@ spc = 1; } - do { + do + { // Create a new mapping. - map = (struct DiskBVMap *) malloc( sizeof(*map) ); + map = (struct DiskBVMap *)malloc(sizeof(*map)); if ( map ) { map->biosdev = biosdev; @@ -857,8 +988,7 @@ while ( getNextFDiskPartition( biosdev, &partno, &part ) ) { - DEBUG_DISK(("%s: part %d [%x]\n", __FUNCTION__, - partno, part->systid)); + DEBUG_DISK(("%s: part %d [%X]\n", __FUNCTION__, partno, part->systid)); bvr = 0; switch ( part->systid ) @@ -879,166 +1009,173 @@ UFSFree, 0, kBIOSDevTypeHardDrive, 0); - break; + break; #endif - case FDISK_HFS: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - HFSInitPartition, - HFSLoadFile, - HFSReadFile, - HFSGetDirEntry, - HFSGetFileBlock, - HFSGetUUID, - HFSGetDescription, - HFSFree, - 0, - kBIOSDevTypeHardDrive, 0); - break; + case FDISK_HFS: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + HFSInitPartition, + HFSLoadFile, + HFSReadFile, + HFSGetDirEntry, + HFSGetFileBlock, + HFSGetUUID, + HFSGetDescription, + HFSFree, + 0, + kBIOSDevTypeHardDrive, 0); + break; - // turbo - we want the booter type scanned also - case FDISK_BOOTER: - if (part->bootid & FDISK_ACTIVE) - gBIOSBootVolume = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - HFSInitPartition, - HFSLoadFile, - HFSReadFile, - HFSGetDirEntry, - HFSGetFileBlock, - HFSGetUUID, - HFSGetDescription, - HFSFree, - 0, - kBIOSDevTypeHardDrive, 0); - break; + // turbo - we want the booter type scanned also + case FDISK_BOOTER: + if (part->bootid & FDISK_ACTIVE) + { + gBIOSBootVolume = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + HFSInitPartition, + HFSLoadFile, + HFSReadFile, + HFSGetDirEntry, + HFSGetFileBlock, + HFSGetUUID, + HFSGetDescription, + HFSFree, + 0, + kBIOSDevTypeHardDrive, 0); + } + break; #if UFS_SUPPORT - case FDISK_BOOTER: - booterUFS = newFDiskBVRef( - biosdev, partno, - ((part->relsect + spc - 1) / spc) * spc, - part, - UFSInitPartition, - UFSLoadFile, - UFSReadFile, - UFSGetDirEntry, - UFSGetFileBlock, - UFSGetUUID, - UFSGetDescription, - UFSFree, - 0, - kBIOSDevTypeHardDrive, 0); - break; + case FDISK_BOOTER: + booterUFS = newFDiskBVRef( + biosdev, partno, + ((part->relsect + spc - 1) / spc) * spc, + part, + UFSInitPartition, + UFSLoadFile, + UFSReadFile, + UFSGetDirEntry, + UFSGetFileBlock, + UFSGetUUID, + UFSGetDescription, + UFSFree, + 0, + kBIOSDevTypeHardDrive, 0); + break; #endif - case FDISK_FAT32: - case FDISK_DOS12: - case FDISK_DOS16S: - case FDISK_DOS16B: - case FDISK_SMALLFAT32: - case FDISK_DOS16SLBA: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - MSDOSInitPartition, - MSDOSLoadFile, - MSDOSReadFile, - MSDOSGetDirEntry, - MSDOSGetFileBlock, - MSDOSGetUUID, - MSDOSGetDescription, - MSDOSFree, - 0, - kBIOSDevTypeHardDrive, 0); - break; + case FDISK_FAT32: + case FDISK_DOS12: + case FDISK_DOS16S: + case FDISK_DOS16B: + case FDISK_SMALLFAT32: + case FDISK_DOS16SLBA: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + MSDOSInitPartition, + MSDOSLoadFile, + MSDOSReadFile, + MSDOSGetDirEntry, + MSDOSGetFileBlock, + MSDOSGetUUID, + MSDOSGetDescription, + MSDOSFree, + 0, + kBIOSDevTypeHardDrive, 0); + break; - case FDISK_NTFS: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - 0, 0, 0, 0, 0, - NTFSGetUUID, - NTFSGetDescription, - (BVFree)free, - 0, kBIOSDevTypeHardDrive, 0); - break; + case FDISK_NTFS: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + 0, 0, 0, 0, 0, + NTFSGetUUID, + NTFSGetDescription, + (BVFree)free, + 0, + kBIOSDevTypeHardDrive, 0); + break; - case FDISK_LINUX: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - 0, 0, 0, 0, 0, - EX2GetUUID, - EX2GetDescription, - (BVFree)free, - 0, kBIOSDevTypeHardDrive, 0); - break; + case FDISK_LINUX: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + 0, 0, 0, 0, 0, + EX2GetUUID, + EX2GetDescription, + (BVFree)free, + 0, + kBIOSDevTypeHardDrive, 0); + break; - case FDISK_BEFS: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - 0, 0, 0, 0, 0, 0, - BeFSGetDescription, - (BVFree)free, - 0, kBIOSDevTypeHardDrive, 0); - break; + case FDISK_BEFS: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + 0, 0, 0, 0, 0, 0, + BeFSGetDescription, + (BVFree)free, + 0, + kBIOSDevTypeHardDrive, 0); + break; - case FDISK_FREEBSD: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - 0, 0, 0, 0, 0, 0, - FreeBSDGetDescription, - (BVFree)free, - 0, kBIOSDevTypeHardDrive, 0); - break; + case FDISK_FREEBSD: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + 0, 0, 0, 0, 0, 0, + FreeBSDGetDescription, + (BVFree)free, + 0, + kBIOSDevTypeHardDrive, 0); + break; - case FDISK_OPENBSD: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - 0, 0, 0, 0, 0, 0, - OpenBSDGetDescription, - (BVFree)free, - 0, kBIOSDevTypeHardDrive, 0); - break; + case FDISK_OPENBSD: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + 0, 0, 0, 0, 0, 0, + OpenBSDGetDescription, + (BVFree)free, + 0, + kBIOSDevTypeHardDrive, 0); + break; - default: - bvr = newFDiskBVRef( - biosdev, partno, - part->relsect, - part, - 0, 0, 0, 0, 0, 0, 0, - (BVFree)free, - 0, - kBIOSDevTypeHardDrive, 0); - break; - } + default: + bvr = newFDiskBVRef( + biosdev, partno, + part->relsect, + part, + 0, 0, 0, 0, 0, 0, 0, + (BVFree)free, + 0, + kBIOSDevTypeHardDrive, 0); + break; + } - if ( bvr ) - { - bvr->next = map->bvr; - map->bvr = bvr; - map->bvrcnt++; - } - } + if ( bvr ) + { + bvr->next = map->bvr; + map->bvr = bvr; + map->bvrcnt++; + } + } #if UFS_SUPPORT - // Booting from a CD with an UFS filesystem embedded - // in a booter partition. + // Booting from a CD with an UFS filesystem embedded + // in a booter partition. if ( booterUFS ) { @@ -1056,11 +1193,11 @@ } } while (0); +#if UNUSED /* * If no FDisk partition, then we will check for * an Apple partition map elsewhere. */ -#if UNUSED if (map && map->bvrcnt == 0) { static struct fdisk_part cdpart; @@ -1088,10 +1225,10 @@ #endif // Actually this should always be true given the above code // (unless malloc failed above) - if(map && map == gDiskBVMap) + if(map && (map == gDiskBVMap)) { // Don't leave a null map in the chain - if(map->bvrcnt == 0 && map->bvr == NULL) + if((map->bvrcnt == 0) && (map->bvr == NULL)) { gDiskBVMap = map->next; free(map); @@ -1101,23 +1238,24 @@ if (countPtr) *countPtr = map ? map->bvrcnt : 0; - return map ? map->bvr : NULL; + return map ? map->bvr : NULL; } //============================================================================== static BVRef diskScanAPMBootVolumes( int biosdev, int * countPtr ) { - struct DiskBVMap * map; - struct Block0 *block0_p; - unsigned int blksize; - unsigned int factor; - void *buffer = malloc(BPS); + struct DiskBVMap *map; + struct Block0 *block0_p; + unsigned int blksize; + unsigned int factor; + void *buffer = malloc(BPS); if (!buffer) { return NULL; } + bzero(buffer,BPS); /* Check for alternate block size */ @@ -1125,6 +1263,7 @@ { return NULL; } + block0_p = buffer; if (OSSwapBigToHostInt16(block0_p->sbSig) == BLOCK0_SIGNATURE) { @@ -1165,7 +1304,7 @@ map->next = gDiskBVMap; gDiskBVMap = map; - for (i=0; idpme_map_entries); } @@ -1210,101 +1349,17 @@ } } while (0); - free(buffer); - - if (countPtr) *countPtr = map ? map->bvrcnt : 0; - - return map ? map->bvr : NULL; -} - -//============================================================================== - -/* - * Trying to figure out the filsystem type of a given partition. - */ -static int probeFileSystem(int biosdev, unsigned int blkoff) -{ - // detected filesystem type; - int result = -1; - int fatbits; - - // Allocating buffer for 4 sectors. - const void * probeBuffer = malloc(PROBEFS_SIZE); - if (probeBuffer == NULL) + if (buffer) { - goto exit; + free(buffer); } - // Reading first 4 sectors of current partition - int error = readBytes(biosdev, blkoff, 0, PROBEFS_SIZE, (void *)probeBuffer); - - if (error) + if (countPtr) { - goto exit; + *countPtr = map ? map->bvrcnt : 0; } - if (HFSProbe(probeBuffer)) - { - result = FDISK_HFS; - } - else if (EX2Probe(probeBuffer)) - { - result = FDISK_LINUX; - } - else if (FreeBSDProbe(probeBuffer)) - { - result = FDISK_FREEBSD; - } - - else if (OpenBSDProbe(probeBuffer)) - { - result = FDISK_OPENBSD; - } - - else if (BeFSProbe(probeBuffer)) - { - result = FDISK_BEFS; - } - - else if (EXFATProbe(probeBuffer)) - { - result = FDISK_PSEUDO_EXFAT; - } - - else if (NTFSProbe(probeBuffer)) - { - result = FDISK_NTFS; - } - - else if ( (fatbits = MSDOSProbe(probeBuffer)) ) - { - switch (fatbits) - { - case 32: - default: - result = FDISK_FAT32; - break; - case 16: - result = FDISK_DOS16B; - break; - case 12: - result = FDISK_DOS12; - break; - } - } - else - { - // Couldn't detect filesystem type - result = 0; - } - -exit: - if (probeBuffer) - { - free((void *)probeBuffer); - } - - return result; + return map ? map->bvr : NULL; } //============================================================================== @@ -1326,7 +1381,8 @@ void *buffer = malloc(BPS); int error; - if ( (error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer )) != 0) + + if ((error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer )) != 0) { verbose("Failed to read boot sector from BIOS device %02xh. Error=%d\n", biosdev, error); goto scanErr; @@ -1374,7 +1430,7 @@ // Determine whether the partition header signature is present. - if ( memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG)) ) + if (memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG))) { goto scanErr; } @@ -1384,7 +1440,7 @@ UInt32 headerCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_self); UInt32 headerSize = OSSwapLittleToHostInt32(headerMap->hdr_size); - if ( headerSize < offsetof(gpt_hdr, padding) ) + if (headerSize < offsetof(gpt_hdr, padding)) { goto scanErr; } @@ -1405,12 +1461,12 @@ // Determine whether the partition entry size is valid. - UInt64 gptBlock = 0; - UInt32 gptCheck = 0; - UInt32 gptCount = 0; - UInt32 gptID = 0; - gpt_ent * gptMap = 0; - UInt32 gptSize = 0; + UInt64 gptBlock = 0; + UInt32 gptCheck = 0; + UInt32 gptCount = 0; + UInt32 gptID = 0; + gpt_ent *gptMap = 0; + UInt32 gptSize = 0; gptBlock = OSSwapLittleToHostInt64(headerMap->hdr_lba_table); gptCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_table); @@ -1458,17 +1514,19 @@ // fdisk like partition type id. int fsType = 0; - for(gptID = 1; gptID <= gptCount; ++gptID) { + for(gptID = 1; gptID <= gptCount; ++gptID) + { BVRef bvr = NULL; unsigned int bvrFlags = 0; // size on disk can be larger than sizeof(gpt_ent) - gptMap = (gpt_ent *) ( buffer + ( (gptID - 1) * gptSize) ); + gptMap = (gpt_ent *)(buffer + ((gptID - 1) * gptSize)); // NOTE: EFI_GUID's are in LE and we know we're on an x86. // The IOGUIDPartitionScheme.cpp code uses byte-based UUIDs, we don't. - if (isPartitionUsed(gptMap)) { + if (isPartitionUsed(gptMap)) + { char stringuuid[100]; efi_guid_unparse_upper((EFI_GUID*)gptMap->ent_type, stringuuid); verbose("Reading GPT partition %d, type %s\n", gptID, stringuuid); @@ -1476,27 +1534,29 @@ // Getting fdisk like partition type. fsType = probeFileSystem(biosdev, gptMap->ent_lba_start); - if ( (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) || (efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) { - bvrFlags = (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ? kBVFlagBooter : 0; - bvr = newGPTBVRef(biosdev, - gptID, - gptMap->ent_lba_start, - gptMap, - HFSInitPartition, - HFSLoadFile, - HFSReadFile, - HFSGetDirEntry, - HFSGetFileBlock, - HFSGetUUID, - HFSGetDescription, - HFSFree, - 0, - kBIOSDevTypeHardDrive, bvrFlags); - } + if ( (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) || (efi_guid_compare(&GPT_HFS_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) + { + bvrFlags = (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ? kBVFlagBooter : 0; + bvr = newGPTBVRef(biosdev, + gptID, + gptMap->ent_lba_start, + gptMap, + HFSInitPartition, + HFSLoadFile, + HFSReadFile, + HFSGetDirEntry, + HFSGetFileBlock, + HFSGetUUID, + HFSGetDescription, + HFSFree, + 0, + kBIOSDevTypeHardDrive, bvrFlags); + } // zef - foreign OS support - if ( (efi_guid_compare(&GPT_BASICDATA_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) || - (efi_guid_compare(&GPT_BASICDATA2_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) { + if ((efi_guid_compare(&GPT_BASICDATA_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) || + (efi_guid_compare(&GPT_BASICDATA2_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) + { switch (fsType) { case FDISK_NTFS: @@ -1583,7 +1643,8 @@ break; default: - if (biosdev == gBIOSDev) { + if (biosdev == gBIOSDev) + { gBIOSBootVolume = bvr; } break; @@ -1606,17 +1667,21 @@ } scanErr: - if (buffer) { + if (buffer) + { free(buffer); } - if(map) { + if(map) + { if(countPtr) *countPtr = map->bvrcnt; { return map->bvr; } - } else { + } + else + { if(countPtr) *countPtr = 0; { return NULL; @@ -1686,7 +1751,7 @@ { const char *val; int len; - + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { // getValueForKey uses const char for val @@ -1757,14 +1822,14 @@ { ret = -1; error = 0; - + // // Check for alternate volume label on boot helper partitions. // if (bvr->flags & kBVFlagBooter) { sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no); - strcpy(fileSpec, ".disk_label.contentDetails"); + sprintf(fileSpec, "%s", ".disk_label.contentDetails"); ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); if (!ret) { @@ -1796,7 +1861,7 @@ if (bvr->flags & kBVFlagNativeBoot) { - if (getOSVersion(bvr,bvr->OSVersion) == true) + if (getOSVersion(bvr, bvr->OSVersion) == true) { bvr->flags |= kBVFlagSystemVolume; } @@ -1814,6 +1879,7 @@ { return; } + CacheReset(); diskFreeMap(oldMap); oldMap = NULL; @@ -1898,10 +1964,12 @@ { bvr = diskScanFDiskBootVolumes(biosdev, &count); } + if (bvr == NULL) { bvr = diskScanAPMBootVolumes(biosdev, &count); } + if (bvr) { scanFSLevelBVRSettings(bvr); @@ -1911,10 +1979,12 @@ { bvr = map->bvr; } + if (countPtr) { *countPtr += count; } + return bvr; } @@ -2077,6 +2147,7 @@ { break; } + nextBVR = bvr->next; if (bvr->filtered) @@ -2097,28 +2168,6 @@ //============================================================================== -static const struct NamedValue fdiskTypes[] = -{ - { FDISK_NTFS, "Windows NTFS" }, - { FDISK_DOS12, "Windows FAT12" }, - { FDISK_DOS16B, "Windows FAT16" }, - { FDISK_DOS16S, "Windows FAT16" }, - { FDISK_DOS16SLBA, "Windows FAT16" }, - { FDISK_SMALLFAT32, "Windows FAT32" }, - { FDISK_FAT32, "Windows FAT32" }, - { FDISK_FREEBSD, "FreeBSD" }, - { FDISK_OPENBSD, "OpenBSD" }, - { FDISK_LINUX, "Linux" }, - { FDISK_UFS, "Apple UFS" }, - { FDISK_HFS, "Apple HFS" }, - { FDISK_BOOTER, "Apple Boot/UFS" }, - { FDISK_BEFS, "Haiku" }, - { 0xCD, "CD-ROM" }, - { 0x00, 0 } /* must be last */ -}; - -//============================================================================== - bool matchVolumeToString( BVRef bvr, const char* match, long matchLen) { char testStr[128]; @@ -2279,7 +2328,7 @@ if (name == NULL) { - sprintf(p, "TYPE %02x", type); + sprintf(p, "TYPE %02X", type); } else { @@ -2294,16 +2343,16 @@ //============================================================================== -int readBootSector(int biosdev, unsigned int secno, void * buffer) +int readBootSector(int biosdev, unsigned int secno, void *buffer) { int error; - struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer; + struct disk_blk0 * bootSector = (struct disk_blk0 *)buffer; if (bootSector == NULL) { if (gBootSector == NULL) { - gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); + gBootSector = (struct disk_blk0 *)malloc(sizeof(*gBootSector)); if (gBootSector == NULL) { @@ -2343,26 +2392,26 @@ //============================================================================== -int testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer ) +int testFAT32EFIBootSector(int biosdev, unsigned int secno, void *buffer) { - struct disk_boot1f32_blk * bootSector = (struct disk_boot1f32_blk *) buffer; - int error; + struct disk_boot1f32_blk *bootSector = (struct disk_boot1f32_blk *)buffer; + int error; - if ( bootSector == NULL ) + if (bootSector == NULL) { - if ( gBootSector == NULL ) + if (gBootSector == NULL) { - gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); + gBootSector = (struct disk_blk0 *)malloc(sizeof(*gBootSector)); if ( gBootSector == NULL ) { return -1; } } - bootSector = (struct disk_boot1f32_blk *) gBootSector; + bootSector = (struct disk_boot1f32_blk *)gBootSector; } - error = readBytes( biosdev, secno, 0, BPS, bootSector ); - if ( error || bootSector->signature != DISK_SIGNATURE || strncmp((const char *)bootSector->magic, BOOT1F32_MAGIC, BOOT1F32_MAGICLEN) ) + error = readBytes(biosdev, secno, 0, BPS, bootSector); + if (error || bootSector->signature != DISK_SIGNATURE || strncmp((const char *)bootSector->magic, BOOT1F32_MAGIC, BOOT1F32_MAGICLEN) ) { return -1; } @@ -2485,7 +2534,7 @@ int diskIsCDROM(BVRef bvr) { - struct driveInfo di; + struct driveInfo di; if (getDriveInfo(bvr->biosdev, &di) == 0 && di.no_emulation) { @@ -2498,7 +2547,7 @@ int biosDevIsCDROM(int biosdev) { - struct driveInfo di; + struct driveInfo di; if (getDriveInfo(biosdev, &di) == 0 && di.no_emulation) { Index: branches/ErmaC/Enoch/i386/libsaio/smbios.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/smbios.c (revision 2542) @@ -34,79 +34,79 @@ /* ======================= BIOS Information (Type 0) ========================= */ -#define kSMBBIOSInformationVendorKey "SMbiosvendor" // Apple Inc. -#define kSMBBIOSInformationVersionKey "SMbiosversion" // MP31.88Z.006C.B05.0802291410 -#define kSMBBIOSInformationReleaseDateKey "SMbiosdate" // 02/29/08 +#define kSMBBIOSInformationVendorKey "SMbiosvendor" // Apple Inc. +#define kSMBBIOSInformationVersionKey "SMbiosversion" // MP31.88Z.006C.B05.0802291410 +#define kSMBBIOSInformationReleaseDateKey "SMbiosdate" // 02/29/08 // Bungo -#define kSMBBIOSInformationReleaseKey "SMbiosrelease" // BIOS Revision +#define kSMBBIOSInformationReleaseKey "SMbiosrelease" // BIOS Revision // example: BIOS Revision: 1.23 --> 2 bytes: Major=0x01, Minor=0x17 --> after swap: 0x1701hex = 5889dec (SMBIOS_spec_DSP0134_2.7.1) /* ========================= System Information (Type 1) =========================== */ -#define kSMBSystemInformationManufacturerKey "SMmanufacturer" // Apple Inc. -#define kSMBSystemInformationProductNameKey "SMproductname" // MacPro3,1 -#define kSMBSystemInformationVersionKey "SMsystemversion" // 1.0 -#define kSMBSystemInformationSerialNumberKey "SMserial" // Serial number +#define kSMBSystemInformationManufacturerKey "SMmanufacturer" // Apple Inc. +#define kSMBSystemInformationProductNameKey "SMproductname" // MacPro3,1 +#define kSMBSystemInformationVersionKey "SMsystemversion" // 1.0 +#define kSMBSystemInformationSerialNumberKey "SMserial" // Serial number //Bungo -#define kSMBSystemInformationUUIDKey "SMsystemuuid" // ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }' -#define kSMBSystemInformationSKUNumberKey "SMskunumber" // System SKU# +#define kSMBSystemInformationUUIDKey "SMsystemuuid" // ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }' +#define kSMBSystemInformationSKUNumberKey "SMskunumber" // System SKU# -#define kSMBSystemInformationFamilyKey "SMfamily" // MacPro +#define kSMBSystemInformationFamilyKey "SMfamily" // MacPro /* ========================================= Base Board (or Module) Information (Type 2) =========================================== */ -#define kSMBBaseBoardManufacturerKey "SMboardmanufacturer" // Apple Inc. -#define kSMBBaseBoardProductKey "SMboardproduct" // Mac-F2268DC8 +#define kSMBBaseBoardManufacturerKey "SMboardmanufacturer" // Apple Inc. +#define kSMBBaseBoardProductKey "SMboardproduct" // Mac-F2268DC8 // Bungo -#define kSMBBaseBoardVersionKey "SMboardversion" // MacPro3,1 -#define kSMBBaseBoardSerialNumberKey "SMboardserial" // C02140302D5DMT31M -#define kSMBBaseBoardAssetTagKey "SMboardassettag" // Base Board Asset Tag# Bungo: renamed folowing convention -#define kSMBBaseBoardLocationInChassisKey "SMboardlocation" // Part Component +#define kSMBBaseBoardVersionKey "SMboardversion" // MacPro3,1 +#define kSMBBaseBoardSerialNumberKey "SMboardserial" // C02140302D5DMT31M +#define kSMBBaseBoardAssetTagKey "SMboardassettag" // Base Board Asset Tag# Bungo: renamed folowing convention +#define kSMBBaseBoardLocationInChassisKey "SMboardlocation" // Part Component // ErmaC BoardType 0x0a(10) or 0x0b(11) MacPro Family -#define kSMBBaseBoardTypeKey "SMboardtype" // 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro +#define kSMBBaseBoardTypeKey "SMboardtype" // 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro // Bungo /* ======================= System Enclosure (Type 3) ========================= */ -#define kSMBSystemEnclosureManufacturerKey "SMchassismanufacturer" // Apple Inc. -#define kSMBSystemEnclosureTypeKey "SMchassistype" // 7 Desktop -#define kSMBSystemEnclosureVersionKey "SMchassisversion" // Mac-F42C88C8 -#define kSMBSystemEnclosureSerialNumberKey "SMchassisserial" // Serial number -#define kSMBSystemEnclosureAssetTagKey "SMchassisassettag" // Pro-Enclosure Bungo: renamed folowing convention +#define kSMBSystemEnclosureManufacturerKey "SMchassismanufacturer" // Apple Inc. +#define kSMBSystemEnclosureTypeKey "SMchassistype" // 7 Desktop +#define kSMBSystemEnclosureVersionKey "SMchassisversion" // Mac-F42C88C8 +#define kSMBSystemEnclosureSerialNumberKey "SMchassisserial" // Serial number +#define kSMBSystemEnclosureAssetTagKey "SMchassisassettag" // Pro-Enclosure Bungo: renamed folowing convention /* ============================ Processor Information (Type 4) ============================== */ // Bungo -#define kSMBProcessorInformationSocketKey "SMcpusocket" -#define kSMBProcessorInformationManufacturerKey "SMcpumanufacturer" -#define kSMBProcessorInformationVersionKey "SMcpuversion" +#define kSMBProcessorInformationSocketKey "SMcpusocket" +#define kSMBProcessorInformationManufacturerKey "SMcpumanufacturer" +#define kSMBProcessorInformationVersionKey "SMcpuversion" // #define kSMBProcessorInformationExternalClockKey "SMexternalclock" #define kSMBProcessorInformationMaximumClockKey "SMmaximalclock" // Bungo -#define kSMBProcessorInformationCurrentClockKey "SMcurrentclock" -#define kSMBProcessorInformationUpgradeKey "SMcpuupgrade" -#define kSMBProcessorInformationSerialNumberKey "SMcpuserial" -#define kSMBProcessorInformationAssetTagKey "SMcpuassettag" // Bungo: renamed folowing convention -#define kSMBProcessorInformationPartNumberKey "SMcpupartnumber" +#define kSMBProcessorInformationCurrentClockKey "SMcurrentclock" +#define kSMBProcessorInformationUpgradeKey "SMcpuupgrade" +#define kSMBProcessorInformationSerialNumberKey "SMcpuserial" +#define kSMBProcessorInformationAssetTagKey "SMcpuassettag" // Bungo: renamed folowing convention +#define kSMBProcessorInformationPartNumberKey "SMcpupartnumber" /* ===================== Memory Device (Type 17) ======================= */ -#define kSMBMemoryDeviceDeviceLocatorKey "SMmemdevloc" // -#define kSMBMemoryDeviceBankLocatorKey "SMmembankloc" // -#define kSMBMemoryDeviceMemoryTypeKey "SMmemtype" // -#define kSMBMemoryDeviceMemorySpeedKey "SMmemspeed" // -#define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" // -#define kSMBMemoryDeviceSerialNumberKey "SMmemserial" // -#define kSMBMemoryDevicePartNumberKey "SMmempart" // +#define kSMBMemoryDeviceDeviceLocatorKey "SMmemdevloc" // +#define kSMBMemoryDeviceBankLocatorKey "SMmembankloc" // +#define kSMBMemoryDeviceMemoryTypeKey "SMmemtype" // +#define kSMBMemoryDeviceMemorySpeedKey "SMmemspeed" // +#define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" // +#define kSMBMemoryDeviceSerialNumberKey "SMmemserial" // +#define kSMBMemoryDevicePartNumberKey "SMmempart" // // Bungo: -#define kSMBMemoryDeviceAssetTagKey "SMmemassettag" // +#define kSMBMemoryDeviceAssetTagKey "SMmemassettag" // /* =========================================== Memory SPD Data (Apple Specific - Type 130) @@ -115,17 +115,17 @@ /* ============================================ OEM Processor Type (Apple Specific - Type 131) ============================================== */ -#define kSMBOemProcessorTypeKey "SMoemcputype" // Bungo: renamed from SMcputype +#define kSMBOemProcessorTypeKey "SMoemcputype" // Bungo: renamed from SMcputype /* ================================================= OEM Processor Bus Speed (Apple Specific - Type 132) =================================================== */ -#define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed +#define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed /* ============================================== OEM Platform Feature (Apple Specific - Type 133) ================================================ */ -//#define kSMBOemPlatformFeatureKey "SMoemplatformfeature" +//#define kSMBOemPlatformFeatureKey "SMoemplatformfeature" /* ==================================================*/ #define getFieldOffset(struct, field) ((uint8_t)(uint32_t)&(((struct *)0)->field)) @@ -208,75 +208,75 @@ BIOS Information (Type 0) ========================= */ { kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, vendor), - kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor }, // SMbiosvendor - Apple Inc. + kSMBBIOSInformationVendorKey, NULL, &defaultBIOSInfo.vendor }, // SMbiosvendor - Apple Inc. { kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, version), - kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version }, // SMbiosversion - MP31.88Z.006C.B05.0802291410 + kSMBBIOSInformationVersionKey, NULL, &defaultBIOSInfo.version }, // SMbiosversion - MP31.88Z.006C.B05.0802291410 { kSMBTypeBIOSInformation, kSMBString, getFieldOffset(SMBBIOSInformation, releaseDate), - kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate }, // SMbiosdate - 02/29/08 + kSMBBIOSInformationReleaseDateKey, NULL, &defaultBIOSInfo.releaseDate }, // SMbiosdate - 02/29/08 // Bungo { kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor), - kSMBBIOSInformationReleaseKey, NULL, (char **)&defaultBIOSInfo.release }, // SMbiosrelease - 0.1 (256) + kSMBBIOSInformationReleaseKey, NULL, (char **)&defaultBIOSInfo.release }, // SMbiosrelease - 0.1 (256) /* ========================= System Information (Type 1) =========================== */ {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, manufacturer), - kSMBSystemInformationManufacturerKey, NULL, &defaultSystemInfo.manufacturer }, // SMmanufacturer - Apple Inc. + kSMBSystemInformationManufacturerKey, NULL, &defaultSystemInfo.manufacturer }, // SMmanufacturer - Apple Inc. {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, productName), - kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName }, // SMproductname - MacPro3,1 + kSMBSystemInformationProductNameKey, NULL, &defaultSystemInfo.productName }, // SMproductname - MacPro3,1 {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, version), - kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version }, // SMsystemversion - 1.0 + kSMBSystemInformationVersionKey, NULL, &defaultSystemInfo.version }, // SMsystemversion - 1.0 {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, serialNumber), - kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number + kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number /* Bungo: {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, uuid), - kSMBSystemInformationUUIDKey, NULL, NULL}, // SMsystemuuid + kSMBSystemInformationUUIDKey, NULL, NULL}, // SMsystemuuid {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, wakeupReason), - NULL, NULL, NULL}, // reason for system wakeup + NULL, NULL, NULL}, // reason for system wakeup */ // Bungo {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, skuNumber), - kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU# + kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU# {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, family), - kSMBSystemInformationFamilyKey, NULL, &defaultSystemInfo.family}, // SMfamily - MacPro + kSMBSystemInformationFamilyKey, NULL, &defaultSystemInfo.family}, // SMfamily - MacPro /* ========================================= Base Board (or Module) Information (Type 2) =========================================== */ {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, manufacturer), - kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMboardmanufacturer - Apple Inc. + kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMboardmanufacturer - Apple Inc. {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, product), - kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product }, // SMboardproduct - Mac-F2268DC8 + kSMBBaseBoardProductKey, NULL, &defaultBaseBoard.product }, // SMboardproduct - Mac-F2268DC8 // Bungo {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, version), - kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version }, // SMboardversion - MacPro3,1 + kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version }, // SMboardversion - MacPro3,1 {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, serialNumber), - kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M + kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, assetTag), - kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassettag - Base Board Asset Tag# + kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassettag - Base Board Asset Tag# {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, locationInChassis), - kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component + kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component {kSMBTypeBaseBoard, kSMBByte, getFieldOffset(SMBBaseBoard, boardType), - kSMBBaseBoardTypeKey, NULL, (char **)&defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro + kSMBBaseBoardTypeKey, NULL, (char **)&defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro /* {kSMBTypeBaseBoard, kSMBByte, getFieldOffset(SMBBaseBoard, numberOfContainedHandles), - NULL , NULL, NULL }, // numberOfContainedHandles = 0 + NULL , NULL, NULL }, // numberOfContainedHandles = 0 */ // @@ -285,19 +285,19 @@ System Enclosure (Type 3) ========================= */ {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, manufacturer), - kSMBSystemEnclosureManufacturerKey, NULL, &defaultChassis.manufacturer }, // SMchassismanufacturer - Apple Inc. + kSMBSystemEnclosureManufacturerKey, NULL, &defaultChassis.manufacturer }, // SMchassismanufacturer - Apple Inc. {kSMBTypeSystemEnclosure, kSMBByte, getFieldOffset(SMBSystemEnclosure, chassisType), - kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType }, // SMchassistype - 7 + kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType }, // SMchassistype - 7 {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, version), - kSMBSystemEnclosureVersionKey, NULL, &defaultChassis.version }, // SMchassisversion - Mac-F42C88C8 + kSMBSystemEnclosureVersionKey, NULL, &defaultChassis.version }, // SMchassisversion - Mac-F42C88C8 {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, serialNumber), - kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber }, // SMchassisserial + kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber }, // SMchassisserial {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTag), - kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag }, // SMchassisassettag - Pro Enclosure + kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag }, // SMchassisassettag - Pro Enclosure /* {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, skuNumber), @@ -308,32 +308,32 @@ Processor Information (Type 4) ============================== */ {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, socketDesignation), - kSMBProcessorInformationSocketKey, NULL, NULL}, // SMcpusocket - + kSMBProcessorInformationSocketKey, NULL, NULL}, // SMcpusocket - {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, manufacturer), - kSMBProcessorInformationManufacturerKey, NULL, NULL}, // SMcpumanufacturer - Intel(R) Corporation + kSMBProcessorInformationManufacturerKey, NULL, NULL}, // SMcpumanufacturer - Intel(R) Corporation {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, processorVersion), - kSMBProcessorInformationVersionKey, NULL, NULL}, // SMcpuversion + kSMBProcessorInformationVersionKey, NULL, NULL}, // SMcpuversion {kSMBTypeProcessorInformation, kSMBWord, getFieldOffset(SMBProcessorInformation, externalClock), - kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock, NULL}, // SMcpuexternalclock + kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock, NULL}, // SMcpuexternalclock {kSMBTypeProcessorInformation, kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock), - kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock, NULL}, // SMcpumaximumclock + kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock, NULL}, // SMcpumaximumclock // Bungo {kSMBTypeProcessorInformation, kSMBWord, getFieldOffset(SMBProcessorInformation, currentClock), - kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentclock + kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentclock {kSMBTypeProcessorInformation, kSMBByte, getFieldOffset(SMBProcessorInformation, processorUpgrade), - kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade + kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade // {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, serialNumber), kSMBProcessorInformationSerialNumberKey, NULL, NULL}, // Bungo {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, assetTag), - kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag + kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag // {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, partNumber), kSMBProcessorInformationPartNumberKey, NULL, NULL}, @@ -372,25 +372,25 @@ // Apple Specific //------------------------------------------------------------------------------------------------------------------------- // OEM Processor Type (Apple Specific - Type 131) - {kSMBTypeOemProcessorType, kSMBWord, getFieldOffset(SMBOemProcessorType, ProcessorType), kSMBOemProcessorTypeKey, + {kSMBTypeOemProcessorType, kSMBWord, getFieldOffset(SMBOemProcessorType, ProcessorType), kSMBOemProcessorTypeKey, getSMBOemProcessorType, NULL}, // OEM Processor Bus Speed (Apple Specific - Type 132) {kSMBTypeOemProcessorBusSpeed, kSMBWord, getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed), kSMBOemProcessorBusSpeedKey, - getSMBOemProcessorBusSpeed, NULL} + getSMBOemProcessorBusSpeed, NULL} // OEM Platform Feature (Apple Specific - Type 133) /* {kSMBTypeOemPlatformFeature, kSMBWord, getFieldOffset(SMBOemPlatformFeature, PlatformFeature), kSMBOemPlatformFeatureKey, - getSMBOemPlatformFeature, NULL} + getSMBOemPlatformFeature, NULL} */ }; int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter); -SMBEntryPoint *origeps = 0; -SMBEntryPoint *neweps = 0; +SMBEntryPoint *origeps = 0; +SMBEntryPoint *neweps = 0; static uint8_t stringIndex; // increament when a string is added and set the field value accordingly static uint8_t stringsSize; // add string size @@ -616,9 +616,9 @@ /* ============================================ */ -bool useSMBIOSdefaults = true; // Bungo +bool useSMBIOSdefaults = true; // Bungo -SMBByte PlatformType = 1; // Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED. +SMBByte PlatformType = 1; // Bungo: same as Platfom.Type in platform.h. Because can't get from ACPI FADT PM profile and platformCPUFeature(CPU_FEATURE_MOBILE)) doesn't work as expect, FIXING NEEDED. /* Rewrite this function */ void setDefaultSMBData(void) // Bungo: setting data from real Macs @@ -780,19 +780,25 @@ int len; char key[24]; - if (current != structHeader->handle) { + if (current != structHeader->handle) + { idx++; current = structHeader->handle; } sprintf(key, "%s%d", keyString, idx); - if (value) { - if (getIntForKey(key, (int *)&(value->dword), SMBPlist)) { + if (value) + { + if (getIntForKey(key, (int *)&(value->dword), SMBPlist)) + { return true; } - } else { - if (getValueForKey(key, string, &len, SMBPlist)) { + } + else + { + if (getValueForKey(key, string, &len, SMBPlist)) + { return true; } } @@ -801,12 +807,13 @@ char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field) { - uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length; - - if (!field) { + if (!field) + { return NULL; } + uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length; + for (field--; field != 0 && strlen((char *)stringPtr) > 0; field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1)); @@ -817,25 +824,30 @@ { int strSize; - if (!field) { + if (!field) + { return; } - if (!string) { + if (!string) + { *field = 0; return; } strSize = strlen(string); - // remove any spaces found at the end but only in MemoryDevice - if (structHeader->type == kSMBTypeMemoryDevice) { - while ((strSize != 0) && (string[strSize - 1] == ' ')) { + // remove any spaces found at the end but only in MemoryDevice avoiding errors + if (structHeader->type == kSMBTypeMemoryDevice) + { + while ((strSize != 0) && (string[strSize - 1] == ' ')) + { strSize--; } } - if (strSize == 0) { + if (strSize == 0) + { *field = 0; return; } @@ -854,11 +866,13 @@ bool parsed; int val; - if (numOfSetters <= idx) { + if (numOfSetters <= idx) + { return false; } - switch (SMBSetters[idx].valueType) { + switch (SMBSetters[idx].valueType) + { case kSMBString: { if (SMBSetters[idx].keyString) @@ -866,7 +880,9 @@ if (getValueForKey(SMBSetters[idx].keyString, &string, &len, SMBPlist)) { break; - } else { + } + else + { if (structPtr->orig->type == kSMBTypeMemoryDevice) // MemoryDevice only { if (getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, &string, NULL)) @@ -877,33 +893,42 @@ } } - if (SMBSetters[idx].getSMBValue) { - if (SMBSetters[idx].getSMBValue((returnType *)&string)) { + if (SMBSetters[idx].getSMBValue) + { + if (SMBSetters[idx].getSMBValue((returnType *)&string)) + { break; } } // if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo - if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) { + if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) + { string = *(SMBSetters[idx].defaultValue); break; } string = getSMBStringForField(structPtr->orig, *(uint8_t *)value); break; } + case kSMBByte: case kSMBWord: case kSMBDWord: case kSMBQWord: - if (SMBSetters[idx].keyString) { + if (SMBSetters[idx].keyString) + { parsed = getIntForKey(SMBSetters[idx].keyString, &val, SMBPlist); if (!parsed) { - if (structPtr->orig->type == kSMBTypeMemoryDevice) { // MemoryDevice only + if (structPtr->orig->type == kSMBTypeMemoryDevice) // MemoryDevice only + { parsed = getSMBValueForKey(structPtr->orig, SMBSetters[idx].keyString, NULL, (returnType *)&val); } } - if (parsed) { - switch (SMBSetters[idx].valueType) { + + if (parsed) + { + switch (SMBSetters[idx].valueType) + { case kSMBByte: value->byte = (uint8_t)val; break; @@ -922,14 +947,17 @@ } } - if (SMBSetters[idx].getSMBValue) { - if (SMBSetters[idx].getSMBValue(value)) { + if (SMBSetters[idx].getSMBValue) + { + if (SMBSetters[idx].getSMBValue(value)) + { return true; } } // #if 0 Bungo: enables code below // if (*(SMBSetters[idx].defaultValue)) Bungo - if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) { + if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) + { // value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo switch (SMBSetters[idx].valueType) { case kSMBByte: @@ -953,7 +981,8 @@ } // if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified" - if ((SMBSetters[idx].valueType == kSMBString) && string) { + if ((SMBSetters[idx].valueType == kSMBString) && string) + { setSMBStringForField(structPtr->new, string, &value->byte); } return true; @@ -1050,7 +1079,9 @@ /* ============================================== OEM Platform Feature (Apple Specific - Type 133) ================================================ */ - /*void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) { +/* +void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) +{ SMBOemPlatformFeature *p = (SMBOemPlatformFeature *)structPtr->new; p->header.type = kSMBTypeOemPlatformFeature; @@ -1062,7 +1093,8 @@ structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBOemPPlatformFeature) + 2); tableLength += sizeof(SMBOemPlatformFeature) + 2; structureCount++; - }*/ + } +*/ //------------------------------------------------------------------------------------------------------------------------- // EndOfTable @@ -1090,9 +1122,11 @@ // http://forge.voodooprojects.org/p/chameleon/issues/361/ bool forceFullMemInfo = false; - if (structPtr->orig->type == kSMBTypeMemoryDevice) { + if (structPtr->orig->type == kSMBTypeMemoryDevice) + { getBoolForKey(kMemFullInfo, &forceFullMemInfo, &bootInfo->chameleonConfig); - if (forceFullMemInfo) { + if (forceFullMemInfo) + { structPtr->orig->length = 27; } }*/ @@ -1100,11 +1134,13 @@ stringIndex = 1; stringsSize = 0; - if (handle < structPtr->orig->handle) { + if (handle < structPtr->orig->handle) + { handle = structPtr->orig->handle; } - // Bungo: fix unsuported tables lengths from original smbios: extend smaller or truncate bigger - we use SMBIOS rev. 2.4 like Apple uses - switch (structPtr->orig->type) { + // Bungo: fix unsuported tables lengths from original smbios: extend shorter or truncate longer - we use SMBIOS rev. 2.4 like Apple uses + switch (structPtr->orig->type) + { case kSMBTypeBIOSInformation: structSize = sizeof(SMBBIOSInformation); break; @@ -1129,38 +1165,48 @@ } // memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length); - if (structPtr->orig->length <= structSize) { + if (structPtr->orig->length <= structSize) + { memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length); - } else { + } + else + { memcpy((void *)structPtr->new, structPtr->orig, structSize); } structPtr->new->length = structSize; - for (i = 0; i < numOfSetters; i++) { + for (i = 0; i < numOfSetters; i++) + { // Bungo: //if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) { - if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize)) { + if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize)) + { setterFound = true; setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset)); } } - if (setterFound) { + if (setterFound) + { // Bungo: // ptr = (uint8_t *)structPtr->new + structPtr->orig->length; ptr = (uint8_t *)structPtr->new + structPtr->new->length; for (; ((uint16_t *)ptr)[0] != 0; ptr++); - if (((uint16_t *)ptr)[0] == 0) { + if (((uint16_t *)ptr)[0] == 0) + { ptr += 2; } structSize = ptr - (uint8_t *)structPtr->new; - } else { + } + else + { ptr = (uint8_t *)structPtr->orig + structPtr->orig->length; for (; ((uint16_t *)ptr)[0] != 0; ptr++); - if (((uint16_t *)ptr)[0] == 0) { + if (((uint16_t *)ptr)[0] == 0) + { ptr += 2; } @@ -1172,7 +1218,8 @@ tableLength += structSize; - if (structSize > maxStructSize) { + if (structSize > maxStructSize) + { maxStructSize = structSize; } @@ -1206,7 +1253,8 @@ ptr = (uint8_t *)((uint32_t)structPtr->orig + structPtr->orig->length); for (; ((uint16_t *)ptr)[0] != 0; ptr++); - if (((uint16_t *)ptr)[0] == 0) { + if (((uint16_t *)ptr)[0] == 0) + { ptr += 2; } @@ -1236,7 +1284,8 @@ ptr = (uint8_t *)((uint32_t)structHeader + structHeader->length); for (; ((uint16_t *)ptr)[0] != 0; ptr++); - if (((uint16_t *)ptr)[0] == 0) { + if (((uint16_t *)ptr)[0] == 0) + { ptr += 2; } @@ -1245,28 +1294,33 @@ ptr = ((SMBSystemInformation *)structHeader)->uuid; - if (!sysId || !ret) { // no or bad custom UUID,... + if (!sysId || !ret) // no or bad custom uuid,... + { sysId = 0; - ret = Platform.UUID; // ...try bios dmi system uuid extraction + ret = Platform.UUID; // ...use original (factory) system uuid } - for (i=0, isZero=1, isOnes=1; idmi.structureCount = structureCount; neweps->dmi.bcdRevision = 0x24; // ... and 2.4 DMI rev. as real Macs - if (!neweps->dmi.tableAddress) { + if (!neweps->dmi.tableAddress) + { free(buffer); free(structPtr); return; @@ -1350,17 +1409,20 @@ free(buffer); free(structPtr); + DBG("SMBIOS orig was = %x\n", origeps); + DBG("SMBIOS new is = %x\n", neweps); + decodeSMBIOSTable(neweps); - DBG("SMBIOS orig was = %x\n", origeps); - DBG("SMBIOS new is = %x\n", neweps); } void *getSmbios(int which) { - switch (which) { + switch (which) + { case SMBIOS_ORIGINAL: - if (!origeps) { + if (!origeps) + { origeps = getAddressOfSmbiosTable(); } return origeps; @@ -1391,7 +1453,8 @@ break; case kSMBTypeSystemEnclosure: // Bungo: determine platform type - switch (((SMBSystemEnclosure *)structHeader)->chassisType) { + switch (((SMBSystemEnclosure *)structHeader)->chassisType) + { case kSMBchassisDesktop: case kSMBchassisLPDesktop: case kSMBchassisAllInOne: @@ -1417,10 +1480,12 @@ case kSMBTypeMemoryDevice: Platform.DMI.CntMemorySlots++; - if (((SMBMemoryDevice *)structHeader)->memorySize != 0) { + if (((SMBMemoryDevice *)structHeader)->memorySize != 0) + { Platform.DMI.MemoryModules++; } - if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0) { + if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0) + { Platform.RAM.DIMM[dimmnbr].Frequency = ((SMBMemoryDevice *)structHeader)->memorySpeed; } dimmnbr++; @@ -1432,7 +1497,8 @@ structPtr = (uint8_t *)((uint32_t)structHeader + structHeader->length); for (; ((uint16_t *)structPtr)[0] != 0; structPtr++); - if (((uint16_t *)structPtr)[0] == 0) { + if (((uint16_t *)structPtr)[0] == 0) + { structPtr += 2; } Index: branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c (revision 2542) @@ -23,12 +23,12 @@ extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field); // Bungo: -#define NotSpecifiedStr "Not Specified" // no string -#define OutOfSpecStr "" // value out of smbios spec. range -#define PrivateStr "** PRIVATE **" // masking private data -#define neverMask false +#define NotSpecifiedStr "Not Specified" // no string +#define OutOfSpecStr "" // value out of smbios spec. range +#define PrivateStr "** PRIVATE **" // masking private data +#define neverMask false -static bool privateData = true; +static bool privateData = true; static SMBByte minorVersion; // SMBIOS rev. minor static SMBByte majorVersion; // SMBIOS rev. major static SMBByte bcdRevisionLo; // DMI rev. minor @@ -223,18 +223,19 @@ "FBD2" /* 19h FBD2 */ }; -static const int kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / - sizeof(SMBMemoryDeviceTypes[0]); +static const int kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / sizeof(SMBMemoryDeviceTypes[0]); // Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode displays char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask) { char *str = NULL; str = getSMBStringForField(structHeader, field); - if (!field) { + if (!field) + { str = NotSpecifiedStr; } - else if (mask) { + else if (mask) + { str = PrivateStr; } @@ -243,7 +244,7 @@ void printHeader(SMBStructHeader *structHeader) { - DBG("Handle: 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length); + DBG("Handle: 0x%04X, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length); } //------------------------------------------------------------------------------------------------------------------------- @@ -372,14 +373,17 @@ // DBG("\tSignature: Type %u, Family %u, Model %u, Stepping %u\n", (eax >> 12) & 0x3, ((eax >> 20) & 0xFF) + ((eax >> 8) & 0x0F), ((eax >> 12) & 0xF0) + ((eax >> 4) & 0x0F), eax & 0xF); // Flags: DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->processorVersion, neverMask)); -// DBG("\tVoltage: 0.%xV\n", ((SMBProcessorInformation *)structHeader)->voltage); +// DBG("\tVoltage: 0.%dV\n", ((SMBProcessorInformation *)structHeader)->voltage); DBG("\tExternal Clock: %d MHz\n", ((SMBProcessorInformation *)structHeader)->externalClock); DBG("\tMax Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->maximumClock); DBG("\tCurrent Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->currentClock); // Status: Populated/Unpopulated - if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) { + if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) + { DBG("\tUpgrade: %s\n", OutOfSpecStr); - } else { + } + else + { DBG("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]); } // L1 Cache Handle: @@ -388,11 +392,18 @@ DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->serialNumber, privateData)); DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->assetTag, neverMask)); DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->partNumber, neverMask)); - if(((SMBProcessorInformation *)structHeader)->coreCount != 0) { - DBG("\tCore Count: %d\n", ((SMBProcessorInformation *)structHeader)->coreCount);} - if(((SMBProcessorInformation *)structHeader)->coreEnabled != 0) { - DBG("\tCore Enabled: %d\n", ((SMBProcessorInformation *)structHeader)->coreEnabled);} - if(((SMBProcessorInformation *)structHeader)->threadCount != 0) { + if(((SMBProcessorInformation *)structHeader)->coreCount != 0) + { + DBG("\tCore Count: %d\n", ((SMBProcessorInformation *)structHeader)->coreCount); + } + + if(((SMBProcessorInformation *)structHeader)->coreEnabled != 0) + { + DBG("\tCore Enabled: %d\n", ((SMBProcessorInformation *)structHeader)->coreEnabled); + } + + if(((SMBProcessorInformation *)structHeader)->threadCount != 0) + { DBG("\tThread Count: %d\n", ((SMBProcessorInformation *)structHeader)->threadCount); } // Characteristics: @@ -533,7 +544,7 @@ { printHeader(structHeader); DBG("Apple specific Processor Type\n"); - DBG("\tCpu-type: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType); + DBG("\tCpu-type = 0x%04X\n", ((SMBOemProcessorType *)structHeader)->ProcessorType); DBG("\n"); } Index: branches/ErmaC/Enoch/i386/libsaio/smbios.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/smbios.h (revision 2542) @@ -23,7 +23,6 @@ #ifndef __LIBSAIO_SMBIOS_H #define __LIBSAIO_SMBIOS_H - /* Based on System Management BIOS Reference Specification v2.4 */ // http://dmtf.org/standards/smbios @@ -33,7 +32,6 @@ typedef uint32_t SMBDWord; typedef uint64_t SMBQWord; - typedef struct DMIEntryPoint { SMBByte anchor[5]; @@ -140,7 +138,7 @@ }; //---------------------------------------------------------------------------------------------------------- -// Struct - BIOS Information (Type 0) +// Struct - BIOS Information (Type 0), Apple uses 24 bytes length typedef struct SMBBIOSInformation { SMB_STRUCT_HEADER @@ -160,7 +158,7 @@ } __attribute__((packed)) SMBBIOSInformation; //---------------------------------------------------------------------------------------------------------- -// Struct - System Information (Type 1) +// Struct - System Information (Type 1), Apple uses 27 bytes length typedef struct SMBSystemInformation { // 2.0+ spec (8 bytes) @@ -199,7 +197,7 @@ kSMBBaseBoardInterconnect = 0x0D // Interconnect board } BASE_BOARD_TYPE; -// Struct - Base Board (or Module) Information (Type 2) +// Struct - Base Board (or Module) Information (Type 2), Apple uses 16 bytes length typedef struct SMBBaseBoard { SMB_STRUCT_HEADER // Type 2 @@ -268,7 +266,7 @@ kSMBChassisSecurityStatusExternalInterfaceLockedEnabled = 0x05 } MISC_CHASSIS_SECURITY_STATE; -// Struct - System Enclosure (Type 3) +// Struct - System Enclosure (Type 3), Apple uses 21 bytes length typedef struct SMBSystemEnclosure { SMB_STRUCT_HEADER // Type 3 @@ -287,7 +285,8 @@ SMBByte containedElementCount; // Number of Contained Element record that follow, in the range 0 to 255 // SMBByte containedElementRecord; // Byte leght of each Contained Element record that follow, in the range 0 to 255 // SMBByte containedElements; // Elements, possibly defined by other SMBIOS structures present in chassis - // SMBString skuNumber; // Number of null-terminated string describing the chassis or enclosure SKU number (2.7+) + // 2.7+ + // SMBString skuNumber; // Number of null-terminated string describing the chassis or enclosure SKU number } __attribute__((packed)) SMBSystemEnclosure; //---------------------------------------------------------------------------------------------------------- @@ -542,7 +541,7 @@ kSMBprocessorUpgradeSocketFM2 = 0x2A } PROCESSOR_UPGRADE; -// Struct - Processor Information (Type 4). +// Struct - Processor Information (Type 4), Apple uses 35 bytes length typedef struct SMBProcessorInformation { // 2.0+ spec (26 bytes) @@ -567,7 +566,7 @@ SMBString serialNumber; SMBString assetTag; SMBString partNumber; - // 2.5+ spec (38 bytes) + // 2.5+ spec (40 bytes) SMBByte coreCount; SMBByte coreEnabled; SMBByte threadCount; @@ -610,7 +609,7 @@ #define kSMBMemoryModuleSizeNotInstalled 0x7F //---------------------------------------------------------------------------------------------------------- -// Struct - Cache Information (Type 7) +// Struct - Cache Information (Type 7), Apple uses 19 bytes length typedef struct SMBCacheInformation { SMB_STRUCT_HEADER // Type 7 @@ -627,7 +626,7 @@ } __attribute__((packed)) SMBCacheInformation; //---------------------------------------------------------------------------------------------------------- -// Struct - System Slots (Type 9) +// Struct - System Slots (Type 9), Apple uses 13 bytes length typedef struct SMBSystemSlot { // 2.0+ spec (12 bytes) @@ -648,7 +647,7 @@ } __attribute__((packed)) SMBSystemSlot; //---------------------------------------------------------------------------------------------------------- -// Struct - OEM Strings (Type 11) +// Struct - OEM Strings (Type 11), Apple uses 5 bytes length typedef struct SMBOEMStrings { SMB_STRUCT_HEADER // Type 11 @@ -684,7 +683,7 @@ kSMBMemoryArrayErrorCorrectionTypeCRC = 0x07 } MEMORY_ERROR_CORRECTION; -// Struct - Physical Memory Array (Type 16) +// Struct - Physical Memory Array (Type 16), Apple uses 15 bytes length typedef struct SMBPhysicalMemoryArray { // 2.1+ spec (15 bytes) @@ -700,7 +699,7 @@ } __attribute__((packed)) SMBPhysicalMemoryArray; //---------------------------------------------------------------------------------------------------------- -// Struct - Memory Device (Type 17) +// Struct - Memory Device (Type 17), Apple uses 27 bytes length typedef struct SMBMemoryDevice { // 2.1+ spec (21 bytes) @@ -735,7 +734,7 @@ //---------------------------------------------------------------------------------------------------------- -// Struct - Memory Array Mapped Address (Type 19) +// Struct - Memory Array Mapped Address (Type 19), Apple uses 15 bytes length //typedef struct SMBMemoryArrayMappedAddress //{ // 2.1+ spec @@ -787,7 +786,7 @@ SMBDWord EndAddress; } __attribute__((packed)) FW_REGION_INFO; -// Struct - Firmware Volume Description (Apple Specific - Type 128) +// Struct - Firmware Volume Description (Apple Specific - Type 128), Apple uses 88 bytes length typedef struct SMBFirmwareVolume { SMB_STRUCT_HEADER // Type 128 @@ -861,5 +860,4 @@ extern void decodeSMBIOSTable(SMBEntryPoint *eps); - #endif /* !__LIBSAIO_SMBIOS_H */ Index: branches/ErmaC/Enoch/i386/libsaio/pci.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/pci.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/pci.c (revision 2542) @@ -75,17 +75,23 @@ uint8_t secondary_bus; uint8_t header_type; - for (dev = 0; dev < 32; dev++) { - for (func = 0; func < 8; func++) { + for (dev = 0; dev < 32; dev++) + { + for (func = 0; func < 8; func++) + { pci_addr = PCIADDR(bus, dev, func); id = pci_config_read32(pci_addr, PCI_VENDOR_ID); - if (!id || id == 0xfffffffful) { + if (!id || id == 0xfffffffful) + { continue; } + new = (pci_dt_t*)malloc(sizeof(pci_dt_t)); - if (!new) { + if (!new) + { continue; } + bzero(new, sizeof(pci_dt_t)); new->dev.addr = pci_addr; @@ -99,21 +105,25 @@ new->parent = start; header_type = pci_config_read8(pci_addr, PCI_HEADER_TYPE); - switch (header_type & 0x7f) { - case PCI_HEADER_TYPE_BRIDGE: - case PCI_HEADER_TYPE_CARDBUS: - secondary_bus = pci_config_read8(pci_addr, PCI_SECONDARY_BUS); - if (secondary_bus != 0) { - scan_pci_bus(new, secondary_bus); - } - break; - default: - break; + switch (header_type & 0x7f) + { + case PCI_HEADER_TYPE_BRIDGE: + case PCI_HEADER_TYPE_CARDBUS: + secondary_bus = pci_config_read8(pci_addr, PCI_SECONDARY_BUS); + if (secondary_bus != 0) + { + scan_pci_bus(new, secondary_bus); + } + break; + default: + break; } + *current = new; current = &new->next; - if ((func == 0) && ((header_type & 0x80) == 0)) { + if ((func == 0) && ((header_type & 0x80) == 0)) + { break; } } @@ -131,6 +141,7 @@ { return; } + rcba = pci_config_read32(PCIADDR(0, 0x1f, 0), 0xf0) & ~1; //this is LPC host fd = (uint32_t *)(rcba + 0x3418); /* set SMBus Disable (SD) to 0 */ @@ -144,7 +155,8 @@ { root_pci_dev = malloc(sizeof(pci_dt_t)); - if (!root_pci_dev) { + if (!root_pci_dev) + { return; } @@ -159,11 +171,12 @@ } static char dev_path[256]; + char *get_pci_dev_path(pci_dt_t *pci_dt) { pci_dt_t *current; pci_dt_t *end; - int dev_path_len = 0; + int dev_path_len = 0; dev_path[0] = 0; end = root_pci_dev; @@ -175,11 +188,14 @@ while (current->parent != end) current = current->parent; end = current; - if (current->parent == root_pci_dev) { + if (current->parent == root_pci_dev) + { dev_path_len += snprintf(dev_path + dev_path_len, sizeof(dev_path) - dev_path_len, "PciRoot(0x%x)/Pci(0x%x,0x%x)", uid, current->dev.bits.dev, current->dev.bits.func); - } else { + } + else + { dev_path_len += snprintf(dev_path + dev_path_len, sizeof(dev_path) - dev_path_len, "/Pci(0x%x,0x%x)", current->dev.bits.dev, current->dev.bits.func); Index: branches/ErmaC/Enoch/i386/libsaio/stringTable.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/stringTable.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/stringTable.c (revision 2542) @@ -332,11 +332,12 @@ } /* Return NULL if no option has been successfully retrieved, or the string otherwise */ -const char * getStringForKey(const char * key, config_file_t *config) +const char *getStringForKey(const char *key, config_file_t *config) { - static const char* value =0; - int len=0; - if(!getValueForKey(key, &value, &len, config)) { + static const char *value = 0; + int len = 0; + if (!getValueForKey(key, &value, &len, config)) + { value = 0; } return value; @@ -347,15 +348,19 @@ * The boolean value of the key is stored in 'val'. */ -bool getBoolForKey( const char *key, bool *result_val, config_file_t *config ) +bool getBoolForKey(const char *key, bool *result_val, config_file_t *config) { const char *key_val; int size; - if (getValueForKey(key, &key_val, &size, config)) { - if ( (size >= 1) && (key_val[0] == 'Y' || key_val[0] == 'y') ) { + if (getValueForKey(key, &key_val, &size, config)) + { + if ((size >= 1) && (key_val[0] == 'Y' || key_val[0] == 'y')) + { *result_val = true; - } else { + } + else + { *result_val = false; } return true; @@ -363,14 +368,14 @@ return false; } -bool getIntForKey( const char *key, int *value, config_file_t *config ) +bool getIntForKey(const char *key, int *value, config_file_t *config) { const char *val; int size, sum; bool negative = false; if (getValueForKey(key, &val, &size, config)) { - if ( size ) { + if (size) { if (*val == '-') { negative = true; val++; @@ -508,7 +513,7 @@ if (override) { *val = overrideVal; *size = overrideSize; - return true; + ret = true; } } } @@ -547,7 +552,7 @@ // (and does not modify dict pointer). // Prints an error message if there is a parsing error. // -int ParseXMLFile( char * buffer, TagPtr * dict ) +int ParseXMLFile( char *buffer, TagPtr *dict ) { long length, pos; TagPtr tag; @@ -617,7 +622,7 @@ "/Mac OS X Install Data/com.apple.Boot.plist", // OS X Installer (Lion 10.7) "/OS X Install Data/com.apple.Boot.plist", // OS X Installer (10.8+) "/.IABootFiles/com.apple.Boot.plist", // OS X Installer - "/Library/Preferences/SystemConfiguration/com.apple.Boot.plist", // com.boot.Apple.plist + "/Library/Preferences/SystemConfiguration/com.apple.Boot.plist", // com.apple.Boot.plist "/com.apple.recovery.boot/com.apple.Boot.plist" // OS X Recovery }; Index: branches/ErmaC/Enoch/i386/libsaio/convert.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/convert.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/convert.c (revision 2542) @@ -29,20 +29,20 @@ char *p = (char *)source; int i; char buf[3]; - static EFI_CHAR8 uuid[UUID_LEN+1]=""; + static EFI_CHAR8 uuid[UUID_LEN+1] = ""; buf[2] = '\0'; - for (i=0; i='A' && c<='Z')?((c) | 0x20):(c)) @@ -149,8 +149,7 @@ } -long -MSDOSInitPartition (CICell ih) +long MSDOSInitPartition (CICell ih) { union bootsector *bsp; struct bpb33 *b33; @@ -252,8 +251,7 @@ return 0; } -static int -readSector(CICell ih, off_t readOffset, char *buf, int size) +static int readSector(CICell ih, off_t readOffset, char *buf, int size) { // Caching only FAT entries (4 bytes) by utlizing the cache with sector aligned read requests. if (size < BPS) @@ -280,8 +278,7 @@ return 0; } -static int -msdosreadcluster (CICell ih, uint8_t *buf, int size, off_t *cluster) +static int msdosreadcluster (CICell ih, uint8_t *buf, int size, off_t *cluster) { off_t readOffset; char tmpbuf[8]; @@ -346,8 +343,7 @@ } } -static struct direntry * -getnextdirent (CICell ih, uint16_t *longname, struct msdosdirstate *st) +static struct direntry *getnextdirent (CICell ih, uint16_t *longname, struct msdosdirstate *st) { struct direntry *dirp; while (1) @@ -391,7 +387,9 @@ bcopy (&(wdirp->wePart1),longname+WIN_CHARS*(num-1),sizeof (wdirp->wePart1)); bcopy (&(wdirp->wePart2),longname+WIN_CHARS*(num-1)+5,sizeof (wdirp->wePart2)); bcopy (&(wdirp->wePart3),longname+WIN_CHARS*(num-1)+11,sizeof (wdirp->wePart3)); - } else { + } + else + { uint8_t labelchecksum; int i; longname[st->vfatnumber*WIN_CHARS]=0; @@ -417,16 +415,20 @@ } } -static void -initRoot (struct msdosdirstate *st) +static void initRoot (struct msdosdirstate *st) { - if (msdosrootDirSectors) { /* FAT12 or FAT16 */ + if (msdosrootDirSectors) + { + /* FAT12 or FAT16 */ st->root16 = 1; st->vfatchecksum = 0; st->nument = 0; st->cluster = 0; st->vfatnumber = 0; - } else { /* FAT32 */ + } + else + { + /* FAT32 */ st->root16 = 0; st->vfatchecksum = 0; st->nument = 0; @@ -568,8 +570,7 @@ {0x00A0,0x00A0} }; -static int -checkname (uint16_t *ucsname, int ucslen, struct direntry *dirp, uint16_t *vfatname) +static int checkname (uint16_t *ucsname, int ucslen, struct direntry *dirp, uint16_t *vfatname) { uint16_t tmp[15]; if (vfatname[0]) @@ -605,8 +606,7 @@ } -static struct direntry * -getdirpfrompath (CICell ih, char *dirspec, uint8_t *buf) +static struct direntry *getdirpfrompath (CICell ih, char *dirspec, uint8_t *buf) { struct msdosdirstate st; struct direntry *dirp; @@ -633,10 +633,16 @@ { for (;*ptr && *ptr!='/';ptr++); if (!*ptr) + { return dirp; + } + ptr++; if (!*ptr) + { return dirp; + } + for (slash=ptr;*slash && *slash!='/';slash++); c=*slash; *slash=0; @@ -645,7 +651,10 @@ ucsname[ucslenhost]=0; *slash=c; if (!(dirp->deAttributes & ATTR_DIRECTORY)) + { return 0; + } + st.root16 = 0; st.vfatchecksum = 0; st.nument = 0; @@ -662,8 +671,8 @@ char ** name, long * flags, u_int32_t * time, FinderInfo * finderInfo, long * infoValid) { - struct msdosdirstate *st; - struct direntry *dirp; + struct msdosdirstate *st; + struct direntry *dirp; uint16_t vfatname[WIN_MAXLEN+2*WIN_CHARS]; if (MSDOSInitPartition (ih)<0) { @@ -714,7 +723,10 @@ } else + { initRoot (st); + } + *dirIndex = (long long) (long) st; } while((dirp = getnextdirent (ih, vfatname, st))&& (dirp->deAttributes & ATTR_VOLUME)); @@ -748,21 +760,26 @@ free (st); return -1; } + for (i=7;i>=0;i--) + { if (dirp->deName[i]!=' ') { break; } + } j=i+1; tmp[i+1]=0; for(;i>=0;i--) tmp[i]=(dirp->deName[i]>=128)?cp850[dirp->deName[i]-128][0]:tolower(dirp->deName[i]); for (i=2;i>=0;i--) + { if (dirp->deName[8+i]!=' ') { break; } + } if (i>=0) { @@ -770,7 +787,10 @@ tmp[j+i+1]=0; k=j+i+1; for(;i>=0;i--) + { tmp[j+i]=(dirp->deName[i]>=128)?cp850[dirp->deName[i+8]-128][0]:tolower(dirp->deName[i+8]); + } + j=k; } @@ -797,8 +817,7 @@ return 0; } -long -MSDOSReadFile(CICell ih, char * filePath, void *base, uint64_t offset, uint64_t length) +long MSDOSReadFile(CICell ih, char * filePath, void *base, uint64_t offset, uint64_t length) { uint8_t *buf; off_t cluster; @@ -819,11 +838,14 @@ { filePath++; } + buf = malloc(msdosclustersize); + if (!buf) { return -1; } + bzero(buf,msdosclustersize); dirp = getdirpfrompath (ih, filePath, buf); @@ -832,23 +854,32 @@ free (buf); return -1; } + cluster = OSReadLittleInt16 ((dirp->deStartCluster),0); + if (msdosfatbits == 32) { cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16; } size = (uint32_t)OSReadLittleInt32 ((dirp->deFileSize),0); + if (size<=offset) { free (buf); return -1; } + nskip=offset/msdosclustersize; - for (i=0;isize-offset) { toread=size-offset; @@ -884,11 +915,19 @@ uint8_t *buf; off_t cluster; struct direntry *dirp; + if (MSDOSInitPartition (ih)<0) + { return -1; + } + if (filePath[0] == '/') + { filePath++; + } + buf = malloc(msdosclustersize); + if (!buf) { return -1; @@ -896,32 +935,47 @@ bzero(buf,msdosclustersize); dirp = getdirpfrompath (ih, filePath, buf); + if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY)) { free (buf); return -1; } + cluster = OSReadLittleInt16 ((dirp->deStartCluster),0); + if (msdosfatbits == 32) + { cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16; - + } + off_t clusn; - switch (msdosfatbits) { + switch (msdosfatbits) + { case 32: if (cluster < CLUST_FIRST ||cluster >= CLUST_RSRVD32) + { return -1; + } + clusn = cluster - CLUST_FIRST; break; case 16: if (cluster < CLUST_FIRST ||cluster >= CLUST_RSRVD16) + { return 0; + } + clusn = cluster - CLUST_FIRST; break; case 12: if (cluster < CLUST_FIRST ||cluster >= CLUST_RSRVD12) + { return 0; + } + clusn = cluster - CLUST_FIRST; break; default: @@ -952,30 +1006,37 @@ label[0] = 0xE5; /* Remove any trailing spaces */ - for (i=LABEL_LENGTH-1; i>=0; --i) { - if (label[i] == ' ') - label[i] = 0; - else - break; + for (i=LABEL_LENGTH-1; i>=0; --i) + { + if (label[i] == ' ') + { + label[i] = 0; + } + else + { + break; + } } + labelucs[i++]=0; len=i; for (;i>=0;--i) + { labelucs[i]=label[i]>=128?cp850[label[i]-128][1]:(label[i]); - + } + utf_encodestr(labelucs, len, (uint8_t *)str, strMaxLen, OSHostByteOrder() ); } - void MSDOSGetDescription(CICell ih, char *str, long strMaxLen) { - struct direntry *dirp; - uint8_t label[LABEL_LENGTH+1]; - uint16_t vfatlabel[WIN_MAXLEN+2*WIN_CHARS]; - struct msdosdirstate st; - int labelfound = 0; + struct direntry *dirp; + uint8_t label[LABEL_LENGTH+1]; + uint16_t vfatlabel[WIN_MAXLEN+2*WIN_CHARS]; + struct msdosdirstate st; + int labelfound = 0; - if (MSDOSInitPartition (ih)<0) + if (MSDOSInitPartition(ih) < 0) { str[0]=0; return; @@ -986,7 +1047,7 @@ label[0] = '\0'; - initRoot (&st); + initRoot(&st); st.buf = malloc(msdosclustersize); if (!st.buf) { @@ -995,7 +1056,8 @@ bzero(st.buf,msdosclustersize); while ((dirp = getnextdirent (ih, vfatlabel, &st))) - if (dirp->deAttributes & ATTR_VOLUME) { + if (dirp->deAttributes & ATTR_VOLUME) + { strncpy((char *)label, (char *)dirp->deName, LABEL_LENGTH); labelfound = 1; break; @@ -1010,8 +1072,10 @@ utf_encodestr(vfatlabel, i, (u_int8_t *)str, strMaxLen, OSLittleEndian ); } else if (labelfound) + { fixLabel(label, str, strMaxLen); - + } + /* else look in the boot blocks */ if (!labelfound || str[0] == '\0') { @@ -1039,8 +1103,7 @@ return; } -long -MSDOSGetUUID(CICell ih, char *uuidStr) +long MSDOSGetUUID(CICell ih, char *uuidStr) { char *buf = malloc (512); if (!buf) @@ -1060,10 +1123,10 @@ if (msdosfatbits == 32) { /* It's FAT32 */ memcpy(uuidStr+12, (char *)((struct extboot *)bsp->bs710.bsExt)->exVolumeID, 4); } - else if (msdosfatbits == 16) { + else if (msdosfatbits == 16) + { memcpy(uuidStr+12, (char *)((struct extboot *)bsp->bs50.bsExt)->exVolumeID, 4); } free (buf); - return 0; - + return 0; } Index: branches/ErmaC/Enoch/i386/libsaio/state_generator.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/state_generator.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/state_generator.c (revision 2542) @@ -69,10 +69,10 @@ 0x00, 0x00, 0x00, 0x79, 0x00, }; -struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt) +struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt *dsdt) { - if (Platform.CPU.Vendor != 0x756E6547) + if (Platform.CPU.Vendor != CPUID_VENDOR_INTEL) // 0x756E6547 { DBG("Not an Intel platform: P-States will not be generated !!!\n"); return NULL; @@ -355,10 +355,10 @@ return NULL; } -struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt) +struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt *fadt) { - if (Platform.CPU.Vendor != 0x756E6547) + if (Platform.CPU.Vendor != CPUID_VENDOR_INTEL) // 0x756E6547 { DBG("Not an Intel platform: C-States will not be generated !!!\n"); return NULL; @@ -370,7 +370,7 @@ return NULL; } - struct acpi_2_dsdt* dsdt = (void*)fadt->DSDT; + struct acpi_2_dsdt *dsdt = (void *)fadt->DSDT; if (dsdt == NULL) { Index: branches/ErmaC/Enoch/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/fake_efi.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/fake_efi.c (revision 2542) @@ -123,7 +123,7 @@ // We only do adds, not modifications and deletes like InstallConfigurationTable if (i >= MAX_CONFIGURATION_TABLE_ENTRIES) { - stop("Ran out of space for configuration tables. Increase the reserved size in the code.\n"); + stop("Fake EFI [ERROR]: Ran out of space for configuration tables [%d]. Increase the reserved size in the code.\n", i); } if (pGuid == NULL) @@ -142,7 +142,7 @@ Node *tableNode = DT__AddChild(gEfiConfigurationTableNode, mallocStringForGuid(pGuid)); // Use the pointer to the GUID we just stuffed into the system table - DT__AddProperty(tableNode, "guid", sizeof(EFI_GUID), (void*)pGuid); + DT__AddProperty(tableNode, "guid", sizeof(EFI_GUID), (void *)pGuid); // The "table" property is the 32-bit (in our implementation) physical address of the table DT__AddProperty(tableNode, "table", sizeof(void*) * 2, table); @@ -551,15 +551,15 @@ */ /* - * Must be called AFTER setup Acpi because we need to take care of correct - * facp content to reflect in ioregs + * Must be called AFTER setupAcpi because we need to take care of correct + * FACP content to reflect in ioregs */ void setupSystemType() { Node *node = DT__FindNode("/", false); if (node == 0) { - stop("Couldn't get root node"); + stop("Couldn't get root '/' node"); } // we need to write this property after facp parsing // Export system-type only if it has been overrriden by the SystemType option @@ -676,7 +676,7 @@ node = DT__FindNode("/", false); if (node == 0) { - stop("Couldn't get root node"); + stop("Couldn't get root '/' node"); } const char *boardid = getStringForKey("SMboardproduct", &bootInfo->smbiosConfig); if (boardid) @@ -695,7 +695,7 @@ chosenNode = DT__FindNode("/chosen", false); if (chosenNode == 0) { - stop("Couldn't get chosen node"); + stop("setupChosenNode: Couldn't get '/chosen' node"); } int length = strlen(gBootUUIDString); Index: branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c (revision 2542) @@ -31,7 +31,6 @@ switch (Platform.CPU.Family) { case 0x06: - { switch (Platform.CPU.Model) { // set external clock to 0 for SANDY @@ -49,12 +48,13 @@ break; default: value->word = (uint16_t)(Platform.CPU.FSBFrequency/1000000LL); + break; } - } break; default: value->word = (uint16_t)(Platform.CPU.FSBFrequency/1000000LL); + break; } } else @@ -78,7 +78,6 @@ switch (Platform.CPU.Family) { case 0x06: - { switch (Platform.CPU.Model) { case CPUID_MODEL_PENTIUM_M: @@ -138,15 +137,19 @@ value->word = qpibusspeed; return true; } + break; + default: - break; //Unsupported CPU type + break; } - } + break; + default: break; } } - return false; + + return false; //Unsupported CPU type } uint16_t simpleGetSMBOemProcessorType(void) @@ -181,7 +184,7 @@ { case 0x0F: case 0x06: - { + switch (Platform.CPU.Model) { case CPUID_MODEL_PENTIUM_M: @@ -381,7 +384,8 @@ default: break; // Unsupported CPU type } - } + break; + default: break; } @@ -429,14 +433,17 @@ static int idx = -1; int map; - if (!bootInfo->memDetect) { + if (!bootInfo->memDetect) + { return false; } idx++; - if (idx < MAX_RAM_SLOTS) { + if (idx < MAX_RAM_SLOTS) + { map = Platform.DMI.DIMM[idx]; - if (Platform.RAM.DIMM[map].InUse && Platform.RAM.DIMM[map].Frequency != 0) { + if (Platform.RAM.DIMM[map].InUse && Platform.RAM.DIMM[map].Frequency != 0) + { DBG("RAM Detected Freq = %d Mhz\n", Platform.RAM.DIMM[map].Frequency); value->dword = Platform.RAM.DIMM[map].Frequency; return true; Index: branches/ErmaC/Enoch/i386/libsaio/state_generator.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/state_generator.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/state_generator.h (revision 2542) @@ -15,8 +15,8 @@ #include "aml_generator.h" #include "libsaio.h" -void get_acpi_cpu_names(uint8_t* dsdt, uint32_t length); -struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt); -struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt); +void get_acpi_cpu_names(uint8_t *dsdt, uint32_t length); +struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt *fadt); +struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt *dsdt); #endif /* !__LIBSAIO_STATE_GENERATOR_H */ Index: branches/ErmaC/Enoch/i386/libsaio/saio_internal.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/saio_internal.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsaio/saio_internal.h (revision 2542) @@ -98,6 +98,7 @@ extern void stop(const char *format, ...) __attribute__ ((noreturn)); //Azi: replace getc/getchar with ? console.c extern void pause(); +extern uint64_t getRTCdatetime(); /* disk.c */ extern void rescanBIOSDevice(int biosdev); Index: branches/ErmaC/Enoch/i386/include/IOKit/storage/IOFDiskPartitionScheme.h =================================================================== --- branches/ErmaC/Enoch/i386/include/IOKit/storage/IOFDiskPartitionScheme.h (revision 2541) +++ branches/ErmaC/Enoch/i386/include/IOKit/storage/IOFDiskPartitionScheme.h (revision 2542) @@ -56,7 +56,7 @@ UInt8 beghead; /* (beginning head) */ UInt8 begsect; /* (beginning sector; beginning cylinder, high 2 bits) */ UInt8 begcyl; /* (beginning cylinder, low 8 bits) */ - UInt8 systid; /* (type) */ + UInt8 systid; /* (OS type) */ UInt8 endhead; /* (ending head) */ UInt8 endsect; /* (ending sector; ending cylinder, high 2 bits) */ UInt8 endcyl; /* (ending cylinder, low 8 bits) */ Index: branches/ErmaC/Enoch/i386/boot2/graphics.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2542) @@ -279,6 +279,7 @@ // Get mode information. bzero( &modeInfo, sizeof(modeInfo) ); + err = getVBEModeInfo( *modePtr, &modeInfo ); if ( err != errSuccess ) { @@ -427,23 +428,23 @@ unsigned char bitsPerPixel, unsigned short refreshRate ) { - VBEModeInfoBlock minfo; - unsigned short mode; - unsigned short vesaVersion; - int err = errFuncNotSupported; + VBEModeInfoBlock minfo; + unsigned short mode; + unsigned short vesaVersion; + int err = errFuncNotSupported; - do { - mode = getVESAModeWithProperties( width, height, bitsPerPixel, + do { + mode = getVESAModeWithProperties( width, height, bitsPerPixel, maColorModeBit | maModeIsSupportedBit | maGraphicsModeBit | maLinearFrameBufferAvailBit, 0, &minfo, &vesaVersion ); - if ( mode == modeEndOfList ) - { - break; - } + if ( mode == modeEndOfList ) + { + break; + } // // FIXME : generateCRTCTiming() causes crash. @@ -484,9 +485,9 @@ // Set the mode with default refresh rate. - err = setVBEMode( mode | kLinearFrameBufferBit, NULL ); + err = setVBEMode(mode | kLinearFrameBufferBit, NULL); - if ( err != errSuccess ) + if (err != errSuccess) { break; } @@ -520,8 +521,7 @@ bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); - } - while ( 0 ); + } while ( 0 ); return err; } @@ -1120,28 +1120,29 @@ unsigned long numbers[], unsigned long maxArrayCount ) { - char * propStr; - unsigned long count = 0; + char *propStr; + unsigned long count = 0; - propStr = newStringForKey( (char *) propKey , &bootInfo->chameleonConfig ); - if ( propStr ) + propStr = newStringForKey((char *)propKey , &bootInfo->chameleonConfig); + + if (propStr) { - char * delimiter = propStr; - char * p = propStr; + char *delimiter = propStr; + char *p = propStr; - while ( count < maxArrayCount && *p != '\0' ) + while ((count < maxArrayCount) && (*p != '\0')) { - unsigned long val = strtoul( p, &delimiter, 10 ); - if ( p != delimiter ) + unsigned long val = strtoul(p, &delimiter, 10); + if (p != delimiter) { numbers[count++] = val; p = delimiter; } - while ( ( *p != '\0' ) && !isdigit(*p) ) + while ((*p != '\0') && !isdigit(*p)) p++; } - free( propStr ); + free(propStr); } return count; @@ -1163,7 +1164,7 @@ // Use the default resolution if we don't have an initialized GUI. if (gui.screen.width == 0 || gui.screen.height == 0) { - gui.screen.width = DEFAULT_SCREEN_WIDTH; + gui.screen.width = DEFAULT_SCREEN_WIDTH; gui.screen.height = DEFAULT_SCREEN_HEIGHT; } @@ -1183,7 +1184,7 @@ if ( params[2] == 888 ) params[2] = 32; - return setVESAGraphicsMode( params[0], params[1], params[2], params[3] ); + return setVESAGraphicsMode( params[0], params[1], params[2], params[3] ); } //========================================================================== @@ -1199,7 +1200,7 @@ if ( mode == GRAPHICS_MODE ) { - if ( (err=initGraphicsMode ()) == errSuccess ) + if ( (err = initGraphicsMode()) == errSuccess ) { if (gVerboseMode) { @@ -1215,14 +1216,14 @@ if ( (mode == VGA_TEXT_MODE) || (err != errSuccess) ) { - count = getNumberArrayFromProperty( kTextModeKey, params, 2 ); + count = getNumberArrayFromProperty(kTextModeKey, params, 2); if ( count < 2 ) { params[0] = 80; // Default text mode is 80x25. params[1] = 25; } - setVESATextMode( params[0], params[1], 4 ); + setVESATextMode(params[0], params[1], 4); bootArgs->Video.v_display = VGA_TEXT_MODE; } @@ -1239,15 +1240,15 @@ unsigned short vesaVersion; unsigned short mode = modeEndOfList; - getNumberArrayFromProperty( kGraphicsModeKey, params, 4); + getNumberArrayFromProperty(kGraphicsModeKey, params, 4); - mode = getVESAModeWithProperties( params[0], params[1], params[2], + mode = getVESAModeWithProperties(params[0], params[1], params[2], maColorModeBit | maModeIsSupportedBit | maGraphicsModeBit | maLinearFrameBufferAvailBit, 0, - &minfo, &vesaVersion ); + &minfo, &vesaVersion); params[0] = minfo.XResolution; params[1] = minfo.YResolution; Index: branches/ErmaC/Enoch/i386/boot2/drivers.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/drivers.c (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/drivers.c (revision 2542) @@ -110,15 +110,17 @@ static long InitDriverSupport(void); ModulePtr gModuleHead, gModuleTail; -static TagPtr gPersonalityHead, gPersonalityTail; -static char * gExtensionsSpec; -static char * gDriverSpec; -static char * gFileSpec; -static char * gTempSpec; -static char * gFileName; +static TagPtr gPersonalityHead, gPersonalityTail; +static char *gExtensionsSpec; +static char *gDriverSpec; +static char *gFileSpec; +static char *gTempSpec; +static char *gFileName; +// Bungo +char *gDarwinBuildVerStr = "Darwin Kernel Version"; /*static*/ unsigned long -Adler32( unsigned char * buffer, long length ) +Adler32( unsigned char *buffer, long length ) { long cnt; unsigned long result, lowHalf, highHalf; @@ -186,7 +188,7 @@ { if (NetLoadDrivers(dirSpec) != 0) { - error("Could not load drivers from the network\n"); + error("LoadDrivers: Could not load drivers from the network\n"); return -1; } } @@ -238,7 +240,7 @@ if (gMKextName[0] != '\0') { - verbose("LoadDrivers: Loading from [%s]\n", gMKextName); + verbose("LoadDrivers: Loading from '%s'\n", gMKextName); if ( LoadDriverMKext(gMKextName) != 0 ) { error("Could not load %s\n", gMKextName); @@ -295,7 +297,7 @@ || (((gBootMode & kBootModeSafe) == 0) && (time == (time2 + 1)))) { snprintf(gDriverSpec, sizeof(altDirSpec) + 18, "%sExtensions.mkext", altDirSpec); - verbose("LoadDrivers: Loading from [%s]\n", gDriverSpec); + verbose("LoadDrivers: Loading from '%s'\n", gDriverSpec); if (LoadDriverMKext(gDriverSpec) == 0) { @@ -877,12 +879,10 @@ static char gPlatformName[64]; #endif -char *gDarwinBuildVerStr = "Darwin Kernel Version"; // Bungo - long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize) { long ret = 0; - compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary; + compressed_kernel_header *kernel_header = (compressed_kernel_header *)binary; u_int32_t uncompressed_size = 0, size = 0, adler32 = 0; void *buffer = NULL; unsigned long len = 0; @@ -899,7 +899,7 @@ if (kernel_header->signature == OSSwapBigToHostConstInt32('comp')) { - DBG("Decompressing Kernel: "); + DBG("Decompressing Kernel Cache"); if ((kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) && (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzvn'))) @@ -912,12 +912,10 @@ { verbose ("Decompressing Kernel Using lzss\n"); } - else + + if (kernel_header->compress_type == OSSwapBigToHostConstInt32('lzvn')) { - if (kernel_header->compress_type == OSSwapBigToHostConstInt32('lzvn')) - { - verbose ("Decompressing Kernel Using lzvn\n"); - } + verbose ("Decompressing Kernel Using lzvn\n"); } #if NOTDEF @@ -939,11 +937,11 @@ switch (kernel_header->compress_type) { case OSSwapBigToHostConstInt32('lzvn'): - size = lzvn_decode( binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); + size = lzvn_decode(binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); break; case OSSwapBigToHostConstInt32('lzss'): - size = decompress_lzss( (u_int8_t *)binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); + size = decompress_lzss((u_int8_t *)binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); break; default: @@ -955,12 +953,12 @@ { if ( kernel_header->compress_type == OSSwapBigToHostConstInt32('lzvn')) { - error("ERROR: size mismatch from lzvn (found: %x, expected: %x).\n", size, uncompressed_size); + error("ERROR! Size mismatch from lzvn (found: %x, expected: %x).\n", size, uncompressed_size); } if ( kernel_header->compress_type == OSSwapBigToHostConstInt32('lzss')) { - error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size); + error("ERROR! size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size); } return -1; @@ -969,7 +967,7 @@ adler32 = Adler32(binary, uncompressed_size); if (OSSwapBigToHostInt32(kernel_header->adler32) != adler32) { - error("ERROR: adler mismatch (found: %x, expected: %x).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32)); + error("ERROR! Adler mismatch (found: %X, expected: %X).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32)); return -1; } @@ -991,7 +989,7 @@ gDarwinBuildVerStr = (char *)binary + size; // Notify modules that the kernel has been decompressed, thinned and is about to be decoded - execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL); + execute_hook("DecodeKernel", (void *)binary, NULL, NULL, NULL); ret = DecodeMachO(binary, rentry, raddr, rsize); if (ret < 0 && archCpuType == CPU_TYPE_X86_64) Index: branches/ErmaC/Enoch/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2542) @@ -72,7 +72,11 @@ */ #define kBootErrorTimeout 5 -bool gOverrideKernel, gEnableCDROMRescan, gScanSingleDrive, useGUI; +bool gOverrideKernel; +bool gEnableCDROMRescan; +bool gScanSingleDrive; +bool useGUI; + static bool gUnloadPXEOnExit = false; static char gCacheNameAdler[64 + 256]; @@ -81,11 +85,15 @@ char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; char gMacOSVersion[8]; -int bvCount = 0, gDeviceCount = 0; +int bvCount = 0; +int gDeviceCount = 0; //int menucount = 0; long gBootMode; /* defaults to 0 == kBootModeNormal */ -BVRef bvr, menuBVR, bvChain; +BVRef bvr; +BVRef menuBVR; +BVRef bvChain; + static unsigned long Adler32(unsigned char *buffer, long length); //static void selectBiosDevice(void); @@ -93,7 +101,6 @@ extern char* msgbuf; void showTextBuffer(char *buf, int size); - //========================================================================== // Zero the BSS. @@ -127,7 +134,7 @@ } //========================================================================== -// execKernel - Load the kernel image (mach-o) and jump to its entry point. +// ExecKernel - Load the kernel image (mach-o) and jump to its entry point. static int ExecKernel(void *binary) { @@ -135,12 +142,12 @@ entry_t kernelEntry; bootArgs->kaddr = bootArgs->ksize = 0; - execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); + execute_hook("ExecKernel", (void *)binary, NULL, NULL, NULL); ret = DecodeKernel(binary, &kernelEntry, (char **) &bootArgs->kaddr, - (int *)&bootArgs->ksize ); + (int *)&bootArgs->ksize); if ( ret != 0 ) { @@ -151,7 +158,7 @@ reserveKernBootStruct(); // Notify modules that the kernel has been decoded - execute_hook("DecodedKernel", (void*)binary, (void*)bootArgs->kaddr, (void*)bootArgs->ksize, NULL); + execute_hook("DecodedKernel", (void *)binary, (void *)bootArgs->kaddr, (void *)bootArgs->ksize, NULL); setupFakeEfi(); @@ -161,7 +168,7 @@ LoadDrivers("/"); } - execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL); + execute_hook("DriversLoaded", (void *)binary, NULL, NULL, NULL); clearActivityIndicator(); @@ -180,7 +187,7 @@ { if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) { - printf("nbpUnloadBaseCode error %d\n", (int) ret); + printf("nbpUnloadBaseCode error %d\n", (int)ret); sleep(2); } } @@ -198,7 +205,7 @@ // verbose mode. if (gVerboseMode) { - setVideoMode( GRAPHICS_MODE, 0 ); + setVideoMode(GRAPHICS_MODE, 0); } else { @@ -256,16 +263,16 @@ if (cacheFile[0] != 0) { strlcpy(kernelCacheFile, cacheFile, sizeof(kernelCacheFile)); - verbose("Specified kernel cache file path = %s\n", cacheFile); + verbose("Specified kernel cache file path: %s\n", cacheFile); } else { - // Lion, Mountain Lion, Mavericks, and Yosemite prelink kernel cache file - // for 10.7 10.8 10.9 10.10 if ( LION || MOUNTAIN_LION || MAVERICKS || YOSEMITE) { + // Lion, Mountain Lion, Mavericks, and Yosemite prelink kernel cache file + // for 10.7 10.8 10.9 10.10 snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow); - verbose("10.7, 10.8, 10.9 & 10.10 kernel cache file path = %s\n", kernelCacheFile); + verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCacheFile);; } // Snow Leopard prelink kernel cache file else if ( SNOW_LEOPARD ) @@ -273,34 +280,36 @@ snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); - int lnam = strlen(kernelCacheFile) + 9; //with adler32 - char *name; - u_int32_t prev_time = 0; + int lnam = strlen(kernelCacheFile) + 9; //with adler32 + char *name; + u_int32_t prev_time = 0; - struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); + struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); - /* TODO: handle error? */ - if (cacheDir) - { - while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) + /* TODO: handle error? */ + if (cacheDir) { - if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time - && strstr(name, kernelCacheFile) && (name[lnam] != '.')) + while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) { - snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s%s", kDefaultCachePathSnow, name); - prev_time = time; + if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time + && strstr(name, kernelCacheFile) && (name[lnam] != '.')) + { + snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s%s", kDefaultCachePathSnow, name); + prev_time = time; + } } + verbose("Kernel Cache file path (Mac OS X 10.6.X): %s\n", kernelCacheFile); } - verbose("Snow Leopard kernel cache file path = %s\n", kernelCacheFile); + closedir(cacheDir); } - closedir(cacheDir); - } else { + else + { // Reset cache name. bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64); snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, "%s,%s", gRootDevice, bootInfo->bootFile); adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler)); snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s.%08lX", kDefaultCachePathLeo, adler32); - verbose("Reseted kernel cache file path = %s\n", kernelCacheFile); + verbose("Reseted kernel cache file path: %s\n", kernelCacheFile);; } } @@ -363,7 +372,7 @@ // Check if the kernel file is more recent than the cache file if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime)) { - DBG("Kernel file (%s) is more recent than Kernel Cache (%s)! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile); + DBG("Kernel file '%s' is more recent than Kernel Cache '%s'! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile); return -1; } @@ -372,12 +381,12 @@ // Check if the S/L/E directory time is more recent than the cache file if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime)) { - DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache file (%s)! Ignoring Kernel Cache.\n", kernelCacheFile); + DBG("Folder '/System/Library/Extensions' is more recent than Kernel Cache file '%s'! Ignoring Kernel Cache.\n", kernelCacheFile); return -1; } // Since the kernel cache file exists and is the most recent try to load it - DBG("Loading kernel cache: '%s'\n", kernelCachePath); + DBG("Loading Kernel Cache from: '%s'\n", kernelCachePath); ret = LoadThinFatFile(kernelCachePath, binary); return ret; // ret contain the length of the binary @@ -474,8 +483,10 @@ gEnableCDROMRescan = true; } + // Disable rescanPrompt option by default + rescanPrompt = false; + // Ask the user for Rescan option by setting "Rescan Prompt"=y in system config. - rescanPrompt = false; if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) { gEnableCDROMRescan = promptForRescanOption(); @@ -506,10 +517,10 @@ init_module_system(); #if DEBUG - printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", - gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); - printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", - gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); + printf("Default: %d, ->biosdev: %d, ->part_no: %d ->flags: 0x%08X\n", + gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); + printf("bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: 0x%08X\n", + gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); getchar(); #endif @@ -667,42 +678,54 @@ } getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig); - if (useKernelCache) do { + if (useKernelCache) + { + do + { + // Determine the name of the Kernel Cache + if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) + { + if (val[0] == '\\') + { + len--; + val++; + } + /* FIXME: check len vs sizeof(kernelCacheFile) */ + strlcpy(kernelCacheFile, val, len + 1); + } + else + { + kernelCacheFile[0] = 0; // Use default kernel cache file + } - // Determine the name of the Kernel Cache - if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) { - if (val[0] == '\\') + if (gOverrideKernel && kernelCacheFile[0] == 0) { - len--; - val++; + DBG("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile); + useKernelCache = false; + break; } - /* FIXME: check len vs sizeof(kernelCacheFile) */ - strlcpy(kernelCacheFile, val, len + 1); - } - else - { - kernelCacheFile[0] = 0; // Use default kernel cache file - } - if (gOverrideKernel && kernelCacheFile[0] == 0) - { - DBG("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile); - useKernelCache = false; - break; - } - if (gMKextName[0] != 0) - { - DBG("Using a specific MKext Cache (%s), KernelCache will not be used\n", - gMKextName); - useKernelCache = false; - break; - } - if (gBootFileType != kBlockDeviceType) - useKernelCache = false; + if (gMKextName[0] != 0) + { + DBG("Using a specific MKext Cache (%s), KernelCache will not be used\n", gMKextName); + useKernelCache = false; + break; + } - } while(0); + if (gBootFileType != kBlockDeviceType) + { + useKernelCache = false; + } - do { + } while(0); + } + else + { + DBG("Kernel Cache using disabled by user."); + } + + do + { if (useKernelCache) { ret = LoadKernelCache(kernelCacheFile, &binary); @@ -724,16 +747,11 @@ { if ( !YOSEMITE ) { - //printf(HEADER " (%s).\n", bootInfo->bootFile); snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading / - //sleep(1); } else { - - //printf(HEADER " (%s).\n", bootInfo->bootFile); snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos"%s", bootInfo->bootFile); // Yosemite - //sleep(1); } } else @@ -764,7 +782,7 @@ strlcpy(bootFilePath, bootFile, sizeof(bootFilePath)); } - DBG("Loading kernel: '%s'\n", bootFilePath); + DBG("Loading kernel from: '%s'\n", bootFilePath); ret = LoadThinFatFile(bootFilePath, &binary); if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) { @@ -782,7 +800,7 @@ if (ret <= 0) { - printf("Can't find %s\n", bootFile); + printf("Can't find boot file: '%s'\n", bootFile); sleep(1); if (gBootFileType == kNetworkDeviceType) Index: branches/ErmaC/Enoch/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2542) @@ -43,93 +43,93 @@ */ // kernel cache -#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/" -#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/" +#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/" +#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/" // Lion installer -#define kLionInstallerDataFolder "/Mac OS X Install Data/" -#define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist" +#define kLionInstallerDataFolder "/Mac OS X Install Data/" +#define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist" // Mountain Lion installer -#define kMLionInstallerDataFolder "/OS X Install Data/" -#define kMLionInstallerPlist kMLionInstallerDataFolder "com.apple.Boot.plist" +#define kMLionInstallerDataFolder "/OS X Install Data/" +#define kMLionInstallerPlist kMLionInstallerDataFolder "com.apple.Boot.plist" //kernel path #define kDefaultKernelPathPreYos "/" -#define kDefaultKernelPathForYos "/System/Library/Kernels/" //for Yosemite +#define kDefaultKernelPathForYos "/System/Library/Kernels/" //for Yosemite and newer /* * Keys used in system Boot.plist */ -#define kGraphicsModeKey "Graphics Mode" -#define kTextModeKey "Text Mode" -#define kQuietBootKey "Quiet Boot" -#define kKernelFlagsKey "Kernel Flags" -#define kKernelArchKey "Kernel Architecture" -#define kMKextCacheKey "MKext Cache" -#define kKernelNameKey "Kernel" -#define kKernelCacheKey "Kernel Cache" -#define kUseKernelCache "UseKernelCache" /* boot.c */ -#define kBootDeviceKey "Boot Device" -#define kTimeoutKey "Timeout" -#define kRootDeviceKey "rd" -#define kBootUUIDKey "boot-uuid" -#define kHelperRootUUIDKey "Root UUID" -#define kPlatformKey "platform" -#define kACPIKey "acpi" -#define kCDROMPromptKey "CD-ROM Prompt" -#define kCDROMOptionKey "CD-ROM Option Key" -#define kRescanPromptKey "Rescan Prompt" -#define kRescanKey "Rescan" -#define kScanSingleDriveKey "Scan Single Drive" -#define kInstantMenuKey "Instant Menu" -#define kDefaultKernel "mach_kernel" -#define kOSXKernel "kernel" // Yosemite -#define kGUIKey "GUI" -#define kBootBannerKey "Boot Banner" -#define kShowInfoKey "ShowInfo" /* gui.c */ -#define kWaitForKeypressKey "Wait" +#define kGraphicsModeKey "Graphics Mode" +#define kTextModeKey "Text Mode" +#define kQuietBootKey "Quiet Boot" +#define kKernelFlagsKey "Kernel Flags" +#define kKernelArchKey "Kernel Architecture" +#define kMKextCacheKey "MKext Cache" +#define kKernelNameKey "Kernel" +#define kKernelCacheKey "Kernel Cache" +#define kUseKernelCache "UseKernelCache" /* boot.c */ +#define kBootDeviceKey "Boot Device" +#define kTimeoutKey "Timeout" +#define kRootDeviceKey "rd" +#define kBootUUIDKey "boot-uuid" +#define kHelperRootUUIDKey "Root UUID" +#define kPlatformKey "platform" +#define kACPIKey "acpi" +#define kCDROMPromptKey "CD-ROM Prompt" +#define kCDROMOptionKey "CD-ROM Option Key" +#define kRescanPromptKey "Rescan Prompt" +#define kRescanKey "Rescan" +#define kScanSingleDriveKey "Scan Single Drive" +#define kInstantMenuKey "Instant Menu" +#define kDefaultKernel "mach_kernel" +#define kOSXKernel "kernel" // Yosemite +#define kGUIKey "GUI" +#define kBootBannerKey "Boot Banner" +#define kShowInfoKey "ShowInfo" // gui.c +#define kWaitForKeypressKey "Wait" /* AsereBLN: added these keys */ -#define kUseAtiROM "UseAtiROM" /* ati.c */ -#define kWake "Wake" /* boot.c */ -#define kForceWake "ForceWake" /* boot.c */ -#define kWakeImage "WakeImage" /* boot.c */ -#define kProductVersion "ProductVersion" /* boot.c */ -#define karch "arch" /* boot.c */ -#define kDSDT "DSDT" /* acpi_patcher.c */ -#define kDropSSDT "DropSSDT" /* acpi_patcher.c */ -#define kDeviceProperties "device-properties" /* device_inject.c */ -#define kHidePartition "Hide Partition" /* disk.c */ -#define kRenamePartition "Rename Partition" /* disk.c */ -#define kSMBIOSKey "SMBIOS" /* fake_efi.c */ -//#define kSystemID "SystemId" /* fake_efi.c */ -#define kSystemType "SystemType" /* fake_efi.c */ -#define kUseNvidiaROM "UseNvidiaROM" /* nvidia.c */ -#define kVBIOS "VBIOS" /* nvidia.c && ati.c */ -#define kPCIRootUID "PCIRootUID" /* pci_root.c */ -#define kEthernetBuiltIn "EthernetBuiltIn" /* pci_setup.c */ -#define kGraphicsEnabler "GraphicsEnabler" /* pci_setup.c */ -#define kForceHPET "ForceHPET" /* pci_setup.c */ -#define kUseMemDetect "UseMemDetect" /* platform.c */ -#define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ -#define kUSBBusFix "USBBusFix" /* usb.c */ -#define kEHCIacquire "EHCIacquire" /* usb.c */ -#define kUHCIreset "UHCIreset" /* usb.c */ -#define kEHCIhard "EHCIhard" /* usb.c */ -#define kDefaultPartition "Default Partition" /* sys.c */ +#define kUseAtiROM "UseAtiROM" /* ati.c */ +#define kWake "Wake" /* boot.c */ +#define kForceWake "ForceWake" /* boot.c */ +#define kWakeImage "WakeImage" /* boot.c */ +#define kProductVersion "ProductVersion" /* boot.c */ +#define karch "arch" /* boot.c */ +#define kDSDT "DSDT" /* acpi_patcher.c */ +#define kDropSSDT "DropSSDT" /* acpi_patcher.c */ +#define kDeviceProperties "device-properties" /* device_inject.c */ +#define kHidePartition "Hide Partition" /* disk.c */ +#define kRenamePartition "Rename Partition" /* disk.c */ +#define kSMBIOSKey "SMBIOS" /* fake_efi.c */ +//#define kSystemID "SystemId" /* fake_efi.c */ +#define kSystemType "SystemType" /* fake_efi.c */ +#define kUseNvidiaROM "UseNvidiaROM" /* nvidia.c */ +#define kVBIOS "VBIOS" /* nvidia.c && ati.c */ +#define kPCIRootUID "PCIRootUID" /* pci_root.c */ +#define kEthernetBuiltIn "EthernetBuiltIn" /* pci_setup.c */ +#define kGraphicsEnabler "GraphicsEnabler" /* pci_setup.c */ +#define kForceHPET "ForceHPET" /* pci_setup.c */ +#define kUseMemDetect "UseMemDetect" /* platform.c */ +#define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ +#define kUSBBusFix "USBBusFix" /* usb.c */ +#define kEHCIacquire "EHCIacquire" /* usb.c */ +#define kUHCIreset "UHCIreset" /* usb.c */ +#define kEHCIhard "EHCIhard" /* usb.c */ +#define kDefaultPartition "Default Partition" /* sys.c */ /* Zenith432: added this */ -#define kXHCILegacyOff "XHCILegacyOff" /* usb.c */ +#define kXHCILegacyOff "XHCILegacyOff" /* usb.c */ /* Duvel300: added this */ -#define kRestartFix "RestartFix" /* acpi_patcher.c */ +#define kRestartFix "RestartFix" /* acpi_patcher.c */ /* Slice: added this */ -#define kPS2RestartFix "PS2RestartFix" /* acpi_patcher.c */ -//#define kInjectEDID "InjectEDID" /* ati.c */ -//#define kCustomEDID "CustomEDID" /* ati.c */ -#define kUseIntelHDMI "UseIntelHDMI" /* ati.c && nvidia.c && gma.c */ +#define kPS2RestartFix "PS2RestartFix" /* acpi_patcher.c */ +//#define kInjectEDID "InjectEDID" /* ati.c */ +//#define kCustomEDID "CustomEDID" /* ati.c */ +#define kUseIntelHDMI "UseIntelHDMI" /* ati.c && nvidia.c && gma.c */ /* Signal64: added this key */ #define kLegacyOff "USBLegacyOff" /* usb.c */ @@ -137,96 +137,96 @@ /* Lebidou: added this key */ /* Meklort: added this key */ -#define kMD0Image "md0" /* ramdisk.h */ -#define kEnableWifi "EnableWifi" /* pci_setup.c */ +#define kMD0Image "md0" /* ramdisk.h */ +#define kEnableWifi "EnableWifi" /* pci_setup.c */ /* Andyvand: added these keys */ -//#define kSSDT "SSDT" /* acpi_patcher.c */ -#define kHPET "HPET" /* acpi_patcher.c */ -#define kSBST "SBST" /* acpi_patcher.c */ -#define kECDT "ECDT" /* acpi_patcher.c */ -#define kASFT "ASFT" /* acpi_patcher.c */ -#define kDMAR "DMAR" /* acpi_patcher.c */ -#define kFADT "FADT" /* acpi_patcher.c */ -#define kAPIC "APIC" /* acpi_patcher.c */ -#define kMCFG "MCFG" /* acpi_patcher.c */ -#define kDropHPET "DropHPET" /* acpi_patcher.c */ -#define kDropSLIC "DropSLIC" /* acpi_patcher.c */ -#define kDropSBST "DropSBST" /* acpi_patcher.c */ -#define kDropECDT "DropECDT" /* acpi_patcher.c */ -#define kDropASFT "DropASFT" /* acpi_patcher.c */ -#define kDropDMAR "DropDMAR" /* acpi_patcher.c */ -#define kUpdateACPI "UpdateACPI" /* acpi_patcher.c */ +//#define kSSDT "SSDT" /* acpi_patcher.c */ +#define kHPET "HPET" /* acpi_patcher.c */ +#define kSBST "SBST" /* acpi_patcher.c */ +#define kECDT "ECDT" /* acpi_patcher.c */ +#define kASFT "ASFT" /* acpi_patcher.c */ +#define kDMAR "DMAR" /* acpi_patcher.c */ +#define kFADT "FADT" /* acpi_patcher.c */ +#define kAPIC "APIC" /* acpi_patcher.c */ +#define kMCFG "MCFG" /* acpi_patcher.c */ +#define kDropHPET "DropHPET" /* acpi_patcher.c */ +#define kDropSLIC "DropSLIC" /* acpi_patcher.c */ +#define kDropSBST "DropSBST" /* acpi_patcher.c */ +#define kDropECDT "DropECDT" /* acpi_patcher.c */ +#define kDropASFT "DropASFT" /* acpi_patcher.c */ +#define kDropDMAR "DropDMAR" /* acpi_patcher.c */ +#define kUpdateACPI "UpdateACPI" /* acpi_patcher.c */ /* Mojodojo: added these keys */ -#define kGeneratePStates "GeneratePStates" /* acpi_patcher.c */ -#define kGenerateCStates "GenerateCStates" /* acpi_patcher.c */ -#define kCSTUsingSystemIO "CSTUsingSystemIO" /* acpi_patcher.c */ -#define kEnableC2State "EnableC2State" /* acpi_patcher.c */ -#define kEnableC3State "EnableC3State" /* acpi_patcher.c */ -#define kEnableC4State "EnableC4State" /* acpi_patcher.c */ -#define kEnableC6State "EnableC6State" /* acpi_patcher.c */ -#define kEnableC7State "EnableC7State" /* acpi_patcher.c */ +#define kGeneratePStates "GeneratePStates" /* acpi_patcher.c */ +#define kGenerateCStates "GenerateCStates" /* acpi_patcher.c */ +#define kCSTUsingSystemIO "CSTUsingSystemIO" /* acpi_patcher.c */ +#define kEnableC2State "EnableC2State" /* acpi_patcher.c */ +#define kEnableC3State "EnableC3State" /* acpi_patcher.c */ +#define kEnableC4State "EnableC4State" /* acpi_patcher.c */ +#define kEnableC6State "EnableC6State" /* acpi_patcher.c */ +#define kEnableC7State "EnableC7State" /* acpi_patcher.c */ /* valv: added these keys */ -#define kbusratio "busratio" /* cpu.c */ -#define kDcfg0 "display_0" /* nvidia.c */ -#define kDcfg1 "display_1" /* nvidia.c */ +#define kbusratio "busratio" /* cpu.c */ +#define kDcfg0 "display_0" /* nvidia.c */ +#define kDcfg1 "display_1" /* nvidia.c */ /* Marchrius: added these keys */ -#define kEnableBacklight "EnableBacklight" /* nvidia.c */ +#define kEnableBacklight "EnableBacklight" /* nvidia.c */ /* Kabyl: added these keys */ -#define kAtiConfig "AtiConfig" /* ati.c */ -#define kAtiPorts "AtiPorts" /* ati.c */ -#define kATYbinimage "ATYbinimage" /* ati.c */ +#define kAtiConfig "AtiConfig" /* ati.c */ +#define kAtiPorts "AtiPorts" /* ati.c */ +#define kATYbinimage "ATYbinimage" /* ati.c */ /* cosmo1: added these keys */ -#define kEnableHDMIAudio "EnableHDMIAudio" /* ati.c && nvidia.c */ +#define kEnableHDMIAudio "EnableHDMIAudio" /* ati.c && nvidia.c */ /* cparm: added these keys */ //#define kRebootOnPanic "RebootOnPanic" -//#define kEnableHiDPI "EnableHiDPI" /* enable High resolution display (aka Retina) */ +//#define kEnableHiDPI "EnableHiDPI" /* enable High resolution display (aka Retina) */ /* ErmaC: added these keys */ -#define kEnableDualLink "EnableDualLink" /* ati.c && nvidia.c && gma.c*/ -#define kNvidiaGeneric "NvidiaGeneric" /* nvidia.c */ -#define kSkipIntelGfx "SkipIntelGfx" /* pci_setup.c */ -#define kSkipNvidiaGfx "SkipNvidiaGfx" /* pci_setup.c */ -#define kSkipAtiGfx "SkipAtiGfx" /* pci_setup.c */ -//#define kUsbInject "USBInject" /* usb.c */ -#define kIntelCapriFB "IntelCapriFB" /* gma.c was HD4K-ig */ -#define kIntelAzulFB "IntelAzulFB" /* gma.c was HD5K-ig */ -#define kAAPLCustomIG "InjectIntel-ig" /* gma.c */ -#define kHDAEnabler "HDAEnabler" /* pci_setup.c */ -#define kHDEFLayoutID "HDEFLayoutID" /* hda.c */ -#define kHDAULayoutID "HDAULayoutID" /* hda.c */ -#define kBGRT "BGRT" /* acpi_patcher.c */ -#define kDropBGRT "DropBGRT" /* acpi_patcher.c */ -#define kDropMCFG "DropMCFG" /* acpi_patcher.c */ -#define kDropAPIC "DropAPIC" /* acpi_patcher.c */ +#define kEnableDualLink "EnableDualLink" /* ati.c && nvidia.c && gma.c*/ +#define kNvidiaGeneric "NvidiaGeneric" /* nvidia.c */ +#define kSkipIntelGfx "SkipIntelGfx" /* pci_setup.c */ +#define kSkipNvidiaGfx "SkipNvidiaGfx" /* pci_setup.c */ +#define kSkipAtiGfx "SkipAtiGfx" /* pci_setup.c */ +//#define kUsbInject "USBInject" /* usb.c */ +#define kIntelCapriFB "IntelCapriFB" /* gma.c was HD4K-ig */ +#define kIntelAzulFB "IntelAzulFB" /* gma.c was HD5K-ig */ +#define kAAPLCustomIG "InjectIntel-ig" /* gma.c */ +#define kHDAEnabler "HDAEnabler" /* pci_setup.c */ +#define kHDEFLayoutID "HDEFLayoutID" /* hda.c */ +#define kHDAULayoutID "HDAULayoutID" /* hda.c */ +#define kBGRT "BGRT" /* acpi_patcher.c */ +#define kDropBGRT "DropBGRT" /* acpi_patcher.c */ +#define kDropMCFG "DropMCFG" /* acpi_patcher.c */ +#define kDropAPIC "DropAPIC" /* acpi_patcher.c */ /* Karas: added these keys */ -#define kMemFullInfo "ForceFullMemInfo" /* smbios.c */ +#define kMemFullInfo "ForceFullMemInfo" /* smbios.c */ /* Bungo: added these keys */ -// mask private data or no -#define kPrivateData "PrivateData" /* smbios_decode.c */ +#define kPrivateData "PrivateData" /* smbios_decode.c */ + /* * Flags to the booter or kernel */ -#define kVerboseModeFlag "-v" -#define kSafeModeFlag "-x" -#define kIgnoreCachesFlag "-f" -#define kIgnoreBootFileFlag "-F" -#define kSingleUserModeFlag "-s" +#define kVerboseModeFlag "-v" +#define kSafeModeFlag "-x" +#define kIgnoreCachesFlag "-f" +#define kIgnoreBootFileFlag "-F" +#define kSingleUserModeFlag "-s" /* * Booter behavior control */ -#define kBootTimeout -1 -#define kCDBootTimeout 8 +#define kBootTimeout -1 +#define kCDBootTimeout 8 /* * A global set by boot() to record the device that the booter was loaded from. @@ -257,7 +257,7 @@ extern void initialize_runtime(); extern void common_boot(int biosdev); - +bool checkOSVersion(const char * version); /* * usb.c */ @@ -283,7 +283,7 @@ unsigned short y, unsigned short width, unsigned short height, - unsigned char * data + unsigned char *data ); extern int convertImage( unsigned short width, @@ -292,19 +292,20 @@ unsigned char **newImageData ); extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes ); extern void drawBootGraphics(void); -extern void drawPreview(void *src, uint8_t * saveunder); +extern void drawPreview(void *src, uint8_t *saveunder); extern int getVideoMode(void); extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or); /* * drivers.c */ -extern char *gDarwinBuildVerStr; // Bungo extern long LoadExtraDrivers(char * dirSpec); extern long LoadDrivers(char * dirSpec); extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize); - typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin); +// Bungo +extern char *gDarwinBuildVerStr; + /*! Hookable function pointer called during the driver loading phase that allows other code to cause additional drivers to be loaded. @@ -315,7 +316,6 @@ * options.c */ extern char gBootUUIDString[]; - extern int getBootOptions(bool firstRun); extern int processBootOptions(); extern int selectAlternateBootDevice(int bootdevice); @@ -339,16 +339,16 @@ /* * lzvn.c */ -extern size_t lzvn_decode(void * dst, - size_t dst_size, - const void * src, - size_t src_size); +extern size_t lzvn_decode(void *dst, + size_t dst_size, + const void *src, + size_t src_size); /* -extern size_t lzvn_encode(void * dst, - size_t dst_size, - const void * src, - size_t src_size, - void * work); +extern size_t lzvn_encode(void *dst, + size_t dst_size, + const void *src, + size_t src_size, + void *work); */ struct compressed_kernel_header { @@ -369,8 +369,6 @@ void HibernateBootSnow(char *boot_device); /* bmdecompress.c */ -void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel); +void *DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel); -bool checkOSVersion(const char * version); - #endif /* !__BOOT2_BOOT_H */ Index: branches/ErmaC/Enoch/i386/boot2/modules.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/modules.c (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/modules.c (revision 2542) @@ -76,7 +76,7 @@ // Module system was compiled in (Symbols.dylib addr known) module_start = parse_mach(module_data, &load_module, &add_symbol, NULL); - if(module_start && module_start != (void*)0xFFFFFFFF) + if(module_start && (module_start != (void*)0xFFFFFFFF)) { // Notify the system that it was laoded module_loaded(SYMBOLS_MODULE, module_start, SYMBOLS_AUTHOR, SYMBOLS_DESCRIPTION, SYMBOLS_VERSION, SYMBOLS_COMPAT); @@ -88,7 +88,8 @@ else { // The module does not have a valid start function - printf("Unable to start %s at 0x%x\n", SYMBOLS_MODULE, module_data); pause(); + printf("Unable to start %s at 0x%x\n", SYMBOLS_MODULE, module_data); + pause(); } } @@ -123,7 +124,7 @@ module_start = parse_mach(module_data, &load_module, &add_symbol, NULL); - if(module_start && module_start != (void*)0xFFFFFFFF) + if(module_start && (module_start != (void*)0xFFFFFFFF)) { // Notify the system that it was laoded module_loaded(name, module_start, NULL, NULL, 0, 0 /*moduleName, NULL, moduleVersion, moduleCompat*/); @@ -164,18 +165,18 @@ */ void load_all_modules() { - char* name; + char *name; long flags; u_int32_t time; - struct dirstuff* moduleDir = opendir("/Extra/modules/"); + struct dirstuff *moduleDir = opendir("/Extra/modules/"); if(!moduleDir) { - verbose("Warning: Unable to open modules folder at '/Extra/modules/'. Ignoring modules.\n"); + verbose("[WARNING!] Unable to open modules folder at '/Extra/modules/'. Ignoring modules.\n"); return; } while (readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) { if(strcmp(&name[strlen(name) - sizeof("dylib")], ".dylib") == 0) { - char* tmp = malloc(strlen(name) + 1); + char *tmp = malloc(strlen(name) + 1); strcpy(tmp, name); if(!load_module(tmp)) @@ -208,6 +209,7 @@ // Check to see if the module has already been loaded if(is_module_loaded(module)) { + DBG("Module '%s' already loaded.\n", module); return 1; } @@ -215,16 +217,17 @@ fh = open(modString, 0); if(fh < 0) { - DBG("WARNING: Unable to locate module %s\n", modString); DBGPAUSE(); + DBG("[WARNING!] Unable to locate module '%s'. Not loaded.\n", modString); + DBGPAUSE(); return 0; } unsigned int moduleSize = file_size(fh); - if(moduleSize == 0) - { - DBG("WARNING: The module %s has a file size of %d, the module will not be loaded.\n", modString, moduleSize); - return 0; - } + if(moduleSize == 0) + { + DBG("[WARNING!] The module '%s' has a file size=%d. Not loading.\n", modString, moduleSize); + return 0; + } char* module_base = (char*) malloc(moduleSize); if (moduleSize && read(fh, module_base, moduleSize) == moduleSize) @@ -237,21 +240,23 @@ // Notify the system that it was laoded module_loaded(module, module_start, NULL, NULL, 0, 0 /*moduleName, NULL, moduleVersion, moduleCompat*/); (*module_start)(); // Start the module - DBG("Module %s Loaded.\n", module); DBGPAUSE(); + DBG("Module %s Loaded.\n", module); + DBGPAUSE(); } #if CONFIG_MODULE_DEBUG else // The module does not have a valid start function. This may be a library. { - printf("WARNING: Unable to start %s\n", module); + printf("[WARNING!] Unable to start module '%s'.\n", module); getchar(); } #else - else msglog("WARNING: Unable to start %s\n", module); + else msglog("[WARNING!] Unable to start module '%s'.\n", module); #endif } else { - DBG("Unable to read in module %s\n.", module); DBGPAUSE(); + DBG("[WARNING!] Unable to read in module '%s'.\n", module); + DBGPAUSE(); retVal = 0; } @@ -311,7 +316,7 @@ new_entry->compat = compat; DBG("Module '%s' by '%s' Loaded.\n", name, author); - DBG("\tInitialization: 0x%X\n", start); + DBG("\tInitialization: 0x%08X\n", start); DBG("\tDescription: %s\n", description); DBG("\tVersion: %d\n", version); // todo: sperate to major.minor.bugfix DBG("\tCompat: %d\n", compat); // todo: ^^^ major.minor.bugfix @@ -320,12 +325,13 @@ int is_module_loaded(const char* name) { // todo sorted search - moduleList_t* entry = loadedModules; + moduleList_t *entry = loadedModules; while(entry) { if(strcmp(entry->name, name) == 0) { - DBG("Located module %s\n", name); DBGPAUSE(); + DBG("Located module %s\n", name); + DBGPAUSE(); return 1; } else @@ -335,7 +341,8 @@ } - DBG("Module %s not loaded\n", name); DBGPAUSE(); + DBG("Module %s not loaded\n", name); + DBGPAUSE(); return 0; } @@ -365,7 +372,7 @@ } #if CONFIG_MODULE_DEBUG - printf("Unable to locate symbol %s\n", name); + printf("[WARNING!] Unable to locate symbol %s.\n", name); getchar(); #endif @@ -431,7 +438,7 @@ } else { - verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic); + verbose("[ERROR!] Invalid mach magic: 0x%08X.\n", ((struct mach_header*)binary)->magic); return NULL; } @@ -564,7 +571,7 @@ break; default: - DBG("Unhandled loadcommand 0x%X\n", loadCommand->cmd & 0x7FFFFFFF); + DBG("[WARNING!] Unhandled loadcommand: 0x%08X.\n", loadCommand->cmd & 0x7FFFFFFF); break; } @@ -925,7 +932,7 @@ } else { - printf("Unable to bind symbol %s\n", symbolName); + printf("[ERROR!] Unable to bind symbol %s.\n", symbolName); getchar(); } @@ -944,7 +951,7 @@ } else { - printf("Unable to bind symbol %s\n", symbolName); + printf("[ERROR!] Unable to bind symbol %s.\n", symbolName); getchar(); } @@ -962,7 +969,7 @@ } else { - printf("Unable to bind symbol %s\n", symbolName); + printf("[ERROR!] Unable to bind symbol %s.\n", symbolName); getchar(); } segmentAddress += (immediate * sizeof(void*)) + sizeof(void*); @@ -987,7 +994,7 @@ } else { - printf("Unable to bind symbol %s\n", symbolName); + printf("[ERROR!] Unable to bind symbol %s.\n", symbolName); getchar(); } break; @@ -1072,7 +1079,8 @@ */ int execute_hook(const char* name, void* arg1, void* arg2, void* arg3, void* arg4) { - DBG("Attempting to execute hook '%s'\n", name); DBGPAUSE(); + DBG("Attempting to execute hook '%s'...\n", name); + DBGPAUSE(); moduleHook_t* hook = hook_exists(name); if(hook) @@ -1086,13 +1094,14 @@ callbacks->callback(arg1, arg2, arg3, arg4); callbacks = callbacks->next; } - DBG("Hook '%s' executed.\n", name); DBGPAUSE(); + DBG("Hook '%s' executed.\n", name); + DBGPAUSE(); return 1; } else { // Callback for this hook doesn't exist; - DBG("No callbacks for '%s' hook.\n", name); + DBG("No callbacks for hook '%s'.\n", name); return 0; } } @@ -1108,22 +1117,25 @@ */ void register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*)) { - DBG("Adding callback for '%s' hook.\n", name); DBGPAUSE(); + DBG("Adding callback for '%s' hook... ", name); + DBGPAUSE(); - moduleHook_t* hook = hook_exists(name); + moduleHook_t *hook = hook_exists(name); if(hook) { // append - callbackList_t* newCallback = malloc(sizeof(callbackList_t)); + callbackList_t *newCallback = malloc(sizeof(callbackList_t)); newCallback->next = hook->callbacks; hook->callbacks = newCallback; newCallback->callback = callback; + DBG("Added.\n"); } else { // create new hook - moduleHook_t* newHook = malloc(sizeof(moduleHook_t)); + DBG("Hook not exists, creating a new hook.\n"); + moduleHook_t *newHook = malloc(sizeof(moduleHook_t)); newHook->name = name; newHook->callbacks = malloc(sizeof(callbackList_t)); newHook->callbacks->callback = callback; @@ -1183,7 +1195,7 @@ void dyld_stub_binder() { - printf("ERROR: dyld_stub_binder was called, should have been take care of by the linker.\n"); + printf("[ERROR!] 'dyld_stub_binder' was called, should have been take care of by the linker.\n"); getchar(); } @@ -1206,13 +1218,13 @@ void register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*)) { - printf("WARNING: register_hook_callback is not supported when compiled in.\n"); + printf("[WARNING!] 'register_hook_callback' is not supported when compiled in.\n"); pause(); } int replace_function(const char* symbol, void* newAddress) { - printf("WARNING: replace_functions is not supported when compiled in.\n"); + printf("[WARNING!] 'replace_functions' is not supported when compiled in.\n"); pause(); return 0; } Index: branches/ErmaC/Enoch/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2542) @@ -916,7 +916,7 @@ int initGUI(void) { - int val; + int val; int len; char dirspec[256]; @@ -938,10 +938,12 @@ #endif } // parse display size parameters - if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0) { + if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && (val > 0)) + { screen_params[0] = val; } - if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && val > 0) { + if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && (val > 0)) + { screen_params[1] = val; } Index: branches/ErmaC/Enoch/i386/boot2/options.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/options.c (revision 2541) +++ branches/ErmaC/Enoch/i386/boot2/options.c (revision 2542) @@ -50,15 +50,16 @@ extern int gDeviceCount; int selectIndex = 0; -MenuItem * menuItems = NULL; +MenuItem *menuItems = NULL; + enum { kMenuTopRow = 5, kMenuMaxItems = 10, kScreenLastRow = 24 }; -extern char* msgbuf; +extern char *msgbuf; void showTextBuffer(char *buf_orig, int size); @@ -185,11 +186,11 @@ //========================================================================== -char gBootArgs[BOOT_STRING_LEN]; -static char * gBootArgsPtr = gBootArgs; -static char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1; -static char booterCommand[BOOT_STRING_LEN]; -static char booterParam[BOOT_STRING_LEN]; +char gBootArgs[BOOT_STRING_LEN]; +static char *gBootArgsPtr = gBootArgs; +static char *gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1; +static char booterCommand[BOOT_STRING_LEN]; +static char booterParam[BOOT_STRING_LEN]; static void clearBootArgs(void) { @@ -260,49 +261,55 @@ static void updateBootArgs( int key ) { - key = ASCII_KEY(key); + key = ASCII_KEY(key); - switch ( key ) - { - case KEY_BKSP: - if ( gBootArgsPtr > gBootArgs ) - { - *--gBootArgsPtr = '\0'; + switch ( key ) + { + case KEY_BKSP: + if ( gBootArgsPtr > gBootArgs ) + { + *--gBootArgsPtr = '\0'; - int x, y, t; - getCursorPositionAndType( &x, &y, &t ); - if ( x == 0 && y ) - { - x = 80; y--; - } - if (x) { - x--; - } + int x, y, t; + getCursorPositionAndType( &x, &y, &t ); + if ( x == 0 && y ) + { + x = 80; y--; + } - if( bootArgs->Video.v_display == VGA_TEXT_MODE ) - { - setCursorPosition( x, y, 0 ); - putca(' ', 0x07, 1); - } - else - { - updateGraphicBootPrompt(); - } - } + if (x) + { + x--; + } + + if( bootArgs->Video.v_display == VGA_TEXT_MODE ) + { + setCursorPosition( x, y, 0 ); + putca(' ', 0x07, 1); + } + else + { + updateGraphicBootPrompt(); + } + } break; - default: - if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd) - { - *gBootArgsPtr++ = key; + default: + if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd) + { + *gBootArgsPtr++ = key; - if( bootArgs->Video.v_display != VGA_TEXT_MODE ) - updateGraphicBootPrompt(); - else if ( key >= ' ' && key < 0x7f) - putchar(key); - } + if( bootArgs->Video.v_display != VGA_TEXT_MODE ) + { + updateGraphicBootPrompt(); + } + else if ( key >= ' ' && key < 0x7f) + { + putchar(key); + } + } - break; + break; } } @@ -375,11 +382,11 @@ // Draw the visible items. if( bootArgs->Video.v_display != VGA_TEXT_MODE ) - + { drawDeviceList(gMenuStart, gMenuEnd, gMenuSelection); - - else { - + } + else + { changeCursor( 0, row, kCursorTypeHidden, &cursorState ); for ( i = gMenuTop; i <= gMenuBottom; i++ ) @@ -905,7 +912,7 @@ // gDeviceCount is actually > 0, so menuItems[selectIndex] exists menuBVR = (BVRef)(menuItems[selectIndex].param); - // what happen is bvChain is empty ? + // what happen if bvChain is empty ? } } @@ -1114,14 +1121,15 @@ bool copyArgument(const char *argName, const char *val, int cnt, char **argP, int *cntRemainingP) { int argLen = argName ? strlen(argName) : 0; - int len = argLen + cnt + 1; // + 1 to account for space. + int len = argLen + cnt + 1; // +1 to account for space if (argName) { len++; // +1 to account for '=' } - if (len > *cntRemainingP) { + if (len > *cntRemainingP) + { error("Warning: boot arguments too long, truncating\n"); return false; } @@ -1179,8 +1187,7 @@ // Maximum config table value size #define VALUE_SIZE 2048 -int -processBootOptions() +int processBootOptions() { const char *cp = gBootArgs; const char *val = 0; @@ -1197,10 +1204,11 @@ skipblanks( &cp ); // Update the unit and partition number. - - if ( gBootVolume ) { - if (!( gBootVolume->flags & kBVFlagNativeBoot )) { - readBootSector( gBootVolume->biosdev, gBootVolume->part_boff, (void *) 0x7c00 ); + if (gBootVolume) + { + if (!(gBootVolume->flags & kBVFlagNativeBoot)) + { + readBootSector(gBootVolume->biosdev, gBootVolume->part_boff, (void *)0x7c00); // // Setup edx, and signal intention to chain load the // foreign booter. @@ -1217,7 +1225,8 @@ } // If no boot volume fail immediately because we're just going to fail // trying to load the config file anyway. - else { + else + { return -1; } @@ -1226,7 +1235,8 @@ // Load config table specified by the user, or use the default. - if (!getValueForBootKey(cp, "config", &val, &cnt)) { + if (!getValueForBootKey(cp, "config", &val, &cnt)) + { val = 0; cnt = 0; } @@ -1259,15 +1269,12 @@ { if( YOSEMITE ) // is 10.10 { - strlcpy( bootInfo->bootFile, kOSXKernel, sizeof(bootInfo->bootFile) ); - //printf(HEADER "/System/Library/Kernels/%s\n", bootInfo->bootFile); } else { // OSX is not 10.10 strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) ); - //printf(HEADER "/%s\n", bootInfo->bootFile); } } } @@ -1299,8 +1306,7 @@ argP = bootArgs->CommandLine; // Get config kernel flags, if not ignored. - if (getValueForBootKey(cp, kIgnoreBootFileFlag, &val, &cnt) || - !getValueForKey( kKernelFlagsKey, &val, &cnt, &bootInfo->bootConfig )) + if (getValueForBootKey(cp, kIgnoreBootFileFlag, &val, &cnt) || !getValueForKey(kKernelFlagsKey, &val, &cnt, &bootInfo->bootConfig)) { val = ""; cnt = 0; @@ -1378,7 +1384,7 @@ { copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); } - strlcpy( gRootDevice, val, (cnt + 1)); + strlcpy(gRootDevice, val, (cnt + 1)); } /* Index: branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.c (revision 2541) +++ branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.c (revision 2542) @@ -350,7 +350,9 @@ } else { verbose(", BT_ATI_2\n"); } - } else { + } + else + { /* * check if we have NVIDIA Index: branches/ErmaC/Enoch/i386/modules/Resolution/edid.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/Resolution/edid.c (revision 2541) +++ branches/ErmaC/Enoch/i386/modules/Resolution/edid.c (revision 2542) @@ -265,10 +265,12 @@ yResolution = val; } */ - if(!xResolution || !yResolution || !bpResolution) { + if(!xResolution || !yResolution || !bpResolution) + { char* edidInfo = readEDID(); - if(!edidInfo) { + if(!edidInfo) + { return; } @@ -278,10 +280,13 @@ //yResolution = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4); //Slice - done here - if(fb_parse_edid((struct EDID *)edidInfo, &mode) == 0) { + if(fb_parse_edid((struct EDID *)edidInfo, &mode) == 0) + { xResolution = DEFAULT_SCREEN_WIDTH; yResolution = DEFAULT_SCREEN_HEIGHT; - } else { + } + else + { xResolution = mode.h_active; yResolution = mode.v_active; } @@ -343,7 +348,8 @@ msglog("Buffer location: 0x%X status: %d\n", SEG(edidInfo) << 16 | OFF(edidInfo), status); int j, i; - for (j = 0; j < 8; j++) { + for (j = 0; j < 8; j++) + { for(i = 0; i < 16; i++) msglog(" 0x%02X", edidInfo[((i+1) * (j + 1)) - 1]); msglog("\n"); } Index: branches/ErmaC/Enoch/i386/libsa/prf.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/prf.c (revision 2541) +++ branches/ErmaC/Enoch/i386/libsa/prf.c (revision 2542) @@ -104,10 +104,13 @@ loop: while ((c = *fmt++) != '%') { - if(c == '\0') { + if(c == '\0') + { return len; } - if (putfn_p) { + + if (putfn_p) + { (*putfn_p)(c, putfn_arg); } len++; @@ -152,7 +155,8 @@ case 'o': case 'O': b = 8; number: - if (putfn_p) { + if (putfn_p) + { printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg); } len++; @@ -160,7 +164,8 @@ case 's': s = (char *)*adx; while ((c = *s++)) { - if (putfn_p) { + if (putfn_p) + { (*putfn_p)(c, putfn_arg); } len++; @@ -168,14 +173,16 @@ } while (width++ < minwidth) { - if (putfn_p) { + if (putfn_p) + { (*putfn_p)(' ', putfn_arg); } len++; } break; case 'c': - if (putfn_p) { + if (putfn_p) + { (*putfn_p)((char)*adx, putfn_arg); } len++; Index: branches/ErmaC/Enoch/i386/libsa/memory.h =================================================================== --- branches/ErmaC/Enoch/i386/libsa/memory.h (revision 2541) +++ branches/ErmaC/Enoch/i386/libsa/memory.h (revision 2542) @@ -90,7 +90,7 @@ #define KERNEL_LEN 0x08000000 #define ZALLOC_ADDR 0x08100000 // 256M zalloc area -#define ZALLOC_LEN 0x10000000 +#define ZALLOC_LEN 0x14000000 #define LOAD_ADDR 0x18100000 // 64M File load buffer #define LOAD_LEN 0x04000000 Index: branches/ErmaC/Enoch/package/po/mk.po =================================================================== --- branches/ErmaC/Enoch/package/po/mk.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/mk.po (revision 2542) @@ -609,7 +609,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -621,7 +621,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -631,10 +631,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -644,10 +643,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/package/po/nl.po =================================================================== --- branches/ErmaC/Enoch/package/po/nl.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/nl.po (revision 2542) @@ -628,7 +628,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -640,7 +640,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -650,10 +650,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -663,10 +662,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/package/po/hr.po =================================================================== --- branches/ErmaC/Enoch/package/po/hr.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/hr.po (revision 2542) @@ -610,7 +610,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -622,7 +622,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -632,10 +632,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -645,10 +644,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/package/po/pl.po =================================================================== --- branches/ErmaC/Enoch/package/po/pl.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/pl.po (revision 2542) @@ -614,7 +614,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -626,7 +626,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -636,10 +636,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -649,10 +648,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/package/po/hu.po =================================================================== --- branches/ErmaC/Enoch/package/po/hu.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/hu.po (revision 2542) @@ -603,7 +603,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -615,7 +615,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -625,10 +625,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -638,10 +637,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/package/po/ca.po =================================================================== --- branches/ErmaC/Enoch/package/po/ca.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/ca.po (revision 2542) @@ -612,7 +612,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -624,7 +624,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -634,10 +634,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -647,10 +646,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/package/po/sr.po =================================================================== --- branches/ErmaC/Enoch/package/po/sr.po (revision 2541) +++ branches/ErmaC/Enoch/package/po/sr.po (revision 2542) @@ -608,7 +608,7 @@ #: Resources/templates/Localizable.strings:126 #, no-wrap msgid "PrivateData=No" -msgstr "" +msgstr "PrivateData=No" #. type: "PrivateData_description" #: Resources/templates/Localizable.strings:127 @@ -620,7 +620,7 @@ #: Resources/templates/Localizable.strings:131 #, no-wrap msgid "USBBusFix=Yes" -msgstr "" +msgstr "USBBusFix=Yes" #. type: "USBBusFix_description" #: Resources/templates/Localizable.strings:132 @@ -630,10 +630,9 @@ #. type: "USBLegacyOff_title" #: Resources/templates/Localizable.strings:134 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "USBLegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "USBLegacyOff=Yes" #. type: "USBLegacyOff_description" #: Resources/templates/Localizable.strings:135 @@ -643,10 +642,9 @@ #. type: "XHCILegacyOff_title" #: Resources/templates/Localizable.strings:137 -#, fuzzy, no-wrap -#| msgid "LegacyLogo=Yes" +#, no-wrap msgid "XHCILegacyOff=Yes" -msgstr "LegacyLogo=Yes" +msgstr "XHCILegacyOff=Yes" #. type: "XHCILegacyOff_description" #: Resources/templates/Localizable.strings:138 Index: branches/ErmaC/Enoch/CHANGES =================================================================== --- branches/ErmaC/Enoch/CHANGES (revision 2541) +++ branches/ErmaC/Enoch/CHANGES (revision 2542) @@ -1,3 +1,4 @@ +- Bungo : Added getRTCdatetime() Int 1Ah function 02h - RTC service - Zenith432 : Use caching with ExFat filesystem - Zenith432 : Add turning off USB legacy for XHCI (XHCILegacyOff) - Zenith432 : saio_types.h, biosfn.c - minor typo in bios-defined data structure that isn't actually used.