Index: branches/ErmaC/Enoch/Chameleon.xcodeproj/project.pbxproj =================================================================== --- branches/ErmaC/Enoch/Chameleon.xcodeproj/project.pbxproj (revision 2322) +++ branches/ErmaC/Enoch/Chameleon.xcodeproj/project.pbxproj (revision 2323) @@ -8,111 +8,96 @@ /* Begin PBXFileReference section */ 019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = ""; }; - 360A04661861F48F0091F464 /* acpi_patcher.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acpi_patcher.c; sourceTree = ""; }; - 360A04671861F48F0091F464 /* acpi_patcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi_patcher.h; sourceTree = ""; }; - 360A04681861F48F0091F464 /* acpi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; - 360A04691861F48F0091F464 /* allocate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = ""; }; - 360A046A1861F48F0091F464 /* aml_generator.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = ""; }; - 360A046B1861F48F0091F464 /* aml_generator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aml_generator.h; sourceTree = ""; }; - 360A046C1861F48F0091F464 /* asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = asm.s; sourceTree = ""; }; - 360A046D1861F48F0091F464 /* ati_reg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ati_reg.h; sourceTree = ""; }; - 360A046E1861F48F0091F464 /* ati.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ati.c; sourceTree = ""; }; - 360A046F1861F48F0091F464 /* ati.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ati.h; sourceTree = ""; }; - 360A04701861F48F0091F464 /* base64-decode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "base64-decode.c"; sourceTree = ""; }; - 360A04711861F48F0091F464 /* befs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = befs.c; sourceTree = ""; }; - 360A04721861F48F0091F464 /* befs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = befs.h; sourceTree = ""; }; - 360A04731861F48F0091F464 /* bios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = ""; }; - 360A04741861F48F0091F464 /* bios.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bios.s; sourceTree = ""; }; - 360A04751861F48F0091F464 /* biosfn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = biosfn.c; sourceTree = ""; }; - 360A04761861F48F0091F464 /* bootargs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bootargs.h; sourceTree = ""; }; - 360A04771861F48F0091F464 /* bootstruct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bootstruct.c; sourceTree = ""; }; - 360A04781861F48F0091F464 /* bootstruct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bootstruct.h; sourceTree = ""; }; - 360A04791861F48F0091F464 /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; - 360A047A1861F48F0091F464 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; - 360A047B1861F48F0091F464 /* console.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = console.c; sourceTree = ""; }; - 360A047C1861F48F0091F464 /* convert.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = convert.c; sourceTree = ""; }; - 360A047D1861F48F0091F464 /* convert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = ""; }; - 360A047E1861F48F0091F464 /* cpu.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = ""; }; - 360A047F1861F48F0091F464 /* cpu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; - 360A04801861F48F0091F464 /* device_inject.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = device_inject.c; sourceTree = ""; }; - 360A04811861F48F0091F464 /* device_inject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = ""; }; - 360A04821861F48F0091F464 /* device_tree.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = ""; }; - 360A04831861F48F0091F464 /* device_tree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = ""; }; - 360A04841861F48F0091F464 /* disk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = disk.c; sourceTree = ""; }; - 360A04851861F48F0091F464 /* disk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = ""; }; - 360A04861861F48F0091F464 /* dram_controllers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = ""; }; - 360A04871861F48F0091F464 /* dram_controllers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = ""; }; - 360A04881861F48F0091F464 /* efi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = efi.h; sourceTree = ""; }; - 360A04891861F48F0091F464 /* exfat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exfat.c; sourceTree = ""; }; - 360A048A1861F48F0091F464 /* exfat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = exfat.h; sourceTree = ""; }; - 360A048B1861F48F0091F464 /* ext2fs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ext2fs.c; sourceTree = ""; }; - 360A048C1861F48F0091F464 /* ext2fs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ext2fs.h; sourceTree = ""; }; - 360A048D1861F48F0091F464 /* fake_efi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fake_efi.c; sourceTree = ""; }; - 360A048E1861F48F0091F464 /* fake_efi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fake_efi.h; sourceTree = ""; }; - 360A048F1861F48F0091F464 /* fdisk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fdisk.h; sourceTree = ""; }; - 360A04901861F48F0091F464 /* freebsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = freebsd.c; sourceTree = ""; }; - 360A04911861F48F0091F464 /* freebsd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = freebsd.h; sourceTree = ""; }; - 360A04921861F48F0091F464 /* gma.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gma.c; sourceTree = ""; }; - 360A04931861F48F0091F464 /* gma.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gma.h; sourceTree = ""; }; - 360A04941861F48F0091F464 /* hda.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hda.c; sourceTree = ""; }; - 360A04951861F48F0091F464 /* hda.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hda.h; sourceTree = ""; }; - 360A04961861F48F0091F464 /* hfs_CaseTables.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hfs_CaseTables.h; sourceTree = ""; }; - 360A04971861F48F0091F464 /* hfs_compare.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hfs_compare.c; sourceTree = ""; }; - 360A04981861F48F0091F464 /* hfs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hfs.c; sourceTree = ""; }; - 360A04991861F48F0091F464 /* hfs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hfs.h; sourceTree = ""; }; - 360A049A1861F48F0091F464 /* hpet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hpet.c; sourceTree = ""; }; - 360A049B1861F48F0091F464 /* hpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hpet.h; sourceTree = ""; }; - 360A049C1861F48F0091F464 /* io_inline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = io_inline.h; sourceTree = ""; }; - 360A049D1861F48F0091F464 /* libsaio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libsaio.h; sourceTree = ""; }; - 360A049E1861F48F0091F464 /* load.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = ""; }; - 360A049F1861F48F0091F464 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - 360A04A01861F48F0091F464 /* md5c.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = md5c.c; sourceTree = ""; }; - 360A04A11861F48F0091F464 /* memvendors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = ""; }; - 360A04A21861F48F0091F464 /* misc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = ""; }; - 360A04A31861F48F0091F464 /* msdos_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msdos_private.h; sourceTree = ""; }; - 360A04A41861F48F0091F464 /* msdos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = msdos.c; sourceTree = ""; }; - 360A04A51861F48F0091F464 /* msdos.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msdos.h; sourceTree = ""; }; - 360A04A61861F48F0091F464 /* nbp_cmd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nbp_cmd.h; sourceTree = ""; }; - 360A04A71861F48F0091F464 /* nbp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nbp.c; sourceTree = ""; }; - 360A04A81861F48F0091F464 /* ntfs_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ntfs_private.h; sourceTree = ""; }; - 360A04A91861F48F0091F464 /* ntfs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ntfs.c; sourceTree = ""; }; - 360A04AA1861F48F0091F464 /* ntfs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ntfs.h; sourceTree = ""; }; - 360A04AB1861F48F0091F464 /* nvidia_helper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nvidia_helper.c; sourceTree = ""; }; - 360A04AC1861F48F0091F464 /* nvidia_helper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nvidia_helper.h; sourceTree = ""; }; - 360A04AD1861F48F0091F464 /* nvidia.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nvidia.c; sourceTree = ""; }; - 360A04AE1861F48F0091F464 /* nvidia.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nvidia.h; sourceTree = ""; }; - 360A04AF1861F48F0091F464 /* openbsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = openbsd.c; sourceTree = ""; }; - 360A04B01861F48F0091F464 /* openbsd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = openbsd.h; sourceTree = ""; }; - 360A04B11861F48F0091F464 /* pci_root.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pci_root.c; sourceTree = ""; }; - 360A04B21861F48F0091F464 /* pci_root.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pci_root.h; sourceTree = ""; }; - 360A04B31861F48F0091F464 /* pci_setup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pci_setup.c; sourceTree = ""; }; - 360A04B41861F48F0091F464 /* pci.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pci.c; sourceTree = ""; }; - 360A04B51861F48F0091F464 /* pci.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pci.h; sourceTree = ""; }; - 360A04B61861F48F0091F464 /* platform.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = ""; }; - 360A04B71861F48F0091F464 /* platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = ""; }; - 360A04B81861F48F0091F464 /* saio_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = saio_internal.h; sourceTree = ""; }; - 360A04B91861F48F0091F464 /* saio_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = saio_types.h; sourceTree = ""; }; - 360A04BA1861F48F0091F464 /* sl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sl.h; sourceTree = ""; }; - 360A04BB1861F48F0091F464 /* smbios_decode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios_decode.c; sourceTree = ""; }; - 360A04BC1861F48F0091F464 /* smbios_getters.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios_getters.c; sourceTree = ""; }; - 360A04BD1861F48F0091F464 /* smbios_getters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = smbios_getters.h; sourceTree = ""; }; - 360A04BE1861F48F0091F464 /* smbios.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios.c; sourceTree = ""; }; - 360A04C01861F48F0091F464 /* smbios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = smbios.h; sourceTree = ""; }; - 360A04C21861F48F0091F464 /* spd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = ""; }; - 360A04C31861F48F0091F464 /* spd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = ""; }; - 360A04C41861F48F0091F464 /* stringTable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = ""; }; - 360A04C51861F48F0091F464 /* sys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = ""; }; - 360A04C61861F48F0091F464 /* table.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = ""; }; - 360A04C71861F48F0091F464 /* term.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = term.h; sourceTree = ""; }; - 360A04C81861F48F0091F464 /* ufs_byteorder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ufs_byteorder.h; sourceTree = ""; }; - 360A04C91861F48F0091F464 /* ufs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ufs.h; sourceTree = ""; }; - 360A04CA1861F48F0091F464 /* usb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = usb.c; sourceTree = ""; }; - 360A04CB1861F48F0091F464 /* vbe.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vbe.c; sourceTree = ""; }; - 360A04CC1861F48F0091F464 /* vbe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = ""; }; - 360A04CD1861F48F0091F464 /* xml.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = ""; }; - 360A04CE1861F48F0091F464 /* xml.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = ""; }; + 3601D701177540B500AE44D2 /* networking.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = networking.c; sourceTree = ""; }; + 3601D702177540B500AE44D2 /* networking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = networking.h; sourceTree = ""; }; + 3617E23517503A6600AE753C /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; + 3617E23617503A6600AE753C /* efi_tables.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = efi_tables.c; sourceTree = ""; }; + 3617E23717503A6600AE753C /* efi_tables.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = efi_tables.h; sourceTree = ""; }; + 3617E23817503A6600AE753C /* error.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; + 3617E23917503A6600AE753C /* libsa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libsa.h; sourceTree = ""; }; + 3617E23A17503A6600AE753C /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 3617E23B17503A6600AE753C /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; + 3617E23C17503A6600AE753C /* prf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = prf.c; sourceTree = ""; }; + 3617E23D17503A6600AE753C /* printf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = ""; }; + 3617E23E17503A6600AE753C /* qsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = ""; }; + 3617E23F17503A6600AE753C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; + 3617E24017503A6600AE753C /* string.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = ""; }; + 3617E24117503A6600AE753C /* strtol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = ""; }; + 3617E24217503A6600AE753C /* zalloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = zalloc.c; sourceTree = ""; }; + 3617E24317503A9300AE753C /* appleboot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = appleboot.h; sourceTree = ""; }; + 3617E24417503A9300AE753C /* appleClut8.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = appleClut8.h; sourceTree = ""; }; + 3617E24517503A9300AE753C /* bmdecompress.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bmdecompress.c; sourceTree = ""; }; + 3617E24617503A9300AE753C /* boot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = boot.c; sourceTree = ""; }; + 3617E24717503A9300AE753C /* boot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boot.h; sourceTree = ""; }; + 3617E24817503A9300AE753C /* boot2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = boot2.s; sourceTree = ""; }; + 3617E24917503A9300AE753C /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; + 3617E24A17503A9300AE753C /* drivers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = ""; }; + 3617E24B17503A9300AE753C /* graphic_utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = ""; }; + 3617E24C17503A9300AE753C /* graphic_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = ""; }; + 3617E24D17503A9300AE753C /* graphics.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = graphics.c; sourceTree = ""; }; + 3617E24E17503A9300AE753C /* graphics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = graphics.h; sourceTree = ""; }; + 3617E24F17503A9300AE753C /* gui.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = ""; }; + 3617E25017503A9300AE753C /* gui.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; + 3617E25117503A9300AE753C /* IOHibernatePrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IOHibernatePrivate.h; sourceTree = ""; }; + 3617E25217503A9300AE753C /* kernel_patcher.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = kernel_patcher.c; sourceTree = ""; }; + 3617E25317503A9300AE753C /* kernel_patcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = kernel_patcher.h; sourceTree = ""; }; + 3617E25417503A9300AE753C /* lzss.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lzss.c; sourceTree = ""; }; + 3617E25517503A9300AE753C /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 3617E25617503A9300AE753C /* mboot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mboot.c; sourceTree = ""; }; + 3617E25717503A9300AE753C /* mboot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mboot.h; sourceTree = ""; }; + 3617E25817503A9300AE753C /* modules_support.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = modules_support.s; sourceTree = ""; }; + 3617E25917503A9300AE753C /* modules.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = modules.c; sourceTree = ""; }; + 3617E25A17503A9300AE753C /* modules.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = modules.h; sourceTree = ""; }; + 3617E25B17503A9300AE753C /* multiboot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = multiboot.h; sourceTree = ""; }; + 3617E25C17503A9300AE753C /* options.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; + 3617E25D17503A9300AE753C /* picopng.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = picopng.c; sourceTree = ""; }; + 3617E25E17503A9300AE753C /* picopng.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = ""; }; + 3617E25F17503A9300AE753C /* prompt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = prompt.c; sourceTree = ""; }; + 3617E26017503A9300AE753C /* ramdisk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ramdisk.c; sourceTree = ""; }; + 3617E26117503A9300AE753C /* ramdisk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ramdisk.h; sourceTree = ""; }; + 3617E26217503A9300AE753C /* resume.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = ""; }; + 3617E26317503A9300AE753C /* WKdm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKdm.h; sourceTree = ""; }; + 3617E26417503A9300AE753C /* WKdmDecompress.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = WKdmDecompress.c; sourceTree = ""; }; 361BC70214BD977700236488 /* Changes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Changes.txt; sourceTree = ""; }; + 361BC70614BD97C800236488 /* dmg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = dmg.zip; path = Icons/dmg.zip; sourceTree = ""; }; + 361BC70714BD97C800236488 /* doc.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = doc.zip; path = Icons/doc.zip; sourceTree = ""; }; + 361BC70814BD97C800236488 /* i386.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = i386.zip; path = Icons/i386.zip; sourceTree = ""; }; + 361BC70914BD97C800236488 /* Icon.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = Icon.zip; path = Icons/Icon.zip; sourceTree = ""; }; + 361BC70A14BD97C800236488 /* pan.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pan.zip; path = Icons/pan.zip; sourceTree = ""; }; 361BC70B14BD97C800236488 /* pkg.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pkg.zip; path = Icons/pkg.zip; sourceTree = ""; }; + 361BC70C14BD97C800236488 /* tm.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = tm.zip; path = Icons/tm.zip; sourceTree = ""; }; + 361DAA8F177D152200CFBF68 /* IntelAzul.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = IntelAzul.txt; path = OptionalSettings/IntelAzul.txt; sourceTree = ""; }; + 362317A617510EB900A25D5D /* br */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = br; path = package/Resources/br.lproj/Conclusion.rtfd; sourceTree = SOURCE_ROOT; }; + 362317A817510EB900A25D5D /* br */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = br; path = package/Resources/br.lproj/Welcome.rtfd; sourceTree = SOURCE_ROOT; }; + 362317AA17510ECE00A25D5D /* pt */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pt; path = package/Resources/pt.lproj/Conclusion.rtfd; sourceTree = SOURCE_ROOT; }; + 362317AC17510ECE00A25D5D /* pt */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pt; path = package/Resources/pt.lproj/Welcome.rtfd; sourceTree = SOURCE_ROOT; }; + 36256EF41752BA5A0018189D /* ar.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = ar.po; sourceTree = ""; }; + 36256EF51752BA5A0018189D /* bg.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = bg.po; sourceTree = ""; }; + 36256EF71752BA5A0018189D /* bs.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = bs.po; sourceTree = ""; }; + 36256EF81752BA5A0018189D /* ca.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = ca.po; sourceTree = ""; }; + 36256EF91752BA5A0018189D /* chameleon.pot */ = {isa = PBXFileReference; lastKnownFileType = text; path = chameleon.pot; sourceTree = ""; }; + 36256EFB1752BA5A0018189D /* de.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = de.po; sourceTree = ""; }; + 36256EFC1752BA5A0018189D /* el.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = el.po; sourceTree = ""; }; + 36256EFD1752BA5A0018189D /* en.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = en.po; sourceTree = ""; }; + 36256EFE1752BA5A0018189D /* es.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = es.po; sourceTree = ""; }; + 36256EFF1752BA5A0018189D /* fa.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = fa.po; sourceTree = ""; }; + 36256F001752BA5A0018189D /* fr.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = fr.po; sourceTree = ""; }; + 36256F011752BA5A0018189D /* he.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = he.po; sourceTree = ""; }; + 36256F021752BA5A0018189D /* hr.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = hr.po; sourceTree = ""; }; + 36256F031752BA5A0018189D /* hu.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = hu.po; sourceTree = ""; }; + 36256F041752BA5A0018189D /* id.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = id.po; sourceTree = ""; }; + 36256F051752BA5A0018189D /* it.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = it.po; sourceTree = ""; }; + 36256F061752BA5A0018189D /* ja.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = ja.po; sourceTree = ""; }; + 36256F071752BA5A0018189D /* ko.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = ko.po; sourceTree = ""; }; + 36256F081752BA5A0018189D /* mk.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = mk.po; sourceTree = ""; }; + 36256F091752BA5A0018189D /* nl.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = nl.po; sourceTree = ""; }; + 36256F0A1752BA5A0018189D /* pl.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = pl.po; sourceTree = ""; }; + 36256F0B1752BA5A0018189D /* pt.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = pt.po; sourceTree = ""; }; + 36256F0C1752BA5A0018189D /* ro.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = ro.po; sourceTree = ""; }; + 36256F0D1752BA5A0018189D /* ru.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = ru.po; sourceTree = ""; }; + 36256F0E1752BA5A0018189D /* sr.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = sr.po; sourceTree = ""; }; + 36256F0F1752BA5A0018189D /* zh_CN.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = zh_CN.po; sourceTree = ""; }; + 36256F101752BA5A0018189D /* zh_TW.po */ = {isa = PBXFileReference; lastKnownFileType = text; path = zh_TW.po; sourceTree = ""; }; 369689D014BD0AF10013D77F /* BLOCKERS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BLOCKERS; sourceTree = ""; }; 369689D114BD0AF10013D77F /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; 369689D214BD0B470013D77F /* version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = version; sourceTree = ""; }; @@ -186,16 +171,156 @@ 36AB75E814BD095E005B8045 /* PowerManagement.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = PowerManagement.txt; path = OptionalSettings/PowerManagement.txt; sourceTree = ""; }; 36AB75E914BD095E005B8045 /* Resolution.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Resolution.txt; path = OptionalSettings/Resolution.txt; sourceTree = ""; }; 36AB75EA14BD095E005B8045 /* Video.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Video.txt; path = OptionalSettings/Video.txt; sourceTree = ""; }; - 36AE6E5716D644BC00D083A6 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = KernelPatcher/Cconfig; sourceTree = ""; }; - 36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = KernelPatcher.dylib; path = KernelPatcher/KernelPatcher.dylib; sourceTree = ""; }; - 36AE6E5916D644BC00D083A6 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = KernelPatcher/Makefile; sourceTree = ""; }; - 36AE6E5C16D644E800D083A6 /* FileNVRAM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FileNVRAM.h; path = FileNVRAM/include/FileNVRAM.h; sourceTree = ""; }; - 36AE6E5D16D644F300D083A6 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = FileNVRAM/Cconfig; sourceTree = ""; }; - 36AE6E5E16D644F300D083A6 /* FileNVRAM.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = FileNVRAM.dylib; path = FileNVRAM/FileNVRAM.dylib; sourceTree = ""; }; - 36AE6E5F16D644F300D083A6 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = FileNVRAM/Makefile; sourceTree = ""; }; - 6DBAFD1313B0D21E0047ED33 /* modules_support.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = modules_support.s; sourceTree = ""; }; - 6DBAFD1413B0D21E0047ED33 /* modules.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = modules.c; sourceTree = ""; }; - 6DBAFD1513B0D21E0047ED33 /* modules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modules.h; sourceTree = ""; }; + 36B83692167832FC00314162 /* Audio.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = Audio.txt; path = OptionalSettings/Audio.txt; sourceTree = ""; }; + 36B836941678330900314162 /* HDEFLayout.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = HDEFLayout.txt; path = OptionalSettings/HDEFLayout.txt; sourceTree = ""; }; + 36C9C9841739EF9900B28C9B /* IntelCapri.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = IntelCapri.txt; path = OptionalSettings/IntelCapri.txt; sourceTree = ""; }; + 36CA2F1B1758294E002E6F1E /* acpi_patcher.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acpi_patcher.c; sourceTree = ""; }; + 36CA2F1C1758294E002E6F1E /* acpi_patcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi_patcher.h; sourceTree = ""; }; + 36CA2F1D1758294E002E6F1E /* acpi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; + 36CA2F1E1758294E002E6F1E /* allocate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = ""; }; + 36CA2F1F1758294E002E6F1E /* aml_generator.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = ""; }; + 36CA2F201758294E002E6F1E /* aml_generator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aml_generator.h; sourceTree = ""; }; + 36CA2F211758294E002E6F1E /* asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = asm.s; sourceTree = ""; }; + 36CA2F221758294E002E6F1E /* ati.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ati.c; sourceTree = ""; }; + 36CA2F231758294E002E6F1E /* ati.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ati.h; sourceTree = ""; }; + 36CA2F241758294E002E6F1E /* base64-decode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "base64-decode.c"; sourceTree = ""; }; + 36CA2F251758294E002E6F1E /* befs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = befs.c; sourceTree = ""; }; + 36CA2F261758294E002E6F1E /* befs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = befs.h; sourceTree = ""; }; + 36CA2F271758294E002E6F1E /* bios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = ""; }; + 36CA2F281758294E002E6F1E /* bios.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bios.s; sourceTree = ""; }; + 36CA2F291758294E002E6F1E /* biosfn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = biosfn.c; sourceTree = ""; }; + 36CA2F2A1758294E002E6F1E /* bootargs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bootargs.h; sourceTree = ""; }; + 36CA2F2B1758294E002E6F1E /* bootstruct.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bootstruct.c; sourceTree = ""; }; + 36CA2F2C1758294E002E6F1E /* bootstruct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bootstruct.h; sourceTree = ""; }; + 36CA2F2D1758294E002E6F1E /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; + 36CA2F2E1758294E002E6F1E /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; + 36CA2F2F1758294E002E6F1E /* console.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = console.c; sourceTree = ""; }; + 36CA2F301758294E002E6F1E /* convert.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = convert.c; sourceTree = ""; }; + 36CA2F311758294E002E6F1E /* convert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = ""; }; + 36CA2F321758294E002E6F1E /* cpu.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = ""; }; + 36CA2F331758294E002E6F1E /* cpu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; + 36CA2F341758294E002E6F1E /* device_inject.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = device_inject.c; sourceTree = ""; }; + 36CA2F351758294E002E6F1E /* device_inject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = ""; }; + 36CA2F361758294E002E6F1E /* device_tree.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = ""; }; + 36CA2F371758294E002E6F1E /* device_tree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = ""; }; + 36CA2F381758294E002E6F1E /* disk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = disk.c; sourceTree = ""; }; + 36CA2F391758294E002E6F1E /* disk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = ""; }; + 36CA2F3A1758294E002E6F1E /* dram_controllers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = ""; }; + 36CA2F3B1758294E002E6F1E /* dram_controllers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = ""; }; + 36CA2F3D1758294E002E6F1E /* edid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = edid.c; sourceTree = ""; }; + 36CA2F3E1758294E002E6F1E /* edid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = edid.h; sourceTree = ""; }; + 36CA2F3F1758294E002E6F1E /* efi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = efi.h; sourceTree = ""; }; + 36CA2F401758294E002E6F1E /* exfat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exfat.c; sourceTree = ""; }; + 36CA2F411758294E002E6F1E /* exfat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = exfat.h; sourceTree = ""; }; + 36CA2F421758294E002E6F1E /* ext2fs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ext2fs.c; sourceTree = ""; }; + 36CA2F431758294E002E6F1E /* ext2fs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ext2fs.h; sourceTree = ""; }; + 36CA2F441758294E002E6F1E /* fake_efi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fake_efi.c; sourceTree = ""; }; + 36CA2F451758294E002E6F1E /* fake_efi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fake_efi.h; sourceTree = ""; }; + 36CA2F461758294E002E6F1E /* fdisk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fdisk.h; sourceTree = ""; }; + 36CA2F471758294E002E6F1E /* freebsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = freebsd.c; sourceTree = ""; }; + 36CA2F481758294E002E6F1E /* freebsd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = freebsd.h; sourceTree = ""; }; + 36CA2F491758294E002E6F1E /* gma.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gma.c; sourceTree = ""; }; + 36CA2F4A1758294E002E6F1E /* gma.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gma.h; sourceTree = ""; }; + 36CA2F4B1758294E002E6F1E /* hfs_CaseTables.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hfs_CaseTables.h; sourceTree = ""; }; + 36CA2F4C1758294E002E6F1E /* hfs_compare.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hfs_compare.c; sourceTree = ""; }; + 36CA2F4D1758294E002E6F1E /* hfs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hfs.c; sourceTree = ""; }; + 36CA2F4E1758294E002E6F1E /* hfs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hfs.h; sourceTree = ""; }; + 36CA2F4F1758294E002E6F1E /* hpet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hpet.c; sourceTree = ""; }; + 36CA2F501758294E002E6F1E /* hpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hpet.h; sourceTree = ""; }; + 36CA2F511758294E002E6F1E /* io_inline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = io_inline.h; sourceTree = ""; }; + 36CA2F521758294E002E6F1E /* libsaio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libsaio.h; sourceTree = ""; }; + 36CA2F531758294E002E6F1E /* load.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = ""; }; + 36CA2F541758294E002E6F1E /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 36CA2F551758294E002E6F1E /* md5c.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = md5c.c; sourceTree = ""; }; + 36CA2F561758294E002E6F1E /* memvendors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = ""; }; + 36CA2F571758294E002E6F1E /* misc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = ""; }; + 36CA2F581758294E002E6F1E /* msdos_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msdos_private.h; sourceTree = ""; }; + 36CA2F591758294E002E6F1E /* msdos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = msdos.c; sourceTree = ""; }; + 36CA2F5A1758294E002E6F1E /* msdos.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msdos.h; sourceTree = ""; }; + 36CA2F5B1758294E002E6F1E /* nbp_cmd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nbp_cmd.h; sourceTree = ""; }; + 36CA2F5C1758294E002E6F1E /* nbp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nbp.c; sourceTree = ""; }; + 36CA2F5D1758294E002E6F1E /* ntfs_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ntfs_private.h; sourceTree = ""; }; + 36CA2F5E1758294E002E6F1E /* ntfs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ntfs.c; sourceTree = ""; }; + 36CA2F5F1758294E002E6F1E /* ntfs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ntfs.h; sourceTree = ""; }; + 36CA2F601758294E002E6F1E /* nvidia_helper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nvidia_helper.c; sourceTree = ""; }; + 36CA2F611758294E002E6F1E /* nvidia_helper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nvidia_helper.h; sourceTree = ""; }; + 36CA2F621758294E002E6F1E /* nvidia.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nvidia.c; sourceTree = ""; }; + 36CA2F631758294E002E6F1E /* nvidia.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nvidia.h; sourceTree = ""; }; + 36CA2F641758294E002E6F1E /* openbsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = openbsd.c; sourceTree = ""; }; + 36CA2F651758294E002E6F1E /* openbsd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = openbsd.h; sourceTree = ""; }; + 36CA2F661758294E002E6F1E /* pci_root.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pci_root.c; sourceTree = ""; }; + 36CA2F671758294E002E6F1E /* pci_root.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pci_root.h; sourceTree = ""; }; + 36CA2F681758294E002E6F1E /* pci_setup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pci_setup.c; sourceTree = ""; }; + 36CA2F691758294E002E6F1E /* pci.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pci.c; sourceTree = ""; }; + 36CA2F6A1758294E002E6F1E /* pci.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pci.h; sourceTree = ""; }; + 36CA2F6B1758294E002E6F1E /* platform.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = ""; }; + 36CA2F6C1758294E002E6F1E /* platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = ""; }; + 36CA2F6D1758294E002E6F1E /* saio_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = saio_internal.h; sourceTree = ""; }; + 36CA2F6E1758294E002E6F1E /* saio_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = saio_types.h; sourceTree = ""; }; + 36CA2F6F1758294E002E6F1E /* sl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sl.h; sourceTree = ""; }; + 36CA2F701758294E002E6F1E /* smbios_decode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios_decode.c; sourceTree = ""; }; + 36CA2F711758294E002E6F1E /* smbios_getters.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios_getters.c; sourceTree = ""; }; + 36CA2F721758294E002E6F1E /* smbios_getters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = smbios_getters.h; sourceTree = ""; }; + 36CA2F731758294E002E6F1E /* smbios.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios.c; sourceTree = ""; }; + 36CA2F741758294E002E6F1E /* smbios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = smbios.h; sourceTree = ""; }; + 36CA2F751758294E002E6F1E /* spd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = ""; }; + 36CA2F761758294E002E6F1E /* spd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = ""; }; + 36CA2F771758294E002E6F1E /* state_generator.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = state_generator.c; sourceTree = ""; }; + 36CA2F781758294E002E6F1E /* state_generator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = state_generator.h; sourceTree = ""; }; + 36CA2F791758294E002E6F1E /* stringTable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = ""; }; + 36CA2F7A1758294E002E6F1E /* sys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = ""; }; + 36CA2F7B1758294E002E6F1E /* table.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = ""; }; + 36CA2F7C1758294E002E6F1E /* term.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = term.h; sourceTree = ""; }; + 36CA2F7D1758294E002E6F1E /* ufs_byteorder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ufs_byteorder.h; sourceTree = ""; }; + 36CA2F7E1758294E002E6F1E /* ufs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ufs.h; sourceTree = ""; }; + 36CA2F7F1758294E002E6F1E /* usb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = usb.c; sourceTree = ""; }; + 36CA2F801758294E002E6F1E /* vbe.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vbe.c; sourceTree = ""; }; + 36CA2F811758294E002E6F1E /* vbe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = ""; }; + 36CA2F821758294E002E6F1E /* xml.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = ""; }; + 36CA2F831758294E002E6F1E /* xml.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = ""; }; + 36CA2F841758362B002E6F1E /* dsdt_patcher.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dsdt_patcher.c; sourceTree = ""; }; + 36CF786716A0DD3D00EE5DC1 /* HDAULayout.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = HDAULayout.txt; path = OptionalSettings/HDAULayout.txt; sourceTree = ""; }; + 36D621D016A41501006031F3 /* hda_controller.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = hda_controller.c; path = HDAEnabler/hda_controller.c; sourceTree = ""; }; + 36D621D116A41501006031F3 /* hda_controller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = hda_controller.h; path = HDAEnabler/hda_controller.h; sourceTree = ""; }; + 36D621D216A41501006031F3 /* hda_enabler.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = hda_enabler.c; path = HDAEnabler/hda_enabler.c; sourceTree = ""; }; + 36D621D316A4155C006031F3 /* hda_codec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = hda_codec.c; path = HDAEnabler/hda_codec.c; sourceTree = ""; }; + 36D621D416A4155C006031F3 /* hda_codec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = hda_codec.h; path = HDAEnabler/hda_codec.h; sourceTree = ""; }; + 36DFBE8F16AF0A7B001A6428 /* FileNVRAM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FileNVRAM.h; path = FileNVRAM/include/FileNVRAM.h; sourceTree = ""; }; + 36DFBE9016AF0A89001A6428 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = FileNVRAM/Cconfig; sourceTree = ""; }; + 36DFBE9116AF0A89001A6428 /* FileNVRAM.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = FileNVRAM.dylib; path = FileNVRAM/FileNVRAM.dylib; sourceTree = ""; }; + 36DFBE9216AF0A89001A6428 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = FileNVRAM/Makefile; sourceTree = ""; }; + 36F0179C16A3896A00519CEA /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = HDAEnabler/Cconfig; sourceTree = ""; }; + 36F0179E16A3896A00519CEA /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = HDAEnabler/Makefile; sourceTree = ""; }; + 52073BCA17EB133F00DE2795 /* adler32.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = adler32.c; path = KextPatcher/adler32.c; sourceTree = ""; }; + 52073BCB17EB133F00DE2795 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = KextPatcher/Cconfig; sourceTree = ""; }; + 52073BCC17EB133F00DE2795 /* deflate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = deflate.c; path = KextPatcher/deflate.c; sourceTree = ""; }; + 52073BCD17EB133F00DE2795 /* deflate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = deflate.h; path = KextPatcher/deflate.h; sourceTree = ""; }; + 52073BCE17EB133F00DE2795 /* hex_editor.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = hex_editor.c; path = KextPatcher/hex_editor.c; sourceTree = ""; }; + 52073BCF17EB133F00DE2795 /* hex_editor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = hex_editor.h; path = KextPatcher/hex_editor.h; sourceTree = ""; }; + 52073BD017EB133F00DE2795 /* inffast.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = inffast.c; path = KextPatcher/inffast.c; sourceTree = ""; }; + 52073BD117EB133F00DE2795 /* inffast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = inffast.h; path = KextPatcher/inffast.h; sourceTree = ""; }; + 52073BD217EB133F00DE2795 /* inffixed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = inffixed.h; path = KextPatcher/inffixed.h; sourceTree = ""; }; + 52073BD317EB133F00DE2795 /* inflate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = inflate.c; path = KextPatcher/inflate.c; sourceTree = ""; }; + 52073BD417EB133F00DE2795 /* inflate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = inflate.h; path = KextPatcher/inflate.h; sourceTree = ""; }; + 52073BD517EB133F00DE2795 /* inftrees.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = inftrees.c; path = KextPatcher/inftrees.c; sourceTree = ""; }; + 52073BD617EB133F00DE2795 /* inftrees.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = inftrees.h; path = KextPatcher/inftrees.h; sourceTree = ""; }; + 52073BD717EB133F00DE2795 /* kext_patcher.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = kext_patcher.c; path = KextPatcher/kext_patcher.c; sourceTree = ""; }; + 52073BD817EB133F00DE2795 /* kext_patcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = kext_patcher.h; path = KextPatcher/kext_patcher.h; sourceTree = ""; }; + 52073BD917EB133F00DE2795 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = KextPatcher/Makefile; sourceTree = ""; }; + 52073BDA17EB133F00DE2795 /* mkext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mkext.h; path = KextPatcher/mkext.h; sourceTree = ""; }; + 52073BDB17EB133F00DE2795 /* trees.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = trees.c; path = KextPatcher/trees.c; sourceTree = ""; }; + 52073BDC17EB133F00DE2795 /* trees.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = trees.h; path = KextPatcher/trees.h; sourceTree = ""; }; + 52073BDD17EB133F00DE2795 /* zconf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = zconf.h; path = KextPatcher/zconf.h; sourceTree = ""; }; + 52073BDE17EB133F00DE2795 /* zlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = zlib.h; path = KextPatcher/zlib.h; sourceTree = ""; }; + 52073BDF17EB133F00DE2795 /* zutil.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = zutil.c; path = KextPatcher/zutil.c; sourceTree = ""; }; + 52073BE017EB133F00DE2795 /* zutil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = zutil.h; path = KextPatcher/zutil.h; sourceTree = ""; }; + 52DF7A2D17EDFA5900A88D32 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = KernelPatcher/Cconfig; sourceTree = ""; }; + 52DF7A2E17EDFA5900A88D32 /* kernel_patcher.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = kernel_patcher.c; path = KernelPatcher/kernel_patcher.c; sourceTree = ""; }; + 52DF7A2F17EDFA5900A88D32 /* kernel_patcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = kernel_patcher.h; path = KernelPatcher/kernel_patcher.h; sourceTree = ""; }; + 52DF7A3017EDFA5900A88D32 /* KernelPatcher.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = KernelPatcher.dylib; path = KernelPatcher/KernelPatcher.dylib; sourceTree = ""; }; + 52DF7A3117EDFA5900A88D32 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = KernelPatcher/Makefile; sourceTree = ""; }; + 52F9208217E9280E0039B7EB /* hda.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hda.c; sourceTree = ""; }; + 52F9208317E9280E0039B7EB /* hda.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hda.h; sourceTree = ""; }; 6DBAFD1813B0D4590047ED33 /* _structs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _structs.h; sourceTree = ""; }; 6DBAFD1913B0D4590047ED33 /* _types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _types.h; sourceTree = ""; }; 6DBAFD1B13B0D4590047ED33 /* alignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = alignment.h; sourceTree = ""; }; @@ -1083,167 +1208,9 @@ A35D2178141A753E00969AC0 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; A35D2187141A75DC00969AC0 /* slimpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = slimpkg.sh; sourceTree = ""; }; A35D2188141A75DC00969AC0 /* buildpkg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = buildpkg.sh; sourceTree = ""; }; + A35D2189141A75DC00969AC0 /* builddmg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = builddmg.sh; sourceTree = ""; }; A360AA7D14136C1A00084D3F /* Make.rules */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Make.rules; sourceTree = ""; }; - A396E2CC150247630025A245 /* License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = License.rtf; sourceTree = ""; }; - A396E2CE150247630025A245 /* background.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = background.tiff; sourceTree = ""; }; - A396E2D1150247630025A245 /* Description.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Description.html; sourceTree = ""; }; - A396E2D2150247630025A245 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; - A396E35915028C9C0025A245 /* Welcome.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Welcome.html; sourceTree = ""; }; - A396E4F51502D0580025A245 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = ar.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E4F71502D0580025A245 /* ar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ar; path = ar.lproj/Description.html; sourceTree = ""; }; - A396E4F91502D0580025A245 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ar; path = ar.lproj/License.rtf; sourceTree = ""; }; - A396E4FB1502D0580025A245 /* ar */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = ""; }; - A396E4FD1502D0580025A245 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = ar.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E4FE1502D0580025A245 /* background.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = background.tiff; sourceTree = ""; }; - A396E4FF1502D0580025A245 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = bg.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5001502D0580025A245 /* bg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = bg; path = bg.lproj/Description.html; sourceTree = ""; }; - A396E5011502D0580025A245 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = bg; path = bg.lproj/License.rtf; sourceTree = ""; }; - A396E5021502D0580025A245 /* bg */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Localizable.strings; sourceTree = ""; }; - A396E5031502D0580025A245 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = bg.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5041502D0580025A245 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = bs.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5051502D0580025A245 /* bs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = bs; path = bs.lproj/Description.html; sourceTree = ""; }; - A396E5061502D0580025A245 /* bs */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = bs; path = bs.lproj/License.rtf; sourceTree = ""; }; - A396E5071502D0580025A245 /* bs */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = bs; path = bs.lproj/Localizable.strings; sourceTree = ""; }; - A396E5081502D0580025A245 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = bs.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5091502D0580025A245 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = ca.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E50A1502D0580025A245 /* ca */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ca; path = ca.lproj/Description.html; sourceTree = ""; }; - A396E50B1502D0580025A245 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ca; path = ca.lproj/License.rtf; sourceTree = ""; }; - A396E50C1502D0580025A245 /* ca */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = ""; }; - A396E50D1502D0580025A245 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = ca.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E50E1502D0580025A245 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = de.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E50F1502D0580025A245 /* de */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = de; path = de.lproj/Description.html; sourceTree = ""; }; - A396E5101502D0580025A245 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = de; path = de.lproj/License.rtf; sourceTree = ""; }; - A396E5111502D0580025A245 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; - A396E5121502D0580025A245 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = de.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5131502D0580025A245 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = el.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5141502D0580025A245 /* el */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = el; path = el.lproj/Description.html; sourceTree = ""; }; - A396E5151502D0580025A245 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = el; path = el.lproj/License.rtf; sourceTree = ""; }; - A396E5161502D0580025A245 /* el */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Localizable.strings; sourceTree = ""; }; - A396E5171502D0580025A245 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = el.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5181502D0580025A245 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = en.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5191502D0580025A245 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = en; path = en.lproj/Description.html; sourceTree = ""; }; - A396E51A1502D0580025A245 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/License.rtf; sourceTree = ""; }; - A396E51B1502D0580025A245 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - A396E51C1502D0580025A245 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = en.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E51D1502D0580025A245 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = es.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E51E1502D0580025A245 /* es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = es; path = es.lproj/Description.html; sourceTree = ""; }; - A396E51F1502D0580025A245 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = es; path = es.lproj/License.rtf; sourceTree = ""; }; - A396E5201502D0580025A245 /* es */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; - A396E5211502D0580025A245 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = es.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5221502D0580025A245 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = fr.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5231502D0580025A245 /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = fr; path = fr.lproj/Description.html; sourceTree = ""; }; - A396E5241502D0580025A245 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = fr; path = fr.lproj/License.rtf; sourceTree = ""; }; - A396E5251502D0580025A245 /* fr */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; - A396E5261502D0580025A245 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = fr.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5271502D0580025A245 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = he.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5281502D0580025A245 /* he */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = he; path = he.lproj/Description.html; sourceTree = ""; }; - A396E5291502D0580025A245 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = he; path = he.lproj/License.rtf; sourceTree = ""; }; - A396E52A1502D0580025A245 /* he */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = ""; }; - A396E52B1502D0580025A245 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = he.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E52C1502D0580025A245 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = hr.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E52D1502D0580025A245 /* hr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = hr; path = hr.lproj/Description.html; sourceTree = ""; }; - A396E52E1502D0580025A245 /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = hr; path = hr.lproj/License.rtf; sourceTree = ""; }; - A396E52F1502D0580025A245 /* hr */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Localizable.strings; sourceTree = ""; }; - A396E5301502D0580025A245 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = hr.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5311502D0580025A245 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = id.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5321502D0580025A245 /* id */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = id; path = id.lproj/Description.html; sourceTree = ""; }; - A396E5331502D0580025A245 /* id */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = id; path = id.lproj/License.rtf; sourceTree = ""; }; - A396E5341502D0580025A245 /* id */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/Localizable.strings; sourceTree = ""; }; - A396E5351502D0580025A245 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = id.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5361502D0580025A245 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = it.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5371502D0580025A245 /* it */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = it; path = it.lproj/Description.html; sourceTree = ""; }; - A396E5381502D0580025A245 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = it; path = it.lproj/License.rtf; sourceTree = ""; }; - A396E5391502D0580025A245 /* it */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = ""; }; - A396E53A1502D0580025A245 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = it.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E53B1502D0580025A245 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = ja.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E53C1502D0580025A245 /* ja */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ja; path = ja.lproj/Description.html; sourceTree = ""; }; - A396E53D1502D0580025A245 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ja; path = ja.lproj/License.rtf; sourceTree = ""; }; - A396E53E1502D0580025A245 /* ja */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; - A396E53F1502D0580025A245 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = ja.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5401502D0580025A245 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = ko.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5411502D0580025A245 /* ko */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ko; path = ko.lproj/Description.html; sourceTree = ""; }; - A396E5421502D0580025A245 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ko; path = ko.lproj/License.rtf; sourceTree = ""; }; - A396E5431502D0580025A245 /* ko */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = ""; }; - A396E5441502D0580025A245 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = ko.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5451502D0580025A245 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = mk.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5461502D0580025A245 /* mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = mk; path = mk.lproj/Description.html; sourceTree = ""; }; - A396E5471502D0580025A245 /* mk */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = mk; path = mk.lproj/License.rtf; sourceTree = ""; }; - A396E5481502D0580025A245 /* mk */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = mk; path = mk.lproj/Localizable.strings; sourceTree = ""; }; - A396E5491502D0580025A245 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = mk.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E54A1502D0580025A245 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = nl.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E54B1502D0580025A245 /* nl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nl; path = nl.lproj/Description.html; sourceTree = ""; }; - A396E54C1502D0580025A245 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = nl; path = nl.lproj/License.rtf; sourceTree = ""; }; - A396E54D1502D0580025A245 /* nl */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; - A396E54E1502D0580025A245 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = nl.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E54F1502D0580025A245 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = pl.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5501502D0580025A245 /* pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = pl; path = pl.lproj/Description.html; sourceTree = ""; }; - A396E5511502D0580025A245 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = pl; path = pl.lproj/License.rtf; sourceTree = ""; }; - A396E5521502D0580025A245 /* pl */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = ""; }; - A396E5531502D0580025A245 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = pl.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5541502D0580025A245 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-BR"; path = "pt-BR.lproj/Conclusion.rtfd"; sourceTree = ""; }; - A396E5551502D0580025A245 /* pt-BR */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "pt-BR"; path = "pt-BR.lproj/Description.html"; sourceTree = ""; }; - A396E5561502D0580025A245 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "pt-BR"; path = "pt-BR.lproj/License.rtf"; sourceTree = ""; }; - A396E5571502D0580025A245 /* pt-BR */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = ""; }; - A396E5581502D0580025A245 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-BR"; path = "pt-BR.lproj/Welcome.rtfd"; sourceTree = ""; }; - A396E5591502D0580025A245 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-PT"; path = "pt-PT.lproj/Conclusion.rtfd"; sourceTree = ""; }; - A396E55A1502D0580025A245 /* pt-PT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "pt-PT"; path = "pt-PT.lproj/Description.html"; sourceTree = ""; }; - A396E55B1502D0580025A245 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "pt-PT"; path = "pt-PT.lproj/License.rtf"; sourceTree = ""; }; - A396E55C1502D0580025A245 /* pt-PT */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Localizable.strings"; sourceTree = ""; }; - A396E55D1502D0580025A245 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = "pt-PT"; path = "pt-PT.lproj/Welcome.rtfd"; sourceTree = ""; }; - A396E55E1502D0580025A245 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = ro.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E55F1502D0580025A245 /* ro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ro; path = ro.lproj/Description.html; sourceTree = ""; }; - A396E5601502D0580025A245 /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ro; path = ro.lproj/License.rtf; sourceTree = ""; }; - A396E5611502D0580025A245 /* ro */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Localizable.strings; sourceTree = ""; }; - A396E5621502D0580025A245 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = ro.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5631502D0580025A245 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = ru.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5641502D0580025A245 /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ru; path = ru.lproj/Description.html; sourceTree = ""; }; - A396E5651502D0580025A245 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ru; path = ru.lproj/License.rtf; sourceTree = ""; }; - A396E5661502D0580025A245 /* ru */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; - A396E5671502D0580025A245 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = ru.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5681502D0580025A245 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = sr.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5691502D0580025A245 /* sr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = sr; path = sr.lproj/Description.html; sourceTree = ""; }; - A396E56A1502D0580025A245 /* sr */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = sr; path = sr.lproj/License.rtf; sourceTree = ""; }; - A396E56B1502D0580025A245 /* sr */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = sr; path = sr.lproj/Localizable.strings; sourceTree = ""; }; - A396E56C1502D0580025A245 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = sr.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E56D1502D0580025A245 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = zh_CN.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E56E1502D0580025A245 /* zh_CN */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = zh_CN; path = zh_CN.lproj/Description.html; sourceTree = ""; }; - A396E56F1502D0580025A245 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = zh_CN; path = zh_CN.lproj/License.rtf; sourceTree = ""; }; - A396E5701502D0580025A245 /* zh_CN */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Localizable.strings; sourceTree = ""; }; - A396E5711502D0580025A245 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = zh_CN.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5721502D0580025A245 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = zh_TW.lproj/Conclusion.rtfd; sourceTree = ""; }; - A396E5731502D0580025A245 /* zh_TW */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = zh_TW; path = zh_TW.lproj/Description.html; sourceTree = ""; }; - A396E5741502D0580025A245 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = zh_TW; path = zh_TW.lproj/License.rtf; sourceTree = ""; }; - A396E5751502D0580025A245 /* zh_TW */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Localizable.strings; sourceTree = ""; }; - A396E5761502D0580025A245 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = zh_TW.lproj/Welcome.rtfd; sourceTree = ""; }; - A396E5821502D3320025A245 /* Conclusion.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Conclusion.html; sourceTree = ""; }; A3F1F267141B9B3B00DDA709 /* Readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Readme.txt; sourceTree = ""; }; - AB1DE71815B6E2D00088E06B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; - AB1DE71A15B6E2D00088E06B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - AB1DE71B15B6E2D00088E06B /* Sata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Sata.c; sourceTree = ""; }; - AB30C92E15DE60ED0047BE7B /* ld_classic */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = ld_classic; sourceTree = ""; }; - AB30C92F15DE60ED0047BE7B /* ld_classic.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = ld_classic.1; sourceTree = ""; }; - AB30C93215DE66D90047BE7B /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; - AB30C93315DE66D90047BE7B /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - AB30C93415DE66D90047BE7B /* md.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = md.1; sourceTree = ""; }; - AB30C93515DE66D90047BE7B /* md.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = md.c; sourceTree = ""; }; - AB47D38A15B702F00083D898 /* org.chameleon.Boot.nvidia.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = org.chameleon.Boot.nvidia.plist; sourceTree = ""; }; - AB4DDA8D15CEFF2100E77157 /* acpi_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_codec.c; sourceTree = ""; }; - AB4DDA8E15CEFF2100E77157 /* acpi_tools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_tools.c; sourceTree = ""; }; - AB4DDA8F15CEFF2100E77157 /* acpicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpicode.c; sourceTree = ""; }; - AB4DDA9015CEFF2100E77157 /* ACPICodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ACPICodec.c; sourceTree = ""; }; - AB4DDA9115CEFF2100E77157 /* acpidecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpidecode.c; sourceTree = ""; }; - AB4DDA9215CEFF2100E77157 /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; - AB4DDA9415CEFF2100E77157 /* acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; - AB4DDA9515CEFF2100E77157 /* acpi_codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_codec.h; sourceTree = ""; }; - AB4DDA9615CEFF2100E77157 /* acpi_tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_tools.h; sourceTree = ""; }; - AB4DDA9715CEFF2100E77157 /* acpicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpicode.h; sourceTree = ""; }; - AB4DDA9815CEFF2100E77157 /* acpidecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = ""; }; - AB4DDA9915CEFF2100E77157 /* datatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = ""; }; - AB4DDA9A15CEFF2100E77157 /* intel_acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = ""; }; - AB4DDA9B15CEFF2100E77157 /* ppm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = ""; }; - AB4DDA9C15CEFF2100E77157 /* ppmsetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = ""; }; - AB4DDA9D15CEFF2100E77157 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - AB4DDA9E15CEFF2100E77157 /* Readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Readme.txt; sourceTree = ""; }; B0056CE711F3868000754B65 /* boot0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0.s; sourceTree = ""; }; B0056CE811F3868000754B65 /* chain0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = chain0.s; sourceTree = ""; }; B0056CE911F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; @@ -1252,52 +1219,11 @@ B0056CEF11F3868000754B65 /* boot1he.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1he.s; sourceTree = ""; }; B0056CF011F3868000754B65 /* boot1hp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1hp.s; sourceTree = ""; }; B0056CF111F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056CF311F3868000754B65 /* appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleboot.h; sourceTree = ""; }; - B0056CF411F3868000754B65 /* appleClut8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleClut8.h; sourceTree = ""; }; - B0056CF511F3868000754B65 /* bmdecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmdecompress.c; sourceTree = ""; }; - B0056CF611F3868000754B65 /* boot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = boot.c; sourceTree = ""; }; - B0056CF711F3868000754B65 /* boot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.h; sourceTree = ""; }; - B0056CF811F3868000754B65 /* boot2.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot2.s; sourceTree = ""; }; - B0056CF911F3868000754B65 /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = ""; }; - B0056CFA11F3868000754B65 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = ""; }; - B0056CFB11F3868000754B65 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = ""; }; - B0056CFC11F3868000754B65 /* graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphics.c; sourceTree = ""; }; - B0056CFD11F3868000754B65 /* graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.h; sourceTree = ""; }; - B0056CFE11F3868000754B65 /* gui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = ""; }; - B0056CFF11F3868000754B65 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; - B0056D0011F3868000754B65 /* IOHibernatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHibernatePrivate.h; sourceTree = ""; }; - B0056D0111F3868000754B65 /* lzss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzss.c; sourceTree = ""; }; - B0056D0211F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D0311F3868000754B65 /* mboot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mboot.c; sourceTree = ""; }; - B0056D0411F3868000754B65 /* mboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mboot.h; sourceTree = ""; }; - B0056D0511F3868000754B65 /* multiboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiboot.h; sourceTree = ""; }; - B0056D0611F3868000754B65 /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; - B0056D0711F3868000754B65 /* picopng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = picopng.c; sourceTree = ""; }; - B0056D0811F3868000754B65 /* picopng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = ""; }; - B0056D0911F3868000754B65 /* prompt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prompt.c; sourceTree = ""; }; - B0056D0A11F3868000754B65 /* ramdisk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ramdisk.c; sourceTree = ""; }; - B0056D0B11F3868000754B65 /* ramdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ramdisk.h; sourceTree = ""; }; - B0056D0C11F3868000754B65 /* resume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = ""; }; - B0056D0D11F3868000754B65 /* WKdm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKdm.h; sourceTree = ""; }; - B0056D0E11F3868000754B65 /* WKdmDecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WKdmDecompress.c; sourceTree = ""; }; B0056D1011F3868000754B65 /* cdboot.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboot.s; sourceTree = ""; }; B0056D1111F3868000754B65 /* cdboothdd.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboothdd.s; sourceTree = ""; }; B0056D1211F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; B0056D1411F3868000754B65 /* Limits */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Limits; sourceTree = ""; }; B0056D1511F3868000754B65 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - B0056D1711F3868000754B65 /* efi_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = efi_tables.c; sourceTree = ""; }; - B0056D1811F3868000754B65 /* efi_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi_tables.h; sourceTree = ""; }; - B0056D1911F3868000754B65 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; - B0056D1A11F3868000754B65 /* libsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsa.h; sourceTree = ""; }; - B0056D1B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - B0056D1C11F3868000754B65 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; - B0056D1D11F3868000754B65 /* prf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prf.c; sourceTree = ""; }; - B0056D1E11F3868000754B65 /* printf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = ""; }; - B0056D1F11F3868000754B65 /* qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = ""; }; - B0056D2011F3868000754B65 /* setjmp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; - B0056D2111F3868000754B65 /* string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = ""; }; - B0056D2211F3868000754B65 /* strtol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = ""; }; - B0056D2311F3868000754B65 /* zalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zalloc.c; sourceTree = ""; }; B0056D7611F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; B0056D7A11F3868000754B65 /* machOconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = machOconv.c; sourceTree = ""; }; B0056D7B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; @@ -1340,13 +1266,6 @@ B0056DD911F3868000754B65 /* text_scroll_next.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = text_scroll_next.png; sourceTree = ""; }; B0056DDA11F3868000754B65 /* text_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = text_scroll_prev.png; sourceTree = ""; }; B0056DDB11F3868000754B65 /* theme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = theme.plist; sourceTree = ""; }; - B0056DFD11F3868000754B65 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; - B0056DFE11F3868000754B65 /* theme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = theme.plist; sourceTree = ""; }; - B0056E0011F3868000754B65 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; - B0056E0111F3868000754B65 /* theme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = theme.plist; sourceTree = ""; }; - B0056E0311F3868000754B65 /* font_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = font_small.png; sourceTree = ""; }; - B0056E0411F3868000754B65 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; - B0056E0511F3868000754B65 /* theme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = theme.plist; sourceTree = ""; }; B0056E0811F3868000754B65 /* Users_Guide0.4.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide0.4.pdf; sourceTree = ""; }; B0056E0911F3868000754B65 /* Users_Guide_v0.3.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide_v0.3.pdf; sourceTree = ""; }; B0056E0A11F3868000754B65 /* UsersGuide-v0.2.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "UsersGuide-v0.2.pdf"; sourceTree = ""; }; @@ -1367,80 +1286,29 @@ B0056E1A11F3868000754B65 /* Users_Guide0.5.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide0.5.pdf; sourceTree = ""; }; B0146EFF11FDEF550010765C /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = ""; }; - B4118C63153EFEC200C8D926 /* clean_po_headers.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_po_headers.sh; sourceTree = ""; }; - B4118C65153EFEC200C8D926 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; - B4118C69153EFEC200C8D926 /* BibTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = BibTeX.pm; sourceTree = ""; }; - B4118C6A153EFEC200C8D926 /* Chooser.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Chooser.pm; sourceTree = ""; }; - B4118C6B153EFEC200C8D926 /* Common.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Common.pm; sourceTree = ""; }; - B4118C6C153EFEC200C8D926 /* Debconf.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Debconf.pm; sourceTree = ""; }; - B4118C6D153EFEC200C8D926 /* Dia.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Dia.pm; sourceTree = ""; }; - B4118C6E153EFEC200C8D926 /* Docbook.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Docbook.pm; sourceTree = ""; }; - B4118C6F153EFEC200C8D926 /* Guide.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Guide.pm; sourceTree = ""; }; - B4118C70153EFEC200C8D926 /* Halibut.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Halibut.pm; sourceTree = ""; }; - B4118C71153EFEC200C8D926 /* Html.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Html.pm; sourceTree = ""; }; - B4118C72153EFEC200C8D926 /* Ini.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Ini.pm; sourceTree = ""; }; - B4118C73153EFEC200C8D926 /* KernelHelp.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = KernelHelp.pm; sourceTree = ""; }; - B4118C74153EFEC200C8D926 /* LaTeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = LaTeX.pm; sourceTree = ""; }; - B4118C75153EFEC200C8D926 /* Man.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Man.pm; sourceTree = ""; }; - B4118C76153EFEC200C8D926 /* NewsDebian.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = NewsDebian.pm; sourceTree = ""; }; - B4118C77153EFEC200C8D926 /* Po.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Po.pm; sourceTree = ""; }; - B4118C78153EFEC200C8D926 /* Pod.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Pod.pm; sourceTree = ""; }; - B4118C79153EFEC200C8D926 /* Prop.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Prop.pm; sourceTree = ""; }; - B4118C7A153EFEC200C8D926 /* Sgml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Sgml.pm; sourceTree = ""; }; - B4118C7B153EFEC200C8D926 /* TeX.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TeX.pm; sourceTree = ""; }; - B4118C7C153EFEC200C8D926 /* Texinfo.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Texinfo.pm; sourceTree = ""; }; - B4118C7D153EFEC200C8D926 /* Text.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Text.pm; sourceTree = ""; }; - B4118C7E153EFEC200C8D926 /* TransTractor.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = TransTractor.pm; sourceTree = ""; }; - B4118C7F153EFEC200C8D926 /* Wml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Wml.pm; sourceTree = ""; }; - B4118C80153EFEC200C8D926 /* Xhtml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xhtml.pm; sourceTree = ""; }; - B4118C81153EFEC200C8D926 /* Xml.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = Xml.pm; sourceTree = ""; }; - B4118C82153EFEC200C8D926 /* MANIFEST */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MANIFEST; sourceTree = ""; }; - B4118C83153EFEC200C8D926 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NEWS; sourceTree = ""; }; - B4118C84153EFEC200C8D926 /* po4a */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = po4a; sourceTree = ""; }; - B4118C85153EFEC200C8D926 /* po4a-gettextize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-gettextize"; sourceTree = ""; }; - B4118C86153EFEC200C8D926 /* po4a-normalize */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-normalize"; sourceTree = ""; }; - B4118C87153EFEC200C8D926 /* po4a-translate */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-translate"; sourceTree = ""; }; - B4118C88153EFEC200C8D926 /* po4a-updatepo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-updatepo"; sourceTree = ""; }; - B4118C89153EFEC200C8D926 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - B4118C8A153EFEC200C8D926 /* README.maintainers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.maintainers; sourceTree = ""; }; - B4118C8B153EFEC200C8D926 /* README.tests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.tests; sourceTree = ""; }; - B4118C8C153EFEC200C8D926 /* README.translators */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.translators; sourceTree = ""; }; - B4118C8F153EFF3300C8D926 /* ar.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ar.po; sourceTree = ""; }; - B4118C90153EFF3300C8D926 /* bg.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bg.po; sourceTree = ""; }; - B4118C91153EFF3300C8D926 /* bs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bs.po; sourceTree = ""; }; - B4118C92153EFF3300C8D926 /* ca.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ca.po; sourceTree = ""; }; - B4118C93153EFF3300C8D926 /* chameleon.pot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = chameleon.pot; sourceTree = ""; }; - B4118C94153EFF3300C8D926 /* cs.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cs.po; sourceTree = ""; }; - B4118C95153EFF3300C8D926 /* de.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = de.po; sourceTree = ""; }; - B4118C96153EFF3300C8D926 /* el.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = el.po; sourceTree = ""; }; - B4118C97153EFF3300C8D926 /* en.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = en.po; sourceTree = ""; }; - B4118C98153EFF3300C8D926 /* es.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = es.po; sourceTree = ""; }; - B4118C99153EFF3300C8D926 /* fa.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fa.po; sourceTree = ""; }; - B4118C9A153EFF3300C8D926 /* fr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = fr.po; sourceTree = ""; }; - B4118C9B153EFF3300C8D926 /* he.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = he.po; sourceTree = ""; }; - B4118C9C153EFF3300C8D926 /* hr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hr.po; sourceTree = ""; }; - B4118C9D153EFF3300C8D926 /* hu.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = hu.po; sourceTree = ""; }; - B4118C9E153EFF3300C8D926 /* id.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = id.po; sourceTree = ""; }; - B4118C9F153EFF3300C8D926 /* it.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = it.po; sourceTree = ""; }; - B4118CA0153EFF3300C8D926 /* ko.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ko.po; sourceTree = ""; }; - B4118CA1153EFF3300C8D926 /* mk.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mk.po; sourceTree = ""; }; - B4118CA2153EFF3300C8D926 /* nl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl.po; sourceTree = ""; }; - B4118CA3153EFF3300C8D926 /* pl.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pl.po; sourceTree = ""; }; - B4118CA4153EFF3300C8D926 /* pt-BR.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-BR.po"; sourceTree = ""; }; - B4118CA5153EFF3300C8D926 /* pt-PT.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pt-PT.po"; sourceTree = ""; }; - B4118CA6153EFF3300C8D926 /* ro.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ro.po; sourceTree = ""; }; - B4118CA7153EFF3300C8D926 /* ru.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ru.po; sourceTree = ""; }; - B4118CA8153EFF3300C8D926 /* sr.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sr.po; sourceTree = ""; }; - B4118CA9153EFF3300C8D926 /* zh_CN.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_CN.po; sourceTree = ""; }; - B4118CAA153EFF3300C8D926 /* zh_TW.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = zh_TW.po; sourceTree = ""; }; - B4118CAB153EFF3D00C8D926 /* po4a-chameleon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-chameleon.cfg"; sourceTree = ""; }; + B412979E15BE0C4F00073B54 /* acpi_codec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpi_codec.c; path = AcpiCodec/acpi_codec.c; sourceTree = ""; }; + B412979F15BE0C4F00073B54 /* acpi_tools.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpi_tools.c; path = AcpiCodec/acpi_tools.c; sourceTree = ""; }; + B41297A015BE0C4F00073B54 /* acpicode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpicode.c; path = AcpiCodec/acpicode.c; sourceTree = ""; }; + B41297A115BE0C4F00073B54 /* ACPICodec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ACPICodec.c; path = AcpiCodec/ACPICodec.c; sourceTree = ""; }; + B41297A215BE0C4F00073B54 /* acpidecode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = acpidecode.c; path = AcpiCodec/acpidecode.c; sourceTree = ""; }; + B41297A315BE0C4F00073B54 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = AcpiCodec/Cconfig; sourceTree = ""; }; + B41297A515BE0C4F00073B54 /* acpi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = ""; }; + B41297A615BE0C4F00073B54 /* acpi_codec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi_codec.h; sourceTree = ""; }; + B41297A715BE0C4F00073B54 /* acpi_tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpi_tools.h; sourceTree = ""; }; + B41297A815BE0C4F00073B54 /* acpicode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpicode.h; sourceTree = ""; }; + B41297A915BE0C4F00073B54 /* acpidecode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = ""; }; + B41297AA15BE0C4F00073B54 /* datatype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = ""; }; + B41297AB15BE0C4F00073B54 /* intel_acpi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = ""; }; + B41297AC15BE0C4F00073B54 /* ppm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = ""; }; + B41297AD15BE0C4F00073B54 /* ppmsetup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = ""; }; + B41297AE15BE0C4F00073B54 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = AcpiCodec/Makefile; sourceTree = ""; }; + B41297AF15BE0C4F00073B54 /* Readme.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = Readme.txt; path = AcpiCodec/Readme.txt; sourceTree = ""; }; B41899FB14BFBE2400ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B41899FD14BFBE4500ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B41899FE14BFBE5200ED5B0B /* boot0md.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0md.s; sourceTree = ""; }; B41899FF14BFBE5D00ED5B0B /* boot0hfs.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0hfs.s; sourceTree = ""; }; B4189A0014BFBE7D00ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B4189A0114BFBE8900ED5B0B /* boot1h.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1h.s; sourceTree = ""; }; - B4189A0214BFBE9E00ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B4189A0514BFBF0A00ED5B0B /* BIG.FAT.WARNING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = BIG.FAT.WARNING; path = config/lxdialog/BIG.FAT.WARNING; sourceTree = ""; }; B4189A0614BFBF0A00ED5B0B /* check-lxdialog.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "check-lxdialog.sh"; path = "config/lxdialog/check-lxdialog.sh"; sourceTree = ""; }; B4189A0714BFBF0A00ED5B0B /* checklist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = checklist.c; path = config/lxdialog/checklist.c; sourceTree = ""; }; @@ -1470,19 +1338,164 @@ B4189A1F14BFBF1C00ED5B0B /* yesno.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yesno.c; path = config/yesno.c; sourceTree = ""; }; B4189A2014BFBF1C00ED5B0B /* zconf.hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zconf.hash.c; path = config/zconf.hash.c; sourceTree = ""; }; B4189A2114BFBF1C00ED5B0B /* zconf.tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zconf.tab.c; path = config/zconf.tab.c; sourceTree = ""; }; - B4189A2214BFBF5600ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; B4189A2414BFBFD100ED5B0B /* Cconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cconfig; sourceTree = ""; }; + B43E407614EE869700CD79F9 /* device_hfsplus_ml_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsplus_ml_o.png; sourceTree = ""; }; + B43E407714EE869800CD79F9 /* device_hfsplus_ml.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsplus_ml.png; sourceTree = ""; }; + B43E407814EE869A00CD79F9 /* device_hfsraid_ml_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsraid_ml_o.png; sourceTree = ""; }; + B43E407914EE869C00CD79F9 /* device_hfsraid_ml.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsraid_ml.png; sourceTree = ""; }; + B442D9F515C216C900985ED1 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = embed/background.png; sourceTree = ""; }; + B442D9F615C216C900985ED1 /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = boot.png; path = embed/boot.png; sourceTree = ""; }; + B442D9F715C216C900985ED1 /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_cdrom.png; path = embed/device_cdrom.png; sourceTree = ""; }; + B442D9F815C216C900985ED1 /* device_ext3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_ext3.png; path = embed/device_ext3.png; sourceTree = ""; }; + B442D9F915C216C900985ED1 /* device_fat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_fat.png; path = embed/device_fat.png; sourceTree = ""; }; + B442D9FA15C216C900985ED1 /* device_generic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_generic.png; path = embed/device_generic.png; sourceTree = ""; }; + B442D9FB15C216C900985ED1 /* device_hfsplus.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_hfsplus.png; path = embed/device_hfsplus.png; sourceTree = ""; }; + B442D9FC15C216C900985ED1 /* device_hfsraid.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_hfsraid.png; path = embed/device_hfsraid.png; sourceTree = ""; }; + B442D9FD15C216C900985ED1 /* device_ntfs.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_ntfs.png; path = embed/device_ntfs.png; sourceTree = ""; }; + B442D9FE15C216C900985ED1 /* device_scroll_next.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_scroll_next.png; path = embed/device_scroll_next.png; sourceTree = ""; }; + B442D9FF15C216C900985ED1 /* device_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_scroll_prev.png; path = embed/device_scroll_prev.png; sourceTree = ""; }; + B442DA0015C216C900985ED1 /* device_selection.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_selection.png; path = embed/device_selection.png; sourceTree = ""; }; + B442DA0115C216C900985ED1 /* font_console.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_console.png; path = embed/font_console.png; sourceTree = ""; }; + B442DA0215C216C900985ED1 /* font_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_small.png; path = embed/font_small.png; sourceTree = ""; }; + B442DA0315C216C900985ED1 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = embed/logo.png; sourceTree = ""; }; + B442DA0415C216C900985ED1 /* menu_boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_boot.png; path = embed/menu_boot.png; sourceTree = ""; }; + B442DA0515C216C900985ED1 /* menu_help.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_help.png; path = embed/menu_help.png; sourceTree = ""; }; + B442DA0615C216C900985ED1 /* menu_ignore_caches_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_ignore_caches_disabled.png; path = embed/menu_ignore_caches_disabled.png; sourceTree = ""; }; + B442DA0715C216C900985ED1 /* menu_ignore_caches.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_ignore_caches.png; path = embed/menu_ignore_caches.png; sourceTree = ""; }; + B442DA0815C216C900985ED1 /* menu_memory_info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_memory_info.png; path = embed/menu_memory_info.png; sourceTree = ""; }; + B442DA0915C216C900985ED1 /* menu_selection.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_selection.png; path = embed/menu_selection.png; sourceTree = ""; }; + B442DA0A15C216C900985ED1 /* menu_single_user_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_single_user_disabled.png; path = embed/menu_single_user_disabled.png; sourceTree = ""; }; + B442DA0B15C216C900985ED1 /* menu_single_user.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_single_user.png; path = embed/menu_single_user.png; sourceTree = ""; }; + B442DA0C15C216C900985ED1 /* menu_verbose_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_verbose_disabled.png; path = embed/menu_verbose_disabled.png; sourceTree = ""; }; + B442DA0D15C216C900985ED1 /* menu_verbose.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_verbose.png; path = embed/menu_verbose.png; sourceTree = ""; }; + B442DA0E15C216C900985ED1 /* menu_video_info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_video_info.png; path = embed/menu_video_info.png; sourceTree = ""; }; + B442DA0F15C216C900985ED1 /* progress_bar_background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = progress_bar_background.png; path = embed/progress_bar_background.png; sourceTree = ""; }; + B442DA1015C216C900985ED1 /* progress_bar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = progress_bar.png; path = embed/progress_bar.png; sourceTree = ""; }; + B442DA1115C216C900985ED1 /* text_scroll_next.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = text_scroll_next.png; path = embed/text_scroll_next.png; sourceTree = ""; }; + B442DA1215C216C900985ED1 /* text_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = text_scroll_prev.png; path = embed/text_scroll_prev.png; sourceTree = ""; }; + B442DA1315C216C900985ED1 /* theme.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = theme.plist; path = embed/theme.plist; sourceTree = ""; }; + B442DA1415C216E500985ED1 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = legacy/background.png; sourceTree = ""; }; + B442DA1515C216E500985ED1 /* boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = boot.png; path = legacy/boot.png; sourceTree = ""; }; + B442DA1615C216E500985ED1 /* device_cdrom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_cdrom.png; path = legacy/device_cdrom.png; sourceTree = ""; }; + B442DA1715C216E500985ED1 /* device_ext3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_ext3.png; path = legacy/device_ext3.png; sourceTree = ""; }; + B442DA1815C216E500985ED1 /* device_fat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_fat.png; path = legacy/device_fat.png; sourceTree = ""; }; + B442DA1915C216E500985ED1 /* device_generic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_generic.png; path = legacy/device_generic.png; sourceTree = ""; }; + B442DA1A15C216E500985ED1 /* device_hfsplus.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_hfsplus.png; path = legacy/device_hfsplus.png; sourceTree = ""; }; + B442DA1B15C216E500985ED1 /* device_ntfs.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_ntfs.png; path = legacy/device_ntfs.png; sourceTree = ""; }; + B442DA1C15C216E500985ED1 /* device_scroll_next.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_scroll_next.png; path = legacy/device_scroll_next.png; sourceTree = ""; }; + B442DA1D15C216E500985ED1 /* device_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_scroll_prev.png; path = legacy/device_scroll_prev.png; sourceTree = ""; }; + B442DA1E15C216E500985ED1 /* device_selection.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = device_selection.png; path = legacy/device_selection.png; sourceTree = ""; }; + B442DA1F15C216E500985ED1 /* font_console.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_console.png; path = legacy/font_console.png; sourceTree = ""; }; + B442DA2015C216E500985ED1 /* font_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = font_small.png; path = legacy/font_small.png; sourceTree = ""; }; + B442DA2115C216E500985ED1 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = legacy/logo.png; sourceTree = ""; }; + B442DA2215C216E500985ED1 /* menu_boot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_boot.png; path = legacy/menu_boot.png; sourceTree = ""; }; + B442DA2315C216E500985ED1 /* menu_help.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_help.png; path = legacy/menu_help.png; sourceTree = ""; }; + B442DA2415C216E500985ED1 /* menu_ignore_caches_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_ignore_caches_disabled.png; path = legacy/menu_ignore_caches_disabled.png; sourceTree = ""; }; + B442DA2515C216E500985ED1 /* menu_ignore_caches.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_ignore_caches.png; path = legacy/menu_ignore_caches.png; sourceTree = ""; }; + B442DA2615C216E500985ED1 /* menu_memory_info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_memory_info.png; path = legacy/menu_memory_info.png; sourceTree = ""; }; + B442DA2715C216E500985ED1 /* menu_selection.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_selection.png; path = legacy/menu_selection.png; sourceTree = ""; }; + B442DA2815C216E500985ED1 /* menu_single_user_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_single_user_disabled.png; path = legacy/menu_single_user_disabled.png; sourceTree = ""; }; + B442DA2915C216E500985ED1 /* menu_single_user.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_single_user.png; path = legacy/menu_single_user.png; sourceTree = ""; }; + B442DA2A15C216E500985ED1 /* menu_verbose_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_verbose_disabled.png; path = legacy/menu_verbose_disabled.png; sourceTree = ""; }; + B442DA2B15C216E500985ED1 /* menu_verbose.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_verbose.png; path = legacy/menu_verbose.png; sourceTree = ""; }; + B442DA2C15C216E500985ED1 /* menu_video_info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menu_video_info.png; path = legacy/menu_video_info.png; sourceTree = ""; }; + B442DA2D15C216E500985ED1 /* progress_bar_background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = progress_bar_background.png; path = legacy/progress_bar_background.png; sourceTree = ""; }; + B442DA2E15C216E500985ED1 /* progress_bar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = progress_bar.png; path = legacy/progress_bar.png; sourceTree = ""; }; + B442DA2F15C216E500985ED1 /* text_scroll_next.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = text_scroll_next.png; path = legacy/text_scroll_next.png; sourceTree = ""; }; + B442DA3015C216E500985ED1 /* text_scroll_prev.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = text_scroll_prev.png; path = legacy/text_scroll_prev.png; sourceTree = ""; }; + B442DA3115C216E500985ED1 /* theme.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = theme.plist; path = legacy/theme.plist; sourceTree = ""; }; + B45260B4153EFCF60018E994 /* po4a-chameleon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "po4a-chameleon.cfg"; sourceTree = ""; }; B4AABE5914C3B8B90055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; B4AABE5B14C3B8C70055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; B4AABE5D14C3B8D70055ECD1 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = postinstall; sourceTree = ""; }; B4AABE5E14C3B8EF0055ECD1 /* clean_bootplist.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = clean_bootplist.pl; sourceTree = ""; }; + B4B3DD8D15B8E2F7002FAA73 /* device_hfsplus_recovery_o.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsplus_recovery_o.png; sourceTree = ""; }; + B4B3DD8E15B8E2F7002FAA73 /* device_hfsplus_recovery.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = device_hfsplus_recovery.png; sourceTree = ""; }; + B4B3DD9015B8E347002FAA73 /* org.chameleon.Boot.nvidia.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = org.chameleon.Boot.nvidia.plist; sourceTree = ""; }; + B4B3DDA615B8E3CB002FAA73 /* Cconfig */ = {isa = PBXFileReference; lastKnownFileType = text; name = Cconfig; path = Sata/Cconfig; sourceTree = ""; }; + B4B3DDA815B8E3CB002FAA73 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = Sata/Makefile; sourceTree = ""; }; + B4B3DDA915B8E3CB002FAA73 /* Sata.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = Sata.c; path = Sata/Sata.c; sourceTree = ""; }; + B4B3DDC015B8E914002FAA73 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDC215B8E914002FAA73 /* ar */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ar; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDC515B8E914002FAA73 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDC715B8E914002FAA73 /* bg */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bg; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDCA15B8E914002FAA73 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDCC15B8E914002FAA73 /* bs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = bs; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDCF15B8E914002FAA73 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDD115B8E914002FAA73 /* ca */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ca; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDD315B8E914002FAA73 /* License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = License.rtf; sourceTree = ""; }; + B4B3DDD615B8E914002FAA73 /* cs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = cs; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDD815B8E914002FAA73 /* cs */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = cs; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDDB15B8E914002FAA73 /* da */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = da; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDDD15B8E914002FAA73 /* da */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = da; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDE015B8E914002FAA73 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDE215B8E914002FAA73 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = de; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDE715B8E914002FAA73 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDE915B8E914002FAA73 /* el */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = el; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDEC15B8E914002FAA73 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDEE15B8E914002FAA73 /* en */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = en; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDF115B8E914002FAA73 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDF315B8E914002FAA73 /* es */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = es; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDF615B8E914002FAA73 /* fa */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fa; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDF815B8E914002FAA73 /* fa */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fa; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DDFB15B8E914002FAA73 /* fi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fi; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DDFD15B8E914002FAA73 /* fi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fi; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE0015B8E914002FAA73 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE0215B8E914002FAA73 /* fr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = fr; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE0515B8E914002FAA73 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE0715B8E914002FAA73 /* he */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = he; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE0A15B8E914002FAA73 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE0C15B8E914002FAA73 /* hr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hr; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE0F15B8E914002FAA73 /* hu */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hu; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE1115B8E914002FAA73 /* hu */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = hu; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE1415B8E914002FAA73 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE1615B8E914002FAA73 /* id */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = id; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE1915B8E914002FAA73 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE1B15B8E914002FAA73 /* it */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = it; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE1E15B8E914002FAA73 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE2015B8E914002FAA73 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ja; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE2315B8E914002FAA73 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE2515B8E914002FAA73 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ko; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE2815B8E914002FAA73 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE2A15B8E914002FAA73 /* mk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = mk; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE2D15B8E914002FAA73 /* ms */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ms; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE2F15B8E914002FAA73 /* ms */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ms; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE3215B8E914002FAA73 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE3415B8E914002FAA73 /* nl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = nl; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE3715B8E914002FAA73 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE3915B8E914002FAA73 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = pl; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE4615B8E914002FAA73 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE4815B8E914002FAA73 /* ro */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ro; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE4B15B8E914002FAA73 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE4D15B8E914002FAA73 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = ru; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE5015B8E914002FAA73 /* sk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sk; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE5215B8E914002FAA73 /* sk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sk; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE5515B8E914002FAA73 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE5715B8E914002FAA73 /* sr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sr; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE5A15B8E914002FAA73 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sv; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE5C15B8E914002FAA73 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = sv; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE5E15B8E914002FAA73 /* Conclusion.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = Conclusion.html; sourceTree = ""; }; + B4B3DE5F15B8E914002FAA73 /* Description.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = Description.html; sourceTree = ""; }; + B4B3DE6015B8E914002FAA73 /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; + B4B3DE6115B8E914002FAA73 /* Welcome.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = Welcome.html; sourceTree = ""; }; + B4B3DE6415B8E914002FAA73 /* th */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = th; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE6615B8E914002FAA73 /* th */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = th; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE6915B8E914002FAA73 /* tr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = tr; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE6B15B8E914002FAA73 /* tr */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = tr; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE6E15B8E914002FAA73 /* uk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = uk; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE7015B8E914002FAA73 /* uk */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = uk; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE7315B8E914002FAA73 /* vi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = vi; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE7515B8E914002FAA73 /* vi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = vi; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE7815B8E914002FAA73 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE7A15B8E914002FAA73 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_CN; path = Welcome.rtfd; sourceTree = ""; }; + B4B3DE7D15B8E914002FAA73 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = Conclusion.rtfd; sourceTree = ""; }; + B4B3DE7F15B8E914002FAA73 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; name = zh_TW; path = Welcome.rtfd; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ 08FB7794FE84155DC02AAC07 /* Chameleon */ = { isa = PBXGroup; children = ( - AB30C92D15DE60ED0047BE7B /* bin */, B0056D8211F3868000754B65 /* APPLE_LICENSE */, B0056DBA11F3868000754B65 /* artwork */, 369689D014BD0AF10013D77F /* BLOCKERS */, @@ -1508,11 +1521,24 @@ 361BC70414BD979700236488 /* Icons */ = { isa = PBXGroup; children = ( + 361BC70614BD97C800236488 /* dmg.zip */, + 361BC70714BD97C800236488 /* doc.zip */, + 361BC70814BD97C800236488 /* i386.zip */, + 361BC70914BD97C800236488 /* Icon.zip */, + 361BC70A14BD97C800236488 /* pan.zip */, 361BC70B14BD97C800236488 /* pkg.zip */, + 361BC70C14BD97C800236488 /* tm.zip */, ); name = Icons; sourceTree = ""; }; + 361BC70514BD97A800236488 /* dmg */ = { + isa = PBXGroup; + children = ( + ); + name = dmg; + sourceTree = ""; + }; 364E0DDF14BCFB6600F55E58 /* Scripts.templates */ = { isa = PBXGroup; children = ( @@ -1554,48 +1580,107 @@ path = Scripts.templates/Pre; sourceTree = ""; }; - 36AE6E5616D6449A00D083A6 /* KernelPatcher */ = { + 36B43E8114BCE91300D29461 /* OptionalSettings */ = { isa = PBXGroup; children = ( - 36AE6E5716D644BC00D083A6 /* Cconfig */, - 36AE6E5816D644BC00D083A6 /* KernelPatcher.dylib */, - 36AE6E5916D644BC00D083A6 /* Makefile */, + 36B83692167832FC00314162 /* Audio.txt */, + 36AB75E514BD095E005B8045 /* Control.txt */, + 36AB75E614BD095E005B8045 /* General.txt */, + 36C9C9841739EF9900B28C9B /* IntelCapri.txt */, + 361DAA8F177D152200CFBF68 /* IntelAzul.txt */, + 36B836941678330900314162 /* HDEFLayout.txt */, + 36CF786716A0DD3D00EE5DC1 /* HDAULayout.txt */, + 36AB75E714BD095E005B8045 /* KernelFlags.txt */, + 36AB75E814BD095E005B8045 /* PowerManagement.txt */, + 36AB75E914BD095E005B8045 /* Resolution.txt */, + 36AB75EA14BD095E005B8045 /* Video.txt */, ); - name = KernelPatcher; + name = OptionalSettings; sourceTree = ""; }; - 36AE6E5A16D644CB00D083A6 /* FileNVRAM */ = { + 36DFBE8C16AF0A4B001A6428 /* FileNVRAM */ = { isa = PBXGroup; children = ( - 36AE6E5D16D644F300D083A6 /* Cconfig */, - 36AE6E5E16D644F300D083A6 /* FileNVRAM.dylib */, - 36AE6E5B16D644DB00D083A6 /* include */, - 36AE6E5F16D644F300D083A6 /* Makefile */, + 36DFBE9016AF0A89001A6428 /* Cconfig */, + 36DFBE9116AF0A89001A6428 /* FileNVRAM.dylib */, + 36DFBE9216AF0A89001A6428 /* Makefile */, + 36DFBE8E16AF0A6B001A6428 /* include */, ); name = FileNVRAM; sourceTree = ""; }; - 36AE6E5B16D644DB00D083A6 /* include */ = { + 36DFBE8E16AF0A6B001A6428 /* include */ = { isa = PBXGroup; children = ( - 36AE6E5C16D644E800D083A6 /* FileNVRAM.h */, + 36DFBE8F16AF0A7B001A6428 /* FileNVRAM.h */, ); name = include; sourceTree = ""; }; - 36B43E8114BCE91300D29461 /* OptionalSettings */ = { + 36F0179A16A3894A00519CEA /* HDAEnabler */ = { isa = PBXGroup; children = ( - 36AB75E514BD095E005B8045 /* Control.txt */, - 36AB75E614BD095E005B8045 /* General.txt */, - 36AB75E714BD095E005B8045 /* KernelFlags.txt */, - 36AB75E814BD095E005B8045 /* PowerManagement.txt */, - 36AB75E914BD095E005B8045 /* Resolution.txt */, - 36AB75EA14BD095E005B8045 /* Video.txt */, + 36F0179C16A3896A00519CEA /* Cconfig */, + 36D621D316A4155C006031F3 /* hda_codec.c */, + 36D621D416A4155C006031F3 /* hda_codec.h */, + 36D621D016A41501006031F3 /* hda_controller.c */, + 36D621D116A41501006031F3 /* hda_controller.h */, + 36D621D216A41501006031F3 /* hda_enabler.c */, + 36F0179B16A3895700519CEA /* include */, + 36F0179E16A3896A00519CEA /* Makefile */, ); - name = OptionalSettings; + name = HDAEnabler; sourceTree = ""; }; + 36F0179B16A3895700519CEA /* include */ = { + isa = PBXGroup; + children = ( + ); + name = include; + sourceTree = ""; + }; + 52073BC817EB130100DE2795 /* KextPatcher */ = { + isa = PBXGroup; + children = ( + 52073BCA17EB133F00DE2795 /* adler32.c */, + 52073BCB17EB133F00DE2795 /* Cconfig */, + 52073BCC17EB133F00DE2795 /* deflate.c */, + 52073BCD17EB133F00DE2795 /* deflate.h */, + 52073BCE17EB133F00DE2795 /* hex_editor.c */, + 52073BCF17EB133F00DE2795 /* hex_editor.h */, + 52073BD017EB133F00DE2795 /* inffast.c */, + 52073BD117EB133F00DE2795 /* inffast.h */, + 52073BD217EB133F00DE2795 /* inffixed.h */, + 52073BD317EB133F00DE2795 /* inflate.c */, + 52073BD417EB133F00DE2795 /* inflate.h */, + 52073BD517EB133F00DE2795 /* inftrees.c */, + 52073BD617EB133F00DE2795 /* inftrees.h */, + 52073BD717EB133F00DE2795 /* kext_patcher.c */, + 52073BD817EB133F00DE2795 /* kext_patcher.h */, + 52073BD917EB133F00DE2795 /* Makefile */, + 52073BDA17EB133F00DE2795 /* mkext.h */, + 52073BDB17EB133F00DE2795 /* trees.c */, + 52073BDC17EB133F00DE2795 /* trees.h */, + 52073BDD17EB133F00DE2795 /* zconf.h */, + 52073BDE17EB133F00DE2795 /* zlib.h */, + 52073BDF17EB133F00DE2795 /* zutil.c */, + 52073BE017EB133F00DE2795 /* zutil.h */, + ); + name = KextPatcher; + sourceTree = ""; + }; + 52073BC917EB131A00DE2795 /* KernelPatcher */ = { + isa = PBXGroup; + children = ( + 52DF7A2D17EDFA5900A88D32 /* Cconfig */, + 52DF7A2E17EDFA5900A88D32 /* kernel_patcher.c */, + 52DF7A2F17EDFA5900A88D32 /* kernel_patcher.h */, + 52DF7A3017EDFA5900A88D32 /* KernelPatcher.dylib */, + 52DF7A3117EDFA5900A88D32 /* Makefile */, + ); + name = KernelPatcher; + sourceTree = ""; + }; 6DBAFD1713B0D4590047ED33 /* include */ = { isa = PBXGroup; children = ( @@ -2757,19 +2842,21 @@ A3561CAB1414024C00E9B51E /* modules */ = { isa = PBXGroup; children = ( - AB4DDA8C15CEFF2100E77157 /* AcpiCodec */, + B412979C15BE0C3100073B54 /* AcpiCodec */, A3561CAC1414024C00E9B51E /* Cconfig */, - 36AE6E5A16D644CB00D083A6 /* FileNVRAM */, + 36DFBE8C16AF0A4B001A6428 /* FileNVRAM */, + 36F0179A16A3894A00519CEA /* HDAEnabler */, A3561CAD1414024C00E9B51E /* HelloWorld */, A3561CB21414024C00E9B51E /* include */, - 36AE6E5616D6449A00D083A6 /* KernelPatcher */, + 52073BC917EB131A00DE2795 /* KernelPatcher */, + 52073BC817EB130100DE2795 /* KextPatcher */, A3561CB41414024C00E9B51E /* Keylayout */, A3561CB71414024D00E9B51E /* klibc */, A3561D011414024D00E9B51E /* Makefile */, A3561D021414024D00E9B51E /* MakeInc.dir */, A3561D031414024D00E9B51E /* Modules.txt */, A3561D041414024D00E9B51E /* Resolution */, - AB1DE71715B6E2D00088E06B /* Sata */, + B4B3DDA515B8E384002FAA73 /* Sata */, A3561D0F1414024D00E9B51E /* uClibcxx */, ); path = modules; @@ -3072,53 +3159,49 @@ A396E2CA150247630025A245 /* Resources */ = { isa = PBXGroup; children = ( - A396E2CB150247630025A245 /* common */, - A396E2CD150247630025A245 /* distribution */, - A396E2CF150247630025A245 /* templates */, + B4B3DDBE15B8E914002FAA73 /* ar.lproj */, + B4B3DDC315B8E914002FAA73 /* bg.lproj */, + B4B3DDC815B8E914002FAA73 /* bs.lproj */, + B4B3DE3A15B8E914002FAA73 /* br.lproj */, + B4B3DDCD15B8E914002FAA73 /* ca.lproj */, + B4B3DDD215B8E914002FAA73 /* common */, + B4B3DDD415B8E914002FAA73 /* cs.lproj */, + B4B3DDD915B8E914002FAA73 /* da.lproj */, + B4B3DDDE15B8E914002FAA73 /* de.lproj */, + B4B3DDE515B8E914002FAA73 /* el.lproj */, + B4B3DDEA15B8E914002FAA73 /* en.lproj */, + B4B3DDEF15B8E914002FAA73 /* es.lproj */, + B4B3DDF415B8E914002FAA73 /* fa.lproj */, + B4B3DDF915B8E914002FAA73 /* fi.lproj */, + B4B3DDFE15B8E914002FAA73 /* fr.lproj */, + B4B3DE0315B8E914002FAA73 /* he.lproj */, + B4B3DE0815B8E914002FAA73 /* hr.lproj */, + B4B3DE0D15B8E914002FAA73 /* hu.lproj */, + B4B3DE1215B8E914002FAA73 /* id.lproj */, + B4B3DE1715B8E914002FAA73 /* it.lproj */, + B4B3DE1C15B8E914002FAA73 /* ja.lproj */, + B4B3DE2115B8E914002FAA73 /* ko.lproj */, + B4B3DE2615B8E914002FAA73 /* mk.lproj */, + B4B3DE2B15B8E914002FAA73 /* ms.lproj */, + B4B3DE3015B8E914002FAA73 /* nl.lproj */, + B4B3DE3515B8E914002FAA73 /* pl.lproj */, + B4B3DE3F15B8E914002FAA73 /* pt.lproj */, + B4B3DE4415B8E914002FAA73 /* ro.lproj */, + B4B3DE4915B8E914002FAA73 /* ru.lproj */, + B4B3DE4E15B8E914002FAA73 /* sk.lproj */, + B4B3DE5315B8E914002FAA73 /* sr.lproj */, + B4B3DE5815B8E914002FAA73 /* sv.lproj */, + B4B3DE5D15B8E914002FAA73 /* templates */, + B4B3DE6215B8E914002FAA73 /* th.lproj */, + B4B3DE6715B8E914002FAA73 /* tr.lproj */, + B4B3DE6C15B8E914002FAA73 /* uk.lproj */, + B4B3DE7115B8E914002FAA73 /* vi.lproj */, + B4B3DE7615B8E914002FAA73 /* zh_CN.lproj */, + B4B3DE7B15B8E914002FAA73 /* zh_TW.lproj */, ); path = Resources; sourceTree = ""; }; - A396E2CB150247630025A245 /* common */ = { - isa = PBXGroup; - children = ( - A396E2CC150247630025A245 /* License.rtf */, - ); - path = common; - sourceTree = ""; - }; - A396E2CD150247630025A245 /* distribution */ = { - isa = PBXGroup; - children = ( - A396E2CE150247630025A245 /* background.tiff */, - ); - path = distribution; - sourceTree = ""; - }; - A396E2CF150247630025A245 /* templates */ = { - isa = PBXGroup; - children = ( - A396E35915028C9C0025A245 /* Welcome.html */, - A396E2D1150247630025A245 /* Description.html */, - A396E5821502D3320025A245 /* Conclusion.html */, - A396E2D2150247630025A245 /* Localizable.strings */, - ); - path = templates; - sourceTree = ""; - }; - A396E4F31502D0580025A245 /* Resources.old */ = { - isa = PBXGroup; - children = ( - A396E4F41502D0580025A245 /* Conclusion.rtfd */, - A396E4F61502D0580025A245 /* Description.html */, - A396E4F81502D0580025A245 /* License.rtf */, - A396E4FA1502D0580025A245 /* Localizable.strings */, - A396E4FC1502D0580025A245 /* Welcome.rtfd */, - A396E4FE1502D0580025A245 /* background.tiff */, - ); - path = Resources.old; - sourceTree = ""; - }; A3F1F20D141B9B0D00DDA709 /* Scripts */ = { isa = PBXGroup; children = ( @@ -3128,76 +3211,6 @@ path = Scripts; sourceTree = ""; }; - AB1DE71715B6E2D00088E06B /* Sata */ = { - isa = PBXGroup; - children = ( - AB1DE71815B6E2D00088E06B /* Cconfig */, - AB1DE71915B6E2D00088E06B /* include */, - AB1DE71A15B6E2D00088E06B /* Makefile */, - AB1DE71B15B6E2D00088E06B /* Sata.c */, - ); - path = Sata; - sourceTree = ""; - }; - AB1DE71915B6E2D00088E06B /* include */ = { - isa = PBXGroup; - children = ( - ); - path = include; - sourceTree = ""; - }; - AB30C92D15DE60ED0047BE7B /* bin */ = { - isa = PBXGroup; - children = ( - AB30C92E15DE60ED0047BE7B /* ld_classic */, - AB30C92F15DE60ED0047BE7B /* ld_classic.1 */, - ); - path = bin; - sourceTree = ""; - }; - AB30C93115DE66D90047BE7B /* md */ = { - isa = PBXGroup; - children = ( - AB30C93215DE66D90047BE7B /* Cconfig */, - AB30C93315DE66D90047BE7B /* Makefile */, - AB30C93415DE66D90047BE7B /* md.1 */, - AB30C93515DE66D90047BE7B /* md.c */, - ); - path = md; - sourceTree = ""; - }; - AB4DDA8C15CEFF2100E77157 /* AcpiCodec */ = { - isa = PBXGroup; - children = ( - AB4DDA8D15CEFF2100E77157 /* acpi_codec.c */, - AB4DDA8E15CEFF2100E77157 /* acpi_tools.c */, - AB4DDA8F15CEFF2100E77157 /* acpicode.c */, - AB4DDA9015CEFF2100E77157 /* ACPICodec.c */, - AB4DDA9115CEFF2100E77157 /* acpidecode.c */, - AB4DDA9215CEFF2100E77157 /* Cconfig */, - AB4DDA9315CEFF2100E77157 /* include */, - AB4DDA9D15CEFF2100E77157 /* Makefile */, - AB4DDA9E15CEFF2100E77157 /* Readme.txt */, - ); - path = AcpiCodec; - sourceTree = ""; - }; - AB4DDA9315CEFF2100E77157 /* include */ = { - isa = PBXGroup; - children = ( - AB4DDA9415CEFF2100E77157 /* acpi.h */, - AB4DDA9515CEFF2100E77157 /* acpi_codec.h */, - AB4DDA9615CEFF2100E77157 /* acpi_tools.h */, - AB4DDA9715CEFF2100E77157 /* acpicode.h */, - AB4DDA9815CEFF2100E77157 /* acpidecode.h */, - AB4DDA9915CEFF2100E77157 /* datatype.h */, - AB4DDA9A15CEFF2100E77157 /* intel_acpi.h */, - AB4DDA9B15CEFF2100E77157 /* ppm.h */, - AB4DDA9C15CEFF2100E77157 /* ppmsetup.h */, - ); - path = include; - sourceTree = ""; - }; B0056CE511F3868000754B65 /* i386 */ = { isa = PBXGroup; children = ( @@ -3212,7 +3225,6 @@ B0056D1611F3868000754B65 /* libsa */, B0056D2411F3868000754B65 /* libsaio */, B0056D7611F3868000754B65 /* Makefile */, - AB30C93115DE66D90047BE7B /* md */, A3561CAB1414024C00E9B51E /* modules */, B0056D7911F3868000754B65 /* util */, ); @@ -3249,38 +3261,40 @@ B0056CF211F3868000754B65 /* boot2 */ = { isa = PBXGroup; children = ( - B0056CF311F3868000754B65 /* appleboot.h */, - B0056CF411F3868000754B65 /* appleClut8.h */, - B0056CF511F3868000754B65 /* bmdecompress.c */, - B0056CF611F3868000754B65 /* boot.c */, - B0056CF711F3868000754B65 /* boot.h */, - B0056CF811F3868000754B65 /* boot2.s */, - B4189A0214BFBE9E00ED5B0B /* Cconfig */, - B0056CF911F3868000754B65 /* drivers.c */, - B0056CFA11F3868000754B65 /* graphic_utils.c */, - B0056CFB11F3868000754B65 /* graphic_utils.h */, - B0056CFC11F3868000754B65 /* graphics.c */, - B0056CFD11F3868000754B65 /* graphics.h */, - B0056CFE11F3868000754B65 /* gui.c */, - 6DBAFD1313B0D21E0047ED33 /* modules_support.s */, - 6DBAFD1413B0D21E0047ED33 /* modules.c */, - 6DBAFD1513B0D21E0047ED33 /* modules.h */, - B0056CFF11F3868000754B65 /* gui.h */, - B0056D0011F3868000754B65 /* IOHibernatePrivate.h */, - B0056D0111F3868000754B65 /* lzss.c */, - B0056D0211F3868000754B65 /* Makefile */, - B0056D0311F3868000754B65 /* mboot.c */, - B0056D0411F3868000754B65 /* mboot.h */, - B0056D0511F3868000754B65 /* multiboot.h */, - B0056D0611F3868000754B65 /* options.c */, - B0056D0711F3868000754B65 /* picopng.c */, - B0056D0811F3868000754B65 /* picopng.h */, - B0056D0911F3868000754B65 /* prompt.c */, - B0056D0A11F3868000754B65 /* ramdisk.c */, - B0056D0B11F3868000754B65 /* ramdisk.h */, - B0056D0C11F3868000754B65 /* resume.c */, - B0056D0D11F3868000754B65 /* WKdm.h */, - B0056D0E11F3868000754B65 /* WKdmDecompress.c */, + 3617E24317503A9300AE753C /* appleboot.h */, + 3617E24417503A9300AE753C /* appleClut8.h */, + 3617E24517503A9300AE753C /* bmdecompress.c */, + 3617E24617503A9300AE753C /* boot.c */, + 3617E24717503A9300AE753C /* boot.h */, + 3617E24817503A9300AE753C /* boot2.s */, + 3617E24917503A9300AE753C /* Cconfig */, + 3617E24A17503A9300AE753C /* drivers.c */, + 3617E24B17503A9300AE753C /* graphic_utils.c */, + 3617E24C17503A9300AE753C /* graphic_utils.h */, + 3617E24D17503A9300AE753C /* graphics.c */, + 3617E24E17503A9300AE753C /* graphics.h */, + 3617E24F17503A9300AE753C /* gui.c */, + 3617E25017503A9300AE753C /* gui.h */, + 3617E25117503A9300AE753C /* IOHibernatePrivate.h */, + 3617E25217503A9300AE753C /* kernel_patcher.c */, + 3617E25317503A9300AE753C /* kernel_patcher.h */, + 3617E25417503A9300AE753C /* lzss.c */, + 3617E25517503A9300AE753C /* Makefile */, + 3617E25617503A9300AE753C /* mboot.c */, + 3617E25717503A9300AE753C /* mboot.h */, + 3617E25817503A9300AE753C /* modules_support.s */, + 3617E25917503A9300AE753C /* modules.c */, + 3617E25A17503A9300AE753C /* modules.h */, + 3617E25B17503A9300AE753C /* multiboot.h */, + 3617E25C17503A9300AE753C /* options.c */, + 3617E25D17503A9300AE753C /* picopng.c */, + 3617E25E17503A9300AE753C /* picopng.h */, + 3617E25F17503A9300AE753C /* prompt.c */, + 3617E26017503A9300AE753C /* ramdisk.c */, + 3617E26117503A9300AE753C /* ramdisk.h */, + 3617E26217503A9300AE753C /* resume.c */, + 3617E26317503A9300AE753C /* WKdm.h */, + 3617E26417503A9300AE753C /* WKdmDecompress.c */, ); path = boot2; sourceTree = ""; @@ -3307,20 +3321,20 @@ B0056D1611F3868000754B65 /* libsa */ = { isa = PBXGroup; children = ( - B4189A2214BFBF5600ED5B0B /* Cconfig */, - B0056D1711F3868000754B65 /* efi_tables.c */, - B0056D1811F3868000754B65 /* efi_tables.h */, - B0056D1911F3868000754B65 /* error.c */, - B0056D1A11F3868000754B65 /* libsa.h */, - B0056D1B11F3868000754B65 /* Makefile */, - B0056D1C11F3868000754B65 /* memory.h */, - B0056D1D11F3868000754B65 /* prf.c */, - B0056D1E11F3868000754B65 /* printf.c */, - B0056D1F11F3868000754B65 /* qsort.c */, - B0056D2011F3868000754B65 /* setjmp.s */, - B0056D2111F3868000754B65 /* string.c */, - B0056D2211F3868000754B65 /* strtol.c */, - B0056D2311F3868000754B65 /* zalloc.c */, + 3617E23517503A6600AE753C /* Cconfig */, + 3617E23617503A6600AE753C /* efi_tables.c */, + 3617E23717503A6600AE753C /* efi_tables.h */, + 3617E23817503A6600AE753C /* error.c */, + 3617E23917503A6600AE753C /* libsa.h */, + 3617E23A17503A6600AE753C /* Makefile */, + 3617E23B17503A6600AE753C /* memory.h */, + 3617E23C17503A6600AE753C /* prf.c */, + 3617E23D17503A6600AE753C /* printf.c */, + 3617E23E17503A6600AE753C /* qsort.c */, + 3617E23F17503A6600AE753C /* setjmp.s */, + 3617E24017503A6600AE753C /* string.c */, + 3617E24117503A6600AE753C /* strtol.c */, + 3617E24217503A6600AE753C /* zalloc.c */, ); path = libsa; sourceTree = ""; @@ -3328,109 +3342,115 @@ B0056D2411F3868000754B65 /* libsaio */ = { isa = PBXGroup; children = ( - 360A04661861F48F0091F464 /* acpi_patcher.c */, - 360A04671861F48F0091F464 /* acpi_patcher.h */, - 360A04681861F48F0091F464 /* acpi.h */, - 360A04691861F48F0091F464 /* allocate.c */, - 360A046A1861F48F0091F464 /* aml_generator.c */, - 360A046B1861F48F0091F464 /* aml_generator.h */, - 360A046C1861F48F0091F464 /* asm.s */, - 360A046D1861F48F0091F464 /* ati_reg.h */, - 360A046E1861F48F0091F464 /* ati.c */, - 360A046F1861F48F0091F464 /* ati.h */, - 360A04701861F48F0091F464 /* base64-decode.c */, - 360A04711861F48F0091F464 /* befs.c */, - 360A04721861F48F0091F464 /* befs.h */, - 360A04731861F48F0091F464 /* bios.h */, - 360A04741861F48F0091F464 /* bios.s */, - 360A04751861F48F0091F464 /* biosfn.c */, - 360A04761861F48F0091F464 /* bootargs.h */, - 360A04771861F48F0091F464 /* bootstruct.c */, - 360A04781861F48F0091F464 /* bootstruct.h */, - 360A04791861F48F0091F464 /* cache.c */, - 360A047A1861F48F0091F464 /* Cconfig */, - 360A047B1861F48F0091F464 /* console.c */, - 360A047C1861F48F0091F464 /* convert.c */, - 360A047D1861F48F0091F464 /* convert.h */, - 360A047E1861F48F0091F464 /* cpu.c */, - 360A047F1861F48F0091F464 /* cpu.h */, - 360A04801861F48F0091F464 /* device_inject.c */, - 360A04811861F48F0091F464 /* device_inject.h */, - 360A04821861F48F0091F464 /* device_tree.c */, - 360A04831861F48F0091F464 /* device_tree.h */, - 360A04841861F48F0091F464 /* disk.c */, - 360A04851861F48F0091F464 /* disk.h */, - 360A04861861F48F0091F464 /* dram_controllers.c */, - 360A04871861F48F0091F464 /* dram_controllers.h */, - 360A04881861F48F0091F464 /* efi.h */, - 360A04891861F48F0091F464 /* exfat.c */, - 360A048A1861F48F0091F464 /* exfat.h */, - 360A048B1861F48F0091F464 /* ext2fs.c */, - 360A048C1861F48F0091F464 /* ext2fs.h */, - 360A048D1861F48F0091F464 /* fake_efi.c */, - 360A048E1861F48F0091F464 /* fake_efi.h */, - 360A048F1861F48F0091F464 /* fdisk.h */, - 360A04901861F48F0091F464 /* freebsd.c */, - 360A04911861F48F0091F464 /* freebsd.h */, - 360A04921861F48F0091F464 /* gma.c */, - 360A04931861F48F0091F464 /* gma.h */, - 360A04941861F48F0091F464 /* hda.c */, - 360A04951861F48F0091F464 /* hda.h */, - 360A04961861F48F0091F464 /* hfs_CaseTables.h */, - 360A04971861F48F0091F464 /* hfs_compare.c */, - 360A04981861F48F0091F464 /* hfs.c */, - 360A04991861F48F0091F464 /* hfs.h */, - 360A049A1861F48F0091F464 /* hpet.c */, - 360A049B1861F48F0091F464 /* hpet.h */, - 360A049C1861F48F0091F464 /* io_inline.h */, - 360A049D1861F48F0091F464 /* libsaio.h */, - 360A049E1861F48F0091F464 /* load.c */, - 360A049F1861F48F0091F464 /* Makefile */, - 360A04A01861F48F0091F464 /* md5c.c */, - 360A04A11861F48F0091F464 /* memvendors.h */, - 360A04A21861F48F0091F464 /* misc.c */, - 360A04A31861F48F0091F464 /* msdos_private.h */, - 360A04A41861F48F0091F464 /* msdos.c */, - 360A04A51861F48F0091F464 /* msdos.h */, - 360A04A61861F48F0091F464 /* nbp_cmd.h */, - 360A04A71861F48F0091F464 /* nbp.c */, - 360A04A81861F48F0091F464 /* ntfs_private.h */, - 360A04A91861F48F0091F464 /* ntfs.c */, - 360A04AA1861F48F0091F464 /* ntfs.h */, - 360A04AB1861F48F0091F464 /* nvidia_helper.c */, - 360A04AC1861F48F0091F464 /* nvidia_helper.h */, - 360A04AD1861F48F0091F464 /* nvidia.c */, - 360A04AE1861F48F0091F464 /* nvidia.h */, - 360A04AF1861F48F0091F464 /* openbsd.c */, - 360A04B01861F48F0091F464 /* openbsd.h */, - 360A04B11861F48F0091F464 /* pci_root.c */, - 360A04B21861F48F0091F464 /* pci_root.h */, - 360A04B31861F48F0091F464 /* pci_setup.c */, - 360A04B41861F48F0091F464 /* pci.c */, - 360A04B51861F48F0091F464 /* pci.h */, - 360A04B61861F48F0091F464 /* platform.c */, - 360A04B71861F48F0091F464 /* platform.h */, - 360A04B81861F48F0091F464 /* saio_internal.h */, - 360A04B91861F48F0091F464 /* saio_types.h */, - 360A04BA1861F48F0091F464 /* sl.h */, - 360A04BB1861F48F0091F464 /* smbios_decode.c */, - 360A04BC1861F48F0091F464 /* smbios_getters.c */, - 360A04BD1861F48F0091F464 /* smbios_getters.h */, - 360A04BE1861F48F0091F464 /* smbios.c */, - 360A04C01861F48F0091F464 /* smbios.h */, - 360A04C21861F48F0091F464 /* spd.c */, - 360A04C31861F48F0091F464 /* spd.h */, - 360A04C41861F48F0091F464 /* stringTable.c */, - 360A04C51861F48F0091F464 /* sys.c */, - 360A04C61861F48F0091F464 /* table.c */, - 360A04C71861F48F0091F464 /* term.h */, - 360A04C81861F48F0091F464 /* ufs_byteorder.h */, - 360A04C91861F48F0091F464 /* ufs.h */, - 360A04CA1861F48F0091F464 /* usb.c */, - 360A04CB1861F48F0091F464 /* vbe.c */, - 360A04CC1861F48F0091F464 /* vbe.h */, - 360A04CD1861F48F0091F464 /* xml.c */, - 360A04CE1861F48F0091F464 /* xml.h */, + 36CA2F1B1758294E002E6F1E /* acpi_patcher.c */, + 36CA2F1C1758294E002E6F1E /* acpi_patcher.h */, + 36CA2F1D1758294E002E6F1E /* acpi.h */, + 36CA2F1E1758294E002E6F1E /* allocate.c */, + 36CA2F1F1758294E002E6F1E /* aml_generator.c */, + 36CA2F201758294E002E6F1E /* aml_generator.h */, + 36CA2F211758294E002E6F1E /* asm.s */, + 36CA2F221758294E002E6F1E /* ati.c */, + 36CA2F231758294E002E6F1E /* ati.h */, + 36CA2F241758294E002E6F1E /* base64-decode.c */, + 36CA2F251758294E002E6F1E /* befs.c */, + 36CA2F261758294E002E6F1E /* befs.h */, + 36CA2F271758294E002E6F1E /* bios.h */, + 36CA2F281758294E002E6F1E /* bios.s */, + 36CA2F291758294E002E6F1E /* biosfn.c */, + 36CA2F2A1758294E002E6F1E /* bootargs.h */, + 36CA2F2B1758294E002E6F1E /* bootstruct.c */, + 36CA2F2C1758294E002E6F1E /* bootstruct.h */, + 36CA2F2D1758294E002E6F1E /* cache.c */, + 36CA2F2E1758294E002E6F1E /* Cconfig */, + 36CA2F2F1758294E002E6F1E /* console.c */, + 36CA2F301758294E002E6F1E /* convert.c */, + 36CA2F311758294E002E6F1E /* convert.h */, + 36CA2F321758294E002E6F1E /* cpu.c */, + 36CA2F331758294E002E6F1E /* cpu.h */, + 36CA2F341758294E002E6F1E /* device_inject.c */, + 36CA2F351758294E002E6F1E /* device_inject.h */, + 36CA2F361758294E002E6F1E /* device_tree.c */, + 36CA2F371758294E002E6F1E /* device_tree.h */, + 36CA2F381758294E002E6F1E /* disk.c */, + 36CA2F391758294E002E6F1E /* disk.h */, + 36CA2F3A1758294E002E6F1E /* dram_controllers.c */, + 36CA2F3B1758294E002E6F1E /* dram_controllers.h */, + 36CA2F841758362B002E6F1E /* dsdt_patcher.c */, + 36CA2F3D1758294E002E6F1E /* edid.c */, + 36CA2F3E1758294E002E6F1E /* edid.h */, + 36CA2F3F1758294E002E6F1E /* efi.h */, + 36CA2F401758294E002E6F1E /* exfat.c */, + 36CA2F411758294E002E6F1E /* exfat.h */, + 36CA2F421758294E002E6F1E /* ext2fs.c */, + 36CA2F431758294E002E6F1E /* ext2fs.h */, + 36CA2F441758294E002E6F1E /* fake_efi.c */, + 36CA2F451758294E002E6F1E /* fake_efi.h */, + 36CA2F461758294E002E6F1E /* fdisk.h */, + 36CA2F471758294E002E6F1E /* freebsd.c */, + 36CA2F481758294E002E6F1E /* freebsd.h */, + 36CA2F491758294E002E6F1E /* gma.c */, + 36CA2F4A1758294E002E6F1E /* gma.h */, + 52F9208217E9280E0039B7EB /* hda.c */, + 52F9208317E9280E0039B7EB /* hda.h */, + 36CA2F4B1758294E002E6F1E /* hfs_CaseTables.h */, + 36CA2F4C1758294E002E6F1E /* hfs_compare.c */, + 36CA2F4D1758294E002E6F1E /* hfs.c */, + 36CA2F4E1758294E002E6F1E /* hfs.h */, + 36CA2F4F1758294E002E6F1E /* hpet.c */, + 36CA2F501758294E002E6F1E /* hpet.h */, + 36CA2F511758294E002E6F1E /* io_inline.h */, + 36CA2F521758294E002E6F1E /* libsaio.h */, + 36CA2F531758294E002E6F1E /* load.c */, + 36CA2F541758294E002E6F1E /* Makefile */, + 36CA2F551758294E002E6F1E /* md5c.c */, + 36CA2F561758294E002E6F1E /* memvendors.h */, + 36CA2F571758294E002E6F1E /* misc.c */, + 36CA2F581758294E002E6F1E /* msdos_private.h */, + 36CA2F591758294E002E6F1E /* msdos.c */, + 36CA2F5A1758294E002E6F1E /* msdos.h */, + 36CA2F5B1758294E002E6F1E /* nbp_cmd.h */, + 36CA2F5C1758294E002E6F1E /* nbp.c */, + 3601D701177540B500AE44D2 /* networking.c */, + 3601D702177540B500AE44D2 /* networking.h */, + 36CA2F5D1758294E002E6F1E /* ntfs_private.h */, + 36CA2F5E1758294E002E6F1E /* ntfs.c */, + 36CA2F5F1758294E002E6F1E /* ntfs.h */, + 36CA2F601758294E002E6F1E /* nvidia_helper.c */, + 36CA2F611758294E002E6F1E /* nvidia_helper.h */, + 36CA2F621758294E002E6F1E /* nvidia.c */, + 36CA2F631758294E002E6F1E /* nvidia.h */, + 36CA2F641758294E002E6F1E /* openbsd.c */, + 36CA2F651758294E002E6F1E /* openbsd.h */, + 36CA2F661758294E002E6F1E /* pci_root.c */, + 36CA2F671758294E002E6F1E /* pci_root.h */, + 36CA2F681758294E002E6F1E /* pci_setup.c */, + 36CA2F691758294E002E6F1E /* pci.c */, + 36CA2F6A1758294E002E6F1E /* pci.h */, + 36CA2F6B1758294E002E6F1E /* platform.c */, + 36CA2F6C1758294E002E6F1E /* platform.h */, + 36CA2F6D1758294E002E6F1E /* saio_internal.h */, + 36CA2F6E1758294E002E6F1E /* saio_types.h */, + 36CA2F6F1758294E002E6F1E /* sl.h */, + 36CA2F701758294E002E6F1E /* smbios_decode.c */, + 36CA2F711758294E002E6F1E /* smbios_getters.c */, + 36CA2F721758294E002E6F1E /* smbios_getters.h */, + 36CA2F731758294E002E6F1E /* smbios.c */, + 36CA2F741758294E002E6F1E /* smbios.h */, + 36CA2F751758294E002E6F1E /* spd.c */, + 36CA2F761758294E002E6F1E /* spd.h */, + 36CA2F771758294E002E6F1E /* state_generator.c */, + 36CA2F781758294E002E6F1E /* state_generator.h */, + 36CA2F791758294E002E6F1E /* stringTable.c */, + 36CA2F7A1758294E002E6F1E /* sys.c */, + 36CA2F7B1758294E002E6F1E /* table.c */, + 36CA2F7C1758294E002E6F1E /* term.h */, + 36CA2F7D1758294E002E6F1E /* ufs_byteorder.h */, + 36CA2F7E1758294E002E6F1E /* ufs.h */, + 36CA2F7F1758294E002E6F1E /* usb.c */, + 36CA2F801758294E002E6F1E /* vbe.c */, + 36CA2F811758294E002E6F1E /* vbe.h */, + 36CA2F821758294E002E6F1E /* xml.c */, + 36CA2F831758294E002E6F1E /* xml.h */, ); path = libsaio; sourceTree = ""; @@ -3452,16 +3472,16 @@ B0056D8311F3868000754B65 /* package */ = { isa = PBXGroup; children = ( - B4118C62153EFEC200C8D926 /* bin */, + A35D2189141A75DC00969AC0 /* builddmg.sh */, A35D2188141A75DC00969AC0 /* buildpkg.sh */, 361BC70214BD977700236488 /* Changes.txt */, B0056D8511F3868000754B65 /* Distribution */, + 361BC70514BD97A800236488 /* dmg */, 361BC70414BD979700236488 /* Icons */, 36B43E8114BCE91300D29461 /* OptionalSettings */, - B4118C8E153EFF3300C8D926 /* po */, - B4118CAB153EFF3D00C8D926 /* po4a-chameleon.cfg */, + B4526096153EFCE90018E994 /* po */, + B45260B4153EFCF60018E994 /* po4a-chameleon.cfg */, A396E2CA150247630025A245 /* Resources */, - A396E4F31502D0580025A245 /* Resources.old */, A3F1F20D141B9B0D00DDA709 /* Scripts */, 364E0DDF14BCFB6600F55E58 /* Scripts.templates */, A35D2187141A75DC00969AC0 /* slimpkg.sh */, @@ -3483,9 +3503,8 @@ children = ( B0056DBC11F3868000754B65 /* bullet */, B0056DDC11F3868000754B65 /* default */, - B0056DFC11F3868000754B65 /* msi_netbook */, - B0056DFF11F3868000754B65 /* pinktink */, - B0056E0211F3868000754B65 /* twilight */, + B442D9F315C2164800985ED1 /* embed */, + B442D9F415C2166000985ED1 /* legacy */, ); path = themes; sourceTree = ""; @@ -3549,6 +3568,8 @@ 36AB75B014BD0866005B8045 /* device_hfsplus_leo.png */, 36AB75B114BD0866005B8045 /* device_hfsplus_lion_o.png */, 36AB75B214BD0866005B8045 /* device_hfsplus_lion.png */, + B43E407614EE869700CD79F9 /* device_hfsplus_ml_o.png */, + B43E407714EE869800CD79F9 /* device_hfsplus_ml.png */, 36AB75B314BD0866005B8045 /* device_hfsplus_o.png */, 36AB75B414BD0866005B8045 /* device_hfsplus_sl_o.png */, 36AB75B514BD0866005B8045 /* device_hfsplus_sl.png */, @@ -3559,7 +3580,11 @@ 36AB75BA14BD0866005B8045 /* device_hfsraid_leo.png */, 36AB75BB14BD0866005B8045 /* device_hfsraid_lion_o.png */, 36AB75BC14BD0866005B8045 /* device_hfsraid_lion.png */, + B43E407814EE869A00CD79F9 /* device_hfsraid_ml_o.png */, + B43E407914EE869C00CD79F9 /* device_hfsraid_ml.png */, 36AB75BD14BD0866005B8045 /* device_hfsraid_o.png */, + B4B3DD8D15B8E2F7002FAA73 /* device_hfsplus_recovery_o.png */, + B4B3DD8E15B8E2F7002FAA73 /* device_hfsplus_recovery.png */, 36AB75BE14BD0866005B8045 /* device_hfsraid_sl_o.png */, 36AB75BF14BD0866005B8045 /* device_hfsraid_sl.png */, 36AB75C014BD0866005B8045 /* device_hfsraid_tiger_o.png */, @@ -3596,40 +3621,12 @@ path = default; sourceTree = ""; }; - B0056DFC11F3868000754B65 /* msi_netbook */ = { - isa = PBXGroup; - children = ( - B0056DFD11F3868000754B65 /* logo.png */, - B0056DFE11F3868000754B65 /* theme.plist */, - ); - path = msi_netbook; - sourceTree = ""; - }; - B0056DFF11F3868000754B65 /* pinktink */ = { - isa = PBXGroup; - children = ( - B0056E0011F3868000754B65 /* logo.png */, - B0056E0111F3868000754B65 /* theme.plist */, - ); - path = pinktink; - sourceTree = ""; - }; - B0056E0211F3868000754B65 /* twilight */ = { - isa = PBXGroup; - children = ( - B0056E0311F3868000754B65 /* font_small.png */, - B0056E0411F3868000754B65 /* logo.png */, - B0056E0511F3868000754B65 /* theme.plist */, - ); - path = twilight; - sourceTree = ""; - }; B0056E0611F3868000754B65 /* doc */ = { isa = PBXGroup; children = ( B0056E0711F3868000754B65 /* archive */, B0056E0B11F3868000754B65 /* BootHelp.txt */, - AB47D38A15B702F00083D898 /* org.chameleon.Boot.nvidia.plist */, + B4B3DD9015B8E347002FAA73 /* org.chameleon.Boot.nvidia.plist */, B0056E0C11F3868000754B65 /* README */, B0056E0D11F3868000754B65 /* themeinfo.png */, B0056E0E11F3868000754B65 /* User_Guide_src */, @@ -3666,118 +3663,39 @@ path = User_Guide_src; sourceTree = ""; }; - B4118C62153EFEC200C8D926 /* bin */ = { + B412979C15BE0C3100073B54 /* AcpiCodec */ = { isa = PBXGroup; children = ( - B4118C63153EFEC200C8D926 /* clean_po_headers.sh */, - B4118C64153EFEC200C8D926 /* po4a */, + B412979E15BE0C4F00073B54 /* acpi_codec.c */, + B412979F15BE0C4F00073B54 /* acpi_tools.c */, + B41297A015BE0C4F00073B54 /* acpicode.c */, + B41297A115BE0C4F00073B54 /* ACPICodec.c */, + B41297A215BE0C4F00073B54 /* acpidecode.c */, + B41297A315BE0C4F00073B54 /* Cconfig */, + B41297A415BE0C4F00073B54 /* include */, + B41297AE15BE0C4F00073B54 /* Makefile */, + B41297AF15BE0C4F00073B54 /* Readme.txt */, ); - path = bin; + name = AcpiCodec; sourceTree = ""; }; - B4118C64153EFEC200C8D926 /* po4a */ = { + B41297A415BE0C4F00073B54 /* include */ = { isa = PBXGroup; children = ( - B4118C65153EFEC200C8D926 /* COPYING */, - B4118C66153EFEC200C8D926 /* lib */, - B4118C82153EFEC200C8D926 /* MANIFEST */, - B4118C83153EFEC200C8D926 /* NEWS */, - B4118C84153EFEC200C8D926 /* po4a */, - B4118C85153EFEC200C8D926 /* po4a-gettextize */, - B4118C86153EFEC200C8D926 /* po4a-normalize */, - B4118C87153EFEC200C8D926 /* po4a-translate */, - B4118C88153EFEC200C8D926 /* po4a-updatepo */, - B4118C89153EFEC200C8D926 /* README */, - B4118C8A153EFEC200C8D926 /* README.maintainers */, - B4118C8B153EFEC200C8D926 /* README.tests */, - B4118C8C153EFEC200C8D926 /* README.translators */, + B41297A515BE0C4F00073B54 /* acpi.h */, + B41297A615BE0C4F00073B54 /* acpi_codec.h */, + B41297A715BE0C4F00073B54 /* acpi_tools.h */, + B41297A815BE0C4F00073B54 /* acpicode.h */, + B41297A915BE0C4F00073B54 /* acpidecode.h */, + B41297AA15BE0C4F00073B54 /* datatype.h */, + B41297AB15BE0C4F00073B54 /* intel_acpi.h */, + B41297AC15BE0C4F00073B54 /* ppm.h */, + B41297AD15BE0C4F00073B54 /* ppmsetup.h */, ); - path = po4a; + name = include; + path = AcpiCodec/include; sourceTree = ""; }; - B4118C66153EFEC200C8D926 /* lib */ = { - isa = PBXGroup; - children = ( - B4118C67153EFEC200C8D926 /* Locale */, - ); - path = lib; - sourceTree = ""; - }; - B4118C67153EFEC200C8D926 /* Locale */ = { - isa = PBXGroup; - children = ( - B4118C68153EFEC200C8D926 /* Po4a */, - ); - path = Locale; - sourceTree = ""; - }; - B4118C68153EFEC200C8D926 /* Po4a */ = { - isa = PBXGroup; - children = ( - B4118C69153EFEC200C8D926 /* BibTeX.pm */, - B4118C6A153EFEC200C8D926 /* Chooser.pm */, - B4118C6B153EFEC200C8D926 /* Common.pm */, - B4118C6C153EFEC200C8D926 /* Debconf.pm */, - B4118C6D153EFEC200C8D926 /* Dia.pm */, - B4118C6E153EFEC200C8D926 /* Docbook.pm */, - B4118C6F153EFEC200C8D926 /* Guide.pm */, - B4118C70153EFEC200C8D926 /* Halibut.pm */, - B4118C71153EFEC200C8D926 /* Html.pm */, - B4118C72153EFEC200C8D926 /* Ini.pm */, - B4118C73153EFEC200C8D926 /* KernelHelp.pm */, - B4118C74153EFEC200C8D926 /* LaTeX.pm */, - B4118C75153EFEC200C8D926 /* Man.pm */, - B4118C76153EFEC200C8D926 /* NewsDebian.pm */, - B4118C77153EFEC200C8D926 /* Po.pm */, - B4118C78153EFEC200C8D926 /* Pod.pm */, - B4118C79153EFEC200C8D926 /* Prop.pm */, - B4118C7A153EFEC200C8D926 /* Sgml.pm */, - B4118C7B153EFEC200C8D926 /* TeX.pm */, - B4118C7C153EFEC200C8D926 /* Texinfo.pm */, - B4118C7D153EFEC200C8D926 /* Text.pm */, - B4118C7E153EFEC200C8D926 /* TransTractor.pm */, - B4118C7F153EFEC200C8D926 /* Wml.pm */, - B4118C80153EFEC200C8D926 /* Xhtml.pm */, - B4118C81153EFEC200C8D926 /* Xml.pm */, - ); - path = Po4a; - sourceTree = ""; - }; - B4118C8E153EFF3300C8D926 /* po */ = { - isa = PBXGroup; - children = ( - B4118C8F153EFF3300C8D926 /* ar.po */, - B4118C90153EFF3300C8D926 /* bg.po */, - B4118C91153EFF3300C8D926 /* bs.po */, - B4118C92153EFF3300C8D926 /* ca.po */, - B4118C93153EFF3300C8D926 /* chameleon.pot */, - B4118C94153EFF3300C8D926 /* cs.po */, - B4118C95153EFF3300C8D926 /* de.po */, - B4118C96153EFF3300C8D926 /* el.po */, - B4118C97153EFF3300C8D926 /* en.po */, - B4118C98153EFF3300C8D926 /* es.po */, - B4118C99153EFF3300C8D926 /* fa.po */, - B4118C9A153EFF3300C8D926 /* fr.po */, - B4118C9B153EFF3300C8D926 /* he.po */, - B4118C9C153EFF3300C8D926 /* hr.po */, - B4118C9D153EFF3300C8D926 /* hu.po */, - B4118C9E153EFF3300C8D926 /* id.po */, - B4118C9F153EFF3300C8D926 /* it.po */, - B4118CA0153EFF3300C8D926 /* ko.po */, - B4118CA1153EFF3300C8D926 /* mk.po */, - B4118CA2153EFF3300C8D926 /* nl.po */, - B4118CA3153EFF3300C8D926 /* pl.po */, - B4118CA4153EFF3300C8D926 /* pt-BR.po */, - B4118CA5153EFF3300C8D926 /* pt-PT.po */, - B4118CA6153EFF3300C8D926 /* ro.po */, - B4118CA7153EFF3300C8D926 /* ru.po */, - B4118CA8153EFF3300C8D926 /* sr.po */, - B4118CA9153EFF3300C8D926 /* zh_CN.po */, - B4118CAA153EFF3300C8D926 /* zh_TW.po */, - ); - path = po; - sourceTree = ""; - }; B4189A0314BFBED900ED5B0B /* config */ = { isa = PBXGroup; children = ( @@ -3822,6 +3740,115 @@ name = lxdialog; sourceTree = ""; }; + B442D9F315C2164800985ED1 /* embed */ = { + isa = PBXGroup; + children = ( + B442D9F515C216C900985ED1 /* background.png */, + B442D9F615C216C900985ED1 /* boot.png */, + B442D9F715C216C900985ED1 /* device_cdrom.png */, + B442D9F815C216C900985ED1 /* device_ext3.png */, + B442D9F915C216C900985ED1 /* device_fat.png */, + B442D9FA15C216C900985ED1 /* device_generic.png */, + B442D9FB15C216C900985ED1 /* device_hfsplus.png */, + B442D9FC15C216C900985ED1 /* device_hfsraid.png */, + B442D9FD15C216C900985ED1 /* device_ntfs.png */, + B442D9FE15C216C900985ED1 /* device_scroll_next.png */, + B442D9FF15C216C900985ED1 /* device_scroll_prev.png */, + B442DA0015C216C900985ED1 /* device_selection.png */, + B442DA0115C216C900985ED1 /* font_console.png */, + B442DA0215C216C900985ED1 /* font_small.png */, + B442DA0315C216C900985ED1 /* logo.png */, + B442DA0415C216C900985ED1 /* menu_boot.png */, + B442DA0515C216C900985ED1 /* menu_help.png */, + B442DA0615C216C900985ED1 /* menu_ignore_caches_disabled.png */, + B442DA0715C216C900985ED1 /* menu_ignore_caches.png */, + B442DA0815C216C900985ED1 /* menu_memory_info.png */, + B442DA0915C216C900985ED1 /* menu_selection.png */, + B442DA0A15C216C900985ED1 /* menu_single_user_disabled.png */, + B442DA0B15C216C900985ED1 /* menu_single_user.png */, + B442DA0C15C216C900985ED1 /* menu_verbose_disabled.png */, + B442DA0D15C216C900985ED1 /* menu_verbose.png */, + B442DA0E15C216C900985ED1 /* menu_video_info.png */, + B442DA0F15C216C900985ED1 /* progress_bar_background.png */, + B442DA1015C216C900985ED1 /* progress_bar.png */, + B442DA1115C216C900985ED1 /* text_scroll_next.png */, + B442DA1215C216C900985ED1 /* text_scroll_prev.png */, + B442DA1315C216C900985ED1 /* theme.plist */, + ); + name = embed; + sourceTree = ""; + }; + B442D9F415C2166000985ED1 /* legacy */ = { + isa = PBXGroup; + children = ( + B442DA1415C216E500985ED1 /* background.png */, + B442DA1515C216E500985ED1 /* boot.png */, + B442DA1615C216E500985ED1 /* device_cdrom.png */, + B442DA1715C216E500985ED1 /* device_ext3.png */, + B442DA1815C216E500985ED1 /* device_fat.png */, + B442DA1915C216E500985ED1 /* device_generic.png */, + B442DA1A15C216E500985ED1 /* device_hfsplus.png */, + B442DA1B15C216E500985ED1 /* device_ntfs.png */, + B442DA1C15C216E500985ED1 /* device_scroll_next.png */, + B442DA1D15C216E500985ED1 /* device_scroll_prev.png */, + B442DA1E15C216E500985ED1 /* device_selection.png */, + B442DA1F15C216E500985ED1 /* font_console.png */, + B442DA2015C216E500985ED1 /* font_small.png */, + B442DA2115C216E500985ED1 /* logo.png */, + B442DA2215C216E500985ED1 /* menu_boot.png */, + B442DA2315C216E500985ED1 /* menu_help.png */, + B442DA2415C216E500985ED1 /* menu_ignore_caches_disabled.png */, + B442DA2515C216E500985ED1 /* menu_ignore_caches.png */, + B442DA2615C216E500985ED1 /* menu_memory_info.png */, + B442DA2715C216E500985ED1 /* menu_selection.png */, + B442DA2815C216E500985ED1 /* menu_single_user_disabled.png */, + B442DA2915C216E500985ED1 /* menu_single_user.png */, + B442DA2A15C216E500985ED1 /* menu_verbose_disabled.png */, + B442DA2B15C216E500985ED1 /* menu_verbose.png */, + B442DA2C15C216E500985ED1 /* menu_video_info.png */, + B442DA2D15C216E500985ED1 /* progress_bar_background.png */, + B442DA2E15C216E500985ED1 /* progress_bar.png */, + B442DA2F15C216E500985ED1 /* text_scroll_next.png */, + B442DA3015C216E500985ED1 /* text_scroll_prev.png */, + B442DA3115C216E500985ED1 /* theme.plist */, + ); + name = legacy; + sourceTree = ""; + }; + B4526096153EFCE90018E994 /* po */ = { + isa = PBXGroup; + children = ( + 36256EF41752BA5A0018189D /* ar.po */, + 36256EF51752BA5A0018189D /* bg.po */, + 36256EF71752BA5A0018189D /* bs.po */, + 36256EF81752BA5A0018189D /* ca.po */, + 36256EF91752BA5A0018189D /* chameleon.pot */, + 36256EFB1752BA5A0018189D /* de.po */, + 36256EFC1752BA5A0018189D /* el.po */, + 36256EFD1752BA5A0018189D /* en.po */, + 36256EFE1752BA5A0018189D /* es.po */, + 36256EFF1752BA5A0018189D /* fa.po */, + 36256F001752BA5A0018189D /* fr.po */, + 36256F011752BA5A0018189D /* he.po */, + 36256F021752BA5A0018189D /* hr.po */, + 36256F031752BA5A0018189D /* hu.po */, + 36256F041752BA5A0018189D /* id.po */, + 36256F051752BA5A0018189D /* it.po */, + 36256F061752BA5A0018189D /* ja.po */, + 36256F071752BA5A0018189D /* ko.po */, + 36256F081752BA5A0018189D /* mk.po */, + 36256F091752BA5A0018189D /* nl.po */, + 36256F0A1752BA5A0018189D /* pl.po */, + 36256F0B1752BA5A0018189D /* pt.po */, + 36256F0C1752BA5A0018189D /* ro.po */, + 36256F0D1752BA5A0018189D /* ru.po */, + 36256F0E1752BA5A0018189D /* sr.po */, + 36256F0F1752BA5A0018189D /* zh_CN.po */, + 36256F101752BA5A0018189D /* zh_TW.po */, + ); + path = po; + sourceTree = ""; + }; B4AABE5814C3B8B90055ECD1 /* AddOption */ = { isa = PBXGroup; children = ( @@ -3849,6 +3876,379 @@ path = Scripts.templates/InstallTheme; sourceTree = ""; }; + B4B3DDA515B8E384002FAA73 /* Sata */ = { + isa = PBXGroup; + children = ( + B4B3DDA615B8E3CB002FAA73 /* Cconfig */, + B4B3DDA715B8E3CB002FAA73 /* include */, + B4B3DDA815B8E3CB002FAA73 /* Makefile */, + B4B3DDA915B8E3CB002FAA73 /* Sata.c */, + ); + name = Sata; + sourceTree = ""; + }; + B4B3DDA715B8E3CB002FAA73 /* include */ = { + isa = PBXGroup; + children = ( + ); + name = include; + path = Sata/include; + sourceTree = ""; + }; + B4B3DDBE15B8E914002FAA73 /* ar.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDBF15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDC115B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ar.lproj; + sourceTree = ""; + }; + B4B3DDC315B8E914002FAA73 /* bg.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDC415B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDC615B8E914002FAA73 /* Welcome.rtfd */, + ); + path = bg.lproj; + sourceTree = ""; + }; + B4B3DDC815B8E914002FAA73 /* bs.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDC915B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDCB15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = bs.lproj; + sourceTree = ""; + }; + B4B3DDCD15B8E914002FAA73 /* ca.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDCE15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDD015B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ca.lproj; + sourceTree = ""; + }; + B4B3DDD215B8E914002FAA73 /* common */ = { + isa = PBXGroup; + children = ( + B4B3DDD315B8E914002FAA73 /* License.rtf */, + ); + path = common; + sourceTree = ""; + }; + B4B3DDD415B8E914002FAA73 /* cs.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDD515B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDD715B8E914002FAA73 /* Welcome.rtfd */, + ); + path = cs.lproj; + sourceTree = ""; + }; + B4B3DDD915B8E914002FAA73 /* da.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDDA15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDDC15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = da.lproj; + sourceTree = ""; + }; + B4B3DDDE15B8E914002FAA73 /* de.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDDF15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDE115B8E914002FAA73 /* Welcome.rtfd */, + ); + path = de.lproj; + sourceTree = ""; + }; + B4B3DDE515B8E914002FAA73 /* el.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDE615B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDE815B8E914002FAA73 /* Welcome.rtfd */, + ); + path = el.lproj; + sourceTree = ""; + }; + B4B3DDEA15B8E914002FAA73 /* en.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDEB15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDED15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = en.lproj; + sourceTree = ""; + }; + B4B3DDEF15B8E914002FAA73 /* es.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDF015B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDF215B8E914002FAA73 /* Welcome.rtfd */, + ); + path = es.lproj; + sourceTree = ""; + }; + B4B3DDF415B8E914002FAA73 /* fa.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDF515B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDF715B8E914002FAA73 /* Welcome.rtfd */, + ); + path = fa.lproj; + sourceTree = ""; + }; + B4B3DDF915B8E914002FAA73 /* fi.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDFA15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DDFC15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = fi.lproj; + sourceTree = ""; + }; + B4B3DDFE15B8E914002FAA73 /* fr.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DDFF15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE0115B8E914002FAA73 /* Welcome.rtfd */, + ); + path = fr.lproj; + sourceTree = ""; + }; + B4B3DE0315B8E914002FAA73 /* he.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE0415B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE0615B8E914002FAA73 /* Welcome.rtfd */, + ); + path = he.lproj; + sourceTree = ""; + }; + B4B3DE0815B8E914002FAA73 /* hr.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE0915B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE0B15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = hr.lproj; + sourceTree = ""; + }; + B4B3DE0D15B8E914002FAA73 /* hu.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE0E15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE1015B8E914002FAA73 /* Welcome.rtfd */, + ); + path = hu.lproj; + sourceTree = ""; + }; + B4B3DE1215B8E914002FAA73 /* id.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE1315B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE1515B8E914002FAA73 /* Welcome.rtfd */, + ); + path = id.lproj; + sourceTree = ""; + }; + B4B3DE1715B8E914002FAA73 /* it.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE1815B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE1A15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = it.lproj; + sourceTree = ""; + }; + B4B3DE1C15B8E914002FAA73 /* ja.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE1D15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE1F15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ja.lproj; + sourceTree = ""; + }; + B4B3DE2115B8E914002FAA73 /* ko.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE2215B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE2415B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ko.lproj; + sourceTree = ""; + }; + B4B3DE2615B8E914002FAA73 /* mk.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE2715B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE2915B8E914002FAA73 /* Welcome.rtfd */, + ); + path = mk.lproj; + sourceTree = ""; + }; + B4B3DE2B15B8E914002FAA73 /* ms.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE2C15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE2E15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ms.lproj; + sourceTree = ""; + }; + B4B3DE3015B8E914002FAA73 /* nl.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE3115B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE3315B8E914002FAA73 /* Welcome.rtfd */, + ); + path = nl.lproj; + sourceTree = ""; + }; + B4B3DE3515B8E914002FAA73 /* pl.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE3615B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE3815B8E914002FAA73 /* Welcome.rtfd */, + ); + path = pl.lproj; + sourceTree = ""; + }; + B4B3DE3A15B8E914002FAA73 /* br.lproj */ = { + isa = PBXGroup; + children = ( + 362317A517510EB900A25D5D /* Conclusion.rtfd */, + 362317A717510EB900A25D5D /* Welcome.rtfd */, + ); + name = br.lproj; + path = "pt-BR.lproj"; + sourceTree = ""; + }; + B4B3DE3F15B8E914002FAA73 /* pt.lproj */ = { + isa = PBXGroup; + children = ( + 362317A917510ECE00A25D5D /* Conclusion.rtfd */, + 362317AB17510ECE00A25D5D /* Welcome.rtfd */, + ); + name = pt.lproj; + path = "pt-PT.lproj"; + sourceTree = ""; + }; + B4B3DE4415B8E914002FAA73 /* ro.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE4515B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE4715B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ro.lproj; + sourceTree = ""; + }; + B4B3DE4915B8E914002FAA73 /* ru.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE4A15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE4C15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = ru.lproj; + sourceTree = ""; + }; + B4B3DE4E15B8E914002FAA73 /* sk.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE4F15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE5115B8E914002FAA73 /* Welcome.rtfd */, + ); + path = sk.lproj; + sourceTree = ""; + }; + B4B3DE5315B8E914002FAA73 /* sr.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE5415B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE5615B8E914002FAA73 /* Welcome.rtfd */, + ); + path = sr.lproj; + sourceTree = ""; + }; + B4B3DE5815B8E914002FAA73 /* sv.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE5915B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE5B15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = sv.lproj; + sourceTree = ""; + }; + B4B3DE5D15B8E914002FAA73 /* templates */ = { + isa = PBXGroup; + children = ( + B4B3DE5E15B8E914002FAA73 /* Conclusion.html */, + B4B3DE5F15B8E914002FAA73 /* Description.html */, + B4B3DE6015B8E914002FAA73 /* Localizable.strings */, + B4B3DE6115B8E914002FAA73 /* Welcome.html */, + ); + path = templates; + sourceTree = ""; + }; + B4B3DE6215B8E914002FAA73 /* th.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE6315B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE6515B8E914002FAA73 /* Welcome.rtfd */, + ); + path = th.lproj; + sourceTree = ""; + }; + B4B3DE6715B8E914002FAA73 /* tr.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE6815B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE6A15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = tr.lproj; + sourceTree = ""; + }; + B4B3DE6C15B8E914002FAA73 /* uk.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE6D15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE6F15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = uk.lproj; + sourceTree = ""; + }; + B4B3DE7115B8E914002FAA73 /* vi.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE7215B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE7415B8E914002FAA73 /* Welcome.rtfd */, + ); + path = vi.lproj; + sourceTree = ""; + }; + B4B3DE7615B8E914002FAA73 /* zh_CN.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE7715B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE7915B8E914002FAA73 /* Welcome.rtfd */, + ); + path = zh_CN.lproj; + sourceTree = ""; + }; + B4B3DE7B15B8E914002FAA73 /* zh_TW.lproj */ = { + isa = PBXGroup; + children = ( + B4B3DE7C15B8E914002FAA73 /* Conclusion.rtfd */, + B4B3DE7E15B8E914002FAA73 /* Welcome.rtfd */, + ); + path = zh_TW.lproj; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXLegacyTarget section */ @@ -3872,7 +4272,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0440; }; buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "Chameleon" */; compatibilityVersion = "Xcode 3.2"; @@ -3916,6 +4316,9 @@ vi, zh_CN, zh_TW, + fa, + br, + pt, ); mainGroup = 08FB7794FE84155DC02AAC07 /* Chameleon */; projectDirPath = ""; @@ -3927,172 +4330,605 @@ /* End PBXProject section */ /* Begin PBXVariantGroup section */ - A396E4F41502D0580025A245 /* Conclusion.rtfd */ = { + 362317A517510EB900A25D5D /* Conclusion.rtfd */ = { isa = PBXVariantGroup; children = ( - A396E4F51502D0580025A245 /* ar */, - A396E4FF1502D0580025A245 /* bg */, - A396E5041502D0580025A245 /* bs */, - A396E5091502D0580025A245 /* ca */, - A396E50E1502D0580025A245 /* de */, - A396E5131502D0580025A245 /* el */, - A396E5181502D0580025A245 /* en */, - A396E51D1502D0580025A245 /* es */, - A396E5221502D0580025A245 /* fr */, - A396E5271502D0580025A245 /* he */, - A396E52C1502D0580025A245 /* hr */, - A396E5311502D0580025A245 /* id */, - A396E5361502D0580025A245 /* it */, - A396E53B1502D0580025A245 /* ja */, - A396E5401502D0580025A245 /* ko */, - A396E5451502D0580025A245 /* mk */, - A396E54A1502D0580025A245 /* nl */, - A396E54F1502D0580025A245 /* pl */, - A396E5541502D0580025A245 /* pt-BR */, - A396E5591502D0580025A245 /* pt-PT */, - A396E55E1502D0580025A245 /* ro */, - A396E5631502D0580025A245 /* ru */, - A396E5681502D0580025A245 /* sr */, - A396E56D1502D0580025A245 /* zh_CN */, - A396E5721502D0580025A245 /* zh_TW */, + 362317A617510EB900A25D5D /* br */, ); name = Conclusion.rtfd; sourceTree = ""; }; - A396E4F61502D0580025A245 /* Description.html */ = { + 362317A717510EB900A25D5D /* Welcome.rtfd */ = { isa = PBXVariantGroup; children = ( - A396E4F71502D0580025A245 /* ar */, - A396E5001502D0580025A245 /* bg */, - A396E5051502D0580025A245 /* bs */, - A396E50A1502D0580025A245 /* ca */, - A396E50F1502D0580025A245 /* de */, - A396E5141502D0580025A245 /* el */, - A396E5191502D0580025A245 /* en */, - A396E51E1502D0580025A245 /* es */, - A396E5231502D0580025A245 /* fr */, - A396E5281502D0580025A245 /* he */, - A396E52D1502D0580025A245 /* hr */, - A396E5321502D0580025A245 /* id */, - A396E5371502D0580025A245 /* it */, - A396E53C1502D0580025A245 /* ja */, - A396E5411502D0580025A245 /* ko */, - A396E5461502D0580025A245 /* mk */, - A396E54B1502D0580025A245 /* nl */, - A396E5501502D0580025A245 /* pl */, - A396E5551502D0580025A245 /* pt-BR */, - A396E55A1502D0580025A245 /* pt-PT */, - A396E55F1502D0580025A245 /* ro */, - A396E5641502D0580025A245 /* ru */, - A396E5691502D0580025A245 /* sr */, - A396E56E1502D0580025A245 /* zh_CN */, - A396E5731502D0580025A245 /* zh_TW */, + 362317A817510EB900A25D5D /* br */, ); - name = Description.html; + name = Welcome.rtfd; sourceTree = ""; }; - A396E4F81502D0580025A245 /* License.rtf */ = { + 362317A917510ECE00A25D5D /* Conclusion.rtfd */ = { isa = PBXVariantGroup; children = ( - A396E4F91502D0580025A245 /* ar */, - A396E5011502D0580025A245 /* bg */, - A396E5061502D0580025A245 /* bs */, - A396E50B1502D0580025A245 /* ca */, - A396E5101502D0580025A245 /* de */, - A396E5151502D0580025A245 /* el */, - A396E51A1502D0580025A245 /* en */, - A396E51F1502D0580025A245 /* es */, - A396E5241502D0580025A245 /* fr */, - A396E5291502D0580025A245 /* he */, - A396E52E1502D0580025A245 /* hr */, - A396E5331502D0580025A245 /* id */, - A396E5381502D0580025A245 /* it */, - A396E53D1502D0580025A245 /* ja */, - A396E5421502D0580025A245 /* ko */, - A396E5471502D0580025A245 /* mk */, - A396E54C1502D0580025A245 /* nl */, - A396E5511502D0580025A245 /* pl */, - A396E5561502D0580025A245 /* pt-BR */, - A396E55B1502D0580025A245 /* pt-PT */, - A396E5601502D0580025A245 /* ro */, - A396E5651502D0580025A245 /* ru */, - A396E56A1502D0580025A245 /* sr */, - A396E56F1502D0580025A245 /* zh_CN */, - A396E5741502D0580025A245 /* zh_TW */, + 362317AA17510ECE00A25D5D /* pt */, ); - name = License.rtf; + name = Conclusion.rtfd; sourceTree = ""; }; - A396E4FA1502D0580025A245 /* Localizable.strings */ = { + 362317AB17510ECE00A25D5D /* Welcome.rtfd */ = { isa = PBXVariantGroup; children = ( - A396E4FB1502D0580025A245 /* ar */, - A396E5021502D0580025A245 /* bg */, - A396E5071502D0580025A245 /* bs */, - A396E50C1502D0580025A245 /* ca */, - A396E5111502D0580025A245 /* de */, - A396E5161502D0580025A245 /* el */, - A396E51B1502D0580025A245 /* en */, - A396E5201502D0580025A245 /* es */, - A396E5251502D0580025A245 /* fr */, - A396E52A1502D0580025A245 /* he */, - A396E52F1502D0580025A245 /* hr */, - A396E5341502D0580025A245 /* id */, - A396E5391502D0580025A245 /* it */, - A396E53E1502D0580025A245 /* ja */, - A396E5431502D0580025A245 /* ko */, - A396E5481502D0580025A245 /* mk */, - A396E54D1502D0580025A245 /* nl */, - A396E5521502D0580025A245 /* pl */, - A396E5571502D0580025A245 /* pt-BR */, - A396E55C1502D0580025A245 /* pt-PT */, - A396E5611502D0580025A245 /* ro */, - A396E5661502D0580025A245 /* ru */, - A396E56B1502D0580025A245 /* sr */, - A396E5701502D0580025A245 /* zh_CN */, - A396E5751502D0580025A245 /* zh_TW */, + 362317AC17510ECE00A25D5D /* pt */, ); - name = Localizable.strings; + name = Welcome.rtfd; sourceTree = ""; }; - A396E4FC1502D0580025A245 /* Welcome.rtfd */ = { + B4B3DDBF15B8E914002FAA73 /* Conclusion.rtfd */ = { isa = PBXVariantGroup; children = ( - A396E4FD1502D0580025A245 /* ar */, - A396E5031502D0580025A245 /* bg */, - A396E5081502D0580025A245 /* bs */, - A396E50D1502D0580025A245 /* ca */, - A396E5121502D0580025A245 /* de */, - A396E5171502D0580025A245 /* el */, - A396E51C1502D0580025A245 /* en */, - A396E5211502D0580025A245 /* es */, - A396E5261502D0580025A245 /* fr */, - A396E52B1502D0580025A245 /* he */, - A396E5301502D0580025A245 /* hr */, - A396E5351502D0580025A245 /* id */, - A396E53A1502D0580025A245 /* it */, - A396E53F1502D0580025A245 /* ja */, - A396E5441502D0580025A245 /* ko */, - A396E5491502D0580025A245 /* mk */, - A396E54E1502D0580025A245 /* nl */, - A396E5531502D0580025A245 /* pl */, - A396E5581502D0580025A245 /* pt-BR */, - A396E55D1502D0580025A245 /* pt-PT */, - A396E5621502D0580025A245 /* ro */, - A396E5671502D0580025A245 /* ru */, - A396E56C1502D0580025A245 /* sr */, - A396E5711502D0580025A245 /* zh_CN */, - A396E5761502D0580025A245 /* zh_TW */, + B4B3DDC015B8E914002FAA73 /* ar */, ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDC115B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDC215B8E914002FAA73 /* ar */, + ); name = Welcome.rtfd; sourceTree = ""; }; + B4B3DDC415B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDC515B8E914002FAA73 /* bg */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDC615B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDC715B8E914002FAA73 /* bg */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDC915B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDCA15B8E914002FAA73 /* bs */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDCB15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDCC15B8E914002FAA73 /* bs */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDCE15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDCF15B8E914002FAA73 /* ca */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDD015B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDD115B8E914002FAA73 /* ca */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDD515B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDD615B8E914002FAA73 /* cs */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDD715B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDD815B8E914002FAA73 /* cs */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDDA15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDDB15B8E914002FAA73 /* da */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDDC15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDDD15B8E914002FAA73 /* da */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDDF15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDE015B8E914002FAA73 /* de */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDE115B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDE215B8E914002FAA73 /* de */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDE615B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDE715B8E914002FAA73 /* el */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDE815B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDE915B8E914002FAA73 /* el */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDEB15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDEC15B8E914002FAA73 /* en */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDED15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDEE15B8E914002FAA73 /* en */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDF015B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDF115B8E914002FAA73 /* es */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDF215B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDF315B8E914002FAA73 /* es */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDF515B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDF615B8E914002FAA73 /* fa */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDF715B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDF815B8E914002FAA73 /* fa */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDFA15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDFB15B8E914002FAA73 /* fi */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DDFC15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DDFD15B8E914002FAA73 /* fi */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DDFF15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0015B8E914002FAA73 /* fr */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE0115B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0215B8E914002FAA73 /* fr */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE0415B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0515B8E914002FAA73 /* he */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE0615B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0715B8E914002FAA73 /* he */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE0915B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0A15B8E914002FAA73 /* hr */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE0B15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0C15B8E914002FAA73 /* hr */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE0E15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE0F15B8E914002FAA73 /* hu */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE1015B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE1115B8E914002FAA73 /* hu */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE1315B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE1415B8E914002FAA73 /* id */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE1515B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE1615B8E914002FAA73 /* id */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE1815B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE1915B8E914002FAA73 /* it */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE1A15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE1B15B8E914002FAA73 /* it */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE1D15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE1E15B8E914002FAA73 /* ja */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE1F15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2015B8E914002FAA73 /* ja */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE2215B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2315B8E914002FAA73 /* ko */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE2415B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2515B8E914002FAA73 /* ko */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE2715B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2815B8E914002FAA73 /* mk */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE2915B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2A15B8E914002FAA73 /* mk */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE2C15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2D15B8E914002FAA73 /* ms */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE2E15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE2F15B8E914002FAA73 /* ms */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE3115B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE3215B8E914002FAA73 /* nl */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE3315B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE3415B8E914002FAA73 /* nl */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE3615B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE3715B8E914002FAA73 /* pl */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE3815B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE3915B8E914002FAA73 /* pl */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE4515B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE4615B8E914002FAA73 /* ro */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE4715B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE4815B8E914002FAA73 /* ro */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE4A15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE4B15B8E914002FAA73 /* ru */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE4C15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE4D15B8E914002FAA73 /* ru */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE4F15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE5015B8E914002FAA73 /* sk */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE5115B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE5215B8E914002FAA73 /* sk */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE5415B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE5515B8E914002FAA73 /* sr */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE5615B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE5715B8E914002FAA73 /* sr */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE5915B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE5A15B8E914002FAA73 /* sv */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE5B15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE5C15B8E914002FAA73 /* sv */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE6315B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE6415B8E914002FAA73 /* th */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE6515B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE6615B8E914002FAA73 /* th */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE6815B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE6915B8E914002FAA73 /* tr */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE6A15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE6B15B8E914002FAA73 /* tr */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE6D15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE6E15B8E914002FAA73 /* uk */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE6F15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7015B8E914002FAA73 /* uk */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE7215B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7315B8E914002FAA73 /* vi */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE7415B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7515B8E914002FAA73 /* vi */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE7715B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7815B8E914002FAA73 /* zh_CN */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE7915B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7A15B8E914002FAA73 /* zh_CN */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; + B4B3DE7C15B8E914002FAA73 /* Conclusion.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7D15B8E914002FAA73 /* zh_TW */, + ); + name = Conclusion.rtfd; + sourceTree = ""; + }; + B4B3DE7E15B8E914002FAA73 /* Welcome.rtfd */ = { + isa = PBXVariantGroup; + children = ( + B4B3DE7F15B8E914002FAA73 /* zh_TW */, + ); + name = Welcome.rtfd; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 1DEB919008733D9F0010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUGGING_SYMBOLS = YES; GCC_DYNAMIC_NO_PIC = NO; @@ -4107,6 +4943,7 @@ 1DEB919108733D9F0010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; Index: branches/ErmaC/Enoch/i386/libsaio/xml.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/xml.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/xml.c (revision 2323) @@ -68,20 +68,20 @@ } struct Module { - struct Module *nextModule; - long willLoad; - TagPtr dict; - char *plistAddr; - long plistLength; - char *driverPath; + struct Module *nextModule; + long willLoad; + TagPtr dict; + char *plistAddr; + long plistLength; + char *driverPath; }; typedef struct Module Module, *ModulePtr; struct DriverInfo { - char *plistAddr; - long plistLength; - void *moduleAddr; - long moduleLength; + char *plistAddr; + long plistLength; + void *moduleAddr; + long moduleLength; }; typedef struct DriverInfo DriverInfo, *DriverInfoPtr; @@ -89,20 +89,20 @@ #define kDriverPackageSignature2 'MOSX' struct DriversPackage { - unsigned long signature1; - unsigned long signature2; - unsigned long length; - unsigned long adler32; - unsigned long version; - unsigned long numDrivers; - unsigned long reserved1; - unsigned long reserved2; + unsigned long signature1; + unsigned long signature2; + unsigned long length; + unsigned long adler32; + unsigned long version; + unsigned long numDrivers; + unsigned long reserved1; + unsigned long reserved2; }; typedef struct DriversPackage DriversPackage; enum { - kCFBundleType2, - kCFBundleType3 + kCFBundleType2, + kCFBundleType3 }; @@ -114,6 +114,7 @@ static long ParseTagInteger(char *buffer, TagPtr *tag); static long ParseTagData(char *buffer, TagPtr *tag); static long ParseTagDate(char *buffer, TagPtr *tag); +//static long ParseTagBoolean(char *buffer, TagPtr *tag, long type); static long GetNextTag(char *buffer, char **tag, long *start); static long FixDataMatchingTag(char *buffer, char *tag); static TagPtr NewTag(void); @@ -127,7 +128,7 @@ // XMLGetProperty TagPtr -XMLGetProperty( TagPtr dict, const char * key ) +XMLGetProperty(TagPtr dict, const char * key) { TagPtr tagList, tag; @@ -140,12 +141,16 @@ tag = tagList; tagList = tag->tagNext; - if ((tag->type != kTagTypeKey) || (tag->string == 0)) continue; - - if (!strcmp(tag->string, key)) return tag->tag; - } - - return 0; + if ((tag->type != kTagTypeKey) || (tag->string == 0)) { + continue; + } + + if (!strcmp(tag->string, key)) { + return tag->tag; + } + } + + return 0; } //========================================================================== @@ -154,31 +159,40 @@ TagPtr XMLGetKey( TagPtr dict, int id ) { - TagPtr tagList, tag; + TagPtr tagList, tag; - if (dict->type != kTagTypeDict) return 0; - - tag = 0; - int element = 0; - tagList = dict->tag; - while (tagList && element != id) - { - tag = tagList; - tagList = tag->tagNext; - - if ((tag->type != kTagTypeKey) || (tag->string == 0)) continue; - element++; - if(id == element) return tag; - } - return 0; + if (dict->type != kTagTypeDict) { + return 0; + } + + tag = 0; + int element = 0; + tagList = dict->tag; + while (tagList && element != id) + { + tag = tagList; + tagList = tag->tagNext; + + if ((tag->type != kTagTypeKey) || (tag->string == 0)) { + continue; + } + + element++; + if(id == element) { + return tag; + } + + } + return 0; } TagPtr XMLGetValueForKey(TagPtr key) { - if (!key || - key->type != kTagTypeKey) return 0; - - return key->tag; + if (!key || key->type != kTagTypeKey) { + return 0; + } + + return key->tag; } @@ -190,30 +204,37 @@ int count = 0; TagPtr tagList, tag; - if (dict->type != kTagTypeDict && dict->type != kTagTypeArray) return 0; + if (dict->type != kTagTypeDict && dict->type != kTagTypeArray) { + return 0; + } + tag = 0; - tagList = dict->tag; - while (tagList) - { + tagList = dict->tag; + while (tagList) + { tag = tagList; - tagList = tag->tagNext; + tagList = tag->tagNext; if (((tag->type != kTagTypeKey) && ((tag->string == 0) || (tag->string[0] == 0))) && (dict->type != kTagTypeArray) // If we are an array, any element is valid - ) continue; + ) { + continue; + } //if(tag->type == kTagTypeKey) printf("Located key %s\n", tag->string); count++; - } + } return count; } TagPtr XMLGetElement( TagPtr dict, int id ) { - if(dict->type != kTagTypeArray) return 0; - + if(dict->type != kTagTypeArray) { + return 0; + } + int element = 0; TagPtr tmp = dict->tag; @@ -230,59 +251,58 @@ char* XMLDecode(const char* src) { - typedef const struct XMLEntity { - const char* name; - size_t nameLen; - char value; - } XMLEntity; - - /* This is ugly, but better than specifying the lengths by hand */ - #define _e(str,c) {str,sizeof(str)-1,c} - const XMLEntity ents[] = { - _e("quot;",'"'), _e("apos;",'\''), - _e("lt;", '<'), _e("gt;", '>'), - _e("amp;", '&') - }; - - size_t len; - const char *s; - char *out, *o; - - if ( !src || !(len = strlen(src)) || !(out = malloc(len+1)) ) - return 0; - - o = out; - s = src; - while (s <= src+len) /* Make sure the terminator is also copied */ - { - if ( *s == '&' ) - { - bool entFound = false; - int i; - - s++; - for ( i = 0; i < sizeof(ents)/sizeof(ents[0]); i++) - { - if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 ) - { - entFound = true; - break; - } - } - if ( entFound ) - { - *o++ = ents[i].value; - s += ents[i].nameLen; - continue; - } - } - - *o++ = *s++; - } + typedef const struct XMLEntity { + const char* name; + size_t nameLen; + char value; + } XMLEntity; - return out; -} + /* This is ugly, but better than specifying the lengths by hand */ + #define _e(str,c) {str,sizeof(str)-1,c} + const XMLEntity ents[] = { + _e("quot;",'"'), _e("apos;",'\''), + _e("lt;", '<'), _e("gt;", '>'), + _e("amp;", '&') + }; + size_t len; + const char *s; + char *out, *o; + + if ( !src || !(len = strlen(src)) || !(out = malloc(len+1)) ) { + return 0; + } + + o = out; + s = src; + while (s <= src+len) /* Make sure the terminator is also copied */ + { + if ( *s == '&' ) { + bool entFound = false; + int i; + + s++; + for ( i = 0; i < sizeof(ents)/sizeof(ents[0]); i++) + { + if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 ) { + entFound = true; + break; + } + } + if ( entFound ) { + *o++ = ents[i].value; + s += ents[i].nameLen; + + continue; + } + } + + *o++ = *s++; + } + + return out; +} + //#if UNUSED //========================================================================== // XMLParseFile @@ -294,25 +314,25 @@ long XMLParseFile( char * buffer, TagPtr * dict ) { - long length, pos; - TagPtr tag; - pos = 0; + long length, pos; + TagPtr tag; + pos = 0; char *configBuffer; - - int strlength = strlen(buffer); - configBuffer = malloc(strlength+1); - bcopy(buffer, configBuffer, strlength); - configBuffer[strlength] = 0; + int strlength = strlen(buffer); + configBuffer = malloc(strlength+1); + bcopy(buffer, configBuffer, strlength); + configBuffer[strlength] = 0; + buffer_start = configBuffer; while (1) { length = XMLParseNextTag(configBuffer + pos, &tag); if (length == -1) break; - + pos += length; - + if (tag == 0) continue; if (tag->type == kTagTypeDict) break; @@ -335,14 +355,18 @@ { long length, pos; char * tagName; - + length = GetNextTag(buffer, &tagName, 0); - if (length == -1) return -1; - + if (length == -1) { + return -1; + } + pos = length; if (!strncmp(tagName, kXMLTagPList, 6)) { length = 0; + // just a header; nothing to parse + // return-via-reference tag should be left alone } /***** dict ****/ else if (!strcmp(tagName, kXMLTagDict)) @@ -362,7 +386,7 @@ { length = ParseTagKey(buffer + pos, tag); } - + /***** string ****/ else if (!strcmp(tagName, kXMLTagString)) { @@ -431,7 +455,7 @@ //printf("Located IDREF, id = %d, string = %s\n", id, str); } } - + /***** integer ****/ else if (!strcmp(tagName, kXMLTagInteger)) { @@ -518,13 +542,13 @@ { length = ParseTagDate(buffer + pos, tag); } - + /***** date ****/ else if (!strncmp(tagName, kXMLTagDate " ", strlen(kXMLTagDate " "))) { length = ParseTagDate(buffer + pos, tag); } - + /***** false ****/ else if (!strcmp(tagName, kXMLTagFalse)) { @@ -535,7 +559,7 @@ { length = ParseTagBoolean(buffer + pos, tag, kTagTypeTrue); } - + /***** array ****/ else if (!strcmp(tagName, kXMLTagArray)) { @@ -549,16 +573,19 @@ { length = ParseTagList(buffer + pos, tag, kTagTypeArray, 1); } - + /***** unknown ****/ else { + // it wasn't parsed so we consumed no additional characters *tag = 0; length = 0; } - - if (length == -1) return -1; - + + if (length == -1) { + return -1; + } + return pos + length; } @@ -571,46 +598,51 @@ long length, pos; TagPtr tagList, tmpTag; - tagList = 0; - pos = 0; + tagList = 0; + pos = 0; - if (!empty) - { - while (1) - { - length = XMLParseNextTag(buffer + pos, &tmpTag); - if (length == -1) break; + if (!empty) + { + while (1) + { + length = XMLParseNextTag(buffer + pos, &tmpTag); + if (length == -1) { + break; + } - pos += length; + pos += length; - if (tmpTag == 0) break; - tmpTag->tagNext = tagList; - tagList = tmpTag; - } - - if (length == -1) - { - XMLFreeTag(tagList); - return -1; - } - } + // detect end of list + if (tmpTag == 0) { + break; + } + tmpTag->tagNext = tagList; + tagList = tmpTag; + } + + if (length == -1) + { + XMLFreeTag(tagList); + return -1; + } + } - tmpTag = NewTag(); - if (tmpTag == 0) - { - XMLFreeTag(tagList); - return -1; - } + tmpTag = NewTag(); + if (tmpTag == 0) + { + XMLFreeTag(tagList); + return -1; + } - tmpTag->type = type; - tmpTag->string = 0; + tmpTag->type = type; + tmpTag->string = 0; tmpTag->offset = buffer_start ? buffer - buffer_start : 0; - tmpTag->tag = tagList; - tmpTag->tagNext = 0; - - *tag = tmpTag; - - return pos; + tmpTag->tag = tagList; + tmpTag->tagNext = 0; + + *tag = tmpTag; + + return pos; } //========================================================================== @@ -619,40 +651,42 @@ static long ParseTagKey( char * buffer, TagPtr * tag ) { - long length, length2; - char *string; - TagPtr tmpTag, subTag; + long length, length2; + char *string; + TagPtr tmpTag, subTag; - length = FixDataMatchingTag(buffer, kXMLTagKey); - if (length == -1) return -1; + length = FixDataMatchingTag(buffer, kXMLTagKey); + if (length == -1) { + return -1; + } - length2 = XMLParseNextTag(buffer + length, &subTag); - if (length2 == -1) return -1; + length2 = XMLParseNextTag(buffer + length, &subTag); + if (length2 == -1) { + return -1; + } + + tmpTag = NewTag(); + if (tmpTag == 0) { + XMLFreeTag(subTag); + return -1; + } - tmpTag = NewTag(); - if (tmpTag == 0) - { - XMLFreeTag(subTag); - return -1; - } + string = NewSymbol(buffer); + if (string == 0) { + XMLFreeTag(subTag); + XMLFreeTag(tmpTag); + return -1; + } - string = NewSymbol(buffer); - if (string == 0) - { - XMLFreeTag(subTag); - XMLFreeTag(tmpTag); - return -1; - } - - tmpTag->type = kTagTypeKey; - tmpTag->string = string; - tmpTag->tag = subTag; + tmpTag->type = kTagTypeKey; + tmpTag->string = string; + tmpTag->tag = subTag; tmpTag->offset = buffer_start ? buffer - buffer_start: 0; - tmpTag->tagNext = 0; + tmpTag->tagNext = 0; - *tag = tmpTag; + *tag = tmpTag; - return length + length2; + return length + length2; } //========================================================================== @@ -661,30 +695,33 @@ static long ParseTagString( char * buffer, TagPtr * tag ) { - long length; - char * string; + long length; + char * string; - length = FixDataMatchingTag(buffer, kXMLTagString); - if (length == -1) return -1; + length = FixDataMatchingTag(buffer, kXMLTagString); + if (length == -1) { + return -1; + } TagPtr tmpTag = NewTag(); - if (tmpTag == 0) return -1; + if (tmpTag == 0) { + return -1; + } - string = NewSymbol(buffer); - if (string == 0) - { - XMLFreeTag(tmpTag); - return -1; - } + string = NewSymbol(buffer); + if (string == 0) { + XMLFreeTag(tmpTag); + return -1; + } - tmpTag->type = kTagTypeString; - tmpTag->string = string; - tmpTag->tag = 0; + tmpTag->type = kTagTypeString; + tmpTag->string = string; + tmpTag->tag = 0; tmpTag->offset = buffer_start ? buffer - buffer_start: 0; - tmpTag->tagNext = 0; - - *tag = tmpTag; - return length; + tmpTag->tagNext = 0; + + *tag = tmpTag; + return length; } //========================================================================== @@ -693,11 +730,11 @@ static long ParseTagInteger( char * buffer, TagPtr * tag ) { - long length, integer; + long length, integer; bool negative = false; - TagPtr tmpTag; + TagPtr tmpTag; char* val = buffer; - int size; + int size; if(buffer[0] == '<') { @@ -715,14 +752,14 @@ return 0; } - size = length = FixDataMatchingTag(buffer, kXMLTagInteger); - if (length == -1) return -1; - - tmpTag = NewTag(); - if (tmpTag == 0) return -1; - - integer = 0; + size = length = FixDataMatchingTag(buffer, kXMLTagInteger); + if (length == -1) return -1; + tmpTag = NewTag(); + if (tmpTag == 0) return -1; + + integer = 0; + if(size > 1 && (val[1] == 'x' || val[1] == 'X')) // Hex value { val += 2; @@ -744,7 +781,7 @@ { printf("ParseTagInteger hex error (0x%x) in buffer %s\n", *val, buffer); getchar(); - XMLFreeTag(tmpTag); + XMLFreeTag(tmpTag); return -1; } } @@ -776,16 +813,16 @@ if (negative) integer = -integer; } - - tmpTag->type = kTagTypeInteger; + + tmpTag->type = kTagTypeInteger; tmpTag->string = (char *)integer; tmpTag->tag = 0; tmpTag->offset = buffer_start ? buffer - buffer_start: 0; - tmpTag->tagNext = 0; - - *tag = tmpTag; - - return length; + tmpTag->tagNext = 0; + + *tag = tmpTag; + + return length; } //========================================================================== @@ -794,30 +831,30 @@ static long ParseTagData( char * buffer, TagPtr * tag ) { - int actuallen = 0; - long length; - TagPtr tmpTag; + int actuallen = 0; + long length; + TagPtr tmpTag; - length = FixDataMatchingTag(buffer, kXMLTagData); - if (length == -1) return -1; - - tmpTag = NewTag(); - if (tmpTag == 0) return -1; - + length = FixDataMatchingTag(buffer, kXMLTagData); + if (length == -1) return -1; + + tmpTag = NewTag(); + if (tmpTag == 0) return -1; + //printf("ParseTagData unimplimented\n"); //printf("Data: %s\n", buffer); // getchar(); char* string = BASE64Decode(buffer, strlen(buffer), &actuallen); - tmpTag->type = kTagTypeData; - tmpTag->string = string; - tmpTag->tag = 0; + tmpTag->type = kTagTypeData; + tmpTag->string = string; + tmpTag->tag = 0; tmpTag->offset = actuallen; // buffer_start ? buffer - buffer_start: 0; - tmpTag->tagNext = 0; - - *tag = tmpTag; - - return length; + tmpTag->tagNext = 0; + + *tag = tmpTag; + + return length; } //========================================================================== @@ -826,27 +863,27 @@ static long ParseTagDate( char * buffer, TagPtr * tag ) { - long length; - TagPtr tmpTag; - - length = FixDataMatchingTag(buffer, kXMLTagDate); - if (length == -1) return -1; - - tmpTag = NewTag(); - if (tmpTag == 0) return -1; - + long length; + TagPtr tmpTag; + + length = FixDataMatchingTag(buffer, kXMLTagDate); + if (length == -1) return -1; + + tmpTag = NewTag(); + if (tmpTag == 0) return -1; + printf("ParseTagDate unimplimented\n"); getchar(); - - tmpTag->type = kTagTypeDate; - tmpTag->string = 0; - tmpTag->tag = 0; + + tmpTag->type = kTagTypeDate; + tmpTag->string = 0; + tmpTag->tag = 0; tmpTag->offset = buffer_start ? buffer - buffer_start: 0; - tmpTag->tagNext = 0; - - *tag = tmpTag; - - return length; + tmpTag->tagNext = 0; + + *tag = tmpTag; + + return length; } //========================================================================== @@ -855,20 +892,20 @@ long ParseTagBoolean( char * buffer, TagPtr * tag, long type ) { - TagPtr tmpTag; - - tmpTag = NewTag(); - if (tmpTag == 0) return -1; - - tmpTag->type = type; - tmpTag->string = 0; - tmpTag->tag = 0; + TagPtr tmpTag; + + tmpTag = NewTag(); + if (tmpTag == 0) return -1; + + tmpTag->type = type; + tmpTag->string = 0; + tmpTag->tag = 0; tmpTag->offset = buffer_start ? buffer - buffer_start: 0; - tmpTag->tagNext = 0; - - *tag = tmpTag; - - return 0; + tmpTag->tagNext = 0; + + *tag = tmpTag; + + return 0; } //========================================================================== @@ -877,26 +914,25 @@ static long GetNextTag( char * buffer, char ** tag, long * start ) { - long cnt, cnt2; + long cnt, cnt2; - if (tag == 0) return -1; - - // Find the start of the tag. - cnt = 0; - while ((buffer[cnt] != '\0') && (buffer[cnt] != '<')) cnt++; - if (buffer[cnt] == '\0') return -1; - - // Find the end of the tag. - cnt2 = cnt + 1; - while ((buffer[cnt2] != '\0') && (buffer[cnt2] != '>')) cnt2++; - if (buffer[cnt2] == '\0') return -1; + if (tag == 0) return -1; - // Fix the tag data. - *tag = buffer + cnt + 1; - buffer[cnt2] = '\0'; - if (start) *start = cnt; - - return cnt2 + 1; +// Find the start of the tag. + cnt = 0; + while ((buffer[cnt] != '\0') && (buffer[cnt] != '<')) cnt++; + if (buffer[cnt] == '\0') return -1; + // Find the end of the tag. + cnt2 = cnt + 1; + while ((buffer[cnt2] != '\0') && (buffer[cnt2] != '>')) cnt2++; + if (buffer[cnt2] == '\0') return -1; + + // Fix the tag data. + *tag = buffer + cnt + 1; + buffer[cnt2] = '\0'; + if (start) *start = cnt; + + return cnt2 + 1; } //========================================================================== @@ -970,22 +1006,28 @@ XMLFreeTag( TagPtr tag ) { #if DOFREE - if (tag == 0) return; + if (tag == 0) + { + return; + } - if (!XMLIsInteger(tag) && tag->string) FreeSymbol(tag->string); + if (!XMLIsInteger(tag) && tag->string) + { + FreeSymbol(tag->string); + } + + XMLFreeTag(tag->tag); + XMLFreeTag(tag->tagNext); - XMLFreeTag(tag->tag); - XMLFreeTag(tag->tagNext); - - // Clear and free the tag. - tag->type = kTagTypeNone; - tag->string = 0; - tag->tag = 0; + // Clear and free the tag. + tag->type = kTagTypeNone; + tag->string = 0; + tag->tag = 0; tag->offset = 0; - tag->tagNext = gTagsFree; - gTagsFree = tag; + tag->tagNext = gTagsFree; + gTagsFree = tag; #else - return; + return; #endif } @@ -994,9 +1036,9 @@ struct Symbol { - long refCount; - struct Symbol *next; - char string[]; + long refCount; + struct Symbol *next; + char string[]; }; typedef struct Symbol Symbol, *SymbolPtr; @@ -1010,33 +1052,39 @@ static char * NewSymbol( char * string ) { -static SymbolPtr lastGuy = 0; + static SymbolPtr lastGuy = 0; SymbolPtr symbol; - - // Look for string in the list of symbols. - symbol = FindSymbol(string, 0); - + + // Look for string in the list of symbols. + symbol = FindSymbol(string, 0); + // Add the new symbol. - if (symbol == 0) - { - symbol = (SymbolPtr)malloc(sizeof(Symbol) + 1 + strlen(string)); - if (symbol == 0) //return 0; - stop("NULL symbol!"); - - // Set the symbol's data. - symbol->refCount = 0; - strcpy(symbol->string, string); - - // Add the symbol to the list. - symbol->next = gSymbolsHead; - gSymbolsHead = symbol; - } - - // Update the refCount and return the string. - symbol->refCount++; + if (symbol == 0) + { + symbol = (SymbolPtr)malloc(sizeof(Symbol) + 1 + strlen(string)); + if (symbol == 0) //return 0; + { + stop("NULL symbol!"); + } - if (lastGuy && lastGuy->next != 0) stop("last guy not last!"); - return symbol->string; + // Set the symbol's data. + symbol->refCount = 0; + strcpy(symbol->string, string); + + // Add the symbol to the list. + symbol->next = gSymbolsHead; + gSymbolsHead = symbol; + } + + // Update the refCount and return the string. + symbol->refCount++; + + if (lastGuy && lastGuy->next != 0) + { + stop("last guy not last!"); + } + + return symbol->string; } //========================================================================== @@ -1046,24 +1094,36 @@ static void FreeSymbol( char * string ) { - SymbolPtr symbol, prev; + SymbolPtr symbol, prev; prev = 0; - - // Look for string in the list of symbols. - symbol = FindSymbol(string, &prev); - if (symbol == 0) return; - - // Update the refCount. - symbol->refCount--; - - if (symbol->refCount != 0) return; - - // Remove the symbol from the list. - if (prev != 0) prev->next = symbol->next; - else gSymbolsHead = symbol->next; - - // Free the symbol's memory. - free(symbol); + + // Look for string in the list of symbols. + symbol = FindSymbol(string, &prev); + if (symbol == 0) + { + return; + } + + // Update the refCount. + symbol->refCount--; + + if (symbol->refCount != 0) + { + return; + } + + // Remove the symbol from the list. + if (prev != 0) + { + prev->next = symbol->next; + } + else + { + gSymbolsHead = symbol->next; + } + + // Free the symbol's memory. + free(symbol); } #endif @@ -1073,40 +1133,60 @@ static SymbolPtr FindSymbol( char * string, SymbolPtr * prevSymbol ) { - SymbolPtr symbol, prev; + SymbolPtr symbol, prev; - symbol = gSymbolsHead; - prev = 0; + symbol = gSymbolsHead; + prev = 0; - while (symbol != 0) { - if (!strcmp(symbol->string, string)) break; + while (symbol != 0) + { + if (!strcmp(symbol->string, string)) + { + break; + } - prev = symbol; - symbol = symbol->next; - } + prev = symbol; + symbol = symbol->next; + } - if ((symbol != 0) && (prevSymbol != 0)) *prevSymbol = prev; - - return symbol; + if ((symbol != 0) && (prevSymbol != 0)) + { + *prevSymbol = prev; + } + + return symbol; } bool XMLIsType(TagPtr dict, enum xmltype type) { - if(!dict) return (type == kTagTypeNone); + if(!dict) + { + return (type == kTagTypeNone); + } return (dict->type == type); } /*** Cast functions ***/ bool XMLIsArray(TagPtr entry) { - return entry && (entry->type == kTagTypeArray); + return entry && (entry->type == kTagTypeArray); } TagPtr XMLCastArray(TagPtr dict) { - if(!dict) return NULL; - if(dict->type == kTagTypeArray) return dict; - else return NULL; + if(!dict) + { + return NULL; + } + + if(dict->type == kTagTypeArray) + { + return dict; + } + else + { + return NULL; + } } bool XMLIsDict(TagPtr entry) @@ -1116,43 +1196,58 @@ bool XMLIsData(TagPtr entry) { - return entry && (entry->type == kTagTypeData); + return entry && (entry->type == kTagTypeData); } TagPtr XMLCastDict(TagPtr dict) { - if(!dict) return NULL; - if(dict->type == kTagTypeDict) return dict; - else return NULL; + if(!dict) + { + return NULL; + } + + if(dict->type == kTagTypeDict) + { + return dict; + } + else + { + return NULL; + } } bool XMLIsString(TagPtr entry) { - return entry && - ((entry->type == kTagTypeString) || - (entry->type == kTagTypeKey)); + return entry && ((entry->type == kTagTypeString) || (entry->type == kTagTypeKey)); } char* XMLCastString(TagPtr dict) { - if(!dict) return NULL; + if(!dict) + { + return NULL; + } - if((dict->type == kTagTypeString) || - (dict->type == kTagTypeKey)) return dict->string; - + if((dict->type == kTagTypeString) || (dict->type == kTagTypeKey)) + { + return dict->string; + } + return NULL; } char* XMLCastData(TagPtr dict, int* length) { - if(!dict) return NULL; - - if((dict->type == kTagTypeData) || - (dict->type == kTagTypeKey)) - { - *length = dict->offset; - return dict->string; - } + if(!dict) + { + return NULL; + } + + if((dict->type == kTagTypeData) || (dict->type == kTagTypeKey)) + { + *length = dict->offset; + return dict->string; + } *length = 0; return NULL; } @@ -1160,9 +1255,7 @@ long XMLCastStringOffset(TagPtr dict) { - if(dict && - ((dict->type == kTagTypeString) || - (dict->type == kTagTypeKey))) + if(dict && ((dict->type == kTagTypeString) || (dict->type == kTagTypeKey))) { return dict->offset; } @@ -1174,15 +1267,21 @@ bool XMLIsBoolean(TagPtr entry) { - return entry && - ((entry->type == kTagTypeTrue) || - (entry->type == kTagTypeFalse)); + return entry && ((entry->type == kTagTypeTrue) || (entry->type == kTagTypeFalse)); } bool XMLCastBoolean(TagPtr dict) { - if(!dict) return false; - if(dict->type == kTagTypeTrue) return true; + if(!dict) + { + return false; + } + + if(dict->type == kTagTypeTrue) + { + return true; + } + return false; } @@ -1198,50 +1297,57 @@ //printf("XMLCastInteger: null dict\n"); return 0; } - if(dict->type == kTagTypeInteger) return (int)(dict->string); + if(dict->type == kTagTypeInteger) + { + return (int)(dict->string); + } + return 0; } bool XMLAddTagToDictionary(TagPtr dict, char* key, TagPtr value) { - if (!dict || dict->type != kTagTypeDict) return false; + if (!dict || dict->type != kTagTypeDict) + { + return false; + } - TagPtr tmpTag; - char* string; + TagPtr tmpTag; + char* string; - tmpTag = NewTag(); - if (tmpTag == 0) - { - return false; - } - - string = NewSymbol(key); - if (string == 0) - { - XMLFreeTag(tmpTag); - return false; - } - - tmpTag->type = kTagTypeKey; - tmpTag->string = string; - tmpTag->tag = value; + tmpTag = NewTag(); + if (tmpTag == 0) + { + return false; + } + + string = NewSymbol(key); + if (string == 0) + { + XMLFreeTag(tmpTag); + return false; + } + + tmpTag->type = kTagTypeKey; + tmpTag->string = string; + tmpTag->tag = value; tmpTag->offset = 0; - tmpTag->tagNext = 0; - - TagPtr tagList = dict->tag; - if(!tagList) - { - // First tag - dict->tag = tmpTag; - return true; - } - while(tagList && tagList->tagNext) tagList = tagList->tagNext; - if(tagList) - { - tagList->tagNext = tmpTag; - return true; - } + tmpTag->tagNext = 0; - XMLFreeTag(tmpTag); - return false; + TagPtr tagList = dict->tag; + if(!tagList) + { + // First tag + dict->tag = tmpTag; + return true; + } + while(tagList && tagList->tagNext) tagList = tagList->tagNext; + if(tagList) + { + tagList->tagNext = tmpTag; + return true; + } + + XMLFreeTag(tmpTag); + return false; } Index: branches/ErmaC/Enoch/i386/libsaio/asm.s =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/asm.s (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/asm.s (revision 2323) @@ -82,7 +82,7 @@ * New boot0 (boot1 has been deprecated). Booter must now reside in its own partition, no disk label required. * * Revision 1.1.1.2 1999/08/04 21:16:57 wsanchez - * Impoort of boot-66 + * Import of boot-66 * * Revision 1.3 1999/08/04 21:12:12 wsanchez * Update APSL @@ -338,6 +338,31 @@ #endif jmp _halt +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// disableIRQs() +// http://www.insanelymac.com/forum/index.php?s=&showtopic=255866&view=findpost&p=1677779 +// +// Port of original patch by: CPARM (who basically did this in boot.c) Thanks! +// +// +LABEL(_disableIRQs) +// The ACPI specification dictates that the 8259 (PC-AT compatible) vectors +// must be disabled (that is, masked) when enabling the ACPI APIC operation +// but this isn't done (apparently) on all mobo's and thus we do that here. + + push %eax // Saving register data + + movb $0x80, %al // Block NMI + outb %al, $0x70 + + movb $0xff, %al // Load mask + outb %al, $0x21 // Disable IRQ's 0-7 on Master PIC + outb %al, $0xa1 // Disable IRQ's 8-15 on Slave PIC + + popl %eax // Restore register data + + ret + #ifndef BOOT1 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // startprog(phyaddr, arg) @@ -345,10 +370,12 @@ // Passes arg to the program in %eax. // LABEL(_startprog) + call _disableIRQs // Taking care of a ACPI bug. (Azi: calling the above) + push %ebp mov %esp, %ebp - mov 0xc(%ebp), %eax // argument to program + mov 0xc(%ebp), %eax // argument to program - bootargs to mach_kernel mov 0x8(%ebp), %ecx // entry offset mov $0x28, %ebx // segment push %ebx Index: branches/ErmaC/Enoch/i386/libsaio/console.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/console.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/console.c (revision 2323) @@ -50,8 +50,8 @@ extern int vprf(const char * fmt, va_list ap); -bool gVerboseMode; -bool gErrors; +bool gVerboseMode = false; +bool gErrors = false; /* * Azi: Doubled available log size; this seems to fix some hangs and instant reboots caused by @@ -69,8 +69,8 @@ struct putc_info //Azi: exists on gui.c & printf.c { - char * str; - char * last_str; + char * str; + char * last_str; }; static int @@ -83,7 +83,7 @@ return 0; } *(pi->str)++ = c; - return c; + return c; } void initBooterLog(void) @@ -91,7 +91,7 @@ msgbuf = malloc(BOOTER_LOG_SIZE); bzero(msgbuf, BOOTER_LOG_SIZE); cursor = msgbuf; - msglog("%s\n", "Chameleon " I386BOOT_CHAMELEONVERSION " (svn-r" I386BOOT_CHAMELEONREVISION ")" " [" I386BOOT_BUILDDATE "]"); + msglog("%s\n", "Enoch (r" I386BOOT_CHAMELEONREVISION ")" " [" I386BOOT_BUILDDATE "]"); } void msglog(const char * fmt, ...) @@ -99,11 +99,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; + } va_start(ap, fmt); pi.str = cursor; @@ -115,8 +117,9 @@ void setupBooterLog(void) { - if (!msgbuf) + if (!msgbuf) { return; + } Node *node = DT__FindNode("/", false); if (node) @@ -129,30 +132,29 @@ */ int putchar(int c) { - if ( c == '\t' ) - { + if ( c == '\t' ) { for (c = 0; c < 8; c++) bios_putchar(' '); return c; } - if ( c == '\n' ) - { + if ( c == '\n' ) { bios_putchar('\r'); - } + } bios_putchar(c); - return c; + return c; } int getc() { - int c = bgetc(); + int c = bgetc(); - if ((c & 0xff) == 0) - return c; - else - return (c & 0xff); + if ((c & 0xff) == 0) { + return c; + } else { + return (c & 0xff); + } } // Read and echo a character from console. This doesn't echo backspace @@ -165,28 +167,31 @@ // if ( c == '\r' ) c = '\n'; // if ( c >= ' ' && c < 0x7f) putchar(c); - + return (c); } int printf(const char * fmt, ...) { - va_list ap; + va_list ap; va_start(ap, fmt); - if (bootArgs->Video.v_display == VGA_TEXT_MODE) + if (bootArgs->Video.v_display == VGA_TEXT_MODE) { prf(fmt, ap, putchar, 0); - else + } else { vprf(fmt, ap); + } { - // Kabyl: BooterLog + /* Kabyl: BooterLog */ struct putc_info pi; - if (!msgbuf) + if (!msgbuf) { return 0; + } - if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) { return 0; + } pi.str = cursor; pi.last_str = 0; prf(fmt, ap, sputc, &pi); @@ -194,52 +199,55 @@ } va_end(ap); - return 0; + return 0; } int verbose(const char * fmt, ...) { - va_list ap; + va_list ap; va_start(ap, fmt); - if (gVerboseMode) - { - if (bootArgs->Video.v_display == VGA_TEXT_MODE) + if (gVerboseMode) { + if (bootArgs->Video.v_display == VGA_TEXT_MODE) { prf(fmt, ap, putchar, 0); - else + } else { vprf(fmt, ap); - } + } + } { - // Kabyl: BooterLog + /* Kabyl: BooterLog */ struct putc_info pi; - if (!msgbuf) + if (!msgbuf) { return 0; + } - if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) + if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) { return 0; + } pi.str = cursor; pi.last_str = 0; prf(fmt, ap, sputc, &pi); cursor += strlen((char *)cursor); } - va_end(ap); - return(0); + va_end(ap); + return(0); } int error(const char * fmt, ...) { - va_list ap; - gErrors = true; - va_start(ap, fmt); - if (bootArgs->Video.v_display == VGA_TEXT_MODE) + va_list ap; + gErrors = true; + va_start(ap, fmt); + if (bootArgs->Video.v_display == VGA_TEXT_MODE) { prf(fmt, ap, putchar, 0); - else + } else { vprf(fmt, ap); + } va_end(ap); - return(0); + return(0); } void stop(const char * fmt, ...) Index: branches/ErmaC/Enoch/i386/libsaio/xml.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/xml.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/xml.h (revision 2323) @@ -26,16 +26,16 @@ #define __LIBSAIO_XML_H enum xmltype { - kTagTypeNone = 0, - kTagTypeDict, - kTagTypeKey, - kTagTypeString, - kTagTypeInteger, - kTagTypeData, - kTagTypeDate, - kTagTypeFalse, - kTagTypeTrue, - kTagTypeArray + kTagTypeNone = 0, + kTagTypeDict, + kTagTypeKey, + kTagTypeString, + kTagTypeInteger, + kTagTypeData, + kTagTypeDate, + kTagTypeFalse, + kTagTypeTrue, + kTagTypeArray }; struct string_ref @@ -48,20 +48,21 @@ extern string_ref* ref_strings; -#define kXMLTagPList "plist " -#define kXMLTagDict "dict" -#define kXMLTagKey "key" -#define kXMLTagString "string" -#define kXMLTagInteger "integer" -#define kXMLTagData "data" -#define kXMLTagDate "date" -#define kXMLTagFalse "false/" -#define kXMLTagTrue "true/" -#define kXMLTagArray "array" +#define kXMLTagPList "plist " +#define kXMLTagDict "dict" +#define kXMLTagKey "key" +#define kXMLTagString "string" +#define kXMLTagInteger "integer" +#define kXMLTagData "data" +#define kXMLTagDate "date" +#define kXMLTagFalse "false/" +#define kXMLTagTrue "true/" +#define kXMLTagArray "array" +// for back-references used by libkern serializer +#define kXMLTagReference "reference" +#define kXMLStringID "ID=" +#define kXMLStringIDRef "IDREF=" -#define kXMLStringID "ID=" -#define kXMLStringIDRef "IDREF=" - #define kPropCFBundleIdentifier ("CFBundleIdentifier") #define kPropCFBundleExecutable ("CFBundleExecutable") #define kPropOSBundleRequired ("OSBundleRequired") @@ -71,10 +72,10 @@ /* struct Tag { - long type; - char *string; - struct Tag *tag; - struct Tag *tagNext; + long type; + char *string; + struct Tag *tag; + struct Tag *tagNext; }; typedef struct Tag Tag, *TagPtr; */ Index: branches/ErmaC/Enoch/i386/libsaio/bootstruct.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bootstruct.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/bootstruct.c (revision 2323) @@ -110,7 +110,7 @@ reserveKernBootStruct(void) { if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0') - && (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7' || gMacOSVersion[3] == '8' || gMacOSVersion[3] == '9')) + && (gMacOSVersion[2] == '.') && ((gMacOSVersion[3] == '7') || (gMacOSVersion[3] == '8') || (gMacOSVersion[3] == '9'))) { void *oldAddr = bootArgs; bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args)); Index: branches/ErmaC/Enoch/i386/libsaio/efi.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/efi.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/efi.h (revision 2323) @@ -71,9 +71,8 @@ */ -// // Modifiers for EFI Runtime and Boot Services -// + #define EFI_RUNTIMESERVICE #define EFIAPI #define IN @@ -82,9 +81,7 @@ #define EFI_MAX_BIT 0x80000000 -// // Set the upper bit to indicate EFI Error. -// #define EFIERR(a) (EFI_MAX_BIT | (a)) #define EFIWARN(a) (a) @@ -118,11 +115,16 @@ #define EFI_INCOMPATIBLE_VERSION EFIERR (25) #define EFI_SECURITY_VIOLATION EFIERR (26) #define EFI_CRC_ERROR EFIERR (27) +#define EFI_END_OF_MEDIA EFIERR (28) +#define EFI_END_OF_FILE EFIERR (31) +#define EFI_INVALID_LANGUAGE EFIERR (32) +#define EFI_COMPROMISED_DATA EFIERR (33) #define EFI_WARN_UNKNOWN_GLYPH EFIWARN (1) #define EFI_WARN_DELETE_FAILURE EFIWARN (2) #define EFI_WARN_WRITE_FAILURE EFIWARN (3) #define EFI_WARN_BUFFER_TOO_SMALL EFIWARN (4) +#define EFI_WARN_STALE_DATA EFIWARN (5) // // EFI Specification Revision information @@ -141,7 +143,7 @@ {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27,0x8F, 0xCC, 0x34, 0x22, 0xB6} } #define EFI_GLOBAL_VARIABLE_GUID \ - {0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } + {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } typedef union { EFI_GUID Guid; @@ -160,75 +162,74 @@ // TimeZone: -1440 to 1440 or 2047 // typedef struct { - EFI_UINT16 Year; - EFI_UINT8 Month; - EFI_UINT8 Day; - EFI_UINT8 Hour; - EFI_UINT8 Minute; - EFI_UINT8 Second; - EFI_UINT8 Pad1; - EFI_UINT32 Nanosecond; - EFI_INT16 TimeZone; - EFI_UINT8 Daylight; - EFI_UINT8 Pad2; + EFI_UINT16 Year; + EFI_UINT8 Month; + EFI_UINT8 Day; + EFI_UINT8 Hour; + EFI_UINT8 Minute; + EFI_UINT8 Second; + EFI_UINT8 Pad1; + EFI_UINT32 Nanosecond; + EFI_INT16 TimeZone; + EFI_UINT8 Daylight; + EFI_UINT8 Pad2; } EFI_TIME; -// + // Bit definitions for EFI_TIME.Daylight -// + #define EFI_TIME_ADJUST_DAYLIGHT 0x01 #define EFI_TIME_IN_DAYLIGHT 0x02 -// + // Value definition for EFI_TIME.TimeZone -// + #define EFI_UNSPECIFIED_TIMEZONE 0x07FF typedef enum { - EfiReservedMemoryType, - EfiLoaderCode, - EfiLoaderData, - EfiBootServicesCode, - EfiBootServicesData, - EfiRuntimeServicesCode, - EfiRuntimeServicesData, - EfiConventionalMemory, - EfiUnusableMemory, - EfiACPIReclaimMemory, - EfiACPIMemoryNVS, - EfiMemoryMappedIO, - EfiMemoryMappedIOPortSpace, - EfiPalCode, - EfiMaxMemoryType + EfiReservedMemoryType, + EfiLoaderCode, + EfiLoaderData, + EfiBootServicesCode, + EfiBootServicesData, + EfiRuntimeServicesCode, + EfiRuntimeServicesData, + EfiConventionalMemory, + EfiUnusableMemory, + EfiACPIReclaimMemory, + EfiACPIMemoryNVS, + EfiMemoryMappedIO, + EfiMemoryMappedIOPortSpace, + EfiPalCode, + EfiMaxMemoryType } EFI_MEMORY_TYPE; typedef struct { - EFI_UINT64 Signature; - EFI_UINT32 Revision; - EFI_UINT32 HeaderSize; - EFI_UINT32 CRC32; - EFI_UINT32 Reserved; + EFI_UINT64 Signature; + EFI_UINT32 Revision; + EFI_UINT32 HeaderSize; + EFI_UINT32 CRC32; + EFI_UINT32 Reserved; } __attribute__((aligned(8))) EFI_TABLE_HEADER; -// // possible caching types for the memory range -// + #define EFI_MEMORY_UC 0x0000000000000001ULL #define EFI_MEMORY_WC 0x0000000000000002ULL #define EFI_MEMORY_WT 0x0000000000000004ULL #define EFI_MEMORY_WB 0x0000000000000008ULL #define EFI_MEMORY_UCE 0x0000000000000010ULL -// + // physical memory protection on range -// + #define EFI_MEMORY_WP 0x0000000000001000ULL #define EFI_MEMORY_RP 0x0000000000002000ULL #define EFI_MEMORY_XP 0x0000000000004000ULL -// + // range requires a runtime mapping -// + #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL typedef EFI_UINT64 EFI_PHYSICAL_ADDRESS; @@ -236,12 +237,12 @@ #define EFI_MEMORY_DESCRIPTOR_VERSION 1 typedef struct { - EFI_UINT32 Type; - EFI_UINT32 Pad; - EFI_PHYSICAL_ADDRESS PhysicalStart; - EFI_VIRTUAL_ADDRESS VirtualStart; - EFI_UINT64 NumberOfPages; - EFI_UINT64 Attribute; + EFI_UINT32 Type; + EFI_UINT32 Pad; + EFI_PHYSICAL_ADDRESS PhysicalStart; + EFI_VIRTUAL_ADDRESS VirtualStart; + EFI_UINT64 NumberOfPages; + EFI_UINT64 Attribute; } __attribute__((aligned(8))) EFI_MEMORY_DESCRIPTOR; @@ -263,9 +264,9 @@ IN OUT VOID **Address ) __attribute__((regparm(0))); -// + // Variable attributes -// + #define EFI_VARIABLE_NON_VOLATILE 0x00000001 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 @@ -302,13 +303,13 @@ IN VOID * Data ) __attribute__((regparm(0))); -// + // EFI Time -// + typedef struct { - EFI_UINT32 Resolution; - EFI_UINT32 Accuracy; - EFI_BOOLEAN SetsToZero; + EFI_UINT32 Resolution; + EFI_UINT32 Accuracy; + EFI_BOOLEAN SetsToZero; } __attribute__((aligned(4))) EFI_TIME_CAPABILITIES; typedef @@ -371,18 +372,14 @@ OUT EFI_UINT32 * HighCount ) __attribute__((regparm(0))); -// // Definition of Status Code extended data header -// -// HeaderSize The size of the architecture. This is specified to enable -// the future expansion -// -// Size The size of the data in bytes. This does not include the size -// of the header structure. -// + +// HeaderSize The size of the architecture. This is specified to enable the future expansion + +// Size The size of the data in bytes. This does not include the size of the header structure. + // Type A GUID defining the type of the data -// -// + #ifdef TIANO_EXTENSION_FLAG typedef @@ -404,83 +401,74 @@ #define EFI_RUNTIME_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION << 16) | (EFI_SPECIFICATION_MINOR_REVISION)) typedef struct { - EFI_TABLE_HEADER Hdr; + EFI_TABLE_HEADER Hdr; - // - // Time services - // - EFI_PTR32 GetTime; - EFI_PTR32 SetTime; - EFI_PTR32 GetWakeupTime; - EFI_PTR32 SetWakeupTime; + // Time Services + EFI_PTR32 GetTime; + EFI_PTR32 SetTime; + EFI_PTR32 GetWakeupTime; + EFI_PTR32 SetWakeupTime; - // - // Virtual memory services - // - EFI_PTR32 SetVirtualAddressMap; - EFI_PTR32 ConvertPointer; + // Virtual Memory Services - // - // Variable services - // - EFI_PTR32 GetVariable; - EFI_PTR32 GetNextVariableName; - EFI_PTR32 SetVariable; + EFI_PTR32 SetVirtualAddressMap; + EFI_PTR32 ConvertPointer; - // - // Misc - // - EFI_PTR32 GetNextHighMonotonicCount; - EFI_PTR32 ResetSystem; + // Variable Services + EFI_PTR32 GetVariable; + EFI_PTR32 GetNextVariableName; + EFI_PTR32 SetVariable; + + // Miscellaneous Services + EFI_PTR32 GetNextHighMonotonicCount; + EFI_PTR32 ResetSystem; + #ifdef TIANO_EXTENSION_FLAG - // - // //////////////////////////////////////////////////// - // Extended EFI Services - ////////////////////////////////////////////////////// - // - EFI_PTR32 ReportStatusCode; + + // //////////////////////////////////////////////////// + // Extended EFI Services + ////////////////////////////////////////////////////// + + EFI_PTR32 ReportStatusCode; #endif } __attribute__((aligned(8))) EFI_RUNTIME_SERVICES_32; typedef struct { - EFI_TABLE_HEADER Hdr; + EFI_TABLE_HEADER Hdr; - // - // Time services - // - EFI_PTR64 GetTime; - EFI_PTR64 SetTime; - EFI_PTR64 GetWakeupTime; - EFI_PTR64 SetWakeupTime; - // - // Virtual memory services - // - EFI_PTR64 SetVirtualAddressMap; - EFI_PTR64 ConvertPointer; + // Time services - // - // Variable services - // - EFI_PTR64 GetVariable; - EFI_PTR64 GetNextVariableName; - EFI_PTR64 SetVariable; + EFI_PTR64 GetTime; + EFI_PTR64 SetTime; + EFI_PTR64 GetWakeupTime; + EFI_PTR64 SetWakeupTime; - // - // Misc - // - EFI_PTR64 GetNextHighMonotonicCount; - EFI_PTR64 ResetSystem; + // Virtual memory services + EFI_PTR64 SetVirtualAddressMap; + EFI_PTR64 ConvertPointer; + + // Variable services + + EFI_PTR64 GetVariable; + EFI_PTR64 GetNextVariableName; + EFI_PTR64 SetVariable; + + // Misc + + EFI_PTR64 GetNextHighMonotonicCount; + EFI_PTR64 ResetSystem; + #ifdef TIANO_EXTENSION_FLAG - // - // //////////////////////////////////////////////////// - // Extended EFI Services - ////////////////////////////////////////////////////// - // - EFI_PTR64 ReportStatusCode; + + // //////////////////////////////////////////////////// + // Extended EFI Services + ////////////////////////////////////////////////////// + + EFI_PTR64 ReportStatusCode; #endif } __attribute__((aligned(8))) EFI_RUNTIME_SERVICES_64; @@ -489,18 +477,18 @@ // EFI Configuration Table // typedef struct { - EFI_GUID VendorGuid; - EFI_PTR32 VendorTable; + EFI_GUID VendorGuid; + EFI_PTR32 VendorTable; } EFI_CONFIGURATION_TABLE_32; typedef struct { - EFI_GUID VendorGuid; - EFI_PTR64 VendorTable; + EFI_GUID VendorGuid; + EFI_PTR64 VendorTable; } __attribute__((aligned(8))) EFI_CONFIGURATION_TABLE_64; -// + // EFI System Table -// + #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249ULL #define EFI_SYSTEM_TABLE_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION << 16) | (EFI_SPECIFICATION_MINOR_REVISION)) #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | 00) @@ -508,51 +496,49 @@ #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | 10) typedef struct EFI_SYSTEM_TABLE_32 { - EFI_TABLE_HEADER Hdr; + EFI_TABLE_HEADER Hdr; - EFI_PTR32 FirmwareVendor; - EFI_UINT32 FirmwareRevision; + EFI_PTR32 FirmwareVendor; + EFI_UINT32 FirmwareRevision; - EFI_HANDLE32 ConsoleInHandle; - EFI_PTR32 ConIn; + EFI_HANDLE32 ConsoleInHandle; + EFI_PTR32 ConIn; - EFI_HANDLE32 ConsoleOutHandle; - EFI_PTR32 ConOut; + EFI_HANDLE32 ConsoleOutHandle; + EFI_PTR32 ConOut; - EFI_HANDLE32 StandardErrorHandle; - EFI_PTR32 StdErr; + EFI_HANDLE32 StandardErrorHandle; + EFI_PTR32 StdErr; - EFI_PTR32 RuntimeServices; - EFI_PTR32 BootServices; + EFI_PTR32 RuntimeServices; + EFI_PTR32 BootServices; - EFI_UINT32 NumberOfTableEntries; - EFI_PTR32 ConfigurationTable; + EFI_UINT32 NumberOfTableEntries; + EFI_PTR32 ConfigurationTable; } __attribute__((aligned(8))) EFI_SYSTEM_TABLE_32; typedef struct EFI_SYSTEM_TABLE_64 { - EFI_TABLE_HEADER Hdr; + EFI_TABLE_HEADER Hdr; - EFI_PTR64 FirmwareVendor; - EFI_UINT32 FirmwareRevision; + EFI_PTR64 FirmwareVendor; + EFI_UINT32 FirmwareRevision; - EFI_UINT32 __pad; + EFI_UINT32 __pad; + EFI_HANDLE64 ConsoleInHandle; + EFI_PTR64 ConIn; - EFI_HANDLE64 ConsoleInHandle; - EFI_PTR64 ConIn; + EFI_HANDLE64 ConsoleOutHandle; + EFI_PTR64 ConOut; - EFI_HANDLE64 ConsoleOutHandle; - EFI_PTR64 ConOut; + EFI_HANDLE64 StandardErrorHandle; + EFI_PTR64 StdErr; - EFI_HANDLE64 StandardErrorHandle; - EFI_PTR64 StdErr; + EFI_PTR64 RuntimeServices; + EFI_PTR64 BootServices; - EFI_PTR64 RuntimeServices; - EFI_PTR64 BootServices; - - EFI_UINT64 NumberOfTableEntries; - EFI_PTR64 ConfigurationTable; - + EFI_UINT64 NumberOfTableEntries; + EFI_PTR64 ConfigurationTable; } __attribute__((aligned(8))) EFI_SYSTEM_TABLE_64; #endif /* _PEXPERT_I386_EFI_H */ Index: branches/ErmaC/Enoch/i386/libsaio/io_inline.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/io_inline.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/io_inline.h (revision 2323) @@ -79,4 +79,27 @@ __OUT(w, short) /* outw() */ __OUT(l, long) /* outl() */ + +static inline void cmos_write_byte (int loc, int val) +{ + outb (0x70, loc); + outb (0x71, val); +} + +static inline unsigned cmos_read_byte (int loc) +{ + outb (0x70, loc); + return inb (0x71); +} + +#define CMOS_WRITE_BYTE(x, y) cmos_write_byte(x, y) +#define CMOS_READ_BYTE(x) cmos_read_byte(x) + +static inline void cli() { + asm("cli"); +} +static inline void sti() { + asm("sti"); +} + #endif /* !__LIBSAIO_IO_INLINE_H */ Index: branches/ErmaC/Enoch/i386/libsaio/ext2fs.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/ext2fs.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/ext2fs.c (revision 2323) @@ -18,54 +18,54 @@ return (OSReadLittleInt16(buf+0x438,0)==0xEF53); } -void EX2GetDescription(CICell ih, char *str, long strMaxLen) +long EX2GetUUID(CICell ih, char *uuidStr) { - char * buf=malloc (EX2ProbeSize); - str[0]=0; + uint8_t *b, *buf=malloc (EX2ProbeSize); if (!buf) - return; + return -1; Seek(ih, 0); Read(ih, (long)buf, EX2ProbeSize); if (!EX2Probe (buf)) { free (buf); - return; + return -1; } if (OSReadLittleInt32 (buf+0x44c,0)<1) { free (buf); - return; + return -1; } - str[strMaxLen]=0; - strncpy (str, buf+0x478, MIN(strMaxLen, 16)); + b=buf+0x468; + sprintf(uuidStr, + "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", + b[0], b[1], b[2], b[3], + b[4], b[5], + b[6], b[7], + b[8], b[9], + b[10], b[11], b[12], b[13], b[14], b[15]); free (buf); + return 0; } -long EX2GetUUID(CICell ih, char *uuidStr) +void EX2GetDescription(CICell ih, char *str, long strMaxLen) { - uint8_t *b, *buf=malloc (EX2ProbeSize); + char * buf=malloc (EX2ProbeSize); + str[0]=0; if (!buf) - return -1; + return; Seek(ih, 0); Read(ih, (long)buf, EX2ProbeSize); if (!EX2Probe (buf)) { free (buf); - return -1; + return; } if (OSReadLittleInt32 (buf+0x44c,0)<1) { free (buf); - return -1; + return; } - b=buf+0x468; - sprintf(uuidStr, - "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", - b[0], b[1], b[2], b[3], - b[4], b[5], - b[6], b[7], - b[8], b[9], - b[10], b[11], b[12], b[13], b[14], b[15]); + str[strMaxLen]=0; + strncpy (str, buf+0x478, MIN(strMaxLen, 16)); free (buf); - return 0; } Index: branches/ErmaC/Enoch/i386/libsaio/vbe.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/vbe.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/vbe.c (revision 2323) @@ -29,15 +29,19 @@ #include "libsaio.h" #include "vbe.h" -/* - * Various inline routines for video I/O - */ +// Various inline routines for video I/O + +static biosBuf_t bb; + +//============================================================================== + static inline void outi (int port, int index, int val) { outw (port, (val << 8) | index); } +//============================================================================== static inline void outib (int port, int index, int val) { @@ -45,6 +49,8 @@ outb (port + 1, val); } +//============================================================================== + static inline int ini (int port, int index) { @@ -52,17 +58,16 @@ return inb (port + 1); } +//============================================================================== + static inline void -rmwi (int port, int index, int clear, int set) +rmwi(int port, int index, int clear, int set) { outb (port, index); outb (port + 1, (inb (port + 1) & ~clear) | set); } -/* - * Globals - */ -static biosBuf_t bb; +//============================================================================== int getVBEInfo( void * infoBlock ) { @@ -74,6 +79,8 @@ return(bb.eax.r.h); } +//============================================================================== + int getVBEModeInfo( int mode, void * minfo_p ) { bb.intno = 0x10; @@ -85,6 +92,8 @@ return(bb.eax.r.h); } +//============================================================================== + int getVBEDACFormat(unsigned char *format) { bb.intno = 0x10; @@ -95,6 +104,8 @@ return(bb.eax.r.h); } +//============================================================================== + int setVBEDACFormat(unsigned char format) { bb.intno = 0x10; Index: branches/ErmaC/Enoch/i386/libsaio/bootstruct.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bootstruct.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/bootstruct.h (revision 2323) @@ -30,8 +30,8 @@ #include "bios.h" #include "device_tree.h" -/*! - Kernel boot args global also used by booter for its own data. +/* + * Kernel boot args global also used by booter for its own data. */ extern boot_args *bootArgs; extern boot_args_pre_lion *bootArgsPreLion; @@ -44,7 +44,6 @@ //#define FB_TEXT_MODE 2 - /* * Maximum number of boot drivers that can be loaded. */ @@ -58,26 +57,27 @@ * PCI bus information. */ typedef struct _PCI_bus_info_t { - union { - struct { - unsigned char configMethod1 :1; - unsigned char configMethod2 :1; - unsigned char :2; - unsigned char specialCycle1 :1; - unsigned char specialCycle2 :1; - } s; - unsigned char d; - } u_bus; - unsigned char maxBusNum; - unsigned char majorVersion; - unsigned char minorVersion; - unsigned char BIOSPresent; + union { + struct { + unsigned char configMethod1 :1; + unsigned char configMethod2 :1; + unsigned char :2; + unsigned char specialCycle1 :1; + unsigned char specialCycle2 :1; + } s; + unsigned char d; + } u_bus; + + unsigned char maxBusNum; + unsigned char majorVersion; + unsigned char minorVersion; + unsigned char BIOSPresent; } PCI_bus_info_t; typedef struct { - unsigned long address; // address where driver was loaded - unsigned long size; // number of bytes - unsigned long type; // driver type + unsigned long address; // address where driver was loaded + unsigned long size; // number of bytes + unsigned long type; // driver type } driver_config_t; /* @@ -91,12 +91,12 @@ * ACPI defined memory range types. */ enum { - kMemoryRangeUsable = 1, // RAM usable by the OS. - kMemoryRangeReserved = 2, // Reserved. (Do not use) - kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed. - kMemoryRangeNVS = 4, // ACPI NVS memory. (Do not use) + kMemoryRangeUsable = 1, // RAM usable by the OS. + kMemoryRangeReserved = 2, // Reserved. (Do not use) + kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed. + kMemoryRangeNVS = 4, // ACPI NVS memory. (Do not use) - /* Undefined types should be treated as kMemoryRangeReserved */ + /* Undefined types should be treated as kMemoryRangeReserved */ }; /*! @@ -108,30 +108,30 @@ to the kernel and are thus located in bootArgs although with different field names. */ typedef struct PrivateBootInfo { - int convmem; // conventional memory - int extmem; // extended memory + int convmem; // conventional memory + int extmem; // extended memory #if 0 - int numBootDrivers; // number of drivers loaded + int numBootDrivers; // number of drivers loaded #endif - char bootFile[128]; // kernel file name + char bootFile[128]; // kernel file name - unsigned long memoryMapCount; - MemoryRange memoryMap[kMemoryMapCountMax]; + unsigned long memoryMapCount; + MemoryRange memoryMap[kMemoryMapCountMax]; - PCI_bus_info_t pciInfo; + PCI_bus_info_t pciInfo; #if 0 - driver_config_t driverConfig[NDRIVERS]; + driver_config_t driverConfig[NDRIVERS]; #endif - char * configEnd; // pointer to end of config files - char config[CONFIG_SIZE]; + char * configEnd; // pointer to end of config files + char config[CONFIG_SIZE]; - config_file_t bootConfig; // com.apple.Boot.plist - config_file_t chameleonConfig; // org.chameleon.Boot.plist which can override bootConfig keys - config_file_t themeConfig; // theme.plist - config_file_t smbiosConfig; // smbios.plist - config_file_t helperConfig; // boot helper partition's boot.plist - config_file_t ramdiskConfig; // RAMDisk.plist + config_file_t bootConfig; // com.apple.Boot.plist + config_file_t chameleonConfig; // org.chameleon.Boot.plist which can override bootConfig keys + config_file_t themeConfig; // theme.plist + config_file_t smbiosConfig; // smbios.plist + config_file_t helperConfig; // boot helper partition's boot.plist + config_file_t ramdiskConfig; // RAMDisk.plist bool memDetect; } PrivateBootInfo_t; Index: branches/ErmaC/Enoch/i386/libsaio/device_tree.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/device_tree.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/device_tree.c (revision 2323) @@ -1,31 +1,49 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public + * Source License Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. + * + * The Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * */ #if 1 /* - + Structures for a Flattened Device Tree */ #define kPropNameLength 32 typedef struct DeviceTreeNodeProperty { - char name[kPropNameLength]; // NUL terminated property name - unsigned long length; // Length (bytes) of folloing prop value + char name[kPropNameLength]; // NUL terminated property name + unsigned long length; // Length (bytes) of folloing prop value // unsigned long value[1]; // Variable length value of property // Padded to a multiple of a longword? } DeviceTreeNodeProperty; typedef struct OpaqueDTEntry { - unsigned long nProperties; // Number of props[] elements (0 => end) - unsigned long nChildren; // Number of children[] elements + unsigned long nProperties; // Number of props[] elements (0 => end) + unsigned long nChildren; // Number of children[] elements // DeviceTreeNodeProperty props[];// array size == nProperties // DeviceTreeNode children[]; // array size == nChildren } DeviceTreeNode; typedef char DTPropertyNameBuf[32]; -/* Entry Name Definitions (Entry Names are C-Strings)*/ + +// Entry Name Definitions (Entry Names are C-Strings). enum { kDTMaxEntryNameLength = 31 /* Max length of a C-String Entry Name (terminator not included) */ }; @@ -49,9 +67,9 @@ #define RoundToLong(x) (((x) + 3) & ~3) static struct _DTSizeInfo { - uint32_t numNodes; - uint32_t numProperties; - uint32_t totalPropertySize; + uint32_t numNodes; + uint32_t numProperties; + uint32_t totalPropertySize; } DTInfo; #define kAllocSize 4096 @@ -61,195 +79,246 @@ static Node *freeNodes, *allocedNodes; static Property *freeProperties, *allocedProperties; + +//============================================================================== + Property * DT__AddProperty(Node *node, const char *name, uint32_t length, void *value) { - Property *prop; + Property *prop; - 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"); - if (buf == 0) return 0; - bzero(buf, kAllocSize); - // Use the first property to record the allocated buffer - // for later freeing. - prop = (Property *)buf; - prop->next = allocedProperties; - allocedProperties = prop; - prop->value = buf; - prop++; - for (i=1; i<(kAllocSize / sizeof(Property)); i++) { - prop->next = freeProperties; - freeProperties = prop; - prop++; - } - } - prop = freeProperties; - freeProperties = prop->next; + DPRINTF("DT__AddProperty([Node '%s'], '%s', %d, 0x%x)\n", DT__GetName(node), name, length, value); - prop->name = name; - prop->length = length; - prop->value = value; + if (freeProperties == NULL) { + void *buf = malloc(kAllocSize); + int i; - // Always add to end of list - if (node->properties == 0) { - node->properties = prop; - } else { - node->last_prop->next = prop; - } - node->last_prop = prop; - prop->next = 0; + DPRINTF("Allocating more free properties\n"); - DPRINTF("Done [0x%x]\n", prop); - - DTInfo.numProperties++; - DTInfo.totalPropertySize += RoundToLong(length); + if (buf == 0) { + return 0; + } - return prop; + bzero(buf, kAllocSize); + // Use the first property to record the allocated buffer + // for later freeing. + prop = (Property *)buf; + prop->next = allocedProperties; + allocedProperties = prop; + prop->value = buf; + prop++; + + for (i = 1; i < (kAllocSize / sizeof(Property)); i++) { + prop->next = freeProperties; + freeProperties = prop; + prop++; + } + } + + prop = freeProperties; + freeProperties = prop->next; + + prop->name = name; + prop->length = length; + prop->value = value; + + // Always add to end of list + if (node->properties == 0) { + node->properties = prop; + } else { + node->last_prop->next = prop; + } + + node->last_prop = prop; + prop->next = 0; + + DPRINTF("Done [0x%x]\n", prop); + + DTInfo.numProperties++; + DTInfo.totalPropertySize += RoundToLong(length); + + return prop; } + +//============================================================================== + Node * DT__AddChild(Node *parent, const char *name) { - Node *node; + Node *node; - if (freeNodes == NULL) { - void *buf = malloc(kAllocSize); - int i; - - DPRINTF("Allocating more free nodes\n"); - if (buf == 0) return 0; - bzero(buf, kAllocSize); - node = (Node *)buf; - // Use the first node to record the allocated buffer - // for later freeing. - node->next = allocedNodes; - allocedNodes = node; - node->children = (Node *)buf; - node++; - for (i=1; i<(kAllocSize / sizeof(Node)); i++) { - node->next = freeNodes; - freeNodes = node; - node++; - } - } - DPRINTF("DT__AddChild(0x%x, '%s')\n", parent, name); - 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); + if (freeNodes == NULL) + { + void *buf = malloc(kAllocSize); - if (parent == NULL) { - rootNode = node; - node->next = 0; - } else { - node->next = parent->children; - parent->children = node; - } - DTInfo.numNodes++; - DT__AddProperty(node, "name", strlen(name) + 1, (void *) name); - return node; + if (buf == 0) + { + return 0; + } + + int i; + + DPRINTF("Allocating more free nodes\n"); + + bzero(buf, kAllocSize); + node = (Node *)buf; + + // Use the first node to record the allocated buffer for later freeing. + node->next = allocedNodes; + allocedNodes = node; + node->children = (Node *)buf; + node++; + + for (i = 1; i < (kAllocSize / sizeof(Node)); i++) + { + node->next = freeNodes; + freeNodes = node; + node++; + } + } + + DPRINTF("DT__AddChild(0x%x, '%s')\n", parent, name); + + 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); + + if (parent == NULL) + { + rootNode = node; + node->next = 0; + } + else + { + node->next = parent->children; + parent->children = node; + } + + DTInfo.numNodes++; + DT__AddProperty(node, "name", strlen(name) + 1, (void *) name); + + return node; } + +//============================================================================== + void DT__FreeProperty(Property *prop) { - prop->next = freeProperties; - freeProperties = prop; + prop->next = freeProperties; + freeProperties = prop; } + +//============================================================================== + void DT__FreeNode(Node *node) { - node->next = freeNodes; - freeNodes = node; + node->next = freeNodes; + freeNodes = node; } +//============================================================================== + void DT__Initialize(void) { - DPRINTF("DT__Initialize\n"); - - freeNodes = 0; - allocedNodes = 0; - freeProperties = 0; - allocedProperties = 0; - - DTInfo.numNodes = 0; - DTInfo.numProperties = 0; - DTInfo.totalPropertySize = 0; - - rootNode = DT__AddChild(NULL, "/"); - DPRINTF("DT__Initialize done\n"); + DPRINTF("DT__Initialize\n"); + + freeNodes = 0; + allocedNodes = 0; + freeProperties = 0; + allocedProperties = 0; + + DTInfo.numNodes = 0; + DTInfo.numProperties = 0; + DTInfo.totalPropertySize = 0; + + rootNode = DT__AddChild(NULL, "/"); + DPRINTF("DT__Initialize done\n"); } +//============================================================================== /* - * Free up memory used by in-memory representation - * of device tree. + * Free up memory used by in-memory representation of device tree. */ void DT__Finalize(void) { - Node *node; - Property *prop; + Node *node; + Property *prop; - DPRINTF("DT__Finalize\n"); - for (prop = allocedProperties; prop != NULL; prop = prop->next) { - free(prop->value); - } - allocedProperties = NULL; - freeProperties = NULL; + DPRINTF("DT__Finalize\n"); - for (node = allocedNodes; node != NULL; node = node->next) { - free((void *)node->children); - } - allocedNodes = NULL; - freeNodes = NULL; - rootNode = NULL; + for (prop = allocedProperties; prop != NULL; prop = prop->next) + { + free(prop->value); + } + + allocedProperties = NULL; + freeProperties = NULL; + + for (node = allocedNodes; node != NULL; node = node->next) + { + free((void *)node->children); + } + + allocedNodes = NULL; + freeNodes = NULL; + rootNode = NULL; - // XXX leaks any created strings - - DTInfo.numNodes = 0; - DTInfo.numProperties = 0; - DTInfo.totalPropertySize = 0; + // XXX leaks any created strings + DTInfo.numNodes = 0; + DTInfo.numProperties = 0; + DTInfo.totalPropertySize = 0; } +//============================================================================== + static void * FlattenNodes(Node *node, void *buffer) { - Property *prop; - DeviceTreeNode *flatNode; - DeviceTreeNodeProperty *flatProp; - int count; + Property *prop; + DeviceTreeNode *flatNode; + DeviceTreeNodeProperty *flatProp; + int count; - if (node == 0) return buffer; + if (node == 0) { + return buffer; + } - flatNode = (DeviceTreeNode *)buffer; - buffer += sizeof(DeviceTreeNode); + flatNode = (DeviceTreeNode *)buffer; + buffer += sizeof(DeviceTreeNode); - for (count = 0, prop = node->properties; prop != 0; count++, prop = prop->next) { - flatProp = (DeviceTreeNodeProperty *)buffer; - strcpy(flatProp->name, prop->name); - flatProp->length = prop->length; - buffer += sizeof(DeviceTreeNodeProperty); - bcopy(prop->value, buffer, prop->length); - buffer += RoundToLong(prop->length); - } - flatNode->nProperties = count; + for (count = 0, prop = node->properties; prop != 0; count++, prop = prop->next) + { + flatProp = (DeviceTreeNodeProperty *)buffer; + strcpy(flatProp->name, prop->name); + flatProp->length = prop->length; + buffer += sizeof(DeviceTreeNodeProperty); + bcopy(prop->value, buffer, prop->length); + buffer += RoundToLong(prop->length); + } - for (count = 0, node = node->children; node != 0; count++, node = node->next) { - buffer = FlattenNodes(node, buffer); - } - flatNode->nChildren = count; + flatNode->nProperties = count; - return buffer; + for (count = 0, node = node->children; node != 0; count++, node = node->next) + { + buffer = FlattenNodes(node, buffer); + } + + flatNode->nChildren = count; + + return buffer; } -/* - * Flatten the in-memory representation of the device tree - * into a binary DT block. + +/*============================================================================== + * Flatten the in-memory representation of the device tree into a binary DT block. * To get the buffer size needed, call with result = 0. * To have a buffer allocated for you, call with *result = 0. * To use your own buffer, call with *result = &buffer. @@ -258,282 +327,361 @@ void DT__FlattenDeviceTree(void **buffer_p, uint32_t *length) { - uint32_t totalSize; - void *buf; + uint32_t totalSize; + void * buf; - DPRINTF("DT__FlattenDeviceTree(0x%x, 0x%x)\n", buffer_p, length); + DPRINTF("DT__FlattenDeviceTree(0x%x, 0x%x)\n", buffer_p, length); + #if DEBUG - if (buffer_p) DT__PrintTree(rootNode); + if (buffer_p) { + DT__PrintTree(rootNode); + } #endif - totalSize = DTInfo.numNodes * sizeof(DeviceTreeNode) + - DTInfo.numProperties * sizeof(DeviceTreeNodeProperty) + - DTInfo.totalPropertySize; + totalSize = DTInfo.numNodes * sizeof(DeviceTreeNode) + + DTInfo.numProperties * sizeof(DeviceTreeNodeProperty) + + DTInfo.totalPropertySize; - DPRINTF("Total size 0x%x\n", totalSize); - if (buffer_p != 0) { - if (totalSize == 0) { - buf = 0; - } else { - if (*buffer_p == 0) { - buf = malloc(totalSize); - } else { - buf = *buffer_p; - } - bzero(buf, totalSize); - - FlattenNodes(rootNode, buf); - } - *buffer_p = buf; - } - if (length) - *length = totalSize; + DPRINTF("Total size 0x%x\n", totalSize); + + if (buffer_p != 0) + { + if (totalSize == 0) + { + buf = 0; + } + else + { + if (*buffer_p == 0) + { + buf = malloc(totalSize); + } + else + { + buf = *buffer_p; + } + + bzero(buf, totalSize); + + FlattenNodes(rootNode, buf); + } + + *buffer_p = buf; + } + + if (length) + { + *length = totalSize; + } } +//============================================================================== + char * DT__GetName(Node *node) { - Property *prop; + Property *prop; - //DPRINTF("DT__GetName(0x%x)\n", node); - //DPRINTF("Node properties = 0x%x\n", node->properties); - for (prop = node->properties; prop; prop = prop->next) { - //DPRINTF("Prop '%s'\n", prop->name); - if (strcmp(prop->name, "name") == 0) { - return prop->value; - } - } - //DPRINTF("DT__GetName returns 0\n"); - return "(null)"; + //DPRINTF("DT__GetName(0x%x)\n", node); + //DPRINTF("Node properties = 0x%x\n", node->properties); + for (prop = node->properties; prop; prop = prop->next) + { + //DPRINTF("Prop '%s'\n", prop->name); + if (strcmp(prop->name, "name") == 0) + { + return prop->value; + } + } + + //DPRINTF("DT__GetName returns 0\n"); + return "(null)"; } +//============================================================================== + Node * DT__FindNode(const char *path, bool createIfMissing) { - Node *node, *child; - DTPropertyNameBuf nameBuf; - char *bp; - int i; + Node *node, *child; + DTPropertyNameBuf nameBuf; + char *bp; + int i; - DPRINTF("DT__FindNode('%s', %d)\n", path, createIfMissing); + DPRINTF("DT__FindNode('%s', %d)\n", path, createIfMissing); - // Start at root - node = rootNode; - DPRINTF("root = 0x%x\n", rootNode); + // Start at root + node = rootNode; - while (node) { - // Skip leading slash - while (*path == '/') path++; + DPRINTF("root = 0x%x\n", rootNode); - for (i=0, bp = nameBuf; ++i < kDTMaxEntryNameLength && *path && *path != '/'; bp++, path++) *bp = *path; - *bp = '\0'; + while (node) + { + // Skip leading slash + while (*path == '/') + { + path++; + } - if (nameBuf[0] == '\0') { - // last path entry - break; - } - DPRINTF("Node '%s'\n", nameBuf); + for (i = 0, bp = nameBuf; ++i < kDTMaxEntryNameLength && *path && *path != '/'; bp++, path++) + { + *bp = *path; + } - for (child = node->children; child != 0; child = child->next) { - DPRINTF("Child 0x%x\n", child); - if (strcmp(DT__GetName(child), nameBuf) == 0) { - break; - } - } - if (child == 0 && createIfMissing) { - DPRINTF("Creating node\n"); - char *str = malloc(strlen(nameBuf) + 1); - // XXX this will leak - strcpy(str, nameBuf); + *bp = '\0'; - child = DT__AddChild(node, str); - } - node = child; - } - return node; + if (nameBuf[0] == '\0') + { + // last path entry + break; + } + + DPRINTF("Node '%s'\n", nameBuf); + + for (child = node->children; child != 0; child = child->next) + { + DPRINTF("Child 0x%x\n", child); + + if (strcmp(DT__GetName(child), nameBuf) == 0) + { + break; + } + } + + if (child == 0 && createIfMissing) + { + DPRINTF("Creating node\n"); + + char *str = malloc(strlen(nameBuf) + 1); + // XXX this will leak + strcpy(str, nameBuf); + + child = DT__AddChild(node, str); + } + + node = child; + } + + return node; } #if DEBUG +//============================================================================== + void DT__PrintNode(Node *node, int level) { - char spaces[10], *cp = spaces; - Property *prop; + char spaces[10], *cp = spaces; + Property *prop; - if (level > 9) level = 9; - while (level--) *cp++ = ' '; - *cp = '\0'; + if (level > 9) + { + level = 9; + } - printf("%s===Node===\n", spaces); - for (prop = node->properties; prop; prop = prop->next) { - char c = *((char *)prop->value); - if (prop->length < 64 && ( - strcmp(prop->name, "name") == 0 || - (c >= '0' && c <= '9') || - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || c == '_')) { - printf("%s Property '%s' [%d] = '%s'\n", spaces, prop->name, prop->length, prop->value); - } else { - printf("%s Property '%s' [%d] = (data)\n", spaces, prop->name, prop->length); - } - } - printf("%s==========\n", spaces); + while (level--) + { + *cp++ = ' '; + } + + *cp = '\0'; + + printf("%s===Node===\n", spaces); + + for (prop = node->properties; prop; prop = prop->next) + { + char c = *((char *)prop->value); + if (prop->length < 64 && (strcmp(prop->name, "name") == 0 || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_')) + { + printf("%s Property '%s' [%d] = '%s'\n", spaces, prop->name, prop->length, prop->value); + } + else + { + printf("%s Property '%s' [%d] = (data)\n", spaces, prop->name, prop->length); + } + } + + printf("%s==========\n", spaces); } +//============================================================================== + static void _PrintTree(Node *node, int level) { - DT__PrintNode(node, level); - level++; - for (node = node->children; node; node = node->next) - _PrintTree(node, level); + DT__PrintNode(node, level); + + level++; + + for (node = node->children; node; node = node->next) + { + _PrintTree(node, level); + } } +//============================================================================== + void DT__PrintTree(Node *node) { - if (node == 0) node = rootNode; - _PrintTree(node, 0); + if (node == 0) node = rootNode; + _PrintTree(node, 0); } +//============================================================================== + void DT__PrintFlattenedNode(DTEntry entry, int level) { - char spaces[10], *cp = spaces; - DTPropertyIterator propIter; - char *name; - void *prop; - int propSize; + char spaces[10], *cp = spaces; + DTPropertyIterator propIter; + char *name; + void *prop; + int propSize; - if (level > 9) level = 9; - while (level--) *cp++ = ' '; - *cp = '\0'; + if (level > 9) level = 9; + while (level--) *cp++ = ' '; + *cp = '\0'; - printf("%s===Entry %p===\n", spaces, entry); - if (kSuccess != DTCreatePropertyIterator(entry, &propIter)) { - printf("Couldn't create property iterator\n"); - return; - } - while( kSuccess == DTIterateProperties( propIter, &name)) { - if( kSuccess != DTGetProperty( entry, name, &prop, &propSize )) - continue; - printf("%s Property %s = %s\n", spaces, name, prop); - } - DTDisposePropertyIterator(propIter); + printf("%s===Entry %p===\n", spaces, entry); + if (kSuccess != DTCreatePropertyIterator(entry, &propIter)) + { + printf("Couldn't create property iterator\n"); + return; + } + while( kSuccess == DTIterateProperties( propIter, &name)) + { + if( kSuccess != DTGetProperty( entry, name, &prop, &propSize )) + continue; + printf("%s Property %s = %s\n", spaces, name, prop); + } + DTDisposePropertyIterator(propIter); - printf("%s==========\n", spaces); + printf("%s==========\n", spaces); } +//============================================================================== + static void _PrintFlattenedTree(DTEntry entry, int level) { - DTEntryIterator entryIter; + DTEntryIterator entryIter; - PrintFlattenedNode(entry, level); + PrintFlattenedNode(entry, level); - if (kSuccess != DTCreateEntryIterator(entry, &entryIter)) { - printf("Couldn't create entry iterator\n"); - return; - } - level++; - while (kSuccess == DTIterateEntries( entryIter, &entry )) { - _PrintFlattenedTree(entry, level); - } - DTDisposeEntryIterator(entryIter); + if (kSuccess != DTCreateEntryIterator(entry, &entryIter)) + { + printf("Couldn't create entry iterator\n"); + return; + } + level++; + while (kSuccess == DTIterateEntries( entryIter, &entry )) + { + _PrintFlattenedTree(entry, level); + } + DTDisposeEntryIterator(entryIter); } +//============================================================================== + void DT__PrintFlattenedTree(DTEntry entry) { - _PrintFlattenedTree(entry, 0); + _PrintFlattenedTree(entry, 0); } +//============================================================================== int main(int argc, char **argv) { - DTEntry dtEntry; - DTPropertyIterator propIter; - DTEntryIterator entryIter; - void *prop; - int propSize; - char *name; - void *flatTree; - uint32_t flatSize; + DTEntry dtEntry; + DTPropertyIterator propIter; + DTEntryIterator entryIter; + void *prop; + int propSize; + char *name; + void *flatTree; + uint32_t flatSize; - Node *node; + Node *node; - node = AddChild(NULL, "device-tree"); - AddProperty(node, "potato", 4, "foo"); - AddProperty(node, "chemistry", 4, "bar"); - AddProperty(node, "physics", 4, "baz"); + node = AddChild(NULL, "device-tree"); + AddProperty(node, "potato", 4, "foo"); + AddProperty(node, "chemistry", 4, "bar"); + AddProperty(node, "physics", 4, "baz"); - node = AddChild(node, "dev"); - AddProperty(node, "one", 4, "one"); - AddProperty(node, "two", 4, "two"); - AddProperty(node, "three", 6, "three"); + node = AddChild(node, "dev"); + AddProperty(node, "one", 4, "one"); + AddProperty(node, "two", 4, "two"); + AddProperty(node, "three", 6, "three"); - node = AddChild(rootNode, "foo"); - AddProperty(node, "aaa", 4, "aab"); - AddProperty(node, "bbb", 4, "bbc"); - AddProperty(node, "cccc", 6, "ccccd"); + node = AddChild(rootNode, "foo"); + AddProperty(node, "aaa", 4, "aab"); + AddProperty(node, "bbb", 4, "bbc"); + AddProperty(node, "cccc", 6, "ccccd"); - node = FindNode("/this/is/a/test", 1); - AddProperty(node, "dddd", 12, "abcdefghijk"); + node = FindNode("/this/is/a/test", 1); + AddProperty(node, "dddd", 12, "abcdefghijk"); - printf("In-memory tree:\n\n"); + printf("In-memory tree:\n\n"); - PrintTree(rootNode); + PrintTree(rootNode); - FlattenDeviceTree(&flatTree, &flatSize); + FlattenDeviceTree(&flatTree, &flatSize); - printf("Flat tree = %p, size %d\n", flatTree, flatSize); + printf("Flat tree = %p, size %d\n", flatTree, flatSize); - dtEntry = (DTEntry)flatTree; + dtEntry = (DTEntry)flatTree; - printf("\n\nPrinting flat tree\n\n"); + printf("\n\nPrinting flat tree\n\n"); - DTInit(dtEntry); + DTInit(dtEntry); - PrintFlattenedTree((DTEntry)flatTree); + PrintFlattenedTree((DTEntry)flatTree); #if 0 - printf("=== Entry %p ===\n", dtEntry); - if (kSuccess != DTCreatePropertyIterator(dtEntry, &propIter)) { - printf("Couldn't create property iterator\n"); - return 1; + printf("=== Entry %p ===\n", dtEntry); + if (kSuccess != DTCreatePropertyIterator(dtEntry, &propIter)) + { + printf("Couldn't create property iterator\n"); + return 1; + } + while( kSuccess == DTIterateProperties( propIter, &name)) + { + if( kSuccess != DTGetProperty( dtEntry, name, &prop, &propSize )) + continue; + printf(" Property %s = %s\n", name, prop); } - while( kSuccess == DTIterateProperties( propIter, &name)) { - if( kSuccess != DTGetProperty( dtEntry, name, &prop, &propSize )) - continue; - printf(" Property %s = %s\n", name, prop); - } - DTDisposePropertyIterator(propIter); - printf("========\n"); + DTDisposePropertyIterator(propIter); + printf("========\n"); - if (kSuccess != DTCreateEntryIterator(dtEntry, &entryIter)) { - printf("Couldn't create entry iterator\n"); - return 1; - } - while (kSuccess == DTIterateEntries( entryIter, &dtEntry )) { - printf("=== Entry %p ===\n", dtEntry); + if (kSuccess != DTCreateEntryIterator(dtEntry, &entryIter)) + { + printf("Couldn't create entry iterator\n"); + return 1; + } + while (kSuccess == DTIterateEntries( entryIter, &dtEntry )) + { + printf("=== Entry %p ===\n", dtEntry); - if (kSuccess != DTCreatePropertyIterator(dtEntry, &propIter)) { - printf("Couldn't create property iterator\n"); - return 1; - } - while( kSuccess == DTIterateProperties( propIter, &name)) { - if( kSuccess != DTGetProperty( dtEntry, name, &prop, &propSize )) - continue; - printf(" Property %s = %s\n", name, prop); - } - DTDisposePropertyIterator(propIter); - printf("========\n"); - } - DTDisposeEntryIterator(entryIter); + if (kSuccess != DTCreatePropertyIterator(dtEntry, &propIter)) + { + printf("Couldn't create property iterator\n"); + return 1; + } + while( kSuccess == DTIterateProperties( propIter, &name)) + { + if( kSuccess != DTGetProperty( dtEntry, name, &prop, &propSize )) + continue; + printf(" Property %s = %s\n", name, prop); + } + DTDisposePropertyIterator(propIter); + printf("========\n"); + } + DTDisposeEntryIterator(entryIter); #endif - return 0; + return 0; } #endif Index: branches/ErmaC/Enoch/i386/libsaio/hfs.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/hfs.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/hfs.c (revision 2323) @@ -109,956 +109,1315 @@ u_int16_t *uniStr2, u_int32_t len2); +//============================================================================== + static void SwapFinderInfo(FndrFileInfo *dst, FndrFileInfo *src) { - dst->fdType = SWAP_BE32(src->fdType); - dst->fdCreator = SWAP_BE32(src->fdCreator); - dst->fdFlags = SWAP_BE16(src->fdFlags); - // Don't bother with location + dst->fdType = SWAP_BE32(src->fdType); + dst->fdCreator = SWAP_BE32(src->fdCreator); + dst->fdFlags = SWAP_BE16(src->fdFlags); + // Don't bother with location } + +//============================================================================== + void HFSFree(CICell ih) { - if(gCurrentIH == ih) - gCurrentIH = 0; - free(ih); + if(gCurrentIH == ih) { + gCurrentIH = 0; + } + free(ih); } + +//============================================================================== + bool HFSProbe (const void *buf) { const HFSMasterDirectoryBlock *mdb; const HFSPlusVolumeHeader *header; - mdb=(const HFSMasterDirectoryBlock *)(((const char*)buf)+kMDBBaseOffset); - header=(const HFSPlusVolumeHeader *)(((const char*)buf)+kMDBBaseOffset); + mdb = (const HFSMasterDirectoryBlock *)(((const char*)buf)+kMDBBaseOffset); + header = (const HFSPlusVolumeHeader *)(((const char*)buf)+kMDBBaseOffset); - if ( SWAP_BE16(mdb->drSigWord) == kHFSSigWord ) + if ( SWAP_BE16(mdb->drSigWord) == kHFSSigWord ) { return true; - if (SWAP_BE16(header->signature) != kHFSPlusSigWord && - SWAP_BE16(header->signature) != kHFSXSigWord) + } + + if (SWAP_BE16(header->signature) != kHFSPlusSigWord && SWAP_BE16(header->signature) != kHFSXSigWord) { return false; + } return true; } + +//============================================================================== + long HFSInitPartition(CICell ih) { - long extentSize, extentFile, nodeSize; - void *extent; + long extentSize, extentFile, nodeSize; + void *extent; - if (ih == gCurrentIH) { + if (ih == gCurrentIH) + { #ifdef __i386__ - CacheInit(ih, gCacheBlockSize); + CacheInit(ih, gCacheBlockSize); #endif - return 0; - } + return 0; + } #ifdef __i386__ - if (!gTempStr) gTempStr = (char *)malloc(4096); - if (!gLinkTemp) gLinkTemp = (char *)malloc(64); - if (!gBTreeHeaderBuffer) gBTreeHeaderBuffer = (char *)malloc(512); - if (!gHFSMdbVib) { - gHFSMdbVib = (char *)malloc(kBlockSize); - gHFSMDB = (HFSMasterDirectoryBlock *)gHFSMdbVib; - } - if (!gHFSPlusHeader) { - gHFSPlusHeader = (char *)malloc(kBlockSize); - gHFSPlus = (HFSPlusVolumeHeader *)gHFSPlusHeader; - } - if (!gTempStr || !gLinkTemp || !gBTreeHeaderBuffer || - !gHFSMdbVib || !gHFSPlusHeader) return -1; + if (!gTempStr) + { + gTempStr = (char *)malloc(4096); + } + if (!gLinkTemp) + { + gLinkTemp = (char *)malloc(64); + } + if (!gBTreeHeaderBuffer) + { + gBTreeHeaderBuffer = (char *)malloc(512); + } + if (!gHFSMdbVib) + { + gHFSMdbVib = (char *)malloc(kBlockSize); + gHFSMDB = (HFSMasterDirectoryBlock *)gHFSMdbVib; + } + if (!gHFSPlusHeader) + { + gHFSPlusHeader = (char *)malloc(kBlockSize); + gHFSPlus = (HFSPlusVolumeHeader *)gHFSPlusHeader; + } + if (!gTempStr || !gLinkTemp || !gBTreeHeaderBuffer || !gHFSMdbVib || !gHFSPlusHeader) + { + return -1; + } #endif /* __i386__ */ - gAllocationOffset = 0; - gIsHFSPlus = 0; - gCaseSensitive = 0; - gBTHeaders[0] = 0; - gBTHeaders[1] = 0; + gAllocationOffset = 0; + gIsHFSPlus = 0; + gCaseSensitive = 0; + gBTHeaders[0] = 0; + gBTHeaders[1] = 0; - // Look for the HFS MDB - Seek(ih, kMDBBaseOffset); - Read(ih, (long)gHFSMdbVib, kBlockSize); + // Look for the HFS MDB + Seek(ih, kMDBBaseOffset); + Read(ih, (long)gHFSMdbVib, kBlockSize); - if ( SWAP_BE16(gHFSMDB->drSigWord) == kHFSSigWord ) { - gAllocationOffset = SWAP_BE16(gHFSMDB->drAlBlSt) * kBlockSize; + if (SWAP_BE16(gHFSMDB->drSigWord) == kHFSSigWord) + { + gAllocationOffset = SWAP_BE16(gHFSMDB->drAlBlSt) * kBlockSize; - // See if it is HFSPlus - if (SWAP_BE16(gHFSMDB->drEmbedSigWord) != kHFSPlusSigWord) { - // Normal HFS; - gCacheBlockSize = gBlockSize = SWAP_BE32(gHFSMDB->drAlBlkSiz); - CacheInit(ih, gCacheBlockSize); - gCurrentIH = ih; + // See if it is HFSPlus + if (SWAP_BE16(gHFSMDB->drEmbedSigWord) != kHFSPlusSigWord) + { + // Normal HFS; + gCacheBlockSize = gBlockSize = SWAP_BE32(gHFSMDB->drAlBlkSiz); + CacheInit(ih, gCacheBlockSize); + gCurrentIH = ih; - // grab the 64 bit volume ID - bcopy(&gHFSMDB->drFndrInfo[6], &gVolID, 8); + // grab the 64 bit volume ID + bcopy(&gHFSMDB->drFndrInfo[6], &gVolID, 8); - // Get the Catalog BTree node size. - extent = (HFSExtentDescriptor *)&gHFSMDB->drCTExtRec; - extentSize = SWAP_BE32(gHFSMDB->drCTFlSize); - extentFile = kHFSCatalogFileID; - ReadExtent(extent, extentSize, extentFile, 0, 256, - gBTreeHeaderBuffer + kBTreeCatalog * 256, 0); + // Get the Catalog BTree node size. + extent = (HFSExtentDescriptor *)&gHFSMDB->drCTExtRec; + extentSize = SWAP_BE32(gHFSMDB->drCTFlSize); + extentFile = kHFSCatalogFileID; + ReadExtent(extent, extentSize, extentFile, 0, 256, gBTreeHeaderBuffer + kBTreeCatalog * 256, 0); - nodeSize = SWAP_BE16(((BTHeaderRec *)(gBTreeHeaderBuffer + kBTreeCatalog * 256 + - sizeof(BTNodeDescriptor)))->nodeSize); + nodeSize = SWAP_BE16(((BTHeaderRec *)(gBTreeHeaderBuffer + kBTreeCatalog * 256 + sizeof(BTNodeDescriptor)))->nodeSize); - // If the BTree node size is larger than the block size, reset the cache. - if (nodeSize > gBlockSize) { - gCacheBlockSize = nodeSize; - CacheInit(ih, gCacheBlockSize); - } + // If the BTree node size is larger than the block size, reset the cache. + if (nodeSize > gBlockSize) + { + gCacheBlockSize = nodeSize; + CacheInit(ih, gCacheBlockSize); + } - return 0; - } + return 0; + } - // Calculate the offset to the embeded HFSPlus volume. - gAllocationOffset += (long long)SWAP_BE16(gHFSMDB->drEmbedExtent.startBlock) * + // Calculate the offset to the embeded HFSPlus volume. + gAllocationOffset += (long long)SWAP_BE16(gHFSMDB->drEmbedExtent.startBlock) * SWAP_BE32(gHFSMDB->drAlBlkSiz); - } + } - // Look for the HFSPlus Header - Seek(ih, gAllocationOffset + kMDBBaseOffset); - Read(ih, (long)gHFSPlusHeader, kBlockSize); + // Look for the HFSPlus Header + Seek(ih, gAllocationOffset + kMDBBaseOffset); + Read(ih, (long)gHFSPlusHeader, kBlockSize); - // Not a HFS+ or HFSX volume. - if (SWAP_BE16(gHFSPlus->signature) != kHFSPlusSigWord && - SWAP_BE16(gHFSPlus->signature) != kHFSXSigWord) { - verbose("HFS signature was not present.\n"); - gCurrentIH = 0; - return -1; - } + // Not a HFS+ or HFSX volume. + if (SWAP_BE16(gHFSPlus->signature) != kHFSPlusSigWord && SWAP_BE16(gHFSPlus->signature) != kHFSXSigWord) + { + verbose("HFS signature was not present.\n"); + gCurrentIH = 0; + return -1; + } - gIsHFSPlus = 1; - gCacheBlockSize = gBlockSize = SWAP_BE32(gHFSPlus->blockSize); - CacheInit(ih, gCacheBlockSize); - gCurrentIH = ih; + gIsHFSPlus = 1; + gCacheBlockSize = gBlockSize = SWAP_BE32(gHFSPlus->blockSize); + CacheInit(ih, gCacheBlockSize); + gCurrentIH = ih; ih->modTime = SWAP_BE32(gHFSPlus->modifyDate) - 2082844800; - - // grab the 64 bit volume ID - bcopy(&gHFSPlus->finderInfo[24], &gVolID, 8); - // Get the Catalog BTree node size. - extent = &gHFSPlus->catalogFile.extents; - extentSize = SWAP_BE64(gHFSPlus->catalogFile.logicalSize); - extentFile = kHFSCatalogFileID; + // grab the 64 bit volume ID + bcopy(&gHFSPlus->finderInfo[24], &gVolID, 8); - ReadExtent(extent, extentSize, extentFile, 0, 256, - gBTreeHeaderBuffer + kBTreeCatalog * 256, 0); + // Get the Catalog BTree node size. + extent = &gHFSPlus->catalogFile.extents; + extentSize = SWAP_BE64(gHFSPlus->catalogFile.logicalSize); + extentFile = kHFSCatalogFileID; - nodeSize = SWAP_BE16(((BTHeaderRec *)(gBTreeHeaderBuffer + kBTreeCatalog * 256 + - sizeof(BTNodeDescriptor)))->nodeSize); + ReadExtent(extent, extentSize, extentFile, 0, 256, gBTreeHeaderBuffer + kBTreeCatalog * 256, 0); - // If the BTree node size is larger than the block size, reset the cache. - if (nodeSize > gBlockSize) { - gCacheBlockSize = nodeSize; - CacheInit(ih, gCacheBlockSize); - } + nodeSize = SWAP_BE16(((BTHeaderRec *)(gBTreeHeaderBuffer + kBTreeCatalog * 256 + sizeof(BTNodeDescriptor)))->nodeSize); - return 0; + // If the BTree node size is larger than the block size, reset the cache. + if (nodeSize > gBlockSize) + { + gCacheBlockSize = nodeSize; + CacheInit(ih, gCacheBlockSize); + } + + return 0; } + +//============================================================================== + long HFSLoadFile(CICell ih, char * filePath) { - return HFSReadFile(ih, filePath, (void *)gFSLoadAddress, 0, 0); + return HFSReadFile(ih, filePath, (void *)gFSLoadAddress, 0, 0); } long HFSReadFile(CICell ih, char * filePath, void *base, uint64_t offset, uint64_t length) { - char entry[512]; - char devStr[12]; - long dirID, result, flags; + char entry[512]; + char devStr[12]; + long dirID, result, flags =0; - if (HFSInitPartition(ih) == -1) return -1; - - dirID = kHFSRootFolderID; - // Skip a lead '\'. Start in the system folder if there are two. - if (filePath[0] == '/') { - if (filePath[1] == '/') { - if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); - else dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]); - if (dirID == 0) { + if (HFSInitPartition(ih) == -1) + { return -1; - } - filePath++; - } - filePath++; - } + } - result = ResolvePathToCatalogEntry(filePath, &flags, entry, dirID, 0); - if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - return -1; - } + dirID = kHFSRootFolderID; + // Skip a lead '\'. Start in the system folder if there are two. + if (filePath[0] == '/') + { + if (filePath[1] == '/') + { + if (gIsHFSPlus) + { + dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); + } + else + { + dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]); + } + if (dirID == 0) + { + return -1; + } + + filePath++; + } + + filePath++; + } + + result = ResolvePathToCatalogEntry(filePath, &flags, entry, dirID, 0); + + if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) + { + return -1; + } + #if UNUSED - // Not yet for Intel. System.config/Default.table will fail this check. - // Check file owner and permissions. - if (flags & (kOwnerNotRoot | kPermGroupWrite | kPermOtherWrite)) return -1; + // Not yet for Intel. System.config/Default.table will fail this check. + // Check file owner and permissions. + if (flags & (kOwnerNotRoot | kPermGroupWrite | kPermOtherWrite)) + { + return -1; + } #endif - result = ReadFile(entry, &length, base, offset); - if (result == -1) { - return -1; - } + result = ReadFile(entry, &length, base, offset); + if (result == -1) + { + return -1; + } - getDeviceDescription(ih, devStr); - verbose("Read HFS%s file: [%s/%s] %d bytes.\n", - (gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length); - - return length; + getDeviceDescription(ih, devStr); +/* + verbose("Read HFS%s file: [%s/%s] %d bytes.\n", (gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length); +*/ + return length; } -long HFSGetDirEntry(CICell ih, char * dirPath, long long * dirIndex, char ** name, - long * flags, long * time, - FinderInfo * finderInfo, long * infoValid) +long HFSGetDirEntry(CICell ih, char * dirPath, long long * dirIndex, char ** name, long * flags, long * time, FinderInfo * finderInfo, long * infoValid) { - char entry[512]; - long dirID, dirFlags; + char entry[512]; - if (HFSInitPartition(ih) == -1) return -1; + long dirID, dirFlags = 0; - if (*dirIndex == -1) return -1; + if (HFSInitPartition(ih) == -1) + { + return -1; + } - dirID = kHFSRootFolderID; - // Skip a lead '\'. Start in the system folder if there are two. - if (dirPath[0] == '/') { - if (dirPath[1] == '/') { - if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); - else dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]); - if (dirID == 0) return -1; - dirPath++; - } - dirPath++; - } + if (*dirIndex == -1) + { + return -1; + } - if (*dirIndex == 0) { - ResolvePathToCatalogEntry(dirPath, &dirFlags, entry, dirID, dirIndex); - if (*dirIndex == 0) *dirIndex = -1; - if ((dirFlags & kFileTypeMask) != kFileTypeUnknown) return -1; - } + dirID = kHFSRootFolderID; - GetCatalogEntry(dirIndex, name, flags, time, finderInfo, infoValid); - if (*dirIndex == 0) *dirIndex = -1; - if ((*flags & kFileTypeMask) == kFileTypeUnknown) return -1; + // Skip a lead '\'. Start in the system folder if there are two. + if (dirPath[0] == '/') + { + if (dirPath[1] == '/') + { + if (gIsHFSPlus) + { + dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); + } + else + { + dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]); + } - return 0; + if (dirID == 0) + { + return -1; + } + + dirPath++; + } + + dirPath++; + } + + if (*dirIndex == 0) + { + ResolvePathToCatalogEntry(dirPath, &dirFlags, entry, dirID, dirIndex); + + if (*dirIndex == 0) + { + *dirIndex = -1; + } + + if ((dirFlags & kFileTypeMask) != kFileTypeUnknown) + { + return -1; + } + } + + GetCatalogEntry(dirIndex, name, flags, time, finderInfo, infoValid); + + if (*dirIndex == 0) + { + *dirIndex = -1; + } + + if ((*flags & kFileTypeMask) == kFileTypeUnknown) + { + return -1; + } + + return 0; } -void -HFSGetDescription(CICell ih, char *str, long strMaxLen) +//============================================================================== + +void HFSGetDescription(CICell ih, char *str, long strMaxLen) { - UInt16 nodeSize; - UInt32 firstLeafNode; - long long dirIndex; - char *name; - long flags, time; + UInt16 nodeSize; + UInt32 firstLeafNode; + long long dirIndex; + char *name; + long flags =0, time; - if (HFSInitPartition(ih) == -1) { return; } + if (HFSInitPartition(ih) == -1) { + return; + } - /* Fill some crucial data structures by side effect. */ - dirIndex = 0; - HFSGetDirEntry(ih, "/", &dirIndex, &name, &flags, &time, 0, 0); + /* Fill some crucial data structures by side effect. */ + dirIndex = 0; + HFSGetDirEntry(ih, "/", &dirIndex, &name, &flags, &time, 0, 0); - /* Now we can loook up the volume name node. */ - nodeSize = SWAP_BE16(gBTHeaders[kBTreeCatalog]->nodeSize); - firstLeafNode = SWAP_BE32(gBTHeaders[kBTreeCatalog]->firstLeafNode); + /* Now we can loook up the volume name node. */ + 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); + GetCatalogEntry(&dirIndex, &name, &flags, &time, 0, 0); - strncpy(str, name, strMaxLen); - str[strMaxLen] = '\0'; + strncpy(str, name, strMaxLen); + str[strMaxLen] = '\0'; } -long -HFSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock) +//============================================================================== + +long HFSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock) { - char entry[512]; - long dirID, result, flags; - void *extents; - HFSCatalogFile *hfsFile = (void *)entry; - HFSPlusCatalogFile *hfsPlusFile = (void *)entry; + char entry[512]; + long dirID, result, flags =0; + void *extents; + HFSCatalogFile *hfsFile = (void *)entry; + HFSPlusCatalogFile *hfsPlusFile = (void *)entry; - if (HFSInitPartition(ih) == -1) return -1; + if (HFSInitPartition(ih) == -1) + { + return -1; + } - dirID = kHFSRootFolderID; - // Skip a lead '\'. Start in the system folder if there are two. - if (filePath[0] == '/') { - if (filePath[1] == '/') { - if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]); - else dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]); - if (dirID == 0) { + dirID = kHFSRootFolderID; + + // Skip a lead '\'. Start in the system folder if there are two. + + if (filePath[0] == '/') + { + if (filePath[1] == '/') + { + if (gIsHFSPlus) + { + dirID = SWAP_BE32(((long *) gHFSPlus->finderInfo)[5]); + } + else + { + dirID = SWAP_BE32(gHFSMDB->drFndrInfo[5]); + } + + if (dirID == 0) + { + return -1; + } + filePath++; + } + filePath++; + } + + result = ResolvePathToCatalogEntry(filePath, &flags, entry, dirID, 0); + + if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) + { + printf("HFS: Resolve path %s failed\n", filePath); return -1; - } - filePath++; - } - filePath++; - } + } - result = ResolvePathToCatalogEntry(filePath, &flags, entry, dirID, 0); - if ((result == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - printf("HFS: Resolve path %s failed\n", filePath); - return -1; - } + if (gIsHFSPlus) { + extents = &hfsPlusFile->dataFork.extents; + } else { + extents = &hfsFile->dataExtents; + } - if (gIsHFSPlus) { - extents = &hfsPlusFile->dataFork.extents; - } else { - extents = &hfsFile->dataExtents; - } - #if DEBUG - printf("extent start 0x%x\n", (unsigned long)GetExtentStart(extents, 0)); - printf("block size 0x%x\n", (unsigned long)gBlockSize); - printf("Allocation offset 0x%x\n", (unsigned long)gAllocationOffset); + printf("extent start 0x%x\n", (unsigned long)GetExtentStart(extents, 0)); + printf("block size 0x%x\n", (unsigned long)gBlockSize); + printf("Allocation offset 0x%x\n", (unsigned long)gAllocationOffset); #endif - *firstBlock = ((unsigned long long)GetExtentStart(extents, 0) * (unsigned long long) gBlockSize + gAllocationOffset) / 512ULL; - return 0; + + *firstBlock = ((unsigned long long)GetExtentStart(extents, 0) * (unsigned long long) gBlockSize + gAllocationOffset) / 512ULL; + + return 0; } + +//============================================================================== + long HFSGetUUID(CICell ih, char *uuidStr) { - if (HFSInitPartition(ih) == -1) return -1; - if (gVolID == 0LL) return -1; + if (HFSInitPartition(ih) == -1) + { + return -1; + } - return CreateUUIDString((uint8_t*)(&gVolID), sizeof(gVolID), uuidStr); + if (gVolID == 0LL) + { + return -1; + } + + return CreateUUIDString((uint8_t*)(&gVolID), sizeof(gVolID), uuidStr); } +//============================================================================== // Private Functions static long ReadFile(void * file, uint64_t * length, void * base, uint64_t offset) { - void *extents; - long fileID; - uint64_t fileLength; - HFSCatalogFile *hfsFile = file; - HFSPlusCatalogFile *hfsPlusFile = file; + void *extents; + long fileID; - if (gIsHFSPlus) { - fileID = SWAP_BE32(hfsPlusFile->fileID); - fileLength = (uint64_t)SWAP_BE64(hfsPlusFile->dataFork.logicalSize); - extents = &hfsPlusFile->dataFork.extents; - } else { - fileID = SWAP_BE32(hfsFile->fileID); - fileLength = SWAP_BE32(hfsFile->dataLogicalSize); - extents = &hfsFile->dataExtents; - } + uint64_t fileLength; - if (offset > fileLength) { - printf("Offset is too large.\n"); - return -1; - } + HFSCatalogFile *hfsFile = file; + HFSPlusCatalogFile *hfsPlusFile = file; - if ((*length == 0) || ((offset + *length) > fileLength)) { - *length = fileLength - offset; - } + if (gIsHFSPlus) + { + fileID = SWAP_BE32(hfsPlusFile->fileID); + fileLength = (uint64_t)SWAP_BE64(hfsPlusFile->dataFork.logicalSize); + extents = &hfsPlusFile->dataFork.extents; + } + else + { + fileID = SWAP_BE32(hfsFile->fileID); + fileLength = SWAP_BE32(hfsFile->dataLogicalSize); + extents = &hfsFile->dataExtents; + } -/* if (*length > kLoadSize) { - printf("File is too large.\n"); - return -1; - }*/ + if (offset > fileLength) + { + printf("Offset is too large.\n"); - *length = ReadExtent((char *)extents, fileLength, fileID, - offset, *length, (char *)base, 0); + return -1; + } - return 0; + if ((*length == 0) || ((offset + *length) > fileLength)) + { + *length = fileLength - offset; + } + +/* + if (*length > kLoadSize) + { + printf("File is too large.\n"); + return -1; + } +*/ + + *length = ReadExtent((char *)extents, fileLength, fileID, offset, *length, (char *)base, 0); + + return 0; } -static long GetCatalogEntryInfo(void * entry, long * flags, long * time, - FinderInfo * finderInfo, long * infoValid) +//============================================================================== + +static long GetCatalogEntryInfo(void * entry, long * flags, long * time, FinderInfo * finderInfo, long * infoValid) { - long tmpTime = 0; - long valid = 0; + long tmpTime = 0; + long valid = 0; - // Get information about the file. + // Get information about the file. - switch ( SWAP_BE16(*(short *)entry) ) - { - case kHFSFolderRecord : - *flags = kFileTypeDirectory; - tmpTime = SWAP_BE32(((HFSCatalogFolder *)entry)->modifyDate); - break; + switch (SWAP_BE16(*(short *)entry)) + { + case kHFSFolderRecord : + *flags = kFileTypeDirectory; + tmpTime = SWAP_BE32(((HFSCatalogFolder *)entry)->modifyDate); + break; - case kHFSPlusFolderRecord : - *flags = kFileTypeDirectory | - (SWAP_BE16(((HFSPlusCatalogFolder *)entry)->bsdInfo.fileMode) & kPermMask); - if (SWAP_BE32(((HFSPlusCatalogFolder *)entry)->bsdInfo.ownerID) != 0) - *flags |= kOwnerNotRoot; - tmpTime = SWAP_BE32(((HFSPlusCatalogFolder *)entry)->contentModDate); - break; + case kHFSPlusFolderRecord : + *flags = kFileTypeDirectory | (SWAP_BE16(((HFSPlusCatalogFolder *)entry)->bsdInfo.fileMode) & kPermMask); + if (SWAP_BE32(((HFSPlusCatalogFolder *)entry)->bsdInfo.ownerID) != 0) + { + *flags |= kOwnerNotRoot; + } + tmpTime = SWAP_BE32(((HFSPlusCatalogFolder *)entry)->contentModDate); + break; - case kHFSFileRecord : - *flags = kFileTypeFlat; - tmpTime = SWAP_BE32(((HFSCatalogFile *)entry)->modifyDate); - if (finderInfo) { - SwapFinderInfo((FndrFileInfo *)finderInfo, &((HFSCatalogFile *)entry)->userInfo); - valid = 1; - } - break; + case kHFSFileRecord : + *flags = kFileTypeFlat; + tmpTime = SWAP_BE32(((HFSCatalogFile *)entry)->modifyDate); + if (finderInfo) + { + SwapFinderInfo((FndrFileInfo *)finderInfo, &((HFSCatalogFile *)entry)->userInfo); + valid = 1; + } + break; - case kHFSPlusFileRecord : - *flags = kFileTypeFlat | - (SWAP_BE16(((HFSPlusCatalogFile *)entry)->bsdInfo.fileMode) & kPermMask); - if (SWAP_BE32(((HFSPlusCatalogFile *)entry)->bsdInfo.ownerID) != 0) - *flags |= kOwnerNotRoot; - tmpTime = SWAP_BE32(((HFSPlusCatalogFile *)entry)->contentModDate); - if (finderInfo) { - SwapFinderInfo((FndrFileInfo *)finderInfo, &((HFSPlusCatalogFile *)entry)->userInfo); - valid = 1; - } - break; + case kHFSPlusFileRecord : + *flags = kFileTypeFlat | (SWAP_BE16(((HFSPlusCatalogFile *)entry)->bsdInfo.fileMode) & kPermMask); + if (SWAP_BE32(((HFSPlusCatalogFile *)entry)->bsdInfo.ownerID) != 0) + { + *flags |= kOwnerNotRoot; + } + tmpTime = SWAP_BE32(((HFSPlusCatalogFile *)entry)->contentModDate); + if (finderInfo) + { + SwapFinderInfo((FndrFileInfo *)finderInfo, &((HFSPlusCatalogFile *)entry)->userInfo); + valid = 1; + } + break; - case kHFSFileThreadRecord : - case kHFSPlusFileThreadRecord : - case kHFSFolderThreadRecord : - case kHFSPlusFolderThreadRecord : - *flags = kFileTypeUnknown; - tmpTime = 0; - break; - } + case kHFSFileThreadRecord : + case kHFSPlusFileThreadRecord : + case kHFSFolderThreadRecord : + case kHFSPlusFolderThreadRecord : + *flags = kFileTypeUnknown; + tmpTime = 0; + break; + default: + break; + } - if (time != 0) { - // Convert base time from 1904 to 1970. - *time = tmpTime - 2082844800; - } - if (infoValid) *infoValid = valid; + if (time != 0) + { + // Convert base time from 1904 to 1970. + *time = tmpTime - 2082844800; + } - return 0; + if (infoValid) + { + *infoValid = valid; + } + + return 0; } -static long ResolvePathToCatalogEntry(char * filePath, long * flags, - void * entry, long dirID, long long * dirIndex) + +//============================================================================== + +static long ResolvePathToCatalogEntry(char * filePath, long * flags, void * entry, long dirID, long long * dirIndex) { - char *restPath; - long result, cnt, subFolderID = 0; - long long tmpDirIndex; - HFSPlusCatalogFile *hfsPlusFile; + char *restPath; + long result, cnt, subFolderID = 0; + long long tmpDirIndex; + HFSPlusCatalogFile *hfsPlusFile; - // Copy the file name to gTempStr - cnt = 0; - while ((filePath[cnt] != '/') && (filePath[cnt] != '\0')) cnt++; - strlcpy(gTempStr, filePath, cnt+1); + // Copy the file name to gTempStr + cnt = 0; + while ((filePath[cnt] != '/') && (filePath[cnt] != '\0')) + { + cnt++; + } - // Move restPath to the right place. - if (filePath[cnt] != '\0') cnt++; - restPath = filePath + cnt; + strlcpy(gTempStr, filePath, cnt+1); - // gTempStr is a name in the current Dir. - // restPath is the rest of the path if any. + // Move restPath to the right place. + if (filePath[cnt] != '\0') + { + cnt++; + } - result = ReadCatalogEntry(gTempStr, dirID, entry, dirIndex); - if (result == -1) { - return -1; - } + restPath = filePath + cnt; - GetCatalogEntryInfo(entry, flags, 0, 0, 0); + // gTempStr is a name in the current Dir. + // restPath is the rest of the path if any. - if ((*flags & kFileTypeMask) == kFileTypeDirectory) { - if (gIsHFSPlus) - subFolderID = SWAP_BE32(((HFSPlusCatalogFolder *)entry)->folderID); - else - subFolderID = SWAP_BE32(((HFSCatalogFolder *)entry)->folderID); - } + result = ReadCatalogEntry(gTempStr, dirID, entry, dirIndex); - if ((*flags & kFileTypeMask) == kFileTypeDirectory) - result = ResolvePathToCatalogEntry(restPath, flags, entry, - subFolderID, dirIndex); + if (result == -1) + { + return -1; + } - if (gIsHFSPlus && ((*flags & kFileTypeMask) == kFileTypeFlat)) { - hfsPlusFile = (HFSPlusCatalogFile *)entry; - if ((SWAP_BE32(hfsPlusFile->userInfo.fdType) == kHardLinkFileType) && - (SWAP_BE32(hfsPlusFile->userInfo.fdCreator) == kHFSPlusCreator)) { - sprintf(gLinkTemp, "%s/%s%ld", HFSPLUSMETADATAFOLDER, - HFS_INODE_PREFIX, SWAP_BE32(hfsPlusFile->bsdInfo.special.iNodeNum)); - result = ResolvePathToCatalogEntry(gLinkTemp, flags, entry, - kHFSRootFolderID, &tmpDirIndex); - } - } + GetCatalogEntryInfo(entry, flags, 0, 0, 0); - return result; + if ((*flags & kFileTypeMask) == kFileTypeDirectory) + { + if (gIsHFSPlus) + { + subFolderID = SWAP_BE32(((HFSPlusCatalogFolder *)entry)->folderID); + } + else + { + subFolderID = SWAP_BE32(((HFSCatalogFolder *)entry)->folderID); + } + } + + if ((*flags & kFileTypeMask) == kFileTypeDirectory) + { + result = ResolvePathToCatalogEntry(restPath, flags, entry, subFolderID, dirIndex); + } + + if (gIsHFSPlus && ((*flags & kFileTypeMask) == kFileTypeFlat)) + { + hfsPlusFile = (HFSPlusCatalogFile *)entry; + + if ((SWAP_BE32(hfsPlusFile->userInfo.fdType) == kHardLinkFileType) && (SWAP_BE32(hfsPlusFile->userInfo.fdCreator) == kHFSPlusCreator)) + { + sprintf(gLinkTemp, "%s/%s%ld", HFSPLUSMETADATAFOLDER, HFS_INODE_PREFIX, SWAP_BE32(hfsPlusFile->bsdInfo.special.iNodeNum)); + result = ResolvePathToCatalogEntry(gLinkTemp, flags, entry, kHFSRootFolderID, &tmpDirIndex); + } + } + + return result; } -static long GetCatalogEntry(long long * dirIndex, char ** name, - long * flags, long * time, - FinderInfo * finderInfo, long * infoValid) + +//============================================================================== + +static long GetCatalogEntry(long long * dirIndex, char ** name, long * flags, long * time, FinderInfo * finderInfo, long * infoValid) { - long extentSize, nodeSize, curNode, index; - void *extent; - char *nodeBuf, *testKey, *entry; - BTNodeDescriptor *node; + long extentSize, nodeSize, curNode, index; + void *extent; + char *nodeBuf, *testKey, *entry; + BTNodeDescriptor *node; - if (gIsHFSPlus) { - extent = &gHFSPlus->catalogFile.extents; - extentSize = SWAP_BE64(gHFSPlus->catalogFile.logicalSize); - } else { - extent = (HFSExtentDescriptor *)&gHFSMDB->drCTExtRec; - extentSize = SWAP_BE32(gHFSMDB->drCTFlSize); - } + if (gIsHFSPlus) + { + extent = &gHFSPlus->catalogFile.extents; + extentSize = SWAP_BE64(gHFSPlus->catalogFile.logicalSize); + } + else + { + extent = (HFSExtentDescriptor *)&gHFSMDB->drCTExtRec; + extentSize = SWAP_BE32(gHFSMDB->drCTFlSize); + } - nodeSize = SWAP_BE16(gBTHeaders[kBTreeCatalog]->nodeSize); - nodeBuf = (char *)malloc(nodeSize); - node = (BTNodeDescriptor *)nodeBuf; + nodeSize = SWAP_BE16(gBTHeaders[kBTreeCatalog]->nodeSize); + nodeBuf = (char *)malloc(nodeSize); + node = (BTNodeDescriptor *)nodeBuf; - index = (long) (*dirIndex % nodeSize); - curNode = (long) (*dirIndex / nodeSize); + index = (long) (*dirIndex % nodeSize); + curNode = (long) (*dirIndex / nodeSize); - // Read the BTree node and get the record for index. - ReadExtent(extent, extentSize, kHFSCatalogFileID, - (long long) curNode * nodeSize, nodeSize, nodeBuf, 1); - GetBTreeRecord(index, nodeBuf, nodeSize, &testKey, &entry); + // Read the BTree node and get the record for index. + ReadExtent(extent, extentSize, kHFSCatalogFileID, (long long) curNode * nodeSize, nodeSize, nodeBuf, 1); + GetBTreeRecord(index, nodeBuf, nodeSize, &testKey, &entry); - GetCatalogEntryInfo(entry, flags, time, finderInfo, infoValid); + GetCatalogEntryInfo(entry, flags, time, finderInfo, infoValid); - // Get the file name. - if (gIsHFSPlus) { - utf_encodestr(((HFSPlusCatalogKey *)testKey)->nodeName.unicode, + // Get the file name. + if (gIsHFSPlus) + { + utf_encodestr(((HFSPlusCatalogKey *)testKey)->nodeName.unicode, SWAP_BE16(((HFSPlusCatalogKey *)testKey)->nodeName.length), (u_int8_t *)gTempStr, 256, OSBigEndian); - } else { - strncpy(gTempStr, - (const char *)&((HFSCatalogKey *)testKey)->nodeName[1], - ((HFSCatalogKey *)testKey)->nodeName[0]); - gTempStr[((HFSCatalogKey *)testKey)->nodeName[0]] = '\0'; - } - *name = gTempStr; + } + else + { + strncpy(gTempStr, (const char *)&((HFSCatalogKey *)testKey)->nodeName[1], ((HFSCatalogKey *)testKey)->nodeName[0]); - // Update dirIndex. - index++; - if (index == SWAP_BE16(node->numRecords)) { - index = 0; - curNode = SWAP_BE32(node->fLink); - } - *dirIndex = (long long) curNode * nodeSize + index; + gTempStr[((HFSCatalogKey *)testKey)->nodeName[0]] = '\0'; + } + *name = gTempStr; - free(nodeBuf); + // Update dirIndex. + index++; - return 0; + if (index == SWAP_BE16(node->numRecords)) + { + index = 0; + curNode = SWAP_BE32(node->fLink); + } + *dirIndex = (long long) curNode * nodeSize + index; + + free(nodeBuf); + + return 0; } -static long ReadCatalogEntry(char * fileName, long dirID, - void * entry, long long * dirIndex) + +//============================================================================== + +static long ReadCatalogEntry(char * fileName, long dirID, void * entry, long long * dirIndex) { - long length; - char key[sizeof(HFSPlusCatalogKey)]; - HFSCatalogKey *hfsKey = (HFSCatalogKey *)key; - HFSPlusCatalogKey *hfsPlusKey = (HFSPlusCatalogKey *)key; - - // Make the catalog key. - if ( gIsHFSPlus ) - { - hfsPlusKey->parentID = SWAP_BE32(dirID); - length = strlen(fileName); - if (length > 255) length = 255; - utf_decodestr((u_int8_t *)fileName, hfsPlusKey->nodeName.unicode, - &(hfsPlusKey->nodeName.length), 512, OSBigEndian); - } else { - hfsKey->parentID = SWAP_BE32(dirID); - length = strlen(fileName); - if (length > 31) length = 31; - hfsKey->nodeName[0] = length; - strncpy((char *)(hfsKey->nodeName + 1), fileName, length); - } + long length = 0; + char key[sizeof(HFSPlusCatalogKey)]; + HFSCatalogKey *hfsKey = (HFSCatalogKey *)key; + HFSPlusCatalogKey *hfsPlusKey = (HFSPlusCatalogKey *)key; - return ReadBTreeEntry(kBTreeCatalog, &key, entry, dirIndex); + // Make the catalog key. + if (gIsHFSPlus) + { + hfsPlusKey->parentID = SWAP_BE32(dirID); + length = strlen(fileName); + + if (length > 255) + { + length = 255; + } + + utf_decodestr((u_int8_t *)fileName, hfsPlusKey->nodeName.unicode, &(hfsPlusKey->nodeName.length), 512, OSBigEndian); + } + else + { + hfsKey->parentID = SWAP_BE32(dirID); + length = strlen(fileName); + + if (length > 31) + { + length = 31; + } + + hfsKey->nodeName[0] = length; + strncpy((char *)(hfsKey->nodeName + 1), fileName, length); + } + + return ReadBTreeEntry(kBTreeCatalog, &key, entry, dirIndex); } + +//============================================================================== + static long ReadExtentsEntry(long fileID, long startBlock, void * entry) { - char key[sizeof(HFSPlusExtentKey)]; - HFSExtentKey *hfsKey = (HFSExtentKey *)key; - HFSPlusExtentKey *hfsPlusKey = (HFSPlusExtentKey *)key; + char key[sizeof(HFSPlusExtentKey)]; + HFSExtentKey *hfsKey = (HFSExtentKey *)key; + HFSPlusExtentKey *hfsPlusKey = (HFSPlusExtentKey *)key; - // Make the extents key. - if (gIsHFSPlus) { - hfsPlusKey->forkType = 0; - hfsPlusKey->fileID = SWAP_BE32(fileID); - hfsPlusKey->startBlock = SWAP_BE32(startBlock); - } else { - hfsKey->forkType = 0; - hfsKey->fileID = SWAP_BE32(fileID); - hfsKey->startBlock = SWAP_BE16(startBlock); - } + // Make the extents key. + if (gIsHFSPlus) + { + hfsPlusKey->forkType = 0; + hfsPlusKey->fileID = SWAP_BE32(fileID); + hfsPlusKey->startBlock = SWAP_BE32(startBlock); + } + else + { + hfsKey->forkType = 0; + hfsKey->fileID = SWAP_BE32(fileID); + hfsKey->startBlock = SWAP_BE16(startBlock); + } - return ReadBTreeEntry(kBTreeExtents, &key, entry, 0); + return ReadBTreeEntry(kBTreeExtents, &key, entry, 0); } + +//============================================================================== + static long ReadBTreeEntry(long btree, void * key, char * entry, long long * dirIndex) { - long extentSize; - void *extent; - short extentFile; - char *nodeBuf; - BTNodeDescriptor *node; - long nodeSize, result = 0, entrySize = 0; - long curNode, index = 0, lowerBound, upperBound; - char *testKey, *recordData; + long extentSize; + void *extent; + short extentFile; + char *nodeBuf; + BTNodeDescriptor *node; + long nodeSize, result = 0, entrySize = 0; + long curNode, index = 0, lowerBound, upperBound; + char *testKey, *recordData =0; - // Figure out which tree is being looked at. - if (btree == kBTreeCatalog) { - if (gIsHFSPlus) { - extent = &gHFSPlus->catalogFile.extents; - extentSize = SWAP_BE64(gHFSPlus->catalogFile.logicalSize); - } else { - extent = (HFSExtentDescriptor *)&gHFSMDB->drCTExtRec; - extentSize = SWAP_BE32(gHFSMDB->drCTFlSize); - } - extentFile = kHFSCatalogFileID; - } else { - if (gIsHFSPlus) { - extent = &gHFSPlus->extentsFile.extents; - extentSize = SWAP_BE64(gHFSPlus->extentsFile.logicalSize); - } else { - extent = (HFSExtentDescriptor *)&gHFSMDB->drXTExtRec; - extentSize = SWAP_BE32(gHFSMDB->drXTFlSize); - } - extentFile = kHFSExtentsFileID; - } + // Figure out which tree is being looked at. + if (btree == kBTreeCatalog) + { + if (gIsHFSPlus) + { + extent = &gHFSPlus->catalogFile.extents; + extentSize = SWAP_BE64(gHFSPlus->catalogFile.logicalSize); + } + else + { + extent = (HFSExtentDescriptor *)&gHFSMDB->drCTExtRec; + extentSize = SWAP_BE32(gHFSMDB->drCTFlSize); + } + extentFile = kHFSCatalogFileID; + } + else + { + if (gIsHFSPlus) + { + extent = &gHFSPlus->extentsFile.extents; + extentSize = SWAP_BE64(gHFSPlus->extentsFile.logicalSize); + } + else + { + extent = (HFSExtentDescriptor *)&gHFSMDB->drXTExtRec; + extentSize = SWAP_BE32(gHFSMDB->drXTFlSize); + } + extentFile = kHFSExtentsFileID; + } - // Read the BTree Header if needed. - if (gBTHeaders[btree] == 0) { - ReadExtent(extent, extentSize, extentFile, 0, 256, - gBTreeHeaderBuffer + btree * 256, 0); - gBTHeaders[btree] = (BTHeaderRec *)(gBTreeHeaderBuffer + btree * 256 + - sizeof(BTNodeDescriptor)); - if ((gIsHFSPlus && btree == kBTreeCatalog) && - (gBTHeaders[btree]->keyCompareType == kHFSBinaryCompare)) { - gCaseSensitive = 1; - } - } + // Read the BTree Header if needed. + if (gBTHeaders[btree] == 0) + { + ReadExtent(extent, extentSize, extentFile, 0, 256, gBTreeHeaderBuffer + btree * 256, 0); + gBTHeaders[btree] = (BTHeaderRec *)(gBTreeHeaderBuffer + btree * 256 + sizeof(BTNodeDescriptor)); - curNode = SWAP_BE32(gBTHeaders[btree]->rootNode); - nodeSize = SWAP_BE16(gBTHeaders[btree]->nodeSize); - nodeBuf = (char *)malloc(nodeSize); - node = (BTNodeDescriptor *)nodeBuf; + if ((gIsHFSPlus && btree == kBTreeCatalog) && (gBTHeaders[btree]->keyCompareType == kHFSBinaryCompare)) + { + gCaseSensitive = 1; + } + } - while (1) { - // Read the current node. - ReadExtent(extent, extentSize, extentFile, - (long long) curNode * nodeSize, nodeSize, nodeBuf, 1); - - // Find the matching key. - lowerBound = 0; - upperBound = SWAP_BE16(node->numRecords) - 1; - while (lowerBound <= upperBound) { - index = (lowerBound + upperBound) / 2; + curNode = SWAP_BE32(gBTHeaders[btree]->rootNode); + nodeSize = SWAP_BE16(gBTHeaders[btree]->nodeSize); + nodeBuf = (char *)malloc(nodeSize); + node = (BTNodeDescriptor *)nodeBuf; - GetBTreeRecord(index, nodeBuf, nodeSize, &testKey, &recordData); + while (1) + { + // Read the current node. + ReadExtent(extent, extentSize, extentFile, (long long) curNode * nodeSize, nodeSize, nodeBuf, 1); - if (gIsHFSPlus) { - if (btree == kBTreeCatalog) { - result = CompareHFSPlusCatalogKeys(key, testKey); - } else { - result = CompareHFSPlusExtentsKeys(key, testKey); - } - } else { - if (btree == kBTreeCatalog) { - result = CompareHFSCatalogKeys(key, testKey); - } else { - result = CompareHFSExtentsKeys(key, testKey); - } - } - - if (result < 0) upperBound = index - 1; // search < trial - else if (result > 0) lowerBound = index + 1; // search > trial - else break; // search = trial - } + // Find the matching key. + lowerBound = 0; + upperBound = SWAP_BE16(node->numRecords) - 1; + + while (lowerBound <= upperBound) + { + index = (lowerBound + upperBound) / 2; + + GetBTreeRecord(index, nodeBuf, nodeSize, &testKey, &recordData); + + if (gIsHFSPlus) + { + if (btree == kBTreeCatalog) + { + result = CompareHFSPlusCatalogKeys(key, testKey); + } + else + { + result = CompareHFSPlusExtentsKeys(key, testKey); + } + } + else + { + if (btree == kBTreeCatalog) + { + result = CompareHFSCatalogKeys(key, testKey); + } + else + { + result = CompareHFSExtentsKeys(key, testKey); + } + } + + if (result < 0) + { + upperBound = index - 1; // search < trial + } + else if (result > 0) + { + lowerBound = index + 1; // search > trial + } + else + { + break; // search = trial + } + } + + if (result < 0) + { + index = upperBound; + GetBTreeRecord(index, nodeBuf, nodeSize, &testKey, &recordData); + } - if (result < 0) { - index = upperBound; - GetBTreeRecord(index, nodeBuf, nodeSize, &testKey, &recordData); - } - - // Found the closest key... Recurse on it if this is an index node. - if (node->kind == kBTIndexNode) { - curNode = SWAP_BE32( *((long *)recordData) ); - } else break; - } - - // Return error if the file was not found. - if (result != 0) { free(nodeBuf); return -1; } + // Found the closest key... Recurse on it if this is an index node. + if (node->kind == kBTIndexNode) + { + curNode = SWAP_BE32( *((long *)recordData) ); + } + else + { + break; + } + } - if (btree == kBTreeCatalog) { - switch (SWAP_BE16(*(short *)recordData)) { - case kHFSFolderRecord : entrySize = 70; break; - case kHFSFileRecord : entrySize = 102; break; - case kHFSFolderThreadRecord : entrySize = 46; break; - case kHFSFileThreadRecord : entrySize = 46; break; - case kHFSPlusFolderRecord : entrySize = 88; break; - case kHFSPlusFileRecord : entrySize = 248; break; - case kHFSPlusFolderThreadRecord : entrySize = 264; break; - case kHFSPlusFileThreadRecord : entrySize = 264; break; - } - } else { - if (gIsHFSPlus) entrySize = sizeof(HFSPlusExtentRecord); - else entrySize = sizeof(HFSExtentRecord); - } - - bcopy(recordData, entry, entrySize); + // Return error if the file was not found. + if (result != 0) + { + free(nodeBuf); + return -1; + } - // Update dirIndex. - if (dirIndex != 0) { - index++; - if (index == SWAP_BE16(node->numRecords)) { - index = 0; - curNode = SWAP_BE32(node->fLink); - } - *dirIndex = (long long) curNode * nodeSize + index; - } - - free(nodeBuf); - - return 0; + if (btree == kBTreeCatalog) + { + switch (SWAP_BE16(*(short *)recordData)) + { + case kHFSFolderRecord : entrySize = 70; + break; + case kHFSFileRecord : entrySize = 102; + break; + case kHFSFolderThreadRecord : entrySize = 46; + break; + case kHFSFileThreadRecord : entrySize = 46; + break; + case kHFSPlusFolderRecord : entrySize = 88; + break; + case kHFSPlusFileRecord : entrySize = 248; + break; + case kHFSPlusFolderThreadRecord : entrySize = 264; + break; + case kHFSPlusFileThreadRecord : entrySize = 264; + break; + } + } + else + { + if (gIsHFSPlus) + { + entrySize = sizeof(HFSPlusExtentRecord); + } + else + { + entrySize = sizeof(HFSExtentRecord); + } + } + + bcopy(recordData, entry, entrySize); + + // Update dirIndex. + if (dirIndex != 0) + { + index++; + if (index == SWAP_BE16(node->numRecords)) + { + index = 0; + curNode = SWAP_BE32(node->fLink); + } + *dirIndex = (long long) curNode * nodeSize + index; + } + + free(nodeBuf); + + return 0; } -static void GetBTreeRecord(long index, char * nodeBuffer, long nodeSize, - char ** key, char ** data) +//============================================================================== + +static void GetBTreeRecord(long index, char * nodeBuffer, long nodeSize, char ** key, char ** data) { - long keySize; - long recordOffset; - - recordOffset = SWAP_BE16(*((short *)(nodeBuffer + (nodeSize - 2 * index - 2)))); - *key = nodeBuffer + recordOffset; - if (gIsHFSPlus) { - keySize = SWAP_BE16(*(short *)*key); - *data = *key + 2 + keySize; - } else { - keySize = **key; - *data = *key + 2 + keySize - (keySize & 1); - } + long keySize; + long recordOffset; + + recordOffset = SWAP_BE16(*((short *)(nodeBuffer + (nodeSize - 2 * index - 2)))); + *key = nodeBuffer + recordOffset; + + if (gIsHFSPlus) + { + keySize = SWAP_BE16(*(short *)*key); + *data = *key + 2 + keySize; + } + else + { + keySize = **key; + *data = *key + 2 + keySize - (keySize & 1); + } } -static long ReadExtent(char * extent, uint64_t extentSize, - long extentFile, uint64_t offset, uint64_t size, - void * buffer, long cache) +//============================================================================== + +static long ReadExtent(char * extent, uint64_t extentSize, long extentFile, uint64_t offset, uint64_t size, void * buffer, long cache) { - uint64_t lastOffset; + uint64_t lastOffset; long long blockNumber, countedBlocks = 0; - long long nextExtent = 0, sizeRead = 0, readSize; - long long nextExtentBlock, currentExtentBlock = 0; - long long readOffset; - long long extentDensity, sizeofExtent, currentExtentSize; - char *currentExtent, *extentBuffer = 0, *bufferPos = buffer; + long long nextExtent = 0, sizeRead = 0, readSize; + long long nextExtentBlock, currentExtentBlock = 0; + long long readOffset; + long long extentDensity, sizeofExtent, currentExtentSize; + char *currentExtent, *extentBuffer = 0, *bufferPos = buffer; - if (offset >= extentSize) return 0; + if (offset >= extentSize) + { + return 0; + } - if (gIsHFSPlus) { - extentDensity = kHFSPlusExtentDensity; - sizeofExtent = sizeof(HFSPlusExtentDescriptor); - } else { - extentDensity = kHFSExtentDensity; - sizeofExtent = sizeof(HFSExtentDescriptor); - } + if (gIsHFSPlus) + { + extentDensity = kHFSPlusExtentDensity; + sizeofExtent = sizeof(HFSPlusExtentDescriptor); + } + else + { + extentDensity = kHFSExtentDensity; + sizeofExtent = sizeof(HFSExtentDescriptor); + } - lastOffset = offset + size; - while (offset < lastOffset) { - blockNumber = offset / gBlockSize; + lastOffset = offset + size; - // Find the extent for the offset. - for (; ; nextExtent++) { - if (nextExtent < extentDensity) { - if ((countedBlocks+GetExtentSize(extent, nextExtent)-1)= blockNumber) { - currentExtent = extentBuffer + sizeofExtent * (nextExtent % extentDensity); - break; - } - - countedBlocks += currentExtentSize; - } + nextExtentBlock = nextExtent / extentDensity; - readOffset = ((blockNumber - countedBlocks) * gBlockSize) + - (offset % gBlockSize); - + if (currentExtentBlock != nextExtentBlock) + { + ReadExtentsEntry(extentFile, countedBlocks, extentBuffer); + currentExtentBlock = nextExtentBlock; + } + + currentExtentSize = GetExtentSize(extentBuffer, nextExtent % extentDensity); + + if ((countedBlocks + currentExtentSize - 1) >= blockNumber) + { + currentExtent = extentBuffer + sizeofExtent * (nextExtent % extentDensity); + break; + } + + countedBlocks += currentExtentSize; + } + + readOffset = ((blockNumber - countedBlocks) * gBlockSize) + (offset % gBlockSize); + // MacWen: fix overflow in multiplication by forcing 64bit multiplication - readSize = (long long)GetExtentSize(currentExtent, 0) * gBlockSize - readOffset; - if (readSize > (size - sizeRead)) readSize = size - sizeRead; + readSize = (long long)GetExtentSize(currentExtent, 0) * gBlockSize - readOffset; - readOffset += (long long)GetExtentStart(currentExtent, 0) * gBlockSize; - - CacheRead(gCurrentIH, bufferPos, gAllocationOffset + readOffset, - readSize, cache); + if (readSize > (size - sizeRead)) + { + readSize = size - sizeRead; + } - sizeRead += readSize; - offset += readSize; - bufferPos += readSize; - } + readOffset += (long long)GetExtentStart(currentExtent, 0) * gBlockSize; - if (extentBuffer) free(extentBuffer); + CacheRead(gCurrentIH, bufferPos, gAllocationOffset + readOffset, readSize, cache); - return sizeRead; + sizeRead += readSize; + offset += readSize; + bufferPos += readSize; + } + + if (extentBuffer) + { + free(extentBuffer); + } + + return sizeRead; } +//============================================================================== + static long GetExtentStart(void * extents, long index) { - long start; - HFSExtentDescriptor *hfsExtents = extents; - HFSPlusExtentDescriptor *hfsPlusExtents = extents; + long start; - if (gIsHFSPlus) start = SWAP_BE32(hfsPlusExtents[index].startBlock); - else start = SWAP_BE16(hfsExtents[index].startBlock); + HFSExtentDescriptor *hfsExtents = extents; + HFSPlusExtentDescriptor *hfsPlusExtents = extents; - return start; + if (gIsHFSPlus) + { + start = SWAP_BE32(hfsPlusExtents[index].startBlock); + } + else + { + start = SWAP_BE16(hfsExtents[index].startBlock); + } + + return start; } + +//============================================================================== + static long GetExtentSize(void * extents, long index) { - long size; - HFSExtentDescriptor *hfsExtents = extents; - HFSPlusExtentDescriptor *hfsPlusExtents = extents; - - if (gIsHFSPlus) size = SWAP_BE32(hfsPlusExtents[index].blockCount); - else size = SWAP_BE16(hfsExtents[index].blockCount); + long size = 0; - return size; + HFSExtentDescriptor *hfsExtents = extents; + HFSPlusExtentDescriptor *hfsPlusExtents = extents; + + if (gIsHFSPlus) + { + size = SWAP_BE32(hfsPlusExtents[index].blockCount); + } + else + { + size = SWAP_BE16(hfsExtents[index].blockCount); + } + + return size; } + +//============================================================================== + static long CompareHFSCatalogKeys(void * key, void * testKey) { - HFSCatalogKey *searchKey, *trialKey; - long result, searchParentID, trialParentID; + HFSCatalogKey *searchKey, *trialKey; + long result, searchParentID, trialParentID; - searchKey = key; - trialKey = testKey; + searchKey = key; + trialKey = testKey; - searchParentID = SWAP_BE32(searchKey->parentID); - trialParentID = SWAP_BE32(trialKey->parentID); + searchParentID = SWAP_BE32(searchKey->parentID); + trialParentID = SWAP_BE32(trialKey->parentID); - // parent dirID is unsigned - if (searchParentID > trialParentID) result = 1; - else if (searchParentID < trialParentID) result = -1; - else { - // parent dirID's are equal, compare names - result = FastRelString(searchKey->nodeName, trialKey->nodeName); - } + // parent dirID is unsigned + if (searchParentID > trialParentID) + { + result = 1; + } + else if (searchParentID < trialParentID) + { + result = -1; + } + else + { + // parent dirID's are equal, compare names + result = FastRelString(searchKey->nodeName, trialKey->nodeName); + } - return result; + return result; } + +//============================================================================== + static long CompareHFSPlusCatalogKeys(void * key, void * testKey) { - HFSPlusCatalogKey *searchKey, *trialKey; - long result, searchParentID, trialParentID; - - searchKey = key; - trialKey = testKey; - - searchParentID = SWAP_BE32(searchKey->parentID); - trialParentID = SWAP_BE32(trialKey->parentID); + HFSPlusCatalogKey *searchKey, *trialKey; + long result, searchParentID, trialParentID; - // parent dirID is unsigned - if (searchParentID > trialParentID) result = 1; - else if (searchParentID < trialParentID) result = -1; - else { - // parent dirID's are equal, compare names - if ((searchKey->nodeName.length == 0) || (trialKey->nodeName.length == 0)) - result = searchKey->nodeName.length - trialKey->nodeName.length; - else - if (gCaseSensitive) { - result = BinaryUnicodeCompare(&searchKey->nodeName.unicode[0], + searchKey = key; + trialKey = testKey; + + searchParentID = SWAP_BE32(searchKey->parentID); + trialParentID = SWAP_BE32(trialKey->parentID); + + // parent dirID is unsigned + if (searchParentID > trialParentID) + { + result = 1; + } + else if (searchParentID < trialParentID) + { + result = -1; + } + else + { + // parent dirID's are equal, compare names + if ((searchKey->nodeName.length == 0) || (trialKey->nodeName.length == 0)) + { + result = searchKey->nodeName.length - trialKey->nodeName.length; + } + else if (gCaseSensitive) + { + result = BinaryUnicodeCompare(&searchKey->nodeName.unicode[0], SWAP_BE16(searchKey->nodeName.length), &trialKey->nodeName.unicode[0], SWAP_BE16(trialKey->nodeName.length)); - } else { - result = FastUnicodeCompare(&searchKey->nodeName.unicode[0], + } + else + { + result = FastUnicodeCompare(&searchKey->nodeName.unicode[0], SWAP_BE16(searchKey->nodeName.length), &trialKey->nodeName.unicode[0], SWAP_BE16(trialKey->nodeName.length), OSBigEndian); - } - } + } + } - return result; + return result; } + +//============================================================================== + static long CompareHFSExtentsKeys(void * key, void * testKey) { - HFSExtentKey *searchKey, *trialKey; - long result; - - searchKey = key; - trialKey = testKey; - - // assume searchKey < trialKey - result = -1; + HFSExtentKey *searchKey, *trialKey; + long result; - if (searchKey->fileID == trialKey->fileID) { - // FileNum's are equal; compare fork types - if (searchKey->forkType == trialKey->forkType) { - // Fork types are equal; compare allocation block number - if (searchKey->startBlock == trialKey->startBlock) { - // Everything is equal - result = 0; - } else { - // Allocation block numbers differ; determine sign - if (SWAP_BE16(searchKey->startBlock) > SWAP_BE16(trialKey->startBlock)) - result = 1; - } - } else { - // Fork types differ; determine sign - if (searchKey->forkType > trialKey->forkType) result = 1; - } - } else { - // FileNums differ; determine sign - if (SWAP_BE32(searchKey->fileID) > SWAP_BE32(trialKey->fileID)) - result = 1; - } + searchKey = key; + trialKey = testKey; - return result; + // assume searchKey < trialKey + result = -1; + + if (searchKey->fileID == trialKey->fileID) + { + // FileNum's are equal; compare fork types + if (searchKey->forkType == trialKey->forkType) + { + // Fork types are equal; compare allocation block number + if (searchKey->startBlock == trialKey->startBlock) + { + // Everything is equal + result = 0; + } + else + { + // Allocation block numbers differ; determine sign + if (SWAP_BE16(searchKey->startBlock) > SWAP_BE16(trialKey->startBlock)) + { + result = 1; + } + } + } + else + { + // Fork types differ; determine sign + if (searchKey->forkType > trialKey->forkType) + { + result = 1; + } + } + } + else + { + // FileNums differ; determine sign + if (SWAP_BE32(searchKey->fileID) > SWAP_BE32(trialKey->fileID)) + { + result = 1; + } + } + + return result; } + +//============================================================================== + static long CompareHFSPlusExtentsKeys(void * key, void * testKey) { - HFSPlusExtentKey *searchKey, *trialKey; - long result; - - searchKey = key; - trialKey = testKey; - - // assume searchKey < trialKey - result = -1; - - if (searchKey->fileID == trialKey->fileID) { - // FileNum's are equal; compare fork types - if (searchKey->forkType == trialKey->forkType) { - // Fork types are equal; compare allocation block number - if (searchKey->startBlock == trialKey->startBlock) { - // Everything is equal - result = 0; - } else { - // Allocation block numbers differ; determine sign - if (SWAP_BE32(searchKey->startBlock) > SWAP_BE32(trialKey->startBlock)) - result = 1; - } - } else { - // Fork types differ; determine sign - if (searchKey->forkType > trialKey->forkType) result = 1; - } - } else { - // FileNums differ; determine sign - if (SWAP_BE32(searchKey->fileID) > SWAP_BE32(trialKey->fileID)) - result = 1; - } + HFSPlusExtentKey *searchKey, *trialKey; + long result = -1; // assume searchKey < trialKey + + searchKey = key; + trialKey = testKey; + + if (searchKey->fileID == trialKey->fileID) + { + // FileNum's are equal; compare fork types + if (searchKey->forkType == trialKey->forkType) + { + // Fork types are equal; compare allocation block number + if (searchKey->startBlock == trialKey->startBlock) + { + // Everything is equal + result = 0; + } + else + { + // Allocation block numbers differ; determine sign + if (SWAP_BE32(searchKey->startBlock) > SWAP_BE32(trialKey->startBlock)) + { + result = 1; + } + } + } + else + { + // Fork types differ; determine sign + if (searchKey->forkType > trialKey->forkType) + { + result = 1; + } + } + } + else + { + // FileNums differ; determine sign + if (SWAP_BE32(searchKey->fileID) > SWAP_BE32(trialKey->fileID)) + { + result = 1; + } + } + return result; } Index: branches/ErmaC/Enoch/i386/libsaio/vbe.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/vbe.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/vbe.h (revision 2323) @@ -57,18 +57,19 @@ * Functions */ enum { - funcGetControllerInfo = 0x4F00, - funcGetModeInfo = 0x4F01, - funcSetMode = 0x4F02, - funcGetCurrentMode = 0x4F03, - funcSaveRestoreState = 0x4F04, - funcWindowControl = 0x4F05, - funcGetSetScanLineLength = 0x4F06, - funcGetSetDisplayStart = 0x4F07, - funcGetSetPaletteFormat = 0x4F08, - funcGetSetPaletteData = 0x4F09, - funcGetProtModeInterdace = 0x4F0A, - funcGetSetPixelClock = 0x4F0B + funcGetControllerInfo = 0x4F00, + funcGetModeInfo = 0x4F01, + funcSetMode = 0x4F02, + funcGetCurrentMode = 0x4F03, + funcSaveRestoreState = 0x4F04, + funcWindowControl = 0x4F05, + funcGetSetScanLineLength = 0x4F06, + funcGetSetDisplayStart = 0x4F07, + funcGetSetPaletteFormat = 0x4F08, + funcGetSetPaletteData = 0x4F09, + funcGetProtModeInterdace = 0x4F0A, + funcGetSetPixelClock = 0x4F0B +// funcGetEDID = 0x4F15 }; enum { @@ -277,6 +278,7 @@ extern int setVBEMode(unsigned short mode, const VBECRTCInfoBlock *timing); extern int getVBECurrentMode(unsigned short *mode); extern int getVBEPixelClock(unsigned short mode, unsigned long *pixelClock); +//extern unsigned long getResolutionFromEDID(void); extern int generateCRTCTiming(unsigned short width, unsigned short height, unsigned long paramValue, Index: branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c (revision 2323) @@ -103,19 +103,17 @@ // Start searching any potential location for ACPI Table snprintf(dirSpec, sizeof(dirSpec), "%s", filename); fd = open(dirSpec, 0); - if (fd < 0) - { - snprintf(dirSpec, sizeof(dirSpec), "/Extra/%s", filename); - fd = open(dirSpec, 0); - if (fd < 0) + if (fd < 0) { + snprintf(dirSpec, sizeof(dirSpec), "/Extra/%s", filename); + fd = open(dirSpec, 0); + if (fd < 0) { - snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/%s", filename); - fd = open(dirSpec, 0); - if (fd < 0) - { - // NOT FOUND: - verbose("ACPI Table not found: %s\n", filename); - *dirSpec = '\0'; + snprintf(dirSpec, sizeof(dirSpec), "bt(0,0)/Extra/%s", filename); + fd = open(dirSpec, 0); + if (fd < 0) { + // NOT FOUND: + verbose("ACPI Table not found: %s\n", filename); + *dirSpec = '\0'; } } } @@ -273,14 +271,14 @@ unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + (c3_enabled ? 1 : 0); - struct aml_chunk* root = aml_create_node(NULL); + AML_CHUNK* root = aml_create_node(NULL); aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header - struct aml_chunk* scop = aml_add_scope(root, "\\_PR_"); - struct aml_chunk* name = aml_add_name(scop, "CST_"); - struct aml_chunk* pack = aml_add_package(name); + AML_CHUNK* scop = aml_add_scope(root, "\\_PR_"); + AML_CHUNK* name = aml_add_name(scop, "CST_"); + AML_CHUNK* pack = aml_add_package(name); aml_add_byte(pack, cstates_count); - struct aml_chunk* tmpl = aml_add_package(pack); + AML_CHUNK* tmpl = aml_add_package(pack); if (cst_using_systemio) { // C1 @@ -288,9 +286,9 @@ resource_template_register_fixedhw[9] = 0x00; resource_template_register_fixedhw[18] = 0x00; aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x01); // C1 - aml_add_word(tmpl, 0x0001); // Latency - aml_add_dword(tmpl, 0x000003e8); // Power + aml_add_byte(tmpl, 0x01); // C1 + aml_add_word(tmpl, 0x0001); // Latency + aml_add_dword(tmpl, 0x000003e8); // Power uint8_t p_blk_lo, p_blk_hi; @@ -303,9 +301,9 @@ resource_template_register_systemio[11] = p_blk_lo; // C2 resource_template_register_systemio[12] = p_blk_hi; // C2 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); - aml_add_byte(tmpl, 0x02); // C2 - aml_add_word(tmpl, 0x0040); // Latency - aml_add_dword(tmpl, 0x000001f4); // Power + aml_add_byte(tmpl, 0x02); // C2 + aml_add_word(tmpl, 0x0040); // Latency + aml_add_dword(tmpl, 0x000001f4); // Power } if (c4_enabled) // C4 @@ -317,9 +315,9 @@ resource_template_register_systemio[11] = p_blk_lo; // C4 resource_template_register_systemio[12] = p_blk_hi; // C4 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); - aml_add_byte(tmpl, 0x04); // C4 - aml_add_word(tmpl, 0x0080); // Latency - aml_add_dword(tmpl, 0x000000C8); // Power + aml_add_byte(tmpl, 0x04); // C4 + aml_add_word(tmpl, 0x0080); // Latency + aml_add_dword(tmpl, 0x000000C8); // Power } else if (c3_enabled) // C3 { @@ -330,18 +328,22 @@ resource_template_register_systemio[11] = p_blk_lo; // C3 resource_template_register_systemio[12] = p_blk_hi; // C3 aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio)); - aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, 0x0060); // Latency + aml_add_byte(tmpl, 0x03); // C3 + aml_add_word(tmpl, 0x0060); // Latency aml_add_dword(tmpl, 0x0000015e); // Power } } else { // C1 + resource_template_register_fixedhw[8] = 0x01; + resource_template_register_fixedhw[9] = 0x02; + resource_template_register_fixedhw[18] = 0x01; + resource_template_register_fixedhw[11] = 0x00; // C1 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x01); // C1 - aml_add_word(tmpl, 0x0001); // Latency + aml_add_byte(tmpl, 0x01); // C1 + aml_add_word(tmpl, 0x0001); // Latency aml_add_dword(tmpl, 0x000003e8); // Power resource_template_register_fixedhw[18] = 0x03; @@ -351,8 +353,8 @@ tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x10; // C2 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x02); // C2 - aml_add_word(tmpl, 0x0040); // Latency + aml_add_byte(tmpl, 0x02); // C2 + aml_add_word(tmpl, 0x0040); // Latency aml_add_dword(tmpl, 0x000001f4); // Power } @@ -361,8 +363,8 @@ tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x30; // C4 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x04); // C4 - aml_add_word(tmpl, 0x0080); // Latency + aml_add_byte(tmpl, 0x04); // C4 + aml_add_word(tmpl, 0x0080); // Latency aml_add_dword(tmpl, 0x000000C8); // Power } else if (c3_enabled) @@ -370,8 +372,8 @@ tmpl = aml_add_package(pack); resource_template_register_fixedhw[11] = 0x20; // C3 aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw)); - aml_add_byte(tmpl, 0x03); // C3 - aml_add_word(tmpl, 0x0060); // Latency + aml_add_byte(tmpl, 0x03); // C3 + aml_add_word(tmpl, 0x0060); // Latency aml_add_dword(tmpl, 0x0000015e); // Power } } @@ -638,16 +640,16 @@ { int i; - struct aml_chunk* root = aml_create_node(NULL); + AML_CHUNK* root = aml_create_node(NULL); aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header - struct aml_chunk* scop = aml_add_scope(root, "\\_PR_"); - struct aml_chunk* name = aml_add_name(scop, "PSS_"); - struct aml_chunk* pack = aml_add_package(name); + AML_CHUNK* scop = aml_add_scope(root, "\\_PR_"); + AML_CHUNK* name = aml_add_name(scop, "PSS_"); + AML_CHUNK* pack = aml_add_package(name); for (i = 0; i < p_states_count; i++) { - struct aml_chunk* pstt = aml_add_package(pack); + AML_CHUNK* pstt = aml_add_package(pack); aml_add_dword(pstt, p_states[i].Frequency); aml_add_dword(pstt, 0x00000000); // Power @@ -849,9 +851,15 @@ int setupAcpi(void) { int version; - void *new_dsdt; + void *new_dsdt = NULL; // DSDT.aml DSDT + void *new_hpet = NULL; // HPET.aml HPET + void *new_sbst = NULL; // SBST.aml SBST + void *new_ecdt = NULL; // ECDT.aml ECDT + void *new_asft = NULL; // ASFT.aml ASF! + void *new_dmar = NULL; // DMAR.aml DMAR + void *new_apic = NULL; // APIC.aml APIC + void *new_mcfg = NULL; // MCFG.aml MCFG - const char *filename; char dirSpec[128]; int len = 0; @@ -862,15 +870,101 @@ /* Try using the file specified with the DSDT option */ if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig)) { - snprintf(dirSpec, sizeof(dirSpec), filename); + snprintf(dirSpec, sizeof(dirSpec), filename); } else { sprintf(dirSpec, "DSDT.aml"); + //verbose("dirSpec, DSDT.aml"); } // Load replacement DSDT new_dsdt = loadACPITable(dirSpec); + + /* Try using the file specified with the HPET option */ + if (getValueForKey(kHPET, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "HPET.aml"); + } + // Load replacement HPET + new_hpet = loadACPITable(dirSpec); + + /* Try using the file specified with the SBST option */ + if (getValueForKey(kSBST, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "SBST.aml"); + } + // Load replacement SBST + new_sbst = loadACPITable(dirSpec); + + /* Try using the file specified with the ECDT option */ + if (getValueForKey(kECDT, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "ECDT.aml"); + } + // Load replacement ECDT + new_ecdt = loadACPITable(dirSpec); + + /* Try using the file specified with the ASF! option */ + if (getValueForKey(kASFT, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "ASFT.aml"); + } + // Load replacement ASF! + new_asft = loadACPITable(dirSpec); + + /* Try using the file specified with the DMAR option */ + if (getValueForKey(kDMAR, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "DMAR.aml"); + } + // Load replacement DMAR + new_dmar = loadACPITable(dirSpec); + + /* Try using the file specified with the APIC option */ + if (getValueForKey(kAPIC, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "APIC.aml"); + } + // Load replacement APIC + new_apic = loadACPITable(dirSpec); + + // Try using the file specified with the MCFG option */ + if (getValueForKey(kMCFG, &filename, &len, &bootInfo->chameleonConfig)) + { + snprintf(dirSpec, sizeof(dirSpec), filename); + } + else + { + sprintf(dirSpec, "MCFG.aml"); + } + // Load replacement MCFG + new_mcfg = loadACPITable(dirSpec); + // Mozodojo: going to patch FACP and load SSDT's even if DSDT.aml is not present /*if (!new_dsdt) { @@ -884,21 +978,31 @@ // SSDT Options bool drop_ssdt=false, generate_pstates=false, generate_cstates=false; + + // ACPI Tables + bool drop_dmar = getBoolForKey(kDropDMAR, &drop_dmar, &bootInfo->chameleonConfig); + bool drop_hpet = getBoolForKey(kDropHPET, &drop_hpet, &bootInfo->chameleonConfig); + bool drop_slic = getBoolForKey(kDropSLIC, &drop_slic, &bootInfo->chameleonConfig); + bool drop_sbst = getBoolForKey(kDropSBST, &drop_sbst, &bootInfo->chameleonConfig); + bool drop_ecdt = getBoolForKey(kDropECDT, &drop_ecdt, &bootInfo->chameleonConfig); + bool drop_asft = getBoolForKey(kDropASFT, &drop_asft, &bootInfo->chameleonConfig); getBoolForKey(kDropSSDT, &drop_ssdt, &bootInfo->chameleonConfig); getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig); getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig); + //getBoolForKey(kGenerateTStates, &generate_tstates, &bootInfo->chameleonConfig); DBG("Generating P-States config: %d\n", generate_pstates); DBG("Generating C-States config: %d\n", generate_cstates); + //DBG("Generating T-States config: %d\n", generate_tstates); { int i; - for (i=0; i<30; i++) + for (i = 0; i < 30; i++) { char filename[512]; - sprintf(filename, i>0?"SSDT-%d.aml":"SSDT.aml", i); + sprintf(filename, i > 0?"SSDT-%d.aml":"SSDT.aml", i); if ( (new_ssdt[ssdt_count] = loadACPITable(filename)) ) { @@ -912,7 +1016,7 @@ } // Do the same procedure for both versions of ACPI - for (version=0; version<2; version++) { + for (version = 0; version < 2; version++) { struct acpi_2_rsdp *rsdp, *rsdp_mod; struct acpi_2_rsdt *rsdt, *rsdt_mod; int rsdplength; @@ -974,13 +1078,134 @@ if (drop_ssdt && tableSign(table, "SSDT")) { + verbose("OEM SSDT tables was dropped\n"); dropoffset++; continue; } + + if (drop_hpet && tableSign(table, "HPET")) + { + verbose("OEM HPET table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_slic && tableSign(table, "SLIC")) + { + verbose("OEM SLIC table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_sbst && tableSign(table, "SBST")) + { + verbose("OEM SBST table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_ecdt && tableSign(table, "ECDT")) + { + verbose("OEM ECDT table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_asft && tableSign(table, "ASF!")) + { + verbose("OEM ASF! table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_dmar && tableSign(table, "DMAR")) + { + verbose("OEM DMAR table was dropped\n"); + dropoffset++; + continue; + } + + if (tableSign(table, "HPET")) + { + DBG("HPET found\n"); + verbose("Custom HPET table was found\n"); + if(new_hpet) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_hpet; + } + continue; + } + + if (tableSign(table, "SBST")) + { + DBG("SBST found\n"); + verbose("Custom SBST table was found\n"); + if(new_sbst) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_sbst; + } + continue; + } + + if (tableSign(table, "ECDT")) + { + DBG("ECDT found\n"); + verbose("Custom ECDT table was found\n"); + if(new_ecdt) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_ecdt; + } + continue; + } + + if (tableSign(table, "ASF!")) + { + DBG("ASF! found\n"); + verbose("Custom ASF! table was found\n"); + if(new_asft) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_asft; + } + continue; + } + + if (tableSign(table, "DMAR")) + { + DBG("DMAR found\n"); + verbose("Custom DMAR table was found\n"); + if(new_dmar) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_dmar; + } + continue; + } + + if (tableSign(table, "APIC")) + { + DBG("APIC found\n"); + verbose("Custom APIC table was found\n"); + if(new_apic) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_apic; + } + continue; + } + + if (tableSign(table, "MCFG")) + { + DBG("MCFG found\n"); + verbose("Custom MCFG table was found\n"); + if(new_mcfg) + { + rsdt_entries[i-dropoffset]=(uint32_t)new_mcfg; + } + + continue; + } if (tableSign(table, "DSDT")) { DBG("DSDT found\n"); - + verbose("Custom DSDT table was found\n"); if(new_dsdt) { rsdt_entries[i-dropoffset]=(uint32_t)new_dsdt; @@ -1094,9 +1319,53 @@ if (drop_ssdt && tableSign(table, "SSDT")) { + verbose("OEM SSDT tables was dropped\n"); dropoffset++; continue; } + + if (drop_hpet && tableSign(table, "HPET")) + { + verbose("OEM HPET table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_slic && tableSign(table, "SLIC")) + { + verbose("OEM SLIC table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_sbst && tableSign(table, "SBST")) + { + verbose("OEM SBST table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_ecdt && tableSign(table, "ECDT")) + { + verbose("OEM ECDT table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_asft && tableSign(table, "ASF!")) + { + verbose("OEM ASF! table was dropped\n"); + dropoffset++; + continue; + } + + if (drop_dmar && tableSign(table, "DMAR")) + { + verbose("OEM DMAR table was dropped\n"); + dropoffset++; + continue; + } + if (tableSign(table, "DSDT")) { DBG("DSDT found\n"); @@ -1110,6 +1379,105 @@ continue; } + + if (tableSign(table, "HPET")) + { + DBG("HPET found\n"); + + if (new_hpet) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_hpet; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + + if (tableSign(table, "SBST")) + { + DBG("SBST found\n"); + + if (new_sbst) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_sbst; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + + if (tableSign(table, "ECDT")) + { + DBG("ECDT found\n"); + + if (new_ecdt) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_ecdt; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + + if (tableSign(table, "ASF!")) + { + DBG("ASF! found\n"); +; + if (new_asft) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_asft; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + + if (tableSign(table, "DMAR")) + { + DBG("DMAR found\n"); + + if (new_dmar) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_dmar; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + + if (tableSign(table, "APIC")) + { + DBG("APIC found\n"); + + if (new_apic) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_apic; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + + if (tableSign(table, "MCFG")) + { + DBG("MCFG found\n"); + + if (new_mcfg) + { + xsdt_entries[i-dropoffset]=(uint32_t)new_mcfg; + } + + DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]); + + continue; + } + if (tableSign(table, "FACP")) { struct acpi_2_fadt *fadt, *fadt_mod; @@ -1143,6 +1511,12 @@ ssdt_count++; } + // Generating _TSS SSDT + /*if (generate_tstates && (new_ssdt[ssdt_count] = generate_tss_ssdt((void*)fadt_mod->DSDT))) + { + generate_tstates = false; // Generate SSDT only once! + ssdt_count++; + }*/ continue; } @@ -1160,7 +1534,7 @@ xsdt_entries=(uint64_t *)(xsdt_mod+1); // Mozodojo: Insert additional SSDTs into XSDT - if(ssdt_count>0) + if(ssdt_count > 0) { int j; Index: branches/ErmaC/Enoch/i386/libsaio/device_tree.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/device_tree.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/device_tree.h (revision 2323) @@ -1,5 +1,25 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public + * Source License Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. + * + * The Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ */ #ifndef __DEVICE_TREE_H @@ -8,21 +28,24 @@ #include #include + +//============================================================================== + typedef struct _Property { - const char * name; - uint32_t length; - void * value; - - struct _Property * next; + const char * name; + uint32_t length; + void * value; + struct _Property * next; } Property; + +//============================================================================== + typedef struct _Node { - struct _Property * properties; - struct _Property * last_prop; - - struct _Node * children; - - struct _Node * next; + struct _Property * properties; + struct _Property * last_prop; + struct _Node * children; + struct _Node * next; } Node; @@ -47,10 +70,9 @@ void DT__Initialize(void); -/* - * Free up memory used by in-memory representation - * of device tree. - */ + +// Free up memory used by in-memory representation of device tree. + extern void DT__Finalize(void); Index: branches/ErmaC/Enoch/i386/libsaio/allocate.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/allocate.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/allocate.c (revision 2323) @@ -33,47 +33,55 @@ #define RoundPage(x) ((((unsigned)(x)) + kPageSize - 1) & ~(kPageSize - 1)) +//============================================================================== + long AllocateMemoryRange(char * rangeName, long start, long length, long type) { - char *nameBuf; - uint32_t *buffer; - - nameBuf = malloc(strlen(rangeName) + 1); - if (nameBuf == 0) return -1; - - buffer = malloc(2 * sizeof(uint32_t)); - if (buffer == 0) { - free(nameBuf); - return -1; - } - - strcpy(nameBuf, rangeName); - buffer[0] = start; - buffer[1] = length; - - DT__AddProperty(gMemoryMapNode, nameBuf, 2 * sizeof(uint32_t), (char *)buffer); - - return 0; + char *nameBuf; + uint32_t *buffer; + + nameBuf = malloc(strlen(rangeName) + 1); + + if (nameBuf == 0) { + return -1; + } + + buffer = malloc(2 * sizeof(uint32_t)); + + if (buffer == 0) { + free(nameBuf); + return -1; + } + + strcpy(nameBuf, rangeName); + buffer[0] = start; + buffer[1] = length; + + DT__AddProperty(gMemoryMapNode, nameBuf, 2 * sizeof(uint32_t), (char *)buffer); + + return 0; } + +//============================================================================== + long -AllocateKernelMemory( long inSize ) +AllocateKernelMemory(long inSize) { - long addr; + long addr; - if (gImageLastKernelAddr == 0) { - gImageLastKernelAddr = RoundPage( bootArgs->kaddr + - bootArgs->ksize ); - } - addr = gImageLastKernelAddr; - gImageLastKernelAddr += RoundPage(inSize); + if (gImageLastKernelAddr == 0) { + gImageLastKernelAddr = RoundPage(bootArgs->kaddr + bootArgs->ksize); + } + addr = gImageLastKernelAddr; + gImageLastKernelAddr += RoundPage(inSize); - if ( gImageLastKernelAddr >= (KERNEL_ADDR + KERNEL_LEN) ) { - stop ("AllocateKernelMemory error"); - } - - bootArgs->ksize = gImageLastKernelAddr - bootArgs->kaddr; + if ( gImageLastKernelAddr >= (KERNEL_ADDR + KERNEL_LEN) ) { + stop ("AllocateKernelMemory error"); + } - return addr; + bootArgs->ksize = gImageLastKernelAddr - bootArgs->kaddr; + + return addr; } Index: branches/ErmaC/Enoch/i386/libsaio/bootargs.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bootargs.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/bootargs.h (revision 2323) @@ -45,8 +45,8 @@ enum { kEfiReservedMemoryType = 0, - kEfiLoaderCode = 1, - kEfiLoaderData = 2, + kEfiLoaderCode = 1, + kEfiLoaderData = 2, kEfiBootServicesCode = 3, kEfiBootServicesData = 4, kEfiRuntimeServicesCode = 5, @@ -57,7 +57,7 @@ kEfiACPIMemoryNVS = 10, kEfiMemoryMappedIO = 11, kEfiMemoryMappedIOPortSpace = 12, - kEfiPalCode = 13, + kEfiPalCode = 13, kEfiMaxMemoryType = 14 }; @@ -93,15 +93,15 @@ /* Values for v_display */ -#define GRAPHICS_MODE 1 -#define FB_TEXT_MODE 2 +#define GRAPHICS_MODE 1 +#define FB_TEXT_MODE 2 /* Boot argument structure - passed into Mach kernel at boot time. * "Revision" can be incremented for compatible changes */ // Lion -#define kBootArgsRevision 0 -#define kBootArgsVersion 2 +#define kBootArgsRevision 0 +#define kBootArgsVersion 2 // Snow Leopard and older #define kBootArgsPreLionRevision 6 @@ -109,85 +109,92 @@ /* Snapshot constants of previous revisions that are supported */ -#define kBootArgsEfiMode32 32 -#define kBootArgsEfiMode64 64 +#define kBootArgsEfiMode32 32 +#define kBootArgsEfiMode64 64 -typedef struct boot_args { +typedef struct boot_args_pre_lion +{ uint16_t Revision; /* Revision of boot_args structure */ uint16_t Version; /* Version of boot_args structure */ - - uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */ - uint8_t debugMode; /* Bit field with behavior changes */ - uint8_t __reserved1[2]; - + char CommandLine[BOOT_LINE_LENGTH]; /* Passed in command line */ - + uint32_t MemoryMap; /* Physical address of memory map */ uint32_t MemoryMapSize; uint32_t MemoryMapDescriptorSize; uint32_t MemoryMapDescriptorVersion; - + Boot_Video Video; /* Video Information */ - + uint32_t deviceTreeP; /* Physical address of flattened device tree */ uint32_t deviceTreeLength; /* Length of flattened tree */ - + uint32_t kaddr; /* Physical address of beginning of kernel text */ uint32_t ksize; /* Size of combined kernel text+data+efi */ - + uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */ uint32_t efiRuntimeServicesPageCount; - uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */ - + uint32_t efiSystemTable; /* physical address of system table in runtime area */ - uint32_t __reserved2; - + + uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */ + uint8_t __reserved1[3]; + uint32_t __reserved2[1]; uint32_t performanceDataStart; /* physical address of log */ uint32_t performanceDataSize; - - uint32_t keyStoreDataStart; /* physical address of key store data */ - uint32_t keyStoreDataSize; - uint64_t bootMemStart; - uint64_t bootMemSize; - uint64_t PhysicalMemorySize; - uint64_t FSBFrequency; - uint32_t __reserved4[734]; - -} boot_args; + uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */ + uint32_t __reserved3[2]; -typedef struct boot_args_pre_lion { +} boot_args_pre_lion; + +/* Bitfields for boot_args->flags */ +#define kBootArgsFlagRebootOnPanic (1 << 0) +#define kBootArgsFlagHiDPI (1 << 1) + +typedef struct boot_args +{ uint16_t Revision; /* Revision of boot_args structure */ uint16_t Version; /* Version of boot_args structure */ - + + uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */ + uint8_t debugMode; /* Bit field with behavior changes */ + uint16_t flags; + char CommandLine[BOOT_LINE_LENGTH]; /* Passed in command line */ - + uint32_t MemoryMap; /* Physical address of memory map */ uint32_t MemoryMapSize; uint32_t MemoryMapDescriptorSize; uint32_t MemoryMapDescriptorVersion; - + Boot_Video Video; /* Video Information */ - + uint32_t deviceTreeP; /* Physical address of flattened device tree */ uint32_t deviceTreeLength; /* Length of flattened tree */ - + uint32_t kaddr; /* Physical address of beginning of kernel text */ uint32_t ksize; /* Size of combined kernel text+data+efi */ - + uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */ uint32_t efiRuntimeServicesPageCount; + uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */ + uint32_t efiSystemTable; /* physical address of system table in runtime area */ - - uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */ - uint8_t __reserved1[3]; - uint32_t __reserved2[1]; + uint8_t __reserved1[2]; + uint32_t __reserved2; uint32_t performanceDataStart; /* physical address of log */ uint32_t performanceDataSize; - uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */ - uint32_t __reserved3[2]; - -} boot_args_pre_lion; + uint32_t keyStoreDataStart; /* physical address of key store data */ + uint32_t keyStoreDataSize; + uint64_t bootMemStart; + uint64_t bootMemSize; + uint64_t PhysicalMemorySize; + uint64_t FSBFrequency; + uint32_t __reserved4[734]; + +} boot_args; + extern char gMacOSVersion[8]; #endif /* _PEXPERT_I386_BOOT_H */ Index: branches/ErmaC/Enoch/i386/libsaio/hfs_compare.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/hfs_compare.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/hfs_compare.c (revision 2323) @@ -123,14 +123,14 @@ if (aSortWord < bSortWord) return -1; } - + /* * If characters match exactly, then go on to next character * immediately without doing any extra work. */ } - /* if you got to here, then return bestGuess */ + /* If you got to here, then return bestGuess */ return bestGuess; } Index: branches/ErmaC/Enoch/i386/libsaio/spd.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/spd.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/spd.c (revision 2323) @@ -69,43 +69,6 @@ #define SMBHSTDAT 5 #define SBMBLKDAT 7 -/** 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) -{ - int l1, h1, l2, h2; - unsigned long long t; - - outb(base + SMBHSTSTS, 0x1f); // reset SMBus Controller - outb(base + SMBHSTDAT, 0xff); - - rdtsc(l1, h1); - while ( inb(base + SMBHSTSTS) & 0x01) // wait until read - { - rdtsc(l2, h2); - t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); - if (t > 5) - return 0xFF; // break - } - - outb(base + SMBHSTCMD, cmd); - outb(base + SMBHSTADD, (adr << 1) | 0x01 ); - outb(base + SMBHSTCNT, 0x48 ); - - rdtsc(l1, h1); - - while (!( inb(base + SMBHSTSTS) & 0x02)) // wait til command finished - { - rdtsc(l2, h2); - t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); - if (t > 5) - break; // break after 5ms - } - return inb(base + SMBHSTDAT); -} - -/* 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, @@ -119,6 +82,49 @@ }; #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) +{ + int l1, h1, l2, h2; + unsigned long long t; + + outb(base + SMBHSTSTS, 0x1f); // reset SMBus Controller + outb(base + SMBHSTDAT, 0xff); + + rdtsc(l1, h1); + while ( inb(base + SMBHSTSTS) & 0x01) // wait until read + { + rdtsc(l2, h2); + t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); + if (t > 5) + { + return 0xFF; // break + } + } + + outb(base + SMBHSTCMD, cmd); + outb(base + SMBHSTADD, (adr << 1) | 0x01 ); + outb(base + SMBHSTCNT, 0x48 ); + + rdtsc(l1, h1); + + while (!( inb(base + SMBHSTSTS) & 0x02)) // wait til command finished + { + rdtsc(l2, h2); + t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100); + if (t > 5) + { + break; // break after 5ms + } + } + return inb(base + SMBHSTDAT); +} + +/* 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) + + /** Read from spd *used* values only*/ static void init_spd(char * spd, uint32_t base, int slot) { @@ -132,115 +138,147 @@ have different formats, always return a valid ptr.*/ const char * getVendorName(RamSlotInfo_t* slot, uint32_t base, int slot_num) { - uint8_t bank = 0; - uint8_t code = 0; - int i = 0; - uint8_t * spd = (uint8_t *) slot->spd; + uint8_t bank = 0; + uint8_t code = 0; + int i = 0; + uint8_t * spd = (uint8_t *) slot->spd; - 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) - return vendorMap[i].name; - } - else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) { - if(spd[64]==0x7f) { - for (i=64; i<72 && spd[i]==0x7f;i++) { - bank++; - READ_SPD(spd, base, slot_num,i+1); // prefetch next spd byte to read for next loop + 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) + { + return vendorMap[i].name; } - READ_SPD(spd, base, slot_num,i); - code = spd[i]; - } else { - code = spd[64]; - bank = 0; - } - for (i=0; i < VEN_MAP_SIZE; i++) - if (bank==vendorMap[i].bank && code==vendorMap[i].code) - return vendorMap[i].name; - } - /* OK there is no vendor id here lets try to match the partnum if it exists */ - if (strstr(slot->PartNo,"GU332") == slot->PartNo) // Unifosa fingerprint - return "Unifosa"; - return "NoName"; + } + } + 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]; + bank = 0; + } + for (i=0; i < VEN_MAP_SIZE; i++) + { + if (bank==vendorMap[i].bank && code==vendorMap[i].code) + { + return vendorMap[i].name; + } + } + } + /* OK there is no vendor id here lets try to match the partnum if it exists */ + if (strstr(slot->PartNo,"GU332") == slot->PartNo) // Unifosa fingerprint + { + return "Unifosa"; + } + return "NoName"; } -/** Get Default Memory Module Speed (no overclocking handled) */ +/* 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]) { - case 0x0f: - return 1066; - case 0x0c: - return 1333; - case 0x0a: - return 1600; - case 0x14: - default: - return 800; - } - } - else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) { - switch(spd[9]) { - case 0x50: - return 400; - case 0x3d: - return 533; - case 0x30: - return 667; - case 0x25: - default: - return 800; - } - } - return 800; // default freq for unknown types + if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) + { + switch(spd[12]) + { + case 0x0f: + return 1066; + case 0x0c: + return 1333; + case 0x0a: + return 1600; + case 0x14: + 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]) + { + case 0x50: + return 400; + case 0x3d: + return 533; + case 0x30: + return 667; + case 0x25: + default: + return 800; + case 0x1E: + return 1066; + } + } + return 800; // default freq for unknown types } #define SMST(a) ((uint8_t)((spd[a] & 0xf0) >> 4)) #define SLST(a) ((uint8_t)(spd[a] & 0x0f)) -/** Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */ +/* 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[16]; - if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3 - { - sprintf(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)); - } - else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) // DDR2 or DDR - { - sprintf(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)); - } + if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) // DDR3 + { + sprintf(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)); + } + else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) // DDR2 or DDR + { + sprintf(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, "0000000000000000"); + } - return strdup(asciiSerial); + return strdup(asciiSerial); } -/** Get DDR3 or DDR2 Part Number, always return a valid ptr */ +/* Get DDR3 or DDR2 Part Number, always return a valid ptr */ const char * getDDRPartNum(char* spd, uint32_t base, int slot) { 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) { + 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)); + // 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++) { + for (i=start; i < start + sizeof(asciiPartNo); i++) + { READ_SPD(spd, base, slot, i); // only read once the corresponding model part (ddr3 or ddr2) c = spd[i]; - if (isalpha(c) || isdigit(c) || ispunct(c)) // It seems that System Profiler likes only letters and digits... + if (isalpha(c) || isdigit(c) || ispunct(c)) + { + // It seems that System Profiler likes only letters and digits... asciiPartNo[index++] = c; + } else if (!isascii(c)) + { break; + } } return strdup(asciiPartNo); @@ -249,82 +287,103 @@ 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 */ +/* 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; + uint16_t speed; + uint8_t i, spd_size, spd_type; + uint32_t base, mmio, hostc; +// bool dump = false; + RamSlotInfo_t* slot; uint16_t 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; + 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); + //Azi: no use for this! + // getBoolForKey("DumpSPD", &dump, &bootInfo->chameleonConfig); // needed at least for laptops - bool fullBanks = Platform.DMI.MemoryModules == Platform.DMI.CntMemorySlots; + bool fullBanks = Platform.DMI.MemoryModules == Platform.DMI.CntMemorySlots; char spdbuf[MAX_SPD_SIZE]; - // Search MAX_RAM_SLOTS slots - 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)) - { + // Search MAX_RAM_SLOTS slots + 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): 0x%02x @0x%x\n", spd_size, 0x50 + i); + // Check spd is present + if (spd_size && (spd_size != 0xff)) + { slot->spd = spdbuf; - slot->InUse = true; + // ----- + slot->InUse = true; - bzero(slot->spd, spd_size); - - // Copy spd data into buffer - + bzero(slot->spd, spd_size); + + // Copy spd data into buffer + //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]) { - case SPD_MEMORY_TYPE_SDRAM_DDR2: - - 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]); - break; - - case SPD_MEMORY_TYPE_SDRAM_DDR3: - - slot->ModuleSize = ((slot->spd[4] & 0x0f) + 28 ) + ((slot->spd[8] & 0x7) + 3 ); - slot->ModuleSize -= (slot->spd[7] & 0x7) + 25; - slot->ModuleSize = ((1 << slot->ModuleSize) * (((slot->spd[7] >> 3) & 0x1f) + 1)); - - break; - } - - spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((char) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0); - slot->Type = spd_mem_to_smbios[spd_type]; - slot->PartNo = getDDRPartNum(slot->spd, base, i); - slot->Vendor = getVendorName(slot, base, i); - slot->SerialNo = getDDRSerial(slot->spd); + init_spd(slot->spd, base, i); - // determine spd speed - speed = getDDRspeedMhz(slot->spd); - if (slot->FrequencyFrequency = speed; + 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; + break; + + case SPD_MEMORY_TYPE_SDRAM_DDR2: + + 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]); + break; + + case SPD_MEMORY_TYPE_SDRAM_DDR3: + + slot->ModuleSize = ((slot->spd[4] & 0x0f) + 28 ) + ((slot->spd[8] & 0x7) + 3 ); + slot->ModuleSize -= (slot->spd[7] & 0x7) + 25; + slot->ModuleSize = ((1 << slot->ModuleSize) * (((slot->spd[7] >> 3) & 0x1f) + 1)); + + 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) + { + continue; + } + slot->PartNo = getDDRPartNum(slot->spd, base, i); + slot->Vendor = getVendorName(slot, base, i); + slot->SerialNo = getDDRSerial(slot->spd); + + // determine spd speed + speed = getDDRspeedMhz(slot->spd); + if (slot->FrequencyFrequency = 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; @@ -342,42 +401,47 @@ slot->Frequency, slot->Vendor, slot->PartNo, - slot->SerialNo); - + 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]= - 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 - - - + // 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 slot->spd = NULL; - } // for + } // for } static struct smbus_controllers_t smbus_controllers[] = { +// Info from here: http://cateee.net/lkddb/web-lkddb/I2C_I801.html - {0x8086, 0x269B, "ESB2", read_smb_intel }, - {0x8086, 0x25A4, "6300ESB", read_smb_intel }, - {0x8086, 0x24C3, "ICH4", read_smb_intel }, - {0x8086, 0x24D3, "ICH5", read_smb_intel }, - {0x8086, 0x266A, "ICH6", read_smb_intel }, - {0x8086, 0x27DA, "ICH7", read_smb_intel }, - {0x8086, 0x283E, "ICH8", read_smb_intel }, - {0x8086, 0x2930, "ICH9", read_smb_intel }, - {0x8086, 0x3A30, "ICH10R", read_smb_intel }, - {0x8086, 0x3A60, "ICH10B", read_smb_intel }, - {0x8086, 0x3B30, "5 Series", read_smb_intel }, - {0x8086, 0x1C22, "6 Series", read_smb_intel }, - {0x8086, 0x1D22, "C600/X79 Series", read_smb_intel }, - {0x8086, 0x1E22, "7 Series", read_smb_intel }, - {0x8086, 0x5032, "EP80579", read_smb_intel }, - {0x8086, 0x8C22, "8 Series", read_smb_intel }, - {0x8086, 0x9C22, "Lynx Point-LP", read_smb_intel } + {0x8086, 0x1C22, "6 Series", read_smb_intel }, + {0x8086, 0x1D22, "C600/X79 Series", read_smb_intel }, + {0x8086, 0x1D70, "C600/X79 Series", read_smb_intel }, + {0x8086, 0x1D71, "C608/C606/X79 Series", read_smb_intel }, + {0x8086, 0x1D72, "C608", read_smb_intel }, + {0x8086, 0x1E22, "7 Series/C210 Series", read_smb_intel }, + {0x8086, 0x2330, "DH89xxCC", read_smb_intel }, + {0x8086, 0x2413, "82801AA", read_smb_intel }, + {0x8086, 0x2423, "82801BA/BAM", read_smb_intel }, + {0x8086, 0x2443, "82801BA/BAM", read_smb_intel }, + {0x8086, 0x2483, "82801CA/CAM", read_smb_intel }, + {0x8086, 0x24C3, "82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M)", read_smb_intel }, + {0x8086, 0x24D3, "82801EB/ER (ICH5/ICH5R)", read_smb_intel }, + {0x8086, 0x25A4, "6300ESB", read_smb_intel }, + {0x8086, 0x266A, "82801FB/FBM/FR/FW/FRW (ICH6 Family)", read_smb_intel }, + {0x8086, 0x269B, "631xESB/632xESB/3100", read_smb_intel }, + {0x8086, 0x27DA, "N10/ICH 7 Family", read_smb_intel }, + {0x8086, 0x283E, "82801H (ICH8 Family) ", read_smb_intel }, + {0x8086, 0x2930, "82801I (ICH9 Family)", read_smb_intel }, + {0x8086, 0x3A30, "82801JI (ICH10 Family)", read_smb_intel }, + {0x8086, 0x3A60, "82801JD/DO (ICH10 Family)", read_smb_intel }, + {0x8086, 0x3B30, "5 Series/3400 Series", read_smb_intel }, + {0x8086, 0x5032, "EP80579", read_smb_intel }, + {0x8086, 0x8C22, "8 Series/C220", read_smb_intel }, + {0x8086, 0x9C22, "Lynx Point-LP", read_smb_intel } }; @@ -385,33 +449,33 @@ // find_and_read_smbus_controller(root_pci_dev); bool find_and_read_smbus_controller(pci_dt_t* pci_dt) { - pci_dt_t *current = pci_dt; - int i; + 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)); + 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) - { - smbus_controllers[i].read_smb(current); // read smb - return true; - } - } - find_and_read_smbus_controller(current->children); - current = current->next; - } - return false; // not found + 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; + } + } + find_and_read_smbus_controller(current->children); + current = current->next; + } + return false; // not found } void scan_spd(PlatformInfo_t *p) { - find_and_read_smbus_controller(root_pci_dev); + find_and_read_smbus_controller(root_pci_dev); } Index: branches/ErmaC/Enoch/i386/libsaio/networking.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/networking.c (revision 0) +++ branches/ErmaC/Enoch/i386/libsaio/networking.c (revision 2323) @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2009 Evan Lojewski. All rights reserved. + * + * Merge into file from module compcept by ErmaC and Marchrius + * + */ + +#include "boot.h" +#include "bootstruct.h" +#include "pci.h" +#include "platform.h" +#include "device_inject.h" +#include "networking.h" + +#ifndef DEBUG_NETWORKING +#define DEBUG_NETWORKING 0 +#endif + +#if DEBUG_NETWORKING +#define DBG(x...) printf(x) +#else +#define DBG(x...) +#endif + +uint32_t builtin_set = 0; +extern uint32_t devices_number; +//extern uint32_t onboard_number; + +int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id) +{ + uint8_t builtin = 0x00; + if(device) + { + + if((vendor_id != 0x168c) && (builtin_set == 0)) + { + builtin_set = 1; + builtin = 0x01; + } + if(!devprop_add_value(device, "device_type", (uint8_t*)"ethernet", 8)) + { + return 0; + } + if(!devprop_add_value(device, "built-in", (uint8_t*)&builtin, 1)) + { + return 0; + } + devices_number++; + return 1; + } + else + { + return 0; + } +} + +static network_device known_ethernet_cards[] = +{ +// { 0x0000, 0x0000, "Unknown" }, +// 8169 +// { 0x10EC, 0x8169, "Realtek 8169/8110 Gigabit Ethernet" }, + { 0x10EC, 0x8168, "Realtek RTL8111/8168 PCI Express Gigabit Ethernet" }, +// { 0x10EC, 0x8167, "Realtek 8169/8110 Gigabit Ethernet" }, + { 0x10EC, 0x8136, "Realtek RTL8101E/RTL8102E PCI Express Fast Ethernet Controller" }, +// 8139 +// { 0x10EC, 0x8139, "Realtek RTL8139/810x Family Fast Ethernet" }, +// { 0x1186, 0x1300, "Realtek RTL8139/810x Family Fast Ethernet" }, +// { 0x1113, 0x1211, "Realtek RTL8139/810x Family Fast Ethernet" }, + { 0x11AB, 0x4364, "Marvell Yukon Gigabit Adapter 88E8056 Singleport Copper SA" }, + { 0x11AB, 0x4320, "Marvell Yukon Gigabit Adapter 88E8001 Singleport Copper SA" }, +// Broadcom 57XX +// { 0x14e4, 0x1600, "Broadcom 5751 Ethernet" }, +// { 0x14e4, 0x1659, "Broadcom 57XX Ethernet" }, +// { 0x14e4, 0x165A, "BCM5722 NetXtreme Server Gigabit Ethernet" }, +// { 0x14e4, 0x166A, "Broadcom 57XX Ethernet" }, +// { 0x14e4, 0x1672, "BCM5754M NetXtreme Gigabit Ethernet" }, +// { 0x14e4, 0x1673, "BCM5755M NetXtreme Gigabit Ethernet" }, +// { 0x14e4, 0x167A, "BCM5754 NetXtreme Gigabit Ethernet" }, +// { 0x14e4, 0x167B, "BCM5755 NetXtreme Gigabit Ethernet" }, +// { 0x14e4, 0x1684, "Broadcom 57XX Ethernet" }, +// { 0x14e4, 0x1691, "BCM57788 NetLink (TM) Gigabit Ethernet" }, +// { 0x14e4, 0x1693, "BCM5787M NetLink (TM) Gigabit Ethernet" }, +// { 0x14e4, 0x169B, "BCM5787 NetLink (TM) Gigabit Ethernet" }, +// { 0x14e4, 0x16B4, "Broadcom 57XX Ethernet" }, +// { 0x14e4, 0x16B5, "BCM57785 Gigabit Ethernet PCIe" }, +// { 0x14e4, 0x1712, "BCM5906 NetLink (TM) Fast Ethernet" }, +// { 0x14e4, 0x1713, "BCM5906M NetLink (TM) Fast Ethernet" }, +// Intel 8255x Ethernet +// { 0x8086, 0x1051, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1050, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1029, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1030, "Intel 8255x Ethernet" }, + { 0x8086, 0x10CE, "Intel(R) 82567V-2 PCI Express Gigabit Network" }, +// { 0x8086, 0x1209, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1227, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1228, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1229, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1503, "Intel 82579V Gigabit Network Controller" }, +// { 0x8086, 0x2449, "Intel 8255x Ethernet" }, +// { 0x8086, 0x2459, "Intel 8255x Ethernet" }, +// { 0x8086, 0x245D, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1091, "Intel 8255x Ethernet" }, +// { 0x8086, 0x1060, "Intel 8255x Ethernet" }, +// Atheros AR8151 Ethernet +// { 0x1969, 0x1083, "Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet" }, + { 0x1969, 0x1026, "Atheros AR8121/AR8113/AR8114 Ethernet" }, +}; + +static network_device generic_ethernet_cards[] = +{ + { 0x0000, 0x0000, "Generic Ethernet Controller" }, + { 0x10EC, 0x0000, "Realtek Ethernet Controller" }, + { 0x11AB, 0x0000, "Marvell Ethernet Controller" }, + { 0x1969, 0x0000, "Atheros Ethernet Controller" }, + { 0x8086, 0x0000, "Intel(R) Ethernet Controller" }, +}; + +char *get_ethernet_model(uint32_t vendor_id, uint32_t device_id) +{ + int i = 0; + for( ; i < sizeof(known_ethernet_cards) / sizeof(known_ethernet_cards[0]); i++) + { + if(vendor_id == known_ethernet_cards[i].vendor_id && + device_id == known_ethernet_cards[i].device_id) + { + return known_ethernet_cards[i].model; + } + } + i = 0; + for ( ; i < sizeof(generic_ethernet_cards) / sizeof(generic_ethernet_cards[0]); i++) + { + if (vendor_id == generic_ethernet_cards[i].vendor_id) + { + return generic_ethernet_cards[i].model; + } + } + return generic_ethernet_cards[0].model; +} + +void setup_eth_builtin(pci_dt_t *eth_dev) +{ + char *devicepath = get_pci_dev_path(eth_dev); + char *name_model = NULL; + + DevPropDevice *device = (DevPropDevice*)malloc(sizeof(DevPropDevice)); + + verbose("LAN Controller [%04x:%04x] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath); + + if (!string) + { + string = devprop_create_string(); + if (!string) + { + return; + } + } + + device = devprop_add_device(string, devicepath); + if(device) + { + verbose("Setting up lan keys\n"); + name_model = get_ethernet_model(eth_dev->vendor_id, eth_dev->device_id); + + devprop_add_network_template(device, eth_dev->vendor_id); + devprop_add_value(device, "model", (uint8_t*)name_model, (strlen(name_model) + 1)); + + stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length); + if(stringdata) + { + memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); + stringlength = string->length; + } + } +} + +static network_device known_wifi_cards[] = +{ + {0x14e4, 0x4312, "Broadcom BCM4311 802.11a/b/g"}, + {0x14e4, 0x4315, "Broadcom BCM4312 802.11b/g Wireless LAN Controller"}, + {0x14e4, 0x4319, "Broadcom BCM4318 [AirForce 54g] 802.11a/b/g PCI Express Transceiver"}, + {0x14e4, 0x432b, "Broadcom BCM4322 802.11a/b/g/n Wireless LAN Controller"}, + {0x14e4, 0x432c, "Broadcom BCM4322 802.11b/g/n"}, + {0x14e4, 0x4331, "Broadcom BCM4331 802.11a/b/g/n"}, + {0x14e4, 0x4359, "Broadcom BCM43228 802.11a/b/g/n"}, + {0x168C, 0x0020, "Atheros AR5513 802.11abg Wireless NIC"}, + {0x168C, 0x0023, "Atheros AR5416 Wireless Network Adapter [AR5008 802.11(a)bgn]"}, + {0x168C, 0x0024, "Atheros AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn]"}, + {0x168C, 0x0027, "Atheros AR9160 Wireless Network Adapter [AR9001 802.11(a)bgn]"}, + {0x168C, 0x0029, "Atheros AR922X Wireless Network Adapter"}, + {0x168C, 0x002A, "Atheros AR928X Wireless Network Adapter"}, // "pci168c,2a" + {0x168C, 0x002B, "Atheros AR9285 Wireless Network Adapter"}, +}; + +void setup_wifi_airport(pci_dt_t *wlan_dev) // ARPT +{ + char tmp[16]; + uint8_t BuiltIn = 0x00; + DevPropDevice *device ; + char *devicepath = get_pci_dev_path(wlan_dev); + + verbose("Wifi Controller [%04x:%04x]\n", wlan_dev->vendor_id, wlan_dev->device_id); + + if (!string) + { + string = devprop_create_string(); + if (!string) + { + return; + } + } + + device = devprop_add_device(string, devicepath); + if(device) + { + //sprintf(tmp, sizeof(tmp),"Airport"); + sprintf(tmp, "AirPort"); + devprop_add_value(device, "AAPL,slot-name", (uint8_t *) tmp, strlen(tmp) + 1); + devprop_add_value(device, "device_type", (uint8_t *) tmp, strlen(tmp) + 1); + devprop_add_value(device, "built-in", (uint8_t *)&BuiltIn, 1); + + int i = 0; + for( ; i < sizeof(known_wifi_cards) / sizeof(known_wifi_cards[0]); i++) + { + if(wlan_dev->vendor_id == known_wifi_cards[i].vendor_id && wlan_dev->device_id == known_wifi_cards[i].device_id) + { + verbose("Setting up wifi keys\n"); + devprop_add_value(device, "model", (uint8_t*)known_wifi_cards[i].model, (strlen(known_wifi_cards[i].model) + 1)); + // NOTE: I would set the subsystem id and subsystem vendor id here, + // however, those values seem to be ovverriden in the boot process. + // A better method would be injecting the DTGP dsdt method + // and then injecting the subsystem id there. + + stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length); + if(stringdata) + { + memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); + stringlength = string->length; + } + return; + } + } + } +} Index: branches/ErmaC/Enoch/i386/libsaio/spd.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/spd.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/spd.h (revision 2323) @@ -16,7 +16,7 @@ uint32_t vendor; uint32_t device; char *name; - void (*read_smb)(pci_dt_t *smbus_dev); + void (*read_smb)(pci_dt_t *smbus_dev); }; @@ -38,6 +38,7 @@ /* Byte numbers. */ #define SPD_NUM_MANUFACTURER_BYTES 0 /* Number of bytes used by module manufacturer */ #define SPD_TOTAL_SPD_MEMORY_SIZE 1 /* Total SPD memory size */ +// (Essentially) common to DDR & DDR2 #define SPD_MEMORY_TYPE 2 /* (Fundamental) memory type */ #define SPD_NUM_ROWS 3 /* Number of row address bits */ #define SPD_NUM_COLUMNS 4 /* Number of column address bits */ @@ -130,6 +131,9 @@ #define ERROR_SCHEME_NONE 0 #define ERROR_SCHEME_PARITY 1 #define ERROR_SCHEME_ECC 2 +#define DDR2_DATA_PARITY (1<<0) +#define DDR2_DATA_ECC (1<<1) +#define DDR2_ADDRESS_PARITY (1<<2) /* SPD_ACCEPTABLE_CAS_LATENCIES values. */ // TODO: Check values. @@ -141,6 +145,7 @@ #define SPD_CAS_LATENCY_3_5 0x20 #define SPD_CAS_LATENCY_4_0 0x40 +#define SPD_CAS_LATENCY_DDR2_2 (1 << 2) #define SPD_CAS_LATENCY_DDR2_3 (1 << 3) #define SPD_CAS_LATENCY_DDR2_4 (1 << 4) #define SPD_CAS_LATENCY_DDR2_5 (1 << 5) Index: branches/ErmaC/Enoch/i386/libsaio/networking.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/networking.h (revision 0) +++ branches/ErmaC/Enoch/i386/libsaio/networking.h (revision 2323) @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2009 Evan Lojewski. All rights reserved. + * + * Merge into file from module compcept by ErmaC and Marchrius + * + */ + +#ifndef __LIBSAIO_NETWORKING_H +#define __LIBSAIO_NETWORKING_H + +void setup_eth_builtin(pci_dt_t *eth_dev); +void setup_wifi_airport(pci_dt_t *wlan_dev); +char *get_ethernet_model(uint32_t vendor_id, uint32_t device_id); + +struct network_device; +typedef struct { + uint16_t vendor_id; + uint16_t device_id; + char* model; +} network_device; + +#endif /* !__LIBSAIO_NETWORKING_H */ Index: branches/ErmaC/Enoch/i386/libsaio/Makefile =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/Makefile (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/Makefile (revision 2323) @@ -37,7 +37,7 @@ smbios.o smbios_getters.o smbios_decode.o \ fake_efi.o ext2fs.o \ hpet.o dram_controllers.o spd.o usb.o pci_setup.o \ - device_inject.o nvidia_helper.o nvidia.o ati.o gma.o hda.o pci_root.o \ + device_inject.o networking.o nvidia_helper.o nvidia.o ati.o gma.o hda.o pci_root.o \ convert.o aml_generator.o console.o exfat.o base64-decode.o SAIO_OBJS := $(addprefix $(OBJROOT)/, $(SAIO_OBJS)) Index: branches/ErmaC/Enoch/i386/libsaio/bios.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bios.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/bios.h (revision 2323) @@ -32,63 +32,68 @@ #include "bootargs.h" typedef union { - unsigned int rx; - unsigned short rr; - struct { - unsigned char l; - unsigned char h; - } r; + unsigned int rx; + unsigned short rr; + struct { + unsigned char l; + unsigned char h; + } r; } machineRegister_t; typedef struct { - unsigned short cf :1; - unsigned short :1; - unsigned short pf :1; - unsigned short :1; - unsigned short af :1; - unsigned short :1; - unsigned short zf :1; - unsigned short sf :1; - unsigned short tf :1; - unsigned short _if :1; - unsigned short df :1; - unsigned short of :1; - unsigned short iopl:2; - unsigned short nt :1; + unsigned short cf :1; + unsigned short :1; + unsigned short pf :1; + unsigned short :1; + unsigned short af :1; + unsigned short :1; + unsigned short zf :1; + unsigned short sf :1; + unsigned short tf :1; + unsigned short _if :1; + unsigned short df :1; + unsigned short of :1; + unsigned short iopl:2; + unsigned short nt :1; } machineFlags_t; typedef struct { - unsigned int intno; - machineRegister_t eax; - machineRegister_t ebx; - machineRegister_t ecx; - machineRegister_t edx; - machineRegister_t edi; - machineRegister_t esi; - machineRegister_t ebp; - unsigned short cs; - unsigned short ds; - unsigned short es; - machineFlags_t flags; + unsigned int intno; + machineRegister_t eax; + machineRegister_t ebx; + machineRegister_t ecx; + machineRegister_t edx; + machineRegister_t edi; + machineRegister_t esi; + machineRegister_t ebp; + unsigned short cs; + unsigned short ds; + unsigned short es; + machineFlags_t flags; } biosBuf_t; -#define EBIOS_FIXED_DISK_ACCESS 0x01 -#define EBIOS_LOCKING_ACCESS 0x02 -#define EBIOS_ENHANCED_DRIVE_INFO 0x04 -#define BASE_HD_DRIVE 0x80 +/* + * Used in biosfn.c and disk.c + */ +#define EBIOS_FIXED_DISK_ACCESS 0x01 +#define EBIOS_LOCKING_ACCESS 0x02 +#define EBIOS_ENHANCED_DRIVE_INFO 0x04 + +#define BASE_HD_DRIVE 0x80 + #if 0 /* * ACPI defined memory range types. */ enum { - kMemoryRangeUsable = 1, // RAM usable by the OS. - kMemoryRangeReserved = 2, // Reserved. (Do not use) - kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed. - kMemoryRangeNVS = 4, // ACPI NVS memory. (Do not use) + kMemoryRangeUsable = 1, // RAM usable by the OS. + kMemoryRangeReserved = 2, // Reserved. (Do not use) + kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed. + kMemoryRangeNVS = 4, // ACPI NVS memory. (Do not use) - /* Undefined types should be treated as kMemoryRangeReserved */ + /* Undefined types should be treated as kMemoryRangeReserved */ }; #endif @@ -96,10 +101,10 @@ * Memory range descriptor. */ typedef struct MemoryRange { - unsigned long long base; // 64-bit base address - unsigned long long length; // 64-bit length in bytes - unsigned long type; // type of memory range - unsigned long reserved; + unsigned long long base; // 64-bit base address + unsigned long long length; // 64-bit length in bytes + unsigned long type; // type of memory range + unsigned long reserved; } MemoryRange; #endif /* !__LIBSAIO_BIOS_H */ Index: branches/ErmaC/Enoch/i386/libsaio/gma.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/gma.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/gma.c (revision 2323) @@ -354,7 +354,7 @@ { if (intel_gfx_chipsets[i].model == ((device_id << 16) | vendor_id)) { - snprintf(desc, sizeof(desc), "%s %s", INTEL_NAME, intel_gfx_chipsets[i].label_info); + snprintf(desc, sizeof(desc), "%s %s", INTEL_NAME, intel_gfx_chipsets[i].label_info); return desc; } } @@ -388,14 +388,12 @@ verbose("Class code: [%04x]\n%s [%04x:%04x] (rev %02x)\nSubsystem: [%04x:%04x] :: %s\n", gma_dev->class_id, model, gma_dev->vendor_id, gma_dev->device_id, gma_dev->revision_id, gma_dev->subsys_id.subsys.vendor_id, gma_dev->subsys_id.subsys.device_id, devicepath); - if (!string) - { + if (!string) { string = devprop_create_string(); } struct DevPropDevice *device = devprop_add_device(string, devicepath); - if (!device) - { + if (!device) { printf("Failed initializing dev-prop string dev-entry.\n"); pause(); return false; Index: branches/ErmaC/Enoch/i386/libsaio/pci_root.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/pci_root.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/pci_root.c (revision 2323) @@ -50,7 +50,7 @@ void *new_dsdt; const char *val; int len,fsize; - const char * dsdt_filename=NULL; + const char * dsdt_filename = NULL; extern int search_and_get_acpi_fd(const char *, const char **); if (rootuid < 10) return rootuid; @@ -75,11 +75,10 @@ goto out; } - // Try using the file specified with the DSDT option if (getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->chameleonConfig)) { - snprintf(dsdt_dirSpec, sizeof(dsdt_dirSpec), dsdt_filename); + snprintf(dsdt_dirSpec, sizeof(dsdt_dirSpec), dsdt_filename); } else { @@ -105,7 +104,7 @@ } if (read (fd, new_dsdt, fsize) != fsize) { verbose("[ERROR] read %s failed\n", dsdt_filename); - free(new_dsdt); + free(new_dsdt); close (fd); goto out; } Index: branches/ErmaC/Enoch/i386/libsaio/aml_generator.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/aml_generator.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/aml_generator.c (revision 2323) @@ -5,11 +5,12 @@ * Created by Mozodojo on 20/07/10. * Copyright 2010 mozo. All rights reserved. * + * additions and corrections by Slice and pcj, 2012. */ #include "aml_generator.h" -bool aml_add_to_parent(struct aml_chunk* parent, struct aml_chunk* node) +bool aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node) { if (parent && node) { @@ -24,8 +25,7 @@ verbose("aml_add_to_parent: Node doesn't support child nodes!\n"); return false; case AML_CHUNK_NAME: - if (parent->First) - { + if (parent->First) { verbose("aml_add_to_parent: Name node supports only one child node!\n"); return false; } @@ -34,107 +34,101 @@ default: break; } - - if (!parent->First) + + if (!parent->First) { parent->First = node; - - if (parent->Last) + } + if (parent->Last) { parent->Last->Next = node; - + } parent->Last = node; - + return true; } - + return false; } -struct aml_chunk* aml_create_node(struct aml_chunk* parent) +AML_CHUNK* aml_create_node(AML_CHUNK* parent) { - struct aml_chunk* node = (struct aml_chunk*)malloc(sizeof(struct aml_chunk)); - + AML_CHUNK* node = (AML_CHUNK*)malloc(sizeof(AML_CHUNK)); + aml_add_to_parent(parent, node); - + return node; } -void aml_destroy_node(struct aml_chunk* node) +void aml_destroy_node(AML_CHUNK* node) { // Delete child nodes - struct aml_chunk* child = node->First; - + AML_CHUNK* child = node->First; + while (child) { - struct aml_chunk* next = child->Next; - - if (child->Buffer) + AML_CHUNK* next = child->Next; + + if (child->Buffer) { free(child->Buffer); - + } free(child); child = next; } - + // Free node - if (node->Buffer) + if (node->Buffer) { free(node->Buffer); + } free(node); } -struct aml_chunk* aml_add_buffer(struct aml_chunk* parent, const char* buffer, unsigned int size) +AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, char* buffer, uint32_t size) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_NONE; - node->Length = size; + node->Length = (uint16_t)size; node->Buffer = malloc(node->Length); memcpy(node->Buffer, buffer, node->Length); } - + return node; } -struct aml_chunk* aml_add_byte(struct aml_chunk* parent, unsigned char value) +AML_CHUNK* aml_add_byte(AML_CHUNK* parent, uint8_t value) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_BYTE; - node->Length = 1; node->Buffer = malloc(node->Length); node->Buffer[0] = value; } - return node; } -struct aml_chunk* aml_add_word(struct aml_chunk* parent, unsigned int value) +AML_CHUNK* aml_add_word(AML_CHUNK* parent, uint16_t value) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_WORD; node->Length = 2; node->Buffer = malloc(node->Length); node->Buffer[0] = value & 0xff; node->Buffer[1] = value >> 8; } - return node; } -struct aml_chunk* aml_add_dword(struct aml_chunk* parent, unsigned long value) +AML_CHUNK* aml_add_dword(AML_CHUNK* parent, uint32_t value) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_DWORD; node->Length = 4; node->Buffer = malloc(node->Length); @@ -143,16 +137,14 @@ node->Buffer[2] = (value >> 16) & 0xff; node->Buffer[3] = (value >> 24) & 0xff; } - return node; } -struct aml_chunk* aml_add_qword(struct aml_chunk* parent, unsigned long long value) +AML_CHUNK* aml_add_qword(AML_CHUNK* parent, uint64_t value) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_QWORD; node->Length = 8; node->Buffer = malloc(node->Length); @@ -165,117 +157,126 @@ node->Buffer[6] = (value >> 48) & 0xff; node->Buffer[7] = (value >> 56) & 0xff; } - return node; } -unsigned int aml_fill_simple_name(char* buffer, const char* name) +uint32_t aml_fill_simple_name(char* buffer, char* name) { - if (strlen(name) < 4) - { + if (strlen(name) < 4) { verbose("aml_fill_simple_name: simple name %s has incorrect lengh! Must be 4.\n", name); return 0; } - memcpy(buffer, name, 4); return 4; } -unsigned int aml_fill_name(struct aml_chunk* node, const char* name) +uint32_t aml_fill_name(AML_CHUNK* node, char* name) { - if (!node) + int len, offset, count; + uint32_t root = 0; + + if (!node) { return 0; + } - int len = strlen(name), offset = 0, count = len / 4; + len = strlen(name); + offset = 0; + count = len >> 2; - if ((len % 4) > 1 || count == 0) - { + if ((len % 4) > 1 || count == 0) { verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16, etc...\n", name); return 0; } - - unsigned int root = 0; - if ((len % 4) == 1 && name[0] == '\\') + if (((len % 4) == 1) && (name[0] == '\\')) { root++; - - if (count == 1) - { - node->Length = 4 + root; - node->Buffer = malloc(node->Length); + } + + if (count == 1) { + node->Length = (uint16_t)(4 + root); + node->Buffer = malloc(node->Length+4); memcpy(node->Buffer, name, 4 + root); - return node->Length; + offset += 4 + root; + return (uint32_t)offset; } - - if (count == 2) - { + + if (count == 2) { node->Length = 2 + 8; - node->Buffer = malloc(node->Length); + node->Buffer = malloc(node->Length+4); node->Buffer[offset++] = 0x5c; // Root Char node->Buffer[offset++] = 0x2e; // Double name memcpy(node->Buffer+offset, name + root, 8); - return node->Length; + offset += 8; + return (uint32_t)offset; } - - node->Length = 3 + count*4; - node->Buffer = malloc(node->Length); + + node->Length = (uint16_t)(3 + (count << 2)); + node->Buffer = malloc(node->Length+4); node->Buffer[offset++] = 0x5c; // Root Char node->Buffer[offset++] = 0x2f; // Multi name - node->Buffer[offset++] = count; // Names count + node->Buffer[offset++] = (char)count; // Names count memcpy(node->Buffer+offset, name + root, count*4); - - return node->Length; + offset += count*4; + return (uint32_t)offset; } -struct aml_chunk* aml_add_scope(struct aml_chunk* parent, const char* name) +AML_CHUNK* aml_add_scope(AML_CHUNK* parent, char* name) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_SCOPE; aml_fill_name(node, name); } - return node; } -struct aml_chunk* aml_add_name(struct aml_chunk* parent, const char* name) +AML_CHUNK* aml_add_name(AML_CHUNK* parent, char* name) { - struct aml_chunk* node = aml_create_node(parent); - - if (node) - { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { node->Type = AML_CHUNK_NAME; aml_fill_name(node, name); } + return node; +} +AML_CHUNK* aml_add_method(AML_CHUNK* parent, char* name, uint8_t args) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + unsigned int offset = aml_fill_name(node, name); + node->Type = AML_CHUNK_METHOD; + + node->Length++; + node->Buffer[offset] = args; + + } return node; } -struct aml_chunk* aml_add_package(struct aml_chunk* parent) +AML_CHUNK* aml_add_package(AML_CHUNK* parent) { - struct aml_chunk* node = aml_create_node(parent); + AML_CHUNK* node = aml_create_node(parent); - if (node) - { + if (node) { node->Type = AML_CHUNK_PACKAGE; node->Length = 1; node->Buffer = malloc(node->Length); } - return node; } -struct aml_chunk* aml_add_alias(struct aml_chunk* parent, const char* name1, const char* name2) +AML_CHUNK* aml_add_alias(AML_CHUNK* parent, char* name1, char* name2) { - struct aml_chunk* node = aml_create_node(parent); + AML_CHUNK* node = aml_create_node(parent); - if (node) - { + if (node) { node->Type = AML_CHUNK_ALIAS; node->Length = 8; @@ -287,46 +288,177 @@ return node; } -unsigned char aml_get_size_length(unsigned int size) +AML_CHUNK* aml_add_return_name(AML_CHUNK* parent, char* name) { + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + node->Type = AML_CHUNK_RETURN; + aml_fill_name(node, name); + } + + return node; +} + +AML_CHUNK* aml_add_return_byte(AML_CHUNK* parent, uint8_t value) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + node->Type = AML_CHUNK_RETURN; + aml_add_byte(node, value); + } + + return node; +} + +AML_CHUNK* aml_add_device(AML_CHUNK* parent, char* name) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + node->Type = AML_CHUNK_DEVICE; + aml_fill_name(node, name); + } + + return node; +} + +AML_CHUNK* aml_add_local0(AML_CHUNK* parent) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + node->Type = AML_CHUNK_LOCAL0; + node->Length = 1; + } + + return node; +} + +AML_CHUNK* aml_add_store(AML_CHUNK* parent) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + node->Type = AML_STORE_OP; + node->Length = 1; + } + + return node; +} + +AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, char* data, uint32_t size) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + int offset = 0; + node->Type = AML_CHUNK_BUFFER; + node->Length = (uint8_t)(size + 2); + node->Buffer = malloc (node->Length); + node->Buffer[offset++] = AML_CHUNK_BYTE; //0x0A + node->Buffer[offset++] = (char)size; + memcpy(node->Buffer+offset,data, node->Length); + } + + return node; +} + +AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, char* StringBuf) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + unsigned int offset = 0; + unsigned int len = strlen(StringBuf)+1; + node->Type = AML_CHUNK_BUFFER; + node->Length = (uint8_t)(len + 3); + node->Buffer = malloc (node->Length); + node->Buffer[offset++] = AML_CHUNK_BYTE; + node->Buffer[offset++] = (char)len; + memcpy(node->Buffer+offset, StringBuf, len); + node->Buffer[offset+len] = '\0'; + } + + return node; +} + +AML_CHUNK* aml_add_string(AML_CHUNK* parent, char* StringBuf) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + int len = strlen(StringBuf); + node->Type = AML_CHUNK_STRING; + node->Length = (uint8_t)(len + 1); + node->Buffer = malloc (len); + memcpy(node->Buffer, StringBuf, len); + node->Buffer[len] = '\0'; + } + + return node; +} + +AML_CHUNK* aml_add_return(AML_CHUNK* parent) +{ + AML_CHUNK* node = aml_create_node(parent); + + if (node) { + node->Type = AML_CHUNK_RETURN; + //aml_add_byte(node, value); + } + + return node; +} + +uint8_t aml_get_size_length(uint32_t size) +{ if (size + 1 <= 0x3f) return 1; - else if (size + 2 <= 0x3fff) + else if (size + 2 <= 0xfff) /* Encode in 4 bits and 1 byte */ return 2; - else if (size + 3 <= 0x3fffff) + else if (size + 3 <= 0xfffff) /* Encode in 4 bits and 2 bytes */ return 3; - - return 4; + + return 4; /* Encode 0xfffffff in 4 bits and 2 bytes */ } -unsigned int aml_calculate_size(struct aml_chunk* node) +uint32_t aml_calculate_size(AML_CHUNK* node) { - if (node) - { + if (node) { + // Calculate child nodes size + AML_CHUNK* child = node->First; + uint8_t child_count = 0; + node->Size = 0; - - // Calculate child nodes size - struct aml_chunk* child = node->First; - unsigned char child_count = 0; - - while (child) - { + while (child) { child_count++; - node->Size += aml_calculate_size(child); + node->Size += (uint16_t)aml_calculate_size(child); child = child->Next; } - - switch (node->Type) - { + + switch (node->Type) { case AML_CHUNK_NONE: + case AML_STORE_OP: + case AML_CHUNK_LOCAL0: node->Size += node->Length; break; + + case AML_CHUNK_METHOD: case AML_CHUNK_SCOPE: + case AML_CHUNK_BUFFER: node->Size += 1 + node->Length; node->Size += aml_get_size_length(node->Size); break; + + case AML_CHUNK_DEVICE: + node->Size += 2 + node->Length; + node->Size += aml_get_size_length(node->Size); + break; + case AML_CHUNK_PACKAGE: node->Buffer[0] = child_count; node->Size += 1 + node->Length; @@ -334,15 +466,11 @@ break; case AML_CHUNK_BYTE: - if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) - { + if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) { node->Size += node->Length; - } - else - { + } else { node->Size += 1 + node->Length; } - break; case AML_CHUNK_WORD: @@ -350,24 +478,24 @@ case AML_CHUNK_QWORD: case AML_CHUNK_ALIAS: case AML_CHUNK_NAME: + case AML_CHUNK_RETURN: + case AML_CHUNK_STRING: node->Size += 1 + node->Length; break; } - return node->Size; } - return 0; } -unsigned int aml_write_byte(unsigned char value, char* buffer, unsigned int offset) +uint32_t aml_write_byte(uint8_t value, char* buffer, uint32_t offset) { buffer[offset++] = value; return offset; } -unsigned int aml_write_word(unsigned int value, char* buffer, unsigned int offset) +uint32_t aml_write_word(uint16_t value, char* buffer, uint32_t offset) { buffer[offset++] = value & 0xff; buffer[offset++] = value >> 8; @@ -375,7 +503,7 @@ return offset; } -unsigned int aml_write_dword(unsigned long value, char* buffer, unsigned int offset) +uint32_t aml_write_dword(uint32_t value, char* buffer, uint32_t offset) { buffer[offset++] = value & 0xff; buffer[offset++] = (value >> 8) & 0xff; @@ -385,7 +513,7 @@ return offset; } -unsigned int aml_write_qword(unsigned long long value, char* buffer, unsigned int offset) +uint32_t aml_write_qword(uint64_t value, char* buffer, uint32_t offset) { buffer[offset++] = value & 0xff; buffer[offset++] = (value >> 8) & 0xff; @@ -399,37 +527,29 @@ return offset; } -unsigned int aml_write_buffer(const char* value, unsigned int size, char* buffer, unsigned int offset) +uint32_t aml_write_buffer(const char* value, uint32_t size, char* buffer, uint32_t offset) { - if (size > 0) - { + if (size > 0) { memcpy(buffer + offset, value, size); } return offset + size; } -unsigned int aml_write_size(unsigned int size, char* buffer, unsigned int offset) +uint32_t aml_write_size(uint32_t size, char* buffer, uint32_t offset) { - if (size <= 0x3f) - { - buffer[offset++] = size; - } - else if (size <= 0x3fff) - { - buffer[offset++] = 0x40 | (size & 0xf); - buffer[offset++] = (size >> 4) & 0xff; - } - else if (size <= 0x3fffff) - { - buffer[offset++] = 0x80 | (size & 0xf); - buffer[offset++] = (size >> 4) & 0xff; + if (size <= 0x3f) { /* simple 1 byte length in 6 bits */ + buffer[offset++] = (char)size; + } else if (size <= 0xfff) { + buffer[offset++] = 0x40 | (size & 0xf); /* 0x40 is type, 0x0X is first nibble of length */ + buffer[offset++] = (size >> 4) & 0xff; /* +1 bytes for rest length */ + } else if (size <= 0xfffff) { + buffer[offset++] = 0x80 | (size & 0xf); /* 0x80 is type, 0x0X is first nibble of length */ + buffer[offset++] = (size >> 4) & 0xff; /* +2 bytes for rest length */ buffer[offset++] = (size >> 12) & 0xff; - } - else - { - buffer[offset++] = 0xc0 | (size & 0xf); - buffer[offset++] = (size >> 4) & 0xff; + } else { + buffer[offset++] = 0xc0 | (size & 0xf); /* 0xC0 is type, 0x0X is first nibble of length */ + buffer[offset++] = (size >> 4) & 0xff; /* +3 bytes for rest length */ buffer[offset++] = (size >> 12) & 0xff; buffer[offset++] = (size >> 20) & 0xff; } @@ -437,32 +557,42 @@ return offset; } -unsigned int aml_write_node(struct aml_chunk* node, char* buffer, unsigned int offset) +uint32_t aml_write_node(AML_CHUNK* node, char* buffer, uint32_t offset) { - if (node && buffer) - { - unsigned int old = offset; + if (node && buffer) { + uint32_t old = offset; + AML_CHUNK* child = node->First; - switch (node->Type) - { + switch (node->Type) { case AML_CHUNK_NONE: offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; + case AML_CHUNK_LOCAL0: + case AML_STORE_OP: + offset = aml_write_byte(node->Type, buffer, offset); + break; + + case AML_CHUNK_DEVICE: + offset = aml_write_byte(AML_CHUNK_OP, buffer, offset); + offset = aml_write_byte(node->Type, buffer, offset); + offset = aml_write_size(node->Size-3, buffer, offset); + offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); + break; + case AML_CHUNK_SCOPE: + case AML_CHUNK_METHOD: case AML_CHUNK_PACKAGE: + case AML_CHUNK_BUFFER: offset = aml_write_byte(node->Type, buffer, offset); offset = aml_write_size(node->Size-1, buffer, offset); offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; case AML_CHUNK_BYTE: - if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) - { + if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) { offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); - } - else - { + } else { offset = aml_write_byte(node->Type, buffer, offset); offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); } @@ -473,6 +603,8 @@ case AML_CHUNK_QWORD: case AML_CHUNK_ALIAS: case AML_CHUNK_NAME: + case AML_CHUNK_RETURN: + case AML_CHUNK_STRING: offset = aml_write_byte(node->Type, buffer, offset); offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; @@ -481,18 +613,65 @@ break; } - struct aml_chunk* child = node->First; + while (child) { + offset = aml_write_node(child, buffer, offset); - while (child) - { - offset = aml_write_node(child, buffer, offset); - child = child->Next; } - - if (offset - old != node->Size) - verbose("Node size incorrect: 0x%x\n", node->Type); + + if (offset - old != node->Size) { + verbose("Node size incorrect: type=0x%x size=%x offset=%x\n", + node->Type, node->Size, (offset - old)); + } } - + return offset; } + +//the procedure can find array char sizeof N inside part of large array "dsdt" size of len +int32_t FindBin (uint8_t *dsdt, uint32_t len, uint8_t *bin, unsigned int N) +{ + uint32_t i, j; + bool eq; + + for (i=0; ilength; return devprop_generate_string(string); } @@ -56,39 +54,38 @@ /* 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); } } } -struct DevPropString *devprop_create_string(void) +DevPropString *devprop_create_string(void) { string = (struct DevPropString*)malloc(sizeof(struct DevPropString)); - if (string == NULL) - return NULL; + + if(string == NULL) { + return NULL; + } memset(string, 0, sizeof(struct DevPropString)); string->length = 12; string->WHAT2 = 0x01000000; return string; } - -struct DevPropDevice *devprop_add_device(struct DevPropString *string, char *path) + +DevPropDevice *devprop_add_device(DevPropString *string, char *path) { - struct DevPropDevice *device = NULL; - static const char pciroot_string[] = "PciRoot(0x"; - static 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) { printf("ERROR null device path\n"); @@ -99,13 +96,12 @@ printf("ERROR parsing device path\n"); return NULL; } + if (!(device = malloc(sizeof(DevPropDevice)))) { + printf("ERROR malloc failed\n"); + return NULL; + } - if (!(device = malloc(sizeof(struct DevPropDevice)))) { - printf("ERROR malloc failed\n"); - return NULL; - } - - memset(device, 0, sizeof(struct DevPropDevice)); + memset(device, 0, sizeof(DevPropDevice)); device->acpi_dev_path._UID = getPciRootUID(); int numpaths = 0; @@ -117,12 +113,11 @@ 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; @@ -132,12 +127,11 @@ 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; @@ -148,10 +142,10 @@ } } - if (!numpaths) { - free(device); - return NULL; - } + if(!numpaths) { + free(device); + return NULL; + } device->numentries = 0x00; @@ -163,7 +157,7 @@ device->num_pci_devpaths = numpaths; device->length = 24 + (6*numpaths); - int i; + int i; for(i = 0; i < numpaths; i++) { @@ -178,27 +172,28 @@ device->string = string; device->data = NULL; - - if (!string->entries) - if (!(string->entries = (struct DevPropDevice**) malloc(sizeof(device) * DEV_PROP_DEVICE_MAX_ENTRIES))) { - free(device); - return NULL; - } - - /* FIXME: probably needs bounds checking, as well as error handling in event of malloc failure */ + + if(!string->entries) { + if (!(string->entries = (struct DevPropDevice**) malloc(sizeof(device) * DEV_PROP_DEVICE_MAX_ENTRIES))) { + free(device); + return NULL; + } + } + + /* FIXME: probably needs bounds checking, as well as error handling in event of malloc failure */ string->length += device->length; - string->entries[string->numentries++] = (struct DevPropDevice*)malloc(sizeof(device)); + string->entries[string->numentries++] = (DevPropDevice*)malloc(sizeof(device)); string->entries[string->numentries-1] = device; - + return device; } -int devprop_add_value(struct DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len) +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); { @@ -222,13 +217,13 @@ off += 2; l = len; uint32_t *datalength = (uint32_t*)&data[off]; - *datalength = l + 4; + *datalength = (uint32_t)(l + 4); off += 4; for(i = 0 ; i < l ; i++, off++) { data[off] = *vl++; } - } + } uint32_t offset = device->length - (24 + (6 * device->num_pci_devpaths)); @@ -266,7 +261,7 @@ return 1; } -char *devprop_generate_string(struct DevPropString *string) +char *devprop_generate_string(DevPropString *string) { char *buffer = (char*)malloc(string->length * 2); char *ptr = buffer; @@ -294,7 +289,7 @@ dp_swap32(string->entries[i]->acpi_dev_path._UID)); buffer += 24; - for(x=0;x < string->entries[i]->num_pci_devpaths; x++) + for(x = 0;x < string->entries[i]->num_pci_devpaths; x++) { sprintf(buffer, "%02x%02x%04x%02x%02x", string->entries[i]->pci_dev_path[x].type, string->entries[i]->pci_dev_path[x].subtype, @@ -310,7 +305,7 @@ buffer += 8; uint8_t *dataptr = string->entries[i]->data; - for(x = 0; x < (string->entries[i]->length) - (24 + (6 * string->entries[i]->num_pci_devpaths)) ; x++) + for(x = 0; (uint32_t)x < (string->entries[i]->length) - (24 + (6 * string->entries[i]->num_pci_devpaths)) ; x++) { sprintf(buffer, "%02x", *dataptr++); buffer += 2; @@ -320,7 +315,7 @@ return ptr; } -void devprop_free_string(struct DevPropString *string) +void devprop_free_string(DevPropString *string) { if(!string) @@ -387,40 +382,3 @@ /* a fine place for this code */ -int devprop_add_network_template(struct DevPropDevice *device, uint16_t vendor_id) -{ - if(!device) - return 0; - uint8_t builtin = 0x0; - if((vendor_id != 0x168c) && (builtin_set == 0)) - { - builtin_set = 1; - builtin = 0x01; - } - if(!devprop_add_value(device, "built-in", (uint8_t*)&builtin, 1)) - return 0; - devices_number++; - return 1; -} - -void set_eth_builtin(pci_dt_t *eth_dev) -{ - char *devicepath = get_pci_dev_path(eth_dev); - struct DevPropDevice *device = NULL; - - verbose("LAN Controller [%04x:%04x] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath); - - if(!string) - string = devprop_create_string(); - - device = devprop_add_device(string, devicepath); - if(device) { - verbose("Setting up lan keys\n"); - devprop_add_network_template(device, eth_dev->vendor_id); - stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length); - if(stringdata) { - memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); - stringlength = string->length; - } - } -} Index: branches/ErmaC/Enoch/i386/libsaio/hda.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/hda.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/hda.c (revision 2323) @@ -478,40 +478,50 @@ /* get HDA device name */ static char *get_hda_controller_name(uint16_t controller_device_id, uint16_t controller_vendor_id) { - int i; static char desc[128]; - for (i = 0; i < HDAC_DEVICES_LEN; i++) - { - if (know_hda_controller[i].model == ((controller_device_id << 16) | controller_vendor_id)) - { - if(controller_vendor_id == INTEL_VENDORID){ - sprintf(desc, "Intel %s Hight Definition Audio Controller", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } else if (controller_vendor_id == NVIDIA_VENDORID) { - sprintf(desc, "nVidia %s HDA Controller (HDMi)", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } else if (controller_vendor_id == ATI_VENDORID) { - sprintf(desc, "ATI %s HDA Controller (HDMi)", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } else if (controller_vendor_id == RDC_VENDORID) { - sprintf(desc, "RDC %s Hight Definition Audio Controller", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } else if (controller_vendor_id == VIA_VENDORID) { - sprintf(desc, "VIA %s HDA Controller", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } else if (controller_vendor_id == SIS_VENDORID) { - sprintf(desc, "SiS %s HDA Controller", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } else if (controller_vendor_id == ULI_VENDORID) { - sprintf(desc, "ULI %s HDA Controller", know_hda_controller[i].desc); - desc[sizeof(desc) - 1] = '\0'; - } + const char* name_format = "Unknown HD Audio device %s"; + uint32_t controller_model = ((controller_device_id << 16) | controller_vendor_id); + int i; + + /* Get format for vendor ID */ + switch (controller_vendor_id) { + case ATI_VENDORID: + name_format = "ATI %s HDA Controller (HDMi)"; break; + + case INTEL_VENDORID: + name_format = "Intel %s High Definition Audio Controller"; break; + + case NVIDIA_VENDORID: + name_format = "nVidia %s HDA Controller (HDMi)"; break; + + case RDC_VENDORID: + name_format = "RDC %s High Definition Audio Controller"; break; + + case SIS_VENDORID: + name_format = "SiS %s HDA Controller"; break; + + case ULI_VENDORID: + name_format = "ULI %s HDA Controller"; break; + + case VIA_VENDORID: + name_format = "VIA %s HDA Controller"; break; + + default: + break; + } + + for (i = 0; i < HDAC_DEVICES_LEN; i++) { + if (know_hda_controller[i].model == controller_model) { + snprintf(desc, sizeof(desc), name_format, know_hda_controller[i].desc); return desc; } } - sprintf(desc, "Unknown HD Audio device"); - desc[sizeof(desc) - 1] = '\0'; + + /* Not in table */ + snprintf(desc, sizeof(desc), + "Unknown HD Audio device, vendor %04x, model %04x", + controller_vendor_id, controller_device_id); return desc; } Index: branches/ErmaC/Enoch/i386/libsaio/device_inject.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/device_inject.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/device_inject.h (revision 2323) @@ -22,6 +22,8 @@ uint16_t length; // = 0x0c uint32_t _HID; // = 0xD041030A ? uint32_t _UID; // = 0x00000000 PCI ROOT + uint32_t _CID; // = Optional variable length + }; struct PCIDevPath { @@ -43,7 +45,7 @@ uint16_t numentries; uint16_t WHAT2; // 0x0000 ? struct ACPIDevPath acpi_dev_path; // = 0x02010c00 0xd041030a - struct PCIDevPath pci_dev_path[MAX_PCI_DEV_PATHS]; // = 0x01010600 func dev + struct PCIDevPath pci_dev_path[MAX_PCI_DEV_PATHS]; // = 0x01010600 func dev struct DevicePathEnd path_end; // = 0x7fff0400 uint8_t *data; @@ -53,6 +55,8 @@ // ------------------------ }; +typedef struct DevPropDevice DevPropDevice; + struct DevPropString { uint32_t length; uint32_t WHAT2; // 0x01000000 ? @@ -61,16 +65,19 @@ struct DevPropDevice **entries; }; -extern struct DevPropString *string; +typedef struct DevPropString DevPropString; + +extern DevPropString *string; extern uint8_t *stringdata; extern uint32_t stringlength; -struct DevPropString *devprop_create_string(void); -struct DevPropDevice *devprop_add_device(struct DevPropString *string, char *path); + +DevPropString *devprop_create_string(void); +DevPropDevice *devprop_add_device(DevPropString *string, char *path); char *efi_inject_get_devprop_string(uint32_t *len); -int devprop_add_value(struct DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len); -char *devprop_generate_string(struct DevPropString *string); -void devprop_free_string(struct DevPropString *string); +int devprop_add_value(DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len); +char *devprop_generate_string(DevPropString *string); +void devprop_free_string(DevPropString *string); -int devprop_add_network_template(struct DevPropDevice *device, uint16_t vendor_id); +int devprop_add_network_template(DevPropDevice *device, uint16_t vendor_id); int hex2bin(const char *hex, uint8_t *bin, int len); #endif /* !__LIBSAIO_DEVICE_INJECT_H */ Index: branches/ErmaC/Enoch/i386/libsaio/hda.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/hda.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/hda.h (revision 2323) @@ -675,4 +675,240 @@ #define HDA_CODEC_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) #define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) +/**************************************************************************** + * HDA Controller Register Set + ****************************************************************************/ +#define HDAC_GCAP 0x00 /* 2 - Global Capabilities*/ +#define HDAC_VMIN 0x02 /* 1 - Minor Version */ +#define HDAC_VMAJ 0x03 /* 1 - Major Version */ +#define HDAC_OUTPAY 0x04 /* 2 - Output Payload Capability */ +#define HDAC_INPAY 0x06 /* 2 - Input Payload Capability */ +#define HDAC_GCTL 0x08 /* 4 - Global Control */ +#define HDAC_WAKEEN 0x0c /* 2 - Wake Enable */ +#define HDAC_STATESTS 0x0e /* 2 - State Change Status */ +#define HDAC_GSTS 0x10 /* 2 - Global Status */ +#define HDAC_OUTSTRMPAY 0x18 /* 2 - Output Stream Payload Capability */ +#define HDAC_INSTRMPAY 0x1a /* 2 - Input Stream Payload Capability */ +#define HDAC_INTCTL 0x20 /* 4 - Interrupt Control */ +#define HDAC_INTSTS 0x24 /* 4 - Interrupt Status */ +#define HDAC_WALCLK 0x30 /* 4 - Wall Clock Counter */ +#define HDAC_SSYNC 0x38 /* 4 - Stream Synchronization */ +#define HDAC_CORBLBASE 0x40 /* 4 - CORB Lower Base Address */ +#define HDAC_CORBUBASE 0x44 /* 4 - CORB Upper Base Address */ +#define HDAC_CORBWP 0x48 /* 2 - CORB Write Pointer */ +#define HDAC_CORBRP 0x4a /* 2 - CORB Read Pointer */ +#define HDAC_CORBCTL 0x4c /* 1 - CORB Control */ +#define HDAC_CORBSTS 0x4d /* 1 - CORB Status */ +#define HDAC_CORBSIZE 0x4e /* 1 - CORB Size */ +#define HDAC_RIRBLBASE 0x50 /* 4 - RIRB Lower Base Address */ +#define HDAC_RIRBUBASE 0x54 /* 4 - RIRB Upper Base Address */ +#define HDAC_RIRBWP 0x58 /* 2 - RIRB Write Pointer */ +#define HDAC_RINTCNT 0x5a /* 2 - Response Interrupt Count */ +#define HDAC_RIRBCTL 0x5c /* 1 - RIRB Control */ +#define HDAC_RIRBSTS 0x5d /* 1 - RIRB Status */ +#define HDAC_RIRBSIZE 0x5e /* 1 - RIRB Size */ +#define HDAC_ICOI 0x60 /* 4 - Immediate Command Output Interface */ +#define HDAC_ICII 0x64 /* 4 - Immediate Command Input Interface */ +#define HDAC_ICIS 0x68 /* 2 - Immediate Command Status */ +#define HDAC_DPIBLBASE 0x70 /* 4 - DMA Position Buffer Lower Base */ +#define HDAC_DPIBUBASE 0x74 /* 4 - DMA Position Buffer Upper Base */ +#define HDAC_SDCTL0 0x80 /* 3 - Stream Descriptor Control */ +#define HDAC_SDCTL1 0x81 /* 3 - Stream Descriptor Control */ +#define HDAC_SDCTL2 0x82 /* 3 - Stream Descriptor Control */ +#define HDAC_SDSTS 0x83 /* 1 - Stream Descriptor Status */ +#define HDAC_SDLPIB 0x84 /* 4 - Link Position in Buffer */ +#define HDAC_SDCBL 0x88 /* 4 - Cyclic Buffer Length */ +#define HDAC_SDLVI 0x8C /* 2 - Last Valid Index */ +#define HDAC_SDFIFOS 0x90 /* 2 - FIFOS */ +#define HDAC_SDFMT 0x92 /* 2 - fmt */ +#define HDAC_SDBDPL 0x98 /* 4 - Buffer Descriptor Pointer Lower Base */ +#define HDAC_SDBDPU 0x9C /* 4 - Buffer Descriptor Pointer Upper Base */ + +#define _HDAC_ISDOFFSET(n, iss, oss) (0x80 + ((n) * 0x20)) +#define _HDAC_ISDCTL(n, iss, oss) (0x00 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDSTS(n, iss, oss) (0x03 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDPICB(n, iss, oss) (0x04 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDCBL(n, iss, oss) (0x08 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDLVI(n, iss, oss) (0x0c + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDFIFOD(n, iss, oss) (0x10 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDFMT(n, iss, oss) (0x12 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDBDPL(n, iss, oss) (0x18 + _HDAC_ISDOFFSET(n, iss, oss)) +#define _HDAC_ISDBDPU(n, iss, oss) (0x1c + _HDAC_ISDOFFSET(n, iss, oss)) + +#define _HDAC_OSDOFFSET(n, iss, oss) (0x80 + ((iss) * 0x20) + ((n) * 0x20)) +#define _HDAC_OSDCTL(n, iss, oss) (0x00 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDSTS(n, iss, oss) (0x03 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDPICB(n, iss, oss) (0x04 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDCBL(n, iss, oss) (0x08 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDLVI(n, iss, oss) (0x0c + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDFIFOD(n, iss, oss) (0x10 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDFMT(n, iss, oss) (0x12 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDBDPL(n, iss, oss) (0x18 + _HDAC_OSDOFFSET(n, iss, oss)) +#define _HDAC_OSDBDPU(n, iss, oss) (0x1c + _HDAC_OSDOFFSET(n, iss, oss)) + +#define _HDAC_BSDOFFSET(n, iss, oss) (0x80 + ((iss) * 0x20) + ((oss) * 0x20) + ((n) * 0x20)) +#define _HDAC_BSDCTL(n, iss, oss) (0x00 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDSTS(n, iss, oss) (0x03 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDPICB(n, iss, oss) (0x04 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDCBL(n, iss, oss) (0x08 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDLVI(n, iss, oss) (0x0c + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDFIFOD(n, iss, oss) (0x10 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDFMT(n, iss, oss) (0x12 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDBDPL(n, iss, oss) (0x18 + _HDAC_BSDOFFSET(n, iss, oss)) +#define _HDAC_BSDBDBU(n, iss, oss) (0x1c + _HDAC_BSDOFFSET(n, iss, oss)) + +/**************************************************************************** + * HDA Controller Register Fields + ****************************************************************************/ + +/* GCAP - Global Capabilities */ +#define HDAC_GCAP_64OK 0x0001 +#define HDAC_GCAP_NSDO_MASK 0x0006 +#define HDAC_GCAP_NSDO_SHIFT 1 +#define HDAC_GCAP_BSS_MASK 0x00f8 +#define HDAC_GCAP_BSS_SHIFT 3 +#define HDAC_GCAP_ISS_MASK 0x0f00 +#define HDAC_GCAP_ISS_SHIFT 8 +#define HDAC_GCAP_OSS_MASK 0xf000 +#define HDAC_GCAP_OSS_SHIFT 12 + +#define HDAC_GCAP_NSDO_1SDO 0x00 +#define HDAC_GCAP_NSDO_2SDO 0x02 +#define HDAC_GCAP_NSDO_4SDO 0x04 + +#define HDAC_GCAP_BSS(gcap) \ +(((gcap) & HDAC_GCAP_BSS_MASK) >> HDAC_GCAP_BSS_SHIFT) +#define HDAC_GCAP_ISS(gcap) \ +(((gcap) & HDAC_GCAP_ISS_MASK) >> HDAC_GCAP_ISS_SHIFT) +#define HDAC_GCAP_OSS(gcap) \ +(((gcap) & HDAC_GCAP_OSS_MASK) >> HDAC_GCAP_OSS_SHIFT) +#define HDAC_GCAP_NSDO(gcap) \ +(((gcap) & HDAC_GCAP_NSDO_MASK) >> HDAC_GCAP_NSDO_SHIFT) + +/* GCTL - Global Control */ +#define HDAC_GCTL_CRST 0x00000001 +#define HDAC_GCTL_FCNTRL 0x00000002 +#define HDAC_GCTL_UNSOL 0x00000100 + +/* WAKEEN - Wake Enable */ +#define HDAC_WAKEEN_SDIWEN_MASK 0x7fff +#define HDAC_WAKEEN_SDIWEN_SHIFT 0 + +/* STATESTS - State Change Status */ +#define HDAC_STATESTS_SDIWAKE_MASK 0x7fff +#define HDAC_STATESTS_SDIWAKE_SHIFT 0 + +#define HDAC_STATESTS_SDIWAKE(statests, n) \ +(((((statests) & HDAC_STATESTS_SDIWAKE_MASK) >> \ +HDAC_STATESTS_SDIWAKE_SHIFT) >> (n)) & 0x0001) + +/* GSTS - Global Status */ +#define HDAC_GSTS_FSTS 0x0002 + +/* INTCTL - Interrut Control */ +#define HDAC_INTCTL_SIE_MASK 0x3fffffff +#define HDAC_INTCTL_SIE_SHIFT 0 +#define HDAC_INTCTL_CIE 0x40000000 +#define HDAC_INTCTL_GIE 0x80000000 + +/* INTSTS - Interrupt Status */ +#define HDAC_INTSTS_SIS_MASK 0x3fffffff +#define HDAC_INTSTS_SIS_SHIFT 0 +#define HDAC_INTSTS_CIS 0x40000000 +#define HDAC_INTSTS_GIS 0x80000000 + +/* SSYNC - Stream Synchronization */ +#define HDAC_SSYNC_SSYNC_MASK 0x3fffffff +#define HDAC_SSYNC_SSYNC_SHIFT 0 + +/* CORBWP - CORB Write Pointer */ +#define HDAC_CORBWP_CORBWP_MASK 0x00ff +#define HDAC_CORBWP_CORBWP_SHIFT 0 + +/* CORBRP - CORB Read Pointer */ +#define HDAC_CORBRP_CORBRP_MASK 0x00ff +#define HDAC_CORBRP_CORBRP_SHIFT 0 +#define HDAC_CORBRP_CORBRPRST 0x8000 + +/* CORBCTL - CORB Control */ +#define HDAC_CORBCTL_CMEIE 0x01 +#define HDAC_CORBCTL_CORBRUN 0x02 + +/* CORBSTS - CORB Status */ +#define HDAC_CORBSTS_CMEI 0x01 + +/* CORBSIZE - CORB Size */ +#define HDAC_CORBSIZE_CORBSIZE_MASK 0x03 +#define HDAC_CORBSIZE_CORBSIZE_SHIFT 0 +#define HDAC_CORBSIZE_CORBSZCAP_MASK 0xf0 +#define HDAC_CORBSIZE_CORBSZCAP_SHIFT 4 + +#define HDAC_CORBSIZE_CORBSIZE_2 0x00 +#define HDAC_CORBSIZE_CORBSIZE_16 0x01 +#define HDAC_CORBSIZE_CORBSIZE_256 0x02 + +#define HDAC_CORBSIZE_CORBSZCAP_2 0x10 +#define HDAC_CORBSIZE_CORBSZCAP_16 0x20 +#define HDAC_CORBSIZE_CORBSZCAP_256 0x40 + +#define HDAC_CORBSIZE_CORBSIZE(corbsize) \ +(((corbsize) & HDAC_CORBSIZE_CORBSIZE_MASK) >> HDAC_CORBSIZE_CORBSIZE_SHIFT) + +/* RIRBWP - RIRB Write Pointer */ +#define HDAC_RIRBWP_RIRBWP_MASK 0x00ff +#define HDAC_RIRBWP_RIRBWP_SHIFT 0 +#define HDAC_RIRBWP_RIRBWPRST 0x8000 + +/* RINTCTN - Response Interrupt Count */ +#define HDAC_RINTCNT_MASK 0x00ff +#define HDAC_RINTCNT_SHIFT 0 + +/* RIRBCTL - RIRB Control */ +#define HDAC_RIRBCTL_RINTCTL 0x01 +#define HDAC_RIRBCTL_RIRBDMAEN 0x02 +#define HDAC_RIRBCTL_RIRBOIC 0x04 + +/* RIRBSTS - RIRB Status */ +#define HDAC_RIRBSTS_RINTFL 0x01 +#define HDAC_RIRBSTS_RIRBOIS 0x04 + +/* RIRBSIZE - RIRB Size */ +#define HDAC_RIRBSIZE_RIRBSIZE_MASK 0x03 +#define HDAC_RIRBSIZE_RIRBSIZE_SHIFT 0 +#define HDAC_RIRBSIZE_RIRBSZCAP_MASK 0xf0 +#define HDAC_RIRBSIZE_RIRBSZCAP_SHIFT 4 + +#define HDAC_RIRBSIZE_RIRBSIZE_2 0x00 +#define HDAC_RIRBSIZE_RIRBSIZE_16 0x01 +#define HDAC_RIRBSIZE_RIRBSIZE_256 0x02 + +#define HDAC_RIRBSIZE_RIRBSZCAP_2 0x10 +#define HDAC_RIRBSIZE_RIRBSZCAP_16 0x20 +#define HDAC_RIRBSIZE_RIRBSZCAP_256 0x40 + +#define HDAC_RIRBSIZE_RIRBSIZE(rirbsize) \ +(((rirbsize) & HDAC_RIRBSIZE_RIRBSIZE_MASK) >> HDAC_RIRBSIZE_RIRBSIZE_SHIFT) + +/* DPLBASE - DMA Position Lower Base Address */ +#define HDAC_DPLBASE_DPLBASE_MASK 0xffffff80 +#define HDAC_DPLBASE_DPLBASE_SHIFT 7 +#define HDAC_DPLBASE_DPLBASE_DMAPBE 0x00000001 + +/* SDCTL - Stream Descriptor Control */ +#define HDAC_SDCTL_SRST 0x000001 +#define HDAC_SDCTL_RUN 0x000002 +#define HDAC_SDCTL_IOCE 0x000004 +#define HDAC_SDCTL_FEIE 0x000008 +#define HDAC_SDCTL_DEIE 0x000010 +#define HDAC_SDCTL2_STRIPE_MASK 0x03 +#define HDAC_SDCTL2_STRIPE_SHIFT 0 +#define HDAC_SDCTL2_TP 0x04 +#define HDAC_SDCTL2_DIR 0x08 +#define HDAC_SDCTL2_STRM_MASK 0xf0 +#define HDAC_SDCTL2_STRM_SHIFT 4 + +#define HDAC_SDSTS_DESE (1 << 4) +#define HDAC_SDSTS_FIFOE (1 << 3) +#define HDAC_SDSTS_BCIS (1 << 2) + #endif /* !__LIBSAIO_HDA_H */ Index: branches/ErmaC/Enoch/i386/libsaio/base64-decode.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/base64-decode.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/base64-decode.c (revision 2323) @@ -36,8 +36,7 @@ { /* Wrong base64 string length */ return NULL; - - } + } result = dest = malloc(in_len / 4 * 3 + 1); if (result == NULL) return NULL; /* out of memory */ @@ -68,4 +67,4 @@ } -/* end of base64.c */ \ No newline at end of file +/* end of base64.c */ Index: branches/ErmaC/Enoch/i386/libsaio/fdisk.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/fdisk.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/fdisk.h (revision 2323) @@ -35,58 +35,58 @@ #ifndef __LIBSAIO_FDISK_H #define __LIBSAIO_FDISK_H -#define DISK_BLK0 0 /* blkno of boot block */ -#define DISK_BLK0SZ 512 /* size of boot block */ -#define DISK_BOOTSZ 446 /* size of boot code in boot block */ +#define DISK_BLK0 0 /* blkno of boot block */ +#define DISK_BLK0SZ 512 /* size of boot block */ +#define DISK_BOOTSZ 446 /* size of boot code in boot block */ #define DISK_SIGNATURE 0xAA55 /* signature of the boot record */ -#define FDISK_NPART 4 /* number of entries in fdisk table */ +#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_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_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 -#define FDISK_LINUX 0x83 +#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_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_UFS 0xa8 /* Apple UFS partition */ +#define FDISK_HFS 0xaf /* Apple HFS partition */ #define FDISK_BOOTER 0xab /* Apple booter partition */ /* * Format of fdisk partion entry (if present). */ struct fdisk_part { - unsigned char bootid; /* bootable or not */ - unsigned char beghead; /* begining head, sector, cylinder */ - unsigned char begsect; /* begcyl is a 10-bit number */ - unsigned char begcyl; /* High 2 bits are in begsect */ - unsigned char systid; /* OS type */ - unsigned char endhead; /* ending head, sector, cylinder */ - unsigned char endsect; /* endcyl is a 10-bit number */ - unsigned char endcyl; /* High 2 bits are in endsect */ - unsigned long relsect; /* partion physical offset on disk */ - unsigned long numsect; /* number of sectors in partition */ + unsigned char bootid; /* bootable or not */ + unsigned char beghead; /* begining head, sector, cylinder */ + unsigned char begsect; /* begcyl is a 10-bit number */ + unsigned char begcyl; /* High 2 bits are in begsect */ + unsigned char systid; /* OS type */ + unsigned char endhead; /* ending head, sector, cylinder */ + unsigned char endsect; /* endcyl is a 10-bit number */ + unsigned char endcyl; /* High 2 bits are in endsect */ + unsigned long relsect; /* partion physical offset on disk */ + unsigned long numsect; /* number of sectors in partition */ } __attribute__((packed)); /* * Format of boot block. */ struct disk_blk0 { - unsigned char bootcode[DISK_BOOTSZ]; - unsigned char parts[FDISK_NPART][sizeof (struct fdisk_part)]; - unsigned short signature; + unsigned char bootcode[DISK_BOOTSZ]; + unsigned char parts[FDISK_NPART][sizeof (struct fdisk_part)]; + unsigned short signature; }; struct REAL_disk_blk0 { - unsigned char bootcode[DISK_BOOTSZ]; - struct fdisk_part parts[FDISK_NPART]; - unsigned short signature; + unsigned char bootcode[DISK_BOOTSZ]; + struct fdisk_part parts[FDISK_NPART]; + unsigned short signature; } __attribute__((packed)); #endif /* !__LIBSAIO_FDISK_H */ Index: branches/ErmaC/Enoch/i386/libsaio/dram_controllers.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/dram_controllers.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/dram_controllers.c (revision 2323) @@ -309,10 +309,11 @@ // RAS Active to precharge (tRAS) Platform.RAM.RAS = (Precharge_Register >> 11) & 0x1F; - if ((c0ckectrl >> 20 & 0xF) && (c1ckectrl >> 20 & 0xF)) + if ((c0ckectrl >> 20 & 0xF) && (c1ckectrl >> 20 & 0xF)) { Platform.RAM.Channels = SMB_MEM_CHANNEL_DUAL; - else + } else { Platform.RAM.Channels = SMB_MEM_CHANNEL_SINGLE; + } } // Get im965 Memory Timings @@ -356,10 +357,11 @@ // RAS Active to precharge (tRAS) Platform.RAM.RAS = (Precharge_Register >> 21) & 0x1F; - if ((c0ckectrl >> 20 & 0xF) && (c1ckectrl >> 20 & 0xF)) + if ((c0ckectrl >> 20 & 0xF) && (c1ckectrl >> 20 & 0xF)) { Platform.RAM.Channels = SMB_MEM_CHANNEL_DUAL; - else + } else { Platform.RAM.Channels = SMB_MEM_CHANNEL_SINGLE; + } } // Get P35 Memory Timings @@ -417,16 +419,18 @@ } // Determine DDR-II or DDR-III - if (Memory_Check & 1) + if (Memory_Check & 1) { Platform.RAM.Type = SMB_MEM_TYPE_DDR2; - else + } else { Platform.RAM.Type = SMB_MEM_TYPE_DDR3; + } // CAS Latency (tCAS) - if(dram_dev->device_id > 0x2E00) + if(dram_dev->device_id > 0x2E00) { Platform.RAM.CAS = ((ODT_Control_Register >> 8) & 0x3F) - 6; - else + } else { Platform.RAM.CAS = ((ODT_Control_Register >> 8) & 0x3F) - 9; + } // RAS-To-CAS (tRCD) Platform.RAM.TRC = (Read_Register >> 17) & 0xF; @@ -438,10 +442,11 @@ Platform.RAM.RAS = Precharge_Register & 0x3F; // Channel configuration - if (((c0ckectrl >> 20) & 0xF) && ((c1ckectrl >> 20) & 0xF)) + if (((c0ckectrl >> 20) & 0xF) && ((c1ckectrl >> 20) & 0xF)) { Platform.RAM.Channels = SMB_MEM_CHANNEL_DUAL; - else + } else { Platform.RAM.Channels = SMB_MEM_CHANNEL_SINGLE; + } } // Get Nehalem Memory Timings @@ -458,12 +463,13 @@ Platform.RAM.Type = SMB_MEM_TYPE_DDR3; // Get the first valid channel - if(mc_control & 1) + if(mc_control & 1) { fvc_bn = 4; - else if(mc_control & 2) + } else if(mc_control & 2) { fvc_bn = 5; - else if(mc_control & 7) + } else if(mc_control & 7) { fvc_bn = 6; + } // Now, detect timings mc_channel_bank_timing = pci_config_read32(PCIADDR(nhm_bus, fvc_bn, 0), 0x88); @@ -482,12 +488,13 @@ Platform.RAM.TRP = mc_channel_bank_timing & 0xF; // Single , Dual or Triple Channels - if (mc_control == 1 || mc_control == 2 || mc_control == 4 ) + if (mc_control == 1 || mc_control == 2 || mc_control == 4 ) { Platform.RAM.Channels = SMB_MEM_CHANNEL_SINGLE; - else if (mc_control == 7) + } else if (mc_control == 7) { Platform.RAM.Channels = SMB_MEM_CHANNEL_TRIPLE; - else + } else { Platform.RAM.Channels = SMB_MEM_CHANNEL_DUAL; + } } static struct mem_controller_t dram_controllers[] = { @@ -496,37 +503,62 @@ { 0, 0, "", NULL, NULL, NULL }, // Intel +// { 0x8086, 0x0100, "2rd Gen Core processor", NULL, NULL, NULL }, +// { 0x8086, 0x0104, "2rd Gen Core processor", NULL, NULL, NULL }, +// { 0x8086, 0x010C, "Xeon E3-1200/2rd Gen Core processor", NULL, NULL, NULL }, +// { 0x8086, 0x0150, "Xeon E3-1200 v2/3rd Gen Core processor", NULL, NULL, NULL }, +// { 0x8086, 0x0154, "3rd Gen Core processor", NULL, NULL, NULL }, +// { 0x8086, 0x0158, "Xeon E3-1200 v2/Ivy Bridge", NULL, NULL, NULL }, +// { 0x8086, 0x015C, "Xeon E3-1200 v2/3rd Gen Core processor", NULL, NULL, NULL }, + +// { 0x8086, 0x0BF0, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF1, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF2, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF3, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF4, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF5, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF6, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, +// { 0x8086, 0x0BF7, "Atom Processor D2xxx/N2xxx", NULL, NULL, NULL }, + +// { 0x8086, 0x0C00, "Haswell", NULL, NULL, NULL }, +// { 0x8086, 0x0C04, "Haswell", NULL, NULL, NULL }, +// { 0x8086, 0x0C08, "Haswell", NULL, NULL, NULL }, + { 0x8086, 0x7190, "VMWare", NULL, NULL, NULL }, - { 0x8086, 0x1A30, "i845", NULL, NULL, NULL }, + { 0x8086, 0x1A30, "82845 845 [Brookdale]", NULL, NULL, NULL }, - { 0x8086, 0x2970, "i946PL/GZ", setup_p35, get_fsb_i965, get_timings_i965 }, - { 0x8086, 0x2990, "Q963/Q965", setup_p35, get_fsb_i965, get_timings_i965 }, + { 0x8086, 0x2970, "82946GZ/PL/GL", setup_p35, get_fsb_i965, get_timings_i965 }, + { 0x8086, 0x2990, "82Q963/Q965", setup_p35, get_fsb_i965, get_timings_i965 }, { 0x8086, 0x29A0, "P965/G965", setup_p35, get_fsb_i965, get_timings_i965 }, { 0x8086, 0x2A00, "GM965/GL960", setup_p35, get_fsb_im965, get_timings_im965 }, { 0x8086, 0x2A10, "GME965/GLE960", setup_p35, get_fsb_im965, get_timings_im965 }, { 0x8086, 0x2A40, "PM/GM45/47", setup_p35, get_fsb_im965, get_timings_im965 }, - { 0x8086, 0x29B0, "Q35", setup_p35, get_fsb_i965, get_timings_p35 }, - { 0x8086, 0x29C0, "P35/G33", setup_p35, get_fsb_i965, get_timings_p35 }, - { 0x8086, 0x29D0, "Q33", setup_p35, get_fsb_i965, get_timings_p35 }, - { 0x8086, 0x29E0, "X38/X48", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x29B0, "82Q35 Express", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x29C0, "82G33/G31/P35/P31", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x29D0, "82Q33 Express", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x29E0, "82X38/X48 Express", setup_p35, get_fsb_i965, get_timings_p35 }, +// { 0x8086, 0x29F0, "3200/3210 Chipset", NULL, NULL, NULL }, + { 0x8086, 0x2E00, "Eaglelake", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E10, "Q45/Q43", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E20, "P45/G45", setup_p35, get_fsb_i965, get_timings_p35 }, - { 0x8086, 0x2E30, "G41", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x2E30, "G41", setup_p35, get_fsb_i965, get_timings_p35 }, +// { 0x8086, 0x2E40, "4 Series Chipset", NULL, NULL, NULL }, +// { 0x8086, 0x2E90, "4 Series Chipset", NULL, NULL, NULL }, { 0x8086, 0xD131, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, { 0x8086, 0xD132, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3400, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3401, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3402, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3403, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3404, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3405, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3406, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, - { 0x8086, 0x3407, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3400, "5520/5500/X58", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3401, "5520/5500/X58", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3402, "5520/5500/X58", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3403, "5500", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3404, "5520/5500/X58", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3405, "5520/5500/X58", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3406, "5520", setup_nhm, get_fsb_nhm, get_timings_nhm }, + { 0x8086, 0x3407, "5520/5500/X58", setup_nhm, get_fsb_nhm, get_timings_nhm }, }; static const char *memory_channel_types[] = @@ -538,30 +570,33 @@ { int i; for(i = 1; i < sizeof(dram_controllers) / sizeof(dram_controllers[0]); i++) - if ((dram_controllers[i].vendor == dram_dev->vendor_id) - && (dram_controllers[i].device == dram_dev->device_id)) + { + if ((dram_controllers[i].vendor == dram_dev->vendor_id) && (dram_controllers[i].device == dram_dev->device_id)) { verbose("%s%s DRAM Controller [%4x:%4x] at %02x:%02x.%x\n", - (dram_dev->vendor_id == 0x8086) ? "Intel " : "" , - dram_controllers[i].name, dram_dev->vendor_id, dram_dev->device_id, - dram_dev->dev.bits.bus, dram_dev->dev.bits.dev, dram_dev->dev.bits.func); + (dram_dev->vendor_id == 0x8086) ? "Intel Corporation " : "" , + dram_controllers[i].name, dram_dev->vendor_id, dram_dev->device_id, + dram_dev->dev.bits.bus, dram_dev->dev.bits.dev, dram_dev->dev.bits.func); - if (dram_controllers[i].initialise != NULL) + if (dram_controllers[i].initialise != NULL) { dram_controllers[i].initialise(dram_dev); + } - if (dram_controllers[i].poll_timings != NULL) + if (dram_controllers[i].poll_timings != NULL) { dram_controllers[i].poll_timings(dram_dev); + } - if (dram_controllers[i].poll_speed != NULL) + if (dram_controllers[i].poll_speed != NULL) { dram_controllers[i].poll_speed(dram_dev); + } verbose("Frequency detected: %d MHz (%d) %s Channel \n\tCAS:%d tRC:%d tRP:%d RAS:%d (%d-%d-%d-%d)\n", - (uint32_t)Platform.RAM.Frequency / 1000000, - (uint32_t)Platform.RAM.Frequency / 500000, - memory_channel_types[Platform.RAM.Channels] - ,Platform.RAM.CAS, Platform.RAM.TRC, Platform.RAM.TRP, Platform.RAM.RAS - ,Platform.RAM.CAS, Platform.RAM.TRC, Platform.RAM.TRP, Platform.RAM.RAS - ); + (uint32_t)Platform.RAM.Frequency / 1000000, + (uint32_t)Platform.RAM.Frequency / 500000, + memory_channel_types[Platform.RAM.Channels] + ,Platform.RAM.CAS, Platform.RAM.TRC, Platform.RAM.TRP, Platform.RAM.RAS + ,Platform.RAM.CAS, Platform.RAM.TRC, Platform.RAM.TRP, Platform.RAM.RAS); // getchar(); } + } } Index: branches/ErmaC/Enoch/i386/libsaio/nvidia.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/nvidia.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/nvidia.c (revision 2323) @@ -1702,9 +1702,9 @@ { if (nvidia_card_vendors[j].device == (subsys_id & 0xffff0000)) { - snprintf(name_model, sizeof(name_model), "%s %s", - nvidia_card_vendors[j].name, nvidia_card_generic[i].name); - return name_model; + snprintf(name_model, sizeof(name_model), "%s %s", + nvidia_card_vendors[j].name, nvidia_card_generic[i].name); + return name_model; } } } @@ -2171,7 +2171,7 @@ memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); stringlength = string->length; - free(version_str); + free(version_str); free(rom); return true; } Index: branches/ErmaC/Enoch/i386/libsaio/ntfs.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/ntfs.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/ntfs.c (revision 2323) @@ -270,15 +270,13 @@ //verbose("NTFS: lseek to $Volume failed: %s\n", strerror(errno)); goto error; } - if (read(fd, buf, mftRecordSize) != mftRecordSize) - { + if (read(fd, buf, mftRecordSize) != mftRecordSize) { //verbose("NTFS: error reading MFT $Volume record: %s\n", strerror(errno)); goto error; } #endif - if (ntfs_fixup(buf, mftRecordSize, NTFS_FILEMAGIC, bytesPerSector) != 0) - { + if (ntfs_fixup(buf, mftRecordSize, NTFS_FILEMAGIC, bytesPerSector) != 0) { //verbose("NTFS: block fixup failed\n"); goto error; } @@ -310,8 +308,9 @@ struct bootfile *boot; void *buf = malloc(MAX_BLOCK_SIZE); - if ( !buf ) + if ( !buf ) { return -1; + } /* * Read the boot sector, check signatures, and do some minimal @@ -331,29 +330,30 @@ } // Check for non-null volume serial number - if( !boot->bf_volsn ) + if( !boot->bf_volsn ) { return -1; + } // Use UUID like the one you get on Windows sprintf(uuidStr, "%04X-%04X", (unsigned short)(boot->bf_volsn >> 16) & 0xFFFF, (unsigned short)boot->bf_volsn & 0xFFFF); return 0; -} +} bool NTFSProbe(const void * buffer) { bool result = false; - + 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) result = true; - + // If not NTFS, maybe it is EXFAT if (!result) result = EXFATProbe(buffer); - + return result; } Index: branches/ErmaC/Enoch/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/ati.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/ati.c (revision 2323) @@ -1359,7 +1359,9 @@ { 0x95C4, 0x00000000, CHIP_FAMILY_RV620, "ATI Radeon HD 3470 Series", kIago }, { 0x95C5, 0x00000000, CHIP_FAMILY_RV620, "ATI Radeon HD 3450 Series", kIago }, + { 0x95C6, 0x00000000, CHIP_FAMILY_RV620, "ATI Radeon HD 3450 AGP", kIago }, + /* IGP */ { 0x9610, 0x00000000, CHIP_FAMILY_RS780, "ATI Radeon HD 3200 Graphics", kNull }, { 0x9611, 0x00000000, CHIP_FAMILY_RS780, "ATI Radeon HD 3100 Graphics", kNull }, @@ -1559,7 +1561,7 @@ { 0x6808, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7600 Series", kFutomaki }, // ATI7000Controller.kext // { 0x6809, 0x00000000, CHIP_FAMILY_PITCAIRN, "AMD Radeon HD ??? Series", kNull }, -// { 0x6810, 0x00000000, CHIP_FAMILY_PITCAIRN, "AMD Radeon HD ??? Series", kNull }, + { 0x6810, 0x00000000, CHIP_FAMILY_PITCAIRN, "AMD Radeon R9 270X", kNull }, { 0x6818, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7870 Series", kFutomaki }, // CHIP_FAMILY_PITCAIRN ??// ATI7000Controller.kext { 0x6819, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7850 Series", kFutomaki },// CHIP_FAMILY_PITCAIRN ?? @@ -1584,7 +1586,7 @@ { 0x6831, 0x00000000, CHIP_FAMILY_VERDE, "AMD Radeon HD 7700 Series", kBuri }, { 0x6837, 0x00000000, CHIP_FAMILY_VERDE, "AMD Radeon HD 7700 Series", kBuri }, -// { 0x6838, 0x00000000, CHIP_FAMILY_VERDE, "AMD Radeon HD ??? Series", kBuri }, + { 0x6838, 0x00000000, CHIP_FAMILY_VERDE, "AMD Radeon HD 7700 Series", kBuri }, { 0x6839, 0x00000000, CHIP_FAMILY_VERDE, "AMD Radeon HD 7700 Series", kBuri }, // ATI7000Controller.kext { 0x683B, 0x00000000, CHIP_FAMILY_VERDE, "AMD Radeon HD 7700 Series", kBuri }, // ATI7000Controller.kext @@ -1861,7 +1863,7 @@ { if (devprop_list[i].get_value(val)) { - devprop_list[i].name[1] = 0x30 + pnum; // convert to ascii + devprop_list[i].name[1] = (uint8_t)(0x30 + pnum); // convert to ascii devprop_add_value(card->device, devprop_list[i].name, val->data, val->size); free_val(val); } @@ -1885,7 +1887,7 @@ { if (devprop_list[i].default_val.type != kNul) { - devprop_list[i].name[1] = 0x30 + pnum; // convert to ascii + devprop_list[i].name[1] = (uint8_t)(0x30 + pnum); // convert to ascii devprop_add_value(card->device, devprop_list[i].name, devprop_list[i].default_val.type == kCst ? (uint8_t *)&(devprop_list[i].default_val.data) : devprop_list[i].default_val.data, Index: branches/ErmaC/Enoch/i386/libsaio/sys.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2323) @@ -82,20 +82,21 @@ extern int multiboot_skip_partition_set; struct devsw { - const char * name; - // size increased from char to short to handle non-BIOS internal devices - unsigned short biosdev; - int type; + const char * name; + // size increased from char to short to handle non-BIOS internal devices + unsigned short biosdev; + int type; }; // Device entries must be ordered by bios device numbers. static struct devsw devsw[] = { - { "hd", 0x80, kBIOSDevTypeHardDrive }, /* DEV_HD */ - { "en", 0xE0, kBIOSDevTypeNetwork }, /* DEV_EN */ - { "rd", 0x100, kBIOSDevTypeHardDrive }, - { "bt", 0x101, kBIOSDevTypeHardDrive }, // turbo - type for booter partition - { 0, 0 } +// { "sd", 0x80, kBIOSDevTypeHardDrive }, /* DEV_SD */ + { "hd", 0x80, kBIOSDevTypeHardDrive }, /* DEV_HD */ + { "en", 0xE0, kBIOSDevTypeNetwork }, /* DEV_EN */ + { "rd", 0x100, kBIOSDevTypeHardDrive }, + { "bt", 0x101, kBIOSDevTypeHardDrive }, // turbo - type for booter partition + { 0, 0 } }; // Pseudo BIOS devices @@ -120,7 +121,7 @@ //static BVRef getBootVolumeRef( const char * path, const char ** outPath ); static BVRef newBootVolumeRef( int biosdev, int partno ); -//========================================================================== +//============================================================================== // LoadVolumeFile - LOW-LEVEL FILESYSTEM FUNCTION. // Load the specified file from the specified volume // to the load buffer at LOAD_ADDR. @@ -128,7 +129,7 @@ long LoadVolumeFile(BVRef bvr, const char *filePath) { - long fileSize; + long fileSize; // Read file into load buffer. The data in the load buffer will be // overwritten by the next LoadFile() call. @@ -142,105 +143,125 @@ return fileSize; } -//========================================================================== +//============================================================================== // LoadFile - LOW-LEVEL FILESYSTEM FUNCTION. // Load the specified file to the load buffer at LOAD_ADDR. // If the file is fat, load only the i386 portion. long LoadFile(const char * fileSpec) { - const char * filePath; - BVRef bvr; + const char * filePath; + BVRef bvr; - // Resolve the boot volume from the file spec. + // Resolve the boot volume from the file spec. - if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) - return -1; + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) { + return -1; + } - return LoadVolumeFile(bvr, filePath); + return LoadVolumeFile(bvr, filePath); } +//============================================================================== + long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length) { - const char *filePath; - BVRef bvr; + const char *filePath; + BVRef bvr; - if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) - return -1; + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) { + return -1; + } - if (bvr->fs_readfile == NULL) - return -1; + if (bvr->fs_readfile == NULL) { + return -1; + } - return bvr->fs_readfile(bvr, (char *)filePath, buffer, offset, length); + return bvr->fs_readfile(bvr, (char *)filePath, buffer, offset, length); } +//============================================================================== + long LoadThinFatFile(const char *fileSpec, void **binary) { - const char *filePath; - FSReadFile readFile; - BVRef bvr; - unsigned long length, length2; - - // Resolve the boot volume from the file spec. + const char * filePath; + FSReadFile readFile; + BVRef bvr; + unsigned long length, length2; - if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) - return -1; + // Resolve the boot volume from the file spec. + + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) { + return -1; + } + + *binary = (void *)kLoadAddr; - *binary = (void *)kLoadAddr; - - // Read file into load buffer. The data in the load buffer will be - // overwritten by the next LoadFile() call. + // Read file into load buffer. The data in the load buffer will be + // overwritten by the next LoadFile() call. - gFSLoadAddress = (void *) LOAD_ADDR; + gFSLoadAddress = (void *) LOAD_ADDR; - readFile = bvr->fs_readfile; + readFile = bvr->fs_readfile; - if (readFile != NULL) { - // Read the first 4096 bytes (fat header) - length = readFile(bvr, (char *)filePath, *binary, 0, 0x1000); - if (length > 0) { - if (ThinFatFile(binary, &length) == 0) { - if (length == 0) + if (readFile != NULL) { + // Read the first 4096 bytes (fat header) + length = readFile(bvr, (char *)filePath, *binary, 0, 0x1000); + + if (length > 0) { + if (ThinFatFile(binary, &length) == 0) { + if (length == 0) { return 0; - // We found a fat binary; read only the thin part - length = readFile(bvr, (char *)filePath, - (void *)kLoadAddr, (unsigned long)(*binary) - kLoadAddr, length); - *binary = (void *)kLoadAddr; - } else { - // Not a fat binary; read the rest of the file - length2 = readFile(bvr, (char *)filePath, (void *)(kLoadAddr + length), length, 0); - if (length2 == -1) return -1; - length += length2; - } - } - } else { - length = bvr->fs_loadfile(bvr, (char *)filePath); - if (length > 0) { - ThinFatFile(binary, &length); - } - } + } + + // We found a fat binary; read only the thin part + length = readFile(bvr, (char *)filePath, (void *)kLoadAddr, (unsigned long)(*binary) - kLoadAddr, length); + *binary = (void *)kLoadAddr; + } else { + // Not a fat binary; read the rest of the file + length2 = readFile(bvr, (char *)filePath, (void *)(kLoadAddr + length), length, 0); + + if (length2 == -1) { + return -1; + } + + length += length2; + } + } + } else { + length = bvr->fs_loadfile(bvr, (char *)filePath); + + if (length > 0) { + ThinFatFile(binary, &length); + } + } - return length; + return length; } +//============================================================================== + #if UNUSED long GetFSUUID(char *spec, char *uuidStr) { - BVRef bvr; - long rval = -1; - const char *devSpec; + BVRef bvr; + long rval = -1; + const char *devSpec; - if ((bvr = getBootVolumeRef(spec, &devSpec)) == NULL) - return -1; + if ((bvr = getBootVolumeRef(spec, &devSpec)) == NULL) { + return -1; + } - if(bvr->fs_getuuid) - rval = bvr->fs_getuuid(bvr, uuidStr); + if(bvr->fs_getuuid) { + rval = bvr->fs_getuuid(bvr, uuidStr); + } - return rval; + return rval; } #endif // filesystem-specific getUUID functions call this shared string generator + long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr) { unsigned fmtbase, fmtidx, i; @@ -264,50 +285,61 @@ // generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292 - i = 0; fmtbase = 0; - for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) { - for(i=0; i < uuidfmt[fmtidx]; i++) { - uint8_t byte = mdresult[fmtbase+i]; - char nib; + i = 0; + fmtbase = 0; - nib = byte >> 4; - *p = nib + '0'; // 0x4 -> '4' - if(*p > '9') *p = (nib - 9 + ('A'-1)); // 0xB -> 'B' - p++; + for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) { + for (i = 0; i < uuidfmt[fmtidx]; i++) { + uint8_t byte = mdresult[fmtbase + i]; + char nib = byte >> 4; + *p = nib + '0'; // 0x4 -> '4' - nib = byte & 0xf; - *p = nib + '0'; // 0x4 -> '4' - if(*p > '9') *p = (nib - 9 + ('A'-1)); // 0xB -> 'B' - p++; + if (*p > '9') { + *p = (nib - 9 + ('A'-1)); // 0xB -> 'B' + } - } - fmtbase += i; - if(fmtidx < sizeof(uuidfmt)-1) - *(p++) = '-'; - else - *p = '\0'; - } + p++; - return 0; + nib = byte & 0xf; + *p = nib + '0'; // 0x4 -> '4' + + if (*p > '9') { + *p = (nib - 9 + ('A'-1)); // 0xB -> 'B' + } + + p++; + } + + fmtbase += i; + + if (fmtidx < sizeof(uuidfmt) - 1) { + *(p++) = '-'; + } + else + { + *p = '\0'; + } + } + + return 0; } - -//========================================================================== +//============================================================================== // GetDirEntry - LOW-LEVEL FILESYSTEM FUNCTION. // Fetch the next directory entry for the given directory. -long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name, - long * flags, long * time) +long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name, long * flags, long * time) { - const char * dirPath; - BVRef bvr; + const char * dirPath; + BVRef bvr; - // Resolve the boot volume from the dir spec. + // Resolve the boot volume from the dir spec. - if ((bvr = getBootVolumeRef(dirSpec, &dirPath)) == NULL) - return -1; + if ((bvr = getBootVolumeRef(dirSpec, &dirPath)) == NULL) { + return -1; + } - // Return 0 on success, or -1 if there are no additional entries. + // Returns 0 on success or -1 when there are no additional entries. return bvr->fs_getdirentry( bvr, /* dirPath */ (char *)dirPath, @@ -315,64 +347,70 @@ /* dirEntry */ (char **)name, flags, time, 0, 0 ); } -//========================================================================== +//============================================================================== // GetFileInfo - LOW-LEVEL FILESYSTEM FUNCTION. // Get attributes for the specified file. static char* gMakeDirSpec; -long GetFileInfo(const char * dirSpec, const char * name, - long * flags, long * time) +long GetFileInfo(const char * dirSpec, const char * name, long * flags, long * time) { - long long index = 0; - const char * entryName; + long long index = 0; + const char * entryName; - if (gMakeDirSpec == 0) - gMakeDirSpec = (char *)malloc(1024); + if (gMakeDirSpec == 0) { + gMakeDirSpec = (char *)malloc(1024); + } - if (!dirSpec) { - long idx, len; + if (!dirSpec) { + long idx, len; - len = strlen(name); + len = strlen(name); - for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {} - if (idx == 0) { - if(name[idx] == '/' || name[idx] == '\\') ++name; // todo: ensure other functions handel \ properly - gMakeDirSpec[0] = '/'; - gMakeDirSpec[1] = '\0'; - } else { - idx++; - strncpy(gMakeDirSpec, name, idx); - gMakeDirSpec[idx] = '\0'; - name += idx; - } - dirSpec = gMakeDirSpec; - } + for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {} + if (idx == 0) { + if(name[idx] == '/' || name[idx] == '\\') ++name; // todo: ensure other functions handel \ properly + gMakeDirSpec[0] = '/'; + gMakeDirSpec[1] = '\0'; + gMakeDirSpec[idx] = '\0'; + } else { + idx++; + strncpy(gMakeDirSpec, name, idx); + gMakeDirSpec[idx] = '\0'; // ISSUE: http://forge.voodooprojects.org/p/chameleon/issues/270/ + name += idx; + } - while (GetDirEntry(dirSpec, &index, &entryName, flags, time) == 0) - { - if (strcmp(entryName, name) == 0) - return 0; // success - } - return -1; // file not found + dirSpec = gMakeDirSpec; + } + + while (GetDirEntry(dirSpec, &index, &entryName, flags, time) == 0) + { + if (strcmp(entryName, name) == 0) { + return 0; // success + } + } + + return -1; // file not found } +//============================================================================== + long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock) { - const char * filePath; - BVRef bvr; + const char * filePath; + BVRef bvr; - // Resolve the boot volume from the file spec. + // Resolve the boot volume from the file spec. - if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) { - printf("Boot volume for '%s' is bogus\n", fileSpec); - return -1; - } + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) { + // printf("Boot volume for '%s' is bogus\n", fileSpec); + return -1; + } - return bvr->fs_getfileblock(bvr, (char *)filePath, firstBlock); + return bvr->fs_getfileblock(bvr, (char *)filePath, firstBlock); } -//========================================================================== +//============================================================================== // GetFreeFD() static int GetFreeFd(void) @@ -390,7 +428,7 @@ return -1; } -//========================================================================== +//============================================================================== // iob_from_fdesc() // // Return a pointer to an allocated 'iob' based on the file descriptor @@ -398,16 +436,16 @@ static struct iob * iob_from_fdesc(int fdesc) { - register struct iob * io; + register struct iob * io; - if (fdesc < 0 || fdesc >= NFILES || - ((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0) - return NULL; - else - return io; + if (fdesc < 0 || fdesc >= NFILES || ((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0) { + return NULL; + } else { + return io; + } } -//========================================================================== +//============================================================================== // openmem() int openmem(char * buf, int len) @@ -429,7 +467,7 @@ return fdesc; } -//========================================================================== +//============================================================================== // open() - Open the file specified by 'path' for reading. static int open_bvr(BVRef bvr, const char *filePath, int flags) @@ -449,8 +487,11 @@ // Mark the descriptor as taken. io->i_flgs = F_ALLOC; + // Find the next available memory block in the download buffer. + io->i_buf = (char *) LOAD_ADDR; + for (i = 0; i < NFILES; i++) { if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc)) { continue; @@ -459,12 +500,15 @@ } // Load entire file into memory. Unnecessary open() calls must be avoided. + gFSLoadAddress = io->i_buf; io->i_filesize = bvr->fs_loadfile(bvr, (char *)filePath); + if (io->i_filesize < 0) { close(fdesc); return -1; } + return fdesc; } @@ -525,75 +569,85 @@ return -1; } -//========================================================================== +//============================================================================== // close() - Close a file descriptor. int close(int fdesc) { - struct iob * io; + struct iob * io; - if ((io = iob_from_fdesc(fdesc)) == NULL) - return (-1); + if ((io = iob_from_fdesc(fdesc)) == NULL) { + return (-1); + } - io->i_flgs = 0; + io->i_flgs = 0; - return 0; + return 0; } -//========================================================================== + +//============================================================================== // lseek() - Reposition the byte offset of the file descriptor from the // beginning of the file. Returns the relocated offset. int b_lseek(int fdesc, int offset, int ptr) { - struct iob * io; + struct iob * io; - if ((io = iob_from_fdesc(fdesc)) == NULL) - return (-1); + if ((io = iob_from_fdesc(fdesc)) == NULL) { + return (-1); + } - io->i_offset = offset; + io->i_offset = offset; - return offset; + return offset; } -//========================================================================== + +//============================================================================== // tell() - Returns the byte offset of the file descriptor. int tell(int fdesc) { - struct iob * io; + struct iob * io; - if ((io = iob_from_fdesc(fdesc)) == NULL) - return 0; + if ((io = iob_from_fdesc(fdesc)) == NULL) { + return 0; + } - return io->i_offset; + return io->i_offset; } -//========================================================================== + +//============================================================================== // read() - Read up to 'count' bytes of data from the file descriptor // into the buffer pointed to by buf. int read(int fdesc, char * buf, int count) { - struct iob * io; - - if ((io = iob_from_fdesc(fdesc)) == NULL) - return (-1); + struct iob * io; - if ((io->i_offset + count) > (unsigned int)io->i_filesize) - count = io->i_filesize - io->i_offset; + if ((io = iob_from_fdesc(fdesc)) == NULL) { + return (-1); + } - if (count <= 0) - return 0; // end of file + if ((io->i_offset + count) > (unsigned int)io->i_filesize) { + count = io->i_filesize - io->i_offset; + } - bcopy(io->i_buf + io->i_offset, buf, count); + if (count <= 0) { + return 0; // end of file + } - io->i_offset += count; + bcopy(io->i_buf + io->i_offset, buf, count); - return count; + io->i_offset += count; + + return count; } -//========================================================================== + +//============================================================================== // write() - Write up to 'count' bytes of data to the file descriptor // from the buffer pointed to by buf. @@ -649,50 +703,55 @@ return 4; } -//========================================================================== +//============================================================================== // file_size() - Returns the size of the file described by the file // descriptor. int file_size(int fdesc) { - struct iob * io; + struct iob * io; - if ((io = iob_from_fdesc(fdesc)) == 0) - return 0; + if ((io = iob_from_fdesc(fdesc)) == 0) { + return 0; + } - return io->i_filesize; + return io->i_filesize; } -//========================================================================== +//============================================================================== + struct dirstuff * vol_opendir(BVRef bvr, const char * path) { - struct dirstuff * dirp = 0; + struct dirstuff * dirp = 0; - dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); - if (dirp == NULL) - goto error; + dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); - dirp->dir_path = newString(path); - if (dirp->dir_path == NULL) - goto error; + if (dirp == NULL) + goto error; - dirp->dir_bvr = bvr; + dirp->dir_path = newString(path); + if (dirp->dir_path == NULL) + goto error; - return dirp; + dirp->dir_bvr = bvr; + return dirp; + error: - closedir(dirp); - return NULL; + closedir(dirp); + + return NULL; } -//========================================================================== +//============================================================================== + 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; @@ -714,99 +773,99 @@ return NULL; } -//========================================================================== +//============================================================================== + int closedir(struct dirstuff * dirp) { - if (dirp) { - if (dirp->dir_path) free(dirp->dir_path); - free(dirp); - } + if (dirp) { + if (dirp->dir_path) { + free(dirp->dir_path); + } + + free(dirp); + } + return 0; } -//========================================================================== +//============================================================================== + int readdir(struct dirstuff * dirp, const char ** name, long * flags, - long * time) + long * time) { - return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr, - /* dirPath */ dirp->dir_path, - /* dirIndex */ &dirp->dir_index, - /* dirEntry */ (char **)name, flags, time, - 0, 0); + return dirp->dir_bvr->fs_getdirentry(dirp->dir_bvr, + /* dirPath */ dirp->dir_path, + /* dirIndex */ &dirp->dir_index, + /* dirEntry */ (char **)name, flags, time, 0, 0); } -//========================================================================== +//============================================================================== int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, - long * time, FinderInfo *finderInfo, long *infoValid) + long * time, FinderInfo *finderInfo, long *infoValid) { - return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr, - /* dirPath */ dirp->dir_path, - /* dirIndex */ &dirp->dir_index, - /* dirEntry */ (char **)name, - flags, time, - finderInfo, infoValid); + return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr, + /* dirPath */ dirp->dir_path, + /* dirIndex */ &dirp->dir_index, + /* dirEntry */ (char **)name, + flags, time, + finderInfo, infoValid); } -//========================================================================== +//============================================================================== const char * systemConfigDir() { - if (gBootFileType == kNetworkDeviceType) - return ""; - return "/Library/Preferences/SystemConfiguration"; + if (gBootFileType == kNetworkDeviceType) { + return ""; + } + return "/Library/Preferences/SystemConfiguration"; } -//========================================================================== +//============================================================================== int gBootFileType; -void scanBootVolumes( int biosdev, int * count ) +void scanBootVolumes(int biosdev, int * count) { - BVRef bvr = 0; + BVRef bvr = 0; - bvr = diskScanBootVolumes(biosdev, count); - if (bvr == NULL) - { - bvr = nbpScanBootVolumes(biosdev, count); - if (bvr != NULL) - { - gBootFileType = kNetworkDeviceType; - } - } - else - { - gBootFileType = kBlockDeviceType; - } + bvr = diskScanBootVolumes(biosdev, count); + if (bvr == NULL) { + bvr = nbpScanBootVolumes(biosdev, count); + if (bvr != NULL) { + gBootFileType = kNetworkDeviceType; + } + } else { + gBootFileType = kBlockDeviceType; + } } -//========================================================================== +//============================================================================== void scanDisks(int biosdev, int *count) { - #define MAX_HDD_COUNT 32 - int bvCount; - int hd = 0; + #define MAX_HDD_COUNT 32 + int bvCount; + int hd = 0; - // Testing up to MAX_HDD_COUNT hard drives. - while(!testBiosread(0x80 + hd, 0) && hd < MAX_HDD_COUNT) - { - bvCount = 0; - scanBootVolumes(0x80 + hd, &bvCount); - hd++; + // Testing up to MAX_HDD_COUNT hard drives. + while(!testBiosread(0x80 + hd, 0) && hd < MAX_HDD_COUNT) { + bvCount = 0; + scanBootVolumes(0x80 + hd, &bvCount); + hd++; } - // Also scanning CD/DVD drive. - if (biosDevIsCDROM(gBIOSDev)) - { - bvCount = 0; - scanBootVolumes(gBIOSDev, &bvCount); + // Also scanning CD/DVD drive. + if (biosDevIsCDROM(gBIOSDev)) { + bvCount = 0; + scanBootVolumes(gBIOSDev, &bvCount); } } -//========================================================================== +//============================================================================== BVRef selectBootVolume( BVRef chain ) { @@ -814,57 +873,66 @@ bool foundPrimary = false; BVRef bvr, bvr1 = 0, bvr2 = 0; - if (chain->filtered) filteredChain = true; + if (chain->filtered) { + filteredChain = true; + } - if (multiboot_partition_set) - for ( bvr = chain; bvr; bvr = bvr->next ) - if ( bvr->part_no == multiboot_partition && bvr->biosdev == gBIOSDev ) + if (multiboot_partition_set) { + for ( bvr = chain; bvr; bvr = bvr->next ) { + if ( bvr->part_no == multiboot_partition && bvr->biosdev == gBIOSDev ) { return bvr; - + } + } + } + /* * Checking "Default Partition" key in system configuration - use format: hd(x,y), the volume UUID or label - * to override the default selection. * We accept only kBVFlagSystemVolume or kBVFlagForeignBoot volumes. */ char *val = XMLDecode(getStringForKey(kDefaultPartition, &bootInfo->chameleonConfig)); - if (val) { - for ( bvr = chain; bvr; bvr = bvr->next ) { - if (matchVolumeToString(bvr, val, false)) { - free(val); - return bvr; - } - } - free(val); - } - + if (val) { + for ( bvr = chain; bvr; bvr = bvr->next ) { + if (matchVolumeToString(bvr, val, false)) { + free(val); + return bvr; + } + } + free(val); + } + /* * 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. */ - for ( bvr = chain; bvr; bvr = bvr->next ) - { - if (multiboot_skip_partition_set) { - if (bvr->part_no == multiboot_skip_partition) continue; - } - if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) foundPrimary = true; + for ( bvr = chain; bvr; bvr = bvr->next ) { + if (multiboot_skip_partition_set) { + if (bvr->part_no == multiboot_skip_partition) continue; + } + 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) && 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 ) + && bvr->biosdev == gBIOSDev ) { bvr2 = bvr; - } - - + } + } + /* * Use the standrad method for selecting the boot volume. */ @@ -872,8 +940,12 @@ { for ( bvr = chain; bvr; bvr = bvr->next ) { - if ( bvr->flags & kBVFlagNativeBoot && bvr->biosdev == gBIOSDev ) bvr1 = bvr; - if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) bvr2 = bvr; + if ( bvr->flags & kBVFlagNativeBoot && bvr->biosdev == gBIOSDev ) { + bvr1 = bvr; + } + if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) { + bvr2 = bvr; + } } } @@ -883,7 +955,7 @@ return bvr; } -//========================================================================== +//============================================================================== #define LP '(' #define RP ')' @@ -898,22 +970,25 @@ void setRootVolume(BVRef volume) { - gRootVolume = volume; - // Veto non-native FS. Basically that means don't allow the root volume to - // be set to a volume we can't read files from. - if(gRootVolume != NULL && ((gRootVolume->flags & kBVFlagNativeBoot) == 0)) - gRootVolume = NULL; + gRootVolume = volume; + // Veto non-native FS. Basically that means don't allow the root volume to + // be set to a volume we can't read files from. + if(gRootVolume != NULL && ((gRootVolume->flags & kBVFlagNativeBoot) == 0)) { + gRootVolume = NULL; + } } void setBootGlobals(BVRef chain) { - // Record default boot device. - gBootVolume = selectBootVolume(chain); + // Record default boot device. + gBootVolume = selectBootVolume(chain); - // turbo - Save the ORIGINAL boot volume too for loading our mkext - if (!gBIOSBootVolume) gBIOSBootVolume = gBootVolume; - - setRootVolume(gBootVolume); + // turbo - Save the ORIGINAL boot volume too for loading our mkext + if (!gBIOSBootVolume) { + gBIOSBootVolume = gBootVolume; + } + + setRootVolume(gBootVolume); } /*! @@ -924,103 +999,114 @@ 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; - int biosdev = gBIOSDev; + int biosdev = gBIOSDev; // Search for left parenthesis in the path specification. - for (cp = path; *cp; cp++) { - if (*cp == LP || *cp == '/') break; - } + for (cp = path; *cp; cp++) { + if (*cp == LP || *cp == '/') { + break; + } + } - if (*cp != LP) // no left paren found - { - // Path is using the implicit current device so if there is - // no current device, then we must fail. - cp = path; - if ( gRootVolume == NULL ) - return NULL; - } - else if ((cp - path) == 2) // found "xx(" - { - const struct devsw * dp; - const char * xp = path; - int i; - int unit = -1; - int part = -1; + if (*cp != LP) { // no left paren found + cp = path; + // Path is using the implicit current device so if there is + // no current device, then we must fail. + if (gRootVolume == NULL) { + return NULL; + } + } else if ((cp - path) == 2) { // found "xx(" + const struct devsw * dp; + const char * xp = path; - cp++; + int i; + int unit = -1; + int part = -1; - // Check the 2 character device name pointed by 'xp'. + cp++; - for (dp = devsw; dp->name; dp++) - { - if ((xp[0] == dp->name[0]) && (xp[1] == dp->name[1])) - break; // found matching entry - } - if (dp->name == NULL) - { - error("Unknown device '%c%c'\n", xp[0], xp[1]); - return NULL; - } + // Check the 2 character device name pointed by 'xp'. + + for (dp = devsw; dp->name; dp++) { + if ((xp[0] == dp->name[0]) && (xp[1] == dp->name[1])) { + break; // Found matching entry. + } + } + + if (dp->name == NULL) { + error("Unknown device '%c%c'\n", xp[0], xp[1]); + return NULL; + } - // Extract the optional unit number from the specification. - // hd(unit) or hd(unit, part). + // Extract the optional unit number from the specification. + // hd(unit) or hd(unit, part). - i = 0; - while (*cp >= '0' && *cp <= '9') - { - i = i * 10 + *cp++ - '0'; - unit = i; - } + i = 0; + while (*cp >= '0' && *cp <= '9') { + i = i * 10 + *cp++ - '0'; + unit = i; + } + // Unit is no longer optional and never really was. // If the user failed to specify it then the unit number from the previous kernDev // would have been used which makes little sense anyway. // For example, if the user did fd()/foobar and the current root device was the // second hard disk (i.e. unit 1) then fd() would select the second floppy drive! - if(unit == -1) - return NULL; + if (unit == -1) { + return NULL; + } - // Extract the optional partition number from the specification. + // Extract the optional partition number from the specification. - if (*cp == ',') - part = atoi(++cp); + if (*cp == ',') { + part = atoi(++cp); + } - // If part is not specified part will be -1 whereas before it would have been - // whatever the last partition was which makes about zero sense if the device - // has been switched. + // If part is not specified part will be -1 whereas before it would have been + // whatever the last partition was which makes about zero sense if the device + // has been switched. - // Skip past the right paren. + // Skip past the right paren. - for ( ; *cp && *cp != RP; cp++) /* LOOP */; - if (*cp == RP) cp++; + for ( ; *cp && *cp != RP; cp++) /* LOOP */; + + if (*cp == RP) { + cp++; + } - biosdev = dp->biosdev + unit; - bvr = newBootVolumeRef(biosdev, part); + biosdev = dp->biosdev + unit; - if(bvr == NULL) - return NULL; - } - else - { - // Bad device specifier, skip past the right paren. + bvr = newBootVolumeRef(biosdev, part); - for ( cp++; *cp && *cp != RP; cp++) /* LOOP */; - if (*cp == RP) cp++; - // If gRootVolume was NULL, then bvr will be NULL as well which - // should be caught by the caller. - } + if (bvr == NULL) { + return NULL; + } + } else { + // Bad device specifier, skip past the right paren. - // Returns the file path following the device spec. - // e.g. 'hd(1,b)mach_kernel' is reduced to 'mach_kernel'. + for (cp++; *cp && *cp != RP; cp++) /* LOOP */; + { + if (*cp == RP) { + cp++; + } + } - *outPath = cp; + // If gRootVolume was NULL, then bvr will be NULL as well which + // should be caught by the caller. + } - return bvr; + // Returns the file path following the device spec. + // e.g. 'hd(1,b)mach_kernel' is reduced to 'mach_kernel'. + + *outPath = cp; + + return bvr; } //========================================================================== @@ -1032,21 +1118,18 @@ bvr = bvr1 = NULL; - // Try resolving "rd" and "bt" devices first. - if (biosdev == kPseudoBIOSDevRAMDisk) - { - if (gRAMDiskVolume) - bvr1 = gRAMDiskVolume; - } - else if (biosdev == kPseudoBIOSDevBooter) - { - if (gRAMDiskVolume != NULL && gRAMDiskBTAliased) + // Try resolving "rd" and "bt" devices first. + if (biosdev == kPseudoBIOSDevRAMDisk) { + if (gRAMDiskVolume) { bvr1 = gRAMDiskVolume; - else + } + } else if (biosdev == kPseudoBIOSDevBooter) { + if (gRAMDiskVolume != NULL && gRAMDiskBTAliased) { + bvr1 = gRAMDiskVolume; + } else { bvr1 = gBIOSBootVolume; - } - else - { + } + } else { // Fetch the volume list from the device. scanBootVolumes( biosdev, NULL ); @@ -1054,12 +1137,15 @@ // Look for a perfect match based on device and partition number. - for ( bvr1 = NULL, bvr = bvrChain; bvr; bvr = bvr->next ) - { - if ( ( bvr->flags & kBVFlagNativeBoot ) == 0 ) continue; + for ( bvr1 = NULL, bvr = bvrChain; bvr; bvr = bvr->next ) { + if ( ( bvr->flags & kBVFlagNativeBoot ) == 0 ) { + continue; + } bvr1 = bvr; - if ( bvr->part_no == partno ) break; + if ( bvr->part_no == partno ) { + break; + } } } @@ -1072,20 +1158,21 @@ // Returns length of the out string int getDeviceDescription(BVRef bvr, char *str) { - if(!str) - return 0; + if(!str) { + return 0; + } *str = '\0'; - if (bvr) - { - const struct devsw *dp = devsw; - while(dp->name && bvr->biosdev >= dp->biosdev) - dp++; - + if (bvr) { + const struct devsw *dp = devsw; + while(dp->name && bvr->biosdev >= dp->biosdev) { + dp++; + } dp--; - if (dp->name) - return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no); + if (dp->name) { + return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no); + } } return 0; Index: branches/ErmaC/Enoch/i386/libsaio/load.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/load.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/load.c (revision 2323) @@ -32,6 +32,15 @@ #include +/* + * Backward compatibility fix for the SDK 10.7 version of loader.h + */ + +#ifndef LC_MAIN + #define LC_MAIN (0x28|LC_REQ_DYLD) /* replacement for LC_UNIXTHREAD */ +#endif + + static long DecodeSegment(long cmdBase, unsigned int*load_addr, unsigned int *load_size); static long DecodeUnixThread(long cmdBase, unsigned int *entry); static long DecodeSymbolTable(long cmdBase); @@ -41,238 +50,287 @@ bool gHaveKernelCache; /* XXX aserebln: uninitialized? and only set to true, never to false */ cpu_type_t archCpuType=CPU_TYPE_I386; -// Public Functions +//============================================================================== +// Public function. + long ThinFatFile(void **binary, unsigned long *length) { - unsigned long nfat, swapped, size = 0; - struct fat_header *fhp = (struct fat_header *)*binary; - struct fat_arch *fap = - (struct fat_arch *)((unsigned long)*binary + sizeof(struct fat_header)); - cpu_type_t fapcputype; - uint32_t fapoffset; - uint32_t fapsize; + unsigned long nfat, swapped, size = 0; + struct fat_header *fhp = (struct fat_header *)*binary; + struct fat_arch *fap = (struct fat_arch *)((unsigned long)*binary + sizeof(struct fat_header)); + cpu_type_t fapcputype; + uint32_t fapoffset; + uint32_t fapsize; - if (fhp->magic == FAT_MAGIC) { - nfat = fhp->nfat_arch; - swapped = 0; - } else if (fhp->magic == FAT_CIGAM) { - nfat = OSSwapInt32(fhp->nfat_arch); - swapped = 1; - } else { - return -1; - } - - for (; nfat > 0; nfat--, fap++) { - if (swapped) { - fapcputype = OSSwapInt32(fap->cputype); - fapoffset = OSSwapInt32(fap->offset); - fapsize = OSSwapInt32(fap->size); - } + if (fhp->magic == FAT_MAGIC) + { + nfat = fhp->nfat_arch; + swapped = 0; + } + else if (fhp->magic == FAT_CIGAM) + { + nfat = OSSwapInt32(fhp->nfat_arch); + swapped = 1; + } else { - fapcputype = fap->cputype; - fapoffset = fap->offset; - fapsize = fap->size; + return -1; } - - if (fapcputype == archCpuType) { - *binary = (void *) ((unsigned long)*binary + fapoffset); - size = fapsize; - break; - } - } - - if (length != 0) *length = size; - - return 0; + + for (; nfat > 0; nfat--, fap++) + { + if (swapped) + { + fapcputype = OSSwapInt32(fap->cputype); + fapoffset = OSSwapInt32(fap->offset); + fapsize = OSSwapInt32(fap->size); + } + else + { + fapcputype = fap->cputype; + fapoffset = fap->offset; + fapsize = fap->size; + } + + if (fapcputype == archCpuType) + { + *binary = (void *) ((unsigned long)*binary + fapoffset); + size = fapsize; + break; + } + } + + if (length != 0) + { + *length = size; + } + + return 0; } + +//============================================================================== + long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize) { - struct mach_header *mH; - unsigned long ncmds, cmdBase, cmd, cmdsize, cmdstart; - // long headerBase, headerAddr, headerSize; - unsigned int vmaddr = ~0; - unsigned int vmend = 0; - unsigned long cnt; - long ret = -1; - unsigned int entry = 0; - - gBinaryAddress = (unsigned long)binary; - - mH = (struct mach_header *)(gBinaryAddress); - switch (archCpuType) + struct mach_header *mH; + unsigned long ncmds, cmdBase, cmd, cmdsize, cmdstart; + // long headerBase, headerAddr, headerSize; + unsigned int vmaddr = ~0; + unsigned int vmend = 0; + unsigned long cnt; + long ret = -1; + unsigned int entry = 0; + + gBinaryAddress = (unsigned long)binary; + mH = (struct mach_header *)(gBinaryAddress); + +#if DEBUG + printf("magic: %x\n", (unsigned)mH->magic); + printf("cputype: %x\n", (unsigned)mH->cputype); + printf("cpusubtype: %x\n", (unsigned)mH->cpusubtype); + printf("filetype: %x\n", (unsigned)mH->filetype); + printf("ncmds: %x\n", (unsigned)mH->ncmds); + printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds); + printf("flags: %x\n", (unsigned)mH->flags); + getchar(); +#endif + + switch (archCpuType) { case CPU_TYPE_I386: - if (mH->magic != MH_MAGIC) { + + if (mH->magic != MH_MAGIC) + { error("Mach-O file has bad magic number\n"); return -1; } + cmdstart = (unsigned long)gBinaryAddress + sizeof(struct mach_header); break; + case CPU_TYPE_X86_64: - if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) + + if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) + { return -1; - if (mH->magic != MH_MAGIC_64) { + } + + if (mH->magic != MH_MAGIC_64) + { error("Mach-O file has bad magic number\n"); return -1; } + cmdstart = (unsigned long)gBinaryAddress + sizeof(struct mach_header_64); break; + default: + error("Unknown CPU type\n"); return -1; } - - cmdBase = cmdstart; -#if DEBUG - printf("magic: %x\n", (unsigned)mH->magic); - printf("cputype: %x\n", (unsigned)mH->cputype); - printf("cpusubtype: %x\n", (unsigned)mH->cpusubtype); - printf("filetype: %x\n", (unsigned)mH->filetype); - printf("ncmds: %x\n", (unsigned)mH->ncmds); - printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds); - printf("flags: %x\n", (unsigned)mH->flags); - getchar(); -#endif - - ncmds = mH->ncmds; - - for (cnt = 0; cnt < ncmds; cnt++) { - cmd = ((long *)cmdBase)[0]; - cmdsize = ((long *)cmdBase)[1]; - unsigned int load_addr; - unsigned int load_size; - - switch (cmd) { - case LC_SEGMENT_64: - case LC_SEGMENT: - ret = DecodeSegment(cmdBase, &load_addr, &load_size); - if (ret == 0 && load_size != 0 && load_addr >= KERNEL_ADDR) { - vmaddr = MIN(vmaddr, load_addr); - vmend = MAX(vmend, load_addr + load_size); - } - break; - - case LC_UNIXTHREAD: - ret = DecodeUnixThread(cmdBase, &entry); - break; + cmdBase = cmdstart; + ncmds = mH->ncmds; - case LC_SYMTAB: - break; - - default: + for (cnt = 0; cnt < ncmds; cnt++) + { + cmd = ((long *)cmdBase)[0]; + cmdsize = ((long *)cmdBase)[1]; + unsigned int load_addr; + unsigned int load_size; + + switch (cmd) + { + case LC_SEGMENT: + case LC_SEGMENT_64: + + ret = DecodeSegment(cmdBase, &load_addr, &load_size); + + if (ret == 0 && load_size != 0 && load_addr >= KERNEL_ADDR) + { + vmaddr = MIN(vmaddr, load_addr); + vmend = MAX(vmend, load_addr + load_size); + } + break; + + case LC_MAIN: /* Mountain Lion's replacement for LC_UNIXTHREAD */ + case LC_UNIXTHREAD: + ret = DecodeUnixThread(cmdBase, &entry); + break; + + case LC_SYMTAB: + break; + + default: #if NOTDEF - printf("Ignoring cmd type %d.\n", (unsigned)cmd); + printf("Ignoring cmd type %d.\n", (unsigned)cmd); #endif - break; - } - - if (ret != 0) return -1; - - cmdBase += cmdsize; - } - - *rentry = (entry_t)( (unsigned long) entry & 0x3fffffff ); - *rsize = vmend - vmaddr; - *raddr = (char *)vmaddr; - - cmdBase = cmdstart; - for (cnt = 0; cnt < ncmds; cnt++) { + break; + } + + + if (ret != 0) + { + return -1; + } + + cmdBase += cmdsize; + } + + *rentry = (entry_t)( (unsigned long) entry & 0x3fffffff ); + *rsize = vmend - vmaddr; + *raddr = (char *)vmaddr; + + cmdBase = cmdstart; + + for (cnt = 0; cnt < ncmds; cnt++) +{ cmd = ((long *)cmdBase)[0]; cmdsize = ((long *)cmdBase)[1]; - if(cmd==LC_SYMTAB) - if (DecodeSymbolTable(cmdBase)!=0) - return -1; - - cmdBase += cmdsize; - } + if (cmd == LC_SYMTAB) + { + if (DecodeSymbolTable(cmdBase) != 0) + { + return -1; + } + } + + cmdBase += cmdsize; + } - return ret; + return ret; } -// Private Functions +//============================================================================== +// Private function. + + static long DecodeSegment(long cmdBase, unsigned int *load_addr, unsigned int *load_size) { - unsigned long vmaddr, fileaddr; - long vmsize, filesize; - char *segname; - - if (((long *)cmdBase)[0]==LC_SEGMENT_64) - { - struct segment_command_64 *segCmd; - - segCmd = (struct segment_command_64 *)cmdBase; - - vmaddr = (segCmd->vmaddr & 0x3fffffff); - vmsize = segCmd->vmsize; - fileaddr = (gBinaryAddress + segCmd->fileoff); - filesize = segCmd->filesize; + char *segname; + long vmsize, filesize; + unsigned long vmaddr, fileaddr; - segname=segCmd->segname; + if (((long *)cmdBase)[0] == LC_SEGMENT_64) + { + struct segment_command_64 *segCmd; + segCmd = (struct segment_command_64 *)cmdBase; + vmaddr = (segCmd->vmaddr & 0x3fffffff); + vmsize = segCmd->vmsize; + fileaddr = (gBinaryAddress + segCmd->fileoff); + filesize = segCmd->filesize; + segname = segCmd->segname; #ifdef DEBUG printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n", segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize, (unsigned) segCmd->nsects, (unsigned)segCmd->flags); getchar(); -#endif - } - else - { - struct segment_command *segCmd; +#endif + } + else + { + struct segment_command *segCmd; - segCmd = (struct segment_command *)cmdBase; - - vmaddr = (segCmd->vmaddr & 0x3fffffff); - vmsize = segCmd->vmsize; - fileaddr = (gBinaryAddress + segCmd->fileoff); - filesize = segCmd->filesize; - - segname=segCmd->segname; + segCmd = (struct segment_command *)cmdBase; + vmaddr = (segCmd->vmaddr & 0x3fffffff); + vmsize = segCmd->vmsize; + fileaddr = (gBinaryAddress + segCmd->fileoff); + filesize = segCmd->filesize; + segname = segCmd->segname; + #ifdef DEBUG - printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n", - segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize, - (unsigned) segCmd->nsects, (unsigned)segCmd->flags); - getchar(); -#endif - } + printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n", + segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize, (unsigned) segCmd->nsects, (unsigned)segCmd->flags); + getchar(); +#endif + } - if (vmsize == 0 || filesize == 0) { - *load_addr = ~0; - *load_size = 0; - return 0; - } - - if (! ((vmaddr >= KERNEL_ADDR && - (vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) || - (vmaddr >= HIB_ADDR && - (vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) { - stop("Kernel overflows available space"); - } - - if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0))) - gHaveKernelCache = true; - - // Copy from file load area. - if (vmsize>0 && filesize>0) - bcopy((char *)fileaddr, (char *)vmaddr, vmsize>filesize?filesize:vmsize); - - // Zero space at the end of the segment. - if (vmsize > filesize) - bzero((char *)(vmaddr + filesize), vmsize - filesize); + if (vmsize == 0 || filesize == 0) + { + *load_addr = ~0; + *load_size = 0; + return 0; + } - *load_addr = vmaddr; - *load_size = vmsize; + if (! ((vmaddr >= KERNEL_ADDR && (vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) || + (vmaddr >= HIB_ADDR && (vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) + { + stop("Kernel overflows available space"); + } - return 0; + if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0))) + { + gHaveKernelCache = true; + } + + // Copy from file load area. + if (vmsize>0 && filesize > 0) + { + bcopy((char *)fileaddr, (char *)vmaddr, vmsize > filesize ? filesize : vmsize); + } + + // Zero space at the end of the segment. + if (vmsize > filesize) + { + bzero((char *)(vmaddr + filesize), vmsize - filesize); + } + + *load_addr = vmaddr; + *load_size = vmsize; + + return 0; } + +//============================================================================== + static long DecodeUnixThread(long cmdBase, unsigned int *entry) { switch (archCpuType) @@ -280,10 +338,8 @@ case CPU_TYPE_I386: { i386_thread_state_t *i386ThreadState; - - i386ThreadState = (i386_thread_state_t *) - (cmdBase + sizeof(struct thread_command) + 8); - + i386ThreadState = (i386_thread_state_t *) (cmdBase + sizeof(struct thread_command) + 8); + *entry = i386ThreadState->eip; return 0; } @@ -291,10 +347,7 @@ case CPU_TYPE_X86_64: { x86_thread_state64_t *x86_64ThreadState; - - x86_64ThreadState = (x86_thread_state64_t *) - (cmdBase + sizeof(struct thread_command) + 8); - + x86_64ThreadState = (x86_thread_state64_t *) (cmdBase + sizeof(struct thread_command) + 8); *entry = x86_64ThreadState->rip; return 0; } @@ -305,38 +358,42 @@ } } + +//============================================================================== + static long DecodeSymbolTable(long cmdBase) { - struct symtab_command *symTab, *symTableSave; - long tmpAddr, symsSize, totalSize; - long gSymbolTableAddr; - long gSymbolTableSize; + long tmpAddr, symsSize, totalSize; + long gSymbolTableAddr; + long gSymbolTableSize; - symTab = (struct symtab_command *)cmdBase; - + struct symtab_command *symTab, *symTableSave; + + symTab = (struct symtab_command *)cmdBase; + #if DEBUG - printf("symoff: %x, nsyms: %x, stroff: %x, strsize: %x\n", - symTab->symoff, symTab->nsyms, symTab->stroff, symTab->strsize); - getchar(); + + printf("symoff: %x, nsyms: %x, stroff: %x, strsize: %x\n", symTab->symoff, symTab->nsyms, symTab->stroff, symTab->strsize); + getchar(); #endif - - symsSize = symTab->stroff - symTab->symoff; - totalSize = symsSize + symTab->strsize; - - gSymbolTableSize = totalSize + sizeof(struct symtab_command); - gSymbolTableAddr = AllocateKernelMemory(gSymbolTableSize); - // Add the SymTab to the memory-map. - AllocateMemoryRange("Kernel-__SYMTAB", gSymbolTableAddr, gSymbolTableSize, -1); - - symTableSave = (struct symtab_command *)gSymbolTableAddr; - tmpAddr = gSymbolTableAddr + sizeof(struct symtab_command); - - symTableSave->symoff = tmpAddr; - symTableSave->nsyms = symTab->nsyms; - symTableSave->stroff = tmpAddr + symsSize; - symTableSave->strsize = symTab->strsize; + + symsSize = symTab->stroff - symTab->symoff; + totalSize = symsSize + symTab->strsize; + + gSymbolTableSize = totalSize + sizeof(struct symtab_command); + gSymbolTableAddr = AllocateKernelMemory(gSymbolTableSize); + // Add the SymTab to the memory-map. + AllocateMemoryRange("Kernel-__SYMTAB", gSymbolTableAddr, gSymbolTableSize, -1); + + symTableSave = (struct symtab_command *)gSymbolTableAddr; + tmpAddr = gSymbolTableAddr + sizeof(struct symtab_command); + + symTableSave->symoff = tmpAddr; + symTableSave->nsyms = symTab->nsyms; + symTableSave->stroff = tmpAddr + symsSize; + symTableSave->strsize = symTab->strsize; - bcopy((char *)(gBinaryAddress + symTab->symoff), - (char *)tmpAddr, totalSize); - return 0; + bcopy((char *)(gBinaryAddress + symTab->symoff), (char *)tmpAddr, totalSize); + + return 0; } Index: branches/ErmaC/Enoch/i386/libsaio/nvidia.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/nvidia.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/nvidia.h (revision 2323) @@ -69,7 +69,8 @@ #define DCB_MAX_NUM_ENTRIES 16 #define DCB_MAX_NUM_I2C_ENTRIES 16 - +#define DCB_MAX_NUM_GPIO_ENTRIES 32 +#define DCB_MAX_NUM_CONNECTOR_ENTRIES 16 #define DCB_LOC_ON_CHIP 0 struct bios { @@ -77,21 +78,22 @@ uint8_t size; /* Size in multiples of 512 */ }; -#define NV_PMC_OFFSET 0x000000 -#define NV_PMC_SIZE 0x2ffff +#define NV_PMC_OFFSET 0x00000000 +#define NV_PMC_SIZE 0x00001000 // 0x2ffff #define NV_PDISPLAY_OFFSET 0x610000 #define NV_PDISPLAY_SIZE 0x10000 -#define NV_PROM_OFFSET 0x300000 -#define NV_PROM_SIZE 0x0000ffff +#define NV_PROM_OFFSET 0x00300000 +#define NV_PROM_SIZE 0x00010000 #define NV_PRAMIN_OFFSET 0x00700000 #define NV_PRAMIN_SIZE 0x00100000 #define NV04_PFB_FIFO_DATA 0x0010020c -#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK 0xfff00000 -#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT 20 -#define NVC0_MEM_CTRLR_COUNT 0x00121c74 -#define NVC0_MEM_CTRLR_RAM_AMOUNT 0x0010f20c +#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK 0xfff00000 +#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT 20 +#define NVC0_MEM_CTRLR_RAM_AMOUNT 0x0010f20c +#define NVC0_MEM_CTRLR_COUNT 0x00121c74 +#define NV_PBUS_PCI_NV_19 0x0000184C #define NV_PBUS_PCI_NV_20 0x00001850 #define NV_PBUS_PCI_NV_20_ROM_SHADOW_DISABLED (0 << 0) #define NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED (1 << 0) @@ -108,6 +110,8 @@ #define NV_ARCH_40 0x40 #define NV_ARCH_50 0x50 #define NV_ARCH_C0 0xC0 +#define NV_ARCH_D0 0xD0 +#define NV_ARCH_E0 0xE0 #define CHIPSET_NV03 0x0010 #define CHIPSET_NV04 0x0020 Index: branches/ErmaC/Enoch/i386/libsaio/sl.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/sl.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/sl.h (revision 2323) @@ -39,22 +39,22 @@ // File Permissions and Types enum { - kPermOtherExecute = 1 << 0, - kPermOtherWrite = 1 << 1, - kPermOtherRead = 1 << 2, - kPermGroupExecute = 1 << 3, - kPermGroupWrite = 1 << 4, - kPermGroupRead = 1 << 5, - kPermOwnerExecute = 1 << 6, - kPermOwnerWrite = 1 << 7, - kPermOwnerRead = 1 << 8, - kPermMask = 0x1FF, - kOwnerNotRoot = 1 << 9, - kFileTypeUnknown = 0x0 << 16, - kFileTypeFlat = 0x1 << 16, - kFileTypeDirectory = 0x2 << 16, - kFileTypeLink = 0x3 << 16, - kFileTypeMask = 0x3 << 16 + kPermOtherExecute = 1 << 0, + kPermOtherWrite = 1 << 1, + kPermOtherRead = 1 << 2, + kPermGroupExecute = 1 << 3, + kPermGroupWrite = 1 << 4, + kPermGroupRead = 1 << 5, + kPermOwnerExecute = 1 << 6, + kPermOwnerWrite = 1 << 7, + kPermOwnerRead = 1 << 8, + kPermMask = 0x1FF, + kOwnerNotRoot = 1 << 9, + kFileTypeUnknown = 0x0 << 16, + kFileTypeFlat = 0x1 << 16, + kFileTypeDirectory = 0x2 << 16, + kFileTypeLink = 0x3 << 16, + kFileTypeMask = 0x3 << 16 }; #define Seek(c, p) diskSeek(c, p); Index: branches/ErmaC/Enoch/i386/libsaio/platform.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/platform.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/platform.c (revision 2323) @@ -37,30 +37,34 @@ } /** scan mem for memory autodection purpose */ -void scan_mem() { - static bool done = false; - if (done) return; +void scan_mem() +{ + static bool done = false; + if (done) { + return; + } /* our code only works on Intel chipsets so make sure here */ - if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086) + if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086) { bootInfo->memDetect = false; - else + } else { bootInfo->memDetect = true; + } /* manually */ - getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->chameleonConfig); + getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->chameleonConfig); - if (bootInfo->memDetect) { + if (bootInfo->memDetect) { if (dram_controller_dev != NULL) { scan_dram_controller(dram_controller_dev); // Rek: pci dev ram controller direct and fully informative scan ... } - scan_spd(&Platform); - } - done = true; + scan_spd(&Platform); + } + done = true; } -/** - Scan platform hardware information, called by the main entry point (common_boot() ) - _before_ bootConfig xml parsing settings are loaded +/* + * Scan platform hardware information, called by the main entry point (common_boot() ) + * _before_ bootConfig xml parsing settings are loaded */ void scan_platform(void) { Index: branches/ErmaC/Enoch/i386/libsaio/cpu.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/cpu.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/cpu.c (revision 2323) @@ -242,17 +242,23 @@ */ void scan_cpu(PlatformInfo_t *p) { - uint64_t tscFrequency, fsbFrequency, cpuFrequency; - uint64_t msr, flex_ratio; - uint8_t maxcoef, maxdiv, currcoef, bus_ratio_max, currdiv; + uint64_t tscFrequency = 0; + uint64_t fsbFrequency = 0; + uint64_t cpuFrequency = 0; + uint64_t msr = 0; + uint64_t flex_ratio = 0; + uint32_t max_ratio = 0; + uint32_t min_ratio = 0; + uint8_t bus_ratio_max = 0; + uint8_t currdiv = 0; + uint8_t currcoef = 0; + uint8_t maxdiv = 0; + uint8_t maxcoef = 0; const char *newratio; - int len, myfsb; - uint8_t bus_ratio_min; - uint32_t max_ratio, min_ratio; + int len = 0; + int myfsb = 0; + uint8_t bus_ratio_min = 0; - max_ratio = min_ratio = myfsb = bus_ratio_min = 0; - maxcoef = maxdiv = bus_ratio_max = currcoef = currdiv = 0; - /* get cpuid values */ do_cpuid(0x00000000, p->CPU.CPUID[CPUID_0]); do_cpuid(0x00000001, p->CPU.CPUID[CPUID_1]); @@ -291,7 +297,7 @@ } #endif -/* +/* http://www.flounder.com/cpuid_explorer2.htm EAX (Intel): 31 28 27 20 19 16 1514 1312 11 8 7 4 3 0 +--------+----------------+--------+----+----+--------+--------+--------+ @@ -310,6 +316,7 @@ p->CPU.Stepping = bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0); p->CPU.Model = bitfield(p->CPU.CPUID[CPUID_1][0], 7, 4); p->CPU.Family = bitfield(p->CPU.CPUID[CPUID_1][0], 11, 8); + p->CPU.Type = bitfield(p->CPU.CPUID[CPUID_1][0], 13, 12); p->CPU.ExtModel = bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16); p->CPU.ExtFamily = bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20); @@ -413,19 +420,23 @@ } tscFrequency = measure_tsc_frequency(); + DBG("cpu freq classic = 0x%016llx\n", tscFrequency); /* if usual method failed */ if ( tscFrequency < 1000 )//TEST { - tscFrequency = timeRDTSC() * 20; + tscFrequency = timeRDTSC() * 20;//measure_tsc_frequency(); + // DBG("cpu freq timeRDTSC = 0x%016llx\n", tscFrequency); } + else + { + // DBG("cpu freq timeRDTSC = 0x%016llxn", timeRDTSC() * 20); + } fsbFrequency = 0; cpuFrequency = 0; - if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) - { + if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) { int intelCPU = p->CPU.Model; - if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) - { + if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) { /* Nehalem CPU model */ if (p->CPU.Family == 0x06 && (p->CPU.Model == CPU_MODEL_NEHALEM || p->CPU.Model == CPU_MODEL_FIELDS || @@ -529,9 +540,7 @@ myfsb = fsbFrequency / 1000000; verbose("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", myfsb, max_ratio/10); currcoef = bus_ratio_max; - } - else - { + } else { msr = rdmsr64(MSR_IA32_PERF_STATUS); DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, bitfield(msr, 31, 0)); currcoef = bitfield(msr, 12, 8); @@ -576,15 +585,11 @@ } } /* Mobile CPU */ - if (rdmsr64(MSR_IA32_PLATFORM_ID) & (1<<28)) - { + if (rdmsr64(MSR_IA32_PLATFORM_ID) & (1<<28)) { p->CPU.Features |= CPU_FEATURE_MOBILE; } - } - else if ((p->CPU.Vendor == CPUID_VENDOR_AMD) && (p->CPU.Family == 0x0f)) - { - switch(p->CPU.ExtFamily) - { + } else if ((p->CPU.Vendor == CPUID_VENDOR_AMD) && (p->CPU.Family == 0x0f)) { + switch(p->CPU.ExtFamily) { case 0x00: /* K8 */ msr = rdmsr64(K8_FIDVID_STATUS); maxcoef = bitfield(msr, 21, 16) / 2 + 4; @@ -622,47 +627,31 @@ break; } - if (maxcoef) - { - if (currdiv) - { - if (!currcoef) - { + if (maxcoef) { + if (currdiv) { + if (!currcoef) { currcoef = maxcoef; } - if (!cpuFrequency) - { + if (!cpuFrequency) { fsbFrequency = ((tscFrequency * currdiv) / currcoef); - } - else - { + } else { fsbFrequency = ((cpuFrequency * currdiv) / currcoef); } DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); - } - else - { - if (!cpuFrequency) - { + } else { + if (!cpuFrequency) { fsbFrequency = (tscFrequency / maxcoef); - } - else - { + } else { fsbFrequency = (cpuFrequency / maxcoef); } DBG("%d\n", currcoef); } - } - else if (currcoef) - { - if (currdiv) - { + } else if (currcoef) { + if (currdiv) { fsbFrequency = ((tscFrequency * currdiv) / currcoef); DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); - } - else - { + } else { fsbFrequency = (tscFrequency / currcoef); DBG("%d\n", currcoef); } @@ -677,6 +666,9 @@ cpuFrequency = tscFrequency; DBG("0 ! using the default value for FSB !\n"); } + + DBG("cpu freq = 0x%016llxn", timeRDTSC() * 20); + #endif p->CPU.MaxCoef = maxcoef; @@ -688,16 +680,43 @@ p->CPU.CPUFrequency = cpuFrequency; // keep formatted with spaces instead of tabs - DBG("CPU: Brand String: %s\n", p->CPU.BrandString); - DBG("CPU: Vendor/Family/ExtFamily: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Family, p->CPU.ExtFamily); - DBG("CPU: Model/ExtModel/Stepping: 0x%x/0x%x/0x%x\n", p->CPU.Model, p->CPU.ExtModel, p->CPU.Stepping); - DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef); - DBG("CPU: MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv); - DBG("CPU: TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000); - DBG("CPU: FSBFreq: %dMHz\n", p->CPU.FSBFrequency / 1000000); - DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000); - DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads); - DBG("CPU: Features: 0x%08x\n", p->CPU.Features); + DBG("\n---------------------------------------------\n"); + DBG("--------------- CPU INFO --------------------\n"); + DBG("---------------------------------------------\n"); + DBG("Brand String: %s\n", p->CPU.BrandString); // Processor name (BIOS) + DBG("Vendor: 0x%x\n", p->CPU.Vendor); // Vendor ex: GenuineIntel + DBG("Family: 0x%x\n", p->CPU.Family); // Family ex: 6 (06h) + DBG("ExtFamily: 0x%x\n", p->CPU.ExtFamily); + DBG("Signature: %x\n", p->CPU.Signature); // CPUID signature + switch (p->CPU.Type) + { + case PT_OEM: + DBG("Processor type: Intel Original OEM Processor\n"); + break; + case PT_OD: + DBG("Processor type: Intel Over Drive Processor\n"); + break; + case PT_DUAL: + DBG("Processor type: Intel Dual Processor\n"); + break; + case PT_RES: + DBG("Processor type: Intel Reserved\n"); + break; + default: + break; + } + DBG("Model: 0x%x\n", p->CPU.Model); // Model ex: 37 (025h) + DBG("ExtModel: 0x%x\n", p->CPU.ExtModel); + DBG("Stepping: 0x%x\n", p->CPU.Stepping); // Stepping ex: 5 (05h) + DBG("MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef); + DBG("MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv); + DBG("TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000); + DBG("FSBFreq: %dMHz\n", (p->CPU.FSBFrequency + 500000) / 1000000); + DBG("CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000); + DBG("Cores: %d\n", p->CPU.NoCores); // Cores + DBG("Logical processor: %d\n", p->CPU.NoThreads); // Logical procesor + DBG("Features: 0x%08x\n", p->CPU.Features); + DBG("\n---------------------------------------------\n"); #if DEBUG_CPU pause(); #endif Index: branches/ErmaC/Enoch/i386/libsaio/platform.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/platform.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/platform.h (revision 2323) @@ -129,12 +129,15 @@ uint8_t BankConnCnt; } RamSlotInfo_t; +//============================================================================== + typedef struct _PlatformInfo_t { struct CPU { uint32_t Features; // CPU Features like MMX, SSE2, VT, MobileCPU uint32_t Vendor; // Vendor - uint32_t Signature; // Signature + uint32_t Signature; // Processor Signature uint32_t Stepping; // Stepping + uint32_t Type; // Type uint32_t Model; // Model uint32_t ExtModel; // Extended Model uint32_t Family; // Family @@ -168,13 +171,13 @@ } RAM; struct DMI { - int MaxMemorySlots; // number of memory slots populated by SMBIOS - int CntMemorySlots; // number of memory slots counted - int MemoryModules; // number of memory modules installed - int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot + int MaxMemorySlots; // number of memory slots populated by SMBIOS + int CntMemorySlots; // number of memory slots counted + int MemoryModules; // number of memory modules installed + int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot } DMI; - uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) + uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) uint8_t *UUID; } PlatformInfo_t; Index: branches/ErmaC/Enoch/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2323) @@ -139,84 +139,103 @@ static int getDriveInfo( int biosdev, struct driveInfo *dip ) { - static struct driveInfo cached_di; - int cc; - - // Real BIOS devices are 8-bit, so anything above that is for internal use. - // Don't cache ramdisk drive info since it doesn't require several BIOS - // calls and is thus not worth it. - if(biosdev >= 0x100) - { - if(p_get_ramdisk_info != NULL) - cc = (*p_get_ramdisk_info)(biosdev, dip); - else - cc = -1; - if(cc < 0) - { - dip->valid = 0; - return -1; - } - else - return 0; - } + static struct driveInfo cached_di; + int cc; - if ( !cached_di.valid || biosdev != cached_di.biosdev ) - { - cc = get_drive_info(biosdev, &cached_di); - if (cc < 0) { - cached_di.valid = 0; - DEBUG_DISK(("get_drive_info returned error\n")); - return (-1); // BIOS call error + // Real BIOS devices are 8-bit, so anything above that is for internal use. + // Don't cache ramdisk drive info since it doesn't require several BIOS + // calls and is thus not worth it. + if (biosdev >= 0x100) + { + if (p_get_ramdisk_info != NULL) + { + cc = (*p_get_ramdisk_info)(biosdev, dip); + } + else + { + cc = -1; + } + if (cc < 0) + { + dip->valid = 0; + return -1; + } + else + { + return 0; + } } - } - bcopy(&cached_di, dip, sizeof(cached_di)); + if (!cached_di.valid || biosdev != cached_di.biosdev) + { + cc = get_drive_info(biosdev, &cached_di); - return 0; + if (cc < 0) + { + cached_di.valid = 0; + DEBUG_DISK(("get_drive_info returned error\n")); + return (-1); // BIOS call error + } + } + + bcopy(&cached_di, dip, sizeof(cached_di)); + + return 0; } //========================================================================== // Maps (E)BIOS return codes to message strings. struct NamedValue { - unsigned char value; - const char * name; + 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++) - if (np->value == value) - return np->name; + for ( np = nameTable; np->value; np++) + { + if (np->value == value) + { + return np->name; + } + } - return NULL; + 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 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) { - static char errorstr[] = "Error 0x00"; - const char * errname; + static char errorstr[] = "Error 0x00"; + const char * errname; - errname = getNameForValue( bios_errors, errnum ); - if ( errname ) return errname; + errname = getNameForValue(bios_errors, errnum); - sprintf(errorstr, "Error 0x%02x", errnum); - return errorstr; // No string, print error code only + if (errname) + { + return errname; + } + + sprintf(errorstr, "Error 0x%02x", errnum); + return errorstr; // No string, print error code only } //========================================================================== @@ -231,272 +250,283 @@ static int Biosread( int biosdev, unsigned long long secno ) { - static int xbiosdev, xcyl, xhead; - static unsigned int xsec, xnsecs; - struct driveInfo di; + static int xbiosdev, xcyl, xhead; + static unsigned int xsec, xnsecs; + struct driveInfo di; - int rc = -1; - int cyl, head, sec; - int tries = 0; - int bps, divisor; + int rc = -1; + int cyl, head, sec; + int tries = 0; + int bps, divisor; - if (getDriveInfo(biosdev, &di) < 0) { - return -1; - } - if (di.no_emulation) { - /* Always assume 2k block size; BIOS may lie about geometry */ - bps = 2048; - } else { - bps = di.di.params.phys_nbps; - if (bps == 0) { - return -1; - } - } - divisor = bps / BPS; + if (getDriveInfo(biosdev, &di) < 0) + { + return -1; + } - DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps)); + if (di.no_emulation) + { + bps = 2048; /* Always assume 2K block size since the BIOS may lie about the geometry */ + } + else + { + bps = di.di.params.phys_nbps; - // To read the disk sectors, use EBIOS if we can. Otherwise, - // revert to the standard BIOS calls. + if (bps == 0) + { + return -1; + } + } - if ((biosdev >= kBIOSDevTypeHardDrive) && - (di.uses_ebios & EBIOS_FIXED_DISK_ACCESS)) - { - if (cache_valid && - (biosdev == xbiosdev) && - (secno >= xsec) && - ((unsigned int)secno < (xsec + xnsecs))) - { - biosbuf = trackbuf + (BPS * (secno - xsec)); - return 0; - } + divisor = bps / BPS; - xnsecs = N_CACHE_SECS; - xsec = (secno / divisor) * divisor; - cache_valid = false; + DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps)); - while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5)) - { - if (rc == ECC_CORRECTED_ERR) { - /* Ignore corrected ECC errors */ - rc = 0; - break; - } - error(" EBIOS read error: %s\n", bios_error(rc), rc); - error(" Block 0x%x Sectors %d\n", secno, xnsecs); - sleep(1); - } - } - else - { - /* spc = spt * heads */ - int spc = (di.di.params.phys_spt * di.di.params.phys_heads); - cyl = secno / spc; - head = (secno % spc) / di.di.params.phys_spt; - sec = secno % di.di.params.phys_spt; + // To read the disk sectors, use EBIOS if we can. Otherwise, + // revert to the standard BIOS calls. - if (cache_valid && - (biosdev == xbiosdev) && - (cyl == xcyl) && - (head == xhead) && - ((unsigned int)sec >= xsec) && - ((unsigned int)sec < (xsec + xnsecs))) - { - // this sector is in trackbuf cache - biosbuf = trackbuf + (BPS * (sec - xsec)); - return 0; - } + if ((biosdev >= kBIOSDevTypeHardDrive) && (di.uses_ebios & EBIOS_FIXED_DISK_ACCESS)) + { + if (cache_valid && (biosdev == xbiosdev) && (secno >= xsec) && ((unsigned int)secno < (xsec + xnsecs))) + { + biosbuf = trackbuf + (BPS * (secno - xsec)); + return 0; + } - // Cache up to a track worth of sectors, but do not cross a - // track boundary. + xnsecs = N_CACHE_SECS; + xsec = (secno / divisor) * divisor; + cache_valid = false; - xcyl = cyl; - xhead = head; - xsec = sec; - xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS; - cache_valid = false; + while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5)) + { + if (rc == ECC_CORRECTED_ERR) + { + rc = 0; /* Ignore corrected ECC errors */ + break; + } - while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) && - (++tries < 5)) - { - if (rc == ECC_CORRECTED_ERR) { - /* Ignore corrected ECC errors */ - rc = 0; - break; - } - error(" BIOS read error: %s\n", bios_error(rc), rc); - error(" Block %d, Cyl %d Head %d Sector %d\n", - secno, cyl, head, sec); - sleep(1); - } - } + error(" EBIOS read error: %s\n", bios_error(rc), rc); + error(" Block 0x%x Sectors %d\n", secno, xnsecs); + sleep(1); + } + } - // If the BIOS reported success, mark the sector cache as valid. + else + { + /* spc = spt * heads */ + int spc = (di.di.params.phys_spt * di.di.params.phys_heads); + cyl = secno / spc; + head = (secno % spc) / di.di.params.phys_spt; + sec = secno % di.di.params.phys_spt; - if (rc == 0) { - cache_valid = true; - } - biosbuf = trackbuf + (secno % divisor) * BPS; - xbiosdev = biosdev; - - spinActivityIndicator(xnsecs); + if (cache_valid && (biosdev == xbiosdev) && (cyl == xcyl) && + (head == xhead) && ((unsigned int)sec >= xsec) && ((unsigned int)sec < (xsec + xnsecs))) - return rc; + { + // this sector is in trackbuf cache + biosbuf = trackbuf + (BPS * (sec - xsec)); + return 0; + } + + // Cache up to a track worth of sectors, but do not cross a track boundary. + + xcyl = cyl; + xhead = head; + xsec = sec; + xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS; + + cache_valid = false; + + while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) && (++tries < 5)) + { + if (rc == ECC_CORRECTED_ERR) + { + rc = 0; /* Ignore corrected ECC errors */ + break; + } + error(" BIOS read error: %s\n", bios_error(rc), rc); + error(" Block %d, Cyl %d Head %d Sector %d\n", secno, cyl, head, sec); + sleep(1); + } + } + + // If the BIOS reported success, mark the sector cache as valid. + + if (rc == 0) + { + cache_valid = true; + } + + biosbuf = trackbuf + (secno % divisor) * BPS; + xbiosdev = biosdev; + + spinActivityIndicator(xnsecs); + + return rc; } -//========================================================================== -int testBiosread( int biosdev, unsigned long long secno ) +//============================================================================== + +int testBiosread(int biosdev, unsigned long long secno) { return Biosread(biosdev, secno); } -//========================================================================== +//============================================================================== -static int readBytes( int biosdev, unsigned long long blkno, - unsigned int byteoff, - unsigned int byteCount, void * buffer ) +static int readBytes(int biosdev, unsigned long long blkno, unsigned int byteoff, unsigned int byteCount, void * buffer) { - // ramdisks require completely different code for reading. - if(p_ramdiskReadBytes != NULL && biosdev >= 0x100) - return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer); + // ramdisks require completely different code for reading. + if(p_ramdiskReadBytes != NULL && biosdev >= 0x100) + { + return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer); + } - char * cbuf = (char *) buffer; - int error; - int copy_len; + char * cbuf = (char *) buffer; + 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++ ) - { - error = Biosread( biosdev, blkno ); - if ( error ) - { - DEBUG_DISK(("error\n")); - return (-1); - } + for (; byteCount; cbuf += copy_len, blkno++) + { + error = Biosread(biosdev, blkno); - copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount; - bcopy( biosbuf + byteoff, cbuf, copy_len ); - byteCount -= copy_len; - byteoff = 0; - } + if (error) + { + DEBUG_DISK(("error\n")); - DEBUG_DISK(("done\n")); + return (-1); + } - return 0; + copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount; + bcopy( biosbuf + byteoff, cbuf, copy_len ); + byteCount -= copy_len; + byteoff = 0; + } + + DEBUG_DISK(("done\n")); + + return 0; } -//========================================================================== +//============================================================================== static int isExtendedFDiskPartition( const struct fdisk_part * part ) { - static unsigned char extParts[] = - { - 0x05, /* Extended */ - 0x0f, /* Win95 extended */ - 0x85, /* Linux extended */ - }; + static unsigned char extParts[] = + { + 0x05, /* Extended */ + 0x0f, /* Win95 extended */ + 0x85, /* Linux extended */ + }; - unsigned int i; + unsigned int i; - for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++) - { - if (extParts[i] == part->systid) return 1; - } - return 0; + for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++) + { + if (extParts[i] == part->systid) + { + return 1; + } + } + return 0; } -//========================================================================== +//============================================================================== 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 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; - if ( sBiosdev != biosdev || *partno < 0 ) - { - // Fetch MBR. - if ( readBootSector( biosdev, DISK_BLK0, 0 ) ) return 0; + if ( sBiosdev != biosdev || *partno < 0 ) + { + // Fetch MBR. + if ( readBootSector( biosdev, DISK_BLK0, 0 ) ) + { + return 0; + } - sBiosdev = biosdev; - sNextPartNo = 0; - sFirstBase = 0; - sExtBase = 0; - sExtDepth = 0; - sExtPart = NULL; - } + sBiosdev = biosdev; + sNextPartNo = 0; + sFirstBase = 0; + sExtBase = 0; + sExtDepth = 0; + sExtPart = NULL; + } - while (1) - { - part = NULL; + while (1) + { + part = NULL; - if ( sNextPartNo < FDISK_NPART ) - { - part = (struct fdisk_part *) gBootSector->parts[sNextPartNo]; - } - else if ( sExtPart ) - { - unsigned int blkno = sExtPart->relsect + sFirstBase; + if ( sNextPartNo < FDISK_NPART ) + { + part = (struct fdisk_part *) gBootSector->parts[sNextPartNo]; + } + else if ( sExtPart ) + { + unsigned int blkno = sExtPart->relsect + sFirstBase; - // Save the block offset of the first extended partition. + // Save the block offset of the first extended partition. - if (sExtDepth == 0) { - sFirstBase = blkno; - } - sExtBase = blkno; + if (sExtDepth == 0) + { + sFirstBase = blkno; + } + sExtBase = blkno; - // Load extended partition table. + // Load extended partition table. - if ( readBootSector( biosdev, blkno, 0 ) == 0 ) - { - sNextPartNo = 0; - sExtDepth++; - sExtPart = NULL; - continue; - } - // Fall through to part == NULL - } + if ( readBootSector( biosdev, blkno, 0 ) == 0 ) + { + sNextPartNo = 0; + sExtDepth++; + sExtPart = NULL; + continue; + } + // Fall through to part == NULL + } - if ( part == NULL ) break; // Reached end of partition chain. + if ( part == NULL ) break; // Reached end of partition chain. - // Advance to next partition number. + // Advance to next partition number. - sNextPartNo++; + sNextPartNo++; - if ( isExtendedFDiskPartition(part) ) - { - sExtPart = part; - continue; - } + if ( isExtendedFDiskPartition(part) ) + { + sExtPart = part; + continue; + } - // Skip empty slots. + // Skip empty slots. - if ( part->systid == 0x00 ) - { - continue; - } + if ( part->systid == 0x00 ) + { + continue; + } - // Change relative offset to an absolute offset. - part->relsect += sExtBase; + // Change relative offset to an absolute offset. + part->relsect += sExtBase; - *outPart = part; - *partno = sExtDepth ? (int)(sExtDepth + FDISK_NPART) : sNextPartNo; + *outPart = part; + *partno = sExtDepth ? (int)(sExtDepth + FDISK_NPART) : sNextPartNo; - break; - } + break; + } - return (part != NULL); + return (part != NULL); } -//========================================================================== +//============================================================================== static BVRef newFDiskBVRef( int biosdev, int partno, unsigned int blkoff, const struct fdisk_part * part, @@ -509,63 +539,68 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); - if ( bvr ) - { - bzero(bvr, 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->part_type = part->systid; - 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->part_type = part->systid; + 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; - if ((part->bootid & FDISK_ACTIVE) && (part->systid == FDISK_HFS)) - bvr->flags |= kBVFlagPrimary; + if ((part->bootid & FDISK_ACTIVE) && (part->systid == FDISK_HFS)) + { + bvr->flags |= kBVFlagPrimary; + } - // Probe the filesystem. + // Probe the filesystem. - if ( initFunc ) - { - bvr->flags |= kBVFlagNativeBoot; + if ( initFunc ) + { + bvr->flags |= kBVFlagNativeBoot; - if ( probe && initFunc( bvr ) != 0 ) - { - // filesystem probe failed. + if ( probe && initFunc( bvr ) != 0 ) + { + // 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; - } - if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) - { - bvr->flags |= kBVFlagBootable; - } - } - else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) - { - bvr->flags |= kBVFlagForeignBoot; - } - else - { - (*bvr->bv_free)(bvr); - bvr = NULL; - } - } - if (bvr) bvr->flags |= bvrFlags; - return bvr; + (*bvr->bv_free)(bvr); + bvr = NULL; + } + + if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) + { + bvr->flags |= kBVFlagBootable; + } + } + else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) + { + bvr->flags |= kBVFlagForeignBoot; + } + else + { + (*bvr->bv_free)(bvr); + bvr = NULL; + } + } + + if (bvr) bvr->flags |= bvrFlags; + { + return bvr; + } } -//========================================================================== +//============================================================================== BVRef newAPMBVRef( int biosdev, int partno, unsigned int blkoff, const DPME * part, @@ -578,64 +613,68 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); - if ( bvr ) - { - bzero(bvr, 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; - strlcpy(bvr->name, part->dpme_name, DPISTRLEN); - strlcpy(bvr->type_name, part->dpme_type, DPISTRLEN); + 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; + strlcpy(bvr->name, part->dpme_name, DPISTRLEN); + strlcpy(bvr->type_name, part->dpme_type, DPISTRLEN); - /* - if ( part->bootid & FDISK_ACTIVE ) - bvr->flags |= kBVFlagPrimary; - */ + /* + if ( part->bootid & FDISK_ACTIVE ) + { + bvr->flags |= kBVFlagPrimary; + } + */ - // Probe the filesystem. + // Probe the filesystem. - if ( initFunc ) - { - bvr->flags |= kBVFlagNativeBoot | kBVFlagBootable | kBVFlagSystemVolume; + if ( initFunc ) + { + bvr->flags |= kBVFlagNativeBoot | kBVFlagBootable | kBVFlagSystemVolume; - if ( probe && initFunc( bvr ) != 0 ) - { - // filesystem probe failed. + if ( probe && initFunc( bvr ) != 0 ) + { + // 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; - } - } - /* - else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) - { - bvr->flags |= kBVFlagForeignBoot; - } - */ - else - { - (*bvr->bv_free)(bvr); - bvr = NULL; - } - } - if (bvr) bvr->flags |= bvrFlags; - return bvr; + (*bvr->bv_free)(bvr); + bvr = NULL; + } + } + /* + else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) + { + bvr->flags |= kBVFlagForeignBoot; + } + */ + else + { + (*bvr->bv_free)(bvr); + bvr = NULL; + } + } + if (bvr) + { + bvr->flags |= bvrFlags; + } + return bvr; } -//========================================================================== +//============================================================================== // GUID's in LE form: // HFS+ partition - 48465300-0000-11AA-AA11-00306543ECAC @@ -665,71 +704,65 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); - if ( bvr ) - { - bzero(bvr, 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; - // 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) ) - strlcpy(bvr->type_name, "GPT HFS+", DPISTRLEN); - else - strlcpy(bvr->type_name, "GPT Unknown", DPISTRLEN); + 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) ) { + strlcpy(bvr->type_name, "GPT HFS+", DPISTRLEN); + } else { + strlcpy(bvr->type_name, "GPT Unknown", DPISTRLEN); + } - /* - if ( part->bootid & FDISK_ACTIVE ) - bvr->flags |= kBVFlagPrimary; - */ + /* + if ( part->bootid & FDISK_ACTIVE ) { + bvr->flags |= kBVFlagPrimary; + } + */ - // Probe the filesystem. + // Probe the filesystem. - if ( initFunc ) - { - bvr->flags |= kBVFlagNativeBoot; + if ( initFunc ) { + bvr->flags |= kBVFlagNativeBoot; - if ( probe && initFunc( bvr ) != 0 ) - { - // filesystem probe failed. + if ( probe && initFunc( bvr ) != 0 ) { + // 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; - } - if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) - { - bvr->flags |= kBVFlagBootable; - } - } - else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) - { - bvr->flags |= kBVFlagForeignBoot; - } - else - { - (*bvr->bv_free)(bvr); - bvr = NULL; - } - } - if (bvr) bvr->flags |= bvrFlags; - return bvr; + (*bvr->bv_free)(bvr); + bvr = NULL; + } + if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) { + bvr->flags |= kBVFlagBootable; + } + } else if ( readBootSector( biosdev, blkoff, (void *)0x7e00 ) == 0 ) { + bvr->flags |= kBVFlagForeignBoot; + } else { + (*bvr->bv_free)(bvr); + bvr = NULL; + } + } + if (bvr) { + bvr->flags |= bvrFlags; + } + return bvr; } -//========================================================================== +//============================================================================== /* A note on partition numbers: * IOKit makes the primary partitions numbers 1-4, and then @@ -751,17 +784,22 @@ struct driveInfo di; boot_drive_info_t *dp; - /* Initialize disk info */ - if (getDriveInfo(biosdev, &di) != 0) { - return NULL; - } - dp = &di.di; - spc = (dp->params.phys_spt * dp->params.phys_heads); - if (spc == 0) { - /* This is probably a CD-ROM; punt on the geometry. */ - spc = 1; - } + /* Initialize disk info */ + if (getDriveInfo(biosdev, &di) != 0) + { + return NULL; + } + + dp = &di.di; + spc = (dp->params.phys_spt * dp->params.phys_heads); + + if (spc == 0) + { + /* This is probably a CD-ROM; punt on the geometry. */ + spc = 1; + } + do { // Create a new mapping. @@ -879,7 +917,7 @@ 0, kBIOSDevTypeHardDrive, 0); break; - + case FDISK_NTFS: bvr = newFDiskBVRef( biosdev, partno, @@ -903,7 +941,7 @@ (BVFree)free, 0, kBIOSDevTypeHardDrive, 0); break; - + case FDISK_BEFS: bvr = newFDiskBVRef( biosdev, partno, @@ -936,7 +974,7 @@ (BVFree)free, 0, kBIOSDevTypeHardDrive, 0); break; - + default: bvr = newFDiskBVRef( biosdev, partno, @@ -961,386 +999,451 @@ // Booting from a CD with an UFS filesystem embedded // in a booter partition. - if ( booterUFS ) - { - if ( map->bvrcnt == 0 ) - { - map->bvr = booterUFS; - map->bvrcnt++; - } - else free( booterUFS ); - } + if ( booterUFS ) + { + if ( map->bvrcnt == 0 ) + { + map->bvr = booterUFS; + map->bvrcnt++; + } + else + { + free( booterUFS ); + } + } #endif - } - } while (0); + } + } while (0); - /* - * If no FDisk partition, then we will check for - * an Apple partition map elsewhere. - */ + /* + * If no FDisk partition, then we will check for + * an Apple partition map elsewhere. + */ #if UNUSED - if (map->bvrcnt == 0) { - static struct fdisk_part cdpart; - cdpart.systid = 0xCD; + if (map->bvrcnt == 0) + { + static struct fdisk_part cdpart; + cdpart.systid = 0xCD; - /* Let's try assuming we are on a hybrid HFS/ISO9660 CD. */ - bvr = newFDiskBVRef( - biosdev, 0, - 0, - &cdpart, - HFSInitPartition, - HFSLoadFile, - HFSReadFile, - HFSGetDirEntry, - HFSGetFileBlock, - HFSGetUUID, - 0, - kBIOSDevTypeHardDrive); - bvr->next = map->bvr; - map->bvr = bvr; - map->bvrcnt++; - } + /* Let's try assuming we are on a hybrid HFS/ISO9660 CD. */ + bvr = newFDiskBVRef( + biosdev, 0, + 0, + &cdpart, + HFSInitPartition, + HFSLoadFile, + HFSReadFile, + HFSGetDirEntry, + HFSGetFileBlock, + HFSGetUUID, + 0, + kBIOSDevTypeHardDrive); + bvr->next = map->bvr; + map->bvr = bvr; + map->bvrcnt++; + } #endif - // Actually this should always be true given the above code - if(map == gDiskBVMap) - { - // Don't leave a null map in the chain - if(map->bvrcnt == 0 && map->bvr == NULL) - { - gDiskBVMap = map->next; - free(map); - map = NULL; - } - } + // Actually this should always be true given the above code + if(map == gDiskBVMap) + { + // Don't leave a null map in the chain + if(map->bvrcnt == 0 && map->bvr == NULL) + { + gDiskBVMap = map->next; + free(map); + map = NULL; + } + } - if (countPtr) *countPtr = map ? map->bvrcnt : 0; + 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); - /* Check for alternate block size */ - if (readBytes( biosdev, 0, 0, BPS, buffer ) != 0) { - return NULL; - } - block0_p = buffer; - if (OSSwapBigToHostInt16(block0_p->sbSig) == BLOCK0_SIGNATURE) { - blksize = OSSwapBigToHostInt16(block0_p->sbBlkSize); - if (blksize != BPS) { - free(buffer); - buffer = malloc(blksize); - } - factor = blksize / BPS; - } else { - blksize = BPS; - factor = 1; - } - - do { - // Create a new mapping. + if (!buffer) + { + return NULL; + } - map = (struct DiskBVMap *) malloc( sizeof(*map) ); - if ( map ) - { - int error; - DPME *dpme_p = (DPME *)buffer; - UInt32 i, npart = UINT_MAX; - BVRef bvr; + /* Check for alternate block size */ + if (readBytes( biosdev, 0, 0, BPS, buffer ) != 0) + { + return NULL; + } + block0_p = buffer; + if (OSSwapBigToHostInt16(block0_p->sbSig) == BLOCK0_SIGNATURE) + { + blksize = OSSwapBigToHostInt16(block0_p->sbBlkSize); + if (blksize != BPS) + { + free(buffer); + buffer = malloc(blksize); + if (!buffer) + { + return NULL; + } + } + factor = blksize / BPS; + } + else + { + blksize = BPS; + factor = 1; + } - map->biosdev = biosdev; - map->bvr = NULL; - map->bvrcnt = 0; - map->next = gDiskBVMap; - gDiskBVMap = map; + do + { + // Create a new mapping. - for (i=0; idpme_signature) != DPME_SIGNATURE) { - break; - } + map->biosdev = biosdev; + map->bvr = NULL; + map->bvrcnt = 0; + map->next = gDiskBVMap; + gDiskBVMap = map; - if (i==0) { - npart = OSSwapBigToHostInt32(dpme_p->dpme_map_entries); - } - /* - printf("name = %s, %s%s %d -> %d [%d -> %d] {%d}\n", - dpme.dpme_name, dpme.dpme_type, (dpme.dpme_flags & DPME_FLAGS_BOOTABLE) ? "(bootable)" : "", - dpme.dpme_pblock_start, dpme.dpme_pblocks, - dpme.dpme_lblock_start, dpme.dpme_lblocks, - dpme.dpme_boot_block); - */ + for (i=0; idpme_type, "Apple_HFS") == 0) { - bvr = newAPMBVRef(biosdev, - i, - OSSwapBigToHostInt32(dpme_p->dpme_pblock_start) * factor, - dpme_p, - HFSInitPartition, - HFSLoadFile, - HFSReadFile, - HFSGetDirEntry, - HFSGetFileBlock, - HFSGetUUID, - HFSGetDescription, - HFSFree, - 0, - kBIOSDevTypeHardDrive, 0); - bvr->next = map->bvr; - map->bvr = bvr; - map->bvrcnt++; - } - } - } - } while (0); + if (error || OSSwapBigToHostInt16(dpme_p->dpme_signature) != DPME_SIGNATURE) + { + break; + } - free(buffer); + if (i==0) + { + npart = OSSwapBigToHostInt32(dpme_p->dpme_map_entries); + } + /* + printf("name = %s, %s%s %d -> %d [%d -> %d] {%d}\n", + dpme.dpme_name, dpme.dpme_type, (dpme.dpme_flags & DPME_FLAGS_BOOTABLE) ? "(bootable)" : "", + dpme.dpme_pblock_start, dpme.dpme_pblocks, + dpme.dpme_lblock_start, dpme.dpme_lblocks, + dpme.dpme_boot_block); + */ - if (countPtr) *countPtr = map ? map->bvrcnt : 0; + if (strcmp(dpme_p->dpme_type, "Apple_HFS") == 0) + { + bvr = newAPMBVRef(biosdev, + i, + OSSwapBigToHostInt32(dpme_p->dpme_pblock_start) * factor, + dpme_p, + HFSInitPartition, + HFSLoadFile, + HFSReadFile, + HFSGetDirEntry, + HFSGetFileBlock, + HFSGetUUID, + HFSGetDescription, + HFSFree, + 0, + kBIOSDevTypeHardDrive, 0); + bvr->next = map->bvr; + map->bvr = bvr; + map->bvrcnt++; + } + } + } + } while (0); - return map ? map->bvr : NULL; + 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; + // detected filesystem type; + int result = -1; + int fatbits; - // Allocating buffer for 4 sectors. - const void * probeBuffer = malloc(PROBEFS_SIZE); - if (probeBuffer == NULL) - goto exit; + // 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; + // Reading first 4 sectors of current partition + int error = readBytes(biosdev, blkoff, 0, PROBEFS_SIZE, (void *)probeBuffer); - 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 (NTFSProbe(probeBuffer)) - result = FDISK_NTFS; - else if (BeFSProbe(probeBuffer)) - result = FDISK_BEFS; - 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; - + 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 ( (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 != NULL) free((void *)probeBuffer); - return result; + if (probeBuffer != NULL) free((void *)probeBuffer); + { + return result; + } } +//============================================================================== + static bool isPartitionUsed(gpt_ent * partition) { - // - // Ask whether the given partition is used. - // - return efi_guid_is_null((EFI_GUID const*)partition->ent_type) ? false : true; + // Ask whether the given partition is used. + + return efi_guid_is_null((EFI_GUID const*)partition->ent_type) ? false : true; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +//============================================================================== -static BVRef diskScanGPTBootVolumes( int biosdev, int * countPtr ) +static BVRef diskScanGPTBootVolumes(int biosdev, int * countPtr) { - struct DiskBVMap * map = NULL; - void *buffer = malloc(BPS); - int error; - 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; - } - struct REAL_disk_blk0 *fdiskMap = buffer; - if ( OSSwapLittleToHostInt16(fdiskMap->signature) != DISK_SIGNATURE ) - { - verbose("Failed to find boot signature on BIOS device %02xh\n", biosdev); - goto scanErr; - } + struct DiskBVMap *map = NULL; - int fdiskID = 0; - unsigned index; - for ( index = 0; index < FDISK_NPART; index++ ) - { - if ( fdiskMap->parts[index].systid ) - { - if ( fdiskMap->parts[index].systid == 0xEE ) - { - // Fail if two 0xEE partitions are present which - // means the FDISK code will wind up parsing it. - if ( fdiskID ) goto scanErr; + void *buffer = malloc(BPS); - fdiskID = index + 1; - } - } - } + int error; + 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; + } + struct REAL_disk_blk0 *fdiskMap = buffer; + if ( OSSwapLittleToHostInt16(fdiskMap->signature) != DISK_SIGNATURE ) + { + verbose("Failed to find boot signature on BIOS device %02xh\n", biosdev); + goto scanErr; + } - if ( fdiskID == 0 ) goto scanErr; - verbose("Attempting to read GPT\n"); + int fdiskID = 0; + unsigned index; + for ( index = 0; index < FDISK_NPART; index++ ) + { + if ( fdiskMap->parts[index].systid ) + { + if ( fdiskMap->parts[index].systid == 0xEE ) + { + // Fail if two 0xEE partitions are present which + // means the FDISK code will wind up parsing it. + if ( fdiskID ) + { + goto scanErr; + } - if(readBytes(biosdev, 1, 0, BPS, buffer) != 0) - goto scanErr; - - gpt_hdr *headerMap = buffer; + fdiskID = index + 1; + } + } + } - // Determine whether the partition header signature is present. + if ( fdiskID == 0 ) + { + goto scanErr; + } - if ( memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG)) ) - { - goto scanErr; - } + verbose("Attempting to read GPT\n"); - // Determine whether the partition header size is valid. + if(readBytes(biosdev, 1, 0, BPS, buffer) != 0) + { + goto scanErr; + } - UInt32 headerCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_self); - UInt32 headerSize = OSSwapLittleToHostInt32(headerMap->hdr_size); + gpt_hdr *headerMap = buffer; - if ( headerSize < offsetof(gpt_hdr, padding) ) - { - goto scanErr; - } + // Determine whether the partition header signature is present. - if ( headerSize > BPS ) - { - goto scanErr; - } + if ( memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG)) ) + { + goto scanErr; + } - // Determine whether the partition header checksum is valid. + // Determine whether the partition header size is valid. - headerMap->hdr_crc_self = 0; + UInt32 headerCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_self); + UInt32 headerSize = OSSwapLittleToHostInt32(headerMap->hdr_size); - if ( crc32(0, headerMap, headerSize) != headerCheck ) - { - goto scanErr; - } + if ( headerSize < offsetof(gpt_hdr, padding) ) + { + goto scanErr; + } - // Determine whether the partition entry size is valid. + if ( headerSize > BPS ) + { + goto scanErr; + } - UInt64 gptBlock = 0; - UInt32 gptCheck = 0; - UInt32 gptCount = 0; - UInt32 gptID = 0; - gpt_ent * gptMap = 0; - UInt32 gptSize = 0; + // Determine whether the partition header checksum is valid. - gptBlock = OSSwapLittleToHostInt64(headerMap->hdr_lba_table); - gptCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_table); - gptCount = OSSwapLittleToHostInt32(headerMap->hdr_entries); - gptSize = OSSwapLittleToHostInt32(headerMap->hdr_entsz); + headerMap->hdr_crc_self = 0; - if ( gptSize < sizeof(gpt_ent) ) - { - goto scanErr; - } + if ( crc32(0, headerMap, headerSize) != headerCheck ) + { + goto scanErr; + } - // Allocate a buffer large enough to hold one map, rounded to a media block. - free(buffer); - buffer = NULL; + // Determine whether the partition entry size is valid. - UInt32 bufferSize = IORound(gptCount * gptSize, BPS); - if(bufferSize == 0) - goto scanErr; - buffer = malloc(bufferSize); + UInt64 gptBlock = 0; + UInt32 gptCheck = 0; + UInt32 gptCount = 0; + UInt32 gptID = 0; + gpt_ent * gptMap = 0; + UInt32 gptSize = 0; - if(readBytes(biosdev, gptBlock, 0, bufferSize, buffer) != 0) - goto scanErr; + gptBlock = OSSwapLittleToHostInt64(headerMap->hdr_lba_table); + gptCheck = OSSwapLittleToHostInt32(headerMap->hdr_crc_table); + gptCount = OSSwapLittleToHostInt32(headerMap->hdr_entries); + gptSize = OSSwapLittleToHostInt32(headerMap->hdr_entsz); - verbose("Read GPT\n"); + if ( gptSize < sizeof(gpt_ent) ) + { + goto scanErr; + } - // Allocate a new map for this BIOS device and insert it into the chain - map = malloc(sizeof(*map)); - map->biosdev = biosdev; - map->bvr = NULL; - map->bvrcnt = 0; - map->next = gDiskBVMap; - gDiskBVMap = map; + // Allocate a buffer large enough to hold one map, rounded to a media block. + free(buffer); + buffer = NULL; - // fdisk like partition type id. - int fsType = 0; - - 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) ); + UInt32 bufferSize = IORound(gptCount * gptSize, BPS); + if (bufferSize == 0) + { + goto scanErr; + } + buffer = malloc(bufferSize); + if (!buffer) + { + goto scanErr; + } - // 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 (readBytes(biosdev, gptBlock, 0, bufferSize, buffer) != 0) + { + goto scanErr; + } + verbose("Read GPT\n"); - 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); + // Allocate a new map for this BIOS device and insert it into the chain + map = malloc(sizeof(*map)); + if (!map) + { + goto scanErr; + } + map->biosdev = biosdev; + map->bvr = NULL; + map->bvrcnt = 0; + map->next = gDiskBVMap; + gDiskBVMap = map; - // Getting fdisk like partition type. - fsType = probeFileSystem(biosdev, gptMap->ent_lba_start); + // fdisk like partition type id. + int fsType = 0; - 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); - } + 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) ); + + // 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)) { + char stringuuid[100]; + efi_guid_unparse_upper((EFI_GUID*)gptMap->ent_type, stringuuid); + verbose("Reading GPT partition %d, type %s\n", gptID, stringuuid); + + // 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); + } + // 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) ) - { + (efi_guid_compare(&GPT_BASICDATA2_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) { switch (fsType) { case FDISK_NTFS: @@ -1364,198 +1467,188 @@ } - // turbo - save our booter partition - // zef - only on original boot device - if ( (efi_guid_compare(&GPT_EFISYS_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) - { - switch (fsType) - { - case FDISK_HFS: - if (readBootSector( biosdev, gptMap->ent_lba_start, (void *)0x7e00 ) == 0) - { - bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap, - HFSInitPartition, - HFSLoadFile, - HFSReadFile, - HFSGetDirEntry, - HFSGetFileBlock, - HFSGetUUID, - HFSGetDescription, - HFSFree, - 0, kBIOSDevTypeHardDrive, kBVFlagEFISystem); - } - break; + // turbo - save our booter partition + // zef - only on original boot device + if ( (efi_guid_compare(&GPT_EFISYS_GUID, (EFI_GUID const*)gptMap->ent_type) == 0) ) { + switch (fsType) { + case FDISK_HFS: + if (readBootSector( biosdev, gptMap->ent_lba_start, (void *)0x7e00 ) == 0) { + bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap, + HFSInitPartition, + HFSLoadFile, + HFSReadFile, + HFSGetDirEntry, + HFSGetFileBlock, + HFSGetUUID, + HFSGetDescription, + HFSFree, + 0, kBIOSDevTypeHardDrive, kBVFlagEFISystem); + } + break; - case FDISK_FAT32: - if (testFAT32EFIBootSector( biosdev, gptMap->ent_lba_start, (void *)0x7e00 ) == 0) - { - bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap, - MSDOSInitPartition, - MSDOSLoadFile, - MSDOSReadFile, - MSDOSGetDirEntry, - MSDOSGetFileBlock, - MSDOSGetUUID, - MSDOSGetDescription, - MSDOSFree, - 0, kBIOSDevTypeHardDrive, kBVFlagEFISystem); - } - break; + case FDISK_FAT32: + if (testFAT32EFIBootSector( biosdev, gptMap->ent_lba_start, (void *)0x7e00 ) == 0) { + bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap, + MSDOSInitPartition, + MSDOSLoadFile, + MSDOSReadFile, + MSDOSGetDirEntry, + MSDOSGetFileBlock, + MSDOSGetUUID, + MSDOSGetDescription, + MSDOSFree, + 0, kBIOSDevTypeHardDrive, kBVFlagEFISystem); + } + break; - if (biosdev == gBIOSDev) - gBIOSBootVolume = bvr; - } - } + default: + if (biosdev == gBIOSDev) { + gBIOSBootVolume = bvr; + } + break; + } + } - if (bvr) - { - // Fixup bvr with the fake fdisk partition type. - if (fsType > 0) bvr->part_type = fsType; + if (bvr) + { + // Fixup bvr with the fake fdisk partition type. + if (fsType > 0) { + bvr->part_type = fsType; + } - bvr->next = map->bvr; - map->bvr = bvr; - ++map->bvrcnt; - } + bvr->next = map->bvr; + map->bvr = bvr; + ++map->bvrcnt; + } - } - } + } + } -scanErr: - free(buffer); + scanErr: + if (buffer) { + free(buffer); + } - if(map) - { - if(countPtr) *countPtr = map->bvrcnt; - return map->bvr; - } - else - { - if(countPtr) *countPtr = 0; - return NULL; - } + if(map) { + if(countPtr) *countPtr = map->bvrcnt; + { + return map->bvr; + } + + } else { + if(countPtr) *countPtr = 0; + { + return NULL; + } + } } +//============================================================================== + static bool getOSVersion(BVRef bvr, char *str) { bool valid = false; config_file_t systemVersion; char dirSpec[512]; - + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); - if (!loadConfigFile(dirSpec, &systemVersion)) - { + if (!loadConfigFile(dirSpec, &systemVersion)) { valid = true; - } - else - { + } else { sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); - + if (!loadConfigFile(dirSpec, &systemVersion)) { - bvr->OSisServer = true; + bvr->OSisServer = true; valid = true; - } + } } - if (valid) - { + if (valid) { const char *val; int len; - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) - { + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { // getValueForKey uses const char for val // so copy it and trim *str = '\0'; strncat(str, val, MIN(len, 4)); + } else { + valid = false; } - else - valid = false; } - if(!valid) - { + if(!valid) { int fh = -1; sprintf(dirSpec, "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no); fh = open(dirSpec, 0); - - if (fh >= 0) - { + + if (fh >= 0) { valid = true; bvr->OSisInstaller = true; strcpy(bvr->OSVersion, "10.7"); // 10.7 + - } - else - { + } else { close(fh); } } - return valid; } -//========================================================================== +//============================================================================== static void scanFSLevelBVRSettings(BVRef chain) { - BVRef bvr; - char dirSpec[512], fileSpec[512]; - char label[BVSTRLEN]; - int ret; - long flags, time; - int fh, fileSize, error; + BVRef bvr; + char dirSpec[512], fileSpec[512]; + char label[BVSTRLEN]; + int ret; + long flags, time; + int fh, fileSize, error; - for (bvr = chain; bvr; bvr = bvr->next) - { - ret = -1; - error = 0; + for (bvr = chain; bvr; bvr = bvr->next) { + 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"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); - if (!ret) - { - fh = open(strcat(dirSpec, fileSpec), 0); - fileSize = file_size(fh); - if (fileSize > 0 && fileSize < BVSTRLEN) - { - if (read(fh, label, fileSize) != fileSize) - error = -1; - } - else - error = -1; + // + // 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"); + ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); + if (!ret) { + fh = open(strcat(dirSpec, fileSpec), 0); + fileSize = file_size(fh); + if (fileSize > 0 && fileSize < BVSTRLEN) { + if (read(fh, label, fileSize) != fileSize) { + error = -1; + } + } else { + error = -1; + } - close(fh); + close(fh); - if (!error) - { - label[fileSize] = '\0'; - strcpy(bvr->altlabel, label); - } - } - } + if (!error) { + label[fileSize] = '\0'; + strcpy(bvr->altlabel, label); + } + } + } - // - // Check for SystemVersion.plist or ServerVersion.plist - // to determine if a volume hosts an installed system. - // - if (bvr->flags & kBVFlagNativeBoot) - { - if (getOSVersion(bvr,bvr->OSVersion) == true) - { - bvr->flags |= kBVFlagSystemVolume; - } - } + // Check for SystemVersion.plist or ServerVersion.plist to determine if a volume hosts an installed system. - } + if (bvr->flags & kBVFlagNativeBoot) { + if (getOSVersion(bvr,bvr->OSVersion) == true) { + bvr->flags |= kBVFlagSystemVolume; + } + } + } } +//============================================================================== + void rescanBIOSDevice(int biosdev) { struct DiskBVMap *oldMap = diskResetBootVolumes(biosdev); @@ -1565,225 +1658,261 @@ scanBootVolumes(biosdev, 0); } +//============================================================================== + struct DiskBVMap* diskResetBootVolumes(int biosdev) { - struct DiskBVMap * map; - struct DiskBVMap *prevMap = NULL; - for ( map = gDiskBVMap; map; prevMap = map, map = map->next ) { - if ( biosdev == map->biosdev ) { - break; - } - } - if(map != NULL) - { - verbose("Resetting BIOS device %xh\n", biosdev); - // Reset the biosbuf cache - cache_valid = false; - if(map == gDiskBVMap) - gDiskBVMap = map->next; - else if(prevMap != NULL) - prevMap->next = map->next; - else - stop(""); - } - // Return the old map, either to be freed, or reinserted later - return map; + struct DiskBVMap * map; + struct DiskBVMap *prevMap = NULL; + for ( map = gDiskBVMap; map; prevMap = map, map = map->next ) { + if ( biosdev == map->biosdev ) { + break; + } + } + + if(map != NULL) { + verbose("Resetting BIOS device %xh\n", biosdev); + // Reset the biosbuf cache + cache_valid = false; + if(map == gDiskBVMap) { + gDiskBVMap = map->next; + } else if(prevMap != NULL) { + prevMap->next = map->next; + } else { + stop(""); + } + } + // Return the old map, either to be freed, or reinserted later + return map; } +//============================================================================== + // Frees a DiskBVMap and all of its BootVolume's void diskFreeMap(struct DiskBVMap *map) { - if(map != NULL) - { - while(map->bvr != NULL) - { - BVRef bvr = map->bvr; - map->bvr = bvr->next; - (*bvr->bv_free)(bvr); - } - free(map); - } + if(map != NULL) + { + while(map->bvr != NULL) + { + BVRef bvr = map->bvr; + map->bvr = bvr->next; + (*bvr->bv_free)(bvr); + } + + free(map); + } } -BVRef diskScanBootVolumes( int biosdev, int * countPtr ) +//============================================================================== + +BVRef diskScanBootVolumes(int biosdev, int * countPtr) { - struct DiskBVMap * map; - BVRef bvr; - int count = 0; + struct DiskBVMap *map; + BVRef bvr; + int count = 0; - // Find an existing mapping for this device. + // Find an existing mapping for this device. - for ( map = gDiskBVMap; map; map = map->next ) { - if ( biosdev == map->biosdev ) { - count = map->bvrcnt; - break; - } - } + for (map = gDiskBVMap; map; map = map->next) + { + if (biosdev == map->biosdev) + { + count = map->bvrcnt; + break; + } + } - if (map == NULL) { - bvr = diskScanGPTBootVolumes(biosdev, &count); - if (bvr == NULL) { - bvr = diskScanFDiskBootVolumes(biosdev, &count); - } - if (bvr == NULL) { - bvr = diskScanAPMBootVolumes(biosdev, &count); - } - if (bvr) - { - scanFSLevelBVRSettings(bvr); - } - } else { - bvr = map->bvr; - } - if (countPtr) *countPtr += count; - return bvr; + if (map == NULL) + { + bvr = diskScanGPTBootVolumes(biosdev, &count); + if (bvr == NULL) + { + bvr = diskScanFDiskBootVolumes(biosdev, &count); + } + if (bvr == NULL) + { + bvr = diskScanAPMBootVolumes(biosdev, &count); + } + if (bvr) + { + scanFSLevelBVRSettings(bvr); + } + } + else + { + bvr = map->bvr; + } + if (countPtr) + { + *countPtr += count; + } + return bvr; } +//============================================================================== + BVRef getBVChainForBIOSDev(int biosdev) { - BVRef chain = NULL; - struct DiskBVMap * map = NULL; + BVRef chain = NULL; + struct DiskBVMap * map = NULL; - for (map = gDiskBVMap; map; map = map->next) - { - if (map->biosdev == biosdev) - { - chain = map->bvr; - break; - } - } - - return chain; + for (map = gDiskBVMap; map; map = map->next) + { + if (map->biosdev == biosdev) + { + chain = map->bvr; + break; + } + } + + return chain; } +//============================================================================== + BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count) { - BVRef chain = NULL; - BVRef bvr = NULL; - BVRef newBVR = NULL; - BVRef prevBVR = NULL; + BVRef chain = NULL; + BVRef bvr = NULL; + BVRef newBVR = NULL; + BVRef prevBVR = NULL; - struct DiskBVMap * map = NULL; - int bvCount = 0; + struct DiskBVMap * map = NULL; + int bvCount = 0; - const char *raw = 0; - char* val = 0; - int len; + const char *raw = 0; + char* val = 0; + int len; - getValueForKey(kHidePartition, &raw, &len, &bootInfo->chameleonConfig); - if(raw) - { - val = XMLDecode(raw); - } + getValueForKey(kHidePartition, &raw, &len, &bootInfo->chameleonConfig); + if(raw) + { + val = XMLDecode(raw); + } - /* - * Traverse gDISKBVmap to get references for - * individual bvr chains of each drive. - */ - for (map = gDiskBVMap; map; map = map->next) - { - for (bvr = map->bvr; bvr; bvr = bvr->next) - { - /* - * Save the last bvr. - */ - if (newBVR) prevBVR = newBVR; + /* + * Traverse gDISKBVmap to get references for + * individual bvr chains of each drive. + */ + for (map = gDiskBVMap; map; map = map->next) + { + for (bvr = map->bvr; bvr; bvr = bvr->next) + { + /* + * Save the last bvr. + */ + if (newBVR) + { + prevBVR = newBVR; + } - /* - * Allocate and copy the matched bvr entry into a new one. - */ - newBVR = (BVRef) malloc(sizeof(*newBVR)); - bcopy(bvr, newBVR, sizeof(*newBVR)); + /* + * Allocate and copy the matched bvr entry into a new one. + */ + newBVR = (BVRef) malloc(sizeof(*newBVR)); + if (!newBVR) + { + continue; + } + bcopy(bvr, newBVR, sizeof(*newBVR)); - /* - * Adjust the new bvr's fields. - */ - newBVR->next = NULL; - newBVR->filtered = true; + /* + * Adjust the new bvr's fields. + */ + newBVR->next = NULL; + newBVR->filtered = true; - if ( (!allowFlags || newBVR->flags & allowFlags) - && (!denyFlags || !(newBVR->flags & denyFlags) ) - && (newBVR->biosdev >= minBIOSDev && newBVR->biosdev <= maxBIOSDev) - ) - newBVR->visible = true; - - /* - * Looking for "Hide Partition" entries in 'hd(x,y)|uuid|"label" hd(m,n)|uuid|"label"' format, - * to be able to hide foreign partitions from the boot menu. - * - */ - if ( (newBVR->flags & kBVFlagForeignBoot) ) - { - char *start, *next = val; - long len = 0; - do - { - start = strbreak(next, &next, &len); - if(len && matchVolumeToString(newBVR, start, len) ) - newBVR->visible = false; - } - while ( next && *next ); - } + if ( (!allowFlags || newBVR->flags & allowFlags) + && (!denyFlags || !(newBVR->flags & denyFlags) ) + && (newBVR->biosdev >= minBIOSDev && newBVR->biosdev <= maxBIOSDev) + ) { + newBVR->visible = true; + } - /* - * Use the first bvr entry as the starting chain pointer. - */ - if (!chain) - chain = newBVR; + /* + * Looking for "Hide Partition" entries in 'hd(x,y)|uuid|"label" hd(m,n)|uuid|"label"' format, + * to be able to hide foreign partitions from the boot menu. + * + */ + if ( (newBVR->flags & kBVFlagForeignBoot) ) { + char *start, *next = val; + long len = 0; + do + { + start = strbreak(next, &next, &len); + if(len && matchVolumeToString(newBVR, start, len) ) + { + newBVR->visible = false; + } + } + while ( next && *next ); + } - /* - * Update the previous bvr's link pointer to use the new memory area. - */ - if (prevBVR) - prevBVR->next = newBVR; - - if (newBVR->visible) - bvCount++; - } - } + /* + * Use the first bvr entry as the starting chain pointer. + */ + if (!chain) { + chain = newBVR; + } + /* + * Update the previous bvr's link pointer to use the new memory area. + */ + if (prevBVR) { + prevBVR->next = newBVR; + } + + if (newBVR->visible) { + bvCount++; + } + } + } + #if DEBUG //Azi: warning - too big for boot-log.. far too big.. i mean HUGE!! :P - for (bvr = chain; bvr; bvr = bvr->next) - { - printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible); - } - printf("count: %d\n", bvCount); - getchar(); + for (bvr = chain; bvr; bvr = bvr->next) + { + printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible); + } + printf("count: %d\n", bvCount); + getchar(); #endif - *count = bvCount; - - free(val); - return chain; + *count = bvCount; + + free(val); + return chain; } +//============================================================================== + int freeFilteredBVChain(const BVRef chain) { - int ret = 1; - BVRef bvr = chain; - BVRef nextBVR = NULL; + int ret = 1; + BVRef bvr = chain; + BVRef nextBVR = NULL; - while (bvr) - { - nextBVR = bvr->next; + while (bvr) + { + nextBVR = bvr->next; - if (bvr->filtered) - { - free(bvr); - } - else - { - ret = 0; - break; - } + if (bvr->filtered) + { + free(bvr); + } + else + { + ret = 0; + break; + } - bvr = nextBVR; - } - - return ret; + bvr = nextBVR; + } + + return ret; } -//========================================================================== +//============================================================================== static const struct NamedValue fdiskTypes[] = { @@ -1805,41 +1934,53 @@ { 0x00, 0 } /* must be last */ }; -//========================================================================== +//============================================================================== bool matchVolumeToString( BVRef bvr, const char* match, long matchLen) { char testStr[128]; if ( !bvr || !match || !*match) + { return 0; - + } + if ( bvr->biosdev < 0x80 || bvr->biosdev >= 0x100 ) + { return 0; - - // Try to match hd(x,y) first. - sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no); - if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) - return true; - - // Try to match volume UUID. - if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0) - { - if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) - return true; - } - - // Try to match volume label (always quoted). - if ( bvr->description ) - { - bvr->description(bvr, testStr, sizeof(testStr)-1); - if( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) - return true; - } - - return false; + } + + // Try to match hd(x,y) first. + sprintf(testStr, "hd(%d,%d)", BIOS_DEV_UNIT(bvr), bvr->part_no); + if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + { + return true; + } + + // Try to match volume UUID. + if ( bvr->fs_getuuid && bvr->fs_getuuid(bvr, testStr) == 0) + { + if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + { + return true; + } + } + + // Try to match volume label (always quoted). + if ( bvr->description ) + { + bvr->description(bvr, testStr, sizeof(testStr)-1); + if ( matchLen ? !strncmp(match, testStr, matchLen) : !strcmp(match, testStr) ) + { + return true; + } + } + + return false; } +//============================================================================== + /* If Rename Partition has defined an alias, then extract it for description purpose. * The format for the rename string is the following: * hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" "alias"; etc... @@ -1847,225 +1988,273 @@ bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen) { - char *aliasList, *entryStart, *entryNext; + char *aliasList, *entryStart, *entryNext; - if ( !str || strMaxLen <= 0) - return false; - - aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->chameleonConfig)); - if ( !aliasList ) - return false; - - for ( entryStart = entryNext = aliasList; - entryNext && *entryNext; - entryStart = entryNext ) - { - char *volStart, *volEnd, *aliasStart; - long volLen, aliasLen; + if ( !str || strMaxLen <= 0) + { + return false; + } + + aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->chameleonConfig)); + if ( !aliasList ) + { + return false; + } + + for ( entryStart = entryNext = aliasList; entryNext && *entryNext; entryStart = entryNext ) + { + char *volStart, *volEnd, *aliasStart; + long volLen, aliasLen; - // Delimit current entry - entryNext = strchr(entryStart, ';'); - if ( entryNext ) - { - *entryNext = '\0'; - entryNext++; - } + // Delimit current entry + entryNext = strchr(entryStart, ';'); + if ( entryNext ) + { + *entryNext = '\0'; + entryNext++; + } - volStart = strbreak(entryStart, &volEnd, &volLen); - if(!volLen) - continue; - - aliasStart = strbreak(volEnd, 0, &aliasLen); - if(!aliasLen) - continue; - - if ( matchVolumeToString(bvr, volStart, volLen) ) - { - strncat(str, aliasStart, MIN(strMaxLen, aliasLen)); - free(aliasList); - - return true; - } - } + volStart = strbreak(entryStart, &volEnd, &volLen); + if(!volLen) + { + continue; + } + + aliasStart = strbreak(volEnd, 0, &aliasLen); + if(!aliasLen) + { + continue; + } + + if ( matchVolumeToString(bvr, volStart, volLen) ) + { + strncat(str, aliasStart, MIN(strMaxLen, aliasLen)); + free(aliasList); + + return true; + } + } - free(aliasList); - return false; + free(aliasList); + return false; } +//============================================================================== + void getBootVolumeDescription( BVRef bvr, char * str, long strMaxLen, bool useDeviceDescription ) { - unsigned char type; - char *p = str; + unsigned char type; + char *p = str; - if(!bvr || !p || strMaxLen <= 0) - return; - - type = (unsigned char) bvr->part_type; - - if (useDeviceDescription) - { - int len = getDeviceDescription(bvr, str); - if(len >= strMaxLen) - return; - - strcpy(str + len, bvr->OSisInstaller ? " (Installer) " : " "); - len += bvr->OSisInstaller ? 13 : 1; - strMaxLen -= len; - p += len; - } - - /* See if a partition rename is preferred */ - if(getVolumeLabelAlias(bvr, p, strMaxLen)) { - strncpy(bvr->label, p, strMaxLen); - return; // we're done here no need to seek for real name - } - - // - // Get the volume label using filesystem specific functions - // or use the alternate volume label if available. - // + if(!bvr || !p || strMaxLen <= 0) + { + return; + } + + type = (unsigned char) bvr->part_type; + + if (useDeviceDescription) + { + int len = getDeviceDescription(bvr, str); + if(len >= strMaxLen) + { + return; + } + + strcpy(str + len, bvr->OSisInstaller ? " (Installer) " : " "); + len += bvr->OSisInstaller ? 13 : 1; + strMaxLen -= len; + p += len; + } + + /* See if a partition rename is preferred */ + if (getVolumeLabelAlias(bvr, p, strMaxLen)) + { + strncpy(bvr->label, p, strMaxLen); + return; // we're done here no need to seek for real name + } + + // Get the volume label using filesystem specific functions or use the alternate volume label if available. + if (*bvr->altlabel != '\0') - strncpy(p, bvr->altlabel, strMaxLen); + { + strncpy(p, bvr->altlabel, strMaxLen); + } else if (bvr->description) - bvr->description(bvr, p, strMaxLen); + { + bvr->description(bvr, p, strMaxLen); + } - if (*p == '\0') { - const char * name = getNameForValue( fdiskTypes, type ); - if (name == NULL) { - name = bvr->type_name; - } - if (name == NULL) { - sprintf(p, "TYPE %02x", type); - } else { - strncpy(p, name, strMaxLen); - } - } - - // Set the devices label - sprintf(bvr->label, p); + if (*p == '\0') + { + const char * name = getNameForValue( fdiskTypes, type ); + + if (name == NULL) + { + name = bvr->type_name; + } + + if (name == NULL) + { + sprintf(p, "TYPE %02x", type); + } + else + { + strncpy(p, name, strMaxLen); + } + } + + // Set the devices label + sprintf(bvr->label, p); } -//========================================================================== -int readBootSector( int biosdev, unsigned int secno, void * buffer ) + +//============================================================================== + +int readBootSector(int biosdev, unsigned int secno, void * buffer) { - struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer; - int error; + int error; + struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer; - if ( bootSector == NULL ) - { - if ( gBootSector == NULL ) - { - gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); - if ( gBootSector == NULL ) return -1; - } - bootSector = gBootSector; - } + if (bootSector == NULL) + { + if (gBootSector == NULL) + { + gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); - error = readBytes( biosdev, secno, 0, BPS, bootSector ); - if ( error || bootSector->signature != DISK_SIGNATURE ) - return -1; + if (gBootSector == NULL) + { + return -1; + } + } - return 0; + bootSector = gBootSector; + } + + error = readBytes(biosdev, secno, 0, BPS, bootSector); + + if (error || bootSector->signature != DISK_SIGNATURE) + { + return -1; + } + return 0; } +//============================================================================== + /* * Format of boot1f32 block. */ - + #define BOOT1F32_MAGIC "BOOT " #define BOOT1F32_MAGICLEN 11 -struct disk_boot1f32_blk { - unsigned char init[3]; - unsigned char fsheader[87]; - unsigned char magic[BOOT1F32_MAGICLEN]; - unsigned char bootcode[409]; - unsigned short signature; +struct disk_boot1f32_blk +{ + unsigned char init[3]; + unsigned char fsheader[87]; + unsigned char magic[BOOT1F32_MAGICLEN]; + unsigned char bootcode[409]; + unsigned short signature; }; +//============================================================================== + 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 ( gBootSector == NULL ) - { - gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); - if ( gBootSector == NULL ) return -1; - } - bootSector = (struct disk_boot1f32_blk *) gBootSector; - } + if ( bootSector == NULL ) + { + if ( gBootSector == NULL ) + { + gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); + if ( gBootSector == NULL ) + { + return -1; + } + } + 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) ) - return -1; - - return 0; + error = readBytes( biosdev, secno, 0, BPS, bootSector ); + if ( error || bootSector->signature != DISK_SIGNATURE || strncmp((const char *)bootSector->magic, BOOT1F32_MAGIC, BOOT1F32_MAGICLEN) ) + { + return -1; + } + return 0; } -//========================================================================== + +//============================================================================== // Handle seek request from filesystem modules. -void diskSeek( BVRef bvr, long long position ) +void diskSeek(BVRef bvr, long long position) { - bvr->fs_boff = position / BPS; - bvr->fs_byteoff = position % BPS; + bvr->fs_boff = position / BPS; + bvr->fs_byteoff = position % BPS; } -//========================================================================== + +//============================================================================== // Handle read request from filesystem modules. -int diskRead( BVRef bvr, long addr, long length ) +int diskRead(BVRef bvr, long addr, long length) { - return readBytes( bvr->biosdev, - bvr->fs_boff + bvr->part_boff, - bvr->fs_byteoff, - length, - (void *) addr ); + return readBytes(bvr->biosdev, bvr->fs_boff + bvr->part_boff, bvr->fs_byteoff, length, (void *) addr); } +//============================================================================== + int rawDiskRead( BVRef bvr, unsigned int secno, void *buffer, unsigned int len ) { - int secs; - unsigned char *cbuf = (unsigned char *)buffer; - unsigned int copy_len; - int rc; + int secs; + unsigned char *cbuf = (unsigned char *)buffer; + unsigned int copy_len; + int rc; - if ((len & (BPS-1)) != 0) { - error("raw disk read not sector aligned"); - return -1; - } - secno += bvr->part_boff; + if ((len & (BPS-1)) != 0) + { + error("raw disk read not sector aligned"); + return -1; + } + secno += bvr->part_boff; - cache_valid = false; + cache_valid = false; - while (len > 0) { - secs = len / BPS; - if (secs > N_CACHE_SECS) secs = N_CACHE_SECS; - copy_len = secs * BPS; + while (len > 0) + { + secs = len / BPS; + if (secs > N_CACHE_SECS) + { + secs = N_CACHE_SECS; + } + copy_len = secs * BPS; - //printf("rdr: ebiosread(%d, %d, %d)\n", bvr->biosdev, secno, secs); - if ((rc = ebiosread(bvr->biosdev, secno, secs)) != 0) { - /* Ignore corrected ECC errors */ - if (rc != ECC_CORRECTED_ERR) { - error(" EBIOS read error: %s\n", bios_error(rc), rc); - error(" Block %d Sectors %d\n", secno, secs); - return rc; - } - } - bcopy( trackbuf, cbuf, copy_len ); - len -= copy_len; - cbuf += copy_len; - secno += secs; - spinActivityIndicator(secs); - } + //printf("rdr: ebiosread(%d, %d, %d)\n", bvr->biosdev, secno, secs); + if ((rc = ebiosread(bvr->biosdev, secno, secs)) != 0) + { + /* Ignore corrected ECC errors */ + if (rc != ECC_CORRECTED_ERR) + { + error(" EBIOS read error: %s\n", bios_error(rc), rc); + error(" Block %d Sectors %d\n", secno, secs); + return rc; + } + } + bcopy( trackbuf, cbuf, copy_len ); + len -= copy_len; + cbuf += copy_len; + secno += secs; + spinActivityIndicator(secs); + } - return 0; + return 0; } +//============================================================================== + int rawDiskWrite( BVRef bvr, unsigned int secno, void *buffer, unsigned int len ) { int secs; @@ -2073,52 +2262,64 @@ unsigned int copy_len; int rc; - if ((len & (BPS-1)) != 0) { - error("raw disk write not sector aligned"); - return -1; - } - secno += bvr->part_boff; + if ((len & (BPS-1)) != 0) + { + error("raw disk write not sector aligned"); + return -1; + } + secno += bvr->part_boff; - cache_valid = false; + cache_valid = false; - while (len > 0) { - secs = len / BPS; - if (secs > N_CACHE_SECS) secs = N_CACHE_SECS; - copy_len = secs * BPS; + while (len > 0) + { + secs = len / BPS; + if (secs > N_CACHE_SECS) + { + secs = N_CACHE_SECS; + } + copy_len = secs * BPS; - bcopy( cbuf, trackbuf, copy_len ); - //printf("rdr: ebioswrite(%d, %d, %d)\n", bvr->biosdev, secno, secs); - if ((rc = ebioswrite(bvr->biosdev, secno, secs)) != 0) { - error(" EBIOS write error: %s\n", bios_error(rc), rc); - error(" Block %d Sectors %d\n", secno, secs); - return rc; - } - len -= copy_len; - cbuf += copy_len; - secno += secs; - spinActivityIndicator(secs); - } + bcopy( cbuf, trackbuf, copy_len ); + //printf("rdr: ebioswrite(%d, %d, %d)\n", bvr->biosdev, secno, secs); + if ((rc = ebioswrite(bvr->biosdev, secno, secs)) != 0) + { + error(" EBIOS write error: %s\n", bios_error(rc), rc); + error(" Block %d Sectors %d\n", secno, secs); + return rc; + } - return 0; + len -= copy_len; + cbuf += copy_len; + secno += secs; + spinActivityIndicator(secs); + } + + return 0; } +//============================================================================== + int diskIsCDROM(BVRef bvr) { - struct driveInfo di; + struct driveInfo di; - if (getDriveInfo(bvr->biosdev, &di) == 0 && di.no_emulation) { - return 1; - } - return 0; + if (getDriveInfo(bvr->biosdev, &di) == 0 && di.no_emulation) + { + return 1; + } + return 0; } +//============================================================================== + int biosDevIsCDROM(int biosdev) { - struct driveInfo di; + struct driveInfo di; - if (getDriveInfo(biosdev, &di) == 0 && di.no_emulation) - { - return 1; - } - return 0; + if (getDriveInfo(biosdev, &di) == 0 && di.no_emulation) + { + return 1; + } + return 0; } Index: branches/ErmaC/Enoch/i386/libsaio/openbsd.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/openbsd.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/openbsd.c (revision 2323) @@ -3,10 +3,11 @@ #include "openbsd.h" #define OpenBSDProbeSize 2048 +#define DISKMAGIC ((uint32_t)0x82564557) /* The disk magic number */ bool OpenBSDProbe (const void *buf) { - return (OSReadLittleInt32(buf+0x200,0)==0x82564557); + return (OSReadLittleInt32(buf+0x200,0) == DISKMAGIC); } void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen) { Index: branches/ErmaC/Enoch/i386/libsaio/pci_setup.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/pci_setup.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/pci_setup.c (revision 2323) @@ -2,89 +2,135 @@ #include "boot.h" #include "bootstruct.h" #include "pci.h" -#include "gma.h" -#include "nvidia.h" -#include "hda.h" +//#include "gma.h" +//#include "nvidia.h" +//#include "hda.h" #include "modules.h" +//#include "device_inject.h" - extern bool setup_ati_devprop(pci_dt_t *ati_dev); extern bool setup_nvidia_devprop(pci_dt_t *nvda_dev); extern bool setup_gma_devprop(pci_dt_t *gma_dev); extern bool setup_hda_devprop(pci_dt_t *hda_dev); -extern void set_eth_builtin(pci_dt_t *eth_dev); +extern void setup_eth_builtin(pci_dt_t *eth_dev); +extern void setup_wifi_airport(pci_dt_t *wifi_dev); +extern bool set_usb_devprop(pci_dt_t *usb_dev); extern void notify_usb_dev(pci_dt_t *pci_dev); extern void force_enable_hpet(pci_dt_t *lpc_dev); - extern pci_dt_t *dram_controller_dev; void setup_pci_devs(pci_dt_t *pci_dt) { char *devicepath; - bool doit, do_eth_devprop, do_gfx_devprop, do_enable_hpet, do_hda_devprop; + bool doit, do_eth_devprop, do_wifi_devprop, do_usb_devprop, do_gfx_devprop, do_enable_hpet, do_hda_devprop = false; pci_dt_t *current = pci_dt; - do_eth_devprop = do_gfx_devprop = do_enable_hpet = do_hda_devprop = false; + //do_eth_devprop = do_wifi_devprop = do_usb_devprop = do_gfx_devprop = do_enable_hpet = do_hda_devprop = false; getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig); + getBoolForKey(kEnableWifi, &do_wifi_devprop, &bootInfo->chameleonConfig); getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig); + getBoolForKey(kUsbInject, &do_usb_devprop, &bootInfo->chameleonConfig); getBoolForKey(kHDAEnabler, &do_hda_devprop, &bootInfo->chameleonConfig); getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig); - while (current) - { +/* tennisgeek http://forum.voodooprojects.org/index.php/topic,1333.0.html + // Get some PCI stuff + if (hasPciToEfiMapping == -1) { + hasPciToEfiMapping = (loadSystemConfig("", &bootInfo->pciConfig, "pci.plist", true) == 0 ? 1 : 0); + if (hasPciToEfiMapping) { + verbose("pci.plist is found.\n"); + } + } + + if (hasPciToEfiMapping) { + // Device ID override injection + memset(id_array, sizeof(id_array), 0); + sprintf(override_key, "pci%04x,%04x", current->vendor_id, current->device_id); + id_count = PciToEfiOverride(override_key, id_array, 4); + device = NULL; + for (i = 0; i < id_count; i++) { + uint8_t fourOctets[4]; + uint32_t id = id_array[i]; + if (id == 0) { + if (i == 0) { + id = current->vendor_id; + } else if (i == 1) { + id = current->device_id; + } else { + continue; + } + } + + fourOctets[0] = id; + fourOctets[1] = id >> 8; + fourOctets[2] = 0; + fourOctets[3] = 0; + if (id != 0) { + if (device == NULL) { + device = devprop_find_device(devicepath); + if (device == NULL) { + deviceString = devprop_create_string(); + device = devprop_add_device(deviceString, devicepath); + } + } + devprop_add_value(device, id_keys[i], fourOctets, sizeof(fourOctets)); + verbose("%s: %s 0x%02x\n", override_key, id_keys[i], id); + } + } + current = current->next; + } +*/ // tennisgeek http://forum.voodooprojects.org/index.php/topic,1333.0.html + + while (current) { devicepath = get_pci_dev_path(current); - switch (current->class_id) - { + switch (current->class_id) { case PCI_CLASS_BRIDGE_HOST: - if (current->dev.addr == PCIADDR(0, 0, 0)) - { + //DBG("Setup BRIDGE_HOST \n"); + if (current->dev.addr == PCIADDR(0, 0, 0)) { dram_controller_dev = current; } break; case PCI_CLASS_NETWORK_ETHERNET: - if (do_eth_devprop) - { - set_eth_builtin(current); + //DBG("Setup ETHERNET %s enabled\n", do_eth_devprop?"":"no"); + if (do_eth_devprop) { + setup_eth_builtin(current); } break; + case PCI_CLASS_NETWORK_OTHER: + //DBG("Setup WIRELESS %s enabled\n", do_wifi_devprop?"":"no"); + if (do_wifi_devprop) { + setup_wifi_airport(current); + } + break; + case PCI_CLASS_DISPLAY_VGA: - if (do_gfx_devprop) - { - switch (current->vendor_id) - { + //DBG("GraphicsEnabler %s enabled\n", do_gfx_devprop?"":"no"); + if (do_gfx_devprop) { + switch (current->vendor_id) { case PCI_VENDOR_ID_ATI: - if (getBoolForKey(kSkipAtiGfx, &doit, &bootInfo->chameleonConfig) && doit) - { + if (getBoolForKey(kSkipAtiGfx, &doit, &bootInfo->chameleonConfig) && doit) { verbose("Skip ATi/AMD gfx device!\n"); - } - else - { + } else { setup_ati_devprop(current); } break; case PCI_VENDOR_ID_INTEL: - if (getBoolForKey(kSkipIntelGfx, &doit, &bootInfo->chameleonConfig) && doit) - { + if (getBoolForKey(kSkipIntelGfx, &doit, &bootInfo->chameleonConfig) && doit) { verbose("Skip Intel gfx device!\n"); - } - else - { + } else { setup_gma_devprop(current); } break; case PCI_VENDOR_ID_NVIDIA: - if (getBoolForKey(kSkipNvidiaGfx, &doit, &bootInfo->chameleonConfig) && doit) - { + if (getBoolForKey(kSkipNvidiaGfx, &doit, &bootInfo->chameleonConfig) && doit) { verbose("Skip Nvidia gfx device!\n"); - } - else - { + } else { setup_nvidia_devprop(current); } break; @@ -92,27 +138,32 @@ } break; + case PCI_CLASS_MULTIMEDIA_AUDIO_DEV: - if (do_hda_devprop) - { + //DBG("Setup HDEF %s enabled\n", do_hda_devprop?"":"no"); + if (do_hda_devprop) { setup_hda_devprop(current); } break; - case PCI_CLASS_SERIAL_USB: - notify_usb_dev(current); - break; + case PCI_CLASS_SERIAL_USB: + //DBG("USB fix \n"); + notify_usb_dev(current); + /*if (do_usb_devprop) { + set_usb_devprop(current); + }*/ + break; - case PCI_CLASS_BRIDGE_ISA: - if (do_enable_hpet) - { - force_enable_hpet(current); - } - break; - } + case PCI_CLASS_BRIDGE_ISA: + //DBG("Force HPET %s enabled\n", do_enable_hpet?"":"no"); + if (do_enable_hpet) { + force_enable_hpet(current); + } + break; + } execute_hook("PCIDevice", current, NULL, NULL, NULL); - + //DBG("setup_pci_devs current devID=%08x\n", current->device_id); setup_pci_devs(current->children); current = current->next; } Index: branches/ErmaC/Enoch/i386/libsaio/cpu.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/cpu.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/cpu.h (revision 2323) @@ -16,18 +16,90 @@ #define CPU_STRING_UNKNOWN "Unknown CPU Type" -#define MSR_IA32_PERF_STATUS 0x00000198 -#define MSR_IA32_PERF_CONTROL 0x199 -#define MSR_IA32_EXT_CONFIG 0x00EE -#define MSR_FLEX_RATIO 0x194 -#define MSR_TURBO_RATIO_LIMIT 0x1AD -#define MSR_PLATFORM_INFO 0xCE -#define MSR_CORE_THREAD_COUNT 0x35 // Undocumented -#define MSR_IA32_PLATFORM_ID 0x17 +//-- processor type -> p_type: +#define PT_OEM 0x00 // Intel Original OEM Processor; +#define PT_OD 0x01 // Intel Over Drive Processor; +#define PT_DUAL 0x02 // Intel Dual Processor; +#define PT_RES 0x03 // Intel Reserved; -#define K8_FIDVID_STATUS 0xC0010042 -#define K10_COFVID_STATUS 0xC0010071 +/* Known MSR registers */ +#define MSR_IA32_PLATFORM_ID 0x0017 +#define MSR_CORE_THREAD_COUNT 0x0035 /* limited use - not for Penryn or older */ +#define IA32_TSC_ADJUST 0x003B +#define MSR_IA32_BIOS_SIGN_ID 0x008B /* microcode version */ +#define MSR_FSB_FREQ 0x00CD /* limited use - not for i7 */ +#define MSR_PLATFORM_INFO 0x00CE /* limited use - MinRatio for i7 but Max for Yonah */ +/* turbo for penryn */ +#define MSR_PKG_CST_CONFIG_CONTROL 0x00E2 /* sandy and ivy */ +#define IA32_MPERF 0x00E7 /* TSC in C0 only */ +#define IA32_APERF 0x00E8 /* actual clocks in C0 */ +#define MSR_IA32_EXT_CONFIG 0x00EE /* limited use - not for i7 */ +#define MSR_FLEX_RATIO 0x0194 /* limited use - not for Penryn or older */ + //see no value on most CPUs +#define MSR_IA32_PERF_STATUS 0x0198 +#define MSR_IA32_PERF_CONTROL 0x0199 +#define MSR_IA32_CLOCK_MODULATION 0x019A +#define MSR_THERMAL_STATUS 0x019C +#define MSR_IA32_MISC_ENABLE 0x01A0 +#define MSR_THERMAL_TARGET 0x01A2 /* limited use - not for Penryn or older */ +#define MSR_TURBO_RATIO_LIMIT 0x01AD /* limited use - not for Penryn or older */ +#define IA32_ENERGY_PERF_BIAS 0x01B0 +//MSR 000001B0 0000-0000-0000-0005 +//MSR 000001B1 0000-0000-8838-0000 +#define IA32_PLATFORM_DCA_CAP 0x01F8 +//MSR 000001FC 0000-0000-0004-005F + +// Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's. +#define MSR_RAPL_POWER_UNIT 0x606 /* R/O */ +//MSR 00000606 0000-0000-000A-1003 +#define MSR_PKGC3_IRTL 0x60A /* RW time limit to go C3 */ +// bit 15 = 1 -- the value valid for C-state PM +#define MSR_PKGC6_IRTL 0x60B /* RW time limit to go C6 */ +//MSR 0000060B 0000-0000-0000-8854 +//Valid + 010=1024ns + 0x54=84mks +#define MSR_PKGC7_IRTL 0x60C /* RW time limit to go C7 */ +//MSR 0000060C 0000-0000-0000-8854 +#define MSR_PKG_C2_RESIDENCY 0x60D /* same as TSC but in C2 only */ + +#define MSR_PKG_RAPL_POWER_LIMIT 0x610 +//MSR 00000610 0000-A580-0000-8960 +#define MSR_PKG_ENERGY_STATUS 0x611 +//MSR 00000611 0000-0000-3212-A857 +#define MSR_PKG_POWER_INFO 0x614 +//MSR 00000614 0000-0000-01E0-02F8 +// Sandy Bridge IA (Core) domain MSR's. +#define MSR_PP0_POWER_LIMIT 0x638 +#define MSR_PP0_ENERGY_STATUS 0x639 +#define MSR_PP0_POLICY 0x63A +#define MSR_PP0_PERF_STATUS 0x63B + +// Sandy Bridge Uncore (IGPU) domain MSR's (Not on JakeTown). +#define MSR_PP1_POWER_LIMIT 0x640 +#define MSR_PP1_ENERGY_STATUS 0x641 +//MSR 00000641 0000-0000-0000-0000 +#define MSR_PP1_POLICY 0x642 + +// JakeTown only Memory MSR's. +#define MSR_PKG_PERF_STATUS 0x613 +#define MSR_DRAM_POWER_LIMIT 0x618 +#define MSR_DRAM_ENERGY_STATUS 0x619 +#define MSR_DRAM_PERF_STATUS 0x61B +#define MSR_DRAM_POWER_INFO 0x61C + +//IVY_BRIDGE +#define MSR_CONFIG_TDP_NOMINAL 0x648 +#define MSR_CONFIG_TDP_LEVEL1 0x649 +#define MSR_CONFIG_TDP_LEVEL2 0x64A +#define MSR_CONFIG_TDP_CONTROL 0x64B /* write once to lock */ +#define MSR_TURBO_ACTIVATION_RATIO 0x64C + +//AMD +#define K8_FIDVID_STATUS 0xC0010042 +#define K10_COFVID_LIMIT 0xC0010061 +#define K10_PSTATE_STATUS 0xC0010064 +#define K10_COFVID_STATUS 0xC0010071 + #define MSR_AMD_MPERF 0x000000E7 #define MSR_AMD_APERF 0x000000E8 @@ -40,7 +112,7 @@ #define CALIBRATE_TIME_MSEC 30 /* 30 msecs */ #define CALIBRATE_LATCH ((CLKNUM * CALIBRATE_TIME_MSEC + 1000/2)/1000) -// CPUID Values +// CPUID Values Reference /* #define CPUID_MODEL_PRESCOTT 3 // 0x03 Celeron D, Pentium 4 (90nm) #define CPUID_MODEL_NOCONA 4 // 0x04 Xeon Nocona, Irwindale (90nm) Index: branches/ErmaC/Enoch/i386/libsaio/smbios.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/smbios.c (revision 2323) @@ -118,91 +118,8 @@ =================================================== */ #define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed -//------------------------------------------------------------------------------------------------------------------------- -// Default SMBIOS Data -//------------------------------------------------------------------------------------------------------------------------- -/* Rewrite: use a struct */ -#define kDefaultVendorManufacturer "Apple Inc." -#define kDefaultBIOSReleaseDate "11/06/2009" -#define kDefaultSerialNumber "SOMESRLNMBR" -#define kDefaultskuNumber "Default System SKU#" -#define kDefaultBoardProduct "Mac-F4208DC8" -#define kDefaultBoardType "10" // 0xA -#define kDefaultSystemVersion "1.0" - -//Bungo -/* 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0) */ -#define kDefaultBIOSRelease 256 - -#define KDefaultBoardSerialNumber "C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H -#define KDefaultBoardAssetTagNumber "Pro-Enclosure" // ErmaC -#define kDefaultLocatioInChassis "Part Component" // ErmaC - -//=========== Mac mini =========== -#define kDefaultMacminiFamily "Macmini" -#define kDefaultMacmini "Macmini1,1" -#define kDefaultMacminiBIOSVersion " MM21.88Z.009A.B00.0903051113" -// MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309 -// MacMini5,2 Mac-4BC72D62AD45599E -// MacMini5,3 - -// MacMini 6,1 - Mac-F65AE981FFA204ED -// MacMini 6,2 -//#define kDefaultMacmini62 "Macmini6,2" -//#define kDefaultMacmini62BIOSVersion " MM61.88Z.0106.B00.1208091121" -//#define kDefaultMacmini62BoardProduct "Mac-F65AE981FFA204ED" -//#define kDefaultMacmini62BIOSReleaseDate "10/14/2012" - -//=========== MacBook =========== -#define kDefaultMacBookFamily "MacBook" -#define kDefaultMacBook "MacBook4,1" -#define kDefaultMacBookBIOSVersion " MB41.88Z.0073.B00.0903051113" -//=========== MacBookAir =========== -// MacBookAir4,1 - Mac-C08A6BB70A942AC2 -// MacBookAir4,2 - Mac-742912EFDBEE19B3 -// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229 -// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442 -//=========== MacBookPro =========== -#define kDefaultMacBookProFamily "MacBookPro" -#define kDefaultMacBookPro "MacBookPro4,1" -#define kDefaultMacBookProBIOSVersion " MBP41.88Z.0073.B00.0903051113" -// MacBookPro8,1 - Mac-94245B3640C91C81 - MBP81.88Z.0047.B24.1110141131 -// MacBookPro8,2 - Mac_94245A3940C91C80 -// MacBookPro8,3 - Mac-942459F5819B171B -// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B02.1310181745 -// MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745 - -//=========== iMac =========== -#define kDefaultiMacFamily "iMac" -#define kDefaultiMac "iMac8,1" -#define kDefaultiMacBIOSVersion " IM81.88Z.00C1.B00.0903051113" -// iMac10,1 -// iMac11,1 core i3/i5/i7 -#define kDefaultiMacNehalem "iMac11,1" -#define kDefaultiMacNehalemBIOSVersion " IM111.88Z.0034.B00.0903051113" -// iMac11,2 -// iMac11,3 -// defaults for an iMac12,1 -#define kDefaultiMacSandy "iMac12,1" -#define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B00.1102091756" - -//=========== MacPro =========== -#define kDefaultMacProFamily "MacPro" -#define kDefaultMacPro "MacPro3,1" -#define kDefaultMacProBIOSVersion " MP31.88Z.006C.B05.0903051113" -// defaults for a Mac Pro 4,1 core i7/Xeon -#define kDefaultMacProNehalem "MacPro4,1" -#define kDefaultMacProNehalemBIOSVersion " MP41.88Z.0081.B08.1001221313" -// defaults for a Mac Pro 5,1 core i7/Xeon -#define kDefaultMacProWestmere "MacPro5,1" -#define kDefaultMacProWestmereBIOSVersion " MP51.88Z.007F.B03.1010071432" -#define kDefaultMacProWestmereBIOSReleaseDate "10/07/2010" -// defaults for a Mac Pro 6,1 -// MacPro6,1 - Mac-F60DEB81FF30ACF6 - MP61.88Z.0116.B00.1311020956 -//------------------------------------------------------------------------------------------------------------------------- - - +/* ==================================================*/ #define getFieldOffset(struct, field) ((uint8_t)(uint32_t)&(((struct *)0)->field)) typedef struct @@ -246,15 +163,26 @@ { char *manufacturer; char *product; - char *productName; // ErmaC + char *version; // Bungo char *serialNumber; // ErmaC char *assetTagNumber; // ErmaC char *locationInChassis; // ErmaC - char *boardType; // ErmaC + uint8_t boardType; // ErmaC } defaultBaseBoard_t; defaultBaseBoard_t defaultBaseBoard; +// Bungo +typedef struct { + char *manufacturer; + uint8_t chassisType; + char *version; + char *serialNumber; + char *assetTagNumber; +} defaultChassis_t; + +defaultChassis_t defaultChassis; + typedef struct { uint8_t type; @@ -262,9 +190,7 @@ uint8_t fieldOffset; char *keyString; bool (*getSMBValue)(returnType *); - // Bungo - // char **defaultValue; - void *defaultValue; + char **defaultValue; } SMBValueSetter; SMBValueSetter SMBSetters[] = @@ -283,8 +209,7 @@ // Bungo { kSMBTypeBIOSInformation, kSMBWord, getFieldOffset(SMBBIOSInformation, releaseMajor), - kSMBBIOSInformationReleaseKey, NULL, &defaultBIOSInfo.release }, // SMbiosrelease - 256 - // + kSMBBIOSInformationReleaseKey, NULL, (char **)&defaultBIOSInfo.release }, // SMbiosrelease - 0.1 (256) /* ========================= System Information (Type 1) @@ -301,12 +226,17 @@ {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, serialNumber), kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number +/* {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, uuid[16]), + NULL, NULL, NULL}, // SmUUID/ + + {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, wakeupReason), + NULL, NULL, NULL}, // reason for system wakeup +*/ + // Bungo {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, skuNumber), kSMBSystemInformationSKUNumberKey, NULL, &defaultSystemInfo.skuNumber}, // SMskunumber - System SKU# - // - {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, family), kSMBSystemInformationFamilyKey, NULL, &defaultSystemInfo.family}, // SMfamily - MacPro @@ -318,11 +248,11 @@ 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.productName}, // SMboardproductname - MacPro3,1 + kSMBBaseBoardVersionKey, NULL, &defaultBaseBoard.version }, // SMboardversion - MacPro3,1 {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, serialNumber), kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M @@ -333,30 +263,33 @@ {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, locationInChassis), kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component - {kSMBTypeBaseBoard, kSMBByte, getFieldOffset(SMBBaseBoard, boardType), - kSMBBaseBoardTypeKey,NULL, &defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro + {kSMBTypeBaseBoard, kSMBByte, getFieldOffset(SMBBaseBoard, boardType), + 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 +*/ // - // Bungo + // Bungo /* ======================= System Enclosure (Type 3) ========================= */ {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, manufacturer), - kSMBSystemEnclosureManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, // SMchassismanufacturer - Apple Inc. + kSMBSystemEnclosureManufacturerKey, NULL, &defaultChassis.manufacturer }, // SMchassismanufacturer - Apple Inc. - {kSMBTypeSystemEnclosure, kSMBByte, getFieldOffset(SMBSystemEnclosure, type), - kSMBSystemEnclosureTypeKey, NULL, &defaultBaseBoard.boardType }, // SMchassistype - 7 + {kSMBTypeSystemEnclosure, kSMBByte, getFieldOffset(SMBSystemEnclosure, chassisType), + kSMBSystemEnclosureTypeKey, NULL, (char **)&defaultChassis.chassisType }, // SMchassistype - 7 {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, version), kSMBSystemEnclosureVersionKey, NULL, &defaultBaseBoard.product }, // SMchassisversion - Mac-F42C88C8 {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, serialNumber), - kSMBSystemEnclosureSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMchassisserial + kSMBSystemEnclosureSerialNumberKey, NULL, &defaultChassis.serialNumber }, // SMchassisserial {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTagNumber), - kSMBSystemEnclosureAssetTagNumberKey, NULL, &defaultBaseBoard.assetTagNumber }, // SMchassisassettag - Pro Enclosure + kSMBSystemEnclosureAssetTagNumberKey, NULL, &defaultChassis.assetTagNumber }, // SMchassisassettag - Pro Enclosure - /* ============================ Processor Information (Type 4) ============================== */ @@ -386,7 +319,7 @@ {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, serialNumber), NULL, NULL, NULL}, - // Bungo + // Bungo {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, assetTag), kSMBProcessorInformationAssetTagNumberKey, NULL, NULL}, // SMcpuassettag @@ -441,8 +374,8 @@ 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 @@ -452,41 +385,227 @@ static SMBWord maxStructSize = 0; static SMBWord structureCount = 0; +//------------------------------------------------------------------------------------------------------------------------- +// Default SMBIOS Data +//------------------------------------------------------------------------------------------------------------------------- +/* Rewrite: use a struct */ + +// Bungo: suggest to not mixing data from different Mac models, use real Mac SMBIOS dumps + +#define kDefaultVendorManufacturer "Apple Inc." +//#define kDefaultBIOSReleaseDate "11/06/2009" +#define kDefaultSerialNumber "SOMESRLNMBR" +//Bungo +#define kDefaultSkuNumber "Default SKU#" +#define kDefaultAssetTagNumber "Default Asset Tag#" +//#define kDefaultBoardType "10" // 0xA +//#define kDefaultBoardProcessorType "11" // 0xB +#define kDefaultSystemVersion "1.0" +#define kDefaultBIOSRelease 256 // 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0) +//#define kDefaultLocatioInChassis "Part Component" +//#define KDefaultBoardSerialNumber "C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H + +//=========== Mac mini =========== +#define kDefaultMacMiniFamily "Mac mini" +//#define kDefaultMacMiniBoardAssetTagNumber "Mini-Aluminum" + +#define kDefaultMacMini "Macmini2,1" +#define kDefaultMacMiniBIOSVersion " MM21.88Z.009A.B00.0706281359" +#define kDefaultMacMiniBIOSReleaseDate "06/28/07" +#define kDefaultMacMiniBoardProduct "Mac-F4208EAA" + +// MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309 +// MacMini5,2 Mac-4BC72D62AD45599E +// MacMini5,3 +//#define kDefaultMacMini "Macmini5,3" +//#define kDefaultMacMiniBIOSVersion " MM51.88Z.0077.B10.1201241549" +//#define kDefaultMacMiniBoardProduct "Mac-F65AE981FFA204ED" +//#define kDefaultMacMiniBIOSReleaseDate "01/24/2012" + +// MacMini 6,1 - Mac-F65AE981FFA204ED +// MacMini 6,2 +//#define kDefaultMacMini62 "Macmini6,2" +//#define kDefaultMacMini62BIOSVersion " MM61.88Z.0106.B00.1208091121" +//#define kDefaultMacMini62BoardProduct "Mac-F65AE981FFA204ED" +//#define kDefaultMacMini62BIOSReleaseDate "10/14/2012" + +//=========== MacBook =========== +#define kDefaultMacBookFamily "MacBook" +//#define kDefaultMacBookBoardAssetTagNumber "MacBook-Black" + +#define kDefaultMacBook "MacBook4,1" +#define kDefaultMacBookBIOSVersion " MB41.88Z.00C1.B00.0802091535" +#define kDefaultMacBookBIOSReleaseDate "02/09/08" +#define kDefaultMacBookBoardProduct "Mac-F22788A9" + +//=========== MacBookAir =========== +#define kDefaultMacBookAirFamily "MacBook Air" + +// MacBookAir4,1 - Mac-C08A6BB70A942AC2 +// MacBookAir4,2 - Mac-742912EFDBEE19B3 +#define kDefaultMacBookAir "MacBookAir5,2" +#define kDefaultMacBookAirBIOSVersion " MBA51.88Z.00EF.B00.1205221442" +#define kDefaultMacBookAirBIOSReleaseDate "05/10/12" +#define kDefaultMacBookBoardAirProduct "Mac-2E6FAB96566FE58C" + +// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229 +// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442 + +//=========== MacBookPro =========== +#define kDefaultMacBookProFamily "MacBook Pro" +//#define kDefaultMacBookProBoardAssetTagNumber "MacBook-Aluminum" + +#define kDefaultMacBookPro "MacBookPro4,1" +#define kDefaultMacBookProBIOSVersion " MBP41.88Z.0073.B00.0903051113" +#define kDefaultMacBookProBIOSReleaseDate "02/27/08" +#define kDefaultMacBookProBoardProduct "Mac-F42C89C8" + +//#define kDefaultMacBookPro "MacBookPro8,1" +//#define kDefaultMacBookProBIOSVersion " MBP81.88Z.0047.B24.1110141131" +//#define kDefaultMacBookProBoardProduct "Mac-94245B3640C91C81" +//#define kDefaultMacBookProBIOSReleaseDate "10/14/11" + +// MacBookPro8,2 - Mac_94245A3940C91C80 +// MacBookPro8,3 - Mac-942459F5819B171B + +// MacBookPro10,2 +//#define kDefaultMacBookProIvy "MacBookPro10,2" +//#define kDefaultMacBookProIvyBIOSVersion " MBP102.88Z.0106.B01.1208311637" +//#define kDefaultMacBookProIvyBoardProduct "Mac-AFD8A9D944EA4843" +//#define kDefaultMacBookProIvyBIOSReleaseDate "10/02/2012" + +// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B02.1310181745 +// MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745 + +//=========== iMac =========== +#define kDefaultiMacFamily "iMac" +//#define kDefaultiMacBoardAssetTagNumber "iMac-Aluminum" + +#define kDefaultiMac "iMac8,1" +#define kDefaultiMacBIOSVersion " IM81.88Z.00C1.B00.0903051113" +#define kDefaultiMacBIOSReleaseDate "02/09/08" +#define kDefaultiMacBoardProduct "Mac-F227BEC8" + +// iMac10,1 +// iMac11,1 core i3/i5/i7 +#define kDefaultiMacNehalem "iMac11,1" +#define kDefaultiMacNehalemBIOSVersion " IM111.88Z.0034.B02.1003171314" +#define kDefaultiMacNehalemBIOSReleaseDate "10/30/09" +#define kDefaultiMacNehalemBoardProduct "Mac-F2268DAE" +// iMac11,2 +// iMac11,3 + +// iMac12,1 +#define kDefaultiMacSandy "iMac12,1" +#define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B00.1102091756" +#define kDefaultiMacSandyBIOSReleaseDate "01/02/08" +#define kDefaultiMacSandyBoardProduct "Mac-942B5BF58194151B" +// iMac12,2 Mac-942B59F58194171B +//#define kDefaultiMacSandy "iMac12,2" +//#define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B1D.1110171110" +//#define kDefaultiMacSandyBIOSReleaseDate "10/17/2011" +//#define kDefaultiMacSandyBoardProduct "Mac-942B59F58194171B" + +// iMac13,2 +//#define kDefaultiMacIvy "iMac13,2" +//#define kDefaultiMacIvyBIOSVersion " IM131.88Z.00CE.B00.1203281326" +//#define kDefaultiMacIvyBIOSReleaseDate "03/28/2012" +//#define kDefaultiMacIvyBoardProduct "Mac-FC02E91DDD3FA6A4" + +//=========== MacPro =========== +#define kDefaultMacProFamily "Mac Pro" +//#define KDefauktMacProBoardAssetTagNumber "Pro-Enclosure" +//#define kDefaultMacProBoardType "0xB" // 11 + +#define kDefaultMacPro "MacPro3,1" +#define kDefaultMacProBIOSVersion " MP31.88Z.006C.B05.0903051113" +#define kDefaultMacProBIOSReleaseDate "08/03/2010" +//#define kDefaultMacProSystemVersion "1.3" +#define kDefaultMacProBoardProduct "Mac-F2268DC8" +//#define KDefaultMacProBoardSerialNumber "J593902RA4MFE" + +// Mac Pro 4,1 core i7/Xeon +#define kDefaultMacProNehalem "MacPro4,1" +#define kDefaultMacProNehalemBIOSVersion " MP41.88Z.0081.B04.0903051113" +#define kDefaultMacProNehalemBIOSReleaseDate "11/06/2009" +//#define kDefaultMacProNehalemSystemVersion "1.4" +#define kDefaultMacProNehalemBoardProduct "Mac-F4238CC8" +//#define KDefaultMacProNehalemBoardSerialNumber "J593004RB1LUE" + +// Mac Pro 5,1 core i7/Xeon +#define kDefaultMacProWestmere "MacPro5,1" +#define kDefaultMacProWestmereBIOSVersion " MP51.88Z.007F.B03.1010071432" +#define kDefaultMacProWestmereBIOSReleaseDate "10/07/10" +//#define kDefaultMacProWestmereSystemVersion "1.2" +#define kDefaultMacProWestmereBoardProduct "Mac-F221BEC8" +//#define KDefaultMacProWestmereBoardSerialNumber "J522700H7BH8C" + +// Mac Pro 6,1 +#define kDefaultMacProHaswell "MacPro6,1" +#define kDefaultMacProHaswellBIOSVersion " MP61.88Z.0116.B00.1311020956" +#define kDefaultMacProHaswellBIOSReleaseDate "06/12/13" +//#define kDefaultMacProHaswellSystemVersion "1.?" +#define kDefaultMacProHaswellBoardProduct "Mac-F60DEB81FF30ACF6" +//#define KDefaultMacProHaswellBoardSerialNumber "?????????????" + +//#define KDefaultBoardSerialNumber "C02140302D5DMT31M" // new C07019501PLDCVHAD - C02032101R5DC771H +// J593902RA4MFE 3,1 +// J5031046RCZJA 5,1 +// J521101A5CZJC 3,1 +// J593004RB1LUE MacPro4,1 +// J513401PZBH8C 5,1 +// J590802LC4ACB 3,1 +// J594900AH1LUE 4,1 +// J512500HZBH8C 5,1 +// J522700H7BH8C MacPro5,1 + +/* ============================================ */ + bool useSMBIOSdefaults = true; // Bungo +SMBByte PlatformType = 3; // Bungo: same as Platfom.Type in platform.h + /* Rewrite this function */ -void setDefaultSMBData(void) +void setDefaultSMBData(void) // Bungo: setting data from real Macs { defaultBIOSInfo.vendor = kDefaultVendorManufacturer; - defaultBIOSInfo.releaseDate = kDefaultBIOSReleaseDate; - defaultBIOSInfo.release = kDefaultBIOSRelease; // Bungo defaultSystemInfo.manufacturer = kDefaultVendorManufacturer; defaultSystemInfo.version = kDefaultSystemVersion; defaultSystemInfo.serialNumber = kDefaultSerialNumber; - defaultSystemInfo.skuNumber = kDefaultskuNumber; // Bungo + defaultSystemInfo.skuNumber = kDefaultSkuNumber; // Bungo defaultBaseBoard.manufacturer = kDefaultVendorManufacturer; - defaultBaseBoard.product = kDefaultBoardProduct; - defaultBaseBoard.boardType = kDefaultBoardType; // ErmaC - defaultBaseBoard.serialNumber = KDefaultBoardSerialNumber; // ErmaC - defaultBaseBoard.assetTagNumber = KDefaultBoardAssetTagNumber; // ErmaC - defaultBaseBoard.locationInChassis = kDefaultLocatioInChassis; // ErmaC + defaultBaseBoard.serialNumber = kDefaultSerialNumber; + defaultBaseBoard.assetTagNumber = kDefaultAssetTagNumber; - if (platformCPUFeature(CPU_FEATURE_MOBILE)) + defaultChassis.manufacturer = kDefaultVendorManufacturer; + defaultChassis.serialNumber = kDefaultSerialNumber; + defaultChassis.assetTagNumber = kDefaultAssetTagNumber; + + // if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly + if (PlatformType == 2) // this method works { if (Platform.CPU.NoCores > 1) { - defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion; defaultSystemInfo.productName = kDefaultMacBookPro; - defaultSystemInfo.family = kDefaultMacBookProFamily; + defaultBIOSInfo.version = kDefaultMacBookProBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacBookProBIOSReleaseDate; + defaultSystemInfo.family = kDefaultMacBookProFamily; + defaultBaseBoard.product = kDefaultMacBookProBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisUnknown; } else { - defaultBIOSInfo.version = kDefaultMacBookBIOSVersion; defaultSystemInfo.productName = kDefaultMacBook; - defaultSystemInfo.family = kDefaultMacBookFamily; + defaultBIOSInfo.version = kDefaultMacBookBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacBookBIOSReleaseDate; + defaultSystemInfo.family = kDefaultMacBookFamily; + defaultBaseBoard.product = kDefaultMacBookBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisUnknown; } } else @@ -494,15 +613,23 @@ switch (Platform.CPU.NoCores) { case 1: - defaultBIOSInfo.version = kDefaultMacminiBIOSVersion; - defaultSystemInfo.productName = kDefaultMacmini; - defaultSystemInfo.family = kDefaultMacminiFamily; + defaultBIOSInfo.version = kDefaultMacMiniBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacMiniBIOSReleaseDate; + defaultSystemInfo.productName = kDefaultMacMini; + defaultSystemInfo.family = kDefaultMacMiniFamily; + defaultBaseBoard.product = kDefaultMacMiniBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardUnknown; + defaultChassis.chassisType = kSMBchassisLPDesktop; break; case 2: - defaultBIOSInfo.version = kDefaultiMacBIOSVersion; - defaultSystemInfo.productName = kDefaultiMac; - defaultSystemInfo.family = kDefaultiMacFamily; + defaultBIOSInfo.version = kDefaultiMacBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultiMacBIOSReleaseDate; + defaultSystemInfo.productName = kDefaultiMac; + defaultSystemInfo.family = kDefaultiMacFamily; + defaultBaseBoard.product = kDefaultiMacBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisAllInOne; break; default: { @@ -516,44 +643,69 @@ case CPU_MODEL_DALES: case CPU_MODEL_DALES_32NM: // Intel Core i3, i5 LGA1156 (32nm) defaultBIOSInfo.version = kDefaultiMacNehalemBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultiMacNehalemBIOSReleaseDate; defaultSystemInfo.productName = kDefaultiMacNehalem; defaultSystemInfo.family = kDefaultiMacFamily; + defaultBaseBoard.product = kDefaultiMacNehalemBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisAllInOne; break; case CPU_MODEL_SANDYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (32nm) case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) + case CPU_MODEL_IVYBRIDGE_XEON: defaultBIOSInfo.version = kDefaultiMacSandyBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultiMacSandyBIOSReleaseDate; defaultSystemInfo.productName = kDefaultiMacSandy; - defaultSystemInfo.family = kDefaultiMacFamily; + defaultSystemInfo.family = kDefaultiMacFamily; + defaultBaseBoard.product = kDefaultiMacSandyBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisAllInOne; break; + case CPU_MODEL_NEHALEM: // Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) case CPU_MODEL_NEHALEM_EX: // Intel Xeon X75xx, Xeon X65xx, Xeon E75xx, Xeon E65x - defaultBIOSInfo.version = kDefaultMacProNehalemBIOSVersion; + defaultBIOSInfo.version = kDefaultMacProNehalemBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProNehalemBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacProNehalem; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.family = kDefaultMacProFamily; + defaultBaseBoard.product = kDefaultMacProNehalemBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule; + defaultChassis.chassisType = kSMBchassisTower; break; case CPU_MODEL_WESTMERE: // Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core case CPU_MODEL_WESTMERE_EX: // Intel Xeon E7 case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm) - defaultBIOSInfo.version = kDefaultMacProWestmereBIOSVersion; - defaultBIOSInfo.releaseDate = kDefaultMacProWestmereBIOSReleaseDate; + defaultBIOSInfo.version = kDefaultMacProWestmereBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProWestmereBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacProWestmere; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.family = kDefaultMacProFamily; + defaultBaseBoard.product = kDefaultMacProWestmereBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardProcessorMemoryModule; + defaultChassis.chassisType = kSMBchassisTower; break; default: - defaultBIOSInfo.version = kDefaultMacProBIOSVersion; + defaultBIOSInfo.version = kDefaultMacProBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacPro; - defaultSystemInfo.family = kDefaultMacProFamily; + defaultSystemInfo.family = kDefaultMacProFamily; + defaultBaseBoard.product = kDefaultMacProBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisUnknown; break; } break; } default: defaultBIOSInfo.version = kDefaultMacProBIOSVersion; + defaultBIOSInfo.releaseDate = kDefaultMacProBIOSReleaseDate; defaultSystemInfo.productName = kDefaultMacPro; defaultSystemInfo.family = kDefaultMacProFamily; + defaultBaseBoard.product = kDefaultMacProBoardProduct; + defaultBaseBoard.boardType = kSMBBaseBoardMotherboard; + defaultChassis.chassisType = kSMBchassisUnknown; break; } break; @@ -685,13 +837,12 @@ if (SMBSetters[idx].getSMBValue((returnType *)&string)) { break; - // if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo } } - if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue) && *(char *)(SMBSetters[idx].defaultValue)) + // if ((SMBSetters[idx].defaultValue) && *(SMBSetters[idx].defaultValue)) Bungo + if (useSMBIOSdefaults && (SMBSetters[idx].defaultValue)) { - // string = *(SMBSetters[idx].defaultValue); Bungo - string = (char *)(SMBSetters[idx].defaultValue); + string = *(SMBSetters[idx].defaultValue); break; } string = getSMBStringForField(structPtr->orig, *(uint8_t *)value); @@ -762,7 +913,7 @@ } // if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified" - if (SMBSetters[idx].valueType == kSMBString) + if ((SMBSetters[idx].valueType == kSMBString) && string) { setSMBStringForField(structPtr->new, string, &value->byte); } @@ -979,7 +1130,7 @@ addSMBEndOfTable(structPtr); } -// Bungo: does fix system uuid in SMBIOS istead of in EFI only +// Bungo: does fix system uuid in SMBIOS (and EFI) instead of in EFI only uint8_t *FixSystemUUID() { uint8_t *ptr = (uint8_t *)neweps->dmi.tableAddress; @@ -1084,8 +1235,8 @@ neweps->anchor[2] = 'M'; neweps->anchor[3] = '_'; neweps->entryPointLength = sizeof(SMBEntryPoint); - neweps->majorVersion = 2; - neweps->minorVersion = 4; + neweps->majorVersion = 2; // Bungo: + neweps->minorVersion = 4; // We're using 2.4 SMBIOS rev. as real Macs neweps->maxStructureSize = maxStructSize; neweps->entryPointRevision = 0; @@ -1109,7 +1260,7 @@ memcpy((void *)neweps->dmi.tableAddress, buffer, tableLength); // Bungo - Platform.UUID = FixSystemUUID(); // Fix System UUID + Platform.UUID = FixSystemUUID(); // Bungo: fix System UUID neweps->dmi.checksum = 0; neweps->dmi.checksum = 0x100 - checksum8(&neweps->dmi, sizeof(DMIEntryPoint)); @@ -1155,12 +1306,32 @@ { switch (structHeader->type) { - /* Bungo + /* Bungo: fixed in smbios now case kSMBTypeSystemInformation: Platform.UUID = ((SMBSystemInformation *)structHeader)->uuid; break; */ - + case kSMBTypeSystemEnclosure: // Bungo: determine platform type + switch (((SMBSystemEnclosure *)structHeader)->chassisType) { + case kSMBchassisDesktop: + case kSMBchassisLPDesktop: + case kSMBchassisAllInOne: + case kSMBchassisLunchBox: + PlatformType = 1; // desktop (iMac, MacMini) + break; + case kSMBchassisPortable: + case kSMBchassisLaptop: + case kSMBchassisNotebook: + case kSMBchassisHandHeld: + case kSMBchassisSubNotebook: + PlatformType = 2; // notebook (Mac Books) + break; + default: + PlatformType = 3; // workstation (Mac Pro, Xserve) + break; + } + break; + // case kSMBTypePhysicalMemoryArray: Platform.DMI.MaxMemorySlots += ((SMBPhysicalMemoryArray *)structHeader)->numMemoryDevices; break; Index: branches/ErmaC/Enoch/i386/libsaio/openbsd.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/openbsd.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/openbsd.h (revision 2323) @@ -1,2 +1,7 @@ +#ifndef __LIBSAIO_OPENBSD_H +#define __LIBSAIO_OPENBSD_H + extern bool OpenBSDProbe (const void *buf); -extern void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen); \ No newline at end of file +extern void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen); + +#endif /* !__LIBSAIO_OPENBSD_H */ Index: branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/smbios_decode.c (revision 2323) @@ -22,6 +22,111 @@ extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field); +// Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode dispays +#define NotSpecifiedStr "Not Specified" + +char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field) +{ + char *str; + str = getSMBStringForField(structHeader, field); + if (str == 0) + str = NotSpecifiedStr; + + return str; +}; +// + +// http://www.on-time.com/rtos-32-docs/rttarget-32/reference-manual/smbios/rtsmbios-oem-string.htm +// http://cvs.savannah.gnu.org/viewvc/dmidecode/dmidecode/ + +#define out_of_spec "" + +/*=== +7.2.2 +===*/ +static const char *dmi_system_wake_up_type[] = +{ + "Reserved", /* 00h */ + "Other", /* 01h */ + "Unknown", /* 02h */ + "APM Timer", /* 03h */ + "Modem Ring", /* 04h */ + "LAN Remote", /* 05h */ + "Power Switch", /* 06h */ + "PCI PME#", /* 07h */ + "AC Power Restored" /* 08h */ +}; + +static const int kdmi_system_wake_up_typeCount = sizeof(dmi_system_wake_up_type) / +sizeof(dmi_system_wake_up_type[0]); + +/*=== + 7.3.2 + ===*/ +static const char *dmi_base_board_type[] = +{ + "Reserved", /* 00h */ + "Unknown", /* 01h */ + "Other", /* 02h */ + "Server Blade", /* 03h */ + "Connectivity Switch", /* 04h */ + "System Management Module", /* 05h */ + "Processor Module", /* 06h */ + "I/O Module", /* 07h */ + "Memory Module", /* 08h */ + "Daughter Board", /* 09h */ + "Motherboard", /* 0Ah */ + "Processor+Memory Module", /* 0Bh */ + "Processor+I/O Module", /* 0Ch */ + "Interconnect Board" /* 0Dh */ +}; + +static const int kdmi_base_board_type = sizeof(dmi_base_board_type) / +sizeof(dmi_base_board_type[0]); + + /*=== + 7.4.1 + ===*/ +static const char *dmi_chassis_type[] = +{ + "Reserved", /* 00h */ + "Other", /* 01h */ + "Unknown", /* 02h */ + "Desktop", /* 03h */ + "Low Profile Desktop", /* 04h */ + "Pizza Box", /* 05h */ + "Mini Tower", /* 06h */ + "Tower", /* 07h */ + "Portable", /* 08h */ + "Laptop", /* 09h */ + "Notebook", /* 0Ah */ + "Hand Held", /* 0Bh */ + "Docking Station", /* 0Ch */ + "All in One", /* 0Dh */ + "Sub Notebook", /* 0Eh */ + "Space-saving", /* 0Fh */ + "Lunch Box", /* 10h */ + "Main Server Chassis", /* 11h */ + "Expansion Chassis", /* 12h */ + "SubChassis", /* 13h */ + "Bus Expansion Chassis",/* 14h */ + "Peripheral Chassis", /* 15h */ + "RAID Chassis", /* 16h */ + "Rack Mount Chassis", /* 17h */ + "Sealed-case PC", /* 18h */ + "Multi-system chassis", /* 19h */ + "Compact PCI", /* 1Ah */ + "Advanced TCA", /* 1Bh */ + "Blade", /* 1Ch */ // An SMBIOS implementation for a Blade would contain a Type 3 Chassis structure + "Blade Enclosing" /* 1Dh */ // A Blade Enclosure is a specialized chassis that contains a set of Blades. +}; + +static const int kdmi_chassis_typeCount = sizeof(dmi_chassis_type) / +sizeof(dmi_chassis_type[0]); + +/*===== + 7.18.2 + ====*/ static const char * SMBMemoryDeviceTypes[] = { @@ -62,10 +167,10 @@ void decodeBIOSInformation(SMBBIOSInformation *structHeader) { DBG("BIOS Information:\n"); - DBG("\tVendor: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor)); - DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); + DBG("\tVendor: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor)); + DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); // Address Segment - DBG("\tRelease Date: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->releaseDate)); + DBG("\tRelease Date: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->releaseDate)); // ROM Size //DBG("\tSupported BIOS functions: (0x%llX) %s\n", structHeader->characteristics, SMBBIOSInfoChar0[structHeader->characteristics]); // Major Release @@ -83,9 +188,9 @@ void decodeSystemInformation(SMBSystemInformation *structHeader) { DBG("System Information:\n"); - DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); - DBG("\tProduct Name: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->productName)); - DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); + DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); + DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->productName)); + DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); if (minorVersion < 1 || structHeader->header.length < 25) @@ -100,8 +205,8 @@ if (minorVersion < 4 || structHeader->header.length < 27) return; - DBG("\tSKU Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber)); // System SKU# - DBG("\tFamily: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->family)); + DBG("\tSKU Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber)); // System SKU# + DBG("\tFamily: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->family)); DBG("\n"); } @@ -111,13 +216,13 @@ void decodeBaseBoard(SMBBaseBoard *structHeader) { DBG("Base Board Information:\n"); - DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); - DBG("\tProduct Name: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->product)); - DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); - DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); - DBG("\tAsset Tag: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber)); + DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); + DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->product)); + DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); + DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); + DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber)); // Feature Flags (BYTE) - DBG("\tLocation In Chassis: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis)); // Part Component + DBG("\tLocation In Chassis: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis)); // Part Component // Chassis Handle (WORD) DBG("\tType: 0x%X\n", structHeader->boardType); // Number of Contained Object Handles (n) (BYTE) @@ -131,11 +236,11 @@ void decodeSystemEnclosure(SMBSystemEnclosure *structHeader) { DBG("Chassis Information:\n"); - DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); - DBG("\tType: %d\n", structHeader->type); - DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); - DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); - DBG("\tAsset Tag Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber)); + DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); + DBG("\tType: 0x%X\n", structHeader->chassisType); + DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version)); + DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); + DBG("\tAsset Tag Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber)); // Boot-up State: // Power Supply State // Thermal State @@ -155,12 +260,12 @@ void decodeProcessorInformation(SMBProcessorInformation *structHeader) { DBG("Processor Information:\n"); - DBG("\tSocket Designation: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation)); + DBG("\tSocket Designation: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation)); DBG("\tType: %d\n", structHeader->processorType); DBG("\tFamily: 0x%X\n", structHeader->processorFamily); - DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); + DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); DBG("\tID: 0x%llX\n", structHeader->processorID); - DBG("\tProcessor Version: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->processorVersion)); + DBG("\tProcessor Version: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->processorVersion)); // DBG("\tVoltage: 0.%xV\n", structHeader->voltage); DBG("\tExternal Clock: %dMHz\n", structHeader->externalClock); DBG("\tMaximum Clock: %dMHz\n", structHeader->maximumClock); @@ -168,9 +273,9 @@ if (minorVersion < 3 || structHeader->header.length < 35) return; - DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); - DBG("\tAsset Tag: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag)); - DBG("\tPart Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber)); + DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); + DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag)); + DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber)); // DBG("\tProcessor Family 2: %d\n", structHeader->processorFamily2); DBG("\n"); } @@ -178,30 +283,49 @@ //------------------------------------------------------------------------------------------------------------------------- // Memory Module Information (Type 6) //------------------------------------------------------------------------------------------------------------------------- +//void decodeMemoryModule(SMBMemoryModule *structHeader) +//{ +// DBG("Memory Module Information:\n"); +// DBG("\tSocket Designation: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation)); +// DBG("\tBank Connections: Type: %d\n", structHeader->bankConnections); +// DBG("\tCurrent Speed: %X\n", structHeader->currentSpeed); +// DBG("\tCurrent Memory Type: %llX\n", structHeader->currentMemoryType); +// DBG("\tInstalled Size: %d\n", structHeader->installedSize); +// DBG("\tEnabled Size: %d\n", structHeader->enabledSize); +// DBG("\tError Status: %x\n", structHeader->errorStatus); +// DBG("\n"); +//} //------------------------------------------------------------------------------------------------------------------------- // OEM Strings (Type 11) //------------------------------------------------------------------------------------------------------------------------- +//void decodeSMBOEMStrings(SMBOEMStrings *structHeader) +//{ +// DBG("OEM Strings:\n"); +// DBG("\tString 1: %d\n"); //, structHeader->string1); +// DBG("\tString 2: %d\n"); //, structHeader->string1); +// DBG("\tString 3: %d\n"); //, structHeader->string1); +// DBG("\n"); +//} - //------------------------------------------------------------------------------------------------------------------------- // MemoryDevice (Type 17) //------------------------------------------------------------------------------------------------------------------------- void decodeMemoryDevice(SMBMemoryDevice *structHeader) { DBG("Memory Device:\n"); - DBG("\tDevice Locator: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator)); - DBG("\tBank Locator: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator)); + DBG("\tDevice Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator)); + DBG("\tBank Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator)); DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[structHeader->memoryType]); if (minorVersion < 3 || structHeader->header.length < 27) return; DBG("\tSpeed: %d MHz\n", structHeader->memorySpeed); DBG("\tError Handle: %x\n", structHeader->errorHandle); - DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); - DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); - DBG("\tAsset Tag: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag)); - DBG("\tPart Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber)); + DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer)); + DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber)); + DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag)); + DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber)); DBG("\n"); } @@ -261,24 +385,32 @@ decodeProcessorInformation((SMBProcessorInformation *)structHeader); break; + //case 6: // kSMBTypeMemoryModule: // Type 6 + // decodeMemoryModule((SMBMemoryModule *)structHeader); + // break; + + //case 11: // kSMBOEMStrings: // Type 11 + // decodeSMBOEMStrings((SMBOEMStrings *)structHeader); + // break; + case kSMBTypeMemoryDevice: // Type 17 decodeMemoryDevice((SMBMemoryDevice *)structHeader); break; /* Skip all Apple Specific Structures */ - case kSMBTypeFirmwareVolume: // Type - case kSMBTypeMemorySPD: // Type + case kSMBTypeFirmwareVolume: // Type 128 + case kSMBTypeMemorySPD: // Type 130 break; - case kSMBTypeOemProcessorType: // Type + case kSMBTypeOemProcessorType: // Type 131 decodeOemProcessorType((SMBOemProcessorType *)structHeader); break; - case kSMBTypeOemProcessorBusSpeed: // Type + case kSMBTypeOemProcessorBusSpeed: // Type 132 decodeOemProcessorBusSpeed((SMBOemProcessorBusSpeed *)structHeader); break; - case kSMBTypeEndOfTable: // Type + case kSMBTypeEndOfTable: // Type 127 /* Skip, to be added at the end */ break; Index: branches/ErmaC/Enoch/i386/libsaio/hpet.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/hpet.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/hpet.c (revision 2323) @@ -1,5 +1,5 @@ /* - * + * Copyright (c) 2009 Evan Lojewski. All rights reserved. */ #include "libsaio.h" @@ -16,8 +16,18 @@ #define DBG(x...) #endif -static struct lpc_controller_t lpc_controllers[] = { +void force_enable_hpet_intel(pci_dt_t *lpc_dev); +void force_enable_hpet_nvidia(pci_dt_t *lpc_dev); +void force_enable_hpet_via(pci_dt_t *lpc_dev); +/* + * Force HPET enabled + * + * VIA fix from http://forum.voodooprojects.org/index.php/topic,1596.0.html + */ + +static struct lpc_controller_t lpc_controllers_intel[] = { + // Default unknown chipset { 0, 0, "" }, @@ -25,12 +35,15 @@ { 0x8086, 0x24dc, "ICH5" }, { 0x8086, 0x2640, "ICH6" }, { 0x8086, 0x2641, "ICH6M" }, + { 0x8086, 0x2670, "631xESB" }, { 0x8086, 0x27b0, "ICH7 DH" }, { 0x8086, 0x27b8, "ICH7" }, { 0x8086, 0x27b9, "ICH7M" }, { 0x8086, 0x27bd, "ICH7M DH" }, + { 0x8086, 0x27bc, "NM10" }, + { 0x8086, 0x2810, "ICH8R" }, { 0x8086, 0x2811, "ICH8M-E" }, { 0x8086, 0x2812, "ICH8DH" }, @@ -48,27 +61,211 @@ { 0x8086, 0x3a16, "ICH10R" }, { 0x8086, 0x3a18, "ICH10" }, { 0x8086, 0x3a1a, "ICH10D" }, + { 0x8086, 0x3b00, "5 Series" }, + { 0x8086, 0x3b01, "Mobile 5 Series" }, + { 0x8086, 0x3b02, "5 Series" }, + { 0x8086, 0x3b09, "Mobile 5 Series" }, + { 0x8086, 0x1c41, "Mobile SFF 6 Series" }, + { 0x8086, 0x1c42, "6 Series" }, + { 0x8086, 0x1c43, "Mobile 6 Series" }, + { 0x8086, 0x1c44, "Z68" }, + { 0x8086, 0x1c46, "UM67" }, + { 0x8086, 0x1c47, "UM67" }, + { 0x8086, 0x1c49, "HM65" }, + { 0x8086, 0x1c4a, "H67" }, + { 0x8086, 0x1c4b, "HM67" }, + { 0x8086, 0x1c4c, "Q65" }, + { 0x8086, 0x1c4d, "QS67" }, + { 0x8086, 0x1c4e, "Q67" }, + { 0x8086, 0x1c4f, "QM67" }, + { 0x8086, 0x1c50, "B65" }, + { 0x8086, 0x1c52, "C202" }, + { 0x8086, 0x1c54, "C204" }, + { 0x8086, 0x1c56, "C206" }, + { 0x8086, 0x1c5c, "H61" }, + + { 0x8086, 0x1c58, "B65" }, + { 0x8086, 0x1c59, "HM67" }, + { 0x8086, 0x1c5a, "Q67" }, + +// { 0x8086, 0x1dc1, "PATSBURG" }, + + { 0x8086, 0x1e41, "Mobile C216/7 Series" }, + { 0x8086, 0x1e42, "Mobile 7 Series" }, + { 0x8086, 0x1e43, "Mobile 7 Series" }, + { 0x8086, 0x1e44, "Z77" }, + { 0x8086, 0x1e45, "H71" }, + { 0x8086, 0x1e46, "Z75" }, + { 0x8086, 0x1e47, "Q77" }, + { 0x8086, 0x1e48, "Q75" }, + { 0x8086, 0x1e49, "B75" }, + { 0x8086, 0x1e4a, "H77" }, + { 0x8086, 0x1e4b, "B75" }, + + { 0x8086, 0x8119, "SCH 8119" }, + }; +static struct lpc_controller_t lpc_controllers_nvidia[] = { + + // Default unknown chipset + { 0, 0, "" }, + + // nVidia + { 0x10de, 0x0aac, "MCP79" }, + { 0x10de, 0x0aae, "MCP79" }, + { 0x10de, 0x0aaf, "MCP79" }, + { 0x10de, 0x0d80, "MCP89" }, + { 0x10de, 0x0d81, "MCP89" }, + { 0x10de, 0x0d82, "MCP89" }, + { 0x10de, 0x0d83, "MCP89" }, + +}; + +static struct lpc_controller_t lpc_controllers_via[] = { + // Default unknown chipset + { 0, 0, "" }, + + { 0x1106, 0x3372, "VT8237S" }, +}; + + void force_enable_hpet(pci_dt_t *lpc_dev) { + switch(lpc_dev->vendor_id) + { + case 0x8086: + force_enable_hpet_intel(lpc_dev); + break; + + case 0x10de: + force_enable_hpet_nvidia(lpc_dev); + break; + + case 0x1106: + force_enable_hpet_via(lpc_dev); + break; + } + +#if DEBUG_HPET + printf("Press [Enter] to continue...\n"); + getchar(); +#endif + +} + +/* ErmaC add lpc for nVidia */ +void force_enable_hpet_nvidia(pci_dt_t *lpc_dev) +{ + uint32_t val, hpet_address = 0xFED00000; int i; + void *rcba; + + for(i = 1; i < sizeof(lpc_controllers_nvidia) / sizeof(lpc_controllers_nvidia[0]); i++) + { + if ((lpc_controllers_nvidia[i].vendor == lpc_dev->vendor_id) && (lpc_controllers_nvidia[i].device == lpc_dev->device_id)) + { + + rcba = (void *)(pci_config_read32(lpc_dev->dev.addr, 0xF0) & 0xFFFFC000); + + DBG("nVidia(R) %s LPC Interface [%04x:%04x], MMIO @ 0x%lx\n", + lpc_controllers_nvidia[i].name, lpc_dev->vendor_id, lpc_dev->device_id, rcba); + + if (rcba == 0) + { + printf(" RCBA disabled; cannot force enable HPET\n"); + } + else + { + val = REG32(rcba, 0x3404); + if (val & 0x80) + { + // HPET is enabled in HPTC. Just not reported by BIOS + DBG(" HPET is enabled in HPTC, just not reported by BIOS\n"); + hpet_address |= (val & 3) << 12 ; + DBG(" HPET MMIO @ 0x%lx\n", hpet_address); + } + else + { + // HPET disabled in HPTC. Trying to enable + DBG(" HPET is disabled in HPTC, trying to enable\n"); + REG32(rcba, 0x3404) = val | 0x80; + hpet_address |= (val & 3) << 12 ; + DBG(" Force enabled HPET, MMIO @ 0x%lx\n", hpet_address); + } + + // verify if the job is done + val = REG32(rcba, 0x3404); + if (!(val & 0x80)) + { + printf(" Failed to force enable HPET\n"); + } + } + break; + } + } +} + +void force_enable_hpet_via(pci_dt_t *lpc_dev) +{ uint32_t val, hpet_address = 0xFED00000; + int i; + + for(i = 1; i < sizeof(lpc_controllers_via) / sizeof(lpc_controllers_via[0]); i++) + { + if ((lpc_controllers_via[i].vendor == lpc_dev->vendor_id) && (lpc_controllers_via[i].device == lpc_dev->device_id)) + { + val = pci_config_read32(lpc_dev->dev.addr, 0x68); + + DBG("VIA %s LPC Interface [%04x:%04x], MMIO\n", + lpc_controllers_via[i].name, lpc_dev->vendor_id, lpc_dev->device_id); + + if (val & 0x80) + { + hpet_address = (val & ~0x3ff); + DBG("HPET at 0x%lx\n", hpet_address); + } + else + { + val = 0xfed00000 | 0x80; + pci_config_write32(lpc_dev->dev.addr, 0x68, val); + val = pci_config_read32(lpc_dev->dev.addr, 0x68); + if (val & 0x80) + { + hpet_address = (val & ~0x3ff); + DBG("Force enabled HPET at 0x%lx\n", hpet_address); + } + else + { + DBG("Unable to enable HPET"); + } + } + } + } +} + +void force_enable_hpet_intel(pci_dt_t *lpc_dev) +{ + uint32_t val, hpet_address = 0xFED00000; + int i; void *rcba; /* LPC on Intel ICH is always (?) at 00:1f.0 */ - for(i = 1; i < sizeof(lpc_controllers) / sizeof(lpc_controllers[0]); i++) - if ((lpc_controllers[i].vendor == lpc_dev->vendor_id) - && (lpc_controllers[i].device == lpc_dev->device_id)) + for(i = 1; i < sizeof(lpc_controllers_intel) / sizeof(lpc_controllers_intel[0]); i++) + { + if ((lpc_controllers_intel[i].vendor == lpc_dev->vendor_id) && (lpc_controllers_intel[i].device == lpc_dev->device_id)) { + rcba = (void *)(pci_config_read32(lpc_dev->dev.addr, 0xF0) & 0xFFFFC000); DBG("Intel(R) %s LPC Interface [%04x:%04x], MMIO @ 0x%lx\n", - lpc_controllers[i].name, lpc_dev->vendor_id, lpc_dev->device_id, rcba); + lpc_controllers_intel[i].name, lpc_dev->vendor_id, lpc_dev->device_id, rcba); if (rcba == 0) + { printf(" RCBA disabled; cannot force enable HPET\n"); + } else { val = REG32(rcba, 0x3404); @@ -91,13 +288,12 @@ // verify if the job is done val = REG32(rcba, 0x3404); if (!(val & 0x80)) + { printf(" Failed to force enable HPET\n"); + } } break; } + } +} -#if DEBUG_HPET - printf("Press [Enter] to continue...\n"); - getchar(); -#endif -} Index: branches/ErmaC/Enoch/i386/libsaio/smbios.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/smbios.h (revision 2323) @@ -23,10 +23,10 @@ #ifndef __LIBSAIO_SMBIOS_H #define __LIBSAIO_SMBIOS_H -// -// Based on System Management BIOS Reference Specification v2.5 -// +/* Based on System Management BIOS Reference Specification v2.5 */ +// http://dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf + typedef uint8_t SMBString; typedef uint8_t SMBByte; typedef uint16_t SMBWord; @@ -84,7 +84,7 @@ /* ======================= SMBIOS structure types. - =======================*/ + ======================= */ enum { kSMBTypeBIOSInformation = 0, // BIOS information (Type 0) @@ -134,7 +134,7 @@ // Inactive (Type 126) kSMBTypeEndOfTable = 127, // End-of-Table (Type 127) - /* Apple Specific Structures */ + // Apple Specific Structures kSMBTypeFirmwareVolume = 128, // FirmwareVolume (TYPE 128) kSMBTypeMemorySPD = 130, // MemorySPD (TYPE 130) kSMBTypeOemProcessorType = 131, // Processor Type (Type 131) @@ -231,7 +231,8 @@ { SMB_STRUCT_HEADER // Type 3 SMBString manufacturer; - SMBByte type; // System Enclosure Indicator +// SMBByte type; Bungo: renamed to chassisType - convention + SMBByte chassisType; // System Enclosure Indicator SMBString version; // Board Number? SMBString serialNumber; SMBString assetTagNumber; @@ -248,6 +249,27 @@ // SMBString skuNumber; // Number of null-terminated string describing the chassis or enclosure SKU number (2.7+) } __attribute__((packed)) SMBSystemEnclosure; +// Bungo: values for SMBSystemEnclosure.chassisType +enum { + kSMBchassisOther = 0x01, + kSMBchassisUnknown = 0x02, + kSMBchassisDesktop = 0x03, + kSMBchassisLPDesktop = 0x04, + kSMBchassisPizzaBox = 0x05, + kSMBchassisMiniTower = 0x06, + kSMBchassisTower = 0x07, + kSMBchassisPortable = 0x08, + kSMBchassisLaptop = 0x09, + kSMBchassisNotebook = 0x0A, + kSMBchassisHandHeld = 0x0B, + kSMBchassisDockingStation = 0x0C, + kSMBchassisAllInOne = 0x0D, + kSMBchassisSubNotebook = 0x0E, + // ... + kSMBchassisLunchBox = 0x10 + // fill up if needed ;-) +}; + /* ============================ Processor Information (Type 4) ============================== */ Index: branches/ErmaC/Enoch/i386/libsaio/cache.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/cache.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/cache.c (revision 2323) @@ -31,9 +31,9 @@ // #include struct CacheEntry { - CICell ih; - long time; - long long offset; + CICell ih; + long time; + long long offset; }; typedef struct CacheEntry CacheEntry; @@ -48,128 +48,155 @@ static long gCacheTime; #ifdef __i386__ -static CacheEntry *gCacheEntries; -static char *gCacheBuffer; + static CacheEntry *gCacheEntries; + static char *gCacheBuffer; #else -static CacheEntry gCacheEntries[kCacheMaxEntries]; -static char gCacheBuffer[kCacheSize]; + static CacheEntry gCacheEntries[kCacheMaxEntries]; + static char gCacheBuffer[kCacheSize]; #endif #if CACHE_STATS -unsigned long gCacheHits; -unsigned long gCacheMisses; -unsigned long gCacheEvicts; + unsigned long gCacheHits; + unsigned long gCacheMisses; + unsigned long gCacheEvicts; #endif void CacheReset() { - gCacheIH = NULL; + gCacheIH = NULL; } void CacheInit( CICell ih, long blockSize ) { #ifdef __i386__ - if ((ih == gCacheIH) && (blockSize == gCacheBlockSize)) - return; + if ((ih == gCacheIH) && (blockSize == gCacheBlockSize)) + { + return; + } #endif - if ((blockSize < kCacheMinBlockSize) || - (blockSize > kCacheMaxBlockSize)) - return; + if ((blockSize < kCacheMinBlockSize) || (blockSize > kCacheMaxBlockSize)) + { + return; + } - gCacheBlockSize = blockSize; - gCacheNumEntries = kCacheSize / gCacheBlockSize; - gCacheTime = 0; + gCacheBlockSize = blockSize; + gCacheNumEntries = kCacheSize / gCacheBlockSize; + gCacheTime = 0; #if CACHE_STATS - gCacheHits = 0; - gCacheMisses = 0; - gCacheEvicts = 0; + gCacheHits = 0; + gCacheMisses = 0; + gCacheEvicts = 0; #endif gCacheIH = ih; #ifdef __i386__ - if (!gCacheBuffer) gCacheBuffer = (char *) malloc(kCacheSize); - if (!gCacheEntries) gCacheEntries = (CacheEntry *) malloc(kCacheMaxEntries * sizeof(CacheEntry)); - if ( !gCacheBuffer || !gCacheEntries ) - { - gCacheIH = 0; // invalidate cache - return; - } + if (!gCacheBuffer) + { + gCacheBuffer = (char *) malloc(kCacheSize); + } + + if (!gCacheEntries) + { + gCacheEntries = (CacheEntry *) malloc(kCacheMaxEntries * sizeof(CacheEntry)); + } + + if (!gCacheBuffer || !gCacheEntries) + { + gCacheIH = 0; // invalidate cache + return; + } #endif - bzero(gCacheEntries, kCacheMaxEntries * sizeof(CacheEntry)); + bzero(gCacheEntries, kCacheMaxEntries * sizeof(CacheEntry)); } -long CacheRead( CICell ih, char * buffer, long long offset, - long length, long cache ) +long CacheRead(CICell ih, char * buffer, long long offset, long length, long cache) { - long cnt, oldestEntry = 0, oldestTime, loadCache = 0; - CacheEntry *entry; + long cnt, oldestEntry = 0, oldestTime, loadCache = 0; + CacheEntry *entry; - // See if the data can be cached. - if (cache && (gCacheIH == ih) && (length == gCacheBlockSize)) { - // Look for the data in the cache. - for (cnt = 0; cnt < gCacheNumEntries; cnt++) { - entry = &gCacheEntries[cnt]; - if ((entry->ih == ih) && (entry->offset == offset)) { - entry->time = ++gCacheTime; - break; - } - } + // See if the data can be cached. + if (cache && (gCacheIH == ih) && (length == gCacheBlockSize)) + { + // Look for the data in the cache. + for (cnt = 0; cnt < gCacheNumEntries; cnt++) + { + entry = &gCacheEntries[cnt]; - // If the data was found copy it to the caller. - if (cnt != gCacheNumEntries) { - bcopy(gCacheBuffer + cnt * gCacheBlockSize, buffer, gCacheBlockSize); + if ((entry->ih == ih) && (entry->offset == offset)) + { + entry->time = ++gCacheTime; + break; + } + } + + // If the data was found copy it to the caller. + if (cnt != gCacheNumEntries) + { + bcopy(gCacheBuffer + cnt * gCacheBlockSize, buffer, gCacheBlockSize); #if CACHE_STATS - gCacheHits++; + gCacheHits++; #endif - return gCacheBlockSize; - } + return gCacheBlockSize; + } - // Could not find the data in the cache. - loadCache = 1; - } + // Could not find the data in the cache. + loadCache = 1; + } - // Read the data from the disk. - Seek(ih, offset); - Read(ih, (long)buffer, length); + // Read the data from the disk. + Seek(ih, offset); + Read(ih, (long)buffer, length); + #if CACHE_STATS - if (cache) gCacheMisses++; + if (cache) + { + gCacheMisses++; + } #endif - // Put the data from the disk in the cache if needed. - if (loadCache) { - // Find a free entry. - oldestTime = gCacheTime; - for (cnt = 0; cnt < gCacheNumEntries; cnt++) { - entry = &gCacheEntries[cnt]; + // Put the data from the disk in the cache if needed. + if (loadCache) + { + // Find a free entry. + oldestTime = gCacheTime; - // Found a free entry. - if (entry->ih == 0) break; + for (cnt = 0; cnt < gCacheNumEntries; cnt++) + { + entry = &gCacheEntries[cnt]; + + // Found a free entry. + if (entry->ih == 0) + { + break; + } - if (entry->time < oldestTime) { - oldestTime = entry->time; - oldestEntry = cnt; - } - } + if (entry->time < oldestTime) + { + oldestTime = entry->time; + oldestEntry = cnt; + } + } - // If no free entry was found, use the oldest. - if (cnt == gCacheNumEntries) { - cnt = oldestEntry; + // If no free entry was found, use the oldest. + if (cnt == gCacheNumEntries) + { + cnt = oldestEntry; #if CACHE_STATS - gCacheEvicts++; + gCacheEvicts++; #endif - } + } - // Copy the data from disk to the new entry. - entry = &gCacheEntries[cnt]; - entry->ih = ih; - entry->time = ++gCacheTime; - entry->offset = offset; - bcopy(buffer, gCacheBuffer + cnt * gCacheBlockSize, gCacheBlockSize); - } + // Copy the data from disk to the new entry. + entry = &gCacheEntries[cnt]; + entry->ih = ih; + entry->time = ++gCacheTime; + entry->offset = offset; + bcopy(buffer, gCacheBuffer + cnt * gCacheBlockSize, gCacheBlockSize); + } - return length; + return length; } Index: branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/nvidia_helper.c (revision 2323) @@ -15,35 +15,35 @@ NVIDIA card injection usage e.g (to be placed in the boot.plist): NVIDIA - - - Chipset Name - Quadro FX 380 - IOPCIPrimaryMatch - 0x10DE0658 - VRam Size - 256 - - - Chipset Name - YOUR_CARD_NAME - IOPCIPrimaryMatch - YOUR_CARD_ID - IOPCISubDevId - YOUR_CARD_SUB_ID(if necessary) - VRam Size - YOUR_CARD_VRAM_SIZE - - - Chipset Name - YOUR_SECOND_CARD_NAME - IOPCIPrimaryMatch - YOUR_SECOND_CARD_ID - IOPCISubDevId - YOUR_SECOND_CARD_SUB_ID(if necessary) - VRam Size - YOUR_SECOND_CARD_VRAM_SIZE - + + + Chipset Name + Quadro FX 380 + IOPCIPrimaryMatch + 0x10DE0658 + VRam Size + 256 + + + Chipset Name + YOUR_CARD_NAME + IOPCIPrimaryMatch + YOUR_CARD_ID + IOPCISubDevId + YOUR_CARD_SUB_ID(if necessary) + VRam Size + YOUR_CARD_VRAM_SIZE + + + Chipset Name + YOUR_SECOND_CARD_NAME + IOPCIPrimaryMatch + YOUR_SECOND_CARD_ID + IOPCISubDevId + YOUR_SECOND_CARD_SUB_ID(if necessary) + VRam Size + YOUR_SECOND_CARD_VRAM_SIZE + . . . @@ -110,7 +110,7 @@ unsigned int i, count; TagPtr NVDIATag; char *model_name = NULL, *match_id = NULL, *sub_id = NULL, *vram_size = NULL; - uint32_t dev_id = 0, subdev_id = 0; + uint32_t dev_id = 0, subdev_id = 0; uint64_t VramSize = 0; if ((NVDIATag = XMLCastArray(XMLGetProperty(bootInfo->chameleonConfig.dictionary, (const char*)"NVIDIA")))) Index: branches/ErmaC/Enoch/i386/libsaio/freebsd.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/freebsd.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/freebsd.c (revision 2323) @@ -3,10 +3,11 @@ #include "freebsd.h" #define FreeBSDProbeSize 2048 +#define DISKMAGIC ((uint32_t)0x19540119) /* The disk magic number */ bool FreeBSDProbe (const void *buf) { - return (OSReadLittleInt32(buf+0xA55C,0)==0x19540119); + return (OSReadLittleInt32(buf+0xA55C,0) == DISKMAGIC); } void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen) { Index: branches/ErmaC/Enoch/i386/libsaio/pci.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/pci.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/pci.c (revision 2323) @@ -79,11 +79,15 @@ for (func = 0; func < 8; func++) { pci_addr = PCIADDR(bus, dev, func); id = pci_config_read32(pci_addr, PCI_VENDOR_ID); - if (!id || id == 0xffffffff) { + if (!id || id == 0xfffffffful) { continue; } new = (pci_dt_t*)malloc(sizeof(pci_dt_t)); + if (!new) { + continue; + } bzero(new, sizeof(pci_dt_t)); + new->dev.addr = pci_addr; new->vendor_id = id & 0xffff; new->device_id = (id >> 16) & 0xffff; @@ -91,6 +95,7 @@ new->revision_id = pci_config_read8(pci_addr, PCI_CLASS_REVISION); new->subsys_id.subsys_id = pci_config_read32(pci_addr, PCI_SUBSYSTEM_VENDOR_ID); new->class_id = pci_config_read16(pci_addr, PCI_CLASS_DEVICE); + //new->subclass_id = pci_config_read16(pci_addr, PCI_SUBCLASS_DEVICE); new->parent = start; header_type = pci_config_read8(pci_addr, PCI_HEADER_TYPE); @@ -102,6 +107,8 @@ scan_pci_bus(new, secondary_bus); } break; + default: + break; } *current = new; current = &new->next; @@ -124,7 +131,7 @@ { return; } - rcba = pci_config_read32(PCIADDR(0, 0x1f, 0), 0xf0) & ~1; + 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 */ *fd &= ~0x8; @@ -136,6 +143,11 @@ void build_pci_dt(void) { root_pci_dev = malloc(sizeof(pci_dt_t)); + + if (!root_pci_dev) { + return; + } + bzero(root_pci_dev, sizeof(pci_dt_t)); enable_pci_devs(); scan_pci_bus(root_pci_dev, 0); @@ -151,7 +163,7 @@ { 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; @@ -159,19 +171,20 @@ int uid = getPciRootUID(); while (end != pci_dt) { - current = pci_dt; - while (current->parent != end) - current = current->parent; - end = current; - 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 { - 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); - } + current = pci_dt; + while (current->parent != end) + current = current->parent; + end = current; + 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 { + 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); + } + } return dev_path; } @@ -184,8 +197,8 @@ while (current) { printf("%02x:%02x.%x [%04x%02x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n", current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func, - current->class_id, 0 /* FIXME: what should this be? */, - current->vendor_id, current->device_id, + current->class_id, 0 /* FIXME: what should this be? */, + current->vendor_id, current->device_id, current->subsys_id.subsys.vendor_id, current->subsys_id.subsys.device_id, get_pci_dev_path(current)); dump_pci_dt(current->children); Index: branches/ErmaC/Enoch/i386/libsaio/stringTable.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/stringTable.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/stringTable.c (revision 2323) @@ -135,34 +135,31 @@ return true; } -char * -newStringFromList( - char **list, - int *size -) +char *newStringFromList(char **list, int *size) { - char *begin = *list, *end; - char *newstr; - int newsize = *size; - int bufsize; + char *begin = *list, *end; + char *newstr; + int newsize = *size; + int bufsize; - while (*begin && newsize && isspace(*begin)) { - begin++; - newsize--; - } - end = begin; - while (*end && newsize && !isspace(*end)) { - end++; - newsize--; - } - if (begin == end) - return 0; - bufsize = end - begin + 1; - newstr = malloc(bufsize); - strlcpy(newstr, begin, bufsize); - *list = end; - *size = newsize; - return newstr; + while (*begin && newsize && isspace(*begin)) { + begin++; + newsize--; + } + end = begin; + while (*end && newsize && !isspace(*end)) { + end++; + newsize--; + } + if (begin == end) { + return 0; + } + bufsize = end - begin + 1; + newstr = malloc(bufsize); + strlcpy(newstr, begin, bufsize); + *list = end; + *size = newsize; + return newstr; } #endif @@ -174,16 +171,14 @@ { int ret = 0; - while (*table) - { - if (*table == '\\') - { + while (*table) { + if (*table == '\\') { table += 2; ret += 1 + (compress ? 0 : 1); - } - else - { - if (*table == '\"') return ret; + } else { + if (*table == '\"') { + return ret; + } ret++; table++; } @@ -200,8 +195,7 @@ value = XMLGetProperty(config->dictionary, key); if (value != 0) { if (value->type != kTagTypeString) { - error("Non-string tag '%s' found in config file\n", - key); + error("Non-string tag '%s' found in config file\n", key); return false; } *val = value->string; @@ -209,7 +203,7 @@ return true; } } else { - + // Legacy plist-style table } @@ -224,42 +218,38 @@ * in the string table matching 'key'. Also translates * \n escapes in the string. */ -char *newStringForStringTableKey( - char *table, - char *key, - config_file_t *config -) +char *newStringForStringTableKey(char *table, char *key, config_file_t *config) { - const char *val; - char *newstr, *p; - int size; + const char *val; + char *newstr, *p; + int size; - if (getValueForConfigTableKey(config, key, &val, &size)) { - newstr = (char *)malloc(size+1); - for (p = newstr; size; size--, p++, val++) { - if ((*p = *val) == '\\') { - switch (*++val) { - case 'r': - *p = '\r'; - break; - case 'n': - *p = '\n'; - break; - case 't': - *p = '\t'; - break; - default: - *p = *val; - break; + if (getValueForConfigTableKey(config, key, &val, &size)) { + newstr = (char *)malloc(size+1); + for (p = newstr; size; size--, p++, val++) { + if ((*p = *val) == '\\') { + switch (*++val) { + case 'r': + *p = '\r'; + break; + case 'n': + *p = '\n'; + break; + case 't': + *p = '\t'; + break; + default: + *p = *val; + break; + } + size--; + } } - size--; - } + *p = '\0'; + return newstr; + } else { + return 0; } - *p = '\0'; - return newstr; - } else { - return 0; - } } #endif @@ -267,17 +257,17 @@ char * newStringForKey(char *key, config_file_t *config) { - const char *val; - char *newstr; - int size; + const char *val; + char *newstr; + int size; - if (getValueForKey(key, &val, &size, config) && size) { - newstr = (char *)malloc(size + 1); - strlcpy(newstr, val, size + 1); - return newstr; - } else { - return 0; - } + if (getValueForKey(key, &val, &size, config) && size) { + newstr = (char *)malloc(size + 1); + strlcpy(newstr, val, size + 1); + return newstr; + } else { + return 0; + } } /* parse a command line @@ -288,64 +278,68 @@ static const char *getToken(const char *line, const char **begin, int *len) { - if (*line == '\"') { - *begin = ++line; - while (*line && *line != '\"') - line++; - *len = line++ - *begin; - } else { - *begin = line; - while (*line && !isspace(*line) && *line != '=') - line++; - *len = line - *begin; - } - return line; + if (*line == '\"') { + *begin = ++line; + while (*line && *line != '\"') { + line++; + } + *len = line++ - *begin; + } else { + *begin = line; + while (*line && !isspace(*line) && *line != '=') { + line++; + } + *len = line - *begin; + } + return line; } bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len) { - const char *key, *value; - int key_len, value_len; - bool retval = false; + const char *key, *value; + int key_len, value_len; + bool retval = false; - while (*line) { - /* look for keyword or argument */ - while (isspace(*line)) line++; + while (*line) { + /* look for keyword or argument */ + while (isspace(*line)) { + line++; + } - /* now look for '=' or whitespace */ - line = getToken(line, &key, &key_len); - /* line now points to '=' or space */ - if (*line && !isspace(*line)) { - line = getToken(++line, &value, &value_len); - } else { - value = line; - value_len = 0; - } - if ((strlen(match) == key_len) - && strncmp(match, key, key_len) == 0) { - // create a new string - char* newstr = malloc(value_len + 1); - strncpy(newstr, value, value_len); - newstr[value_len] = 0; + /* now look for '=' or whitespace */ + line = getToken(line, &key, &key_len); + /* line now points to '=' or space */ + if (*line && !isspace(*line)) { + line = getToken(++line, &value, &value_len); + } else { + value = line; + value_len = 0; + } + if ((strlen(match) == key_len) && strncmp(match, key, key_len) == 0) { + // create a new string + char* newstr = malloc(value_len + 1); + strncpy(newstr, value, value_len); + newstr[value_len] = 0; - *matchval = newstr; - *len = value_len; - retval = true; - /* Continue to look for this key; last one wins. */ + *matchval = newstr; + *len = value_len; + retval = true; + /* Continue to look for this key; last one wins. */ + } } - } - - return retval; + return retval; } /* Return NULL if no option has been successfully retrieved, or the string otherwise */ const char * getStringForKey(const char * key, config_file_t *config) { - static const char* value =0; - int len=0; - if(!getValueForKey(key, &value, &len, config)) value = 0; - return value; + static const char* value =0; + int len=0; + if(!getValueForKey(key, &value, &len, config)) { + value = 0; + } + return value; } @@ -358,50 +352,47 @@ const char *key_val; int size; - if (getValueForKey(key, &key_val, &size, config)) { - if ( (size >= 1) && (key_val[0] == 'Y' || key_val[0] == 'y') ) { - *result_val = true; - } else { - *result_val = false; - } - return true; - } - return false; + if (getValueForKey(key, &key_val, &size, config)) { + if ( (size >= 1) && (key_val[0] == 'Y' || key_val[0] == 'y') ) { + *result_val = true; + } else { + *result_val = false; + } + return true; + } + return false; } bool getIntForKey( const char *key, int *value, config_file_t *config ) { - const char *val; - int size, sum; - bool negative = false; + const char *val; + int size, sum; + bool negative = false; - if (getValueForKey(key, &val, &size, config)) - { - if ( size ) - { - if (*val == '-') - { + if (getValueForKey(key, &val, &size, config)) { + if ( size ) { + if (*val == '-') { negative = true; val++; size--; } - for (sum = 0; size > 0; size--) - { - if (*val < '0' || *val > '9') + for (sum = 0; size > 0; size--) { + if (*val < '0' || *val > '9') { return false; + } sum = (sum * 10) + (*val++ - '0'); } - if (negative) + if (negative) { sum = -sum; - + } *value = sum; return true; } } - return false; + return false; } /* @@ -411,59 +402,57 @@ bool getDimensionForKey( const char *key, unsigned int *value, config_file_t *config, unsigned int dimension_max, unsigned int object_size ) { const char *val; - - int size = 0; + + int size = 0; int sum = 0; - + bool negative = false; bool percentage = false; - - if (getValueForKey(key, &val, &size, config)) - { - if ( size ) - { - if (*val == '-') - { + + if (getValueForKey(key, &val, &size, config)) { + if ( size ) { + if (*val == '-') { negative = true; val++; size--; } - - if (val[size-1] == '%') - { + + if (val[size-1] == '%') { percentage = true; size--; } - + // convert string to integer - for (sum = 0; size > 0; size--) - { - if (*val < '0' || *val > '9') + for (sum = 0; size > 0; size--) { + if (*val < '0' || *val > '9') { return false; - + } + sum = (sum * 10) + (*val++ - '0'); } - - if (percentage) + + if (percentage) { sum = ( dimension_max * sum ) / 100; - + } + // calculate offset from opposite origin - if (negative) + if (negative) { sum = ( ( dimension_max - object_size ) - sum ); - + } + } else { - + // null value calculate center sum = ( dimension_max - object_size ) / 2; - + } - + *value = (uint16_t) sum; return true; } - + // key not found - return false; + return false; } /* @@ -472,60 +461,58 @@ bool getColorForKey( const char *key, unsigned int *value, config_file_t *config ) { - const char *val; - int size; - - if (getValueForKey(key, &val, &size, config)) + const char *val; + int size; + + if (getValueForKey(key, &val, &size, config)) { - if (*val == '#') - { - val++; + if (*val == '#') { + val++; *value = strtol(val, NULL, 16); return true; - } - } - return false; + } + } + return false; } bool getValueForKey( const char *key, const char **val, int *size, config_file_t *config ) { - const char *overrideVal; - int overrideSize; - bool override, ret; - - if (getValueForBootKey(bootArgs->CommandLine, key, val, size)) - return true; + const char *overrideVal; + int overrideSize; + bool override, ret; - ret = getValueForConfigTableKey(config, key, val, size); + if (getValueForBootKey(bootArgs->CommandLine, key, val, size)) { + return true; + } - // Try to find alternate keys in bootInfo->chameleonConfig (if config can be overriden) - // and prefer its values with the exceptions for - // "Kernel"="mach_kernel" and "Kernel Flags"="". + ret = getValueForConfigTableKey(config, key, val, size); - if (config->canOverride) - { - if (getValueForConfigTableKey(&bootInfo->chameleonConfig, key, &overrideVal, &overrideSize)) - { - override = true; + // Try to find alternate keys in bootInfo->chameleonConfig (if config can be overriden) + // and prefer its values with the exceptions for + // "Kernel"="mach_kernel" and "Kernel Flags"="". - // NOTE: Values are defined by apple as being in com.apple.Boot.plist - // kHelperRootUUIDKey, kKernelArchKey, kMKextCacheKey, kKernelCacheKey, kKernelNameKey, kKernelFlagsKey - if (ret && (strcmp(key, kKernelNameKey) == 0) && (overrideSize == 0)) - override = false; + if (config->canOverride) { + if (getValueForConfigTableKey(&bootInfo->chameleonConfig, key, &overrideVal, &overrideSize)) { + override = true; - if (ret && (strcmp(key, kKernelFlagsKey) == 0) && (overrideSize == 0)) - override = false; + // NOTE: Values are defined by apple as being in com.apple.Boot.plist + // kHelperRootUUIDKey, kKernelArchKey, kMKextCacheKey, kKernelCacheKey, kKernelNameKey, kKernelFlagsKey + if (ret && (strcmp(key, kKernelNameKey) == 0) && (overrideSize == 0)) { + override = false; + } - if (override) - { - *val = overrideVal; - *size = overrideSize; - return true; - } - } - } + if (ret && (strcmp(key, kKernelFlagsKey) == 0) && (overrideSize == 0)) { + override = false; + } - return ret; + if (override) { + *val = overrideVal; + *size = overrideSize; + return true; + } + } + } + return ret; } @@ -533,15 +520,19 @@ void printSystemConfig(char *p1) { - char *p2 = p1, tmp; + char *p2 = p1, tmp; - while (*p1 != '\0') { - while (*p2 != '\0' && *p2 != '\n') p2++; + while (*p1 != '\0') { + while (*p2 != '\0' && *p2 != '\n') { + p2++; + } tmp = *p2; *p2 = '\0'; printf("%s\n", p1); *p2 = tmp; - if (tmp == '\0') break; + if (tmp == '\0') { + break; + } p1 = ++p2; } } @@ -558,33 +549,38 @@ // int ParseXMLFile( char * buffer, TagPtr * dict ) { - long length, pos; - TagPtr tag; - pos = 0; - char *configBuffer; + long length, pos; + TagPtr tag; + pos = 0; + char *configBuffer; - configBuffer = malloc(strlen(buffer)+1); - strcpy(configBuffer, buffer); + configBuffer = malloc(strlen(buffer)+1); + strcpy(configBuffer, buffer); - while (1) - { - length = XMLParseNextTag(configBuffer + pos, &tag); - if (length == -1) break; - - pos += length; - - if (tag == 0) continue; - if (tag->type == kTagTypeDict) break; - - XMLFreeTag(tag); - } - free(configBuffer); - if (length < 0) { - error ("Error parsing plist file\n"); - return -1; - } - *dict = tag; - return 0; + while (1) { + length = XMLParseNextTag(configBuffer + pos, &tag); + if (length == -1) { + break; + } + + pos += length; + + if (tag == 0) { + continue; + } + if (tag->type == kTagTypeDict) { + break; + } + + XMLFreeTag(tag); + } + free(configBuffer); + if (length < 0) { + error ("Error parsing plist file\n"); + return -1; + } + *dict = tag; + return 0; } /* loadConfigFile @@ -602,7 +598,7 @@ // read file count = read(fd, config->plist, IO_CONFIG_DATA_SIZE); close(fd); - + // build xml dictionary ParseXMLFile(config->plist, &config->dictionary); return 0; @@ -611,6 +607,13 @@ /* loadSystemConfig * + * filename == NULL: + * You are loading from com.apple.Boot.plist somewhere in the universe. + * Also, bootarg's "config=" is considerd as replacement name. + * + * filename != NULL: + * Use it as file name. + * * Returns 0 - successful. * -1 - unsuccesful. */ @@ -623,19 +626,17 @@ int i, fd, count, ret=-1; - for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) - { - if ((fd = open(dirspec[i], 0)) >= 0) - { + for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) { + if ((fd = open(dirspec[i], 0)) >= 0) { // read file count = read(fd, config->plist, IO_CONFIG_DATA_SIZE); close(fd); - + // build xml dictionary ParseXMLFile(config->plist, &config->dictionary); sysConfigValid = true; ret=0; - + break; } } @@ -667,18 +668,15 @@ int i, fd, count, ret=-1; - for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) - { - if ((fd = open(dirspec[i], 0)) >= 0) - { - // Check for depreciated file names and annoy the user about it. - if(strstr(dirspec[i], "com.apple.Boot.plist")) - { - printf("%s is depreciated.\n", dirspec[i]); - dirspec[i][strlen(dirspec[i]) - strlen("com.apple.Boot.plist")] = 0; - printf("Please use the file %sorg.chameleon.Boot.plist instead.\n", dirspec[i]); - pause(); - } + for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) { + if ((fd = open(dirspec[i], 0)) >= 0) { + // Check for depreciated file names and annoy the user about it. + if(strstr(dirspec[i], "com.apple.Boot.plist")) { + printf("%s is depreciated.\n", dirspec[i]); + dirspec[i][strlen(dirspec[i]) - strlen("com.apple.Boot.plist")] = 0; + printf("Please use the file %sorg.chameleon.Boot.plist instead.\n", dirspec[i]); + pause(); + } // read file count = read(fd, config->plist, IO_CONFIG_DATA_SIZE); close(fd); @@ -708,10 +706,8 @@ int i, fd, count, ret=-1; - for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) - { - if ((fd = open(dirspec[i], 0)) >= 0) - { + for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) { + if ((fd = open(dirspec[i], 0)) >= 0) { // read file count = read(fd, config->plist, IO_CONFIG_DATA_SIZE); close(fd); @@ -728,10 +724,11 @@ char * newString(const char * oldString) { - if ( oldString ) - return strcpy(malloc(strlen(oldString)+1), oldString); - else - return NULL; + if ( oldString ) { + return strcpy(malloc(strlen(oldString)+1), oldString); + } else { + return NULL; + } } /* @@ -739,52 +736,50 @@ */ char * getNextArg(char ** argPtr, char * val) { - char * ptr = *argPtr; - const char * strStart; - int len = 0; - bool isQuoted = false; + char * ptr = *argPtr; + const char * strStart; + int len = 0; + bool isQuoted = false; - *val = '\0'; + *val = '\0'; - // Scan for the next non-whitespace character. - while ( *ptr && (*ptr == ' ' || *ptr == '=') ) - { - ptr++; - } + // Scan for the next non-whitespace character. + while ( *ptr && (*ptr == ' ' || *ptr == '=') ) { + ptr++; + } - strStart = ptr; + strStart = ptr; - // Skip the leading double quote character. - if (*ptr == '\"') - { - isQuoted = true; - ptr++; - strStart++; - } + // Skip the leading double quote character. + if (*ptr == '\"') { + isQuoted = true; + ptr++; + strStart++; + } - // Scan for the argument terminator character. - // This can be either a NULL character - in case we reach the end of the string, - // a double quote in case of quoted argument, - // or a whitespace character (' ' or '=') for non-quoted argument. - while (*ptr && !( (isQuoted && (*ptr == '\"')) || + // Scan for the argument terminator character. + // This can be either a NULL character - in case we reach the end of the string, + // a double quote in case of quoted argument, + // or a whitespace character (' ' or '=') for non-quoted argument. + while (*ptr && !( (isQuoted && (*ptr == '\"')) || (!isQuoted && (*ptr == ' ' || *ptr == '=')) ) - ) - { - ptr++; - } + ) { + ptr++; + } - len = ptr - strStart; + len = ptr - strStart; - // Skip the closing double quote character and adjust - // the starting pointer for the next getNextArg call. - if (*ptr && isQuoted && *ptr == '\"') - ptr++; + // Skip the closing double quote character and adjust + // the starting pointer for the next getNextArg call. + if (*ptr && isQuoted && *ptr == '\"') { + ptr++; + } - // Copy the extracted argument to val. - strncat(val, strStart, len); + // Copy the extracted argument to val. + strncat(val, strStart, len); - // Set command line pointer. - *argPtr = ptr; + // Set command line pointer. + *argPtr = ptr; - return ptr; + return ptr; } Index: branches/ErmaC/Enoch/i386/libsaio/freebsd.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/freebsd.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/freebsd.h (revision 2323) @@ -1,2 +1,7 @@ +#ifndef __LIBSAIO_FREEBSD_H +#define __LIBSAIO_FREEBSD_H + extern bool FreeBSDProbe (const void *buf); -extern void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen); \ No newline at end of file +extern void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen); + +#endif /* !__LIBSAIO_FREEBSD_H */ Index: branches/ErmaC/Enoch/i386/libsaio/biosfn.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/biosfn.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/biosfn.c (revision 2323) @@ -48,60 +48,73 @@ static biosBuf_t bb; + +//============================================================================== + int bgetc(void) { - /* Poll for the next character. Most real BIOS do not need this as the - INT 16h,AH=0h function will block until one is received. - Unfortunately, Apple's EFI CSM will never wake up. This idea is lifted - from the grub-a20.patch to GRUB's stage2/asm.S file. - */ - while(!readKeyboardStatus()) - ; - bb.intno = 0x16; - bb.eax.r.h = 0x00; - bios(&bb); - return bb.eax.rr; + /* Poll for the next character. Most real BIOS do not need this as the + INT 16h,AH=0h function will block until one is received. + Unfortunately, Apple's EFI CSM will never wake up. This idea is lifted + from the grub-a20.patch to GRUB's stage2/asm.S file. + */ + while(!readKeyboardStatus()); + + bb.intno = 0x16; + bb.eax.r.h = 0x00; + bios(&bb); + + return bb.eax.rr; } + +//============================================================================== + int readKeyboardStatus(void) { - bb.intno = 0x16; - bb.eax.r.h = 0x01; - bios(&bb); - if (bb.flags.zf) { - return 0; - } else { - return bb.eax.rr; - } + bb.intno = 0x16; + bb.eax.r.h = 0x01; + bios(&bb); + + if (bb.flags.zf) { + return 0; + } else { + return bb.eax.rr; + } } int readKeyboardShiftFlags(void) { - bb.intno = 0x16; - bb.eax.r.h = 0x02; - bios(&bb); - return bb.eax.r.l; + bb.intno = 0x16; + bb.eax.r.h = 0x02; + bios(&bb); + return bb.eax.r.l; } + +//============================================================================== + unsigned int time18(void) { - union { - struct { - unsigned int low:16; - unsigned int high:16; - } s; - unsigned int i; - } time; + union { + struct { + unsigned int low:16; + unsigned int high:16; + } s; + + unsigned int i; + } time; - bb.intno = 0x1a; - bb.eax.r.h = 0x00; - bios(&bb); - time.s.low = bb.edx.rr; - time.s.high = bb.ecx.rr; - return time.i; + bb.intno = 0x1a; + bb.eax.r.h = 0x00; + bios(&bb); + time.s.low = bb.edx.rr; + time.s.high = bb.ecx.rr; + + return time.i; } -#if 0 +//#if 0 /* COMMENTED */ static unsigned long rerangeMemoryMap(unsigned long count) { int i, still_changing, newcount = count; @@ -158,318 +171,357 @@ return newcount; } -#endif +//#endif /* COMMENTED */ unsigned long getMemoryMap( MemoryRange * rangeArray, unsigned long maxRangeCount, unsigned long * conMemSizePtr, unsigned long * extMemSizePtr ) { - #define kMemoryMapSignature 'SMAP' - #define kDescriptorSizeMin 20 + #define kMemoryMapSignature 'SMAP' + #define kDescriptorSizeMin 20 - MemoryRange * range = (MemoryRange *)BIOS_ADDR; - unsigned long count = 0; - // unsigned long rerangedCount; - unsigned long long conMemSize = 0; - unsigned long long extMemSize = 0; + MemoryRange * range = (MemoryRange *)BIOS_ADDR; + unsigned long count = 0; + unsigned long rerangedCount; + unsigned long long conMemSize = 0; + unsigned long long extMemSize = 0; - // Prepare for the INT15 E820h call. Each call returns a single - // memory range. A continuation value is returned that must be - // provided on a subsequent call to fetch the next range. - // - // Certain BIOSes (Award 6.00PG) expect the upper word in EAX - // to be cleared on entry, otherwise only a single range will - // be reported. - // - // Some BIOSes will simply ignore the value of ECX on entry. - // Probably best to keep its value at 20 to avoid surprises. + // Prepare for the INT15 E820h call. Each call returns a single + // memory range. A continuation value is returned that must be + // provided on a subsequent call to fetch the next range. + // + // Certain BIOSes (Award 6.00PG) expect the upper word in EAX + // to be cleared on entry, otherwise only a single range will + // be reported. + // + // Some BIOSes will simply ignore the value of ECX on entry. + // Probably best to keep its value at 20 to avoid surprises. - //printf("Get memory map 0x%x, %d\n", rangeArray); getchar(); - if (maxRangeCount > (BIOS_LEN / sizeof(MemoryRange))) { - maxRangeCount = (BIOS_LEN / sizeof(MemoryRange)); - } - bb.ebx.rx = 0; // Initial continuation value must be zero. + //printf("Get memory map 0x%x, %d\n", rangeArray); getchar(); + if (maxRangeCount > (BIOS_LEN / sizeof(MemoryRange))) { + maxRangeCount = (BIOS_LEN / sizeof(MemoryRange)); + } + bb.ebx.rx = 0; // Initial continuation value must be zero. - while ( count < maxRangeCount ) - { - bb.intno = 0x15; - bb.eax.rx = 0xe820; - bb.ecx.rx = kDescriptorSizeMin; - bb.edx.rx = kMemoryMapSignature; - bb.edi.rr = NORMALIZED_OFFSET( (unsigned long) range ); - bb.es = NORMALIZED_SEGMENT( (unsigned long) range ); - bios(&bb); + while (count < maxRangeCount) + { + bb.intno = 0x15; + bb.eax.rx = 0xe820; + bb.ecx.rx = kDescriptorSizeMin; + bb.edx.rx = kMemoryMapSignature; + bb.edi.rr = NORMALIZED_OFFSET( (unsigned long) range ); + bb.es = NORMALIZED_SEGMENT( (unsigned long) range ); + bios(&bb); - // Check for errors. + // Check for errors. - if ( bb.flags.cf - || bb.eax.rx != kMemoryMapSignature - || bb.ecx.rx != kDescriptorSizeMin ) { - //printf("Got an error %x %x %x\n", bb.flags.cf, - // bb.eax.rx, bb.ecx.rx); - break; - } + if ( bb.flags.cf + || bb.eax.rx != kMemoryMapSignature + || bb.ecx.rx != kDescriptorSizeMin ) { + //printf("Got an error %x %x %x\n", bb.flags.cf, + // bb.eax.rx, bb.ecx.rx); + break; + } - // Tally up the conventional/extended memory sizes. + // Tally up the conventional/extended memory sizes. - if ( range->type == kMemoryRangeUsable || - range->type == kMemoryRangeACPI || - range->type == kMemoryRangeNVS ) - { - // Tally the conventional memory ranges. - if ( range->base + range->length <= 0xa0000 ) { - conMemSize += range->length; - } + if ( range->type == kMemoryRangeUsable || + range->type == kMemoryRangeACPI || + range->type == kMemoryRangeNVS ) { + // Tally the conventional memory ranges. + if ( range->base + range->length <= 0xa0000 ) { + conMemSize += range->length; + } - // Record the top of extended memory. - if ( range->base >= EXTENDED_ADDR ) { - extMemSize += range->length; - } - } + // Record the top of extended memory. + if (range->base >= EXTENDED_ADDR) { + extMemSize += range->length; + } + } - range++; - count++; + range++; + count++; - // Is this the last address range? + // Is this the last address range? - if ( bb.ebx.rx == 0 ) { - //printf("last range\n"); - break; - } - } - *conMemSizePtr = conMemSize / 1024; // size in KB - *extMemSizePtr = extMemSize / 1024; // size in KB + if ( bb.ebx.rx == 0 ) { + //printf("last range\n"); + break; + } + } + *conMemSizePtr = conMemSize / 1024; // size in KB + *extMemSizePtr = extMemSize / 1024; // size in KB -#if 0 - rerangedCount = rerangeMemoryMap(count); - range += rerangedCount - count; -#endif +//#if 0 /* COMMENTED */ + rerangedCount = rerangeMemoryMap(count); + range += rerangedCount - count; +//#endif /* COMMENTED */ - // Copy out data - bcopy((char *)BIOS_ADDR, rangeArray, ((char *)range - (char *)BIOS_ADDR)); + // Copy out data + bcopy((char *)BIOS_ADDR, rangeArray, ((char *)range - (char *)BIOS_ADDR)); #if DEBUG - { - int i; - printf("%d total ranges\n", count); getchar(); - for (i=0, range = rangeArray; itype, (unsigned int)range->base, (unsigned int)range->length); getchar(); - } - } + { + int i; + printf("%d total ranges\n", count); + + getchar(); + + for (i = 0, range = rangeArray; itype, (unsigned int)range->base, (unsigned int)range->length); + getchar(); + } + } #endif - return count; + return count; } + +//============================================================================== + + unsigned long getExtendedMemorySize() { - // Get extended memory size for large configurations. Not used unless - // the INT15, E820H call (Get System Address Map) failed. - // - // Input: - // - // AX Function Code E801h - // - // Outputs: - // - // CF Carry Flag Carry cleared indicates no error. - // AX Extended 1 Number of contiguous KB between 1 and 16 MB, - // maximum 0x3C00 = 15 MB. - // BX Extended 2 Number of contiguous 64 KB blocks between - // 16 MB and 4 GB. - // CX Configured 1 Number of contiguous KB between 1 and 16 MB, - // maximum 0x3C00 = 15 MB. - // DX Configured 2 Number of contiguous 64 KB blocks between - // 16 MB and 4 GB. + // Get extended memory size for large configurations. Not used unless + // the INT15, E820H call (Get System Address Map) failed. + // + // Input: + // + // AX Function Code E801h + // + // Outputs: + // + // CF Carry Flag Carry cleared indicates no error. + // AX Extended 1 Number of contiguous KB between 1 and 16 MB, + // maximum 0x3C00 = 15 MB. + // BX Extended 2 Number of contiguous 64 KB blocks between + // 16 MB and 4 GB. + // CX Configured 1 Number of contiguous KB between 1 and 16 MB, + // maximum 0x3C00 = 15 MB. + // DX Configured 2 Number of contiguous 64 KB blocks between + // 16 MB and 4 GB. - bb.intno = 0x15; - bb.eax.rx = 0xe801; - bios(&bb); + bb.intno = 0x15; + bb.eax.rx = 0xe801; + bios(&bb); - // Return the size of memory above 1MB (extended memory) in kilobytes. + // Return the size of memory above 1MB (extended memory) in kilobytes. - if ( bb.flags.cf == 0 ) return (bb.ebx.rr * 64 + bb.eax.rr); + if (bb.flags.cf == 0) { + return (bb.ebx.rr * 64 + bb.eax.rr); + } - // Get Extended memory size. Called on last resort since the return - // value is limited to 16-bits (a little less than 64MB max). May - // not be supported by modern BIOSes. - // - // Input: - // - // AX Function Code E801h - // - // Outputs: - // - // CF Carry Flag Carry cleared indicates no error. - // AX Memory Count Number of contiguous KB above 1MB. + // Get Extended memory size. Called on last resort since the return + // value is limited to 16-bits (a little less than 64MB max). May + // not be supported by modern BIOSes. + // + // Input: + // + // AX Function Code E801h + // + // Outputs: + // + // CF Carry Flag Carry cleared indicates no error. + // AX Memory Count Number of contiguous KB above 1MB. - bb.intno = 0x15; - bb.eax.rx = 0x88; - bios(&bb); + bb.intno = 0x15; + bb.eax.rx = 0x88; + bios(&bb); - // Return the size of memory above 1MB (extended memory) in kilobytes. + // Return the size of memory above 1MB (extended memory) in kilobytes. - return bb.flags.cf ? 0 : bb.eax.rr; + return bb.flags.cf ? 0 : bb.eax.rr; } + +//============================================================================== + + unsigned long getConventionalMemorySize() { - bb.intno = 0x12; - bios(&bb); - return bb.eax.rr; // kilobytes + bb.intno = 0x12; + bios(&bb); + + return bb.eax.rr; // kilobytes } + +//============================================================================== + + void video_mode(int mode) { - bb.intno = 0x10; - bb.eax.r.h = 0x00; - bb.eax.r.l = mode; - bios(&bb); + bb.intno = 0x10; + bb.eax.r.h = 0x00; + bb.eax.r.l = mode; + bios(&bb); } + +//============================================================================== + int biosread(int dev, int cyl, int head, int sec, int num) { - int i; + int i; - bb.intno = 0x13; - sec += 1; /* sector numbers start at 1 */ + bb.intno = 0x13; + sec += 1; // sector numbers start at 1. - for (i=0;;) { - bb.ecx.r.h = cyl; - bb.ecx.r.l = ((cyl & 0x300) >> 2) | (sec & 0x3F); - bb.edx.r.h = head; - bb.edx.r.l = dev; - bb.eax.r.l = num; - bb.ebx.rr = OFFSET(ptov(BIOS_ADDR)); - bb.es = SEGMENT(ptov(BIOS_ADDR)); + for (i = 0; ;) { + bb.ecx.r.h = cyl; + bb.ecx.r.l = ((cyl & 0x300) >> 2) | (sec & 0x3F); + bb.edx.r.h = head; + bb.edx.r.l = dev; + bb.eax.r.l = num; + bb.ebx.rr = OFFSET(ptov(BIOS_ADDR)); + bb.es = SEGMENT(ptov(BIOS_ADDR)); - bb.eax.r.h = 0x02; - bios(&bb); + bb.eax.r.h = 0x02; + bios(&bb); - /* In case of a successful call, make sure we set AH (return code) to zero. */ - if (bb.flags.cf == 0) - bb.eax.r.h = 0; + // In case of a successful call, make sure we set AH (return code) to zero. + if (bb.flags.cf == 0) { + bb.eax.r.h = 0; + } - /* Now we can really check for the return code (AH) value. */ - if ((bb.eax.r.h == 0x00) || (i++ >= 5)) - break; + // Now we can really check for the return code (AH) value. + if ((bb.eax.r.h == 0x00) || (i++ >= 5)) { + break; + } - /* reset disk subsystem and try again */ - bb.eax.r.h = 0x00; - bios(&bb); - } - return bb.eax.r.h; + // Reset disk subsystem and try again. + bb.eax.r.h = 0x00; + bios(&bb); + } + + return bb.eax.r.h; } + +//============================================================================== + int ebiosread(int dev, unsigned long long sec, int count) { - int i; - static struct { - unsigned char size; - unsigned char reserved; - unsigned char numblocks; - unsigned char reserved2; - unsigned short bufferOffset; - unsigned short bufferSegment; - unsigned long long startblock; - } addrpacket __attribute__((aligned(16))) = {0}; - addrpacket.size = sizeof(addrpacket); + int i; - for (i=0;;) { - bb.intno = 0x13; - bb.eax.r.h = 0x42; - bb.edx.r.l = dev; - bb.esi.rr = NORMALIZED_OFFSET((unsigned)&addrpacket); - bb.ds = NORMALIZED_SEGMENT((unsigned)&addrpacket); - addrpacket.reserved = addrpacket.reserved2 = 0; - addrpacket.numblocks = count; - addrpacket.bufferOffset = OFFSET(ptov(BIOS_ADDR)); - addrpacket.bufferSegment = SEGMENT(ptov(BIOS_ADDR)); - addrpacket.startblock = sec; - bios(&bb); + static struct { + unsigned char size; + unsigned char reserved; + unsigned char numblocks; + unsigned char reserved2; + unsigned short bufferOffset; + unsigned short bufferSegment; + unsigned long long startblock; + } addrpacket __attribute__((aligned(16))) = {0}; + addrpacket.size = sizeof(addrpacket); - /* In case of a successful call, make sure we set AH (return code) to zero. */ - if (bb.flags.cf == 0) - bb.eax.r.h = 0; + for (i = 0; ;) { + bb.intno = 0x13; + bb.eax.r.h = 0x42; + bb.edx.r.l = dev; + bb.esi.rr = NORMALIZED_OFFSET((unsigned)&addrpacket); + bb.ds = NORMALIZED_SEGMENT((unsigned)&addrpacket); + addrpacket.reserved = addrpacket.reserved2 = 0; + addrpacket.numblocks = count; + addrpacket.bufferOffset = OFFSET(ptov(BIOS_ADDR)); + addrpacket.bufferSegment = SEGMENT(ptov(BIOS_ADDR)); + addrpacket.startblock = sec; + bios(&bb); - /* Now we can really check for the return code (AH) value. */ - if ((bb.eax.r.h == 0x00) || (i++ >= 5)) - break; + // In case of a successful call, make sure we set AH (return code) to zero. + if (bb.flags.cf == 0) { + bb.eax.r.h = 0; + } - /* reset disk subsystem and try again */ - bb.eax.r.h = 0x00; - bios(&bb); - } - return bb.eax.r.h; + // Now we can really check for the return code (AH) value. + if ((bb.eax.r.h == 0x00) || (i++ >= 5)) { + break; + } + + // Reset disk subsystem and try again. + bb.eax.r.h = 0x00; + bios(&bb); + } + + return bb.eax.r.h; } +//============================================================================== + int ebioswrite(int dev, long sec, int count) { - int i; - static struct { - unsigned char size; - unsigned char reserved; - unsigned char numblocks; - unsigned char reserved2; - unsigned short bufferOffset; - unsigned short bufferSegment; - unsigned long long startblock; - } addrpacket __attribute__((aligned(16))) = {0}; - addrpacket.size = sizeof(addrpacket); + int i; + static struct { + unsigned char size; + unsigned char reserved; + unsigned char numblocks; + unsigned char reserved2; + unsigned short bufferOffset; + unsigned short bufferSegment; + unsigned long long startblock; + } addrpacket __attribute__((aligned(16))) = {0}; + addrpacket.size = sizeof(addrpacket); - for (i=0;;) { - bb.intno = 0x13; - bb.eax.r.l = 0; /* Don't verify */ - bb.eax.r.h = 0x43; - bb.edx.r.l = dev; - bb.esi.rr = NORMALIZED_OFFSET((unsigned)&addrpacket); - bb.ds = NORMALIZED_SEGMENT((unsigned)&addrpacket); - addrpacket.reserved = addrpacket.reserved2 = 0; - addrpacket.numblocks = count; - addrpacket.bufferOffset = OFFSET(ptov(BIOS_ADDR)); - addrpacket.bufferSegment = SEGMENT(ptov(BIOS_ADDR)); - addrpacket.startblock = sec; - bios(&bb); + for (i=0;;) { + bb.intno = 0x13; + bb.eax.r.l = 0; /* Don't verify */ + bb.eax.r.h = 0x43; + bb.edx.r.l = dev; + bb.esi.rr = NORMALIZED_OFFSET((unsigned)&addrpacket); + bb.ds = NORMALIZED_SEGMENT((unsigned)&addrpacket); + addrpacket.reserved = addrpacket.reserved2 = 0; + addrpacket.numblocks = count; + addrpacket.bufferOffset = OFFSET(ptov(BIOS_ADDR)); + addrpacket.bufferSegment = SEGMENT(ptov(BIOS_ADDR)); + addrpacket.startblock = sec; + bios(&bb); - /* In case of a successful call, make sure we set AH (return code) to zero. */ - if (bb.flags.cf == 0) - bb.eax.r.h = 0; + /* In case of a successful call, make sure we set AH (return code) to zero. */ + if (bb.flags.cf == 0) + bb.eax.r.h = 0; - /* Now we can really check for the return code (AH) value. */ - if ((bb.eax.r.h == 0x00) || (i++ >= 5)) - break; + /* Now we can really check for the return code (AH) value. */ + if ((bb.eax.r.h == 0x00) || (i++ >= 5)) + break; - /* reset disk subsystem and try again */ - bb.eax.r.h = 0x00; - bios(&bb); - } - return bb.eax.r.h; + /* reset disk subsystem and try again */ + bb.eax.r.h = 0x00; + bios(&bb); + } + return bb.eax.r.h; } void bios_putchar(int ch) { - bb.intno = 0x10; - bb.ebx.r.h = 0x00; /* background black */ - bb.ebx.r.l = 0x0F; /* foreground white */ - bb.eax.r.h = 0x0e; - bb.eax.r.l = ch; - bios(&bb); + bb.intno = 0x10; + bb.ebx.r.h = 0x00; /* background black */ + bb.ebx.r.l = 0x0F; /* foreground white */ + bb.eax.r.h = 0x0e; + bb.eax.r.l = ch; + bios(&bb); } + +//============================================================================== + void putca(int ch, int attr, int repeat) { - bb.intno = 0x10; - bb.ebx.r.h = 0x00; /* page number */ - bb.ebx.r.l = attr; /* attribute */ - bb.eax.r.h = 0x9; - bb.eax.r.l = ch; - bb.ecx.rx = repeat; /* repeat count */ - bios(&bb); + bb.intno = 0x10; + bb.ebx.r.h = 0x00; /* page number */ + bb.ebx.r.l = attr; /* attribute */ + bb.eax.r.h = 0x9; + bb.eax.r.l = ch; + bb.ecx.rx = repeat; /* repeat count */ + bios(&bb); } -/* Check to see if the passed-in drive is in El Torito no-emulation mode. */ + +//============================================================================== +// Check to see if the passed-in drive is in El Torito no-emulation mode. + int is_no_emulation(int drive) { struct packet { @@ -488,30 +540,30 @@ unsigned char reseved; } __attribute__((packed)); static struct packet pkt; - + bzero(&pkt, sizeof(pkt)); pkt.packet_size = 0x13; - - bb.intno = 0x13; - bb.eax.r.h = 0x4b; - bb.eax.r.l = 0x01; // subfunc: get info - bb.edx.r.l = drive; - bb.esi.rr = NORMALIZED_OFFSET((unsigned)&pkt); - bb.ds = NORMALIZED_SEGMENT((unsigned)&pkt); - + + bb.intno = 0x13; + bb.eax.r.h = 0x4b; + bb.eax.r.l = 0x01; // subfunc: get info + bb.edx.r.l = drive; + bb.esi.rr = NORMALIZED_OFFSET((unsigned)&pkt); + bb.ds = NORMALIZED_SEGMENT((unsigned)&pkt); + bios(&bb); + #if DEBUG printf("el_torito info drive %x\n", drive); - printf("--> cf %x, eax %x\n", bb.flags.cf, bb.eax.rr); - printf("pkt_size: %x\n", pkt.packet_size); printf("media_type: %x\n", pkt.media_type); printf("drive_num: %x\n", pkt.drive_num); printf("device_spec: %x\n", pkt.device_spec); + pause(); #endif - + /* Some BIOSes erroneously return cf = 1 */ /* Just check to see if the drive number is the same. */ if (pkt.drive_num == drive) { @@ -568,28 +620,34 @@ #endif +//============================================================================== + int get_drive_info(int drive, struct driveInfo *dp) { + int ret = 0; + boot_drive_info_t *di = &dp->di; - int ret = 0; - + #if UNUSED if (maxhd == 0) { bb.intno = 0x13; bb.eax.r.h = 0x08; bb.edx.r.l = 0x80; bios(&bb); - if (bb.flags.cf == 0) + + if (bb.flags.cf == 0) { maxhd = 0x7f + bb.edx.r.l; + } }; - - if (drive > maxhd) + + if (drive > maxhd) { return 0; + } #endif - + bzero(dp, sizeof(struct driveInfo)); dp->biosdev = drive; - + /* Check for El Torito no-emulation mode. */ dp->no_emulation = is_no_emulation(drive); @@ -620,9 +678,7 @@ if (bb.flags.cf != 0 /* || params.phys_sectors < 2097152 */) { dp->uses_ebios = 0; di->params.buf_size = 1; - } - else - { + } else { bcopy(¶ms, &di->params, sizeof(params)); if (drive >= BASE_HD_DRIVE && @@ -684,101 +740,102 @@ return ret; } +//============================================================================== + int ebiosEjectMedia(int biosdev) { - bb.intno = 0x13; - bb.eax.r.h = 0x46; - bb.eax.r.l = 0; - bb.edx.rx = biosdev; - bios(&bb); - return bb.eax.r.h; + bb.intno = 0x13; + bb.eax.r.h = 0x46; + bb.eax.r.l = 0; + bb.edx.rx = biosdev; + bios(&bb); + return bb.eax.r.h; } void setCursorPosition(int x, int y, int page) { - bb.intno = 0x10; - bb.eax.r.h = 0x02; - bb.ebx.r.h = page; /* page 0 for graphics */ - bb.edx.r.l = x; - bb.edx.r.h = y; - bios(&bb); + bb.intno = 0x10; + bb.eax.r.h = 0x02; + bb.ebx.r.h = page; /* page 0 for graphics */ + bb.edx.r.l = x; + bb.edx.r.h = y; + bios(&bb); } void setCursorType(int type) { - bb.intno = 0x10; - bb.eax.r.h = 0x01; - bb.ecx.rr = type; - bios(&bb); + bb.intno = 0x10; + bb.eax.r.h = 0x01; + bb.ecx.rr = type; + bios(&bb); } void getCursorPositionAndType(int * x, int * y, int * type) { - bb.intno = 0x10; - bb.eax.r.h = 0x03; - bios(&bb); - *x = bb.edx.r.l; - *y = bb.edx.r.h; - *type = bb.ecx.rr; + bb.intno = 0x10; + bb.eax.r.h = 0x03; + bios(&bb); + *x = bb.edx.r.l; + *y = bb.edx.r.h; + *type = bb.ecx.rr; } void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir) { - bb.intno = 0x10; - bb.eax.r.h = (dir > 0) ? 0x06 : 0x07; - bb.eax.r.l = rows; - bb.ebx.r.h = attr; - bb.ecx.r.h = y1; - bb.ecx.r.l = x1; - bb.edx.r.h = y2; - bb.edx.r.l = x2; - bios(&bb); + bb.intno = 0x10; + bb.eax.r.h = (dir > 0) ? 0x06 : 0x07; + bb.eax.r.l = rows; + bb.ebx.r.h = attr; + bb.ecx.r.h = y1; + bb.ecx.r.l = x1; + bb.edx.r.h = y2; + bb.edx.r.l = x2; + bios(&bb); } void clearScreenRows( int y1, int y2 ) { - scollPage( 0, y1, 80 - 1, y2, 0x07, y2 - y1 + 1, 1 ); + scollPage( 0, y1, 80 - 1, y2, 0x07, y2 - y1 + 1, 1 ); } void setActiveDisplayPage( int page ) { - bb.intno = 0x10; - bb.eax.r.h = 5; - bb.eax.r.l = page; - bios(&bb); + bb.intno = 0x10; + bb.eax.r.h = 5; + bb.eax.r.l = page; + bios(&bb); } #if DEBUG int terminateDiskEmulation() { - static char cd_spec[0x13]; + static char cd_spec[0x13]; - bb.intno = 0x13; - bb.eax.r.h = 0x4b; - bb.eax.r.l = 0; // subfunc: terminate emulation - bb.esi.rr = NORMALIZED_OFFSET((unsigned)&cd_spec); - bb.ds = NORMALIZED_SEGMENT((unsigned)&cd_spec); - bios(&bb); - return bb.eax.r.h; + bb.intno = 0x13; + bb.eax.r.h = 0x4b; + bb.eax.r.l = 0; // subfunc: terminate emulation + bb.esi.rr = NORMALIZED_OFFSET((unsigned)&cd_spec); + bb.ds = NORMALIZED_SEGMENT((unsigned)&cd_spec); + bios(&bb); + return bb.eax.r.h; } int readDriveParameters(int drive, struct driveParameters *dp) { - bb.intno = 0x13; - bb.edx.r.l = drive; - bb.eax.r.h = 0x08; - bios(&bb); - if (bb.eax.r.h == 0) { - dp->heads = bb.edx.r.h; - dp->sectors = bb.ecx.r.l & 0x3F; - dp->cylinders = bb.ecx.r.h | ((bb.ecx.r.l & 0xC0) << 2); - dp->totalDrives = bb.edx.r.l; - } else { - bzero(dp, sizeof(*dp)); - } - return bb.eax.r.h; - + bb.intno = 0x13; + bb.edx.r.l = drive; + bb.eax.r.h = 0x08; + bios(&bb); + if (bb.eax.r.h == 0) { + dp->heads = bb.edx.r.h; + dp->sectors = bb.ecx.r.l & 0x3F; + dp->cylinders = bb.ecx.r.h | ((bb.ecx.r.l & 0xC0) << 2); + dp->totalDrives = bb.edx.r.l; + } else { + bzero(dp, sizeof(*dp)); + } + return bb.eax.r.h; } #endif @@ -790,49 +847,46 @@ int APMPresent(void) { - bb.intno = APM_INTNO; - bb.eax.r.h = APM_INTCODE; - bb.eax.r.l = 0x00; - bb.ebx.rr = 0x0000; - bios(&bb); - if ((bb.flags.cf == 0) && - (bb.ebx.r.h == 'P') && - (bb.ebx.r.l == 'M')) { - /* Success */ - bootArgs->apmConfig.major_vers = bb.eax.r.h; - bootArgs->apmConfig.minor_vers = bb.eax.r.l; - bootArgs->apmConfig.flags.data = bb.ecx.rr; - return 1; - } - return 0; + bb.intno = APM_INTNO; + bb.eax.r.h = APM_INTCODE; + bb.eax.r.l = 0x00; + bb.ebx.rr = 0x0000; + bios(&bb); + if ((bb.flags.cf == 0) && (bb.ebx.r.h == 'P') && (bb.ebx.r.l == 'M')) { + /* Success */ + bootArgs->apmConfig.major_vers = bb.eax.r.h; + bootArgs->apmConfig.minor_vers = bb.eax.r.l; + bootArgs->apmConfig.flags.data = bb.ecx.rr; + return 1; + } + return 0; } int APMConnect32(void) { - bb.intno = APM_INTNO; - bb.eax.r.h = APM_INTCODE; - bb.eax.r.l = 0x03; - bb.ebx.rr = 0x0000; - bios(&bb); - if (bb.flags.cf == 0) { - /* Success */ - bootArgs->apmConfig.cs32_base = (bb.eax.rr) << 4; - bootArgs->apmConfig.entry_offset = bb.ebx.rx; - bootArgs->apmConfig.cs16_base = (bb.ecx.rr) << 4; - bootArgs->apmConfig.ds_base = (bb.edx.rr) << 4; - if (bootArgs->apmConfig.major_vers >= 1 && - bootArgs->apmConfig.minor_vers >= 1) { - bootArgs->apmConfig.cs_length = bb.esi.rr; - bootArgs->apmConfig.ds_length = bb.edi.rr; - } else { - bootArgs->apmConfig.cs_length = - bootArgs->apmConfig.ds_length = 64 * 1024; - } - bootArgs->apmConfig.connected = 1; - return 1; - } - return 0; + bb.intno = APM_INTNO; + bb.eax.r.h = APM_INTCODE; + bb.eax.r.l = 0x03; + bb.ebx.rr = 0x0000; + bios(&bb); + if (bb.flags.cf == 0) { + /* Success */ + bootArgs->apmConfig.cs32_base = (bb.eax.rr) << 4; + bootArgs->apmConfig.entry_offset = bb.ebx.rx; + bootArgs->apmConfig.cs16_base = (bb.ecx.rr) << 4; + bootArgs->apmConfig.ds_base = (bb.edx.rr) << 4; + if (bootArgs->apmConfig.major_vers >= 1 && bootArgs->apmConfig.minor_vers >= 1) { + bootArgs->apmConfig.cs_length = bb.esi.rr; + bootArgs->apmConfig.ds_length = bb.edi.rr; + } else { + bootArgs->apmConfig.cs_length = + bootArgs->apmConfig.ds_length = 64 * 1024; + } + bootArgs->apmConfig.connected = 1; + return 1; + } + return 0; } #endif /* APM_SUPPORT */ @@ -840,64 +894,66 @@ #ifdef EISA_SUPPORT bool eisa_present(void) { - static bool checked = false; - static bool isEISA; + static bool checked = false; + static bool isEISA; - if (!checked) { - if (strncmp((char *)0xfffd9, "EISA", 4) == 0) - isEISA = true; + if (!checked) { + if (strncmp((char *)0xfffd9, "EISA", 4) == 0) { + isEISA = true; + } + checked = true; + } - checked = true; - } - - return (isEISA); + return (isEISA); } int ReadEISASlotInfo(EISA_slot_info_t *ep, int slot) { - union { - struct { - unsigned char char2h :2; - unsigned char char1 :5; - unsigned char char3 :5; - unsigned char char2l :3; - unsigned char d2 :4; - unsigned char d1 :4; - unsigned char d4 :4; - unsigned char d3 :4; - } s; - unsigned char data[4]; - } u; - static char hex[0x10] = "0123456789ABCDEF"; + union + { + struct + { + unsigned char char2h :2; + unsigned char char1 :5; + unsigned char char3 :5; + unsigned char char2l :3; + unsigned char d2 :4; + unsigned char d1 :4; + unsigned char d4 :4; + unsigned char d3 :4; + } s; + unsigned char data[4]; + } u; + static char hex[0x10] = "0123456789ABCDEF"; - - bb.intno = 0x15; - bb.eax.r.h = 0xd8; - bb.eax.r.l = 0x00; - bb.ecx.r.l = slot; - bios(&bb); - if (bb.flags.cf) - return bb.eax.r.h; - ep->u_ID.d = bb.eax.r.l; - ep->configMajor = bb.ebx.r.h; - ep->configMinor = bb.ebx.r.l; - ep->checksum = bb.ecx.rr; - ep->numFunctions = bb.edx.r.h; - ep->u_resources.d = bb.edx.r.l; - u.data[0] = bb.edi.r.l; - u.data[1] = bb.edi.r.h; - u.data[2] = bb.esi.r.l; - u.data[3] = bb.esi.r.h; - ep->id[0] = u.s.char1 + ('A' - 1); - ep->id[1] = (u.s.char2l | (u.s.char2h << 3)) + ('A' - 1); - ep->id[2] = u.s.char3 + ('A' - 1); - ep->id[3] = hex[u.s.d1]; - ep->id[4] = hex[u.s.d2]; - ep->id[5] = hex[u.s.d3]; - ep->id[6] = hex[u.s.d4]; - ep->id[7] = 0; - return 0; + + bb.intno = 0x15; + bb.eax.r.h = 0xd8; + bb.eax.r.l = 0x00; + bb.ecx.r.l = slot; + bios(&bb); + if (bb.flags.cf) + return bb.eax.r.h; + ep->u_ID.d = bb.eax.r.l; + ep->configMajor = bb.ebx.r.h; + ep->configMinor = bb.ebx.r.l; + ep->checksum = bb.ecx.rr; + ep->numFunctions = bb.edx.r.h; + ep->u_resources.d = bb.edx.r.l; + u.data[0] = bb.edi.r.l; + u.data[1] = bb.edi.r.h; + u.data[2] = bb.esi.r.l; + u.data[3] = bb.esi.r.h; + ep->id[0] = u.s.char1 + ('A' - 1); + ep->id[1] = (u.s.char2l | (u.s.char2h << 3)) + ('A' - 1); + ep->id[2] = u.s.char3 + ('A' - 1); + ep->id[3] = hex[u.s.d1]; + ep->id[4] = hex[u.s.d2]; + ep->id[5] = hex[u.s.d3]; + ep->id[6] = hex[u.s.d4]; + ep->id[7] = 0; + return 0; } /* @@ -907,18 +963,19 @@ int ReadEISAFuncInfo(EISA_func_info_t *ep, int slot, int function) { - bb.intno = 0x15; - bb.eax.r.h = 0xd8; - bb.eax.r.l = 0x01; - bb.ecx.r.l = slot; - bb.ecx.r.h = function; - bb.esi.rr = (unsigned int)ep->data; - bios(&bb); - if (bb.eax.r.h == 0) { - ep->slot = slot; - ep->function = function; - } - return bb.eax.r.h; + bb.intno = 0x15; + bb.eax.r.h = 0xd8; + bb.eax.r.l = 0x01; + bb.ecx.r.l = slot; + bb.ecx.r.h = function; + bb.esi.rr = (unsigned int)ep->data; + bios(&bb); + if (bb.eax.r.h == 0) + { + ep->slot = slot; + ep->function = function; + } + return bb.eax.r.h; } #endif /* EISA_SUPPORT */ @@ -927,19 +984,20 @@ int ReadPCIBusInfo(PCI_bus_info_t *pp) { - bb.intno = 0x1a; - bb.eax.r.h = 0xb1; - bb.eax.r.l = 0x01; - bios(&bb); - if ((bb.eax.r.h == 0) && (bb.edx.rx == PCI_SIGNATURE)) { - pp->BIOSPresent = 1; - pp->u_bus.d = bb.eax.r.l; - pp->majorVersion = bb.ebx.r.h; - pp->minorVersion = bb.ebx.r.l; - pp->maxBusNum = bb.ecx.r.l; - return 0; - } - return -1; + bb.intno = 0x1a; + bb.eax.r.h = 0xb1; + bb.eax.r.l = 0x01; + bios(&bb); + if ((bb.eax.r.h == 0) && (bb.edx.rx == PCI_SIGNATURE)) + { + pp->BIOSPresent = 1; + pp->u_bus.d = bb.eax.r.l; + pp->majorVersion = bb.ebx.r.h; + pp->minorVersion = bb.ebx.r.l; + pp->maxBusNum = bb.ecx.r.l; + return 0; + } + return -1; } void sleep(int n) @@ -948,6 +1006,9 @@ while (time18() < endtime); } + +//============================================================================== + void delay(int ms) { bb.intno = 0x15; Index: branches/ErmaC/Enoch/i386/libsaio/convert.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/convert.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/convert.c (revision 2323) @@ -93,11 +93,10 @@ { hexNibble = hexStr[hexStrIdx]; - // ignore all chars except valid hex numbers - if ( (hexNibble >= '0' && hexNibble <= '9') || - (hexNibble >= 'A' && hexNibble <= 'F') || - (hexNibble >= 'a' && hexNibble <= 'f') ) - { + // ignore all chars except valid hex numbers + if ( (hexNibble >= '0' && hexNibble <= '9') || + (hexNibble >= 'A' && hexNibble <= 'F') || + (hexNibble >= 'a' && hexNibble <= 'f') ) { hexByte[hexNibbleIdx++] = hexNibble; // found both two nibbles, convert to binary Index: branches/ErmaC/Enoch/i386/libsaio/pci.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/pci.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/pci.h (revision 2323) @@ -30,8 +30,10 @@ } pci_dev_t; typedef struct pci_dt_t { + uint8_t* regs; pci_dev_t dev; + uint16_t devfn; /* encoded device & function index */ uint16_t vendor_id; /* Specifies a vendor ID. The PCI bus configuration code obtains this vendor ID from the vendor ID device register. */ uint16_t device_id; /* Specifies a device ID that identifies the specific device. The PCI @@ -52,11 +54,15 @@ uint16_t class_id; /* Specifies a class code. This member is a data structure that stores information related to the device's class code device register. */ + //uint16_t subclass_id; /* A read-only register that specifies the specific function the device performs. */ + struct pci_dt_t *parent; struct pci_dt_t *children; struct pci_dt_t *next; -} pci_dt_t; +} pci_dt_t; // Info +/* Have pci_addr in the same format as the values written to 0xcf8 + * so register accesses can be made easy. */ #define PCIADDR(bus, dev, func) ((1 << 31) | (bus << 16) | (dev << 11) | (func << 8)) #define PCI_ADDR_REG 0xcf8 #define PCI_DATA_REG 0xcfc @@ -72,15 +78,8 @@ extern void build_pci_dt(void); extern void dump_pci_dt(pci_dt_t *); -/* Option ROM header */ -typedef struct { - uint16_t signature; // 0xAA55 - uint8_t rom_size; - uint32_t entry_point; - uint8_t reserved[15]; - uint16_t pci_header_offset; - uint16_t expansion_header_offset; -} option_rom_header_t; +//----------------------------------------------------------------------------- +// added by iNDi /* Option ROM PCI Data Structure */ typedef struct { @@ -91,21 +90,19 @@ uint16_t structure_length; uint8_t structure_revision; uint8_t class_code[3]; - uint16_t image_length; + uint16_t image_length; //same as rom_size for NVidia and ATI, 0x80 for Intel uint16_t image_revision; uint8_t code_type; uint8_t indicator; uint16_t reserved; } option_rom_pci_header_t; -//----------------------------------------------------------------------------- -// added by iNDi typedef struct { uint32_t signature; // 0x24506E50 '$PnP' uint8_t revision; // 1 uint8_t length; - uint16_t offset; + uint16_t offset; uint8_t checksum; uint32_t identifier; uint16_t manufacturer; @@ -119,60 +116,72 @@ uint16_t resource_vector; } option_rom_pnp_header_t; +/* Option ROM header */ +typedef struct { + uint16_t signature; // 0xAA55 + uint8_t rom_size; //in 512 bytes blocks + uint8_t jump; //0xE9 for ATI and Intel, 0xEB for NVidia + uint8_t entry_point[4]; //offset to + uint8_t reserved[16]; + uint16_t pci_header_offset; //@0x18 + uint16_t expansion_header_offset; +} option_rom_header_t; + + /* * Under PCI, each device has 256 bytes of configuration address space, * of which the first 64 bytes are standardized as follows: * * register name offset *******************************************************/ -#define PCI_VENDOR_ID 0x00 /* 16 bits */ -#define PCI_DEVICE_ID 0x02 /* 16 bits */ -#define PCI_COMMAND 0x04 /* 16 bits */ -#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ -#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ -#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ -#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ -#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ -#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ -#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ -#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ -#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ -#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ -#define PCI_COMMAND_DISABLE_INTx 0x400 /* PCIE: Disable INTx interrupts */ +#define PCI_VENDOR_ID 0x00 /* 16 bits */ +#define PCI_DEVICE_ID 0x02 /* 16 bits */ +#define PCI_COMMAND 0x04 /* 16 bits */ +#define PCI_COMMAND_IO 0x0001 /* Enable response in I/O space */ +#define PCI_COMMAND_MEMORY 0x0002 /* Enable response in Memory space */ +#define PCI_COMMAND_MASTER 0x0004 /* Enable bus mastering */ +#define PCI_COMMAND_SPECIAL 0x0008 /* Enable response to special cycles (1 byte) */ +#define PCI_COMMAND_INVALIDATE 0x0010 /* Use memory write and invalidate */ +#define PCI_COMMAND_VGA_PALETTE 0x0020 /* Enable palette snooping */ +#define PCI_COMMAND_PARITY 0x0040 /* Enable parity checking */ +#define PCI_COMMAND_WAIT 0x0080 /* Enable address/data stepping */ +#define PCI_COMMAND_SERR 0x0100 /* Enable SERR */ +#define PCI_COMMAND_FAST_BACK 0x0200 /* Enable back-to-back writes */ +#define PCI_COMMAND_DISABLE_INTx 0x0400 /* PCIE: Disable INTx interrupts */ -#define PCI_STATUS 0x06 /* 16 bits */ -#define PCI_STATUS_INTx 0x08 /* PCIE: INTx interrupt pending */ -#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ -#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ -#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ -#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ -#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ -#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ -#define PCI_STATUS_DEVSEL_FAST 0x000 -#define PCI_STATUS_DEVSEL_MEDIUM 0x200 -#define PCI_STATUS_DEVSEL_SLOW 0x400 -#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ -#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ -#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ -#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ -#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ +#define PCI_STATUS 0x06 /* 16 bits */ +#define PCI_STATUS_INTx 0x0008 /* PCIE: INTx interrupt pending */ +#define PCI_STATUS_CAP_LIST 0x0010 /* Support Capability List */ +#define PCI_STATUS_66MHZ 0x0020 /* Support 66 Mhz PCI 2.1 bus */ +#define PCI_STATUS_UDF 0x0040 /* Support User Definable Features [obsolete] */ +#define PCI_STATUS_FAST_BACK 0x0080 /* Accept fast-back to back */ +#define PCI_STATUS_PARITY 0x0100 /* Detected parity error */ +#define PCI_STATUS_DEVSEL_FAST 0x0000 +#define PCI_STATUS_DEVSEL_MEDIUM 0x0200 +#define PCI_STATUS_DEVSEL_SLOW 0x0400 +#define PCI_STATUS_DEVSEL_MASK 0x0600 /* DEVSEL timing */ +#define PCI_STATUS_SIG_TARGET_ABORT 0x0800 /* Set on target abort */ +#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ +#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ +#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ +#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface know also as PCI_PROG_IF */ #define PCI_CLASS_DEVICE 0x0a /* Device subclass */ //#define PCI_SUBCLASS_DEVICE 0x0b /* Device class */ -#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ -#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ -#define PCI_HEADER_TYPE 0x0e /* 8 bits */ -#define PCI_HEADER_TYPE_NORMAL 0 -#define PCI_HEADER_TYPE_BRIDGE 1 -#define PCI_HEADER_TYPE_CARDBUS 2 +#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ +#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ +#define PCI_HEADER_TYPE 0x0e /* 8 bits */ +#define PCI_HEADER_TYPE_NORMAL 0x00 +#define PCI_HEADER_TYPE_BRIDGE 0x01 +#define PCI_HEADER_TYPE_CARDBUS 0x02 -#define PCI_BIST 0x0f /* 8 bits */ -#define PCI_BIST_CODE_MASK 0x0f /* Return result */ -#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ -#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ +#define PCI_BIST 0x0f /* 8 bits */ +#define PCI_BIST_CODE_MASK 0x0f /* Return result */ +#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ +#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ /* * Base addresses specify locations in memory or I/O space. @@ -180,238 +189,237 @@ * 0xffffffff to the register, and reading it back. Only * 1 bits are decoded. */ -#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ -#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ -#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ -#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ -#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ -#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ -#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ +#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ +#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ +#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ +#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ +#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ +#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ +#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ #define PCI_BASE_ADDRESS_SPACE_IO 0x01 #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 -#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ -#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ -#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ -#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ +#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ +#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ +#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ +#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ #define PCI_BASE_ADDRESS_MEM_MASK (~(pciaddr_t)0x0f) #define PCI_BASE_ADDRESS_IO_MASK (~(pciaddr_t)0x03) /* bit 1 is reserved if address_space = 1 */ /* Header type 0 (normal devices) */ #define PCI_CARDBUS_CIS 0x28 -#define PCI_SUBSYSTEM_VENDOR_ID 0x2c -#define PCI_SUBSYSTEM_ID 0x2e -#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ +#define PCI_SUBSYSTEM_VENDOR_ID 0x2c /* */ +#define PCI_SUBSYSTEM_ID 0x2e /* */ +#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ #define PCI_ROM_ADDRESS_ENABLE 0x01 #define PCI_ROM_ADDRESS_MASK (~(pciaddr_t)0x7ff) -#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ /* 0x35-0x3b are reserved */ -#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ -#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ -#define PCI_MIN_GNT 0x3e /* 8 bits */ -#define PCI_MAX_LAT 0x3f /* 8 bits */ +#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ +#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ +#define PCI_MIN_GNT 0x3e /* 8 bits */ +#define PCI_MAX_LAT 0x3f /* 8 bits */ /* Header type 1 (PCI-to-PCI bridges) */ -#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ -#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ -#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ -#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ -#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ +#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ +#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ +#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ +#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ #define PCI_IO_LIMIT 0x1d -#define PCI_IO_RANGE_TYPE_MASK 0x0f /* I/O bridging type */ +#define PCI_IO_RANGE_TYPE_MASK 0x0f /* I/O bridging type */ #define PCI_IO_RANGE_TYPE_16 0x00 #define PCI_IO_RANGE_TYPE_32 0x01 #define PCI_IO_RANGE_MASK ~0x0f -#define PCI_SEC_STATUS 0x1e /* Secondary status register */ -#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ +#define PCI_SEC_STATUS 0x1e /* Secondary status register */ +#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ #define PCI_MEMORY_LIMIT 0x22 -#define PCI_MEMORY_RANGE_TYPE_MASK 0x0f -#define PCI_MEMORY_RANGE_MASK ~0x0f -#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ -#define PCI_PREF_MEMORY_LIMIT 0x26 -#define PCI_PREF_RANGE_TYPE_MASK 0x0f -#define PCI_PREF_RANGE_TYPE_32 0x00 -#define PCI_PREF_RANGE_TYPE_64 0x01 +#define PCI_MEMORY_RANGE_TYPE_MASK 0x0f +#define PCI_MEMORY_RANGE_MASK ~0x0f +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ +#define PCI_PREF_MEMORY_LIMIT 0x26 +#define PCI_PREF_RANGE_TYPE_MASK 0x0f +#define PCI_PREF_RANGE_TYPE_32 0x00 +#define PCI_PREF_RANGE_TYPE_64 0x01 #define PCI_PREF_RANGE_MASK ~0x0f -#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ -#define PCI_PREF_LIMIT_UPPER32 0x2c -#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ -#define PCI_IO_LIMIT_UPPER16 0x32 +#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ +#define PCI_PREF_LIMIT_UPPER32 0x2c +#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ +#define PCI_IO_LIMIT_UPPER16 0x32 /* 0x34 same as for htype 0 */ /* 0x35-0x3b is reserved */ -#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ +#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ /* 0x3c-0x3d are same as for htype 0 */ #define PCI_BRIDGE_CONTROL 0x3e -#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ -#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ -#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ -#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ -#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ -#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ -#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ -#define PCI_BRIDGE_CTL_PRI_DISCARD_TIMER 0x100 /* PCI-X? */ -#define PCI_BRIDGE_CTL_SEC_DISCARD_TIMER 0x200 /* PCI-X? */ -#define PCI_BRIDGE_CTL_DISCARD_TIMER_STATUS 0x400 /* PCI-X? */ -#define PCI_BRIDGE_CTL_DISCARD_TIMER_SERR_EN 0x800 /* PCI-X? */ +#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ +#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ +#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ +#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ +#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ +#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ +#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ +#define PCI_BRIDGE_CTL_PRI_DISCARD_TIMER 0x100 /* PCI-X? */ +#define PCI_BRIDGE_CTL_SEC_DISCARD_TIMER 0x200 /* PCI-X? */ +#define PCI_BRIDGE_CTL_DISCARD_TIMER_STATUS 0x400 /* PCI-X? */ +#define PCI_BRIDGE_CTL_DISCARD_TIMER_SERR_EN 0x800 /* PCI-X? */ /* Header type 2 (CardBus bridges) */ /* 0x14-0x15 reserved */ -#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ -#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ -#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ -#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ -#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ -#define PCI_CB_MEMORY_BASE_0 0x1c -#define PCI_CB_MEMORY_LIMIT_0 0x20 -#define PCI_CB_MEMORY_BASE_1 0x24 -#define PCI_CB_MEMORY_LIMIT_1 0x28 +#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ +#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ +#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ +#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ +#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ +#define PCI_CB_MEMORY_BASE_0 0x1c +#define PCI_CB_MEMORY_LIMIT_0 0x20 +#define PCI_CB_MEMORY_BASE_1 0x24 +#define PCI_CB_MEMORY_LIMIT_1 0x28 #define PCI_CB_IO_BASE_0 0x2c #define PCI_CB_IO_BASE_0_HI 0x2e #define PCI_CB_IO_LIMIT_0 0x30 -#define PCI_CB_IO_LIMIT_0_HI 0x32 +#define PCI_CB_IO_LIMIT_0_HI 0x32 #define PCI_CB_IO_BASE_1 0x34 #define PCI_CB_IO_BASE_1_HI 0x36 #define PCI_CB_IO_LIMIT_1 0x38 -#define PCI_CB_IO_LIMIT_1_HI 0x3a -#define PCI_CB_IO_RANGE_MASK ~0x03 +#define PCI_CB_IO_LIMIT_1_HI 0x3a +#define PCI_CB_IO_RANGE_MASK ~0x03 /* 0x3c-0x3d are same as for htype 0 */ -#define PCI_CB_BRIDGE_CONTROL 0x3e -#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ -#define PCI_CB_BRIDGE_CTL_SERR 0x02 -#define PCI_CB_BRIDGE_CTL_ISA 0x04 -#define PCI_CB_BRIDGE_CTL_VGA 0x08 -#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 -#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ -#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 -#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 -#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 +#define PCI_CB_BRIDGE_CONTROL 0x3e +#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ +#define PCI_CB_BRIDGE_CTL_SERR 0x02 +#define PCI_CB_BRIDGE_CTL_ISA 0x04 +#define PCI_CB_BRIDGE_CTL_VGA 0x08 +#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 +#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ +#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 +#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 +#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 #define PCI_CB_SUBSYSTEM_ID 0x42 -#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ +#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ /* 0x48-0x7f reserved */ /* Capability Identification Numbers list */ #define PCI_CAP_LIST_ID 0 /* Capability ID */ -#define PCI_CAP_ID_PM 0x01 /* Power Management */ -#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ -#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ -#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ -#define PCI_CAP_ID_MSI 0x05 /* Message Signaled Interrupts */ -#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ -#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ -#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ -#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ -#define PCI_CAP_ID_DBG 0x0A /* Debug port */ -#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ -#define PCI_CAP_ID_HOTPLUG 0x0C /* PCI hot-plug */ -#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ -#define PCI_CAP_ID_AGP3 0x0E /* AGP 8x */ -#define PCI_CAP_ID_SECURE 0x0F /* Secure device (?) */ -#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ -#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ -#define PCI_CAP_ID_SATA 0x12 /* Serial-ATA HBA */ -#define PCI_CAP_ID_AF 0x13 /* Advanced features of PCI devices integrated in PCIe root cplx */ +#define PCI_CAP_ID_PM 0x01 /* Power Management */ +#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ +#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ +#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ +#define PCI_CAP_ID_MSI 0x05 /* Message Signaled Interrupts */ +#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ +#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ +#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ +#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ +#define PCI_CAP_ID_DBG 0x0A /* Debug port */ +#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ +#define PCI_CAP_ID_HOTPLUG 0x0C /* PCI hot-plug */ +#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ +#define PCI_CAP_ID_AGP3 0x0E /* AGP 8x */ +#define PCI_CAP_ID_SECURE 0x0F /* Secure device (?) */ +#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ +#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ +#define PCI_CAP_ID_SATA 0x12 /* Serial-ATA HBA */ +#define PCI_CAP_ID_AF 0x13 /* Advanced features of PCI devices integrated in PCIe root cplx */ #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ #define PCI_CAP_SIZEOF 4 -/* Capabilities residing in the - PCI Express extended configuration space */ -#define PCI_EXT_CAP_ID_AER 0x01 /* Advanced Error Reporting */ -#define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel */ -#define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ -#define PCI_EXT_CAP_ID_PB 0x04 /* Power Budgeting */ -#define PCI_EXT_CAP_ID_RCLINK 0x05 /* Root Complex Link Declaration */ -#define PCI_EXT_CAP_ID_RCILINK 0x06 /* Root Complex Internal Link Declaration */ -#define PCI_EXT_CAP_ID_RCECOLL 0x07 /* Root Complex Event Collector */ -#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function Virtual Channel */ -#define PCI_EXT_CAP_ID_RBCB 0x0a /* Root Bridge Control Block */ -#define PCI_EXT_CAP_ID_VNDR 0x0b /* Vendor specific */ -#define PCI_EXT_CAP_ID_ACS 0x0d /* Access Controls */ -#define PCI_EXT_CAP_ID_ARI 0x0e /* Alternative Routing-ID Interpretation */ -#define PCI_EXT_CAP_ID_ATS 0x0f /* Address Translation Service */ -#define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ +/* Capabilities residing in the PCI Express extended configuration space */ +#define PCI_EXT_CAP_ID_AER 0x01 /* Advanced Error Reporting */ +#define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel */ +#define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ +#define PCI_EXT_CAP_ID_PB 0x04 /* Power Budgeting */ +#define PCI_EXT_CAP_ID_RCLINK 0x05 /* Root Complex Link Declaration */ +#define PCI_EXT_CAP_ID_RCILINK 0x06 /* Root Complex Internal Link Declaration */ +#define PCI_EXT_CAP_ID_RCECOLL 0x07 /* Root Complex Event Collector */ +#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function Virtual Channel */ +#define PCI_EXT_CAP_ID_RBCB 0x0a /* Root Bridge Control Block */ +#define PCI_EXT_CAP_ID_VNDR 0x0b /* Vendor specific */ +#define PCI_EXT_CAP_ID_ACS 0x0d /* Access Controls */ +#define PCI_EXT_CAP_ID_ARI 0x0e /* Alternative Routing-ID Interpretation */ +#define PCI_EXT_CAP_ID_ATS 0x0f /* Address Translation Service */ +#define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ /* Power Management Registers */ -#define PCI_PM_CAP_VER_MASK 0x0007 /* Version (2=PM1.1) */ -#define PCI_PM_CAP_PME_CLOCK 0x0008 /* Clock required for PME generation */ -#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization required */ -#define PCI_PM_CAP_AUX_C_MASK 0x01c0 /* Maximum aux current required in D3cold */ -#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ -#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ -#define PCI_PM_CAP_PME_D0 0x0800 /* PME can be asserted from D0 */ -#define PCI_PM_CAP_PME_D1 0x1000 /* PME can be asserted from D1 */ -#define PCI_PM_CAP_PME_D2 0x2000 /* PME can be asserted from D2 */ -#define PCI_PM_CAP_PME_D3_HOT 0x4000 /* PME can be asserted from D3hot */ -#define PCI_PM_CAP_PME_D3_COLD 0x8000 /* PME can be asserted from D3cold */ -#define PCI_PM_CTRL 4 /* PM control and status register */ -#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ -#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ -#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* PM table data index */ -#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* PM table data scaling factor */ -#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ -#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions */ -#define PCI_PM_PPB_B2_B3 0x40 /* If bridge enters D3hot, bus enters: 0=B3, 1=B2 */ -#define PCI_PM_BPCC_ENABLE 0x80 /* Secondary bus is power managed */ -#define PCI_PM_DATA_REGISTER 7 /* PM table contents read here */ +#define PCI_PM_CAP_VER_MASK 0x0007 /* Version (2=PM1.1) */ +#define PCI_PM_CAP_PME_CLOCK 0x0008 /* Clock required for PME generation */ +#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization required */ +#define PCI_PM_CAP_AUX_C_MASK 0x01c0 /* Maximum aux current required in D3cold */ +#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ +#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ +#define PCI_PM_CAP_PME_D0 0x0800 /* PME can be asserted from D0 */ +#define PCI_PM_CAP_PME_D1 0x1000 /* PME can be asserted from D1 */ +#define PCI_PM_CAP_PME_D2 0x2000 /* PME can be asserted from D2 */ +#define PCI_PM_CAP_PME_D3_HOT 0x4000 /* PME can be asserted from D3hot */ +#define PCI_PM_CAP_PME_D3_COLD 0x8000 /* PME can be asserted from D3cold */ +#define PCI_PM_CTRL 4 /* PM control and status register */ +#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ +#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ +#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* PM table data index */ +#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* PM table data scaling factor */ +#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ +#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions */ +#define PCI_PM_PPB_B2_B3 0x40 /* If bridge enters D3hot, bus enters: 0=B3, 1=B2 */ +#define PCI_PM_BPCC_ENABLE 0x80 /* Secondary bus is power managed */ +#define PCI_PM_DATA_REGISTER 7 /* PM table contents read here */ #define PCI_PM_SIZEOF 8 /* AGP registers */ #define PCI_AGP_VERSION 2 /* BCD version number */ -#define PCI_AGP_RFU 3 /* Rest of capability flags */ +#define PCI_AGP_RFU 3 /* Rest of capability flags */ #define PCI_AGP_STATUS 4 /* Status register */ -#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ -#define PCI_AGP_STATUS_ISOCH 0x10000 /* Isochronous transactions supported */ -#define PCI_AGP_STATUS_ARQSZ_MASK 0xe000 /* log2(optimum async req size in bytes) - 4 */ -#define PCI_AGP_STATUS_CAL_MASK 0x1c00 /* Calibration cycle timing */ -#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ -#define PCI_AGP_STATUS_ITA_COH 0x0100 /* In-aperture accesses always coherent */ -#define PCI_AGP_STATUS_GART64 0x0080 /* 64-bit GART entries supported */ -#define PCI_AGP_STATUS_HTRANS 0x0040 /* If 0, core logic can xlate host CPU accesses thru aperture */ -#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing cycles supported */ -#define PCI_AGP_STATUS_FW 0x0010 /* Fast write transfers supported */ -#define PCI_AGP_STATUS_AGP3 0x0008 /* AGP3 mode supported */ -#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported (RFU in AGP3 mode) */ -#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported (8x in AGP3 mode) */ -#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported (4x in AGP3 mode) */ +#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ +#define PCI_AGP_STATUS_ISOCH 0x10000 /* Isochronous transactions supported */ +#define PCI_AGP_STATUS_ARQSZ_MASK 0xe000 /* log2(optimum async req size in bytes) - 4 */ +#define PCI_AGP_STATUS_CAL_MASK 0x1c00 /* Calibration cycle timing */ +#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ +#define PCI_AGP_STATUS_ITA_COH 0x0100 /* In-aperture accesses always coherent */ +#define PCI_AGP_STATUS_GART64 0x0080 /* 64-bit GART entries supported */ +#define PCI_AGP_STATUS_HTRANS 0x0040 /* If 0, core logic can xlate host CPU accesses thru aperture */ +#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing cycles supported */ +#define PCI_AGP_STATUS_FW 0x0010 /* Fast write transfers supported */ +#define PCI_AGP_STATUS_AGP3 0x0008 /* AGP3 mode supported */ +#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported (RFU in AGP3 mode) */ +#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported (8x in AGP3 mode) */ +#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported (4x in AGP3 mode) */ #define PCI_AGP_COMMAND 8 /* Control register */ -#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ -#define PCI_AGP_COMMAND_ARQSZ_MASK 0xe000 /* log2(optimum async req size in bytes) - 4 */ -#define PCI_AGP_COMMAND_CAL_MASK 0x1c00 /* Calibration cycle timing */ -#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ -#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ -#define PCI_AGP_COMMAND_GART64 0x0080 /* 64-bit GART entries enabled */ -#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow generation of 64-bit addr cycles */ -#define PCI_AGP_COMMAND_FW 0x0010 /* Enable FW transfers */ -#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate (RFU in AGP3 mode) */ -#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate (8x in AGP3 mode) */ -#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate (4x in AGP3 mode) */ +#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ +#define PCI_AGP_COMMAND_ARQSZ_MASK 0xe000 /* log2(optimum async req size in bytes) - 4 */ +#define PCI_AGP_COMMAND_CAL_MASK 0x1c00 /* Calibration cycle timing */ +#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ +#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ +#define PCI_AGP_COMMAND_GART64 0x0080 /* 64-bit GART entries enabled */ +#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow generation of 64-bit addr cycles */ +#define PCI_AGP_COMMAND_FW 0x0010 /* Enable FW transfers */ +#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate (RFU in AGP3 mode) */ +#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate (8x in AGP3 mode) */ +#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate (4x in AGP3 mode) */ #define PCI_AGP_SIZEOF 12 /* Vital Product Data */ #define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ -#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ -#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ +#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ +#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ /* Slot Identification */ -#define PCI_SID_ESR 2 /* Expansion Slot Register */ -#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ -#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ +#define PCI_SID_ESR 2 /* Expansion Slot Register */ +#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ +#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ /* Message Signaled Interrupts registers */ #define PCI_MSI_FLAGS 2 /* Various flags */ -#define PCI_MSI_FLAGS_MASK_BIT 0x100 /* interrupt masking & reporting supported */ -#define PCI_MSI_FLAGS_64BIT 0x080 /* 64-bit addresses allowed */ -#define PCI_MSI_FLAGS_QSIZE 0x070 /* Message queue size configured */ -#define PCI_MSI_FLAGS_QMASK 0x00e /* Maximum queue size available */ -#define PCI_MSI_FLAGS_ENABLE 0x001 /* MSI feature enabled */ -#define PCI_MSI_RFU 3 /* Rest of capability flags */ +#define PCI_MSI_FLAGS_MASK_BIT 0x100 /* interrupt masking & reporting supported */ +#define PCI_MSI_FLAGS_64BIT 0x080 /* 64-bit addresses allowed */ +#define PCI_MSI_FLAGS_QSIZE 0x070 /* Message queue size configured */ +#define PCI_MSI_FLAGS_QMASK 0x00e /* Maximum queue size available */ +#define PCI_MSI_FLAGS_ENABLE 0x001 /* MSI feature enabled */ +#define PCI_MSI_RFU 3 /* Rest of capability flags */ #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ @@ -422,206 +430,205 @@ #define PCI_MSI_PENDING_64 20 /* per-vector interrupt pending for 64-bit devices */ /* PCI-X */ -#define PCI_PCIX_COMMAND 2 /* Command register offset */ -#define PCI_PCIX_COMMAND_DPERE 0x0001 /* Data Parity Error Recover Enable */ -#define PCI_PCIX_COMMAND_ERO 0x0002 /* Enable Relaxed Ordering */ -#define PCI_PCIX_COMMAND_MAX_MEM_READ_BYTE_COUNT 0x000c /* Maximum Memory Read Byte Count */ -#define PCI_PCIX_COMMAND_MAX_OUTSTANDING_SPLIT_TRANS 0x0070 -#define PCI_PCIX_COMMAND_RESERVED 0xf80 -#define PCI_PCIX_STATUS 4 /* Status register offset */ -#define PCI_PCIX_STATUS_FUNCTION 0x00000007 -#define PCI_PCIX_STATUS_DEVICE 0x000000f8 -#define PCI_PCIX_STATUS_BUS 0x0000ff00 -#define PCI_PCIX_STATUS_64BIT 0x00010000 -#define PCI_PCIX_STATUS_133MHZ 0x00020000 -#define PCI_PCIX_STATUS_SC_DISCARDED 0x00040000 /* Split Completion Discarded */ -#define PCI_PCIX_STATUS_UNEXPECTED_SC 0x00080000 /* Unexpected Split Completion */ -#define PCI_PCIX_STATUS_DEVICE_COMPLEXITY 0x00100000 /* 0 = simple device, 1 = bridge device */ -#define PCI_PCIX_STATUS_DESIGNED_MAX_MEM_READ_BYTE_COUNT 0x00600000 /* 0 = 512 bytes, 1 = 1024, 2 = 2048, 3 = 4096 */ -#define PCI_PCIX_STATUS_DESIGNED_MAX_OUTSTANDING_SPLIT_TRANS 0x03800000 -#define PCI_PCIX_STATUS_DESIGNED_MAX_CUMULATIVE_READ_SIZE 0x1c000000 -#define PCI_PCIX_STATUS_RCVD_SC_ERR_MESS 0x20000000 /* Received Split Completion Error Message */ -#define PCI_PCIX_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ -#define PCI_PCIX_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ -#define PCI_PCIX_SIZEOF 4 +#define PCI_PCIX_COMMAND 2 /* Command register offset */ +#define PCI_PCIX_COMMAND_DPERE 0x0001 /* Data Parity Error Recover Enable */ +#define PCI_PCIX_COMMAND_ERO 0x0002 /* Enable Relaxed Ordering */ +#define PCI_PCIX_COMMAND_MAX_MEM_READ_BYTE_COUNT 0x000c /* Maximum Memory Read Byte Count */ +#define PCI_PCIX_COMMAND_MAX_OUTSTANDING_SPLIT_TRANS 0x0070 +#define PCI_PCIX_COMMAND_RESERVED 0xf80 +#define PCI_PCIX_STATUS 4 /* Status register offset */ +#define PCI_PCIX_STATUS_FUNCTION 0x00000007 +#define PCI_PCIX_STATUS_DEVICE 0x000000f8 +#define PCI_PCIX_STATUS_BUS 0x0000ff00 +#define PCI_PCIX_STATUS_64BIT 0x00010000 +#define PCI_PCIX_STATUS_133MHZ 0x00020000 +#define PCI_PCIX_STATUS_SC_DISCARDED 0x00040000 /* Split Completion Discarded */ +#define PCI_PCIX_STATUS_UNEXPECTED_SC 0x00080000 /* Unexpected Split Completion */ +#define PCI_PCIX_STATUS_DEVICE_COMPLEXITY 0x00100000 /* 0 = simple device, 1 = bridge device */ +#define PCI_PCIX_STATUS_DESIGNED_MAX_MEM_READ_BYTE_COUNT 0x00600000 /* 0 = 512 bytes, 1 = 1024, 2 = 2048, 3 = 4096 */ +#define PCI_PCIX_STATUS_DESIGNED_MAX_OUTSTANDING_SPLIT_TRANS 0x03800000 +#define PCI_PCIX_STATUS_DESIGNED_MAX_CUMULATIVE_READ_SIZE 0x1c000000 +#define PCI_PCIX_STATUS_RCVD_SC_ERR_MESS 0x20000000 /* Received Split Completion Error Message */ +#define PCI_PCIX_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ +#define PCI_PCIX_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ +#define PCI_PCIX_SIZEOF 4 - /* PCI-X Bridges */ -#define PCI_PCIX_BRIDGE_SEC_STATUS 2 /* Secondary bus status register offset */ -#define PCI_PCIX_BRIDGE_SEC_STATUS_64BIT 0x0001 -#define PCI_PCIX_BRIDGE_SEC_STATUS_133MHZ 0x0002 -#define PCI_PCIX_BRIDGE_SEC_STATUS_SC_DISCARDED 0x0004 /* Split Completion Discarded on secondary bus */ -#define PCI_PCIX_BRIDGE_SEC_STATUS_UNEXPECTED_SC 0x0008 /* Unexpected Split Completion on secondary bus */ -#define PCI_PCIX_BRIDGE_SEC_STATUS_SC_OVERRUN 0x0010 /* Split Completion Overrun on secondary bus */ -#define PCI_PCIX_BRIDGE_SEC_STATUS_SPLIT_REQUEST_DELAYED 0x0020 -#define PCI_PCIX_BRIDGE_SEC_STATUS_CLOCK_FREQ 0x01c0 -#define PCI_PCIX_BRIDGE_SEC_STATUS_RESERVED 0xfe00 -#define PCI_PCIX_BRIDGE_STATUS 4 /* Primary bus status register offset */ -#define PCI_PCIX_BRIDGE_STATUS_FUNCTION 0x00000007 -#define PCI_PCIX_BRIDGE_STATUS_DEVICE 0x000000f8 -#define PCI_PCIX_BRIDGE_STATUS_BUS 0x0000ff00 -#define PCI_PCIX_BRIDGE_STATUS_64BIT 0x00010000 -#define PCI_PCIX_BRIDGE_STATUS_133MHZ 0x00020000 -#define PCI_PCIX_BRIDGE_STATUS_SC_DISCARDED 0x00040000 /* Split Completion Discarded */ -#define PCI_PCIX_BRIDGE_STATUS_UNEXPECTED_SC 0x00080000 /* Unexpected Split Completion */ -#define PCI_PCIX_BRIDGE_STATUS_SC_OVERRUN 0x00100000 /* Split Completion Overrun */ -#define PCI_PCIX_BRIDGE_STATUS_SPLIT_REQUEST_DELAYED 0x00200000 -#define PCI_PCIX_BRIDGE_STATUS_RESERVED 0xffc00000 -#define PCI_PCIX_BRIDGE_UPSTREAM_SPLIT_TRANS_CTRL 8 /* Upstream Split Transaction Register offset */ -#define PCI_PCIX_BRIDGE_DOWNSTREAM_SPLIT_TRANS_CTRL 12 /* Downstream Split Transaction Register offset */ -#define PCI_PCIX_BRIDGE_STR_CAPACITY 0x0000ffff -#define PCI_PCIX_BRIDGE_STR_COMMITMENT_LIMIT 0xffff0000 +#define PCI_PCIX_BRIDGE_SEC_STATUS 2 /* Secondary bus status register offset */ +#define PCI_PCIX_BRIDGE_SEC_STATUS_64BIT 0x0001 +#define PCI_PCIX_BRIDGE_SEC_STATUS_133MHZ 0x0002 +#define PCI_PCIX_BRIDGE_SEC_STATUS_SC_DISCARDED 0x0004 /* Split Completion Discarded on secondary bus */ +#define PCI_PCIX_BRIDGE_SEC_STATUS_UNEXPECTED_SC 0x0008 /* Unexpected Split Completion on secondary bus */ +#define PCI_PCIX_BRIDGE_SEC_STATUS_SC_OVERRUN 0x0010 /* Split Completion Overrun on secondary bus */ +#define PCI_PCIX_BRIDGE_SEC_STATUS_SPLIT_REQUEST_DELAYED 0x0020 +#define PCI_PCIX_BRIDGE_SEC_STATUS_CLOCK_FREQ 0x01c0 +#define PCI_PCIX_BRIDGE_SEC_STATUS_RESERVED 0xfe00 +#define PCI_PCIX_BRIDGE_STATUS 4 /* Primary bus status register offset */ +#define PCI_PCIX_BRIDGE_STATUS_FUNCTION 0x00000007 +#define PCI_PCIX_BRIDGE_STATUS_DEVICE 0x000000f8 +#define PCI_PCIX_BRIDGE_STATUS_BUS 0x0000ff00 +#define PCI_PCIX_BRIDGE_STATUS_64BIT 0x00010000 +#define PCI_PCIX_BRIDGE_STATUS_133MHZ 0x00020000 +#define PCI_PCIX_BRIDGE_STATUS_SC_DISCARDED 0x00040000 /* Split Completion Discarded */ +#define PCI_PCIX_BRIDGE_STATUS_UNEXPECTED_SC 0x00080000 /* Unexpected Split Completion */ +#define PCI_PCIX_BRIDGE_STATUS_SC_OVERRUN 0x00100000 /* Split Completion Overrun */ +#define PCI_PCIX_BRIDGE_STATUS_SPLIT_REQUEST_DELAYED 0x00200000 +#define PCI_PCIX_BRIDGE_STATUS_RESERVED 0xffc00000 +#define PCI_PCIX_BRIDGE_UPSTREAM_SPLIT_TRANS_CTRL 8 /* Upstream Split Transaction Register offset */ +#define PCI_PCIX_BRIDGE_DOWNSTREAM_SPLIT_TRANS_CTRL 12 /* Downstream Split Transaction Register offset */ +#define PCI_PCIX_BRIDGE_STR_CAPACITY 0x0000ffff +#define PCI_PCIX_BRIDGE_STR_COMMITMENT_LIMIT 0xffff0000 #define PCI_PCIX_BRIDGE_SIZEOF 12 /* PCI Express */ #define PCI_EXP_FLAGS 0x2 /* Capabilities register */ -#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ -#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ -#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ -#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ -#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ -#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ -#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ -#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ -#define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */ -#define PCI_EXP_TYPE_ROOT_INT_EP 0x9 /* Root Complex Integrated Endpoint */ -#define PCI_EXP_TYPE_ROOT_EC 0xa /* Root Complex Event Collector */ -#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ -#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ -#define PCI_EXP_DEVCAP 0x4 /* Device capabilities */ -#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ -#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ -#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ -#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ -#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ -#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ -#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ -#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ -#define PCI_EXP_DEVCAP_RBE 0x8000 /* Role-Based Error Reporting */ -#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ -#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ -#define PCI_EXP_DEVCAP_FLRESET 0x10000000 /* Function-Level Reset */ -#define PCI_EXP_DEVCTL 0x8 /* Device Control */ -#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ -#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ -#define PCI_EXP_DEVCTL_RELAXED 0x0010 /* Enable Relaxed Ordering */ -#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ -#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ -#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ -#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ -#define PCI_EXP_DEVCTL_NOSNOOP 0x0800 /* Enable No Snoop */ -#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ -#define PCI_EXP_DEVCTL_BCRE 0x8000 /* Bridge Configuration Retry Enable */ -#define PCI_EXP_DEVCTL_FLRESET 0x8000 /* Function-Level Reset [bit shared with BCRE] */ -#define PCI_EXP_DEVSTA 0xa /* Device Status */ -#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ -#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ -#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ -#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ -#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ -#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ -#define PCI_EXP_LNKCAP 0xc /* Link Capabilities */ -#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */ -#define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */ -#define PCI_EXP_LNKCAP_ASPM 0x00c00 /* Active State Power Management */ -#define PCI_EXP_LNKCAP_L0S 0x07000 /* L0s Acceptable Latency */ -#define PCI_EXP_LNKCAP_L1 0x38000 /* L1 Acceptable Latency */ -#define PCI_EXP_LNKCAP_CLOCKPM 0x40000 /* Clock Power Management */ -#define PCI_EXP_LNKCAP_SURPRISE 0x80000 /* Surprise Down Error Reporting */ -#define PCI_EXP_LNKCAP_DLLA 0x100000 /* Data Link Layer Active Reporting */ -#define PCI_EXP_LNKCAP_LBNC 0x200000 /* Link Bandwidth Notification Capability */ -#define PCI_EXP_LNKCAP_PORT 0xff000000 /* Port Number */ -#define PCI_EXP_LNKCTL 0x10 /* Link Control */ -#define PCI_EXP_LNKCTL_ASPM 0x0003 /* ASPM Control */ -#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ -#define PCI_EXP_LNKCTL_DISABLE 0x0010 /* Link Disable */ -#define PCI_EXP_LNKCTL_RETRAIN 0x0020 /* Retrain Link */ -#define PCI_EXP_LNKCTL_CLOCK 0x0040 /* Common Clock Configuration */ -#define PCI_EXP_LNKCTL_XSYNCH 0x0080 /* Extended Synch */ -#define PCI_EXP_LNKCTL_CLOCKPM 0x0100 /* Clock Power Management */ -#define PCI_EXP_LNKCTL_HWAUTWD 0x0200 /* Hardware Autonomous Width Disable */ -#define PCI_EXP_LNKCTL_BWMIE 0x0400 /* Bandwidth Mgmt Interrupt Enable */ -#define PCI_EXP_LNKCTL_AUTBWIE 0x0800 /* Autonomous Bandwidth Mgmt Interrupt Enable */ -#define PCI_EXP_LNKSTA 0x12 /* Link Status */ -#define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */ -#define PCI_EXP_LNKSTA_WIDTH 0x03f0 /* Negotiated Link Width */ -#define PCI_EXP_LNKSTA_TR_ERR 0x0400 /* Training Error (obsolete) */ -#define PCI_EXP_LNKSTA_TRAIN 0x0800 /* Link Training */ -#define PCI_EXP_LNKSTA_SL_CLK 0x1000 /* Slot Clock Configuration */ -#define PCI_EXP_LNKSTA_DL_ACT 0x2000 /* Data Link Layer in DL_Active State */ -#define PCI_EXP_LNKSTA_BWMGMT 0x4000 /* Bandwidth Mgmt Status */ -#define PCI_EXP_LNKSTA_AUTBW 0x8000 /* Autonomous Bandwidth Mgmt Status */ -#define PCI_EXP_SLTCAP 0x14 /* Slot Capabilities */ -#define PCI_EXP_SLTCAP_ATNB 0x0001 /* Attention Button Present */ -#define PCI_EXP_SLTCAP_PWRC 0x0002 /* Power Controller Present */ -#define PCI_EXP_SLTCAP_MRL 0x0004 /* MRL Sensor Present */ -#define PCI_EXP_SLTCAP_ATNI 0x0008 /* Attention Indicator Present */ -#define PCI_EXP_SLTCAP_PWRI 0x0010 /* Power Indicator Present */ -#define PCI_EXP_SLTCAP_HPS 0x0020 /* Hot-Plug Surprise */ -#define PCI_EXP_SLTCAP_HPC 0x0040 /* Hot-Plug Capable */ -#define PCI_EXP_SLTCAP_PWR_VAL 0x00007f80 /* Slot Power Limit Value */ -#define PCI_EXP_SLTCAP_PWR_SCL 0x00018000 /* Slot Power Limit Scale */ -#define PCI_EXP_SLTCAP_INTERLOCK 0x020000 /* Electromechanical Interlock Present */ -#define PCI_EXP_SLTCAP_NOCMDCOMP 0x040000 /* No Command Completed Support */ -#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ -#define PCI_EXP_SLTCTL 0x18 /* Slot Control */ -#define PCI_EXP_SLTCTL_ATNB 0x0001 /* Attention Button Pressed Enable */ -#define PCI_EXP_SLTCTL_PWRF 0x0002 /* Power Fault Detected Enable */ -#define PCI_EXP_SLTCTL_MRLS 0x0004 /* MRL Sensor Changed Enable */ -#define PCI_EXP_SLTCTL_PRSD 0x0008 /* Presence Detect Changed Enable */ -#define PCI_EXP_SLTCTL_CMDC 0x0010 /* Command Completed Interrupt Enable */ -#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ -#define PCI_EXP_SLTCTL_ATNI 0x00c0 /* Attention Indicator Control */ -#define PCI_EXP_SLTCTL_PWRI 0x0300 /* Power Indicator Control */ -#define PCI_EXP_SLTCTL_PWRC 0x0400 /* Power Controller Control */ -#define PCI_EXP_SLTCTL_INTERLOCK 0x0800 /* Electromechanical Interlock Control */ -#define PCI_EXP_SLTCTL_LLCHG 0x1000 /* Data Link Layer State Changed Enable */ -#define PCI_EXP_SLTSTA 0x1a /* Slot Status */ -#define PCI_EXP_SLTSTA_ATNB 0x0001 /* Attention Button Pressed */ -#define PCI_EXP_SLTSTA_PWRF 0x0002 /* Power Fault Detected */ -#define PCI_EXP_SLTSTA_MRLS 0x0004 /* MRL Sensor Changed */ -#define PCI_EXP_SLTSTA_PRSD 0x0008 /* Presence Detect Changed */ -#define PCI_EXP_SLTSTA_CMDC 0x0010 /* Command Completed */ -#define PCI_EXP_SLTSTA_MRL_ST 0x0020 /* MRL Sensor State */ -#define PCI_EXP_SLTSTA_PRES 0x0040 /* Presence Detect State */ -#define PCI_EXP_SLTSTA_INTERLOCK 0x0080 /* Electromechanical Interlock Status */ -#define PCI_EXP_SLTSTA_LLCHG 0x0100 /* Data Link Layer State Changed */ -#define PCI_EXP_RTCTL 0x1c /* Root Control */ -#define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */ -#define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */ -#define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */ -#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ -#define PCI_EXP_RTCTL_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ -#define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ -#define PCI_EXP_RTCAP_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ -#define PCI_EXP_RTSTA 0x20 /* Root Status */ -#define PCI_EXP_RTSTA_PME_REQID 0x0000ffff /* PME Requester ID */ -#define PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */ -#define PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */ -#define PCI_EXP_DEVCAP2 0x24 /* Device capabilities 2 */ -#define PCI_EXP_DEVCTL2 0x28 /* Device Control */ -#define PCI_EXP_DEV2_TIMEOUT_RANGE(x) ((x) & 0xf) /* Completion Timeout Ranges Supported */ -#define PCI_EXP_DEV2_TIMEOUT_VALUE(x) ((x) & 0xf) /* Completion Timeout Value */ -#define PCI_EXP_DEV2_TIMEOUT_DIS 0x0010 /* Completion Timeout Disable Supported */ -#define PCI_EXP_DEV2_ARI 0x0020 /* ARI Forwarding */ -#define PCI_EXP_DEVSTA2 0x2a /* Device Status */ -#define PCI_EXP_LNKCAP2 0x2c /* Link Capabilities */ -#define PCI_EXP_LNKCTL2 0x30 /* Link Control */ -#define PCI_EXP_LNKCTL2_SPEED(x) ((x) & 0xf) /* Target Link Speed */ -#define PCI_EXP_LNKCTL2_CMPLNC 0x0010 /* Enter Compliance */ -#define PCI_EXP_LNKCTL2_SPEED_DIS 0x0020 /* Hardware Autonomous Speed Disable */ -#define PCI_EXP_LNKCTL2_DEEMPHASIS(x) (((x) >> 6) & 1) /* Selectable De-emphasis */ -#define PCI_EXP_LNKCTL2_MARGIN(x) (((x) >> 7) & 7) /* Transmit Margin */ -#define PCI_EXP_LNKCTL2_MOD_CMPLNC 0x0400 /* Enter Modified Compliance */ -#define PCI_EXP_LNKCTL2_CMPLNC_SOS 0x0800 /* Compliance SOS */ -#define PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 1) /* Compliance De-emphasis */ -#define PCI_EXP_LNKSTA2 0x32 /* Link Status */ -#define PCI_EXP_LINKSTA2_DEEMPHASIS(x) ((x) & 1) /* Current De-emphasis Level */ -#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities */ -#define PCI_EXP_SLTCTL2 0x38 /* Slot Control */ -#define PCI_EXP_SLTSTA2 0x3a /* Slot Status */ +#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ +#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ +#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ +#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ +#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ +#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ +#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ +#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ +#define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */ +#define PCI_EXP_TYPE_ROOT_INT_EP 0x9 /* Root Complex Integrated Endpoint */ +#define PCI_EXP_TYPE_ROOT_EC 0xa /* Root Complex Event Collector */ +#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ +#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ +#define PCI_EXP_DEVCAP 0x4 /* Device capabilities */ +#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ +#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ +#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ +#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ +#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ +#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ +#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ +#define PCI_EXP_DEVCAP_RBE 0x8000 /* Role-Based Error Reporting */ +#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ +#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ +#define PCI_EXP_DEVCAP_FLRESET 0x10000000 /* Function-Level Reset */ +#define PCI_EXP_DEVCTL 0x8 /* Device Control */ +#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ +#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ +#define PCI_EXP_DEVCTL_RELAXED 0x0010 /* Enable Relaxed Ordering */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ +#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ +#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ +#define PCI_EXP_DEVCTL_NOSNOOP 0x0800 /* Enable No Snoop */ +#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ +#define PCI_EXP_DEVCTL_BCRE 0x8000 /* Bridge Configuration Retry Enable */ +#define PCI_EXP_DEVCTL_FLRESET 0x8000 /* Function-Level Reset [bit shared with BCRE] */ +#define PCI_EXP_DEVSTA 0xa /* Device Status */ +#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ +#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ +#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ +#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ +#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ +#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ +#define PCI_EXP_LNKCAP 0xc /* Link Capabilities */ +#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */ +#define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */ +#define PCI_EXP_LNKCAP_ASPM 0x00c00 /* Active State Power Management */ +#define PCI_EXP_LNKCAP_L0S 0x07000 /* L0s Acceptable Latency */ +#define PCI_EXP_LNKCAP_L1 0x38000 /* L1 Acceptable Latency */ +#define PCI_EXP_LNKCAP_CLOCKPM 0x40000 /* Clock Power Management */ +#define PCI_EXP_LNKCAP_SURPRISE 0x80000 /* Surprise Down Error Reporting */ +#define PCI_EXP_LNKCAP_DLLA 0x100000 /* Data Link Layer Active Reporting */ +#define PCI_EXP_LNKCAP_LBNC 0x200000 /* Link Bandwidth Notification Capability */ +#define PCI_EXP_LNKCAP_PORT 0xff000000 /* Port Number */ +#define PCI_EXP_LNKCTL 0x10 /* Link Control */ +#define PCI_EXP_LNKCTL_ASPM 0x0003 /* ASPM Control */ +#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ +#define PCI_EXP_LNKCTL_DISABLE 0x0010 /* Link Disable */ +#define PCI_EXP_LNKCTL_RETRAIN 0x0020 /* Retrain Link */ +#define PCI_EXP_LNKCTL_CLOCK 0x0040 /* Common Clock Configuration */ +#define PCI_EXP_LNKCTL_XSYNCH 0x0080 /* Extended Synch */ +#define PCI_EXP_LNKCTL_CLOCKPM 0x0100 /* Clock Power Management */ +#define PCI_EXP_LNKCTL_HWAUTWD 0x0200 /* Hardware Autonomous Width Disable */ +#define PCI_EXP_LNKCTL_BWMIE 0x0400 /* Bandwidth Mgmt Interrupt Enable */ +#define PCI_EXP_LNKCTL_AUTBWIE 0x0800 /* Autonomous Bandwidth Mgmt Interrupt Enable */ +#define PCI_EXP_LNKSTA 0x12 /* Link Status */ +#define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */ +#define PCI_EXP_LNKSTA_WIDTH 0x03f0 /* Negotiated Link Width */ +#define PCI_EXP_LNKSTA_TR_ERR 0x0400 /* Training Error (obsolete) */ +#define PCI_EXP_LNKSTA_TRAIN 0x0800 /* Link Training */ +#define PCI_EXP_LNKSTA_SL_CLK 0x1000 /* Slot Clock Configuration */ +#define PCI_EXP_LNKSTA_DL_ACT 0x2000 /* Data Link Layer in DL_Active State */ +#define PCI_EXP_LNKSTA_BWMGMT 0x4000 /* Bandwidth Mgmt Status */ +#define PCI_EXP_LNKSTA_AUTBW 0x8000 /* Autonomous Bandwidth Mgmt Status */ +#define PCI_EXP_SLTCAP 0x14 /* Slot Capabilities */ +#define PCI_EXP_SLTCAP_ATNB 0x0001 /* Attention Button Present */ +#define PCI_EXP_SLTCAP_PWRC 0x0002 /* Power Controller Present */ +#define PCI_EXP_SLTCAP_MRL 0x0004 /* MRL Sensor Present */ +#define PCI_EXP_SLTCAP_ATNI 0x0008 /* Attention Indicator Present */ +#define PCI_EXP_SLTCAP_PWRI 0x0010 /* Power Indicator Present */ +#define PCI_EXP_SLTCAP_HPS 0x0020 /* Hot-Plug Surprise */ +#define PCI_EXP_SLTCAP_HPC 0x0040 /* Hot-Plug Capable */ +#define PCI_EXP_SLTCAP_PWR_VAL 0x00007f80 /* Slot Power Limit Value */ +#define PCI_EXP_SLTCAP_PWR_SCL 0x00018000 /* Slot Power Limit Scale */ +#define PCI_EXP_SLTCAP_INTERLOCK 0x020000 /* Electromechanical Interlock Present */ +#define PCI_EXP_SLTCAP_NOCMDCOMP 0x040000 /* No Command Completed Support */ +#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ +#define PCI_EXP_SLTCTL 0x18 /* Slot Control */ +#define PCI_EXP_SLTCTL_ATNB 0x0001 /* Attention Button Pressed Enable */ +#define PCI_EXP_SLTCTL_PWRF 0x0002 /* Power Fault Detected Enable */ +#define PCI_EXP_SLTCTL_MRLS 0x0004 /* MRL Sensor Changed Enable */ +#define PCI_EXP_SLTCTL_PRSD 0x0008 /* Presence Detect Changed Enable */ +#define PCI_EXP_SLTCTL_CMDC 0x0010 /* Command Completed Interrupt Enable */ +#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ +#define PCI_EXP_SLTCTL_ATNI 0x00c0 /* Attention Indicator Control */ +#define PCI_EXP_SLTCTL_PWRI 0x0300 /* Power Indicator Control */ +#define PCI_EXP_SLTCTL_PWRC 0x0400 /* Power Controller Control */ +#define PCI_EXP_SLTCTL_INTERLOCK 0x0800 /* Electromechanical Interlock Control */ +#define PCI_EXP_SLTCTL_LLCHG 0x1000 /* Data Link Layer State Changed Enable */ +#define PCI_EXP_SLTSTA 0x1a /* Slot Status */ +#define PCI_EXP_SLTSTA_ATNB 0x0001 /* Attention Button Pressed */ +#define PCI_EXP_SLTSTA_PWRF 0x0002 /* Power Fault Detected */ +#define PCI_EXP_SLTSTA_MRLS 0x0004 /* MRL Sensor Changed */ +#define PCI_EXP_SLTSTA_PRSD 0x0008 /* Presence Detect Changed */ +#define PCI_EXP_SLTSTA_CMDC 0x0010 /* Command Completed */ +#define PCI_EXP_SLTSTA_MRL_ST 0x0020 /* MRL Sensor State */ +#define PCI_EXP_SLTSTA_PRES 0x0040 /* Presence Detect State */ +#define PCI_EXP_SLTSTA_INTERLOCK 0x0080 /* Electromechanical Interlock Status */ +#define PCI_EXP_SLTSTA_LLCHG 0x0100 /* Data Link Layer State Changed */ +#define PCI_EXP_RTCTL 0x1c /* Root Control */ +#define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */ +#define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */ +#define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */ +#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ +#define PCI_EXP_RTCTL_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ +#define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ +#define PCI_EXP_RTCAP_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ +#define PCI_EXP_RTSTA 0x20 /* Root Status */ +#define PCI_EXP_RTSTA_PME_REQID 0x0000ffff /* PME Requester ID */ +#define PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */ +#define PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */ +#define PCI_EXP_DEVCAP2 0x24 /* Device capabilities 2 */ +#define PCI_EXP_DEVCTL2 0x28 /* Device Control */ +#define PCI_EXP_DEV2_TIMEOUT_RANGE(x) ((x) & 0xf) /* Completion Timeout Ranges Supported */ +#define PCI_EXP_DEV2_TIMEOUT_VALUE(x) ((x) & 0xf) /* Completion Timeout Value */ +#define PCI_EXP_DEV2_TIMEOUT_DIS 0x0010 /* Completion Timeout Disable Supported */ +#define PCI_EXP_DEV2_ARI 0x0020 /* ARI Forwarding */ +#define PCI_EXP_DEVSTA2 0x2a /* Device Status */ +#define PCI_EXP_LNKCAP2 0x2c /* Link Capabilities */ +#define PCI_EXP_LNKCTL2 0x30 /* Link Control */ +#define PCI_EXP_LNKCTL2_SPEED(x) ((x) & 0xf) /* Target Link Speed */ +#define PCI_EXP_LNKCTL2_CMPLNC 0x0010 /* Enter Compliance */ +#define PCI_EXP_LNKCTL2_SPEED_DIS 0x0020 /* Hardware Autonomous Speed Disable */ +#define PCI_EXP_LNKCTL2_DEEMPHASIS(x) (((x) >> 6) & 1) /* Selectable De-emphasis */ +#define PCI_EXP_LNKCTL2_MARGIN(x) (((x) >> 7) & 7) /* Transmit Margin */ +#define PCI_EXP_LNKCTL2_MOD_CMPLNC 0x0400 /* Enter Modified Compliance */ +#define PCI_EXP_LNKCTL2_CMPLNC_SOS 0x0800 /* Compliance SOS */ +#define PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 1) /* Compliance De-emphasis */ +#define PCI_EXP_LNKSTA2 0x32 /* Link Status */ +#define PCI_EXP_LINKSTA2_DEEMPHASIS(x) ((x) & 1) /* Current De-emphasis Level */ +#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities */ +#define PCI_EXP_SLTCTL2 0x38 /* Slot Control */ +#define PCI_EXP_SLTSTA2 0x3a /* Slot Status */ /* MSI-X */ #define PCI_MSIX_ENABLE 0x8000 @@ -636,39 +643,39 @@ #define PCI_SSVID_DEVICE 6 /* Advanced Error Reporting */ -#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ -#define PCI_ERR_UNC_TRAIN 0x00000001 /* Undefined in PCIe rev1.1 & 2.0 spec */ -#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ -#define PCI_ERR_UNC_SDES 0x00000020 /* Surprise Down Error */ -#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ -#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ -#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ -#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ -#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ -#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ -#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ -#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ -#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ -#define PCI_ERR_UNC_ACS_VIOL 0x00200000 /* ACS Violation */ +#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ +#define PCI_ERR_UNC_TRAIN 0x00000001 /* Undefined in PCIe rev1.1 & 2.0 spec */ +#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ +#define PCI_ERR_UNC_SDES 0x00000020 /* Surprise Down Error */ +#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ +#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ +#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ +#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ +#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ +#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ +#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ +#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ +#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ +#define PCI_ERR_UNC_ACS_VIOL 0x00200000 /* ACS Violation */ #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ /* Same bits as above */ #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ /* Same bits as above */ #define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ -#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ -#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ -#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ -#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ -#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ -#define PCI_ERR_COR_REP_ANFE 0x00002000 /* Advisory Non-Fatal Error */ +#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ +#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ +#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ +#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ +#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ +#define PCI_ERR_COR_REP_ANFE 0x00002000 /* Advisory Non-Fatal Error */ #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ /* Same bits as above */ -#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ -#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ -#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ -#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ -#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ -#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ +#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ +#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ +#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ +#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ +#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ +#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ #define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ #define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ #define PCI_ERR_ROOT_STATUS 48 @@ -685,80 +692,80 @@ #define PCI_VC_RES_STATUS 26 /* Power Budgeting */ -#define PCI_PWR_DSR 4 /* Data Select Register */ -#define PCI_PWR_DATA 8 /* Data Register */ +#define PCI_PWR_DSR 4 /* Data Select Register */ +#define PCI_PWR_DATA 8 /* Data Register */ #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ -#define PCI_PWR_CAP 12 /* Capability */ -#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ +#define PCI_PWR_CAP 12 /* Capability */ +#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ /* Access Control Services */ -#define PCI_ACS_CAP 0x04 /* ACS Capability Register */ -#define PCI_ACS_CAP_VALID 0x0001 /* ACS Source Validation */ -#define PCI_ACS_CAP_BLOCK 0x0002 /* ACS Translation Blocking */ -#define PCI_ACS_CAP_REQ_RED 0x0004 /* ACS P2P Request Redirect */ -#define PCI_ACS_CAP_CMPLT_RED 0x0008 /* ACS P2P Completion Redirect */ -#define PCI_ACS_CAP_FORWARD 0x0010 /* ACS Upstream Forwarding */ -#define PCI_ACS_CAP_EGRESS 0x0020 /* ACS P2P Egress Control */ -#define PCI_ACS_CAP_TRANS 0x0040 /* ACS Direct Translated P2P */ -#define PCI_ACS_CAP_VECTOR(x) (((x) >> 8) & 0xff) /* Egress Control Vector Size */ -#define PCI_ACS_CTRL 0x06 /* ACS Control Register */ -#define PCI_ACS_CTRL_VALID 0x0001 /* ACS Source Validation Enable */ -#define PCI_ACS_CTRL_BLOCK 0x0002 /* ACS Translation Blocking Enable */ -#define PCI_ACS_CTRL_REQ_RED 0x0004 /* ACS P2P Request Redirect Enable */ -#define PCI_ACS_CTRL_CMPLT_RED 0x0008 /* ACS P2P Completion Redirect Enable */ -#define PCI_ACS_CTRL_FORWARD 0x0010 /* ACS Upstream Forwarding Enable */ -#define PCI_ACS_CTRL_EGRESS 0x0020 /* ACS P2P Egress Control Enable */ -#define PCI_ACS_CTRL_TRANS 0x0040 /* ACS Direct Translated P2P Enable */ -#define PCI_ACS_EGRESS_CTRL 0x08 /* Egress Control Vector */ +#define PCI_ACS_CAP 0x04 /* ACS Capability Register */ +#define PCI_ACS_CAP_VALID 0x0001 /* ACS Source Validation */ +#define PCI_ACS_CAP_BLOCK 0x0002 /* ACS Translation Blocking */ +#define PCI_ACS_CAP_REQ_RED 0x0004 /* ACS P2P Request Redirect */ +#define PCI_ACS_CAP_CMPLT_RED 0x0008 /* ACS P2P Completion Redirect */ +#define PCI_ACS_CAP_FORWARD 0x0010 /* ACS Upstream Forwarding */ +#define PCI_ACS_CAP_EGRESS 0x0020 /* ACS P2P Egress Control */ +#define PCI_ACS_CAP_TRANS 0x0040 /* ACS Direct Translated P2P */ +#define PCI_ACS_CAP_VECTOR(x) (((x) >> 8) & 0xff) /* Egress Control Vector Size */ +#define PCI_ACS_CTRL 0x06 /* ACS Control Register */ +#define PCI_ACS_CTRL_VALID 0x0001 /* ACS Source Validation Enable */ +#define PCI_ACS_CTRL_BLOCK 0x0002 /* ACS Translation Blocking Enable */ +#define PCI_ACS_CTRL_REQ_RED 0x0004 /* ACS P2P Request Redirect Enable */ +#define PCI_ACS_CTRL_CMPLT_RED 0x0008 /* ACS P2P Completion Redirect Enable */ +#define PCI_ACS_CTRL_FORWARD 0x0010 /* ACS Upstream Forwarding Enable */ +#define PCI_ACS_CTRL_EGRESS 0x0020 /* ACS P2P Egress Control Enable */ +#define PCI_ACS_CTRL_TRANS 0x0040 /* ACS Direct Translated P2P Enable */ +#define PCI_ACS_EGRESS_CTRL 0x08 /* Egress Control Vector */ /* Alternative Routing-ID Interpretation */ -#define PCI_ARI_CAP 0x04 /* ARI Capability Register */ -#define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ -#define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ -#define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ -#define PCI_ARI_CTRL 0x06 /* ARI Control Register */ -#define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ -#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ -#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ +#define PCI_ARI_CAP 0x04 /* ARI Capability Register */ +#define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ +#define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ +#define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ +#define PCI_ARI_CTRL 0x06 /* ARI Control Register */ +#define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ +#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ +#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ /* Address Translation Service */ -#define PCI_ATS_CAP 0x04 /* ATS Capability Register */ -#define PCI_ATS_CAP_IQD(x) ((x) & 0x1f) /* Invalidate Queue Depth */ -#define PCI_ATS_CTRL 0x06 /* ATS Control Register */ -#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ -#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ +#define PCI_ATS_CAP 0x04 /* ATS Capability Register */ +#define PCI_ATS_CAP_IQD(x) ((x) & 0x1f) /* Invalidate Queue Depth */ +#define PCI_ATS_CTRL 0x06 /* ATS Control Register */ +#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ +#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ /* Single Root I/O Virtualization */ -#define PCI_IOV_CAP 0x04 /* SR-IOV Capability Register */ -#define PCI_IOV_CAP_VFM 0x00000001 /* VF Migration Capable */ -#define PCI_IOV_CAP_IMN(x) ((x) >> 21) /* VF Migration Interrupt Message Number */ -#define PCI_IOV_CTRL 0x08 /* SR-IOV Control Register */ -#define PCI_IOV_CTRL_VFE 0x0001 /* VF Enable */ -#define PCI_IOV_CTRL_VFME 0x0002 /* VF Migration Enable */ -#define PCI_IOV_CTRL_VFMIE 0x0004 /* VF Migration Interrupt Enable */ -#define PCI_IOV_CTRL_MSE 0x0008 /* VF MSE */ -#define PCI_IOV_CTRL_ARI 0x0010 /* ARI Capable Hierarchy */ -#define PCI_IOV_STATUS 0x0a /* SR-IOV Status Register */ -#define PCI_IOV_STATUS_MS 0x0001 /* VF Migration Status */ -#define PCI_IOV_INITIALVF 0x0c /* Number of VFs that are initially associated */ -#define PCI_IOV_TOTALVF 0x0e /* Maximum number of VFs that could be associated */ -#define PCI_IOV_NUMVF 0x10 /* Number of VFs that are available */ -#define PCI_IOV_FDL 0x12 /* Function Dependency Link */ -#define PCI_IOV_OFFSET 0x14 /* First VF Offset */ -#define PCI_IOV_STRIDE 0x16 /* Routing ID offset from one VF to the next one */ -#define PCI_IOV_DID 0x1a /* VF Device ID */ -#define PCI_IOV_SUPPS 0x1c /* Supported Page Sizes */ -#define PCI_IOV_SYSPS 0x20 /* System Page Size */ -#define PCI_IOV_BAR_BASE 0x24 /* VF BAR0, VF BAR1, ... VF BAR5 */ +#define PCI_IOV_CAP 0x04 /* SR-IOV Capability Register */ +#define PCI_IOV_CAP_VFM 0x00000001 /* VF Migration Capable */ +#define PCI_IOV_CAP_IMN(x) ((x) >> 21) /* VF Migration Interrupt Message Number */ +#define PCI_IOV_CTRL 0x08 /* SR-IOV Control Register */ +#define PCI_IOV_CTRL_VFE 0x0001 /* VF Enable */ +#define PCI_IOV_CTRL_VFME 0x0002 /* VF Migration Enable */ +#define PCI_IOV_CTRL_VFMIE 0x0004 /* VF Migration Interrupt Enable */ +#define PCI_IOV_CTRL_MSE 0x0008 /* VF MSE */ +#define PCI_IOV_CTRL_ARI 0x0010 /* ARI Capable Hierarchy */ +#define PCI_IOV_STATUS 0x0a /* SR-IOV Status Register */ +#define PCI_IOV_STATUS_MS 0x0001 /* VF Migration Status */ +#define PCI_IOV_INITIALVF 0x0c /* Number of VFs that are initially associated */ +#define PCI_IOV_TOTALVF 0x0e /* Maximum number of VFs that could be associated */ +#define PCI_IOV_NUMVF 0x10 /* Number of VFs that are available */ +#define PCI_IOV_FDL 0x12 /* Function Dependency Link */ +#define PCI_IOV_OFFSET 0x14 /* First VF Offset */ +#define PCI_IOV_STRIDE 0x16 /* Routing ID offset from one VF to the next one */ +#define PCI_IOV_DID 0x1a /* VF Device ID */ +#define PCI_IOV_SUPPS 0x1c /* Supported Page Sizes */ +#define PCI_IOV_SYSPS 0x20 /* System Page Size */ +#define PCI_IOV_BAR_BASE 0x24 /* VF BAR0, VF BAR1, ... VF BAR5 */ #define PCI_IOV_NUM_BAR 6 /* Number of VF BARs */ -#define PCI_IOV_MSAO 0x3c /* VF Migration State Array Offset */ -#define PCI_IOV_MSA_BIR(x) ((x) & 7) /* VF Migration State BIR */ -#define PCI_IOV_MSA_OFFSET(x) ((x) & 0xfffffff8) /* VF Migration State Offset */ +#define PCI_IOV_MSAO 0x3c /* VF Migration State Array Offset */ +#define PCI_IOV_MSA_BIR(x) ((x) & 7) /* VF Migration State BIR */ +#define PCI_IOV_MSA_OFFSET(x) ((x) & 0xfffffff8) /* VF Migration State Offset */ /* * The PCI interface treats multi-function devices as independent @@ -812,7 +819,7 @@ #define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 /* video */ #define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 /* audio */ #define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 -#define PCI_CLASS_MULTIMEDIA_AUDIO_DEV 0x0403 /* HD audio */ +#define PCI_CLASS_MULTIMEDIA_AUDIO_DEV 0x0403 /* HD audio */ #define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 // values for the class_sub field for class_base = 0x05 (Memory Controller) @@ -845,14 +852,14 @@ #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 // values for the class_sub field for class_base = 0x08 (Base System Peripherals) -#define PCI_BASE_CLASS_SYSTEM 0x08 -#define PCI_CLASS_SYSTEM_PIC 0x0800 +#define PCI_BASE_CLASS_SYSTEM 0x08 // +#define PCI_CLASS_SYSTEM_PIC 0x0800 // #define PCI_CLASS_SYSTEM_PIC_IOAPIC 0x080010 -#define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020 // I/O APIC interrupt controller , 32 bye none-prefectable memory. +#define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020 // I/O APIC interrupt controller , 32 bye none-prefectable memory. #define PCI_CLASS_SYSTEM_DMA 0x0801 #define PCI_CLASS_SYSTEM_TIMER 0x0802 #define PCI_CLASS_SYSTEM_RTC 0x0803 -#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 // HotPlug Controller +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 // HotPlug Controller #define PCI_CLASS_SYSTEM_SDHCI 0x0805 #define PCI_CLASS_SYSTEM_OTHER 0x0880 @@ -883,14 +890,14 @@ // values for the class_sub field for class_base = 0x0c (serial bus controller) #define PCI_BASE_CLASS_SERIAL 0x0c #define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 /* FireWire (IEEE 1394) */ -#define PCI_CLASS_SERIAL_FIREWIRE_OHCI 0x0c10 +#define PCI_CLASS_SERIAL_FIREWIRE_OHCI 0x0c10 #define PCI_CLASS_SERIAL_ACCESS 0x0c01 #define PCI_CLASS_SERIAL_SSA 0x0c02 #define PCI_CLASS_SERIAL_USB 0x0c03 /* Universal Serial Bus */ -#define PCI_IF_UHCI 0x00 /* Universal Host Controller Interface */ -#define PCI_IF_OHCI 0x10 /* Open Host Controller Interface */ -#define PCI_IF_EHCI 0x20 /* Enhanced Host Controller Interface */ -#define PCI_IF_XHCI 0x30 /* Extensible Host Controller Interface */ +#define PCI_IF_UHCI 0x00 /* Universal Host Controller Interface */ +#define PCI_IF_OHCI 0x10 /* Open Host Controller Interface */ +#define PCI_IF_EHCI 0x20 /* Enhanced Host Controller Interface */ +#define PCI_IF_XHCI 0x30 /* Extensible Host Controller Interface */ #define PCI_CLASS_SERIAL_FIBER 0x0c04 #define PCI_CLASS_SERIAL_SMBUS 0x0c05 #define PCI_CLASS_SERIAL_INFINIBAND 0x0c06 @@ -934,13 +941,50 @@ #define PCI_CLASS_OTHERS 0xff /* Several ID's we need in the library */ -#define PCI_VENDOR_ID_APPLE 0x106b -#define PCI_VENDOR_ID_AMD 0x1022 -#define PCI_VENDOR_ID_ATI 0x1002 -#define PCI_VENDOR_ID_INTEL 0x8086 -#define PCI_VENDOR_ID_NVIDIA 0x10de -#define PCI_VENDOR_ID_REALTEK 0x10ec -#define PCI_VENDOR_ID_TEXAS_INSTRUMENTS 0x104c -#define PCI_VENDOR_ID_VIA 0x1106 +#define PCI_VENDOR_ID_LOGITECH 0x046d +#define PCI_VENDOR_ID_WACOM 0x056a +#define PCI_VENDOR_ID_COMPAQ 0x0e11 +#define PCI_VENDOR_ID_NCR 0x1000 +#define PCI_VENDOR_ID_ATI 0x1002 +#define PCI_VENDOR_ID_NS 0x100b +#define PCI_VENDOR_ID_TSENG 0x100c +#define PCI_VENDOR_ID_WEITEK 0x100e +#define PCI_VENDOR_ID_DEC 0x1011 +#define PCI_VENDOR_ID_CIRRUS 0x1013 +#define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_VENDOR_ID_AMD 0x1022 +#define PCI_VENDOR_ID_DELL 0x1028 +#define PCI_VENDOR_ID_MATROX 0x102B +#define PCI_VENDOR_ID_NEC 0x1033 +#define PCI_VENDOR_ID_FD 0x1036 +#define PCI_VENDOR_ID_SI 0x1039 +#define PCI_VENDOR_ID_HP 0x103c +#define PCI_VENDOR_ID_ASUS 0x1043 +#define PCI_VENDOR_ID_TI 0x104c // Texas Istruments +#define PCI_VENDOR_ID_SONY 0x104d +#define PCI_VENDOR_ID_HITACHI 0x1054 +#define PCI_VENDOR_ID_MOTOROLA 0x1057 +#define PCI_VENDOR_ID_APPLE 0x106b +#define PCI_VENDOR_ID_SUN 0x108e +#define PCI_VENDOR_ID_CMD 0x1095 +#define PCI_VENDOR_ID_NVIDIA 0x10de +#define PCI_VENDOR_ID_REALTEK 0x10ec +#define PCI_VENDOR_ID_VIA 0x1106 +#define PCI_VENDOR_ID_DLINK 0x1186 +#define PCI_VENDOR_ID_MARVELL 0x11ab +#define PCI_VENDOR_ID_NETGEAR 0x1385 +#define PCI_VENDOR_ID_IOMEGA 0x13ca +#define PCI_VENDOR_ID_SAMSUNG 0x144d +#define PCI_VENDOR_ID_GIGABYTE 0x1458 +#define PCI_VENDOR_ID_BROADCOM 0x14e4 +#define PCI_VENDOR_ID_ATHEROS 0x168c +#define PCI_VENDOR_ID_LINKSYS 0x1737 +#define PCI_VENDOR_ID_BELKIN 0x1799 +#define PCI_VENDOR_ID_LENOVO 0x17aa +#define PCI_VENDOR_ID_RALINK 0x1814 +#define PCI_VENDOR_ID_SITECOM 0x182d +#define PCI_VENDOR_ID_JMICRON 0x197B +#define PCI_VENDOR_ID_OCZ 0x1b85 +#define PCI_VENDOR_ID_INTEL 0x8086 #endif /* !__LIBSAIO_PCI_H */ Index: branches/ErmaC/Enoch/i386/libsaio/saio_types.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/saio_types.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/saio_types.h (revision 2323) @@ -70,8 +70,8 @@ typedef struct { char plist[IO_CONFIG_DATA_SIZE]; // buffer for plist - TagPtr dictionary; // buffer for xml dictionary - bool canOverride; // flag to mark a dictionary can be overriden + TagPtr dictionary; // buffer for xml dictionary + bool canOverride; // flag to mark a dictionary can be overriden } config_file_t; /* @@ -79,48 +79,50 @@ */ struct boot_drive_info { struct drive_params { - unsigned short buf_size; - unsigned short info_flags; - unsigned long phys_cyls; - unsigned long phys_heads; - unsigned long phys_spt; - unsigned long long phys_sectors; - unsigned short phys_nbps; - unsigned short dpte_offset; - unsigned short dpte_segment; - unsigned short key; - unsigned char path_len; - unsigned char reserved1; - unsigned short reserved2; - unsigned char bus_type[4]; - unsigned char interface_type[8]; - unsigned char interface_path[8]; - unsigned char dev_path[8]; - unsigned char reserved3; - unsigned char checksum; + unsigned short buf_size; + unsigned short info_flags; + unsigned long phys_cyls; + unsigned long phys_heads; + unsigned long phys_spt; + unsigned long long phys_sectors; + unsigned short phys_nbps; + unsigned short dpte_offset; + unsigned short dpte_segment; + unsigned short key; + unsigned char path_len; + unsigned char reserved1; + unsigned short reserved2; + unsigned char bus_type[4]; + unsigned char interface_type[8]; + unsigned char interface_path[8]; + unsigned char dev_path[8]; + unsigned char reserved3; + unsigned char checksum; } params; + struct drive_dpte { - unsigned short io_port_base; - unsigned short control_port_base; - unsigned char head_flags; - unsigned char vendor_info; - unsigned char irq : 4; - unsigned char irq_unused : 4; - unsigned char block_count; - unsigned char dma_channel : 4; - unsigned char dma_type : 4; - unsigned char pio_type : 4; - unsigned char pio_unused : 4; - unsigned short option_flags; - unsigned short reserved; - unsigned char revision; - unsigned char checksum; - } dpte; + unsigned short io_port_base; + unsigned short control_port_base; + unsigned char head_flags; + unsigned char vendor_info; + unsigned char irq : 4; + unsigned char irq_unused : 4; + unsigned char block_count; + unsigned char dma_channel : 4; + unsigned char dma_type : 4; + unsigned char pio_type : 4; + unsigned char pio_unused : 4; + unsigned short option_flags; + unsigned short reserved; + unsigned char revision; + unsigned char checksum; + } dpte; } __attribute__((packed)); typedef struct boot_drive_info boot_drive_info_t; struct driveInfo { boot_drive_info_t di; + int uses_ebios; int no_emulation; int biosdev; @@ -131,7 +133,8 @@ unsigned char data[16]; } FinderInfo; -struct BootVolume; + +struct BootVolume; typedef struct BootVolume * BVRef; typedef struct BootVolume * CICell; @@ -148,13 +151,13 @@ typedef void (*BVFree)(CICell ih); struct iob { - unsigned int i_flgs; /* see F_* below */ - unsigned int i_offset; /* seek byte offset in file */ - int i_filesize; /* size of file */ - char * i_buf; /* file load address */ + char * i_buf; /* file load address */ + unsigned int i_flgs; /* see F_* below */ + unsigned int i_offset; /* seek byte offset in file */ + int i_filesize; /* size of file */ }; -#define BPS 512 /* sector size of the device */ +#define BPS 512 /* sector size of the device */ #define F_READ 0x1 /* file opened for reading */ #define F_WRITE 0x2 /* file opened for writing */ #define F_ALLOC 0x4 /* buffer allocated */ @@ -166,39 +169,39 @@ struct dirstuff { char * dir_path; /* directory path */ long long dir_index; /* directory entry index */ - BVRef dir_bvr; /* volume reference */ + BVRef dir_bvr; /* volume reference */ }; #define BVSTRLEN 32 struct BootVolume { - BVRef next; /* list linkage pointer */ - int biosdev; /* BIOS device number */ - int type; /* device type (floppy, hd, network) */ - unsigned int flags; /* attribute flags */ - BVGetDescription description; /* BVGetDescription function */ - int part_no; /* partition number (1 based) */ - unsigned int part_boff; /* partition block offset */ - unsigned int part_type; /* partition type */ - unsigned int fs_boff; /* 1st block # of next read */ - unsigned int fs_byteoff; /* Byte offset for read within block */ - FSLoadFile fs_loadfile; /* FSLoadFile function */ - FSReadFile fs_readfile; /* FSReadFile function */ - FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */ - FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */ - FSGetUUID fs_getuuid; /* FSGetUUID function */ - unsigned int bps; /* bytes per sector for this device */ - char name[BVSTRLEN]; /* (name of partition) */ - char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */ - BVFree bv_free; /* BVFree function */ - uint32_t modTime; - char label[BVSTRLEN]; /* partition volume label */ - char altlabel[BVSTRLEN]; /* partition volume label */ - bool filtered; /* newFilteredBVChain() will set to TRUE */ - bool visible; /* will shown in the device list */ - char OSVersion[8]; - bool OSisServer; /* 1 = OS X server , 0 = OS X client */ - bool OSisInstaller; /* 1 = OS X Install partition / recover partition , 0 = OS X Install */ + BVRef next; /* list linkage pointer */ + int biosdev; /* BIOS device number */ + int type; /* device type (floppy, hd, network) */ + unsigned int flags; /* attribute flags */ + BVGetDescription description; /* BVGetDescription function */ + int part_no; /* partition number (1 based) */ + unsigned int part_boff; /* partition block offset */ + unsigned int part_type; /* partition type */ + unsigned int fs_boff; /* 1st block # of next read */ + unsigned int fs_byteoff; /* Byte offset for read within block */ + FSLoadFile fs_loadfile; /* FSLoadFile function */ + FSReadFile fs_readfile; /* FSReadFile function */ + FSGetDirEntry fs_getdirentry; /* FSGetDirEntry function */ + FSGetFileBlock fs_getfileblock; /* FSGetFileBlock function */ + FSGetUUID fs_getuuid; /* FSGetUUID function */ + unsigned int bps; /* bytes per sector for this device */ + char name[BVSTRLEN]; /* (name of partition) */ + char type_name[BVSTRLEN]; /* (type of partition, eg. Apple_HFS) */ + BVFree bv_free; /* BVFree function */ + uint32_t modTime; + char label[BVSTRLEN]; /* partition volume label */ + char altlabel[BVSTRLEN]; /* partition volume label */ + bool filtered; /* newFilteredBVChain() will set to TRUE */ + bool visible; /* will shown in the device list */ + char OSVersion[8]; + bool OSisServer; /* 1 = OS X server , 0 = OS X client */ + bool OSisInstaller; /* 1 = OS X Install partition / recover partition , 0 = OS X Install */ }; @@ -209,12 +212,13 @@ kBVFlagBootable = 0x08, kBVFlagEFISystem = 0x10, kBVFlagBooter = 0x20, - kBVFlagSystemVolume = 0x40 + kBVFlagSystemVolume = 0x40, + kBVFlagInstallVolume = 0x80 }; enum { kBIOSDevTypeFloppy = 0x00, - kBIOSDevTypeHardDrive = 0x80, + kBIOSDevTypeHardDrive = 0x80, kBIOSDevTypeNetwork = 0xE0, kBIOSDevUnitMask = 0x0F, kBIOSDevTypeMask = 0xF0, @@ -222,22 +226,28 @@ }; enum { - kPartitionTypeHFS = 0xAF, - kPartitionTypeHPFS = 0x07, - kPartitionTypeFAT16 = 0x06, - kPartitionTypeFAT32 = 0x0c, - kPartitionTypeEXT3 = 0x83, - kPartitionTypeBEFS = 0xEB, - kPartitionTypeFreeBSD = 0xa5, - kPartitionTypeOpenBSD = 0xa6 + //KPartitionTypeFAT12 = 0x01, // FAT12 + kPartitionTypeHPFS = 0x07, // Mac OS X + kPartitionTypeFAT16 = 0x06, // FAT16 + kPartitionTypeFAT32 = 0x0C, // FAT32 + kPartitionTypeEXT3 = 0x83, // Linux + //kPartitionTypeOSXBoot = 0xAB, // Mac OS X Boot partition + kPartitionTypeFreeBSD = 0xA5, // FreeBSD + kPartitionTypeOpenBSD = 0xA6, // OpenBSD + //kPartitionTypeNeXTSTEP = 0xA7 // NeXTSTEP + //kPartitionTypeNetBSD = 0xA9 // NetBSD + kPartitionTypeHFS = 0xAF, // Mac OS X + //kPartitionTypeSolaris = 0xBE, // Solaris + kPartitionTypeBEFS = 0xEB, // BeOS BFS + //kPartitionTypeBeOS = 0xEB, // BeOS BFS + //kPartitionTypeSkyOS = 0xEC, // SkyOS }; //#define BIOS_DEV_TYPE(d) ((d) & kBIOSDevTypeMask) #define BIOS_DEV_UNIT(bvr) ((bvr)->biosdev - (bvr)->type) -/* - * KernBootStruct device types. - */ +// KernBootStruct device types. + enum { DEV_SD = 0, DEV_HD = 1, @@ -268,7 +278,7 @@ }; //gBootFileType_t; enum { - kCursorTypeHidden = 0x0100, + kCursorTypeHidden = 0x0100, kCursorTypeUnderline = 0x0607 }; Index: branches/ErmaC/Enoch/i386/libsaio/msdos.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/msdos.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/msdos.c (revision 2323) @@ -152,14 +152,20 @@ } buf=malloc (512); + if (!buf) + { + return -1; + } + /* - * Read the boot sector of the filesystem, and then check the - * boot signature. If not a dos boot sector then error out. - * - * NOTE: 2048 is a maximum sector size in current... - */ - Seek(ih, 0); - Read(ih, (long)buf, 512); + * Read the boot sector of the filesystem, and then check the + * boot signature. If not a dos boot sector then error out. + * + * NOTE: 2048 is a maximum sector size in current... + */ + + Seek(ih, 0); + Read(ih, (long)buf, 512); bsp = (union bootsector *)buf; b33 = (struct bpb33 *)bsp->bs33.bsBPB; @@ -167,20 +173,24 @@ b710 = (struct bpb710 *)bsp->bs710.bsBPB; - /* We only work with 512, 1024, and 2048 byte sectors */ - msdosbps = OSSwapLittleToHostInt16(b33->bpbBytesPerSec); - if ((msdosbps < 0x200) || (msdosbps & (msdosbps - 1)) || (msdosbps > 0x800)) + /* We only work with 512, 1024, and 2048 byte sectors */ + msdosbps = OSSwapLittleToHostInt16(b33->bpbBytesPerSec); + if ((msdosbps < 0x200) || (msdosbps & (msdosbps - 1)) || (msdosbps > 0x800)) { free (buf); return -1; } - /* Check to make sure valid sectors per cluster */ - spc = b33->bpbSecPerClust; - if ((spc == 0 ) || (spc & (spc - 1))) + /* Check to make sure valid sectors per cluster */ + spc = b33->bpbSecPerClust; + if ((spc == 0 ) || (spc & (spc - 1))) + { + free (buf); return -1; - - if (OSSwapLittleToHostInt16(b50->bpbRootDirEnts) == 0) { /* It's FAT32 */ + } + if (OSSwapLittleToHostInt16(b50->bpbRootDirEnts) == 0) + { + /* It's FAT32 */ if (memcmp(((struct extboot *)bsp->bs710.bsExt)->exFileSysType, "FAT32 ", 8)) { free (buf); @@ -234,6 +244,10 @@ char *cacheBuffer; cacheBuffer = malloc(MSDOS_CACHE_BLOCKSIZE); + if (!cacheBuffer) + { + return -1; + } CacheRead(ih, cacheBuffer, sectorOffset, MSDOS_CACHE_BLOCKSIZE, true); bcopy(cacheBuffer + relOffset, buf, size); free(cacheBuffer); @@ -294,7 +308,7 @@ readOffset += ((uint64_t)*cluster * (uint64_t)msdosfatbits) / 8; /* Read one sector of the FAT */ - readSector(ih, readOffset, tmpbuf, 4); + if (readSector(ih, readOffset, tmpbuf, 4) != 0) return 0; switch (msdosfatbits) { case 32: @@ -382,14 +396,14 @@ st->vfatchecksum = 0; st->vfatnumber = 0; st->nument++; - if ((!st->root16 &&st->nument * sizeof (struct direntry)>=msdosclustersize) - || (st->root16 &&st->nument * sizeof (struct direntry)>=msdosbps)) + if (((int)(!st->root16 &&st->nument * sizeof (struct direntry))>=msdosclustersize) + || ((int)(st->root16 &&st->nument * sizeof (struct direntry))>=msdosbps)) st->nument = 0; return dirp; } st->nument++; - if ((!st->root16 &&st->nument * sizeof (struct direntry)>=msdosclustersize) - || (st->root16 &&st->nument * sizeof (struct direntry)>=msdosbps)) + if (((int)(!st->root16 &&st->nument * sizeof (struct direntry))>=msdosclustersize) + || ((int)(st->root16 &&st->nument * sizeof (struct direntry))>=msdosbps)) st->nument = 0; } } @@ -649,10 +663,19 @@ st = (struct msdosdirstate *)(long) *dirIndex; if (!st) { - st=malloc (sizeof (*st)); + st=malloc (sizeof (struct msdosdirstate)); + if (!st) + { + return -1; + } if (dirPath[0]) { uint8_t *buf=malloc(msdosclustersize); + if (!buf) + { + free (st); + return -1; + } dirp = getdirpfrompath (ih, dirPath, buf); if (!dirp || !(dirp->deAttributes & ATTR_DIRECTORY)) { @@ -685,6 +708,12 @@ int i; for (i=0;vfatname[i];i++); *name = malloc (256); + if (!*name) + { + free (st->buf); + free (st); + return -1; + } utf_encodestr(vfatname, i, (u_int8_t *)*name, 255, OSLittleEndian ); } else @@ -692,6 +721,12 @@ int i, j, k; uint16_t tmp[13]; *name = malloc (26); + if (!*name) + { + free (st->buf); + free (st); + return -1; + } for (i=7;i>=0;i--) if (dirp->deName[i]!=' ') break; @@ -739,7 +774,7 @@ int toread, wastoread; char *ptr = (char *)base; struct direntry *dirp; - int i; + uint64_t i; char devStr[12]; if (MSDOSInitPartition (ih)<0) @@ -747,6 +782,10 @@ if (filePath[0] == '/') filePath++; buf = malloc(msdosclustersize); + if (!buf) + { + return -1; + } dirp = getdirpfrompath (ih, filePath, buf); if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY)) @@ -759,7 +798,10 @@ 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; wastoread=toread; - bcopy (buf+(offset%msdosclustersize),ptr,MIN(msdosclustersize-(offset%msdosclustersize), toread)); + bcopy (buf+(offset%msdosclustersize),ptr,MIN((msdosclustersize-(offset%msdosclustersize)),(unsigned)toread)); ptr+=msdosclustersize-(offset%msdosclustersize); toread-=msdosclustersize-(offset%msdosclustersize); while (toread>0 && msdosreadcluster (ih, (uint8_t *)ptr, MIN(msdosclustersize,toread), &cluster)) @@ -778,8 +820,10 @@ } getDeviceDescription(ih, devStr); +/* verbose("Read FAT%d file: [%s/%s] %d bytes.\n", msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread); +*/ free (buf); if (toread<0) return wastoread; @@ -798,6 +842,10 @@ if (filePath[0] == '/') filePath++; buf = malloc(msdosclustersize); + if (!buf) + { + return -1; + } dirp = getdirpfrompath (ih, filePath, buf); if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY)) { @@ -847,21 +895,21 @@ static void fixLabel(uint8_t *label, char *str, long strMaxLen) { - int i, len; - uint16_t labelucs[13]; - //unsigned char labelUTF8[LABEL_LENGTH*3]; + int i, len; + uint16_t labelucs[13]; + //unsigned char labelUTF8[LABEL_LENGTH*3]; - /* Convert leading 0x05 to 0xE5 for multibyte languages like Japanese */ - if (label[0] == 0x05) - label[0] = 0xE5; + /* Convert leading 0x05 to 0xE5 for multibyte languages like Japanese */ + if (label[0] == 0x05) + label[0] = 0xE5; - /* Remove any trailing spaces */ - for (i=LABEL_LENGTH-1; i>=0; --i) { - if (label[i] == ' ') + /* Remove any trailing spaces */ + for (i=LABEL_LENGTH-1; i>=0; --i) { + if (label[i] == ' ') label[i] = 0; - else - break; - } + else + break; + } labelucs[i++]=0; len=i; for (;i>=0;--i) @@ -874,8 +922,8 @@ void MSDOSGetDescription(CICell ih, char *str, long strMaxLen) { - struct direntry *dirp; - uint8_t label[LABEL_LENGTH+1]; + struct direntry *dirp; + uint8_t label[LABEL_LENGTH+1]; uint16_t vfatlabel[WIN_MAXLEN+2*WIN_CHARS]; struct msdosdirstate st; int labelfound = 0; @@ -885,11 +933,15 @@ str[0]=0; return; } - + label[0] = '\0'; initRoot (&st); st.buf = malloc(msdosclustersize); + if (!st.buf) + { + return; + } while ((dirp = getnextdirent (ih, vfatlabel, &st))) if (dirp->deAttributes & ATTR_VOLUME) { strncpy((char *)label, (char *)dirp->deName, LABEL_LENGTH); @@ -908,33 +960,46 @@ else if (labelfound) fixLabel(label, str, strMaxLen); - /* else look in the boot blocks */ - if (!labelfound || str[0] == '\0') { + /* else look in the boot blocks */ + if (!labelfound || str[0] == '\0') + { char *buf = malloc (512); + if (!buf) + { + return; + } union bootsector *bsp = (union bootsector *)buf; Seek(ih, 0); Read(ih, (long)buf, 512); - if (msdosfatbits == 32) { /* It's FAT32 */ - strncpy((char *)label, (char *)((struct extboot *)bsp->bs710.bsExt)->exVolumeLabel, LABEL_LENGTH); - } - else if (msdosfatbits == 16) { - strncpy((char *)label, (char *)((struct extboot *)bsp->bs50.bsExt)->exVolumeLabel, LABEL_LENGTH); - } + if (msdosfatbits == 32) + { + /* It's FAT32 */ + strncpy((char *)label, (char *)((struct extboot *)bsp->bs710.bsExt)->exVolumeLabel, LABEL_LENGTH); + } + else if (msdosfatbits == 16) + { + strncpy((char *)label, (char *)((struct extboot *)bsp->bs50.bsExt)->exVolumeLabel, LABEL_LENGTH); + } free (buf); fixLabel(label, str, strMaxLen); - } + } - return; + return; } long MSDOSGetUUID(CICell ih, char *uuidStr) { char *buf = malloc (512); + if (!buf) + { + return -1; + } union bootsector *bsp = (union bootsector *)buf; if (MSDOSInitPartition (ih)<0) { + free (buf); return -1; } bzero (uuidStr, 16); Index: branches/ErmaC/Enoch/i386/libsaio/md5c.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/md5c.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/md5c.c (revision 2323) @@ -1,6 +1,34 @@ /* - * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +/* + * MD5.C - RSA Data Security, Inc., MD5 message-digest algorithm + * * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All * rights reserved. * @@ -35,40 +63,50 @@ #define Encode memcpy #define Decode memcpy +//------------------------------------------------------------------------------ + static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -/* F, G, H and I are basic MD5 functions. */ + +//------------------------------------------------------------------------------ +// F, G, H and I are basic MD5 functions. + #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) -/* ROTATE_LEFT rotates x left n bits. */ +//------------------------------------------------------------------------------ +// ROTATE_LEFT rotates x left n bits. + #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) -/* - * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. - * Rotation is separate from addition to prevent recomputation. - */ +//------------------------------------------------------------------------------ +// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +// Rotation is separate from addition to prevent recomputation. + #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } + #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } + #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } + #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ @@ -79,14 +117,12 @@ /* MD5 initialization. Begins an MD5 operation, writing a new context. */ -void -MD5Init (context) +void MD5Init (context) MD5_CTX *context; { - context->count[0] = context->count[1] = 0; - /* Load magic initialization constants. */ + // Load magic initialization constants. context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; @@ -115,15 +151,19 @@ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((u_int32_t)inputLen << 3)) - < ((u_int32_t)inputLen << 3)) + if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) + { context->count[1]++; + } + context->count[1] += ((u_int32_t)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ - if (inputLen >= partLen) { + + if (inputLen >= partLen) + { memcpy((void *)&context->buffer[index], (const void *)input, partLen); MD5Transform (context->state, context->buffer); @@ -227,7 +267,7 @@ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (d, a, b, c, x[10], S22, 0x02441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ @@ -255,7 +295,7 @@ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (b, c, d, a, x[ 6], S34, 0x04881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ Index: branches/ErmaC/Enoch/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/fake_efi.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/fake_efi.c (revision 2323) @@ -73,7 +73,7 @@ */ /* Identify ourselves as the EFI firmware vendor */ -static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','2', 0}; +static EFI_CHAR16 const FIRMWARE_VENDOR[] = { 'E', 'n', 'o', 'c', 'h', '\0' }; static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */ // Bungo @@ -550,8 +550,7 @@ void setupEfiDeviceTree(void) { - // Bungo - // EFI_CHAR8* ret = 0; + // EFI_CHAR8* ret = 0; Bungo: not used EFI_CHAR16* ret16 = 0; size_t len = 0; Node *node; @@ -634,11 +633,7 @@ DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, (EFI_UINT32*) ret); } */ - - if (Platform.UUID) - { DT__AddProperty(efiPlatformNode, SYSTEM_ID_PROP, UUID_LEN, Platform.UUID); - } // // Export SystemSerialNumber if present @@ -790,7 +785,7 @@ } memcpy(tableAddress, (void *)origeps->dmi.tableAddress, origeps->dmi.tableLength); - DT__AddProperty(node, "SMBIOS", origeps->dmi.tableLength, tableAddress); + DT__AddProperty(node, "SMBIOS-ORIG", origeps->dmi.tableLength, tableAddress); // Bungo: changed from SMBIOS to SMBIOS-ORIG to differentiate } /* Index: branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/smbios_getters.c (revision 2323) @@ -67,10 +67,8 @@ bool getSMBOemProcessorBusSpeed(returnType *value) { - if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) // Intel - { - switch (Platform.CPU.Family) - { + if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) { // Intel + switch (Platform.CPU.Family) { case 0x06: { switch (Platform.CPU.Model) @@ -113,7 +111,7 @@ did &= 0xFF00; if(vid == 0x8086 && did >= 0x2C00) - nhm_bus = possible_nhm_bus[i]; + nhm_bus = possible_nhm_bus[i]; } unsigned long qpimult, qpibusspeed; @@ -143,12 +141,10 @@ uint16_t simpleGetSMBOemProcessorType(void) { - if (Platform.CPU.NoCores >= 4) - { + if (Platform.CPU.NoCores >= 4) { return 0x0501; // Quad-Core Xeon } - else if (Platform.CPU.NoCores == 1) - { + else if (Platform.CPU.NoCores == 1) { return 0x0201; // Core Solo }; @@ -157,7 +153,7 @@ bool getSMBOemProcessorType(returnType *value) { - static bool done = false; + static bool done = false; value->word = simpleGetSMBOemProcessorType(); @@ -168,89 +164,192 @@ verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, (uint32_t)Platform.CPU.Family, (uint32_t)Platform.CPU.Model); done = true; } - - switch (Platform.CPU.Family) - { + // Bungo: fixes Oem Processor Type - better matching IMHO + switch (Platform.CPU.Family) { case 0x06: { switch (Platform.CPU.Model) { - case CPU_MODEL_PENTIUM_M: - case CPU_MODEL_DOTHAN: // Intel Pentium M - case CPU_MODEL_YONAH: // Intel Mobile Core Solo, Duo - case CPU_MODEL_MEROM: // Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx - case CPU_MODEL_PENRYN: // Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx - case CPU_MODEL_ATOM: // Intel Atom (45nm) + + case CPU_MODEL_DOTHAN: // 0x0D - Intel Pentium M model D + value->word = 0x101; return true; - case CPU_MODEL_NEHALEM: // Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) - case CPU_MODEL_WESTMERE: // Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core - case CPU_MODEL_WESTMERE_EX: // Intel Xeon E7 - case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5-xxxx LGA2011 (32nm) + case CPU_MODEL_YONAH: // 0x0E - Intel Mobile Core Solo, Duo + case CPU_MODEL_CELERON: + value->word = 0x201; + return true; + + case CPU_MODEL_XEON_MP: // 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm + value->word = 0x401; + return true; + + case CPU_MODEL_MEROM: // 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx + case CPU_MODEL_PENRYN: // 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x0501; // Xeon + value->word = 0x402; // Xeon } + case CPU_MODEL_PENTIUM_M: // 0x09 - Banias + case CPU_MODEL_LINCROFT: // 0x27 - Intel Atom, "Lincroft", 45nm + case CPU_MODEL_ATOM: // 0x1C - Intel Atom (45nm) + return true; + + case CPU_MODEL_NEHALEM_EX: // 0x2E - Nehalem-ex, "Beckton", 45nm + case CPU_MODEL_NEHALEM: // 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) + if (strstr(Platform.CPU.BrandString, "Xeon(R)")) + { + value->word = 0x501; // Xeon + } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x0701; // Core i7 + value->word = 0x701; // Core i7 } return true; - case CPU_MODEL_FIELDS: // Intel Core i5, i7, Xeon X34xx LGA1156 (45nm) + case CPU_MODEL_FIELDS: // 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm) if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x501;// Xeon + value->word = 0x501; // Lynnfiled Quad-Core Xeon } + if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) + { + value->word = 0x701; // Core i7 + } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { value->word = 0x601; // Core i5 } + return true; + + case CPU_MODEL_DALES: // 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale) + if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) + { + value->word = 0x901; // Core i3 + } + if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) + { + value->word = 0x602; // Core i5 + } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x701; // Core i7 + value->word = 0x702; // Core i7 } - + if (Platform.CPU.NoCores <= 2) + { + value->word = 0x602; // Core i5 + } return true; - case CPU_MODEL_DALES: + case CPU_MODEL_DALES_32NM: // 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale) + if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) + { + value->word = 0x901; // Core i3 + } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x601; // Core i5 + value->word = 0x601; // Core i5 } - else + if(strstr(Platform.CPU.BrandString, "Core(TM) i5 CPU M 540")) { - value->word = 0x0701; // Core i7 + value->word = 0x602; // Core i5 } + if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) + { + value->word = 0x701; // Core i7 + } + if (Platform.CPU.NoCores <= 2) + { + value->word = 0x602; // Core i5 + } return true; - case CPU_MODEL_SANDYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (32nm) - case CPU_MODEL_IVYBRIDGE: // Intel Core i3, i5, i7 LGA1155 (22nm) - case CPU_MODEL_IVYBRIDGE_XEON: - case CPU_MODEL_DALES_32NM: // Intel Core i3, i5 LGA1156 (32nm) - case CPU_MODEL_HASWELL: - case CPU_MODEL_HASWELL_MB: - case CPU_MODEL_HASWELL_ULT: - case CPU_MODEL_CRYSTALWELL: + case CPU_MODEL_WESTMERE: // 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core + case CPU_MODEL_WESTMERE_EX: // 0x2F - Intel Xeon E7 if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x0501; // Xeon + value->word = 0x501; // Xeon } + if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) + { + value->word = 0x701; // Core i7 + } + return true; + + case CPU_MODEL_JAKETOWN: // 0x2D - Intel Core i7, Xeon E5-xxxx LGA2011 (32nm) + case CPU_MODEL_SANDYBRIDGE: // 0x2A - Intel Core i3, i5, i7 LGA1155 (32nm) + if (strstr(Platform.CPU.BrandString, "Xeon(R)")) + { + value->word = 0x501; // Xeon + } if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { - value->word = 0x901; // Core i3 + value->word = 0x903; // Core i3 } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x601; // Core i5 + value->word = 0x603; // Core i5 } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x0701; // Core i7 + value->word = 0x703; // Core i7 } + if (Platform.CPU.NoCores <= 2) + { + value->word = 0x603; // Core i5 + } return true; + case CPU_MODEL_IVYBRIDGE: // 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm) + if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) + { + value->word = 0x903; // Core i3 - Apple doesn't use it + } + if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) + { + value->word = 0x604; // Core i5 + } + if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) + { + value->word = 0x704; // Core i7 + } + if (Platform.CPU.NoCores <= 2) + { + value->word = 0x604; // Core i5 + } + return true; + case CPU_MODEL_IVYBRIDGE_XEON: // 0x3E - + value->word = 0xA01; + return true; + + case CPU_MODEL_HASWELL: // 0x3C - + case CPU_MODEL_HASWELL_MB: // 0x3F - + case CPU_MODEL_HASWELL_ULT: // 0x45 - + case CPU_MODEL_CRYSTALWELL: // 0x46 + if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) + { + value->word = 0x905; // Core i3 - Apple doesn't use it + } + if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) + { + value->word = 0x605; // Core i5 + } + if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) + { + value->word = 0x705; // Core i7 + } + if (Platform.CPU.NoCores <= 2) + { + value->word = 0x605; // Core i5 + } + return true; + + case 0x15: // EP80579 integrated processor + value->word = 0x301; // + return true; + + case 0x13: // Core i5, Xeon MP, "Havendale", "Auburndale", 45nm case 0x19: // Intel Core i5 650 @3.20 Ghz value->word = 0x601; // Core i5 return true; @@ -259,7 +358,7 @@ } } default: - break; + break; } } @@ -403,17 +502,16 @@ SMBEntryPoint *getAddressOfSmbiosTable(void) { SMBEntryPoint *smbios; - /* + /* * The logic is to start at 0xf0000 and end at 0xfffff iterating 16 bytes at a time looking * for the SMBIOS entry-point structure anchor (literal ASCII "_SM_"). */ smbios = (SMBEntryPoint*)SMBIOS_RANGE_START; while (smbios <= (SMBEntryPoint *)SMBIOS_RANGE_END) { - if (COMPARE_DWORD(smbios->anchor, SMTAG) && + if (COMPARE_DWORD(smbios->anchor, SMTAG) && COMPARE_DWORD(smbios->dmi.anchor, DMITAG) && smbios->dmi.anchor[4] == DMITAG[4] && - checksum8(smbios, sizeof(SMBEntryPoint)) == 0) - { + checksum8(smbios, sizeof(SMBEntryPoint)) == 0) { return smbios; } smbios = (SMBEntryPoint*)(((char*)smbios) + 16); Index: branches/ErmaC/Enoch/i386/libsaio/saio_internal.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/saio_internal.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsaio/saio_internal.h (revision 2323) @@ -218,7 +218,7 @@ unsigned int byteoff, unsigned int byteCount, void * buffer ); -/* Base64-decode.c */ +// Base64-decode.c char *BASE64Decode(const char* src, int in_len, int* out_len); #endif /* !__LIBSAIO_SAIO_INTERNAL_H */ Index: branches/ErmaC/Enoch/i386/boot0/boot0.s =================================================================== --- branches/ErmaC/Enoch/i386/boot0/boot0.s (revision 2322) +++ branches/ErmaC/Enoch/i386/boot0/boot0.s (revision 2323) @@ -60,6 +60,11 @@ VERBOSE EQU CONFIG_BOOT0_VERBOSE ; +; Set to 1 to enable unstretch mode +; +UNSTRETCH EQU CONFIG_BOOT0_UNSTRETCH + +; ; Various constants. ; kBoot0Segment EQU 0x0000 @@ -230,6 +235,10 @@ call print_hex %endif +%if UNSTRETCH + call disable_scaler +%endif + ; ; Since this code may not always reside in the MBR, always start by ; loading the MBR to kMBRBuffer and LBA1 to kGPTBuffer. @@ -473,6 +482,7 @@ jmp SHORT initBootLoader .gpt_continue: + add si, bx ; advance SI to next partition entry loop .gpt_loop ; loop through all partition entries @@ -535,7 +545,9 @@ cmp WORD [di + kSectorBytes - 2], kBootSignature .exit: + popa + ret @@ -617,7 +629,7 @@ ; DS:SI = pointer to Disk Address Packet ; ; Returns: - ; AH = return status (sucess is 0) + ; AH = return status (success is 0) ; carry = 0 success ; 1 error ; @@ -755,14 +767,30 @@ popa ret %endif ;DEBUG - - + +%if UNSTRETCH ;-------------------------------------------------------------------------- +; Disable On-Chip Scaling for nVidia Cards +; +disable_scaler: + mov ax,4F14h ;VESA VBE OEM function + mov bl,2 ;Subfunction 02 = Set Panel Expansion/Centering + mov bh,1 ;00 = Return Current Setting, 01 = Set Centering/Expansion + mov cx,0001h ;Exp. mode: 00 = Scaled, 01 = Centered 1:1, 02 = Left Corner 1:1 + int 10h ;call VGA/VBE service + LogString(nv_scaler_str) + ret +%endif +;-------------------------------------------------------------------------- ; NULL terminated strings. ; log_title_str db 10, 13, 'boot0: ', 0 boot_error_str db 'error', 0 +%if UNSTRETCH +nv_scaler_str db 'Unstretch', 0 +%endif ;DEBUG + %if VERBOSE gpt_str db 'GPT', 0 test_str db 'test', 0 Index: branches/ErmaC/Enoch/i386/boot0/boot0hfs.s =================================================================== --- branches/ErmaC/Enoch/i386/boot0/boot0hfs.s (revision 2322) +++ branches/ErmaC/Enoch/i386/boot0/boot0hfs.s (revision 2323) @@ -60,6 +60,11 @@ VERBOSE EQU CONFIG_BOOT0_VERBOSE ; +; Set to 1 to enable unstretch mode +; +UNSTRETCH EQU CONFIG_BOOT0_UNSTRETCH + +; ; Various constants. ; kBoot0Segment EQU 0x0000 @@ -230,6 +235,10 @@ call print_hex %endif +%if UNSTRETCH + call disable_scaler +%endif + ; ; Since this code may not always reside in the MBR, always start by ; loading the MBR to kMBRBuffer and LBA1 to kGPTBuffer. @@ -619,7 +628,7 @@ ; DS:SI = pointer to Disk Address Packet ; ; Returns: - ; AH = return status (sucess is 0) + ; AH = return status (success is 0) ; carry = 0 success ; 1 error ; @@ -758,13 +767,29 @@ ret %endif ;DEBUG - +%if UNSTRETCH ;-------------------------------------------------------------------------- +; Disable On-Chip Scaling for nVidia Cards +; +disable_scaler: + mov ax,4F14h ;VESA VBE OEM function + mov bl,2 ;Subfunction 02 = Set Panel Expansion/Centering + mov bh,1 ;00 = Return Current Setting, 01 = Set Centering/Expansion + mov cx,0001h ;Exp. mode: 00 = Scaled, 01 = Centered 1:1, 02 = Left Corner 1:1 + int 10h ;call VGA/VBE service + LogString(nv_scaler_str) + ret +%endif +;-------------------------------------------------------------------------- ; NULL terminated strings. ; log_title_str db 10, 13, 'boot0: ', 0 boot_error_str db 'error', 0 +%if UNSTRETCH +nv_scaler_str db 'Unstretch', 0 +%endif ;DEBUG + %if VERBOSE gpt_str db 'GPT', 0 test_str db 'test', 0 Index: branches/ErmaC/Enoch/i386/boot0/Cconfig =================================================================== --- branches/ErmaC/Enoch/i386/boot0/Cconfig (revision 2322) +++ branches/ErmaC/Enoch/i386/boot0/Cconfig (revision 2323) @@ -18,3 +18,12 @@ boot0 will print out status updates as it executes to notify the user of progress in the initial boot sequence. When in doubt, say "Y". + +config BOOT0_UNSTRETCH + bool "boot0 unstretch support" + default n + help + Say Y here if you want your Chameleon Boot Screen to be + unstretched. Requires a nVidia card, and a digital LCD + connected via DVI. + When in doubt, say "Y". Index: branches/ErmaC/Enoch/i386/include/mach/mach.h =================================================================== --- branches/ErmaC/Enoch/i386/include/mach/mach.h (revision 2322) +++ branches/ErmaC/Enoch/i386/include/mach/mach.h (revision 2323) @@ -49,9 +49,7 @@ * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. - */ - -/* + * * Includes all the types that a normal user * of Mach programs should need */ Index: branches/ErmaC/Enoch/i386/boot2/picopng.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/picopng.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/picopng.c (revision 2323) @@ -60,14 +60,21 @@ void png_alloc_remove_node(png_alloc_node_t *node) { - if (node->prev) + if (!node) { + return; + } + if (node->prev) { node->prev->next = node->next; - if (node->next) + } + if (node->next) { node->next->prev = node->prev; - if (node == png_alloc_head) + } + if (node == png_alloc_head) { png_alloc_head = node->next; - if (node == png_alloc_tail) + } + if (node == png_alloc_tail) { png_alloc_tail = node->prev; + } node->prev = node->next = node->addr = NULL; free(node); } @@ -81,25 +88,37 @@ void *png_alloc_realloc(void *addr, size_t size) { - void *new_addr; - if (!addr) + void *new_addr = NULL; + if (!addr) { return png_alloc_malloc(size); - new_addr = realloc(addr, size); - if (new_addr != addr) { - png_alloc_node_t *old_node; - old_node = png_alloc_find_node(addr); - png_alloc_remove_node(old_node); - png_alloc_add_node(new_addr, size); } + + png_alloc_node_t *old_node; + old_node = png_alloc_find_node(addr); + + if (old_node) + { + new_addr = realloc(addr, size); + if (new_addr && (new_addr != addr)) + { + png_alloc_remove_node(old_node); + png_alloc_add_node(new_addr, size); + } + } + return new_addr; } void png_alloc_free(void *addr) { + if (!addr) { + return; + } + png_alloc_node_t *node = png_alloc_find_node(addr); - if (!node) - return; - png_alloc_remove_node(node); + if (node) { + png_alloc_remove_node(node); + } free(addr); } @@ -157,9 +176,15 @@ vector32_t *vector32_new(size_t size, uint32_t value) { vector32_t *p = png_alloc_malloc(sizeof (vector32_t)); + if (!p) { + return NULL; + } vector32_init(p); - if (size && !vector32_resizev(p, size, value)) + if (size && !vector32_resizev(p, size, value)) { + vector32_cleanup(p); + png_alloc_free(p); return NULL; + } return p; } @@ -211,9 +236,17 @@ vector8_t *vector8_new(size_t size, uint8_t value) { vector8_t *p = png_alloc_malloc(sizeof (vector8_t)); + if(!p) + { + return NULL; + } vector8_init(p); if (size && !vector8_resizev(p, size, value)) + { + vector8_cleanup(p); + png_alloc_free(p); return NULL; + } return p; } @@ -221,6 +254,10 @@ { vector8_t *q = vector8_new(p->size, 0); uint32_t n; + if (!q) + { + return NULL; + } for (n = 0; n < q->size; n++) q->data[n] = p->data[n]; return q; @@ -229,13 +266,13 @@ /*************************************************************************************************/ const uint32_t LENBASE[29] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, - 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 }; + 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 }; const uint32_t LENEXTRA[29] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, - 4, 5, 5, 5, 5, 0 }; + 4, 5, 5, 5, 5, 0 }; const uint32_t DISTBASE[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, - 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }; + 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }; const uint32_t DISTEXTRA[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, - 10, 10, 11, 11, 12, 12, 13, 13 }; + 10, 10, 11, 11, 12, 12, 13, 13 }; // code length code lengths const uint32_t CLCL[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; @@ -250,6 +287,10 @@ HuffmanTree *HuffmanTree_new() { HuffmanTree *tree = png_alloc_malloc(sizeof (HuffmanTree)); + if (!tree) + { + return NULL; + } tree->tree2d = NULL; return tree; } @@ -262,6 +303,10 @@ tree1d = vector32_new(numcodes, 0); blcount = vector32_new(maxbitlen + 1, 0); nextcode = vector32_new(maxbitlen + 1, 0); + if (!tree1d || !blcount || !nextcode || !nextcode->data) + { + goto error; + } for (bits = 0; bits < numcodes; bits++) blcount->data[bitlen->data[bits]]++; // count number of instances of each code length for (bits = 1; bits <= maxbitlen; bits++) @@ -289,6 +334,23 @@ treepos = tree2d->data[2 * treepos + bit] - numcodes; } return 0; +error: + if (tree1d) + { + vector32_cleanup(tree1d); + png_alloc_free(tree1d); + } + if (blcount) + { + vector32_cleanup(blcount); + png_alloc_free(blcount); + } + if (nextcode) + { + vector32_cleanup(nextcode); + png_alloc_free(nextcode); + } + return 1; } int HuffmanTree_decode(const HuffmanTree *tree, bool *decoded, uint32_t *result, size_t *treepos, @@ -362,6 +424,11 @@ { // get the tree of a deflated block with dynamic tree, the tree itself is also Huffman // compressed with a known tree size_t i, n; + size_t HLIT; + size_t HDIST; + size_t HCLEN; + size_t replength; + vector32_t *codelengthcode; HuffmanTree *codelengthcodetree = HuffmanTree_new(); // the code tree for code length codes vector32_t *bitlen, *bitlenD; bitlen = vector32_new(288, 0); @@ -370,46 +437,53 @@ Inflator_error = 49; // the bit pointer is or will go past the memory return; } - size_t HLIT = Zlib_readBitsFromStream(bp, in, 5) + 257; // number of literal/length codes + 257 - size_t HDIST = Zlib_readBitsFromStream(bp, in, 5) + 1; // number of dist codes + 1 - size_t HCLEN = Zlib_readBitsFromStream(bp, in, 4) + 4; // number of code length codes + 4 - vector32_t *codelengthcode; // lengths of tree to decode the lengths of the dynamic tree + HLIT = Zlib_readBitsFromStream(bp, in, 5) + 257; // number of literal/length codes + 257 + HDIST = Zlib_readBitsFromStream(bp, in, 5) + 1; // number of dist codes + 1 + HCLEN = Zlib_readBitsFromStream(bp, in, 4) + 4; // number of code length codes + 4 + // lengths of tree to decode the lengths of the dynamic tree codelengthcode = vector32_new(19, 0); for (i = 0; i < 19; i++) codelengthcode->data[CLCL[i]] = (i < HCLEN) ? Zlib_readBitsFromStream(bp, in, 3) : 0; Inflator_error = HuffmanTree_makeFromLengths(codelengthcodetree, codelengthcode, 7); if (Inflator_error) return; - size_t replength; + for (i = 0; i < HLIT + HDIST; ) { uint32_t code = Inflator_huffmanDecodeSymbol(in, bp, codelengthcodetree, inlength); - if (Inflator_error) + if (Inflator_error) { return; + } if (code <= 15) { // a length code - if (i < HLIT) + if (i < HLIT) { bitlen->data[i++] = code; - else + } else { bitlenD->data[i++ - HLIT] = code; - } else if (code == 16) { // repeat previous - if (*bp >> 3 >= inlength) { + } + } else if (code == 16) + { // repeat previous + uint32_t value; // set value to the previous code + if (*bp >> 3 >= inlength) + { Inflator_error = 50; // error, bit pointer jumps past memory return; } replength = 3 + Zlib_readBitsFromStream(bp, in, 2); - uint32_t value; // set value to the previous code - if ((i - 1) < HLIT) + + if ((i - 1) < HLIT) { value = bitlen->data[i - 1]; - else + } else { value = bitlenD->data[i - HLIT - 1]; + } for (n = 0; n < replength; n++) { // repeat this value in the next lengths if (i >= HLIT + HDIST) { Inflator_error = 13; // error: i is larger than the amount of codes return; } - if (i < HLIT) + if (i < HLIT) { bitlen->data[i++] = value; - else + } else { bitlenD->data[i++ - HLIT] = value; + } } } else if (code == 17) { // repeat "0" 3-10 times if (*bp >> 3 >= inlength) { @@ -423,9 +497,13 @@ return; } if (i < HLIT) + { bitlen->data[i++] = 0; + } else + { bitlenD->data[i++ - HLIT] = 0; + } } } else if (code == 18) { // repeat "0" 11-138 times if (*bp >> 3 >= inlength) { @@ -439,9 +517,13 @@ return; } if (i < HLIT) + { bitlen->data[i++] = 0; + } else + { bitlenD->data[i++ - HLIT] = 0; + } } } else { Inflator_error = 16; // error: an nonexitent code appeared. This can never happen. @@ -479,14 +561,20 @@ if (Inflator_error) return; if (code == 256) // end code + { return; + } else if (code <= 255) { // literal symbol if (*pos >= out->size) + { vector8_resize(out, (*pos + 1) * 2); // reserve more room + } out->data[(*pos)++] = (uint8_t) code; - } else if (code >= 257 && code <= 285) { // length code + } else if (code >= 257 && code <= 285) + { // length code size_t length = LENBASE[code - 257], numextrabits = LENEXTRA[code - 257]; - if ((*bp >> 3) >= inlength) { + if ((*bp >> 3) >= inlength) + { Inflator_error = 51; // error, bit pointer will jump past memory return; } @@ -582,14 +670,17 @@ // supposed to be made that way return 24; uint32_t CM = in->data[0] & 15, CINFO = (in->data[0] >> 4) & 15, FDICT = (in->data[1] >> 5) & 1; - if (CM != 8 || CINFO > 7) + if (CM != 8 || CINFO > 7){ // error: only compression method 8: inflate with sliding window of 32k is supported by // the PNG spec + return 25; - if (FDICT != 0) + } + if (FDICT != 0) { // error: the specification of PNG says about the zlib stream: "The additional flags shall // not specify a preset dictionary." return 26; + } Inflator_inflate(out, in, 2); return Inflator_error; // note: adler32 checksum was skipped and ignored } @@ -659,11 +750,17 @@ bitDepth = info->bitDepth; colorType = info->colorType; if (colorType == 2) + { return (3 * bitDepth); + } else if (colorType >= 4) + { return (colorType - 2) * bitDepth; + } else + { return bitDepth; + } } void PNG_readPngHeader(PNG_info_t *info, const uint8_t *in, size_t inlength) @@ -887,6 +984,10 @@ PNG_info_t *PNG_info_new() { PNG_info_t *info = png_alloc_malloc(sizeof (PNG_info_t)); + if (!info) + { + return NULL; + } uint32_t i; for (i = 0; i < sizeof (PNG_info_t); i++) ((uint8_t *) info)[i] = 0; @@ -937,6 +1038,12 @@ vector8_resize(idat, offset + chunkLength); } else idat = vector8_new(chunkLength, 0); + + if (!idat) + { + PNG_error = 1; + return NULL; + } for (i = 0; i < chunkLength; i++) idat->data[offset + i] = in[pos + 4 + i]; pos += (4 + chunkLength); @@ -1002,6 +1109,10 @@ uint32_t bpp = PNG_getBpp(info); vector8_t *scanlines; // now the out buffer will be filled scanlines = vector8_new(((info->width * (info->height * bpp + 7)) / 8) + info->height, 0); + if (!scanlines) { + PNG_error = 1; + return NULL; + } PNG_error = Zlib_decompress(scanlines, idat); if (PNG_error) return NULL; // stop if the zlib decompressor returned an error @@ -1068,7 +1179,13 @@ } if (info->colorType != 6 || info->bitDepth != 8) { // conversion needed vector8_t *copy = vector8_copy(info->image); // xxx: is this copy necessary? + if (!copy) { + return NULL; + } PNG_error = PNG_convert(info, info->image, copy->data); + if (PNG_error) { + return NULL; + } } return info; } @@ -1104,15 +1221,15 @@ } insize = (uint32_t) statbuf.st_size; inbuf = malloc(insize); - if (!inbuf) { - perror("malloc"); - fclose(infp); - return 1; - } - if (fread(inbuf, 1, insize, infp) != insize) { + if (!inbuf) { + perror("malloc"); + fclose(infp); + return 1; + } + if (fread(inbuf, 1, insize, infp) != insize) { perror("fread"); - free(inbuf); - fclose(infp); + free(inbuf); + fclose(infp); return 1; } fclose(infp); Index: branches/ErmaC/Enoch/i386/boot2/graphics.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2323) @@ -42,7 +42,7 @@ uint8_t *previewSaveunder = 0; #define VIDEO(x) (bootArgs->Video.v_ ## x) - + //========================================================================== // getVBEVideoRam @@ -84,18 +84,19 @@ return 0; buff = malloc(sizeof(char) * 256); - if (!buff) - return 0; + if (!buff) { + return 0; + } small = (vbeInfo.TotalMemory < 16); snprintf(buff, 256, - "VESA v%d.%d %d%s (%s)\n", - vbeInfo.VESAVersion >> 8, - vbeInfo.VESAVersion & 0xf, - small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16), - small ? "KB" : "MB", - VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) ); + "VESA v%d.%d %d%s (%s)\n", + vbeInfo.VESAVersion >> 8, + vbeInfo.VESAVersion & 0xf, + small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16), + small ? "KB" : "MB", + VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) ); return buff; } @@ -126,87 +127,86 @@ clearScreenRows(0, 24); setCursorPosition( 0, 0, 1 ); - vbeInfoString = getVBEInfoString(); - if (!vbeInfoString) { - printf("Error: getVBEInfoString failed\n"); - return; - } - printf("%s", vbeInfoString); - free(vbeInfoString); - vbeInfoString = NULL; + vbeInfoString = getVBEInfoString(); + if (!vbeInfoString) { + printf("Error: getVBEInfoString failed\n"); + return; + } + printf("%s", vbeInfoString); + free(vbeInfoString); + vbeInfoString = NULL; printf("Video modes supported:\n", VBEDecodeFP(const char *, vbeInfo.OEMStringPtr)); - // Loop through the mode list, and find the matching mode. + // Loop through the mode list, and find the matching mode. - for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); - *modePtr != modeEndOfList; modePtr++ ) - { - // Get mode information. + for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); + *modePtr != modeEndOfList; modePtr++ ) { + // Get mode information. - bzero( &modeInfo, sizeof(modeInfo) ); - err = getVBEModeInfo( *modePtr, &modeInfo ); - if ( err != errSuccess ) - { - continue; - } + bzero( &modeInfo, sizeof(modeInfo) ); + err = getVBEModeInfo( *modePtr, &modeInfo ); + if ( err != errSuccess ) + { + continue; + } - printf("Mode %x: %dx%dx%d mm:%d attr:%x\n", - *modePtr, modeInfo.XResolution, modeInfo.YResolution, - modeInfo.BitsPerPixel, modeInfo.MemoryModel, - modeInfo.ModeAttributes); + printf("Mode %x: %dx%dx%d mm:%d attr:%x\n", + *modePtr, modeInfo.XResolution, modeInfo.YResolution, + modeInfo.BitsPerPixel, modeInfo.MemoryModel, + modeInfo.ModeAttributes); - if (line++ >= 20) { - pause(); - line = 0; - clearScreenRows(0, 24); - setCursorPosition( 0, 0, 1 ); - } - } - if (line != 0) { - pause(); - } - setActiveDisplayPage(0); + if (line++ >= 20) { + pause(); + line = 0; + clearScreenRows(0, 24); + setCursorPosition( 0, 0, 1 ); + } + } + if (line != 0) { + pause(); + } + setActiveDisplayPage(0); } char *getVBEModeInfoString() { VBEInfoBlock vbeInfo; - unsigned short * modePtr; - VBEModeInfoBlock modeInfo; - int err; + unsigned short * modePtr; + VBEModeInfoBlock modeInfo; + int err; bzero( &vbeInfo, sizeof(vbeInfo) ); - strcpy( (char*)&vbeInfo, "VBE2" ); - err = getVBEInfo( &vbeInfo ); - if ( err != errSuccess ) - return 0; - + strcpy( (char*)&vbeInfo, "VBE2" ); + err = getVBEInfo( &vbeInfo ); + if ( err != errSuccess ) { + return 0; + } char *buff=malloc(sizeof(char)*3072); - if(!buff) return 0; - int bufflen = 0; + if(!buff) { + return 0; + } + int bufflen = 0; + // Loop through the mode list, and find the matching mode. - for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); - (*modePtr != modeEndOfList) && (bufflen < 3072); /* prevent buffer overrun */ - modePtr++ ) - { - // Get mode information. + for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr ); + (*modePtr != modeEndOfList) && (bufflen < 3072); /* prevent buffer overrun */ + modePtr++ ) { + // Get mode information. - bzero( &modeInfo, sizeof(modeInfo) ); - err = getVBEModeInfo( *modePtr, &modeInfo ); - if ( err != errSuccess ) - { - continue; - } + bzero( &modeInfo, sizeof(modeInfo) ); + err = getVBEModeInfo( *modePtr, &modeInfo ); + if ( err != errSuccess ) { + continue; + } - bufflen += - snprintf(buff+bufflen, 3072-bufflen, "Mode %x: %dx%dx%d mm:%d attr:%x\n", - *modePtr, modeInfo.XResolution, modeInfo.YResolution, - modeInfo.BitsPerPixel, modeInfo.MemoryModel, - modeInfo.ModeAttributes); - - } + bufflen += + snprintf(buff+bufflen, 3072-bufflen, "Mode %x: %dx%dx%d mm:%d attr:%x\n", + *modePtr, modeInfo.XResolution, modeInfo.YResolution, + modeInfo.BitsPerPixel, modeInfo.MemoryModel, + modeInfo.ModeAttributes); + } return buff; } @@ -1163,7 +1163,7 @@ params[1] = 25; } - setVESATextMode( params[0], params[1], 4 ); + setVESATextMode( params[0], params[1], 4 ); bootArgs->Video.v_display = VGA_TEXT_MODE; } @@ -1205,8 +1205,15 @@ //========================================================================== // Display and clear the activity indicator. +// BASIC Indicator static char indicator[] = {'-', '\\', '|', '/', '-', '\\', '|', '/', '\0'}; +// Bouncing ball .oOo. +//static char indicator[] = {46, 111, 79, 248, 79, 111, '\0'}; + +// ┤┘┴└├┌┬┐ +//static char indicator[] = {180, 217, 193, 192, 195, 218, 194, 191, '\0'}; + // To prevent a ridiculously fast-spinning indicator, // ensure a minimum of 1/9 sec between animation frames. #define MIN_TICKS 2 @@ -1216,33 +1223,28 @@ { static unsigned long lastTickTime = 0, currentTickTime; - if (previewTotalSectors && previewSaveunder) - { + if (previewTotalSectors && previewSaveunder) { int blob, lastBlob; lastBlob = (previewLoadedSectors * kIOHibernateProgressCount) / previewTotalSectors; previewLoadedSectors+=sectors; blob = (previewLoadedSectors * kIOHibernateProgressCount) / previewTotalSectors; - if (blob!=lastBlob) + if (blob!=lastBlob) { updateProgressBar (previewSaveunder, lastBlob, blob); + } return; } currentTickTime = time18(); // late binding - if (currentTickTime < lastTickTime + MIN_TICKS) - { + if (currentTickTime < lastTickTime + MIN_TICKS) { return; - } - else - { + } else { lastTickTime = currentTickTime; } - - if (getVideoMode() == VGA_TEXT_MODE) - { - if (currentIndicator >= sizeof(indicator)) - { + + if (getVideoMode() == VGA_TEXT_MODE) { + if (currentIndicator >= sizeof(indicator)) { currentIndicator = 0; } putchar(indicator[currentIndicator++]); @@ -1253,8 +1255,7 @@ void clearActivityIndicator( void ) { - if ( getVideoMode() == VGA_TEXT_MODE ) - { + if ( getVideoMode() == VGA_TEXT_MODE ) { putchar(' '); putchar('\b'); } Index: branches/ErmaC/Enoch/i386/boot2/drivers.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/drivers.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/drivers.c (revision 2323) @@ -43,24 +43,24 @@ //extern char gMacOSVersion[8]; struct Module { - struct Module *nextModule; - long willLoad; - TagPtr dict; - char *plistAddr; - long plistLength; - char *executablePath; - char *bundlePath; - long bundlePathLength; + struct Module *nextModule; + long willLoad; + TagPtr dict; + char *plistAddr; + long plistLength; + char *executablePath; + char *bundlePath; + long bundlePathLength; }; typedef struct Module Module, *ModulePtr; struct DriverInfo { - char *plistAddr; - long plistLength; - void *executableAddr; - long executableLength; - void *bundlePathAddr; - long bundlePathLength; + char *plistAddr; + long plistLength; + void *executableAddr; + long executableLength; + void *bundlePathAddr; + long bundlePathLength; }; typedef struct DriverInfo DriverInfo, *DriverInfoPtr; @@ -80,8 +80,8 @@ typedef struct DriversPackage DriversPackage; enum { - kCFBundleType2, - kCFBundleType3 + kCFBundleType2, + kCFBundleType3 }; long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p); @@ -114,24 +114,24 @@ /*static*/ unsigned long Adler32( unsigned char * buffer, long length ) { - long cnt; - unsigned long result, lowHalf, highHalf; - - lowHalf = 1; - highHalf = 0; - - for ( cnt = 0; cnt < length; cnt++ ) - { - if ((cnt % 5000) == 0) - { - lowHalf %= 65521L; - highHalf %= 65521L; - } - - lowHalf += buffer[cnt]; - highHalf += lowHalf; - } + long cnt; + unsigned long result, lowHalf, highHalf; + lowHalf = 1; + highHalf = 0; + + for (cnt = 0; cnt < length; cnt++) + { + if ((cnt % 5000) == 0) + { + lowHalf %= 65521L; + highHalf %= 65521L; + } + + lowHalf += buffer[cnt]; + highHalf += lowHalf; + } + lowHalf %= 65521L; highHalf %= 65521L; @@ -147,16 +147,17 @@ static long InitDriverSupport( void ) { - gExtensionsSpec = malloc( 4096 ); - gDriverSpec = malloc( 4096 ); - gFileSpec = malloc( 4096 ); - gTempSpec = malloc( 4096 ); - gFileName = malloc( 4096 ); + gExtensionsSpec = malloc( 4096 ); + gDriverSpec = malloc( 4096 ); + gFileSpec = malloc( 4096 ); + gTempSpec = malloc( 4096 ); + gFileName = malloc( 4096 ); - if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName ) - stop("InitDriverSupport error"); + if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName ) { + stop("InitDriverSupport error"); + } - return 0; + return 0; } //========================================================================== @@ -164,109 +165,98 @@ long LoadDrivers( char * dirSpec ) { - char dirSpecExtra[1024]; + char dirSpecExtra[1024]; - if ( InitDriverSupport() != 0 ) - return 0; + if ( InitDriverSupport() != 0 ) { + return 0; + } - // Load extra drivers if a hook has been installed. - if (LoadExtraDrivers_p != NULL) - { - (*LoadExtraDrivers_p)(&FileLoadDrivers); - } + // Load extra drivers if a hook has been installed. + if (LoadExtraDrivers_p != NULL) + { + (*LoadExtraDrivers_p)(&FileLoadDrivers); + } - if ( gBootFileType == kNetworkDeviceType ) - { - if (NetLoadDrivers(dirSpec) != 0) { - error("Could not load drivers from the network\n"); - return -1; - } - } - else if ( gBootFileType == kBlockDeviceType ) + if ( gBootFileType == kNetworkDeviceType ) { - // First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0). - if (gRAMDiskVolume && !gRAMDiskBTAliased) - { - strcpy(dirSpecExtra, "rd(0,0)/Extra/"); - FileLoadDrivers(dirSpecExtra, 0); - } + if (NetLoadDrivers(dirSpec) != 0) + { + error("Could not load drivers from the network\n"); + return -1; + } + } + else if ( gBootFileType == kBlockDeviceType ) + { + // First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0). + if (gRAMDiskVolume && !gRAMDiskBTAliased) + { + strcpy(dirSpecExtra, "rd(0,0)/Extra/"); + FileLoadDrivers(dirSpecExtra, 0); + } - // Next try to load Extra extensions from the selected root partition. - strcpy(dirSpecExtra, "/Extra/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - // If failed, then try to load Extra extensions from the boot partition - // in case we have a separate booter partition or a bt(0,0) aliased ramdisk. - if ( !(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no) - || (gRAMDiskVolume && gRAMDiskBTAliased) ) - { - // Next try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - // Next we'll try the base - strcpy(dirSpecExtra, "bt(0,0)/Extra/"); - FileLoadDrivers(dirSpecExtra, 0); - } - } - } - if(!gHaveKernelCache) - { - // Don't load main driver (from /System/Library/Extentions) if gHaveKernelCache is set. - // since these drivers will already be in the kernel cache. - // NOTE: when gHaveKernelCache, xnu cannot (by default) load *any* extra kexts from the bootloader. - // The /Extra code is not disabled in this case due to a kernel patch that allows for this to happen. - - // Also try to load Extensions from boot helper partitions. - if (gBootVolume->flags & kBVFlagBooter) - { - strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); - FileLoadDrivers(dirSpecExtra, 0); - } - } - } - - if (gMKextName[0] != '\0') - { - verbose("LoadDrivers: Loading from [%s]\n", gMKextName); - if ( LoadDriverMKext(gMKextName) != 0 ) - { - error("Could not load %s\n", gMKextName); - return -1; - } - } - else - { + // Next try to load Extra extensions from the selected root partition. + strcpy(dirSpecExtra, "/Extra/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) { + // If failed, then try to load Extra extensions from the boot partition + // in case we have a separate booter partition or a bt(0,0) aliased ramdisk. + if ( !(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no) + || (gRAMDiskVolume && gRAMDiskBTAliased) ) { + // Next try a specfic OS version folder ie 10.5 + sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) { + // Next we'll try the base + strcpy(dirSpecExtra, "bt(0,0)/Extra/"); + FileLoadDrivers(dirSpecExtra, 0); + } + } + } + if(!gHaveKernelCache) { + // Don't load main driver (from /System/Library/Extentions) if gHaveKernelCache is set. + // since these drivers will already be in the kernel cache. + // NOTE: when gHaveKernelCache, xnu cannot (by default) load *any* extra kexts from the bootloader. + // The /Extra code is not disabled in this case due to a kernel patch that allows for this to happen. + + // Also try to load Extensions from boot helper partitions. + if (gBootVolume->flags & kBVFlagBooter) { + strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) { + strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) { + strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); + FileLoadDrivers(dirSpecExtra, 0); + } + } + } + + if (gMKextName[0] != '\0') { + verbose("LoadDrivers: Loading from [%s]\n", gMKextName); + if ( LoadDriverMKext(gMKextName) != 0 ) { + error("Could not load %s\n", gMKextName); + return -1; + } + } else { if (gMacOSVersion[3] == '9') { - strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */ + strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */ strcat(gExtensionsSpec, "Library/"); FileLoadDrivers(gExtensionsSpec, 0); } - strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") */ - strcat(gExtensionsSpec, "System/Library/"); - FileLoadDrivers(gExtensionsSpec, 0); - } + strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") */ + strcat(gExtensionsSpec, "System/Library/"); + FileLoadDrivers(gExtensionsSpec, 0); + } - } - } - else - { - return 0; - } + } + } else { + return 0; + } - MatchPersonalities(); + MatchPersonalities(); - MatchLibraries(); + MatchLibraries(); - LoadMatchedModules(); + LoadMatchedModules(); - return 0; + return 0; } //========================================================================== @@ -289,11 +279,12 @@ || ((flags & kFileTypeMask) != kFileTypeDirectory) || (((gBootMode & kBootModeSafe) == 0) && (time == (time2 + 1)))) { - snprintf(gDriverSpec, sizeof(altDirSpec) + 18, "%sExtensions.mkext", altDirSpec); + snprintf(gDriverSpec, sizeof(altDirSpec) + 18, "%sExtensions.mkext", altDirSpec); verbose("LoadDrivers: Loading from [%s]\n", gDriverSpec); - if (LoadDriverMKext(gDriverSpec) == 0) + if (LoadDriverMKext(gDriverSpec) == 0) { return 0; + } } } return -1; @@ -305,59 +296,73 @@ long FileLoadDrivers( char * dirSpec, long plugin ) { - long ret, length, flags, time, bundleType; - long long index; - long result = -1; - const char * name; - - if ( !plugin ) - { - // First try 10.6's path for loading Extensions.mkext. - if (FileLoadMKext(dirSpec, "Caches/com.apple.kext.caches/Startup/") == 0) - return 0; + long ret, length, flags, time, bundleType; + long long index; + long result = -1; + const char * name; - // Next try the legacy path. - else if (FileLoadMKext(dirSpec, "") == 0) - return 0; + if ( !plugin ) + { + // First try 10.6's path for loading Extensions.mkext. + if (FileLoadMKext(dirSpec, "Caches/com.apple.kext.caches/Startup/") == 0) { + return 0; + } - strcat(dirSpec, "Extensions"); - } + // Next try the legacy path. + else if (FileLoadMKext(dirSpec, "") == 0) { + return 0; + } - index = 0; - while (1) { - ret = GetDirEntry(dirSpec, &index, &name, &flags, &time); - if (ret == -1) break; + strcat(dirSpec, "Extensions"); + } - // Make sure this is a directory. - if ((flags & kFileTypeMask) != kFileTypeDirectory) continue; - - // Make sure this is a kext. - length = strlen(name); - if (strcmp(name + length - 5, ".kext")) continue; + index = 0; + while (1) + { + ret = GetDirEntry(dirSpec, &index, &name, &flags, &time); + if (ret == -1) { + break; + } - // Save the file name. - strlcpy(gFileName, name, 4096); - - // Determine the bundle type. - snprintf(gTempSpec, 4096, "%s/%s", dirSpec, gFileName); - ret = GetFileInfo(gTempSpec, "Contents", &flags, &time); - if (ret == 0) bundleType = kCFBundleType2; - else bundleType = kCFBundleType3; + // Make sure this is a directory. + if ((flags & kFileTypeMask) != kFileTypeDirectory) { + continue; + } - if (!plugin) - snprintf(gDriverSpec, 4096, "%s/%s/%sPlugIns", dirSpec, gFileName, - (bundleType == kCFBundleType2) ? "Contents/" : ""); + // Make sure this is a kext. + length = strlen(name); + if (strcmp(name + length - 5, ".kext")) { + continue; + } - ret = LoadDriverPList(dirSpec, gFileName, bundleType); + // Save the file name. + strlcpy(gFileName, name, 4096); - if (result != 0) - result = ret; + // Determine the bundle type. + snprintf(gTempSpec, 4096, "%s/%s", dirSpec, gFileName); + ret = GetFileInfo(gTempSpec, "Contents", &flags, &time); + if (ret == 0) { + bundleType = kCFBundleType2; + } else { + bundleType = kCFBundleType3; + } - if (!plugin) - FileLoadDrivers(gDriverSpec, 1); - } + if (!plugin) { + snprintf(gDriverSpec, 4096, "%s/%s/%sPlugIns", dirSpec, gFileName, (bundleType == kCFBundleType2) ? "Contents/" : ""); + } - return result; + ret = LoadDriverPList(dirSpec, gFileName, bundleType); + + if (result != 0) { + result = ret; + } + + if (!plugin) { + FileLoadDrivers(gDriverSpec, 1); + } + } + + return result; } @@ -367,32 +372,36 @@ long NetLoadDrivers( char * dirSpec ) { - long tries; + long tries; #if NODEF - long cnt; + long cnt; - // Get the name of the kernel - cnt = strlen(gBootFile); - while (cnt--) { - if ((gBootFile[cnt] == '\\') || (gBootFile[cnt] == ',')) { - cnt++; - break; - } - } + // Get the name of the kernel + cnt = strlen(gBootFile); + while (cnt--) { + if ((gBootFile[cnt] == '\\') || (gBootFile[cnt] == ',')) { + cnt++; + break; + } + } #endif - // INTEL modification - snprintf(gDriverSpec, 4096, "%s%s.mkext", dirSpec, bootInfo->bootFile); + // INTEL modification + snprintf(gDriverSpec, 4096, "%s%s.mkext", dirSpec, bootInfo->bootFile); - verbose("NetLoadDrivers: Loading from [%s]\n", gDriverSpec); + verbose("NetLoadDrivers: Loading from [%s]\n", gDriverSpec); - tries = 3; - while (tries--) - { - if (LoadDriverMKext(gDriverSpec) == 0) break; - } - if (tries == -1) return -1; + tries = 3; + while (tries--) + { + if (LoadDriverMKext(gDriverSpec) == 0) { + break; + } + } + if (tries == -1) { + return -1; + } return 0; } @@ -403,44 +412,45 @@ long LoadDriverMKext( char * fileSpec ) { - unsigned long driversAddr, driversLength; - long length; - char segName[32]; - DriversPackage * package; + unsigned long driversAddr, driversLength; + long length; + char segName[32]; + DriversPackage * package; #define GetPackageElement(e) OSSwapBigToHostInt32(package->e) - // Load the MKext. - length = LoadThinFatFile(fileSpec, (void **)&package); - if (length < sizeof (DriversPackage)) return -1; + // Load the MKext. + length = LoadThinFatFile(fileSpec, (void **)&package); + if (length < sizeof (DriversPackage)) { + return -1; + } // call hook to notify modules that the mkext has been loaded execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, (void*) &length, NULL); - // Verify the MKext. - if (( GetPackageElement(signature1) != kDriverPackageSignature1) || - ( GetPackageElement(signature2) != kDriverPackageSignature2) || - ( GetPackageElement(length) > kLoadSize ) || - ( GetPackageElement(adler32) != - Adler32((unsigned char *)&package->version, GetPackageElement(length) - 0x10) ) ) - { - return -1; - } + // Verify the MKext. + if (( GetPackageElement(signature1) != kDriverPackageSignature1) || + ( GetPackageElement(signature2) != kDriverPackageSignature2) || + ( GetPackageElement(length) > kLoadSize ) || + ( GetPackageElement(adler32) != + Adler32((unsigned char *)&package->version, GetPackageElement(length) - 0x10) ) ) + { + return -1; + } - // Make space for the MKext. - driversLength = GetPackageElement(length); - driversAddr = AllocateKernelMemory(driversLength); + // Make space for the MKext. + driversLength = GetPackageElement(length); + driversAddr = AllocateKernelMemory(driversLength); - // Copy the MKext. - memcpy((void *)driversAddr, (void *)package, driversLength); + // Copy the MKext. + memcpy((void *)driversAddr, (void *)package, driversLength); - // Add the MKext to the memory map. - snprintf(segName, sizeof(segName), "DriversPackage-%lx", driversAddr); - AllocateMemoryRange(segName, driversAddr, driversLength, - kBootDriverTypeMKEXT); + // Add the MKext to the memory map. + snprintf(segName, sizeof(segName), "DriversPackage-%lx", driversAddr); + AllocateMemoryRange(segName, driversAddr, driversLength, kBootDriverTypeMKEXT); - return 0; + return 0; } //========================================================================== @@ -449,110 +459,137 @@ long LoadDriverPList( char * dirSpec, char * name, long bundleType ) { - long length, executablePathLength, bundlePathLength; - ModulePtr module; - TagPtr personalities; - char * buffer = 0; - char * tmpExecutablePath = 0; - char * tmpBundlePath = 0; - long ret = -1; + long length, executablePathLength, bundlePathLength; + ModulePtr module; + TagPtr personalities; + char * buffer = 0; + char * tmpExecutablePath = 0; + char * tmpBundlePath = 0; + long ret = -1; - do { - // Save the driver path. + do{ + // Save the driver path. - if(name) - snprintf(gFileSpec, 4096, "%s/%s/%s", dirSpec, name, - (bundleType == kCFBundleType2) ? "Contents/MacOS/" : ""); - else - snprintf(gFileSpec, 4096, "%s/%s", dirSpec, - (bundleType == kCFBundleType2) ? "Contents/MacOS/" : ""); - executablePathLength = strlen(gFileSpec) + 1; + if(name) { + snprintf(gFileSpec, 4096, "%s/%s/%s", dirSpec, name, (bundleType == kCFBundleType2) ? "Contents/MacOS/" : ""); + } else { + snprintf(gFileSpec, 4096, "%s/%s", dirSpec, (bundleType == kCFBundleType2) ? "Contents/MacOS/" : ""); + } + executablePathLength = strlen(gFileSpec) + 1; - tmpExecutablePath = malloc(executablePathLength); - if (tmpExecutablePath == 0) break; - strcpy(tmpExecutablePath, gFileSpec); - - if(name) - snprintf(gFileSpec, 4096, "%s/%s", dirSpec, name); - else - snprintf(gFileSpec, 4096, "%s", dirSpec); - bundlePathLength = strlen(gFileSpec) + 1; + tmpExecutablePath = malloc(executablePathLength); + if (tmpExecutablePath == 0) { + break; + } + strcpy(tmpExecutablePath, gFileSpec); - tmpBundlePath = malloc(bundlePathLength); - if (tmpBundlePath == 0) break; + if(name) { + snprintf(gFileSpec, 4096, "%s/%s", dirSpec, name); + } else { + snprintf(gFileSpec, 4096, "%s", dirSpec); + } + bundlePathLength = strlen(gFileSpec) + 1; - strcpy(tmpBundlePath, gFileSpec); + tmpBundlePath = malloc(bundlePathLength); + if (tmpBundlePath == 0) { + break; + } - // Construct the file spec to the plist, then load it. + strcpy(tmpBundlePath, gFileSpec); - if(name) - snprintf(gFileSpec, 4096, "%s/%s/%sInfo.plist", dirSpec, name, - (bundleType == kCFBundleType2) ? "Contents/" : ""); - else - snprintf(gFileSpec, 4096, "%s/%sInfo.plist", dirSpec, - (bundleType == kCFBundleType2) ? "Contents/" : ""); + // Construct the file spec to the plist, then load it. - length = LoadFile(gFileSpec); - if (length == -1) break; - length = length + 1; - buffer = malloc(length); - if (buffer == 0) break; - strlcpy(buffer, (char *)kLoadAddr, length); + if(name) { + snprintf(gFileSpec, 4096, "%s/%s/%sInfo.plist", dirSpec, name, (bundleType == kCFBundleType2) ? "Contents/" : ""); + } else { + snprintf(gFileSpec, 4096, "%s/%sInfo.plist", dirSpec, (bundleType == kCFBundleType2) ? "Contents/" : ""); + } - // Parse the plist. + length = LoadFile(gFileSpec); + if (length == -1) { + break; + } + length = length + 1; + buffer = malloc(length); + if (buffer == 0) { + break; + } + strlcpy(buffer, (char *)kLoadAddr, length); - ret = ParseXML(buffer, &module, &personalities); - if (ret != 0) { break; } - // Allocate memory for the driver path and the plist. + // Parse the plist. - module->executablePath = tmpExecutablePath; - module->bundlePath = tmpBundlePath; - module->bundlePathLength = bundlePathLength; - module->plistAddr = malloc(length); - - if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0)) - break; - // Save the driver path in the module. - //strcpy(module->driverPath, tmpDriverPath); - tmpExecutablePath = 0; - tmpBundlePath = 0; + ret = ParseXML(buffer, &module, &personalities); - // Add the plist to the module. + if (ret != 0) { + break; + } - strlcpy(module->plistAddr, (char *)kLoadAddr, length); - module->plistLength = length; - - // Add the module to the end of the module list. + if (!module) { + ret = -1; + break; + } // Should never happen but it will make the compiler happy + + // Allocate memory for the driver path and the plist. + + module->executablePath = tmpExecutablePath; + module->bundlePath = tmpBundlePath; + module->bundlePathLength = bundlePathLength; + module->plistAddr = malloc(length); + + if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0)) { + break; + } + + // Save the driver path in the module. + //strcpy(module->driverPath, tmpDriverPath); + tmpExecutablePath = 0; + tmpBundlePath = 0; + + // Add the plist to the module. + + strlcpy(module->plistAddr, (char *)kLoadAddr, length); + module->plistLength = length; + + // Add the module to the end of the module list. - if (gModuleHead == 0) - gModuleHead = module; - else - gModuleTail->nextModule = module; - gModuleTail = module; - - // Add the persionalities to the personality list. - - if (personalities) personalities = personalities->tag; - while (personalities != 0) - { - if (gPersonalityHead == 0) - gPersonalityHead = personalities->tag; - else - gPersonalityTail->tagNext = personalities->tag; - - gPersonalityTail = personalities->tag; - personalities = personalities->tagNext; - } + if (gModuleHead == 0) { + gModuleHead = module; + } else { + gModuleTail->nextModule = module; + } + gModuleTail = module; + + // Add the persionalities to the personality list. + + if (personalities) { + personalities = personalities->tag; + } + while (personalities != 0) + { + if (gPersonalityHead == 0) { + gPersonalityHead = personalities->tag; + } else { + gPersonalityTail->tagNext = personalities->tag; + } + + gPersonalityTail = personalities->tag; + personalities = personalities->tagNext; + } - ret = 0; - } - while (0); + ret = 0; + } + while (0); - if ( buffer ) free( buffer ); - if ( tmpExecutablePath ) free( tmpExecutablePath ); - if ( tmpBundlePath ) free( tmpBundlePath ); - - return ret; + if ( buffer ) { + free( buffer ); + } + if ( tmpExecutablePath ) { + free( tmpExecutablePath ); + } + if ( tmpBundlePath ) { + free( tmpBundlePath ); + } + return ret; } @@ -652,8 +689,8 @@ static long MatchPersonalities( void ) { - /* IONameMatch support not implemented */ - return 0; + /* IONameMatch support not implemented */ + return 0; } //========================================================================== @@ -662,47 +699,55 @@ static long MatchLibraries( void ) { - TagPtr prop, prop2; - ModulePtr module, module2; - long done; + TagPtr prop, prop2; + ModulePtr module, module2; + long done; - do { - done = 1; - module = gModuleHead; + do + { + done = 1; + module = gModuleHead; - while (module != 0) - { - if (module->willLoad == 1) - { - prop = XMLGetProperty(module->dict, kPropOSBundleLibraries); - if (prop != 0) - { - prop = prop->tag; - while (prop != 0) - { - module2 = gModuleHead; - while (module2 != 0) - { - prop2 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier); - if ((prop2 != 0) && (!strcmp(prop->string, prop2->string))) - { - if (module2->willLoad == 0) module2->willLoad = 1; - break; - } - module2 = module2->nextModule; - } - prop = prop->tagNext; - } - } - module->willLoad = 2; - done = 0; - } - module = module->nextModule; - } - } - while (!done); + while (module != 0) + { + if (module->willLoad == 1) + { + prop = XMLGetProperty(module->dict, kPropOSBundleLibraries); - return 0; + if (prop != 0) + { + prop = prop->tag; + + while (prop != 0) + { + module2 = gModuleHead; + + while (module2 != 0) + { + prop2 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier); + + if ((prop2 != 0) && (!strcmp(prop->string, prop2->string))) + { + if (module2->willLoad == 0) + { + module2->willLoad = 1; + } + break; + } + module2 = module2->nextModule; + } + prop = prop->tagNext; + } + } + module->willLoad = 2; + done = 0; + } + module = module->nextModule; + } + } + while (!done); + + return 0; } @@ -713,19 +758,23 @@ static ModulePtr FindModule( char * name ) { - ModulePtr module; - TagPtr prop; + ModulePtr module; + TagPtr prop; + + module = gModuleHead; + + while (module != 0) + { + prop = GetProperty(module->dict, kPropCFBundleIdentifier); + + if ((prop != 0) && !strcmp(name, prop->string)) { + break; + } + + module = module->nextModule; + } - module = gModuleHead; - - while (module != 0) - { - prop = GetProperty(module->dict, kPropCFBundleIdentifier); - if ((prop != 0) && !strcmp(name, prop->string)) break; - module = module->nextModule; - } - - return module; + return module; } #endif /* NOTDEF */ @@ -739,23 +788,30 @@ TagPtr moduleDict, required; ModulePtr tmpModule; - pos = 0; + pos = 0; - while (1) - { - length = XMLParseNextTag(buffer + pos, &moduleDict); - if (length == -1) break; - - pos += length; - - if (moduleDict == 0) continue; - if (moduleDict->type == kTagTypeDict) break; - - XMLFreeTag(moduleDict); - } - - if (length == -1) return -1; + while (1) + { + length = XMLParseNextTag(buffer + pos, &moduleDict); + if (length == -1) { + break; + } + pos += length; + + if (moduleDict == 0) { + continue; + } + if (moduleDict->type == kTagTypeDict) { + break; + } + XMLFreeTag(moduleDict); + } + + if (length == -1) { + return -1; + } + required = XMLGetProperty(moduleDict, kPropOSBundleRequired); if ( (required == 0) || (required->type != kTagTypeString) || !strcmp(required->string, "Safe Boot")) @@ -764,32 +820,31 @@ return -2; } - tmpModule = malloc(sizeof(Module)); - if (tmpModule == 0) - { - XMLFreeTag(moduleDict); - return -1; - } - tmpModule->dict = moduleDict; + tmpModule = malloc(sizeof(Module)); + if (tmpModule == 0) { + XMLFreeTag(moduleDict); + return -1; + } + tmpModule->dict = moduleDict; - // For now, load any module that has OSBundleRequired != "Safe Boot". + // For now, load any module that has OSBundleRequired != "Safe Boot". - tmpModule->willLoad = 1; + tmpModule->willLoad = 1; - *module = tmpModule; + *module = tmpModule; - // Get the personalities. + // Get the personalities. - *personalities = XMLGetProperty(moduleDict, kPropIOKitPersonalities); + *personalities = XMLGetProperty(moduleDict, kPropIOKitPersonalities); - return 0; + return 0; } #if NOTDEF static char gPlatformName[64]; #endif -long +long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize) { long ret; @@ -845,22 +900,21 @@ } ret = ThinFatFile(&binary, &len); - if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64) - { - archCpuType=CPU_TYPE_I386; - ret = ThinFatFile(&binary, &len); - } - - // Notify modules that the kernel has been decompressed, thinned and is about to be decoded + if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64) + { + archCpuType=CPU_TYPE_I386; + ret = ThinFatFile(&binary, &len); + } + + // Notify modules that the kernel has been decompressed, thinned and is about to be decoded execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL); - - - ret = DecodeMachO(binary, rentry, raddr, rsize); - if (ret<0 && archCpuType==CPU_TYPE_X86_64) - { - archCpuType=CPU_TYPE_I386; - ret = DecodeMachO(binary, rentry, raddr, rsize); - } - - return ret; + + ret = DecodeMachO(binary, rentry, raddr, rsize); + if (ret<0 && archCpuType==CPU_TYPE_X86_64) + { + archCpuType=CPU_TYPE_I386; + ret = DecodeMachO(binary, rentry, raddr, rsize); + } + + return ret; } Index: branches/ErmaC/Enoch/i386/boot2/mboot.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/mboot.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/mboot.c (revision 2323) @@ -433,7 +433,7 @@ multiboot_skip_partition = intVal; multiboot_skip_partition_set = 1; } - } + } } if(doSelectDevice) { Index: branches/ErmaC/Enoch/i386/boot2/prompt.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/prompt.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/prompt.c (revision 2323) @@ -28,7 +28,7 @@ #include -char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n" +char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Enoch r" I386BOOT_CHAMELEONREVISION "\n" "Build date: " I386BOOT_BUILDDATE "\n" "%dMB memory\n"; Index: branches/ErmaC/Enoch/i386/boot2/Makefile =================================================================== --- branches/ErmaC/Enoch/i386/boot2/Makefile (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/Makefile (revision 2323) @@ -36,15 +36,15 @@ INC = -I. -I$(SRCROOT) -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I${SRCROOT}/i386/include LIBS= -L$(SYMDIR) -lsaio -lsa -lklibc -LIBDEP= libsaio.a libsa.a libklibc.a +LIBDEP= libsaio.a libsa.a libklibc.a OTHER_FILES = # The ordering is important; # boot2.o must be first. -OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o \ - ramdisk.o picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o \ - modules_support.o boot_modules.o +OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o ramdisk.o \ + picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o \ + modules_support.o boot_modules.o # button.o browser.o scrollbar.o == NOTYET OBJS := $(addprefix $(OBJROOT)/, $(OBJS)) @@ -80,7 +80,7 @@ endif @${MKDIRS} $(OBJROOT)/../boot2_modules/ - + @### First pass, don't worry abount segment alignment. @echo "\t[LD] boot.sys" @$(CC) -Wl,-preload -Wl,-alias,boot2,start \ Index: branches/ErmaC/Enoch/i386/boot2/resume.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/resume.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/resume.c (revision 2323) @@ -22,21 +22,21 @@ static unsigned long getmemorylimit(void) { - int line; - int i; - MemoryRange *mp = bootInfo->memoryMap; + int line; + int i; + MemoryRange *mp = bootInfo->memoryMap; - // Activate and clear page 1 - line = 1; - for (i = 0; i < bootInfo->memoryMapCount; i++) - { - if((mp->type == 1) && ((unsigned long)mp->base == 0x100000)) - { - return (unsigned long)(mp->base + mp->length); - } - mp++; - } - return 0x10000000; + // Activate and clear page 1 + line = 1; + for (i = 0; i < bootInfo->memoryMapCount; i++) + { + if((mp->type == 1) && ((unsigned long)mp->base == 0x100000)) + { + return (unsigned long)(mp->base + mp->length); + } + mp++; + } + return 0x10000000; } static void WakeKernel(IOHibernateImageHeader * header) @@ -50,26 +50,27 @@ int32_t byteCnt; u_int32_t lowHalf, highHalf; u_int32_t sum; - + printf("\nWake Kernel!\n"); - + dst = (unsigned long *) (header->restore1CodePage << 12); count = header->restore1PageCount; proc = (header->restore1CodeOffset + ((uint32_t) dst)); newSP = header->restore1StackOffset + (header->restore1CodePage << 12); - + src = (unsigned long *) (((u_int32_t) &header->fileExtentMap[0]) + header->fileExtentMapSize); sum = 0; - + for (page = 0; page < count; page++) { compressedSize = 4096; - + lowHalf = 1; highHalf = 0; - - for (cnt = 0; cnt < compressedSize; cnt += 0x20) { + + for (cnt = 0; cnt < compressedSize; cnt += 0x20) + { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; @@ -85,14 +86,14 @@ src += 8; dst += 8; } - + lowHalf %= 65521L; highHalf %= 65521L; sum += (highHalf << 16) | lowHalf; } header->actualRestore1Sum = sum; startprog (proc, header); - + return; } @@ -103,19 +104,17 @@ IOHibernateImageHeader _header; IOHibernateImageHeader * header = &_header; long buffer; - + size = ReadFileAtOffset (image_filename, header, 0, sizeof(IOHibernateImageHeader)); printf("header read size %x\n", size); imageSize = header->image1Size; codeSize = header->restore1PageCount << 12; - if (kIOHibernateHeaderSignature != header->signature) - { + if (kIOHibernateHeaderSignature != header->signature) { printf ("Incorrect image signature\n"); return; } - if (header->encryptStart) - { + if (header->encryptStart) { printf ("Resuming from Encrypted image is unsupported.\n" "Uncheck \"Use secure virtual memory\" in \"Security\" pane on system preferences.\n" "Press any key to proceed with normal boot.\n"); @@ -128,9 +127,12 @@ uint32_t machineSignature; size = GetProp(gChosenPH, kIOHibernateMachineSignatureKey, (char *)&machineSignature, sizeof(machineSignature)); - if (size != sizeof(machineSignature)) machineSignature = 0; - if (machineSignature != header->machineSignature) + if (size != sizeof(machineSignature)) { + machineSignature = 0; + } + if (machineSignature != header->machineSignature) { break; + } } #endif @@ -139,21 +141,19 @@ mem_base = getmemorylimit() - allocSize;//TODO: lower this printf("mem_base %x\n", mem_base); - if (((long long)mem_base + allocSize) < (1024 * bootInfo->extmem + 0x100000)) - { + if (((long long)mem_base + allocSize) < (1024 * bootInfo->extmem + 0x100000)) { printf ("Not enough space to restore image. Press any key to proceed with normal boot.\n"); getchar(); return; } - + bcopy(header, (void *) mem_base, sizeof(IOHibernateImageHeader)); header = (IOHibernateImageHeader *) mem_base; imageSize -= sizeof(IOHibernateImageHeader); buffer = (long)(header + 1); - if (header->previewSize) - { + if (header->previewSize) { uint64_t preview_offset = header->fileExtentMapSize - sizeof(header->fileExtentMap) + codeSize; uint8_t progressSaveUnder[kIOHibernateProgressCount][kIOHibernateProgressSaveUnderSize]; @@ -162,10 +162,11 @@ previewTotalSectors = (imageSize-(preview_offset+header->previewSize))/512; previewLoadedSectors = 0; previewSaveunder = &(progressSaveUnder[0][0]); - if (preview_offset+header->previewSizepreviewSizepreviewSize), sizeof(IOHibernateImageHeader)+preview_offset+header->previewSize, imageSize-(preview_offset+header->previewSize)); + } previewTotalSectors = 0; previewLoadedSectors = 0; previewSaveunder = 0; @@ -177,10 +178,9 @@ remove it completely setVideoMode( VGA_TEXT_MODE, 0 ); #endif + } else { + ReadFileAtOffset (image_filename, (char *)buffer, sizeof(IOHibernateImageHeader), imageSize); } - else - ReadFileAtOffset (image_filename, (char *)buffer, sizeof(IOHibernateImageHeader), imageSize); - // Depends on NVRAM #if 0 if (header->encryptStart) { @@ -210,6 +210,6 @@ bzero(&decryptkey, sizeof(decryptkey)); } #endif - + WakeKernel(header); } Index: branches/ErmaC/Enoch/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2323) @@ -6,7 +6,7 @@ * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights * Reserved. This file contains Original Code and/or Modifications of * Original Code as defined in and that are subject to the Apple Public - * Source License Version 2.0 (the "License"). You may not use this file + * Source License Version 2.0 (the "License"). You may not use this file * except in compliance with the License. Please obtain a copy of the * License at http://www.apple.com/publicsource and read it before using * this file. @@ -26,26 +26,21 @@ * Mach Operating System * Copyright (c) 1990 Carnegie-Mellon University * Copyright (c) 1989 Carnegie-Mellon University - * All rights reserved. The CMU software License Agreement specifies + * All rights reserved. The CMU software License Agreement specifies * the terms and conditions for use and redistribution. - */ - -/* - * INTEL CORPORATION PROPRIETARY INFORMATION * - * This software is supplied under the terms of a license agreement or - * nondisclosure agreement with Intel Corporation and may not be copied - * nor disclosed except in accordance with the terms of that agreement. + * INTEL CORPORATION PROPRIETARY INFORMATION * + * This software is supplied under the terms of a license agreement or + * nondisclosure agreement with Intel Corporation and may not be copied + * nor disclosed except in accordance with the terms of that agreement. + * * Copyright 1988, 1989 by Intel Corporation - */ - -/* + * + * * Copyright 1993 NeXT Computer, Inc. * All rights reserved. - */ - -/* + * * Completely reworked by Sam Streeper (sam_s@NeXT.com) * Reworked again by Curtis Galloway (galloway@NeXT.com) */ @@ -75,7 +70,7 @@ char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; char gMacOSVersion[8]; -int bvCount = 0, gDeviceCount = 0; +int bvCount = 0, gDeviceCount = 0; //int menucount = 0; long gBootMode; /* defaults to 0 == kBootModeNormal */ BVRef bvr, menuBVR, bvChain; @@ -96,13 +91,13 @@ static void zeroBSS(void) { extern char bss_start __asm("section$start$__DATA$__bss"); - extern char bss_end __asm("section$end$__DATA$__bss"); - extern char common_start __asm("section$start$__DATA$__common"); - extern char common_end __asm("section$end$__DATA$__common"); - + extern char bss_end __asm("section$end$__DATA$__bss"); + extern char common_start __asm("section$start$__DATA$__common"); + extern char common_end __asm("section$end$__DATA$__common"); + bzero(&bss_start, (&bss_end - &bss_start)); bzero(&common_start, (&common_end - &common_start)); -} +} //========================================================================== // Malloc error function @@ -129,74 +124,73 @@ { int ret; entry_t kernelEntry; - + bootArgs->kaddr = bootArgs->ksize = 0; execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); - + ret = DecodeKernel(binary, &kernelEntry, (char **) &bootArgs->kaddr, (int *)&bootArgs->ksize ); - + if ( ret != 0 ) return ret; - + // Reserve space for boot args reserveKernBootStruct(); - + // Notify modules that the kernel has been decoded execute_hook("DecodedKernel", (void*)binary, (void*)bootArgs->kaddr, (void*)bootArgs->ksize, NULL); - + setupFakeEfi(); - + // Load boot drivers from the specifed root path. //if (!gHaveKernelCache) LoadDrivers("/"); - + execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL); - + clearActivityIndicator(); - + if (gErrors) { printf("Errors encountered while starting up the computer.\n"); printf("Pausing %d seconds...\n", kBootErrorTimeout); sleep(kBootErrorTimeout); } - + md0Ramdisk(); - + verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); verbose("Boot Args: %s\n", bootArgs->CommandLine); // Cleanup the PXE base code. - + if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) { - if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) - { + if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) { printf("nbpUnloadBaseCode error %d\n", (int) ret); sleep(2); } } - + bool dummyVal; if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->chameleonConfig) && dummyVal) { showTextBuffer(msgbuf, strlen(msgbuf)); } - + usb_loop(); // If we were in text mode, switch to graphics mode. // This will draw the boot graphics unless we are in // verbose mode. - if (gVerboseMode) + if (gVerboseMode) { setVideoMode( GRAPHICS_MODE, 0 ); - else + } else { drawBootGraphics(); - + } setupBooterLog(); - + finalizeBootStruct(); - + // Jump to kernel's entry point. There's no going back now. if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9"))) { @@ -205,18 +199,15 @@ execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // Masking out so that Lion doesn't doublefault - outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ - outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ - + startprog( kernelEntry, bootArgs ); - } - else { + } else { // Notify modules that the kernel is about to be started execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL); startprog( kernelEntry, bootArgsPreLion ); } - + // Not reached return 0; } @@ -225,17 +216,17 @@ //========================================================================== // LoadKernelCache - Try to load Kernel Cache. // return the length of the loaded cache file or -1 on error -long LoadKernelCache(const char* cacheFile, void **binary) { +long LoadKernelCache(const char* cacheFile, void **binary) +{ char kernelCacheFile[512]; char kernelCachePath[512]; long flags, time, cachetime, kerneltime, exttime, ret=-1; - unsigned long adler32; + unsigned long adler32; - if((gBootMode & kBootModeSafe) != 0) - { + if((gBootMode & kBootModeSafe) != 0) { verbose("Kernel Cache ignored.\n"); return -1; - } + } // Use specify kernel cache file if not empty if (cacheFile[0] != 0) @@ -247,65 +238,78 @@ // Lion, Mountain Lion and Mavericks prelink kernel cache file if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9"))) { - snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow); + snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow); } // Snow Leopard prelink kernel cache file else if (checkOSVersion("10.6")) { - snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s", - (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); - int lnam = strlen(kernelCacheFile) + 9; //with adler32 + snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s", + (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); + int lnam = strlen(kernelCacheFile) + 9; //with adler32 - char* name; - long prev_time = 0; + char* name; + long prev_time = 0; - struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); - /* TODO: handle error? */ - if (cacheDir) { - while (readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) { - if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time - && strstr(name, kernelCacheFile) && (name[lnam] != '.')) { - snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s%s", kDefaultCachePathSnow, name); - prev_time = time; - } - } - } - closedir(cacheDir); + struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); + /* TODO: handle error? */ + if (cacheDir) { + while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) { + if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time + && strstr(name, kernelCacheFile) && (name[lnam] != '.')) { + snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s%s", kDefaultCachePathSnow, name); + prev_time = time; + } + } + } + closedir(cacheDir); + } 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); } - 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); + } +/* Issue: http://forge.voodooprojects.org/p/chameleon/issues/270/ + // kernelCacheFile must start with a / + if (kernelCacheFile[0] != '/') + { + char *str = strdup(kernelCacheFile); + if (str == NULL) + { + return -1; } + sprintf(kernelCacheFile, "/%s", str); + free(str); } - +*/ // Check if the kernel cache file exists ret = -1; // If boot from a boot helper partition check the kernel cache file on it if (gBootVolume->flags & kBVFlagBooter) { - snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.P%s", kernelCacheFile); - ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); - if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.R%s", kernelCacheFile); - ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); - if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.S%s", kernelCacheFile); - ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); - if ((flags & kFileTypeMask) != kFileTypeFlat) - ret = -1; - } - } + snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.P%s", kernelCacheFile); + ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); + if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { + snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.R%s", kernelCacheFile); + ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); + if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) { + snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.S%s", kernelCacheFile); + ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); + if ((flags & kFileTypeMask) != kFileTypeFlat) { + ret = -1; + } + } + } } // If not found, use the original kernel cache path. if (ret == -1) { - strlcpy(kernelCachePath, kernelCacheFile, sizeof(kernelCachePath)); - ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); - if ((flags & kFileTypeMask) != kFileTypeFlat) - ret = -1; + strlcpy(kernelCachePath, kernelCacheFile, sizeof(kernelCachePath)); + ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime); + if ((flags & kFileTypeMask) != kFileTypeFlat) { + ret = -1; + } } // Exit if kernel cache file wasn't found @@ -373,19 +377,19 @@ int status; unsigned int allowBVFlags = kBVFlagSystemVolume | kBVFlagForeignBoot; unsigned int denyBVFlags = kBVFlagEFISystem; - + // Set reminder to unload the PXE base code. Neglect to unload // the base code will result in a hang or kernel panic. gUnloadPXEOnExit = true; - + // Record the device that the booter was loaded from. gBIOSDev = biosdev & kBIOSDevMask; - + // Initialize boot info structure. initKernBootStruct(); - + initBooterLog(); - + // Setup VGA text mode. // Not sure if it is safe to call setVideoMode() before the // config table has been loaded. Call video_mode() instead. @@ -396,39 +400,39 @@ #if DEBUG printf("after video_mode\n"); #endif - + // Scan and record the system's hardware information. scan_platform(); - + // First get info for boot volume. scanBootVolumes(gBIOSDev, 0); bvChain = getBVChainForBIOSDev(gBIOSDev); setBootGlobals(bvChain); - + // Load boot.plist config file status = loadChameleonConfig(&bootInfo->chameleonConfig); - + if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) { gBootMode |= kBootModeQuiet; } - + // Override firstRun to get to the boot menu instantly by setting "Instant Menu"=y in system config if (getBoolForKey(kInstantMenuKey, &instantMenu, &bootInfo->chameleonConfig) && instantMenu) { firstRun = false; } - + // Loading preboot ramdisk if exists. loadPrebootRAMDisk(); - + // Disable rescan option by default gEnableCDROMRescan = false; - + // Enable it with Rescan=y in system config if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->chameleonConfig) && gEnableCDROMRescan) { gEnableCDROMRescan = true; } - + // Ask the user for Rescan option by setting "Rescan Prompt"=y in system config. rescanPrompt = false; if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig) @@ -436,28 +440,28 @@ { gEnableCDROMRescan = promptForRescanOption(); } - + // Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config. if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig) && gScanSingleDrive) { gScanSingleDrive = true; } - + // Create a list of partitions on device(s). if (gScanSingleDrive) { scanBootVolumes(gBIOSDev, &bvCount); } else { scanDisks(gBIOSDev, &bvCount); } - + // Create a separated bvr chain using the specified filters. bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); - + gBootVolume = selectBootVolume(bvChain); - + // Intialize module system init_module_system(); - + #if DEBUG printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); @@ -474,9 +478,9 @@ // initGUI() returned with an error, disabling GUI. useGUI = false; } - + setBootGlobals(bvChain); - + // Parse args, load and start kernel. while (1) { @@ -486,7 +490,7 @@ int len, ret = -1; long flags, sleeptime, time; void *binary = (void *)kLoadAddr; - + char bootFile[sizeof(bootInfo->bootFile)]; char bootFilePath[512]; char kernelCacheFile[512]; @@ -494,11 +498,11 @@ // Initialize globals. sysConfigValid = false; gErrors = false; - + status = getBootOptions(firstRun); firstRun = false; if (status == -1) continue; - + status = processBootOptions(); // Status == 1 means to chainboot if ( status == 1 ) break; @@ -519,9 +523,9 @@ } continue; } - + // Other status (e.g. 0) means that we should proceed with boot. - + // Turn off any GUI elements if ( bootArgs->Video.v_display == GRAPHICS_MODE ) { @@ -533,74 +537,74 @@ drawBackground(); updateVRAM(); } - + // Find out which version mac os we're booting. getOSVersion(); - + if (platformCPUFeature(CPU_FEATURE_EM64T)) { archCpuType = CPU_TYPE_X86_64; } else { archCpuType = CPU_TYPE_I386; } - + if (getValueForKey(karch, &val, &len, &bootInfo->chameleonConfig)) { if (strncmp(val, "i386", 4) == 0) { archCpuType = CPU_TYPE_I386; } } - + if (getValueForKey(kKernelArchKey, &val, &len, &bootInfo->chameleonConfig)) { if (strncmp(val, "i386", 4) == 0) { archCpuType = CPU_TYPE_I386; } } - + // Notify modules that we are attempting to boot execute_hook("PreBoot", NULL, NULL, NULL, NULL); - + if (!getBoolForKey (kWake, &tryresume, &bootInfo->chameleonConfig)) { tryresume = true; tryresumedefault = true; } else { tryresumedefault = false; } - + if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig)) { forceresume = false; } - + if (forceresume) { tryresume = true; tryresumedefault = false; } - + while (tryresume) { const char *tmp; BVRef bvr; if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->chameleonConfig)) val = "/private/var/vm/sleepimage"; - + // Do this first to be sure that root volume is mounted ret = GetFileInfo(0, val, &flags, &sleeptime); - + if ((bvr = getBootVolumeRef(val, &tmp)) == NULL) break; - + // Can't check if it was hibernation Wake=y is required if (bvr->modTime == 0 && tryresumedefault) break; - + if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) break; - + if (!forceresume && ((sleeptime+3)modTime)) { -#if DEBUG +#if DEBUG printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n", bvr->modTime-sleeptime); -#endif +#endif break; } - + HibernateBoot((char *)val); break; } @@ -618,7 +622,7 @@ val++; } /* FIXME: check len vs sizeof(kernelCacheFile) */ - strlcpy(kernelCacheFile, val, len + 1); + strlcpy(kernelCacheFile, val, len + 1); } else { kernelCacheFile[0] = 0; // Use default kernel cache file } @@ -639,7 +643,7 @@ useKernelCache = false; } while(0); - + do { if (useKernelCache) { ret = LoadKernelCache(kernelCacheFile, &binary); @@ -680,7 +684,7 @@ // No alternate location found, using the original kernel image path. strlcpy(bootFilePath, bootFile, sizeof(bootFilePath)); } - + verbose("Loading kernel %s\n", bootFilePath); ret = LoadThinFatFile(bootFilePath, &binary); if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) @@ -689,18 +693,18 @@ ret = LoadThinFatFile(bootFilePath, &binary); } } while (0); - + clearActivityIndicator(); - + #if DEBUG printf("Pausing..."); sleep(8); #endif - + if (ret <= 0) { printf("Can't find %s\n", bootFile); sleep(1); - + if (gBootFileType == kNetworkDeviceType) { // Return control back to PXE. Don't unload PXE base code. gUnloadPXEOnExit = false; Index: branches/ErmaC/Enoch/i386/boot2/boot2.s =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot2.s (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/boot2.s (revision 2323) @@ -64,7 +64,7 @@ # # Returns: # -LABEL(boot2) +LABEL(boot2) # Entry point at 0:BOOTER_ADDR (will be called by boot1) pushl %ecx # Save general purpose registers pushl %ebx pushl %ebp Index: branches/ErmaC/Enoch/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2323) @@ -40,6 +40,10 @@ #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" + /* * Keys used in system Boot.plist */ @@ -105,6 +109,8 @@ /* Slice: added this */ #define kPS2RestartFix "PS2RestartFix" /* acpi_patcher.c */ +#define kInjectEDID "InjectEDID" /* ati.c*/ +#define kCustomEDID "CustomEDID" /* ati.c*/ /* Signal64: added this key */ #define kLegacyOff "USBLegacyOff" /* usb.c */ @@ -113,8 +119,25 @@ /* Meklort: added this key */ #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 */ /* Mojodojo: added these keys */ #define kGeneratePStates "GeneratePStates" /* acpi_patcher.c */ @@ -130,7 +153,7 @@ #define kDcfg1 "display_1" /* nvidia.c */ /* Marchrius: added these keys */ -#define kEnableBacklight "EnableBacklight" /* nvidia.c */ +#define kEnableBacklight "EnableBacklight" /* ati.c && nvidia.c */ /* Kabyl: added these keys */ #define kAtiConfig "AtiConfig" /* ati.c */ @@ -141,18 +164,26 @@ #define kEnableHDMIAudio "EnableHDMIAudio" /* ati.c && nvidia.c */ /* cparm: added these keys */ +#define kRebootOnPanic "RebootOnPanic" +#define kEnableHiDPI "EnableHiDPI" /* enable High resolution display (aka Retina) */ /* ErmaC: added these keys */ -#define kEnableDualLink "EnableDualLink" /* nvidia.c && gma.c*/ +#define kEnableDualLink "EnableDualLink" /* ati.c && nvidia.c && gma.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 kHDAPinConf "HDEFPinConfiguration" /* 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 */ @@ -193,10 +224,10 @@ * Boot Modes */ enum { - kBootModeNormal = 0, - kBootModeSafe = 1, - kBootModeSecure = 2, - kBootModeQuiet = 4 + kBootModeNormal = 0, + kBootModeSafe = 1, + kBootModeSecure = 2, + kBootModeQuiet = 4 }; extern void initialize_runtime(); @@ -215,16 +246,20 @@ extern int getVideoMode(); extern void spinActivityIndicator(); extern void clearActivityIndicator(); -extern void drawColorRectangle( unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, - unsigned char colorIndex ); -extern void drawDataRectangle( unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, - unsigned char * data ); +extern void drawColorRectangle( + unsigned short x, + unsigned short y, + unsigned short width, + unsigned short height, + unsigned char colorIndex + ); +extern void drawDataRectangle( + unsigned short x, + unsigned short y, + unsigned short width, + unsigned short height, + unsigned char * data + ); extern int convertImage( unsigned short width, unsigned short height, @@ -265,8 +300,8 @@ char *getMemoryInfoString(); typedef struct { - char name[80]; - void * param; + char name[80]; + void * param; } MenuItem; /* @@ -275,15 +310,15 @@ extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen); struct compressed_kernel_header { - u_int32_t signature; - u_int32_t compress_type; - u_int32_t adler32; - u_int32_t uncompressed_size; - u_int32_t compressed_size; - u_int32_t reserved[11]; - char platform_name[64]; - char root_path[256]; - u_int8_t data[0]; + u_int32_t signature; + u_int32_t compress_type; + u_int32_t adler32; + u_int32_t uncompressed_size; + u_int32_t compressed_size; + u_int32_t reserved[11]; + char platform_name[64]; + char root_path[256]; + u_int8_t data[0]; }; typedef struct compressed_kernel_header compressed_kernel_header; Index: branches/ErmaC/Enoch/i386/boot2/modules.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/modules.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/modules.c (revision 2323) @@ -105,15 +105,12 @@ long flags; long time; struct dirstuff* moduleDir = opendir("/Extra/modules/"); - while (readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) - { - if (strcmp(&name[strlen(name) - sizeof("dylib")], ".dylib") == 0) - { + while (readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) { + if(strcmp(&name[strlen(name) - sizeof("dylib")], ".dylib") == 0) { char* tmp = malloc(strlen(name) + 1); strcpy(tmp, name); - if (!load_module(tmp)) - { + if(!load_module(tmp)) { // failed to load // free(tmp); } @@ -122,8 +119,9 @@ { DBG("Ignoring %s\n", name); } + } - closedir(moduleDir); + closedir(moduleDir); } @@ -607,21 +605,18 @@ unsigned int binIndex = 0; index = 0; - do - { + do { segCommand = base + sizeof(struct mach_header) + binIndex; binIndex += segCommand->cmdsize; index++; - } - while(index <= immediate); + } while(index <= immediate); segmentAddress = segCommand->fileoff; tmp = 0; bits = 0; - do - { + do { tmp |= (rebase_stream[++i] & 0x7f) << bits; bits += 7; } @@ -630,18 +625,15 @@ segmentAddress += tmp; break; - case REBASE_OPCODE_ADD_ADDR_ULEB: // Add value to rebase address tmp = 0; bits = 0; - do - { + do { tmp <<= bits; tmp |= rebase_stream[++i] & 0x7f; bits += 7; - } - while(rebase_stream[i] & 0x80); + } while(rebase_stream[i] & 0x80); segmentAddress += tmp; break; @@ -649,8 +641,8 @@ case REBASE_OPCODE_ADD_ADDR_IMM_SCALED: segmentAddress += immediate * sizeof(void*); break; - - + + case REBASE_OPCODE_DO_REBASE_IMM_TIMES: index = 0; for (index = 0; index < immediate; ++index) { @@ -662,13 +654,11 @@ case REBASE_OPCODE_DO_REBASE_ULEB_TIMES: tmp = 0; bits = 0; - do - { + do { tmp |= (rebase_stream[++i] & 0x7f) << bits; bits += 7; - } - while(rebase_stream[i] & 0x80); - + } while(rebase_stream[i] & 0x80); + index = 0; for (index = 0; index < tmp; ++index) { //DBG("\tRebasing 0x%X\n", segmentAddress); @@ -680,12 +670,10 @@ case REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB: tmp = 0; bits = 0; - do - { + do { tmp |= (rebase_stream[++i] & 0x7f) << bits; bits += 7; - } - while(rebase_stream[i] & 0x80); + } while(rebase_stream[i] & 0x80); rebase_location(base + segmentAddress, (char*)base, type); @@ -695,23 +683,19 @@ case REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB: tmp = 0; bits = 0; - do - { + do { tmp |= (rebase_stream[++i] & 0x7f) << bits; bits += 7; - } - while(rebase_stream[i] & 0x80); + } while(rebase_stream[i] & 0x80); tmp2 = 0; bits = 0; - do - { + do { tmp2 |= (rebase_stream[++i] & 0x7f) << bits; bits += 7; - } - while(rebase_stream[i] & 0x80); - + } while(rebase_stream[i] & 0x80); + index = 0; for (index = 0; index < tmp; ++index) { @@ -730,23 +714,18 @@ UInt32 read_uleb(UInt8* bind_stream, unsigned int* i) { - // Read in offset - UInt32 tmp = 0; - UInt8 bits = 0; - do - { - if(bits < sizeof(UInt32)*8) // hack - { - tmp |= (bind_stream[++(*i)] & 0x7f) << bits; - bits += 7; - } - else - { - ++(*i); - } - } - while(bind_stream[*i] & 0x80); - return tmp; + // Read in offset + UInt32 tmp = 0; + UInt8 bits = 0; + do { + if(bits < sizeof(UInt32)*8) { // hack + tmp |= (bind_stream[++(*i)] & 0x7f) << bits; + bits += 7; + } else { + ++(*i); + } + } while(bind_stream[*i] & 0x80); + return tmp; } @@ -832,7 +811,7 @@ // Locate address struct segment_command* segCommand = NULL; // NOTE: 32bit only - + unsigned int binIndex = 0; index = 0; do @@ -985,14 +964,15 @@ UInt32 addr = lookup_all_symbols(symbol); if(addr != 0xFFFFFFFF) { - //DBG("Replacing %s to point to 0x%x\n", symbol, newAddress); - UInt32* jumpPointer = malloc(sizeof(UInt32*)); - char* binary = (char*)addr; - *binary++ = 0xFF; // Jump - *binary++ = 0x25; // Long Jump - *((UInt32*)binary) = (UInt32)jumpPointer; - *jumpPointer = (UInt32)newAddress; - return 1; + //DBG("Replacing %s to point to 0x%x\n", symbol, newAddress); + UInt32* jumpPointer = malloc(sizeof(UInt32*)); + char* binary = (char*)addr; + *binary++ = 0xFF; // Jump + *binary++ = 0x25; // Long Jump + *((UInt32*)binary) = (UInt32)jumpPointer; + + *jumpPointer = (UInt32)newAddress; + return 1; } return 0; } Index: branches/ErmaC/Enoch/i386/boot2/modules.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/modules.h (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/modules.h (revision 2323) @@ -94,9 +94,11 @@ long long(*symbol_handler)(char*, long long, char), char is64); void rebase_macho(void* base, char* rebase_stream, UInt32 size); + void bind_macho(void* base, UInt8* bind_stream, UInt32 size); + /********************************************************************************/ /* Module Interface */ /********************************************************************************/ Index: branches/ErmaC/Enoch/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2323) @@ -36,8 +36,8 @@ * ATTENTION: the enum and the following array images[] MUST match !!! */ enum { - iBackground = 0, - iLogo, + iBackground = 0, + iLogo, iDeviceGeneric, iDeviceGeneric_o, @@ -55,6 +55,7 @@ iDeviceHFS_Leo_o, iDeviceHFS_Tiger, iDeviceHFS_Tiger_o, + iDeviceHFSRAID, iDeviceHFSRAID_o, iDeviceHFSRAID_mav, @@ -69,6 +70,17 @@ iDeviceHFSRAID_Leo_o, iDeviceHFSRAID_Tiger, iDeviceHFSRAID_Tiger_o, + + iDeviceHFSRECOVERY, + iDeviceHFSRECOVERY_o, + + iDeviceHFSFUSION, + iDeviceHFSFUSION_o, + iDeviceHFSFUSION_mav, + iDeviceHFSFUSION_mav_o, + iDeviceHFSFUSION_ML, + iDeviceHFSFUSION_ML_o, + iDeviceEXT3, iDeviceEXT3_o, iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -149,6 +161,17 @@ {.name = "device_hfsraid_leo_o", .image = NULL}, {.name = "device_hfsraid_tiger", .image = NULL}, {.name = "device_hfsraid_tiger_o", .image = NULL}, + + {.name = "device_hfsrecovery", .image = NULL}, + {.name = "device_hfsrecovery_o", .image = NULL}, + + {.name = "device_hfsfusion", .image = NULL}, + {.name = "device_hfsfusion_o", .image = NULL}, + {.name = "device_hfsfusion_mav", .image = NULL}, + {.name = "device_hfsfusion_mav_o", .image = NULL}, + {.name = "device_hfsfusion_ml", .image = NULL}, + {.name = "device_hfsfusion_ml_o", .image = NULL}, + {.name = "device_ext3", .image = NULL}, {.name = "device_ext3_o", .image = NULL}, {.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -296,44 +319,43 @@ uint16_t height; uint8_t *imagedata; - if ((strlen(image) + strlen(theme_name) + 20) > sizeof(dirspec)) + if ((strlen(image) + strlen(theme_name) + 20) > sizeof(dirspec)) { return 1; - if ((i = getImageIndexByName(image)) < 0) + } + if ((i = getImageIndexByName(image)) < 0) { return 1; - if (!images[i].image && !(images[i].image = malloc(sizeof(pixmap_t)))) + } + if (!images[i].image && !(images[i].image = malloc(sizeof(pixmap_t)))) { return 1; - sprintf(dirspec, "/Extra/Themes/%s/%s.png", theme_name, image); - width = 0; - height = 0; - imagedata = NULL; - if ((loadPngImage(dirspec, &width, &height, &imagedata)) == 0) - { - images[i].image->width = width; - images[i].image->height = height; - images[i].image->pixels = (pixel_t *)imagedata; - flipRB(images[i].image); - return 0; - } + } + sprintf(dirspec, "/Extra/Themes/%s/%s.png", theme_name, image); + width = 0; + height = 0; + imagedata = NULL; + if ((loadPngImage(dirspec, &width, &height, &imagedata)) == 0) { + images[i].image->width = width; + images[i].image->height = height; + images[i].image->pixels = (pixel_t *)imagedata; + flipRB(images[i].image); + return 0; + } #ifdef CONFIG_EMBED_THEME - else if ((e = getEmbeddedImageIndexByName(image)) >= 0) - { - unsigned char *embed_data; - unsigned int embed_size; - embed_data = embeddedImages[e].pngdata; - embed_size = *embeddedImages[e].length; + else if ((e = getEmbeddedImageIndexByName(image)) >= 0) { + unsigned char *embed_data; + unsigned int embed_size; + embed_data = embeddedImages[e].pngdata; + embed_size = *embeddedImages[e].length; - if (loadEmbeddedPngImage(embed_data, embed_size, &width, &height, &imagedata) == 0) - { - images[i].image->width = width; - images[i].image->height = height; - images[i].image->pixels = (pixel_t *)imagedata; - flipRB(images[i].image); - return 0; + if (loadEmbeddedPngImage(embed_data, embed_size, &width, &height, &imagedata) == 0) { + images[i].image->width = width; + images[i].image->height = height; + images[i].image->pixels = (pixel_t *)imagedata; + flipRB(images[i].image); + return 0; } } #endif - else if (alt_image != IMG_REQUIRED && is_image_loaded(alt_image)) - { + else if (alt_image != IMG_REQUIRED && is_image_loaded(alt_image)) { // Using the passed alternate image for non-mandatory images. // We don't clone the already existing pixmap, but using its properties instead! images[i].image->width = images[alt_image].image->width; @@ -388,6 +410,17 @@ LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo); LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID); LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger); + + LOADPNG(device_hfsrecovery, iDeviceHFS); + LOADPNG(device_hfsrecovery_o, iDeviceHFSRECOVERY); + + LOADPNG(device_hfsfusion, iDeviceHFS); + LOADPNG(device_hfsfusion_o, iDeviceHFSFUSION); + LOADPNG(device_hfsfusion_mav, iDeviceHFSFUSION); + LOADPNG(device_hfsfusion_mav_o, iDeviceHFSFUSION_mav); + LOADPNG(device_hfsfusion_ml, iDeviceHFSFUSION); + LOADPNG(device_hfsfusion_ml_o, iDeviceHFSFUSION_ML); + LOADPNG(device_ext3, iDeviceGeneric); LOADPNG(device_ext3_o, iDeviceEXT3); LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */ @@ -440,17 +473,17 @@ static int unloadGraphics(void) { - int i; + int i; - destroyFont(&font_console); - destroyFont(&font_small); - for (i = 0; i < sizeof(images) / sizeof(images[0]); i++) - { - if (images[i].image) - { - if (images[i].image->pixels) free(images[i].image->pixels); - free (images[i].image); - images[i].image = 0; + destroyFont(&font_console); + destroyFont(&font_small); + for (i = 0; i < sizeof(images) / sizeof(images[0]); i++) { + if (images[i].image) { + if (images[i].image->pixels) { + free(images[i].image->pixels); + } + free (images[i].image); + images[i].image = 0; } } return 0; @@ -458,27 +491,26 @@ int freeBackBuffer( window_t *window ) { - if (gui.backbuffer && gui.backbuffer->pixels) - { - free(gui.backbuffer->pixels); - free(gui.backbuffer); - gui.backbuffer = 0; - return 0; - } + if (gui.backbuffer && gui.backbuffer->pixels) { + free(gui.backbuffer->pixels); + free(gui.backbuffer); + gui.backbuffer = 0; + return 0; + } - return 1; + return 1; } pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height ) { - pixmap_t *cropped = malloc( sizeof( pixmap_t ) ); - if( !cropped ) + if( !cropped ) { return 0; + } cropped->pixels = malloc( width * height * 4 ); - if ( !cropped->pixels ) + if ( !cropped->pixels ) { return 0; - + } cropped->width = width; cropped->height = height; @@ -540,13 +572,11 @@ int freeWindowBuffer( window_t *window ) { - if (window->pixmap && window->pixmap->pixels) - { + if (window->pixmap && window->pixmap->pixels) { free(window->pixmap->pixels); free(window->pixmap); return 0; } - return 1; } @@ -555,9 +585,11 @@ int x,y; // fill with given color AARRGGBB - for( x=0; x < pm->width; x++ ) - for( y=0; y< pm->height; y++) + for( x=0; x < pm->width; x++ ) { + for( y=0; y< pm->height; y++) { pixel(pm,x,y).value = color; + } + } } void drawBackground() @@ -574,7 +606,7 @@ // draw logo.png into background buffer if (gui.logo.draw) { - blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos); + blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos); } memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); @@ -583,16 +615,18 @@ void setupDeviceList(config_file_t *theme) { unsigned int pixel; - int alpha; // transparency level 0 (obligue) - 255 (transparent) + int alpha; // transparency level 0 (obligue) - 255 (transparent) uint32_t color; // color value formatted RRGGBB int val, len; const char *string; - if(getIntForKey("devices_max_visible", &val, theme )) + if(getIntForKey("devices_max_visible", &val, theme )) { gui.maxdevices = MIN( val, gDeviceCount ); + } - if(getIntForKey("devices_iconspacing", &val, theme )) + if(getIntForKey("devices_iconspacing", &val, theme )) { gui.devicelist.iconspacing = val; + } // check layout for horizontal or vertical gui.layout = HorizontalLayout; @@ -607,11 +641,13 @@ gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing); gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing); - if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) ) + if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) ) { gui.devicelist.pos.x = pixel; + } - if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) ) + if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) ) { gui.devicelist.pos.y = pixel; + } break; case HorizontalLayout: @@ -619,29 +655,33 @@ gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing); gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing); - if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) ) + if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) ) { gui.devicelist.pos.x = pixel; - else + } else { gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2; - + } + if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) ) + { gui.devicelist.pos.y = pixel; - else + } else { gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2; + } break; } - if(getColorForKey("devices_bgcolor", &color, theme)) + if(getColorForKey("devices_bgcolor", &color, theme)) { gui.devicelist.bgcolor = (color & 0x00FFFFFF); + } - if(getIntForKey("devices_transparency", &alpha, theme)) + if(getIntForKey("devices_transparency", &alpha, theme)) { gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24); + } - if (gui.devicelist.pixmap) - { - freeWindowBuffer(&gui.devicelist); - createWindowBuffer(&gui.devicelist); - } + if (gui.devicelist.pixmap) { + freeWindowBuffer(&gui.devicelist); + createWindowBuffer(&gui.devicelist); + } } void loadThemeValues(config_file_t *theme) @@ -649,21 +689,22 @@ unsigned int screen_width = gui.screen.width; unsigned int screen_height = gui.screen.height; unsigned int pixel; - int alpha; // transparency level 0 (obligue) - 255 (transparent) + int alpha; // transparency level 0 (obligue) - 255 (transparent) uint32_t color; // color value formatted RRGGBB int val; /* * Parse screen parameters */ - if(getColorForKey("screen_bgcolor", &color, theme )) + if(getColorForKey("screen_bgcolor", &color, theme )) { gui.screen.bgcolor = (color & 0x00FFFFFF); - - if(getIntForKey("screen_textmargin_h", &val, theme)) + } + if(getIntForKey("screen_textmargin_h", &val, theme)) { gui.screen.hborder = MIN( gui.screen.width , val ); - - if(getIntForKey("screen_textmargin_v", &val, theme)) + } + if(getIntForKey("screen_textmargin_v", &val, theme)) { gui.screen.vborder = MIN( gui.screen.height , val ); + } /* * Parse background parameters @@ -671,35 +712,47 @@ if(getDimensionForKey("background_pos_x", &pixel, theme, screen_width , images[iBackground].image->width ) ) gui.background.pos.x = pixel; - if(getDimensionForKey("background_pos_y", &pixel, theme, screen_height , images[iBackground].image->height ) ) + if(getDimensionForKey("background_pos_y", &pixel, theme, screen_height , images[iBackground].image->height ) ) { gui.background.pos.y = pixel; + } /* * Parse logo parameters */ - if(getDimensionForKey("logo_pos_x", &pixel, theme, screen_width , images[iLogo].image->width ) ) + if(getDimensionForKey("logo_pos_x", &pixel, theme, screen_width , images[iLogo].image->width ) ) { gui.logo.pos.x = pixel; + } if(getDimensionForKey("logo_pos_y", &pixel, theme, screen_height , images[iLogo].image->height ) ) + { gui.logo.pos.y = pixel; + } /* * Parse progress bar parameters */ if(getDimensionForKey("progressbar_pos_x", &pixel, theme, screen_width , 0 ) ) + { gui.progressbar.pos.x = pixel; + } if(getDimensionForKey("progressbar_pos_y", &pixel, theme, screen_height , 0 ) ) + { gui.progressbar.pos.y = pixel; + } /* * Parse countdown text parameters */ if(getDimensionForKey("countdown_pos_x", &pixel, theme, screen_width , 0 ) ) + { gui.countdown.pos.x = pixel; + } if(getDimensionForKey("countdown_pos_y", &pixel, theme, screen_height , 0 ) ) + { gui.countdown.pos.y = pixel; + } /* * Parse devicelist parameters @@ -710,92 +763,124 @@ * Parse infobox parameters */ if(getIntForKey("infobox_width", &val, theme)) + { gui.infobox.width = MIN( screen_width , val ); - + } if(getIntForKey("infobox_height", &val, theme)) + { gui.infobox.height = MIN( screen_height , val ); - + } if(getDimensionForKey("infobox_pos_x", &pixel, theme, screen_width , gui.infobox.width ) ) + { gui.infobox.pos.x = pixel; - + } if(getDimensionForKey("infobox_pos_y", &pixel, theme, screen_height , gui.infobox.height ) ) + { gui.infobox.pos.y = pixel; - + } if(getIntForKey("infobox_textmargin_h", &val, theme)) + { gui.infobox.hborder = MIN( gui.infobox.width , val ); - + } if(getIntForKey("infobox_textmargin_v", &val, theme)) + { gui.infobox.vborder = MIN( gui.infobox.height , val ); - + } if(getColorForKey("infobox_bgcolor", &color, theme)) + { gui.infobox.bgcolor = (color & 0x00FFFFFF); - + } if(getIntForKey("infobox_transparency", &alpha, theme)) + { gui.infobox.bgcolor = gui.infobox.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24); - + } /* * Parse menu parameters */ if(getDimensionForKey("menu_width", &pixel, theme, gui.screen.width , 0 ) ) + { gui.menu.width = pixel; + } else + { gui.menu.width = images[iMenuSelection].image->width; - + } if(getDimensionForKey("menu_height", &pixel, theme, gui.screen.height , 0 ) ) + { gui.menu.height = pixel; + } else + { gui.menu.height = (infoMenuItemsCount) * images[iMenuSelection].image->height; - + } if(getDimensionForKey("menu_pos_x", &pixel, theme, screen_width , gui.menu.width ) ) + { gui.menu.pos.x = pixel; - + } if(getDimensionForKey("menu_pos_y", &pixel, theme, screen_height , gui.menu.height ) ) + { gui.menu.pos.y = pixel; - + } if(getIntForKey("menu_textmargin_h", &val, theme)) + { gui.menu.hborder = MIN( gui.menu.width , val ); - + } if(getIntForKey("menu_textmargin_v", &val, theme)) + { gui.menu.vborder = MIN( gui.menu.height , val ); - + } if(getColorForKey("menu_bgcolor", &color, theme)) + { gui.menu.bgcolor = (color & 0x00FFFFFF); - + } if(getIntForKey("menu_transparency", &alpha, theme)) + { gui.menu.bgcolor = gui.menu.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24); + } /* * Parse bootprompt parameters */ if(getDimensionForKey("bootprompt_width", &pixel, theme, screen_width , 0 ) ) + { gui.bootprompt.width = pixel; - + } if(getIntForKey("bootprompt_height", &val, theme)) + { gui.bootprompt.height = MIN( screen_height , val ); - + } if(getDimensionForKey("bootprompt_pos_x", &pixel, theme, screen_width , gui.bootprompt.width ) ) + { gui.bootprompt.pos.x = pixel; - + } if(getDimensionForKey("bootprompt_pos_y", &pixel, theme, screen_height , gui.bootprompt.height ) ) + { gui.bootprompt.pos.y = pixel; - + } if(getIntForKey("bootprompt_textmargin_h", &val, theme)) + { gui.bootprompt.hborder = MIN( gui.bootprompt.width , val ); - + } if(getIntForKey("bootprompt_textmargin_v", &val, theme)) + { gui.bootprompt.vborder = MIN( gui.bootprompt.height , val ); - + } if(getColorForKey("bootprompt_bgcolor", &color, theme)) + { gui.bootprompt.bgcolor = (color & 0x00FFFFFF); - + } if(getIntForKey("bootprompt_transparency", &alpha, theme)) + { gui.bootprompt.bgcolor = gui.bootprompt.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24); - + } if(getColorForKey("font_small_color", &color, theme)) + { gui.screen.font_small_color = (color & 0x00FFFFFF); - + } if(getColorForKey("font_console_color", &color, theme)) + { gui.screen.font_console_color = (color & 0x00FFFFFF); + } } int initGUI(void) @@ -811,12 +896,12 @@ sprintf(dirspec, "/Extra/Themes/%s/theme.plist", theme_name); if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) { #ifdef CONFIG_EMBED_THEME - config_file_t *config; + config_file_t *config; - config = &bootInfo->themeConfig; - if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) { - return 1; - } + config = &bootInfo->themeConfig; + if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) { + return 1; + } #else return 1; #endif @@ -852,7 +937,7 @@ if (createWindowBuffer(&gui.bootprompt) == 0) { if (createWindowBuffer(&gui.infobox) == 0) { if (createWindowBuffer(&gui.menu) == 0) { - gui.logo.draw = true; + gui.logo.draw = true; drawBackground(); // lets copy the screen into the back buffer memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); @@ -888,10 +973,9 @@ { int devicetype; - if( diskIsCDROM(device) ) + if( diskIsCDROM(device) ) { devicetype = iDeviceCDROM; // Use CDROM icon - else - { + } else { switch (device->part_type) { case kPartitionTypeHFS: @@ -900,9 +984,11 @@ switch (device->OSVersion[3]) { case '9': devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_mav : iDeviceHFS_mav); + //devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSFUSION_mav : iDeviceHFS_mav); break; case '8': devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_ML : iDeviceHFS_ML); + //devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSFUSION_ML : iDeviceHFS_ML); break; case '7': devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_Lion : iDeviceHFS_Lion); @@ -923,7 +1009,11 @@ break; - } + } + //case kPartitionTypeOSXBoot: + // devicetype = iDeviceHFSRECOVERY; // Use Recovery icon + // break; + case kPartitionTypeHPFS: devicetype = iDeviceNTFS; // Use HPFS / NTFS icon break; @@ -1020,23 +1110,26 @@ { BVRef param = menuItems[start + i].param; - bool isSelected = ((start + i) == selection) ? true : false; + bool isSelected = ((start + i) == selection) ? true : false; if (isSelected) { - if (param->flags & kBVFlagNativeBoot) - { - infoMenuNativeBoot = true; - } - else - { - infoMenuNativeBoot = false; - if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END) - infoMenuSelection = 0; - } + if (param->flags & kBVFlagNativeBoot) + { + infoMenuNativeBoot = true; + } + else + { + infoMenuNativeBoot = false; + if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END) + { + infoMenuSelection = 0; + } + } if (gui.menu.draw) + { drawInfoMenuItems(); - + } getBoolForKey(kShowInfoKey, &shoWinfo, &bootInfo->chameleonConfig); if (shoWinfo && showBootBanner) @@ -1075,12 +1168,14 @@ // draw prev indicator if (start) + { blend( images[iDeviceScrollPrev].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollPrev].image, p_prev ) ); - + } // draw next indicator if ( end < gDeviceCount - 1 ) + { blend( images[iDeviceScrollNext].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollNext].image, p_next ) ); - + } gui.redraw = true; updateVRAM(); @@ -1094,7 +1189,7 @@ //prompt_pos=0; - if( gui.bootprompt.draw == true ) + if( gui.bootprompt.draw == true ) { gui.bootprompt.draw = false; gui.redraw = true; @@ -1134,12 +1229,15 @@ void vramwrite (void *data, int width, int height) { if (VIDEO (depth) == 32 && VIDEO (rowBytes) == gui.backbuffer->width * 4) + { memcpy((uint8_t *)vram, gui.backbuffer->pixels, VIDEO (rowBytes)*VIDEO (height)); + } else { uint32_t r, g, b; int i, j; for (i = 0; i < VIDEO (height); i++) + { for (j = 0; j < VIDEO (width); j++) { b = ((uint8_t *) data)[4*i*width + 4*j]; @@ -1163,6 +1261,7 @@ break; } } + } } } @@ -1171,16 +1270,21 @@ if (gui.redraw) { if (gui.devicelist.draw) + { blend( gui.devicelist.pixmap, gui.backbuffer, gui.devicelist.pos ); - + } if (gui.bootprompt.draw) + { blend( gui.bootprompt.pixmap, gui.backbuffer, gui.bootprompt.pos ); - + } if (gui.menu.draw) + { blend( gui.menu.pixmap, gui.backbuffer, gui.menu.pos ); - + } if (gui.infobox.draw) + { blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos ); + } } vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height ); @@ -1194,20 +1298,23 @@ struct putc_info //Azi: exists on console.c & printf.c { - char * str; - char * last_str; + char * str; + char * last_str; }; static int sputc(int c, struct putc_info * pi) //Azi: same as above { - if (pi->last_str) - if (pi->str == pi->last_str) { - *(pi->str) = '\0'; - return 0; - } - *(pi->str)++ = c; - return c; + if (pi->last_str) + { + if (pi->str == pi->last_str) + { + *(pi->str) = '\0'; + return 0; + } + } + *(pi->str)++ = c; + return c; } int gprintf( window_t * window, const char * fmt, ...) @@ -1255,18 +1362,22 @@ cursor.y += font->height; if ( cursor.y > bounds.y ) + { cursor.y = origin.y; - + } continue; } // tab ? if( formattedtext[i] == '\t' ) + { cursor.x += ( font->chars[0]->width * 5 ); - + } + // draw the character - if( font->chars[character]) + if( font->chars[character]) { blend(font->chars[character], window->pixmap, cursor); + } cursor.x += font->chars[character]->width; @@ -1278,8 +1389,9 @@ } // check y pos and reset to origin.y - if ( cursor.y > bounds.y ) + if ( cursor.y > bounds.y ) { cursor.y = origin.y; + } } // update cursor postition @@ -1340,19 +1452,22 @@ cursor.y += font->height; if ( cursor.y > bounds.y ) + { cursor.y = origin.y; - + } continue; } // tab ? if( formattedtext[i] == '\t' ) + { cursor.x += ( font->chars[0]->width * 5 ); - + } // draw the character if( font->chars[character]) + { blend(font->chars[character], gui.backbuffer, cursor); - + } cursor.x += font->chars[character]->width; // check x pos and do newline @@ -1364,7 +1479,9 @@ // check y pos and reset to origin.y if ( cursor.y > bounds.y ) + { cursor.y = origin.y; + } } // update cursor postition @@ -1447,7 +1564,9 @@ } // draw the character if( font->chars[character]) + { blend(font->chars[character], gui.backbuffer, cursor); + } } // save cursor postition window->cursor.x = cursor.x; @@ -1461,9 +1580,10 @@ pixmap_t* charToPixmap(unsigned char ch, font_t *font) { unsigned int cha = (unsigned int)ch - 32; if (cha >= font->count) + { // return ? if the font for the char doesn't exists cha = '?' - 32; - + } return font->chars[cha] ? font->chars[cha] : NULL; } @@ -1475,7 +1595,9 @@ return pos(p.x + pm->width, p.y); } else + { return p; + } } void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p) @@ -1519,15 +1641,21 @@ height += font->height; } else if (text[i] == '\t') + { width += TAB_PIXELS_WIDTH; + } else { pixmap_t* pm = charToPixmap(text[i], font); if (pm) + { width += pm->width; + } } if (width > max_width) + { max_width = width; + } } p.x = ( p.x - ( max_width / 2 ) ); @@ -1538,17 +1666,20 @@ int destroyFont(font_t *font) { - int i; - for (i = 0; i < CHARACTERS_COUNT; i++) - { - if (font->chars[i]) - { - if (font->chars[i]->pixels) free (font->chars[i]->pixels); - free (font->chars[i]); - font->chars[i] = 0; - } - } - return 0; + int i; + for (i = 0; i < CHARACTERS_COUNT; i++) + { + if (font->chars[i]) + { + if (font->chars[i]->pixels) + { + free (font->chars[i]->pixels); + } + free (font->chars[i]); + font->chars[i] = 0; + } + } + return 0; } int initFont(font_t *font, image_t *data) @@ -1589,7 +1720,9 @@ // check if font is monospaced if( ( count > 0 ) && ( font->width != font->chars[count]->width ) ) + { monospaced = true; + } font->width = font->chars[count]->width; @@ -1600,10 +1733,14 @@ } for (x = count; x < CHARACTERS_COUNT; x++) + { font->chars[x] = NULL; + } if(monospaced) + { font->width = 0; + } font->count = count; @@ -1613,8 +1750,10 @@ void colorFont(font_t *font, uint32_t color) { if( !color ) + { return; - + } + int x, y, width, height; int count = 0; pixel_t *buff; @@ -1695,33 +1834,37 @@ int cnt=0; int offset=0; - if( !title || !text_orig ) + if( !title || !text_orig ) { return; - + } + // Create a copy so that we don't mangle the original text = malloc(strlen(text_orig) + 1); strcpy(text, text_orig); - - + position_t pos_title = pos ( gui.infobox.vborder, gui.infobox.vborder ); // calculate number of lines in the title for ( i = 0, lines = 1; iwidth - ( gui.infobox.vborder / 2) ), pos_text.y ); // draw prev indicator @@ -1787,12 +1938,20 @@ key = getchar(); if( key == KEY_UP ) + { if( currentline > 0 ) + { currentline--; + } + } if( key == KEY_DOWN ) + { if( lines > ( currentline + visiblelines ) ) + { currentline++; + } + } if( key == KEY_ESC || key == 'q' || key == 'Q') { @@ -1804,14 +1963,17 @@ if(key == ' ') // spacebar = next page { - if( lines > ( currentline + visiblelines ) ) + if( lines > ( currentline + visiblelines ) ) + { currentline += visiblelines; - + } if(lines < (currentline + visiblelines)) + { currentline = lines - visiblelines; + } } } - free(text); + free(text); } void animateProgressBar() @@ -1829,31 +1991,35 @@ memcpy( buffBar->pixels, buffBar->pixels + 1, ( (buffBar->width*buffBar->height) - 1 ) * 4 ); for( y = buffBar->height - 1; y > 0; y--) + { pixel(buffBar, buffBar->width - 1, y) = pixel(buffBar, buffBar->width - 1, y - 1); - + } pixel(buffBar, buffBar->width-1, 0).value = buff; } } void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress) { - if(progress>100) + if(progress>100) { return; - + } + p.x = ( p.x - ( width / 2 ) ); int todraw = (width * progress) / 100; pixmap_t *buff = images[iProgressBar].image; pixmap_t *buffBG = images[iProgressBarBackground].image; - if(!buff || !buffBG) + if(!buff || !buffBG) { return; - + } + pixmap_t progressbar; progressbar.pixels=malloc(width * 4 * buff->height); - if(!progressbar.pixels) + if(!progressbar.pixels) { return; - + } + progressbar.width = width; progressbar.height = buff->height; @@ -1863,7 +2029,10 @@ { for(x=0; xwidth-1)) x2=0; + if(x2 == (buff->width-1)) + { + x2=0; + } pixel(&progressbar, x,y).value = pixel(buff, x2,y).value; } x2=0; @@ -1873,13 +2042,22 @@ { for(x=todraw, x2 = 0; x < width - 1; x++, x2++) { - if(x2 == (buffBG->width -2 )) x2 = 0; + if(x2 == (buffBG->width -2 )) + { + x2 = 0; + } pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value; } if(progress < 100) + { pixel(&progressbar, width - 1, y).value = pixel(buffBG, buffBG->width - 1, y).value; + } + if(progress == 0) + { pixel(&progressbar, 0, y).value = pixel(buffBG, buffBG->width - 1, y).value; + } + x2=0; } @@ -1982,9 +2160,13 @@ if (infoMenuSelection < infoMenuItemsCount - 1) { if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_START - 1) + { infoMenuSelection += 4; + } else + { infoMenuSelection++; + } drawInfoMenuItems(); updateVRAM(); } @@ -1993,14 +2175,17 @@ case KEY_ENTER: key = 0; if( infoMenuSelection == MENU_SHOW_MEMORY_INFO ) + { showInfoBox( "Memory Info. Press q to quit.\n", getMemoryInfoString()); - + } else if( infoMenuSelection == MENU_SHOW_VIDEO_INFO ) + { showInfoBox( getVBEInfoString(), getVBEModeInfoString() ); - + } else if( infoMenuSelection == MENU_SHOW_HELP ) + { showHelp(); - + } else { int buff = infoMenuSelection; @@ -2034,7 +2219,7 @@ sprintf(dirspec, "/Extra/Themes/%s/boot.png", theme_name); if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) { #ifdef CONFIG_EMBED_THEME - if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) + if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) #endif usePngImage = false; } @@ -2069,7 +2254,7 @@ screen_params[1] = DEFAULT_SCREEN_HEIGHT; } - // Save current screen resolution. + // Save current screen resolution. oldScreenWidth = gui.screen.width; oldScreenHeight = gui.screen.height; @@ -2079,9 +2264,8 @@ // find best matching vesa mode for our requested width & height getGraphicModeParams(screen_params); - // Set graphics mode if the booter was in text mode or the screen resolution has changed. - if (bootArgs->Video.v_display == VGA_TEXT_MODE - || (screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight) ) + // Set graphics mode if the booter was in text mode or the screen resolution has changed. + if (bootArgs->Video.v_display == VGA_TEXT_MODE || (screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight) ) { setVideoMode(GRAPHICS_MODE, 0); } Index: branches/ErmaC/Enoch/i386/boot2/IOHibernatePrivate.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/IOHibernatePrivate.h (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/IOHibernatePrivate.h (revision 2323) @@ -36,81 +36,81 @@ struct IOPolledFileExtent { - uint64_t start; - uint64_t length; + uint64_t start; + uint64_t length; }; typedef struct IOPolledFileExtent IOPolledFileExtent; struct IOHibernateImageHeader { - uint64_t imageSize; - uint64_t image1Size; + uint64_t imageSize; + uint64_t image1Size; - uint32_t restore1CodePage; - uint32_t restore1PageCount; - uint32_t restore1CodeOffset; - uint32_t restore1StackOffset; + uint32_t restore1CodePage; + uint32_t restore1PageCount; + uint32_t restore1CodeOffset; + uint32_t restore1StackOffset; - uint32_t pageCount; - uint32_t bitmapSize; + uint32_t pageCount; + uint32_t bitmapSize; - uint32_t restore1Sum; - uint32_t image1Sum; - uint32_t image2Sum; + uint32_t restore1Sum; + uint32_t image1Sum; + uint32_t image2Sum; - uint32_t actualRestore1Sum; - uint32_t actualImage1Sum; - uint32_t actualImage2Sum; + uint32_t actualRestore1Sum; + uint32_t actualImage1Sum; + uint32_t actualImage2Sum; - uint32_t actualUncompressedPages; - uint32_t conflictCount; - uint32_t nextFree; + uint32_t actualUncompressedPages; + uint32_t conflictCount; + uint32_t nextFree; - uint32_t signature; - uint32_t processorFlags; + uint32_t signature; + uint32_t processorFlags; - uint32_t runtimePages; - uint32_t runtimePageCount; + uint32_t runtimePages; + uint32_t runtimePageCount; - uint8_t reserved2[16]; + uint8_t reserved2[16]; - uint64_t encryptStart; - uint64_t machineSignature; + uint64_t encryptStart; + uint64_t machineSignature; - uint32_t previewSize; - uint32_t previewPageListSize; + uint32_t previewSize; + uint32_t previewPageListSize; - uint32_t diag[4]; + uint32_t diag[4]; - int32_t graphicsInfoOffset; - int32_t cryptVarsOffset; - int32_t memoryMapOffset; - uint32_t memoryMapSize; - uint32_t systemTableOffset; + int32_t graphicsInfoOffset; + int32_t cryptVarsOffset; + int32_t memoryMapOffset; + uint32_t memoryMapSize; + uint32_t systemTableOffset; - uint32_t reserved[77]; // make sizeof == 512 + uint32_t reserved[77]; // make sizeof == 512 - uint32_t fileExtentMapSize; - IOPolledFileExtent fileExtentMap[2]; + uint32_t fileExtentMapSize; + IOPolledFileExtent fileExtentMap[2]; }; typedef struct IOHibernateImageHeader IOHibernateImageHeader; struct hibernate_bitmap_t { - uint32_t first_page; - uint32_t last_page; - uint32_t bitmapwords; - uint32_t bitmap[0]; + uint32_t first_page; + uint32_t last_page; + uint32_t bitmapwords; + uint32_t bitmap[0]; }; typedef struct hibernate_bitmap_t hibernate_bitmap_t; struct hibernate_page_list_t { - uint32_t list_size; - uint32_t page_count; - uint32_t bank_count; - hibernate_bitmap_t bank_bitmap[0]; + uint32_t list_size; + uint32_t page_count; + uint32_t bank_count; + hibernate_bitmap_t bank_bitmap[0]; }; typedef struct hibernate_page_list_t hibernate_page_list_t; @@ -118,14 +118,14 @@ struct hibernate_cryptwakevars_t { - uint8_t aes_iv[AES_BLOCK_SIZE]; + uint8_t aes_iv[AES_BLOCK_SIZE]; }; typedef struct hibernate_cryptwakevars_t hibernate_cryptwakevars_t; struct hibernate_cryptvars_t { - uint8_t aes_iv[AES_BLOCK_SIZE]; - aes_ctx ctx; + uint8_t aes_iv[AES_BLOCK_SIZE]; + aes_ctx ctx; }; typedef struct hibernate_cryptvars_t hibernate_cryptvars_t; @@ -134,38 +134,38 @@ enum { - kIOHibernateProgressCount = 19, - kIOHibernateProgressWidth = 7, - kIOHibernateProgressHeight = 16, - kIOHibernateProgressSpacing = 3, - kIOHibernateProgressOriginY = 81, + kIOHibernateProgressCount = 19, + kIOHibernateProgressWidth = 7, + kIOHibernateProgressHeight = 16, + kIOHibernateProgressSpacing = 3, + kIOHibernateProgressOriginY = 81, - kIOHibernateProgressSaveUnderSize = 2*5+14*2, + kIOHibernateProgressSaveUnderSize = 2*5+14*2, - kIOHibernateProgressLightGray = 230, - kIOHibernateProgressMidGray = 174, - kIOHibernateProgressDarkGray = 92 + kIOHibernateProgressLightGray = 230, + kIOHibernateProgressMidGray = 174, + kIOHibernateProgressDarkGray = 92 }; enum { - kIOHibernatePostWriteSleep = 0, - kIOHibernatePostWriteWake = 1, - kIOHibernatePostWriteHalt = 2, - kIOHibernatePostWriteRestart = 3 + kIOHibernatePostWriteSleep = 0, + kIOHibernatePostWriteWake = 1, + kIOHibernatePostWriteHalt = 2, + kIOHibernatePostWriteRestart = 3 }; struct hibernate_graphics_t { - uint32_t physicalAddress; // Base address of video memory - uint32_t mode; // - uint32_t rowBytes; // Number of bytes per pixel row - uint32_t width; // Width - uint32_t height; // Height - uint32_t depth; // Pixel Depth + uint32_t physicalAddress; // Base address of video memory + uint32_t mode; // + uint32_t rowBytes; // Number of bytes per pixel row + uint32_t width; // Width + uint32_t height; // Height + uint32_t depth; // Pixel Depth - uint8_t progressSaveUnder[kIOHibernateProgressCount][kIOHibernateProgressSaveUnderSize]; + uint8_t progressSaveUnder[kIOHibernateProgressCount][kIOHibernateProgressSaveUnderSize]; }; typedef struct hibernate_graphics_t hibernate_graphics_t; Index: branches/ErmaC/Enoch/i386/boot2/gui.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/gui.h (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/gui.h (revision 2323) @@ -64,7 +64,7 @@ uint16_t height; // Font Height uint16_t width; // Font Width for monospace font only pixmap_t *chars[CHARACTERS_COUNT]; - uint16_t count; // Number of chars in font + uint16_t count; // Number of chars in font } font_t; /* Index: branches/ErmaC/Enoch/i386/boot2/ramdisk.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/ramdisk.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/ramdisk.c (revision 2323) @@ -29,17 +29,17 @@ &bootInfo->chameleonConfig)) { // Use user specified md0 file - snprintf(filename, sizeof(filename), "%s", override_filename); + snprintf(filename, sizeof(filename), "%s", override_filename); fh = open(filename, 0); if(fh < 0) { - snprintf(filename, sizeof(filename), "rd(0,0)/Extra/%s", override_filename); + snprintf(filename, sizeof(filename), "rd(0,0)/Extra/%s", override_filename); fh = open(filename, 0); if(fh < 0) { - snprintf(filename, sizeof(filename), "/Extra/%s", override_filename); + snprintf(filename, sizeof(filename), "/Extra/%s", override_filename); fh = open(filename, 0); } } @@ -151,7 +151,7 @@ if (error == 0) { // Save filename in gRAMDiskFile to display information. - strlcpy(gRAMDiskFile, param, sizeof(gRAMDiskFile)); + strlcpy(gRAMDiskFile, param, sizeof(gRAMDiskFile)); // Set gMI as well for the multiboot ramdisk driver hook. gMI = gRAMDiskMI = malloc(sizeof(multiboot_info)); Index: branches/ErmaC/Enoch/i386/boot2/lzss.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/lzss.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/lzss.c (revision 2323) @@ -42,51 +42,58 @@ #include -#define N 4096 /* size of ring buffer - must be power of 2 */ -#define F 18 /* upper limit for match_length */ -#define THRESHOLD 2 /* encode string into position and length - if match_length is greater than this */ -#define NIL N /* index for root of binary search trees */ +#define N 4096 /* Size of ring buffer - must be power of 2. */ +#define N_MIN_1 4095 +#define F 18 /* Upper limit for match_length. */ +#define R N - F +#define THRESHOLD 2 /* Encode string into position and length if match_length is greater than this. */ +#define NIL N /* Index for root of binary search trees. */ -int -decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen) + +//============================================================================== +// Refactoring and bug fix Copyright (c) 2010 by DHP. + +int decompress_lzss(u_int8_t * dst, u_int8_t * src, u_int32_t srclen) { - /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ - u_int8_t text_buf[N + F - 1]; - u_int8_t *dststart = dst; - u_int8_t *srcend = src + srclen; - int i, j, k, r, c; - unsigned int flags; - - dst = dststart; - srcend = src + srclen; - for (i = 0; i < N - F; i++) - text_buf[i] = ' '; - r = N - F; - flags = 0; - for ( ; ; ) { - if (((flags >>= 1) & 0x100) == 0) { - if (src < srcend) c = *src++; else break; - flags = c | 0xFF00; /* uses higher byte cleverly */ - } /* to count eight */ - if (flags & 1) { - if (src < srcend) c = *src++; else break; - *dst++ = c; - text_buf[r++] = c; - r &= (N - 1); - } else { - if (src < srcend) i = *src++; else break; - if (src < srcend) j = *src++; else break; - i |= ((j & 0xF0) << 4); - j = (j & 0x0F) + THRESHOLD; - for (k = 0; k <= j; k++) { - c = text_buf[(i + k) & (N - 1)]; - *dst++ = c; - text_buf[r++] = c; - r &= (N - 1); - } - } - } - - return dst - dststart; + /* Four KB ring buffer with 17 extra bytes added to aid string comparisons. */ + u_int8_t text_buf[N_MIN_1 + F]; + u_int8_t * dststart = dst; + const u_int8_t * srcend = (src + srclen); + + int r = R; + int i, j, k, c; + unsigned int flags = 0; + + for (i = 0; i < R; i++) { + text_buf[i] = ' '; + } + + while (src < srcend) { + if (((flags >>= 1) & 0x100) == 0) { + c = *src++; + flags = c | 0xFF00; // Clever use of the high byte. + } + + if ((src < srcend) && (flags & 1)) { + c = *src++; + *dst++ = c; + text_buf[r++] = c; + r &= N_MIN_1; + } else if ((src + 2) <= srcend) { + i = *src++; + j = *src++; + + i |= ((j & 0xF0) << 4); + j = (j & 0x0F) + THRESHOLD; + + for (k = 0; k <= j; k++) { + c = text_buf[(i + k) & N_MIN_1]; + *dst++ = c; + text_buf[r++] = c; + r &= N_MIN_1; + } + } + } + + return dst - dststart; } Index: branches/ErmaC/Enoch/i386/boot2/options.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/options.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/options.c (revision 2323) @@ -189,7 +189,6 @@ if (bootArgs->Video.v_display != VGA_TEXT_MODE) { clearGraphicBootPrompt(); } - execute_hook("ClearArgs", NULL, NULL, NULL, NULL); } @@ -228,7 +227,7 @@ } } else { if (bootArgs->Video.v_display != VGA_TEXT_MODE) { - clearGraphicBootPrompt(); + clearGraphicBootPrompt(); } else { printf("Press Enter to start up the foreign OS. "); } @@ -254,8 +253,10 @@ { x = 80; y--; } - if (x) x--; - + if (x) { + x--; + } + if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { setCursorPosition( x, y, 0 ); @@ -641,28 +642,29 @@ char *getMemoryInfoString() { - int i, bufflen; - MemoryRange *mp = bootInfo->memoryMap; - char *buff = malloc(sizeof(char)*1024); - if (!buff) - return 0; - - static const char info[] = "BIOS reported memory ranges:\n"; - bufflen = sprintf(buff, "%s", info); + int i, bufflen; + MemoryRange *mp = bootInfo->memoryMap; + char *buff = malloc(sizeof(char)*1024); + if(!buff) { + return 0; + } - for (i = 0; - (i < bootInfo->memoryMapCount) && (bufflen < 1024); /* prevent buffer overflow */ - i++) { - bufflen += snprintf(buff+bufflen, 1024-bufflen, "Base 0x%08x%08x, ", + static const char info[] = "BIOS reported memory ranges:\n"; + bufflen = sprintf(buff, "%s", info); + + for (i = 0; + (i < bootInfo->memoryMapCount) && (bufflen < 1024); /* prevent buffer overflow */ + i++) { + bufflen += snprintf(buff+bufflen, 1024-bufflen, "Base 0x%08x%08x, ", (unsigned long)(mp->base >> 32), (unsigned long)(mp->base)); - bufflen += snprintf(buff+bufflen, 1024-bufflen, "length 0x%08x%08x, type %d\n", + bufflen += snprintf(buff+bufflen, 1024-bufflen, "length 0x%08x%08x, type %d\n", (unsigned long)(mp->length >> 32), (unsigned long)(mp->length), mp->type); - mp++; - } - return buff; + mp++; + } + return buff; } //========================================================================== @@ -1086,31 +1088,29 @@ 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 argLen = argName ? strlen(argName) : 0; + int len = argLen + cnt + 1; // + 1 to account for space. - if (argName) + if (len > *cntRemainingP) { + error("Warning: boot arguments too long, truncating\n"); + return false; + } + + if (argName) { + strncpy( *argP, argName, argLen ); + *argP += argLen; + *argP[0] = '='; + (*argP)++; len++; // +1 to account for '=' + } - if (len > *cntRemainingP) { - error("Warning: boot arguments too long, truncating\n"); - return false; - } + strncpy(*argP, val, cnt); + *argP += cnt; + *argP[0] = ' '; + (*argP)++; + *cntRemainingP -= len; - if (argName) { - strncpy( *argP, argName, argLen ); - *argP += argLen; - *argP[0] = '='; - (*argP)++; - } - - strncpy( *argP, val, cnt ); - *argP += cnt; - *argP[0] = ' '; - (*argP)++; - - *cntRemainingP -= len; - return true; + return true; } // @@ -1131,19 +1131,26 @@ int cnt; bool found = false; - if (getValueForBootKey(userString, argName, &val, &cnt)) { - // Don't copy; these values will be copied at the end of argument processing. - found = true; - } else if (getValueForBootKey(kernelFlags, argName, &val, &cnt)) { - // Don't copy; these values will be copied at the end of argument processing. - found = true; - } else if (getValueForKey(argName, &val, &cnt, &bootInfo->chameleonConfig)) { - copyArgument(argName, val, cnt, argP, cntRemainingP); - found = true; - } - if (found && foundVal) - strlcpy(foundVal, val, foundValSize); - return found; + if (getValueForBootKey(userString, argName, &val, &cnt)) + { + // Don't copy; these values will be copied at the end of argument processing. + found = true; + } + else if (getValueForBootKey(kernelFlags, argName, &val, &cnt)) + { + // Don't copy; these values will be copied at the end of argument processing. + found = true; + } + else if (getValueForKey(argName, &val, &cnt, &bootInfo->chameleonConfig)) + { + copyArgument(argName, val, cnt, argP, cntRemainingP); + found = true; + } + if (found && foundVal) + { + strlcpy(foundVal, val, foundValSize); + } + return found; } // Maximum config table value size @@ -1152,43 +1159,41 @@ int processBootOptions() { - const char *cp = gBootArgs; - const char *val = 0; - const char *kernel; - int cnt; - int userCnt; - int cntRemaining; - char *argP; - char *configKernelFlags; - char *valueBuffer; + const char *cp = gBootArgs; + const char *val = 0; + const char *kernel; + int cnt; + int userCnt; + int cntRemaining; + char *argP; + char *configKernelFlags; + char *valueBuffer; - valueBuffer = malloc(VALUE_SIZE); + valueBuffer = malloc(VALUE_SIZE); - skipblanks( &cp ); + skipblanks( &cp ); - // Update the unit and partition number. + // 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. + // - // - // Setup edx, and signal intention to chain load the - // foreign booter. - // + chainbootdev = gBootVolume->biosdev; + chainbootflag = 1; - chainbootdev = gBootVolume->biosdev; - chainbootflag = 1; + return 1; + } - return 1; - } + setRootVolume(gBootVolume); - setRootVolume(gBootVolume); - - } + } // If no boot volume fail immediately because we're just going to fail // trying to load the config file anyway. else @@ -1204,8 +1209,8 @@ // Load com.apple.Boot.plist from the selected volume // and use its contents to override default bootConfig. - loadSystemConfig(&bootInfo->bootConfig); - loadChameleonConfig(&bootInfo->chameleonConfig); + loadSystemConfig(&bootInfo->bootConfig); + loadChameleonConfig(&bootInfo->chameleonConfig); // Use the kernel name specified by the user, or fetch the name // in the config table, or use the default if not specified. @@ -1368,11 +1373,11 @@ showInfoBox( "Press q to continue, space for next page.\n",buf_orig ); return; } + + // Create a copy so that we don't mangle the original + buf = malloc(size + 1); + memcpy(buf, buf_orig, size); - // Create a copy so that we don't mangle the original - buf = malloc(size + 1); - memcpy(buf, buf_orig, size); - bp = buf; while (size-- > 0) { Index: branches/ErmaC/Enoch/i386/boot2/graphic_utils.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/graphic_utils.c (revision 2322) +++ branches/ErmaC/Enoch/i386/boot2/graphic_utils.c (revision 2323) @@ -7,9 +7,9 @@ #include "graphic_utils.h" #include "gui.h" -void blend( const pixmap_t *blendThis, // Source image - pixmap_t *blendInto, // Dest image - const position_t position) // Where to place the source image +void blend( const pixmap_t *blendThis, // Source image + pixmap_t *blendInto, // Dest image + const position_t position) // Where to place the source image { uint16_t sx, sy, dx, dy; uint32_t dstrb, dstag, srcrb, srcag, drb, dag, rb, ag, alpha; @@ -17,52 +17,52 @@ uint16_t width = (blendThis->width + position.x < blendInto->width) ? blendThis->width: blendInto->width-position.x; uint16_t height = (blendThis->height + position.y < blendInto->height) ? blendThis->height: blendInto->height-position.y; - for (dy = position.y, sy = 0; sy < height; dy++, sy++) { - for (dx = position.x, sx = 0; sx < width; dx++, sx++) { - alpha = (pixel(blendThis, sx, sy).ch.a); + for (dy = position.y, sy = 0; sy < height; dy++, sy++) { + for (dx = position.x, sx = 0; sx < width; dx++, sx++) { + alpha = (pixel(blendThis, sx, sy).ch.a); - /* Skip blending for fully transparent pixel */ - if (alpha == 0) continue; + /* Skip blending for fully transparent pixel */ + if (alpha == 0) { + continue; + } - /* For fully opaque pixel, there is no need to interpolate */ - if (alpha == 255) { - pixel(blendInto, dx, dy).value = pixel(blendThis, sx, sy).value; - continue; - } + /* For fully opaque pixel, there is no need to interpolate */ + if (alpha == 255) { + pixel(blendInto, dx, dy).value = pixel(blendThis, sx, sy).value; + continue; + } - /* For semi-transparent pixels, do a full blend */ - //alpha++ - /* This is needed to spread the alpha over [0..256] instead of [0..255] + /* For semi-transparent pixels, do a full blend */ + //alpha++ + /* This is needed to spread the alpha over [0..256] instead of [0..255] Boundary conditions were handled above */ - dstrb = pixel(blendInto, dx, dy).value & 0xFF00FF; - dstag = (pixel(blendInto, dx, dy).value >> 8) & 0xFF00FF; - srcrb = pixel(blendThis, sx, sy).value & 0xFF00FF; - srcag = (pixel(blendThis, sx, sy).value >> 8) & 0xFF00FF; - drb = srcrb - dstrb; - dag = srcag - dstag; - drb *= alpha; dag *= alpha; - drb >>= 8; dag >>= 8; - rb = (drb + dstrb) & 0x00FF00FF; - ag = ((dag + dstag) << 8) & 0xFF00FF00; - pixel(blendInto, dx, dy).value = (rb | ag); - } - } + dstrb = pixel(blendInto, dx, dy).value & 0xFF00FF; + dstag = (pixel(blendInto, dx, dy).value >> 8) & 0xFF00FF; + srcrb = pixel(blendThis, sx, sy).value & 0xFF00FF; + srcag = (pixel(blendThis, sx, sy).value >> 8) & 0xFF00FF; + drb = srcrb - dstrb; + dag = srcag - dstag; + drb *= alpha; dag *= alpha; + drb >>= 8; dag >>= 8; + rb = (drb + dstrb) & 0x00FF00FF; + ag = ((dag + dstag) << 8) & 0xFF00FF00; + pixel(blendInto, dx, dy).value = (rb | ag); + } + } } -position_t centeredIn( const pixmap_t *background, const pixmap_t *toCenter ) -{ - position_t centered; - centered.x = ( background->width - toCenter->width ) / 2; - centered.y = ( background->height - toCenter->height ) / 2; - return centered; +position_t centeredIn( const pixmap_t *background, const pixmap_t *toCenter ) { + position_t centered; + centered.x = ( background->width - toCenter->width ) / 2; + centered.y = ( background->height - toCenter->height ) / 2; + return centered; } -position_t centeredAt( const pixmap_t *pixmap, const position_t center ) -{ - position_t topleft; - topleft.x = center.x - (pixmap->width / 2); - topleft.y = center.y - (pixmap->height / 2); - return topleft; +position_t centeredAt( const pixmap_t *pixmap, const position_t center ) { + position_t topleft; + topleft.x = center.x - (pixmap->width / 2); + topleft.y = center.y - (pixmap->height / 2); + return topleft; } position_t pos(const uint16_t x, const uint16_t y) { position_t p; p.x = x; p.y = y; return p; } @@ -72,10 +72,10 @@ //if(testForQemu()) return; uint32_t x; - register uint8_t tempB; + register uint8_t tempB; for (x = 0; x < (p->height) * (p->width) ; x++) { tempB = (p->pixels[x]).ch.b; - (p->pixels[x]).ch.b = (p->pixels[x]).ch.r; - (p->pixels[x]).ch.r = tempB; + (p->pixels[x]).ch.b = (p->pixels[x]).ch.r; + (p->pixels[x]).ch.r = tempB; } } Index: branches/ErmaC/Enoch/i386/config/symbol.c =================================================================== --- branches/ErmaC/Enoch/i386/config/symbol.c (revision 2322) +++ branches/ErmaC/Enoch/i386/config/symbol.c (revision 2323) @@ -881,13 +881,13 @@ newlen = strlen(res) + strlen(symval) + strlen(src) + 1; if (newlen > reslen) { - char* newres = NULL; - if (!(newres = realloc(res, newlen))) { - /* TODO: handle error gracefully - for now, punt */ - break; - } - res = newres; - reslen = newlen; + char* newres = NULL; + if (!(newres = realloc(res, newlen))) { + /* TODO: handle error gracefully - for now, punt */ + break; + } + res = newres; + reslen = newlen; } strcat(res, symval); Index: branches/ErmaC/Enoch/i386/config/lex.zconf.c =================================================================== --- branches/ErmaC/Enoch/i386/config/lex.zconf.c (revision 2322) +++ branches/ErmaC/Enoch/i386/config/lex.zconf.c (revision 2323) @@ -822,15 +822,15 @@ { int new_size = text_size + size + 1; if (new_size > text_asize) { - char* new_text = NULL; - new_size += START_STRSIZE - 1; - new_size &= -START_STRSIZE; - if (!(new_text = realloc(text, new_size))) { - return; + char* new_text = NULL; + new_size += START_STRSIZE - 1; + new_size &= -START_STRSIZE; + if (!(new_text = realloc(text, new_size))) { + return; + } + text = new_text; + text_asize = new_size; } - text = new_text; - text_asize = new_size; - } memcpy(text + text_size, str, size); text_size += size; text[text_size] = 0; Index: branches/ErmaC/Enoch/i386/config/confdata.c =================================================================== --- branches/ErmaC/Enoch/i386/config/confdata.c (revision 2322) +++ branches/ErmaC/Enoch/i386/config/confdata.c (revision 2323) @@ -902,7 +902,7 @@ } fclose(out); fclose(out_h); - fclose(out_inc); + fclose(out_inc); name = getenv("CCONFIG_AUTOHEADER"); if (!name) name = "autoconf.h"; Index: branches/ErmaC/Enoch/i386/Cconfig =================================================================== --- branches/ErmaC/Enoch/i386/Cconfig (revision 2322) +++ branches/ErmaC/Enoch/i386/Cconfig (revision 2323) @@ -4,7 +4,7 @@ config OPTIMIZATION_LEVEL string "Optimization Level" - default "-Oz" + default "-Os" ---help--- Specify the level to compile chameleon with. Index: branches/ErmaC/Enoch/i386/modules/FileNVRAM/Cconfig =================================================================== --- branches/ErmaC/Enoch/i386/modules/FileNVRAM/Cconfig (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/FileNVRAM/Cconfig (revision 2323) @@ -4,7 +4,7 @@ config FILENVRAM_MODULE bool "FileNVRAM Module" - default y + default y ---help--- Say Y here if you want to enable to use of this module. Index: branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.c (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.c (revision 2323) @@ -17,15 +17,13 @@ void patchVideoBios() -{ +{ UInt32 x = 0, y = 0, bp = 0; verbose("Resolution:\n"); getResolution(&x, &y, &bp); - if (x != 0 && - y != 0 && - bp != 0) + if (x != 0 && y != 0 && bp != 0) { vbios_map * map; @@ -33,11 +31,11 @@ if(map) { unlock_vbios(map); - + set_mode(map, x, y, bp, 0, 0); - + relock_vbios(map); - + close_vbios(map); } } @@ -190,7 +188,7 @@ case 0x01048086: // 2nd Generation Core Processor Family DRAM Controller case 0x01088086: // Xeon E3-1200 2nd Generation Core Processor Family DRAM Controller case 0x010c8086: // Xeon E3-1200 2nd Generation Core Processor Family DRAM Controller - + case 0x01508086: // 3rd Generation Core Processor Family DRAM Controller case 0x01548086: // 3rd Generation Core Processor Family DRAM Controller case 0x01588086: // 3rd Generation Core Processor Family DRAM Controller @@ -199,7 +197,6 @@ type = CT_CORE_PROC; break; - default: if((id & 0x0000FFFF) == 0x00008086) // Intel chipset { @@ -215,6 +212,7 @@ } break; } + return type; } @@ -236,6 +234,7 @@ return ptr; } +char detect_bios_type(vbios_map * map, char modeline, int entry_size); char detect_bios_type(vbios_map * map, char modeline, int entry_size) { UInt32 i; @@ -256,8 +255,8 @@ r2 = map->mode_table[i].resolution; } } - - /*printf("r1 = %d r2 = %d\n", r1, r2);*/ + + //printf("r1 = %d r2 = %d\n", r1, r2); } return (r2-r1-6) % entry_size == 0; @@ -275,6 +274,10 @@ { UInt32 z; vbios_map * map = malloc(sizeof(vbios_map)); + if (!map) + { + return 0; + } for(z=0; zchipset_id); close_vbios(map); return 0; - } else { + } + else + { verbose(" Detected chipset/proc id (DRAM controller): %08x\n", map->chipset_id); } @@ -336,15 +341,22 @@ } map->mode_table_size = std_vesa->sHeader.usStructureSize - sizeof(ATOM_COMMON_TABLE_HEADER); - if (!detect_ati_bios_type(map)) map->bios = BT_ATI_2; - - if (map->bios == BT_ATI_1) { + if (!detect_ati_bios_type(map)) + { + map->bios = BT_ATI_2; + } + + if (map->bios == BT_ATI_1) + { verbose(", BT_ATI_1\n"); - } else { + } + else + { verbose(", BT_ATI_2\n"); } } - else { + else + { /* * check if we have NVIDIA @@ -365,7 +377,7 @@ NV_VESA_TABLE * std_vesa; int i = 0; - + while (i < 0x300) { //We don't need to look for the table in the whole bios, the 768 first bytes only if (( map->bios_ptr[i] == 0x44) @@ -400,28 +412,26 @@ } } - + /* * check if we have Intel */ - + /*if (map->chipset == CT_UNKNOWN && memmem(map->bios_ptr, VBIOS_SIZE, INTEL_SIGNATURE, strlen(INTEL_SIGNATURE))) { printf( "Intel chipset detected. However, 915resolution was unable to determine the chipset type.\n"); - + printf("Chipset Id: %x\n", map->chipset_id); - + printf("Please report this problem to stomljen@yahoo.com\n"); - + close_vbios(map); return 0; }*/ - + /* * check for others */ - - /* * Figure out where the mode table is */ @@ -443,8 +453,8 @@ p++; } - - if (map->mode_table == 0) + + if (map->mode_table == 0) { close_vbios(map); return 0; @@ -503,7 +513,7 @@ void unlock_vbios(vbios_map * map) { - + map->unlocked = TRUE; switch (map->chipset) { @@ -557,6 +567,8 @@ outb(CONFIG_MECH_ONE_DATA + 1, 0x33); outb(CONFIG_MECH_ONE_DATA + 2, 0x33); break; + default: + break; } #if DEBUG @@ -614,6 +626,7 @@ outl(CONFIG_MECH_ONE_ADDR, 0x80000080); outb(CONFIG_MECH_ONE_DATA + 1, map->b1); outb(CONFIG_MECH_ONE_DATA + 2, map->b2); + default: break; } @@ -647,7 +660,7 @@ mode->v_sync_offset = (edidInfo[65] & 0x0C) | ((edidInfo[64] & 0x0C) >> 2); mode->v_sync_width = ((edidInfo[65] & 0x3) << 2) | (edidInfo[64] & 0x03); */ - + free( edidInfo ); return 0; @@ -666,7 +679,7 @@ vfreq = vbl * freq; hbl = 16 * (int)(x * (30.0 - 300000.0 / vfreq) / + (70.0 + 300000.0 / vfreq) / 16.0 + 0.5); - + *vsyncstart = y; *vsyncend = y + 3; *vblank = vbl - 1; @@ -694,8 +707,9 @@ verbose("BT_1 patched.\n"); vbios_resolution_type1 * res = map_type1_resolution(map, map->mode_table[i].resolution); - if (bp) { - map->mode_table[i].bits_per_pixel = bp; + if (bp) + { + map->mode_table[i].bits_per_pixel = (uint8_t)bp; } res->x2 = (htotal?(((htotal-x) >> 8) & 0x0f) : (res->x2 & 0x0f)) | ((x >> 4) & 0xf0); @@ -704,19 +718,21 @@ res->y2 = (vtotal?(((vtotal-y) >> 8) & 0x0f) : (res->y2 & 0x0f)) | ((y >> 4) & 0xf0); res->y1 = (y & 0xff); if (htotal) + { res->x_total = ((htotal-x) & 0xff); - + } if (vtotal) + { res->y_total = ((vtotal-y) & 0xff); - + } break; } case BT_2: { vbios_resolution_type2 * res = map_type2_resolution(map, map->mode_table[i].resolution); - res->xchars = x / 8; - res->ychars = y / 16 - 1; + res->xchars = (uint8_t)(x / 8); + res->ychars = (uint8_t)(y / 16 - 1); xprev = res->modelines[0].x1; yprev = res->modelines[0].y1; @@ -724,8 +740,8 @@ vbios_modeline_type2 * modeline = &res->modelines[j]; if (modeline->x1 == xprev && modeline->y1 == yprev) { - modeline->x1 = modeline->x2 = x-1; - modeline->y1 = modeline->y2 = y-1; + modeline->x1 = modeline->x2 = (uint16_t)(x-1); + modeline->y1 = modeline->y2 = (uint16_t)(y-1); gtf_timings(x, y, freqs[j], &modeline->clock, &modeline->hsyncstart, &modeline->hsyncend, @@ -733,14 +749,21 @@ &modeline->vsyncend, &modeline->vblank); if (htotal) - modeline->htotal = htotal; + { + modeline->htotal = (uint16_t)htotal; + } else + { modeline->htotal = modeline->hblank; - + } if (vtotal) - modeline->vtotal = vtotal; + { + modeline->vtotal = (uint16_t)vtotal; + } else + { modeline->vtotal = modeline->vblank; + } } } verbose("BT_1 patched.\n"); @@ -757,24 +780,31 @@ vbios_modeline_type3 * modeline = &res->modelines[j]; if (modeline->x1 == xprev && modeline->y1 == yprev) { - modeline->x1 = modeline->x2 = x-1; - modeline->y1 = modeline->y2 = y-1; + modeline->x1 = modeline->x2 = (uint16_t)(x-1); + modeline->y1 = modeline->y2 = (uint16_t)(y-1); gtf_timings(x, y, freqs[j], &modeline->clock, &modeline->hsyncstart, &modeline->hsyncend, &modeline->hblank, &modeline->vsyncstart, &modeline->vsyncend, &modeline->vblank); if (htotal) - modeline->htotal = htotal; + { + modeline->htotal = (uint16_t)htotal; + } else + { modeline->htotal = modeline->hblank; + } if (vtotal) - modeline->vtotal = vtotal; + { + modeline->vtotal = (uint16_t)vtotal; + } else + { modeline->vtotal = modeline->vblank; - - modeline->timing_h = y-1; - modeline->timing_v = x-1; + } + modeline->timing_h = (uint16_t)(y-1); + modeline->timing_v = (uint16_t)(x-1); } } verbose("BT_3 patched.\n"); @@ -787,8 +817,9 @@ ATOM_MODE_TIMING *mode_timing = (ATOM_MODE_TIMING *) map->ati_mode_table; - //if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) { - if (!getMode(&mode)) { + //if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force){ + if (!getMode(&mode)) + { verbose("\n Edid detailed timing descriptor found: %dx%d\n vbios mode 0 patched!\n", mode.h_active, mode.v_active); mode_timing->usCRTC_H_Total = mode.h_active + mode.h_blanking; mode_timing->usCRTC_H_Disp = mode.h_active; @@ -801,7 +832,9 @@ mode_timing->usCRTC_V_SyncWidth = mode.v_sync_width; mode_timing->usPixelClock = mode.pixel_clock; - } else { + } + else + { verbose(" Edid not found or invalid - vbios not patched!\n"); } /*else @@ -825,7 +858,7 @@ mode_timing->usPixelClock = modeline.clock; }*/ - + break; } case BT_ATI_2: @@ -849,7 +882,9 @@ mode_timing->usVSyncWidth = mode.v_sync_width; mode_timing->usPixClk = mode.pixel_clock; - } else { + } + else + { verbose(" Edid not found or invalid - vbios not patched!\n"); } /*else @@ -862,30 +897,29 @@ &modeline.vsyncend, &modeline.vblank, 0); mode_timing->usHBlanking_Time = modeline.hblank; - + mode_timing->usHActive = x; - + mode_timing->usHSyncOffset = modeline.hsyncstart - x; - + mode_timing->usHSyncWidth = modeline.hsyncend - modeline.hsyncstart; - + - + mode_timing->usVBlanking_Time = modeline.vblank; - + mode_timing->usVActive = y; - + mode_timing->usVSyncOffset = modeline.vsyncstart - y; - + mode_timing->usVSyncWidth = modeline.hsyncend - modeline.hsyncstart; - + - + mode_timing->usPixClk = modeline.clock; - + }*/ - - + mode_timing->usHActive = x; + mode_timing->usHSyncOffset = modeline.hsyncstart - x; + mode_timing->usHSyncWidth = modeline.hsyncend - modeline.hsyncstart; + + mode_timing->usVBlanking_Time = modeline.vblank; + mode_timing->usVActive = y; + mode_timing->usVSyncOffset = modeline.vsyncstart - y; + mode_timing->usVSyncWidth = modeline.hsyncend - modeline.hsyncstart; + + mode_timing->usPixClk = modeline.clock; + }*/ + break; } case BT_NVDA: { verbose("BT_NVDA"); edid_mode mode; - NV_MODELINE *mode_timing = (NV_MODELINE *) map->nv_mode_table; /*if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {*/ - if (!getMode(&mode)) { + if (!getMode(&mode)) + { verbose("\n Edid detailed timing descriptor found: %dx%d\n vbios mode %d patched!\n", mode.h_active, mode.v_active, i); mode_timing[i].usH_Total = mode.h_active + mode.h_blanking; mode_timing[i].usH_Active = mode.h_active; @@ -898,28 +932,29 @@ mode_timing[i].usV_SyncEnd = mode.v_active + mode.v_sync_offset + mode.v_sync_width; mode_timing[i].usPixel_Clock = mode.pixel_clock; - } else { + } + else + { verbose(" Edid not found or invalid - vbios not patched!\n"); } /*else { vbios_modeline_type2 modeline; - cvt_timings(x, y, freqs[0], &modeline.clock, &modeline.hsyncstart, &modeline.hsyncend, &modeline.hblank, &modeline.vsyncstart, &modeline.vsyncend, &modeline.vblank, 0); - + mode_timing[i].usH_Total = x + modeline.hblank - 1; mode_timing[i].usH_Active = x; mode_timing[i].usH_SyncStart = modeline.hsyncstart - 1; mode_timing[i].usH_SyncEnd = modeline.hsyncend - 1; - + mode_timing[i].usV_Total = y + modeline.vblank - 1; mode_timing[i].usV_Active = y; mode_timing[i].usV_SyncStart = modeline.vsyncstart - 1; mode_timing[i].usV_SyncEnd = modeline.vsyncend - 1; - + mode_timing[i].usPixel_Clock = modeline.clock; }*/ break; @@ -929,9 +964,11 @@ verbose(" Unknown - vbios not patched\n"); break; } + default: + break; } // } // } } -#endif // _RESOLUTION_H_ \ No newline at end of file +#endif // _RESOLUTION_H_ Index: branches/ErmaC/Enoch/i386/modules/Resolution/edid.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/Resolution/edid.c (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/Resolution/edid.c (revision 2323) @@ -147,6 +147,10 @@ /* checksum passed, everything's good */ err = 1; } + else + { + msglog(" edid_checksum error "); + } return err; } @@ -165,6 +169,11 @@ err = 0; } + if (err == 0) + { + msglog(" edid_check_header error "); + } + return err; } //------------------------------------------------------------------------ @@ -179,11 +188,11 @@ int edid_is_timing_block(unsigned char *block) { - if ((block[0] != 0x00) || (block[1] != 0x00) || - (block[2] != 0x00) || (block[4] != 0x00)) + if ((block[0] != 0x00) || (block[1] != 0x00) || (block[2] != 0x00) || (block[4] != 0x00)) { return 1; - else + } else { return 0; + } } //---------------------------------------------------------------------------------- @@ -191,13 +200,18 @@ { int i; unsigned char *block; + + msglog(" Parse Edid:"); + if(!verifyEDID((unsigned char *)edid)) { + msglog(" error\n"); + return 0; + } - if(!verifyEDID((unsigned char *)edid)) return 0; - block = (unsigned char *)edid + DETAILED_TIMING_DESCRIPTIONS_START; //54 for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) { if (edid_is_timing_block(block)) { + msglog(" descriptor block %d is timing descriptor ", i); var->h_active = H_ACTIVE; var->v_active = V_ACTIVE; var->h_sync_offset = H_SYNC_OFFSET; @@ -237,7 +251,7 @@ void getResolution(UInt32* x, UInt32* y, UInt32* bp) { // int val; - static UInt32 xResolution, yResolution, bpResolution; + static UInt32 xResolution, yResolution, bpResolution = 32; // assume 32bits /* if(getIntForKey(kScreenWidth, &val, &bootInfo->chameleonConfig)) { @@ -249,28 +263,23 @@ yResolution = val; } */ - bpResolution = 32; // assume 32bits - - - if(!xResolution || !yResolution || !bpResolution) - { - + if(!xResolution || !yResolution || !bpResolution) { char* edidInfo = readEDID(); - if(!edidInfo) return; - + if(!edidInfo) { + return; + } + edid_mode mode; // TODO: check *all* resolutions reported and either use the highest, or the native resolution (if there is a flag for that) //xResolution = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4); //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; } @@ -306,6 +315,7 @@ *y = yResolution; *bp = bpResolution; + msglog("Best mode: %dx%dx%d\n", *x, *y, *bp); } char* readEDID() @@ -326,18 +336,17 @@ bzero( edidInfo, EDID_BLOCK_SIZE); status = getEDID(edidInfo, blocks_left); - + /* msglog("Buffer location: 0x%X status: %d\n", SEG(edidInfo) << 16 | OFF(edidInfo), status); - + int j, i; for (j = 0; j < 8; j++) { for(i = 0; i < 16; i++) msglog(" 0x%02X", edidInfo[((i+1) * (j + 1)) - 1]); msglog("\n"); } */ - - + if(status == 0) { //if( edidInfo[0] == 0x00 || edidInfo[0] == 0xFF) @@ -346,10 +355,9 @@ { blocks_left--; int reported = edidInfo[ EDID_V1_BLOCKS_TO_GO_OFFSET ]; - + if ( reported > blocks_left ) { - msglog("EDID claims %d more blocks left\n", reported); } @@ -382,28 +390,28 @@ return 0; } } - blocks_left = 0; + blocks_left = 0; } while(blocks_left); char* ret = malloc(sizeof(edidInfo)); + if (!ret) + { + return 0; + } memcpy(ret, edidInfo, sizeof(edidInfo)); return ret; } - int getEDID( void * edidBlock, UInt8 block) { biosBuf_t bb; - bzero(&bb, sizeof(bb)); - bb.intno = 0x10; - bb.eax.rr = 0x4F15; + bb.intno = 0x10; + bb.eax.rr = 0x4F15; bb.ebx.r.l= 0x01; bb.edx.rr = block; - - bb.es = SEG( edidBlock ); - bb.edi.rr = OFF( edidBlock ); - - bios( &bb ); - return(bb.eax.r.h); + bb.es = SEG( edidBlock ); + bb.edi.rr = OFF( edidBlock ); + bios( &bb ); + return(bb.eax.r.h); } Index: branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.h =================================================================== --- branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.h (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/Resolution/915resolution.h (revision 2323) @@ -124,10 +124,10 @@ typedef struct { - char *base; - ATOM_ROM_HEADER *AtomRomHeader; - unsigned short *MasterCommandTables; - unsigned short *MasterDataTables; + char *base; + ATOM_ROM_HEADER *AtomRomHeader; + unsigned short *MasterCommandTables; + unsigned short *MasterDataTables; } bios_tables_t; typedef struct { @@ -157,8 +157,8 @@ UInt16 hsyncstart; UInt16 hsyncend; UInt16 y1; - UInt16 vtotal; - UInt16 y2; + UInt16 vtotal; + UInt16 y2; UInt16 vblank; UInt16 vsyncstart; UInt16 vsyncend; @@ -198,7 +198,7 @@ typedef struct { unsigned char unknown[6]; - vbios_modeline_type3 modelines[]; + vbios_modeline_type3 modelines[]; } __attribute__((packed)) vbios_resolution_type3; typedef struct { @@ -222,8 +222,6 @@ UInt8 unlocked; } vbios_map; - - vbios_map * open_vbios(chipset_type); void close_vbios (vbios_map*); void unlock_vbios(vbios_map*); Index: branches/ErmaC/Enoch/i386/modules/Keylayout/layouts/cham-mklayout.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/Keylayout/layouts/cham-mklayout.c (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/Keylayout/layouts/cham-mklayout.c (revision 2323) @@ -365,9 +365,9 @@ struct keyboard_layout* new_layout = create_keylayout(in); if (new_layout) { write_layout(new_layout, out); - free(new_layout); - new_layout = NULL; - } + free(new_layout); + new_layout = NULL; + } fclose(out); fclose(in); Index: branches/ErmaC/Enoch/i386/modules/KernelPatcher/Makefile =================================================================== --- branches/ErmaC/Enoch/i386/modules/KernelPatcher/Makefile (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/KernelPatcher/Makefile (revision 2323) @@ -4,7 +4,7 @@ MODULE_VERSION = "1.1.0" MODULE_COMPAT_VERSION = "1.0.0" MODULE_START = $(MODULE_NAME)_start -MODULE_DEPENDENCIES = +MODULE_DEPENDENCIES = DIR = KernelPatcher Index: branches/ErmaC/Enoch/i386/modules/Sata/Sata.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/Sata/Sata.c (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/Sata/Sata.c (revision 2323) @@ -20,13 +20,12 @@ #define DBG(x...) #endif -void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4); - uint8_t default_SATA_ID[]= { 0x81, 0x26, 0x00, 0x00 }; #define SATA_ID_LEN ( sizeof(default_SATA_ID) / sizeof(uint8_t) ) +void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4); void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4) { pci_dt_t* current = arg1; Index: branches/ErmaC/Enoch/i386/modules/AcpiCodec/acpi_codec.c =================================================================== --- branches/ErmaC/Enoch/i386/modules/AcpiCodec/acpi_codec.c (revision 2322) +++ branches/ErmaC/Enoch/i386/modules/AcpiCodec/acpi_codec.c (revision 2323) @@ -5056,60 +5056,61 @@ getBoolForKey(kSTRIPAPIC, &strip_madt, &bootInfo->chameleonConfig); - if ((strip_madt == false) || (!buildMADT(new_table_list, DsdtPtr, &madt_info ))) + if ((strip_madt == false) || (!buildMADT(new_table_list, DsdtPtr, &madt_info ))) { - ACPI_TABLE_MADT * madt_file = (void*)0ul; - ACPI_TABLE_MADT * MadtPointer = (void*)0ul; - bool oem_apic=false; + ACPI_TABLE_MADT * madt_file = (void*)0ul; + ACPI_TABLE_MADT * MadtPointer = (void*)0ul; + bool oem_apic=false; - { - bool tmpval; - oem_apic=getBoolForKey(kOEMAPIC, &tmpval, &bootInfo->chameleonConfig)&&tmpval; - } + { + bool tmpval; + oem_apic=getBoolForKey(kOEMAPIC, &tmpval, &bootInfo->chameleonConfig)&&tmpval; + } - if ((madt_file = (ACPI_TABLE_MADT *)get_new_table_in_list(new_table_list, NAMESEG("APIC"), &new_table_index)) != (void *)0ul) - { - if (oem_apic == false) - { - MadtPointer = (ACPI_TABLE_MADT *)madt_file; - } - - } else - MadtPointer = (acpi_tables.MadtPointer64 != (void*)0ul) ? (ACPI_TABLE_MADT *)acpi_tables.MadtPointer64 : (ACPI_TABLE_MADT *)acpi_tables.MadtPointer; + if ((madt_file = (ACPI_TABLE_MADT *)get_new_table_in_list(new_table_list, NAMESEG("APIC"), &new_table_index)) != (void *)0ul) + { + if (oem_apic == false) + { + MadtPointer = (ACPI_TABLE_MADT *)madt_file; + } + + } + else + MadtPointer = (acpi_tables.MadtPointer64 != (void*)0ul) ? (ACPI_TABLE_MADT *)acpi_tables.MadtPointer64 : (ACPI_TABLE_MADT *)acpi_tables.MadtPointer; + + ProcessMadtInfo(MadtPointer, &madt_info); - ProcessMadtInfo(MadtPointer, &madt_info); - - } + } - if (gen_ssdt || gen_csta || gen_psta || gen_tsta) - { - ProcessSsdt(new_table_list, DsdtPtr, &madt_info, gen_csta, gen_psta, gen_tsta ); - } - } + if (gen_ssdt || gen_csta || gen_psta || gen_tsta) + { + ProcessSsdt(new_table_list, DsdtPtr, &madt_info, gen_csta, gen_psta, gen_tsta ); + } + } if (rsdp_mod == (void *)0ul) - { + { printf("Error: rsdp_mod == null \n"); return EFI_ABORTED; } - - if (!(rsdp_mod->Length >= ACPI_RSDP_REV0_SIZE)) + + if (!(rsdp_mod->Length >= ACPI_RSDP_REV0_SIZE)) { printf("Error: rsdp_mod size is incorrect \n"); return EFI_ABORTED; - + } - + do { - + if ((rsdp_mod->Revision == 0) || (gen_xsdt == true)) { if (process_rsdt(rsdp_mod, gen_xsdt, new_table_list)) break; printf("Error : ACPI RSD PTR Revision 1 is incorrect, \n"); } - + if ((GetChecksum(rsdp_mod, sizeof(ACPI_TABLE_RSDP)) == 0) && (Revision == 2) && (rsdplength == sizeof(ACPI_TABLE_RSDP))) @@ -5117,40 +5118,40 @@ if (process_xsdt(rsdp_mod, new_table_list)) break; printf("Error : ACPI RSD PTR Revision 2 is incorrect \n"); - } - + } + Revision = 0; // fallback to Revision 0 - + if (process_rsdt(rsdp_mod, false, new_table_list)) - break; - + break; + printf("Error: Incorect ACPI RSD PTR or not found \n"); return EFI_ABORTED; - + } while (0); - - + + // Correct the checksum of RSDP - + DBG("RSDP: Original checksum %d\n", rsdp_mod->Checksum); - + setRsdpchecksum(rsdp_mod); - + DBG("New checksum %d\n", rsdp_mod->Checksum); - + if (Revision == 2) { - DBG("RSDP: Original extended checksum %d\n", rsdp_mod->ExtendedChecksum); - + DBG("RSDP: Original extended checksum %d\n", rsdp_mod->ExtendedChecksum); + setRsdpXchecksum(rsdp_mod); - + DBG("New extended checksum %d\n", rsdp_mod->ExtendedChecksum); - + } - + verbose("ACPI Revision %d successfully patched\n", Revision); - - if (Revision == 2) + + if (Revision == 2) { /* XXX aserebln why uint32 cast if pointer is uint64 ? */ rsd_p = (U32)rsdp_mod; @@ -5162,8 +5163,8 @@ rsd_p = (U32)rsdp_mod; addConfigurationTable(&gEfiAcpiTableGuid, &rsd_p, "ACPI"); } - - + + #if DEBUG_ACPI==2 printf("Press a key to continue... (DEBUG_ACPI)\n"); getc(); @@ -5174,6 +5175,6 @@ int AcpiSetup(void) { EFI_STATUS status = setup_Acpi(); - + return (status == EFI_SUCCESS); } Index: branches/ErmaC/Enoch/i386/cdboot/cdboot.s =================================================================== --- branches/ErmaC/Enoch/i386/cdboot/cdboot.s (revision 2322) +++ branches/ErmaC/Enoch/i386/cdboot/cdboot.s (revision 2323) @@ -406,7 +406,7 @@ ; DS:SI = pointer to Disk Address Packet ; ; Returns: - ; AH = return status (sucess is 0) + ; AH = return status (success is 0) ; carry = 0 success ; 1 error ; Index: branches/ErmaC/Enoch/i386/cdboot/cdboothdd.s =================================================================== --- branches/ErmaC/Enoch/i386/cdboot/cdboothdd.s (revision 2322) +++ branches/ErmaC/Enoch/i386/cdboot/cdboothdd.s (revision 2323) @@ -320,7 +320,7 @@ ; DS:SI = pointer to Disk Address Packet ; ; Returns: - ; AH = return status (sucess is 0) + ; AH = return status (success is 0) ; carry = 0 success ; 1 error ; Index: branches/ErmaC/Enoch/i386/libsa/libsa.h =================================================================== --- branches/ErmaC/Enoch/i386/libsa/libsa.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/libsa.h (revision 2323) @@ -37,53 +37,54 @@ */ static inline int isupper(int c) { - return (c >= 'A' && c <= 'Z'); + return (c >= 'A' && c <= 'Z'); } static inline int islower(int c) { - return (c >= 'a' && c <= 'z'); + return (c >= 'a' && c <= 'z'); } static inline int isalpha(int c) { - return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); + return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); } static inline int isascii(int c) { - return ( (c >= 0x20) && (c < 0x7f) ); + return ( (c >= 0x20) && (c < 0x7f) ); } static inline int isspace(int c) { - return (c == ' ' || c == '\t' || c == '\n' || c == '\12'); + return (c == ' ' || c == '\t' || c == '\n' || c == '\12'); } static inline int isdigit(int c) { - return (c >= '0' && c <= '9'); + return (c >= '0' && c <= '9'); } static inline int isxdigit(int c) { - return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')); + return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')); } static inline int ispunct(int c) { - return (c == '.' || c == '-'); + return (c == '.' || c == '-'); } /* * string.c */ #ifndef bcopy -extern void bcopy(const void * src, void * dst, size_t len); +extern void bcopy(const void * src, void * dst, size_t len); #endif #ifndef bzero -extern void bzero(void * dst, size_t len); +extern void bzero(void * dst, size_t len); +extern void __bzero(void * dst, size_t len); #else #error bzero is defined. #endif @@ -105,7 +106,7 @@ extern char * strdup(const char *s1); #if STRNCASECMP -extern int strncasecmp(const char * s1, const char * s2, size_t n); +extern int strncasecmp(const char *s1, const char *s2, size_t n); #endif extern char * strchr(const char *str, int c); @@ -129,8 +130,7 @@ /* * prf.c */ -extern void prf(const char * fmt, va_list ap, int (*putfn_p)(), - void * putfn_arg); +extern void prf(const char * fmt, va_list ap, int (*putfn_p)(), void * putfn_arg); /* * printf.c @@ -142,7 +142,7 @@ /* * zalloc.c */ -#define malloc(size) safe_malloc(size, __FILE__, __LINE__) +#define malloc(size) safe_malloc(size, __FILE__, __LINE__) extern void malloc_init(char * start, int size, int nodes, void (*malloc_error)(char *, size_t, const char *, int)); extern void * safe_malloc(size_t size,const char *file, int line); extern void free(void * start); @@ -151,7 +151,6 @@ /* * getsegbyname.c */ -extern struct segment_command * - getsegbynamefromheader(struct mach_header * mhp, char * segname); +extern struct segment_command * getsegbynamefromheader(struct mach_header * mhp, char * segname); #endif /* !__BOOT_LIBSA_H */ Index: branches/ErmaC/Enoch/i386/libsa/printf.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/printf.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/printf.c (revision 2323) @@ -30,60 +30,63 @@ struct putc_info //Azi: exists on console.c & gui.c { - char * str; - char * last_str; + char * str; + char * last_str; }; static int sputc(int c, struct putc_info * pi) //Azi: same as above { - if (pi->last_str) - if (pi->str == pi->last_str) { - *(pi->str) = '\0'; - return 0; - } - *(pi->str)++ = c; - return c; + if (pi->last_str) + { + if (pi->str == pi->last_str) + { + *(pi->str) = '\0'; + return 0; + } + } + *(pi->str)++ = c; + return c; } /*VARARGS1*/ /* now slprintf() return the length of the string as in man sprintf()*/ int sprintf(char * str, const char * fmt, ...) { - va_list ap; - struct putc_info pi; + va_list ap; + struct putc_info pi; - va_start(ap, fmt); - pi.str = str; - pi.last_str = 0; - prf(fmt, ap, sputc, &pi); - *pi.str = '\0'; - va_end(ap); - return (pi.str - str); + va_start(ap, fmt); + pi.str = str; + pi.last_str = 0; + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + va_end(ap); + return (pi.str - str); } /*VARARGS1*/ int snprintf(char * str, size_t size, const char * fmt, ...) { - va_list ap; - struct putc_info pi; + va_list ap; + struct putc_info pi; - va_start(ap, fmt); - pi.str = str; - pi.last_str = str + size - 1; - prf(fmt, ap, sputc, &pi); - *pi.str = '\0'; - va_end(ap); - return (pi.str - str); + va_start(ap, fmt); + pi.str = str; + pi.last_str = str + size - 1; + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + va_end(ap); + return (pi.str - str); } /*VARARGS1*/ int slvprintf(char * str, int len, const char * fmt, va_list ap) { - struct putc_info pi; - pi.str = str; - pi.last_str = str + len - 1; - prf(fmt, ap, sputc, &pi); - *pi.str = '\0'; - return (pi.str - str); + struct putc_info pi; + pi.str = str; + pi.last_str = str + len - 1; + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + return (pi.str - str); } Index: branches/ErmaC/Enoch/i386/libsa/zalloc.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/zalloc.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/zalloc.c (revision 2323) @@ -49,7 +49,7 @@ static short availableNodes, allocedNodes, totalNodes; static char * zalloc_base; static char * zalloc_end; -static void (*zerror)(char *, size_t, const char *, int); +static void (*zerror)(char *, size_t, const char *, int); static void zallocate(char * start,int size); static void zinsert(zmem * zp, int ndx); @@ -65,7 +65,7 @@ static void malloc_error(char *addr, size_t size, const char *file, int line) { #ifdef i386 - asm volatile ("hlt"); + asm volatile ("hlt"); #endif } @@ -77,12 +77,17 @@ zalloced = (zmem *) zalloc_base; zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes; zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes; - if (size == 0) size = ZALLOC_LEN; + + if (size == 0) + { + size = ZALLOC_LEN; + } + zavailable[0].size = size - (zavailable[0].start - zalloc_base); - zalloc_end = zalloc_base + size; + zalloc_end = zalloc_base + size; availableNodes = 1; allocedNodes = 0; - zerror = malloc_err_fn ? malloc_err_fn : malloc_error; + zerror = malloc_err_fn ? malloc_err_fn : malloc_error; } #define BEST_FIT 1 @@ -91,8 +96,8 @@ { int i; #if BEST_FIT - int bestFit; - size_t smallestSize; + int bestFit; + size_t smallestSize; #endif char * ret = 0; @@ -104,38 +109,40 @@ size = ((size + 0xf) & ~0xf); - if (size == 0) { - if (zerror) (*zerror)((char *)0xdeadbeef, 0, file, line); + if (size == 0) + { + if (zerror) + { + (*zerror)((char *)0xdeadbeef, 0, file, line); + } } #if BEST_FIT - smallestSize = 0; - bestFit = -1; + smallestSize = 0; + bestFit = -1; #endif - + for (i = 0; i < availableNodes; i++) { // find node with equal size, or if not found, // then smallest node that fits. - if ( zavailable[i].size == size ) + if (zavailable[i].size == size) { zallocate(ret = zavailable[i].start, size); zdelete(zavailable, i); availableNodes--; goto done; } #if BEST_FIT - else - { - if ((zavailable[i].size > size) && - ((smallestSize == 0) || - (zavailable[i].size < smallestSize))) - { - bestFit = i; - smallestSize = zavailable[i].size; - } - } - + else + { + if ((zavailable[i].size > size) && ((smallestSize == 0) || (zavailable[i].size < smallestSize))) + { + bestFit = i; + smallestSize = zavailable[i].size; + } + } + #else - else if ( zavailable[i].size > size ) + else if (zavailable[i].size > size) { zallocate(ret = zavailable[i].start, size); zavailable[i].start += size; @@ -143,71 +150,85 @@ goto done; } #endif - } + } #if BEST_FIT - if (bestFit != -1) - { - zallocate(ret = zavailable[bestFit].start, size); - zavailable[bestFit].start += size; - zavailable[bestFit].size -= size; - } + if (bestFit != -1) + { + zallocate(ret = zavailable[bestFit].start, size); + zavailable[bestFit].start += size; + zavailable[bestFit].size -= size; + } #endif done: if ((ret == 0) || (ret + size >= zalloc_end)) - { - if (zerror) (*zerror)(ret, size, file, line); - } + { + if (zerror) + { + (*zerror)(ret, size, file, line); + } + } + if (ret != 0) - { + { bzero(ret, size); - } + } #if ZDEBUG - zalloced_size += size; + zalloced_size += size; #endif return (void *) ret; } void free(void * pointer) { - unsigned long rp; + unsigned long rp; int i, found = 0; - size_t tsize = 0; + size_t tsize = 0; char * start = pointer; #if i386 - // Get return address of our caller, - // in case we have to report an error below. - asm volatile ("movl %%esp, %%eax\n\t" + // Get return address of our caller, + // in case we have to report an error below. + asm volatile ("movl %%esp, %%eax\n\t" "subl $4, %%eax\n\t" - "movl 0(%%eax), %%eax" : "=a" (rp) ); + "movl 0(%%eax), %%eax" : "=a" (rp)); #else rp = 0; #endif - if ( !start ) return; + if (!start) + { + return; + } for (i = 0; i < allocedNodes; i++) { - if ( zalloced[i].start == start ) + if (zalloced[i].start == start) { tsize = zalloced[i].size; #if ZDEBUG zout -= tsize; - printf(" zz out %d\n",zout); + printf(" zz out %d\n", zout); #endif zdelete(zalloced, i); allocedNodes--; found = 1; #if ZDEBUG - memset(pointer, 0x5A, tsize); + memset(pointer, 0x5A, tsize); #endif break; } } - if ( !found ) { - if (zerror) (*zerror)(pointer, rp, "free", 0); - else return; - } + if (!found) + { + if (zerror) + { + (*zerror)(pointer, rp, "free", 0); + } + else + { + return; + } + } #if ZDEBUG zalloced_size -= tsize; #endif @@ -222,8 +243,7 @@ return; } - if ((i > 0) && - (zavailable[i-1].start + zavailable[i-1].size == start)) + if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start)) { zavailable[i-1].size += tsize; zcoalesce(); @@ -232,9 +252,13 @@ if ((start + tsize) < zavailable[i].start) { - if (++availableNodes > totalNodes) { - if (zerror) (*zerror)((char *)0xf000f000, 0, "free", 0); - } + if (++availableNodes > totalNodes) + { + if (zerror) + { + (*zerror)((char *)0xf000f000, 0, "free", 0); + } + } zinsert(zavailable, i); zavailable[i].start = start; zavailable[i].size = tsize; @@ -242,27 +266,39 @@ } } - if (++availableNodes > totalNodes) { - if (zerror) (*zerror)((char *)0xf000f000, 1, "free", 0); - } + if (++availableNodes > totalNodes) + { + if (zerror) + { + (*zerror)((char *)0xf000f000, 1, "free", 0); + } + } zavailable[i].start = start; zavailable[i].size = tsize; zcoalesce(); + return; } static void zallocate(char * start,int size) { + #if ZDEBUG zout += size; printf(" alloc %d, total 0x%x\n",size,zout); #endif + zalloced[allocedNodes].start = start; zalloced[allocedNodes].size = size; - if (++allocedNodes > totalNodes) { - if (zerror) (*zerror)((char *)0xf000f000, 2, "zallocate", 0); - }; + + if (++allocedNodes > totalNodes) + { + if (zerror) + { + (*zerror)((char *)0xf000f000, 2, "zallocate", 0); + } + }; } static void @@ -277,7 +313,7 @@ for (; i >= ndx; i--, z1--, z2--) { - *z2 = *z1; + *z2 = *z1; } } @@ -290,9 +326,9 @@ z1 = zp + ndx; z2 = z1 + 1; - for (i = ndx; i < totalNodes-1; i++, z1++, z2++) + for (i = ndx; i < totalNodes - 1; i++, z1++, z2++) { - *z1 = *z2; + *z1 = *z2; } } @@ -303,11 +339,10 @@ for (i = 0; i < availableNodes-1; i++) { - if ( zavailable[i].start + zavailable[i].size == - zavailable[i+1].start ) + if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start ) { - zavailable[i].size += zavailable[i+1].size; - zdelete(zavailable, i+1); availableNodes--; + zavailable[i].size += zavailable[i + 1].size; + zdelete(zavailable, i + 1); availableNodes--; return; } } Index: branches/ErmaC/Enoch/i386/libsa/string.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/string.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/string.c (revision 2323) @@ -56,6 +56,11 @@ memset(dst, 0, len); } +void __bzero(void * dst, size_t len) +{ + memset(dst, 0, len); +} + #else void * memcpy(void * dst, const void * src, size_t len) { @@ -101,6 +106,22 @@ : "c" (len), "D" (dst) : "memory", "%eax" ); } + +void __bzero(void * dst, size_t len) +{ + asm volatile ( "xorl %%eax, %%eax \n\t" + "cld \n\t" + "movl %%ecx, %%edx \n\t" + "shrl $2, %%ecx \n\t" + "rep; stosl \n\t" + "movl %%edx, %%ecx \n\t" + "andl $3, %%ecx \n\t" + "rep; stosb \n\t" + : + : "c" (len), "D" (dst) + : "memory", "%eax" ); +} + #endif /* #if DONT_USE_GCC_BUILT_IN_STRLEN */ @@ -161,10 +182,11 @@ { register char *ret = s1; while (n && (*s1++ = *s2++)) - --n; - /* while (n--) *s1++ = '\0'; */ - if (n > 0) - bzero(s1, n); + --n; + /* while (n--) *s1++ = '\0'; */ + if (n > 0) { + bzero(s1, n); + } return ret; } @@ -306,9 +328,9 @@ uint8_t * cp = (uint8_t *) start; unsigned int i; - for ( i = 0; i < length; i++) - csum += *cp++; - - return csum; + for ( i = 0; i < length; i++) { + csum += *cp++; + } + return csum; } Index: branches/ErmaC/Enoch/i386/libsa/prf.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/prf.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/prf.c (revision 2323) @@ -60,7 +60,7 @@ printn(n, b, flag, minwidth, putfn_p, putfn_arg) u_long n; int b, flag, minwidth; - int (*putfn_p)(); + void (*putfn_p)(); void *putfn_arg; { char prbuf[11]; @@ -73,7 +73,7 @@ } cp = prbuf; do { - *cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b]; + *cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b]; n /= b; width++; } while (n); @@ -84,83 +84,111 @@ } while (width++ < minwidth) (*putfn_p)( (flag & ZERO) ? '0' : ' ', putfn_arg); - + do (*putfn_p)(*--cp, putfn_arg); while (cp > prbuf); } -void prf( +int prf( char *fmt, unsigned int *adx, - int (*putfn_p)(), + void (*putfn_p)(), void *putfn_arg ) { - int b, c; + int b, c, len =0; char *s; int flag = 0, width = 0; - int minwidth; + int minwidth; loop: while ((c = *fmt++) != '%') { if(c == '\0') - return; - (*putfn_p)(c, putfn_arg); + { + return len; + } + if (putfn_p) + { + (*putfn_p)(c, putfn_arg); + } + len++; } - minwidth = 0; + minwidth = 0; again: c = *fmt++; switch (c) { - case 'l': - goto again; - case ' ': - flag |= SPACE; - goto again; - case '0': - if (minwidth == 0) { - /* this is a flag */ - flag |= ZERO; - goto again; - } /* fall through */ - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - minwidth *= 10; - minwidth += c - '0'; - goto again; + case 'l': + goto again; + case ' ': + flag |= SPACE; + goto again; + case '0': + if (minwidth == 0) + { + /* this is a flag */ + flag |= ZERO; + goto again; + } /* fall through */ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + minwidth *= 10; + minwidth += c - '0'; + goto again; case 'X': - flag |= UCASE; - /* fall through */ - case 'x': - b = 16; - goto number; - case 'd': - b = 10; - goto number; - case 'o': case 'O': - b = 8; -number: - printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg); - break; - case 's': - s = (char *)*adx; - while ((c = *s++)) { - (*putfn_p)(c, putfn_arg); - width++; - } - while (width++ < minwidth) - (*putfn_p)(' ', putfn_arg); - break; - case 'c': - (*putfn_p)((char)*adx, putfn_arg); - break; + flag |= UCASE; + /* fall through */ + case 'x': + b = 16; + goto number; + case 'd': + b = 10; + goto number; + case 'o': case 'O': + b = 8; + number: + if (putfn_p) + { + printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg); + } + len++; + break; + case 's': + s = (char *)*adx; + while ((c = *s++)) + { + if (putfn_p) + { + (*putfn_p)(c, putfn_arg); + } + len++; + width++; + } + while (width++ < minwidth) + { + if (putfn_p) + { + (*putfn_p)(' ', putfn_arg); + } + len++; + } + break; + case 'c': + if (putfn_p) + { + (*putfn_p)((char)*adx, putfn_arg); + } + len++; + break; + default: + break; } adx++; goto loop; Index: branches/ErmaC/Enoch/i386/libsa/strtol.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/strtol.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/strtol.c (revision 2323) @@ -66,7 +66,7 @@ * Added support for "0b101..." binary constants. * Commented out references to errno. */ - + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91"; #endif /* LIBC_SCCS and not lint */ @@ -103,21 +103,28 @@ if (c == '-') { neg = 1; c = *s++; - } else if (c == '+') + } + else if (c == '+') + { c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { + } + + if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) + { c = s[1]; s += 2; base = 16; - } else if ((base == 0 || base == 2) && - c == '0' && (*s == 'b' || *s == 'B')) { + } + else if ((base == 0 || base == 2) && c == '0' && (*s == 'b' || *s == 'B')) + { c = s[1]; s += 2; base = 2; } if (base == 0) + { base = c == '0' ? 8 : 10; + } /* * Compute the cutoff value between legal numbers and illegal @@ -148,7 +155,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -194,35 +201,52 @@ if (c == '-') { neg = 1; c = *s++; - } else if (c == '+') + } + else if (c == '+') + { c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { + } + if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) + { c = s[1]; s += 2; base = 16; - } else if ((base == 0 || base == 2) && - c == '0' && (*s == 'b' || *s == 'B')) { + } + else if ((base == 0 || base == 2) && c == '0' && (*s == 'b' || *s == 'B')) + { c = s[1]; s += 2; base = 2; } if (base == 0) + { base = c == '0' ? 8 : 10; + } cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; for (acc = 0, any = 0;; c = *s++) { if (isdigit(c)) + { c -= '0'; + } else if (isalpha(c)) + { c -= isupper(c) ? 'A' - 10 : 'a' - 10; + } else + { break; + } if (c >= base) + { break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + } + if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim)) + { any = -1; - else { + } + else + { any = 1; acc *= base; acc += c; @@ -231,10 +255,15 @@ if (any < 0) { acc = ULONG_MAX; // errno = ERANGE; - } else if (neg) + } + else if (neg) + { acc = -acc; + } if (endptr != 0) + { *endptr = (char *)(any ? s - 1 : nptr); + } return (acc); } @@ -269,31 +298,46 @@ } else { neg = 0; if (c == '+') + { c = *s++; + } } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { + if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) + { c = s[1]; s += 2; base = 16; } if (base == 0) + { base = c == '0' ? 8 : 10; + } qbase = (unsigned)base; cutoff = (unsigned long long)UQUAD_MAX / qbase; cutlim = (unsigned long long)UQUAD_MAX % qbase; for (acc = 0, any = 0;; c = *s++) { if (isdigit(c)) + { c -= '0'; + } else if (isalpha(c)) + { c -= isupper(c) ? 'A' - 10 : 'a' - 10; + } else + { break; + } if (c >= base) + { break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + } + if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim)) + { any = -1; - else { + } + else + { any = 1; acc *= qbase; acc += c; @@ -302,9 +346,14 @@ if (any < 0) { acc = UQUAD_MAX; // errno = ERANGE; - } else if (neg) + } + else if (neg) + { acc = -acc; + } if (endptr != 0) + { *endptr = (char *)(any ? s - 1 : nptr); + } return (acc); } Index: branches/ErmaC/Enoch/i386/libsa/efi_tables.c =================================================================== --- branches/ErmaC/Enoch/i386/libsa/efi_tables.c (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/efi_tables.c (revision 2323) @@ -129,17 +129,21 @@ bool efi_guid_is_null(EFI_GUID const *pGuid) { - if(pGuid->Data1 == 0 && pGuid->Data2 == 0 && pGuid->Data3 == 0) - { - int i; - for(i=0; i<8; ++i) - { - if(pGuid->Data4[i] != 0) - return false; - } - return true; - } - return false; + if (pGuid->Data1 == 0 && pGuid->Data2 == 0 && pGuid->Data3 == 0) + { + int i; + + for (i = 0; i < 8; ++i) + { + if (pGuid->Data4[i] != 0) + { + return false; + } + } + return true; + } + + return false; } #define COMPARE_MEMBER_AND_RETURN_IF_NE(a,b,mem) \ @@ -154,7 +158,8 @@ COMPARE_MEMBER_AND_RETURN_IF_NE(pG1, pG2, Data2); COMPARE_MEMBER_AND_RETURN_IF_NE(pG1, pG2, Data3); int i; - for(i=0; i<8; ++i) + + for(i = 0; i < 8; ++i) { COMPARE_MEMBER_AND_RETURN_IF_NE(pG1, pG2, Data4[i]); } Index: branches/ErmaC/Enoch/i386/libsa/memory.h =================================================================== --- branches/ErmaC/Enoch/i386/libsa/memory.h (revision 2322) +++ branches/ErmaC/Enoch/i386/libsa/memory.h (revision 2323) @@ -57,7 +57,7 @@ #define BOOT2_SEG 0x2000 #define BOOT2_OFS 0x0200 // 512 byte disk sector offset -#define BOOT2_MAX_LENGTH 0x6FE00 // Maximum size for boot2 is currentl 447kb +#define BOOT2_MAX_LENGTH 0x6FE00 // Maximum size for boot2 is currentl 447kb #define BIOS_ADDR 0x8000 // BIOS disk I/O buffer #define BIOS_LEN 0x8000 // 32K - divisible by 512 and 2048 @@ -118,9 +118,10 @@ #define OFFSET(addr) ((addr) & 0xFFFF) #define SEGMENT(addr) (((addr) & 0xF0000) >> 4) -/* Extract segment/offset in normalized form so that the resulting far pointer - will point to something that is very unlikely to straddle a segment. - This is sometimes known as a "huge" pointer. +/* + * Extract segment/offset in normalized form so that the resulting far pointer + * will point to something that is very unlikely to straddle a segment. + * This is sometimes known as a "huge" pointer. */ #define NORMALIZED_OFFSET(addr) ((addr) & 0x000F) #define NORMALIZED_SEGMENT(addr) (((addr) & 0xFFFF0) >> 4) @@ -131,7 +132,7 @@ #define MIN_SYS_MEM_KB (32 * 1024) /* - * The number of descriptor entries in the GDT. + * The number of descriptor entries in the GDT (Global Descriptor Table). */ #define NGDTENT 7 @@ -139,6 +140,6 @@ * The total size of the GDT in bytes. * Each descriptor entry require 8 bytes. */ -#define GDTLIMIT ( NGDTENT * 8 ) +#define GDTLIMIT (NGDTENT * 8) #endif /* !__BOOT_MEMORY_H */ Index: branches/ErmaC/Enoch/i386/util/bdmesg.c =================================================================== --- branches/ErmaC/Enoch/i386/util/bdmesg.c (revision 2322) +++ branches/ErmaC/Enoch/i386/util/bdmesg.c (revision 2323) @@ -14,23 +14,14 @@ int main(int argc, char *argv[]) { - io_registry_entry_t root; - CFTypeRef bootLog = NULL; - - root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); - - if (root) - bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0); - - if (!bootLog) + io_registry_entry_t root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); + if (!root) { - // Check for Clover boot log - root = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/efi/platform"); - - if (root) - bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0); + printf("IORegistryEntry \"IOIOService:/\" not found.\n"); + return 0; } + CFTypeRef bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0); if (!bootLog) { printf("\"boot-log\" property not found.\n"); @@ -38,9 +29,10 @@ } const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog); - if (msglog) printf("%s\n", msglog); + CFRelease(bootLog); return 0; } + Index: branches/ErmaC/Enoch/i386/util/openUp.c =================================================================== --- branches/ErmaC/Enoch/i386/util/openUp.c (revision 2322) +++ branches/ErmaC/Enoch/i386/util/openUp.c (revision 2323) @@ -20,7 +20,7 @@ * @APPLE_LICENSE_HEADER_END@ */ /* - * Shantonu Sen <> + * Shantonu Sen * openUp.c - program to set the "first-open-window" field of a volume * * Get the directory ID for the first argument, and set it as word 2 Index: branches/ErmaC/Enoch/i386/util/machOconv.c =================================================================== --- branches/ErmaC/Enoch/i386/util/machOconv.c (revision 2322) +++ branches/ErmaC/Enoch/i386/util/machOconv.c (revision 2323) @@ -40,8 +40,10 @@ static unsigned long swap(unsigned long x) { - if (swap_ends) return OSSwapInt32(x); - else return x; + if (swap_ends) + return OSSwapInt32(x); + else + return x; } int @@ -52,64 +54,57 @@ int nc, ncmds; char * cp; - if (argc == 2) - { - infile = open(argv[1], O_RDONLY); - if (infile < 0) goto usage; - outfile = fileno(stdout); + if (argc == 2) { + infile = open(argv[1], O_RDONLY); + if (infile < 0) + goto usage; + outfile = fileno(stdout); } - else if (argc == 3) - { + else if (argc == 3) { infile = open(argv[1], O_RDONLY); - if (infile < 0) goto usage; - outfile = open(argv[2], O_WRONLY|O_CREAT|O_TRUNC, 0644); - if (outfile < 0) goto usage; + if (infile < 0) + goto usage; + outfile = open(argv[2], O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (outfile < 0) + goto usage; } - else - { - usage: + else { +usage: fprintf(stderr, "usage: machOconv inputfile [outputfile]\n"); - exit(1); + exit(1); } nc = read(infile, &mh, sizeof (mh)); - if (nc < 0) - { - perror("read mach header"); - exit(1); + if (nc < 0) { + perror("read mach header"); + exit(1); } - - if (nc < (int)sizeof (mh)) - { - fprintf(stderr, "read mach header: premature EOF %d\n", nc); - exit(1); + if (nc < (int)sizeof (mh)) { + fprintf(stderr, "read mach header: premature EOF %d\n", nc); + exit(1); } - - - if (mh.magic == MH_MAGIC) swap_ends = false; - else if (mh.magic == MH_CIGAM) swap_ends = true; - else - { + if (mh.magic == MH_MAGIC) + swap_ends = false; + else if (mh.magic == MH_CIGAM) + swap_ends = true; + else { fprintf(stderr, "bad magic number %lx\n", (unsigned long)mh.magic); - exit(1); + exit(1); } - + cmds = calloc(swap(mh.sizeofcmds), sizeof (char)); - if (cmds == 0) - { - fprintf(stderr, "alloc load commands: no memory\n"); - exit(1); + if (cmds == 0) { + fprintf(stderr, "alloc load commands: no memory\n"); + exit(1); } nc = read(infile, cmds, swap(mh.sizeofcmds)); - if (nc < 0) - { - perror("read load commands"); - exit(1); + if (nc < 0) { + perror("read load commands"); + exit(1); } - if (nc < (int)swap(mh.sizeofcmds)) - { - fprintf(stderr, "read load commands: premature EOF %d\n", nc); - exit(1); + if (nc < (int)swap(mh.sizeofcmds)) { + fprintf(stderr, "read load commands: premature EOF %d\n", nc); + exit(1); } unsigned long vmstart = (unsigned long)-1; @@ -118,9 +113,9 @@ for (ncmds = swap(mh.ncmds), cp = cmds; ncmds > 0; ncmds--) { -#define lcp ((struct load_command *)cp) +#define lcp ((struct load_command *)cp) #define scp ((struct segment_command *)cp) - + switch(swap(lcp->cmd)) { case LC_SEGMENT: @@ -132,17 +127,17 @@ cp += swap(lcp->cmdsize); } - + // Second pass: output to file. - for (ncmds = swap(mh.ncmds), cp = cmds; + for (ncmds = swap(mh.ncmds), cp = cmds; ncmds > 0; ncmds--) { -#define lcp ((struct load_command *)cp) +#define lcp ((struct load_command *)cp) #define scp ((struct segment_command *)cp) bool isDATA; unsigned vmsize; - + switch(swap(lcp->cmd)) { case LC_SEGMENT: @@ -155,37 +150,40 @@ { vmsize = swap(scp->vmsize); } - + result = vm_allocate(mach_task_self(), &data, vmsize, true); - if (result != KERN_SUCCESS) { + if (result != KERN_SUCCESS) + { mach_error("vm_allocate segment data", result); exit(1); } - + lseek(infile, swap(scp->fileoff), L_SET); nc = read(infile, (void *)data, swap(scp->filesize)); if (nc < 0) { perror("read segment data"); exit(1); } - if (nc < (int)swap(scp->filesize)) { + if (nc < (int)swap(scp->filesize)) + { fprintf(stderr, "read segment data: premature EOF %d\n", nc); exit(1); } - + lseek(outfile, swap(scp->vmaddr) - vmstart, L_SET); nc = write(outfile, (void *)data, vmsize); - if (nc < (int)vmsize) { + if (nc < (int)vmsize) + { perror("write segment data"); exit(1); } - + vm_deallocate(mach_task_self(), data, vmsize); break; } - + cp += swap(lcp->cmdsize); - } + } - exit(0); + exit(0); } Index: branches/ErmaC/Enoch/package/Distribution =================================================================== --- branches/ErmaC/Enoch/package/Distribution (revision 2322) +++ branches/ErmaC/Enoch/package/Distribution (revision 2323) @@ -9,7 +9,7 @@ - + Chameleon_Package_Title Index: branches/ErmaC/Enoch/package/slimpkg.sh =================================================================== --- branches/ErmaC/Enoch/package/slimpkg.sh (revision 2322) +++ branches/ErmaC/Enoch/package/slimpkg.sh (revision 2323) @@ -179,15 +179,6 @@ } fi # - - if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then - { - mkdir -p ${1}/AutoReso/Root - ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/AutoReso/Root - echo " [BUILD] Resolution " - buildpackage "${1}/AutoReso" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 - } - fi -# - if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then { mkdir -p ${1}/uClibc/Root @@ -198,6 +189,15 @@ } fi # - + if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then + { + mkdir -p ${1}/AutoReso/Root + ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/AutoReso/Root + echo " [BUILD] Resolution " + buildpackage "${1}/AutoReso" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1 + } + fi +# - if [ -e ${1%/*}/i386/modules/Keylayout.dylib ]; then { mkdir -p ${1}/Keylayout/Root @@ -367,6 +367,9 @@ popd >/dev/null # Here is the place for assign a Icon to the pkg +# command use to generate the file: +# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip +# ---- ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/" DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc Rez -append tempicns.rsrc -o "${1%/*}/$packagename-${version}-r$revision.pkg" Index: branches/ErmaC/Enoch/package/OptionalSettings/PowerManagement.txt =================================================================== --- branches/ErmaC/Enoch/package/OptionalSettings/PowerManagement.txt (revision 2322) +++ branches/ErmaC/Enoch/package/OptionalSettings/PowerManagement.txt (revision 2323) @@ -27,8 +27,15 @@ # --------------------------------------------- Bool@CSTUsingSystemIO:CSTUsingSystemIO=Yes Bool@DropSSDT:DropSSDT=Yes +Bool@DropHPET:DropHPET=Yes +Bool@DropSBST:DropSBST=Yes +Bool@DropECDT:DropECDT=Yes +Bool@DropASFT:DropASFT=Yes +Bool@DropDMAR:DropDMAR=Yes Bool@EnableC2State:EnableC2State=Yes Bool@EnableC3State:EnableC3State=Yes Bool@EnableC4State:EnableC4State=Yes +#Bool@EnableC6State:EnableC6State=Yes Bool@GenerateCStates:GenerateCStates=Yes Bool@GeneratePStates:GeneratePStates=Yes +#Bool@GenerateTStates:GenerateTStates=Yes Index: branches/ErmaC/Enoch/package/OptionalSettings/General.txt =================================================================== --- branches/ErmaC/Enoch/package/OptionalSettings/General.txt (revision 2322) +++ branches/ErmaC/Enoch/package/OptionalSettings/General.txt (revision 2323) @@ -28,7 +28,7 @@ Text@arch:arch=i386 Bool@EHCIacquire:EHCIacquire=Yes Bool@EthernetBuiltIn:EthernetBuiltIn=Yes -#Bool@EnableWifi:EnableWifi=Yes +Bool@EnableWifi:EnableWifi=Yes Bool@ForceHPET:ForceHPET=Yes Bool@ForceWake:ForceWake=Yes Bool@ForceFullMemInfo:ForceFullMemInfo=Yes Index: branches/ErmaC/Enoch/package/bin/po4a/po4a-normalize =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/po4a-normalize (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/po4a-normalize (revision 2323) @@ -178,3 +178,4 @@ $parser->writepo('po4a-normalize.po'); __END__ + Index: branches/ErmaC/Enoch/package/bin/po4a/po4a-updatepo =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/po4a-updatepo (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/po4a-updatepo (revision 2323) @@ -103,6 +103,21 @@ Output some debugging information. +=item B I[,B|B] + +Specify the reference format. Argument I can be one of B to not +produce any reference, B to not specify the line number (more +accurately all line numbers are replaced by 1), B to replace line +number by an increasing counter, and B to include complete +references. + +Argument can be followed by a comma and either B or B keyword. +References are written by default on a single line. The B option wraps +references on several lines, to mimic B tools (B and +B). This option will become the default in a future release, because +it is more sensible. The B option is available so that users who want +to keep the old behavior can do so. + =item B<--msgid-bugs-address> I Set the report address for msgid bugs. By default, the created POT files Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Man.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Man.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Man.pm (revision 2323) @@ -2407,6 +2407,8 @@ $macro{'Ss'}=\&translate_mdoc; # .Pp Paragraph Break. Vertical space (one line). $macro{'Pp'}=\&noarg; + # .Lp Same as .Pp + $macro{'Lp'}=\&noarg; # .D1 (D-one) Display-one Indent and display one text line. $macro{'D1'}=\&translate_mdoc; # .Dl (D-ell) Display-one literal. @@ -2427,6 +2429,8 @@ # FIXME: Maybe we could extract other modifiers # as in .It Fl l Ar num $macro{'It'}=\&translate_mdoc; + # .Lk html link + $macro{'Lk'}=\&untranslated; # Manual Domain Macros # ==================== @@ -2440,8 +2444,8 @@ # General Text Domain # =================== - foreach (qw(%A %B %C %D %J %N %O %P %R %T %V - Ac Ao Ap Aq At Bc Bf Bo Bq Bx Db Dc Do Dq Ec Ef Em Eo Fx No Ns + foreach (qw(%A %B %C %D %I %J %N %O %P %Q %R %T %U %V + Ac Ao Ap Aq At Bc Bf Bo Bq Brc Bro Brq Bx Db Dc Do Dq Ec Ef Em Eo Eq Fx No Ns Pc Pf Po Pq Qc Ql Qo Qq Re Rs Rv Sc So Sq Sm Sx Sy Tn Ux Xc Xo)) { $inline{$_} = 1; } Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Po.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Po.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Po.pm (revision 2323) @@ -51,12 +51,39 @@ =over 4 -=item B +=item B I[,B|B] -This specifies the reference format. It can be one of B to not produce -any reference, B to not specify the line number, and B to -include complete references. +Specify the reference format. Argument I can be one of B to not +produce any reference, B to not specify the line number (more +accurately all line numbers are replaced by 1), B to replace line +number by an increasing counter, and B to include complete +references. +Argument can be followed by a comma and either B or B keyword. +References are written by default on a single line. The B option wraps +references on several lines, to mimic B tools (B and +B). This option will become the default in a future release, because +it is more sensible. The B option is available so that users who want +to keep the old behavior can do so. + +=item B<--msgid-bugs-address> I + +Set the report address for msgid bugs. By default, the created POT files +have no Report-Msgid-Bugs-To fields. + +=item B<--copyright-holder> I + +Set the copyright holder in the POT header. The default value is +"Free Software Foundation, Inc." + +=item B<--package-name> I + +Set the package name for the POT header. The default is "PACKAGE". + +=item B<--package-version> I + +Set the package version for the POT header. The default is "VERSION". + =back =cut @@ -150,7 +177,7 @@ chomp $date; # $options = ref($options) || $options; - $self->{options}{'porefs'}= 'full'; + $self->{options}{'porefs'}= 'full,nowrap'; $self->{options}{'msgid-bugs-address'}= undef; $self->{options}{'copyright-holder'}= "Free Software Foundation, Inc."; $self->{options}{'package-name'}= "PACKAGE"; @@ -163,12 +190,15 @@ $self->{options}{$opt} = $options->{$opt}; } } - $self->{options}{'porefs'} =~ /^(full|noline|none)$/ || + $self->{options}{'porefs'} =~ /^(full|counter|noline|none)(,(no)?wrap)?$/ || die wrap_mod("po4a::po", dgettext ("po4a", "Invalid value for option 'porefs' ('%s' is ". - "not one of 'full', 'noline' or 'none')"), + "not one of 'full', 'counter', 'noline' or 'none')"), $self->{options}{'porefs'}); + if ($self->{options}{'porefs'} =~ m/^counter/) { + $self->{counter} = {}; + } $self->{po}=(); $self->{count}=0; # number of msgids in the PO @@ -429,9 +459,15 @@ $output .= format_comment($self->{po}{$msgid}{'type'},". type: ") if defined($self->{po}{$msgid}{'type'}) && length ($self->{po}{$msgid}{'type'}); - $output .= format_comment($self->{po}{$msgid}{'reference'},": ") - if defined($self->{po}{$msgid}{'reference'}) - && length ($self->{po}{$msgid}{'reference'}); + if ( defined($self->{po}{$msgid}{'reference'}) + && length ($self->{po}{$msgid}{'reference'})) { + my $output_ref = $self->{po}{$msgid}{'reference'}; + if ($self->{options}{'porefs'} =~ m/,wrap$/) { + $output_ref = wrap($output_ref); + $output_ref =~ s/\s+$//mg; + } + $output .= format_comment($output_ref,": "); + } $output .= "#, ". join(", ", sort split(/\s+/,$self->{po}{$msgid}{'flags'}))."\n" if defined($self->{po}{$msgid}{'flags'}) && length ($self->{po}{$msgid}{'flags'}); @@ -1221,10 +1257,23 @@ return; } - if ($self->{options}{'porefs'} eq "none") { + if ($self->{options}{'porefs'} =~ m/^none/) { $reference = ""; - } elsif ($self->{options}{'porefs'} eq "noline") { - $reference =~ s/:[0-9]*/:1/g; + } elsif ($self->{options}{'porefs'} =~ m/^counter/) { + if ($reference =~ m/^(.+?)(?=\S+:\d+)/g) { + my $new_ref = $1; + 1 while $reference =~ s{ # x modifier is added to add formatting and improve readability + \G(\s*)(\S+):\d+ # \G is the last match in m//g (see also the (?=) syntax above) + # $2 is the file name + }{ + $self->{counter}{$2} ||= 0, # each file has its own counter + ++$self->{counter}{$2}, # increment it + $new_ref .= "$1$2:".$self->{counter}{$2} # replace line number by this counter + }gex && pos($reference); + $reference = $new_ref; + } + } elsif ($self->{options}{'porefs'} =~ m/^noline/) { + $reference =~ s/:\d+/:1/g; } if (defined($self->{po}{$msgid})) { @@ -1275,7 +1324,7 @@ if (defined $transref) { $self->{po}{$msgid}{'transref'} = $transref; } - if (defined $reference) { + if (defined($reference) && length($reference)) { if (defined $self->{po}{$msgid}{'reference'}) { $self->{po}{$msgid}{'reference'} .= " ".$reference; } else { Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Text.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Text.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Text.pm (revision 2323) @@ -150,6 +150,10 @@ my %control = (); +my $parse_func = \&parse_fallback; + +my @comments = (); + =back =cut @@ -189,22 +193,25 @@ } if (defined $options{'debianchangelog'}) { - $debianchangelog=1; + $parse_func = \&parse_debianchangelog; } if (defined $options{'fortunes'}) { - $fortunes=1; + $parse_func = \&parse_fortunes; } if (defined $options{'markdown'}) { + $parse_func = \&parse_markdown; $markdown=1; } if (defined $options{'asciidoc'}) { + $parse_func = \&parse_asciidoc; $asciidoc=1; } if (defined $options{'control'}) { + $parse_func = \&parse_control; if ($options{'control'} eq "1") { $control{''}=1; } else { @@ -215,173 +222,251 @@ } } -sub parse { - my $self = shift; - my ($line,$ref); - my $paragraph=""; - my $wrapped_mode = 1; - my $expect_header = 1; - my $end_of_paragraph = 0; - ($line,$ref)=$self->shiftline(); - my $file = $ref; - $file =~ s/:[0-9]+$// if defined($line); - while (defined($line)) { - $ref =~ m/^(.*):[0-9]+$/; - if ($1 ne $file) { - $file = $1; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - $expect_header = 1; +sub parse_fallback { + my ($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = @_; + if ( ($line =~ /^\s*$/) + or ( defined $breaks + and $line =~ m/^$breaks$/)) { + # Break paragraphs on lines containing only spaces + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1 unless defined($self->{verbatim}); + $self->pushline($line."\n"); + undef $self->{controlkey}; + } elsif ($line =~ /^-- $/) { + # Break paragraphs on email signature hint + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline($line."\n"); + } elsif ( $line =~ /^=+$/ + or $line =~ /^_+$/ + or $line =~ /^-+$/) { + $wrapped_mode = 0; + $paragraph .= $line."\n"; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + } elsif ($tabs eq "split" and $line =~ m/\t/ and $paragraph !~ m/\t/s) { + $wrapped_mode = 0; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph = "$line\n"; + $wrapped_mode = 0; + } elsif ($tabs eq "split" and $line !~ m/\t/ and $paragraph =~ m/\t/s) { + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph = "$line\n"; + $wrapped_mode = 1; + } else { + if ($line =~ /^\s/) { + # A line starting by a space indicates a non-wrap + # paragraph + $wrapped_mode = 0; } + if ($markdown and + ( $line =~ /\S $/ # explicit newline + or $line =~ /"""$/)) { # """ textblock inside macro begin + # Markdown markup needing separation _after_ this line + $end_of_paragraph = 1; + } else { + undef $self->{bullet}; + undef $self->{indent}; + } +# TODO: comments + $paragraph .= $line."\n"; + } + return ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); +} - chomp($line); - $self->{ref}="$ref"; - if ($debianchangelog and - $expect_header and - $line =~ /^(\w[-+0-9a-z.]*)\ \(([^\(\) \t]+)\) # src, version - \s+([-+0-9a-z.]+); # distribution - \s*urgency\s*\=\s*(.*\S)\s*$/ix) { # - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $self->pushline("$line\n"); - $expect_header=0; - } elsif ($debianchangelog and - $line =~ m/^ \-\- (.*) <(.*)> ((\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}(\s+\([^\\\(\)]\))?)$/) { - # Found trailer - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $self->pushline("$line\n"); - $expect_header=1; - } elsif ($fortunes and - $line =~ m/^%%?\s*$/) { - # Found end of fortune - do_paragraph($self,$paragraph,$wrapped_mode); - $self->pushline("\n") unless ( $wrapped_mode == 0 - or $paragraph eq ""); - $paragraph=""; - $wrapped_mode = 1; - $self->pushline("$line\n"); - } elsif ( $line =~ m/^([^ :]*): *(.*)$/ - and %control) { - warn "Unrecognized section: '$paragraph'\n" - unless $paragraph eq ""; - my $tag = $1; - my $val = $2; - my $t; - if ($control{''} or $control{$tag}) { - $t = $self->translate($val, - $self->{ref}, - $tag.(defined $self->{controlkey}?", ".$self->{controlkey}:""), - "wrap" => 0); +sub parse_debianchangelog { + my ($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = @_; + if ($expect_header and + $line =~ /^(\w[-+0-9a-z.]*)\ \(([^\(\) \t]+)\) # src, version + \s+([-+0-9a-z.]+); # distribution + \s*urgency\s*\=\s*(.*\S)\s*$/ix) { # + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $self->pushline("$line\n"); + $expect_header=0; + } elsif ($line =~ m/^ \-\- (.*) <(.*)> ((\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}(\s+\([^\\\(\)]\))?)$/) { + # Found trailer + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $self->pushline("$line\n"); + $expect_header=1; + } else { + return parse_fallback($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); + } + return ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); +} + +sub parse_fortunes { + my ($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = @_; + if ($line =~ m/^%%?\s*$/) { + # Found end of fortune + do_paragraph($self,$paragraph,$wrapped_mode); + $self->pushline("\n") unless ( $wrapped_mode == 0 + or $paragraph eq ""); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline("$line\n"); + } else { + $line =~ s/%%(.*)$//; + } + return ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); +} + +sub parse_control { + my ($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = @_; + if ($line =~ m/^([^ :]*): *(.*)$/) { + warn "Unrecognized section: '$paragraph'\n" + unless $paragraph eq ""; + my $tag = $1; + my $val = $2; + my $t; + if ($control{''} or $control{$tag}) { + $t = $self->translate($val, + $self->{ref}, + $tag.(defined $self->{controlkey}?", ".$self->{controlkey}:""), + "wrap" => 0); + } else { + $t = $val; + } + if (not defined $self->{controlkey}) { + $self->{controlkey} = "$tag: $val"; + } + $self->pushline("$tag: $t\n"); + $paragraph=""; + $wrapped_mode = 1; + $self->{bullet} = ""; + $self->{indent} = " "; + } elsif ($line eq " .") { + do_paragraph($self,$paragraph,$wrapped_mode, + "Long Description".(defined $self->{controlkey}?", ".$self->{controlkey}:"")); + $paragraph=""; + $self->pushline($line."\n"); + $self->{bullet} = ""; + $self->{indent} = " "; + } elsif ($line =~ m/^ Link: +(.*)$/) { + do_paragraph($self,$paragraph,$wrapped_mode, + "Long Description".(defined $self->{controlkey}?", ".$self->{controlkey}:"")); + my $link=$1; + my $t1 = $self->translate("Link: ", + $self->{ref}, + "Link", + "wrap" => 0); + my $t2 = $self->translate($link, + $self->{ref}, + "Link".(defined $self->{controlkey}?", ".$self->{controlkey}:""), + "wrap" => 0); + $self->pushline(" $t1$t2\n"); + $paragraph=""; + } elsif (defined $self->{indent} and + $line =~ m/^$self->{indent}\S/) { + $paragraph .= $line."\n"; + $self->{type} = "Long Description".(defined $self->{controlkey}?", ".$self->{controlkey}:""); + } else { + return parse_fallback($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); + } + return ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); +} + +my $asciidoc_RE_SECTION_TEMPLATES = "sect1|sect2|sect3|sect4|preface|colophon|dedication|synopsis|index"; +my $asciidoc_RE_STYLE_ADMONITION = "TIP|NOTE|IMPORTANT|WARNING|CAUTION"; +my $asciidoc_RE_STYLE_PARAGRAPH = "normal|literal|verse|quote|listing|abstract|partintro|comment|example|sidebar|source|music|latex|graphviz"; +my $asciidoc_RE_STYLE_NUMBERING = "arabic|loweralpha|upperalpha|lowerroman|upperroman"; +my $asciidoc_RE_STYLE_LIST = "appendix|horizontal|qanda|glossary|bibliography"; +my $asciidoc_RE_STYLES = "$asciidoc_RE_SECTION_TEMPLATES|$asciidoc_RE_STYLE_ADMONITION|$asciidoc_RE_STYLE_PARAGRAPH|$asciidoc_RE_STYLE_NUMBERING|$asciidoc_RE_STYLE_LIST|float"; + +BEGIN { + my $UnicodeGCString_available = 0; + $UnicodeGCString_available = 1 if (eval { require Unicode::GCString }); + eval { + sub columns($$$) { + my $text = shift; + my $encoder = shift; + $text = $encoder->decode($text) if (defined($encoder) && $encoder->name ne "ascii"); + if ($UnicodeGCString_available) { + return Unicode::GCString->new($text)->columns(); } else { - $t = $val; + $text =~ s/\n$//s; + return length($text) if !(defined($encoder) && $encoder->name ne "ascii"); + die wrap_mod("po4a::text", + dgettext("po4a", "Detection of two line titles failed at %s\nInstall the Unicode::GCString module!"), shift) } - if (not defined $self->{controlkey}) { - $self->{controlkey} = "$tag: $val"; - } - $self->pushline("$tag: $t\n"); - $paragraph=""; + } + }; +} + +sub parse_asciidoc { + my ($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = @_; + if ((defined $self->{verbatim}) and ($self->{verbatim} == 3)) { + # Untranslated blocks + $self->pushline($line."\n"); + if ($line =~ m/^~{4,}$/) { + undef $self->{verbatim}; + undef $self->{type}; $wrapped_mode = 1; - $self->{bullet} = ""; - $self->{indent} = " "; - } elsif (%control and - $line eq " .") { - do_paragraph($self,$paragraph,$wrapped_mode, - "Long Description".(defined $self->{controlkey}?", ".$self->{controlkey}:"")); - $paragraph=""; - $self->pushline($line."\n"); - $self->{bullet} = ""; - $self->{indent} = " "; - } elsif (%control and - $line =~ m/^ Link: +(.*)$/) { - do_paragraph($self,$paragraph,$wrapped_mode, - "Long Description".(defined $self->{controlkey}?", ".$self->{controlkey}:"")); - my $link=$1; - my $t1 = $self->translate("Link: ", - $self->{ref}, - "Link", - "wrap" => 0); - my $t2 = $self->translate($link, - $self->{ref}, - "Link".(defined $self->{controlkey}?", ".$self->{controlkey}:""), - "wrap" => 0); - $self->pushline(" $t1$t2\n"); - $paragraph=""; - } elsif (%control and - defined $self->{indent} and - $line =~ m/^$self->{indent}\S/) { - $paragraph .= $line."\n"; - $self->{type} = "Long Description".(defined $self->{controlkey}?", ".$self->{controlkey}:""); - } elsif ( (defined $self->{verbatim}) - and ($self->{verbatim} == 2)) { - # Untranslated blocks - $self->pushline($line."\n"); - if ($asciidoc and - ($line =~ m/^(\/{4,}|~{4,})$/)) { - undef $self->{verbatim}; - undef $self->{type}; - $wrapped_mode = 1; - } - } elsif ( ($line =~ /^\s*$/) - or ( defined $breaks - and $line =~ m/^$breaks$/)) { - # Break paragraphs on lines containing only spaces - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1 unless defined($self->{verbatim}); - $self->pushline($line."\n"); - undef $self->{controlkey}; - } elsif ($asciidoc and (not defined($self->{verbatim})) and - ($line =~ m/^(\+|--)$/)) { - # List Item Continuation or List Block - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $self->pushline($line."\n"); - } elsif ($asciidoc and (not defined($self->{verbatim})) and - ($line =~ m/^(={4,}|-{4,}|~{4,}|\^{4,}|\+{4,})$/) and - (defined($paragraph) )and - ($paragraph =~ m/^[^\n]*\n$/s) and - (length($paragraph) == (length($line)+1))) { - # Found title - $wrapped_mode = 0; - my $level = $line; - $level =~ s/^(.).*$/$1/; - $paragraph =~ s/\n$//s; - my $t = $self->translate($paragraph, - $self->{ref}, - "Title $level", - "wrap" => 0); - $self->pushline($t."\n"); - $paragraph=""; + } + } elsif ((defined $self->{verbatim}) and ($self->{verbatim} == 2)) { + # CommentBlock + if ($line =~ m/^\/{4,}$/) { + undef $self->{verbatim}; + undef $self->{type}; $wrapped_mode = 1; - $self->pushline(($level x (length($t)))."\n"); - } elsif ($asciidoc and - ($line =~ m/^(={1,5})( +)(.*?)( +\1)?$/)) { - my $titlelevel1 = $1; - my $titlespaces = $2; - my $title = $3; - my $titlelevel2 = $4||""; - # Found one line title + } else { + push @comments, $line; + } + } elsif ((not defined($self->{verbatim})) and ($line =~ m/^(\+|--)$/)) { + # List Item Continuation or List Block + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $self->pushline($line."\n"); + } elsif ((not defined($self->{verbatim})) and + ($line =~ m/^(={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})$/) and + (defined($paragraph) )and + ($paragraph =~ m/^[^\n]*\n$/s) and + (columns($paragraph, $self->{TT}{po_in}{encoder}, $ref) == (length($line)))) { + # Found title + $wrapped_mode = 0; + my $level = $line; + $level =~ s/^(.).*$/$1/; + $paragraph =~ s/\n$//s; + my $t = $self->translate($paragraph, + $self->{ref}, + "Title $level", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline($t."\n"); + $paragraph=""; + @comments=(); + $wrapped_mode = 1; + $self->pushline(($level x (columns($t, $self->{TT}{po_in}{encoder}, $ref)))."\n"); + } elsif ($line =~ m/^(={1,5})( +)(.*?)( +\1)?$/) { + my $titlelevel1 = $1; + my $titlespaces = $2; + my $title = $3; + my $titlelevel2 = $4||""; + # Found one line title + do_paragraph($self,$paragraph,$wrapped_mode); + $wrapped_mode = 0; + $paragraph=""; + my $t = $self->translate($title, + $self->{ref}, + "Title $titlelevel1", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline($titlelevel1.$titlespaces.$t.$titlelevel2."\n"); + @comments=(); + $wrapped_mode = 1; + } elsif ($line =~ m/^(\/{4,}|\+{4,}|-{4,}|\.{4,}|\*{4,}|_{4,}|={4,}|~{4,}|\|={4,})$/) { + # Found one delimited block + my $t = $line; + $t =~ s/^(.).*$/$1/; + my $type = "delimited block $t"; + if (defined $self->{verbatim} and ($self->{type} ne $type)) { + $paragraph .= "$line\n"; + } else { do_paragraph($self,$paragraph,$wrapped_mode); - $wrapped_mode = 0; - $paragraph=""; - my $t = $self->translate($title, - $self->{ref}, - "Title $titlelevel1", - "wrap" => 0); - $self->pushline($titlelevel1.$titlespaces.$t.$titlelevel2."\n"); - $wrapped_mode = 1; - } elsif ($asciidoc and - ($line =~ m/^(\/{4,}|\+{4,}|-{4,}|\.{4,}|\*{4,}|_{4,}|={4,}|~{4,})$/)) { - # Found one delimited block - my $t = $line; - $t =~ s/^(.).*$/$1/; - my $type = "delimited block $t"; - if (defined $self->{verbatim} and ($self->{type} ne $type)) { - $paragraph .= "$line\n"; - } else { - do_paragraph($self,$paragraph,$wrapped_mode); if ( (defined $self->{type}) and ($self->{type} eq $type)) { undef $self->{type}; @@ -395,7 +480,7 @@ # PassthroughBlock $wrapped_mode = 0; $self->{verbatim} = 1; - } elsif ($t eq "-") { + } elsif ($t eq "-" or $t eq "|") { # ListingBlock $wrapped_mode = 0; $self->{verbatim} = 1; @@ -421,295 +506,298 @@ } elsif ($t eq "~") { # Filter blocks, TBC: not translated $wrapped_mode = 0; - $self->{verbatim} = 2; + $self->{verbatim} = 3; } $self->{type} = $type; } $paragraph=""; - $self->pushline($line."\n"); - } - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^\[\[([^\]]*)\]\]$/)) { - # Found BlockId - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - $self->pushline($line."\n"); - undef $self->{bullet}; - undef $self->{indent}; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($paragraph eq "") and - ($line =~ m/^((?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):\s+)(.*)$/)) { - my $type = $1; - my $text = $2; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=$text."\n"; - $wrapped_mode = 1; - $self->pushline($type); - undef $self->{bullet}; - undef $self->{indent}; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^\[(NOTE|TIP|IMPORTANT|WARNING|CAUTION|verse|quote)\]$/)) { - my $type = $1; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - $self->pushline($line."\n"); - if ($type eq "verse") { - $wrapped_mode = 0; - } - undef $self->{bullet}; - undef $self->{indent}; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^\[(verse|quote), +(.*)\]$/)) { - my $type = $1; - my $arg = $2; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - my $t = $self->translate($arg, - $self->{ref}, - "$type", - "wrap" => 0); - $self->pushline("[$type, $t]\n"); - $wrapped_mode = 1; - if ($type eq "verse") { - $wrapped_mode = 0; - } - $self->{type} = $type; - undef $self->{bullet}; - undef $self->{indent}; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^\[icon="(.*)"\]$/)) { - my $arg = $1; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - my $t = $self->translate($arg, - $self->{ref}, - "icon", - "wrap" => 0); - $self->pushline("[icon=\"$t\"]\n"); - $wrapped_mode = 1; - undef $self->{bullet}; - undef $self->{indent}; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^\[icons=None, +caption="(.*)"\]$/)) { - my $arg = $1; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - my $t = $self->translate($arg, - $self->{ref}, - "caption", - "wrap" => 0); - $self->pushline("[icons=None, caption=\"$t\"]\n"); - $wrapped_mode = 1; - undef $self->{bullet}; - undef $self->{indent}; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^(\s*)([*_+`'#[:alnum:]].*)((?:::|;;|\?\?|:-)(?: *\\)?)$/)) { - my $indent = $1; - my $label = $2; - my $labelend = $3; - # Found labeled list - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - $self->{bullet} = ""; + $self->pushline($line."\n") unless defined($self->{verbatim}) && $self->{verbatim} == 2; + } + } elsif ((not defined($self->{verbatim})) and ($line =~ m/^\/\/(.*)/)) { + # Comment line + push @comments, $1; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^\[\[([^\]]*)\]\]$/)) { + # Found BlockId + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline($line."\n"); + undef $self->{bullet}; + undef $self->{indent}; + } elsif (not defined $self->{verbatim} and + ($paragraph eq "") and + ($line =~ m/^((?:$asciidoc_RE_STYLE_ADMONITION):\s+)(.*)$/)) { + my $type = $1; + my $text = $2; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=$text."\n"; + $wrapped_mode = 1; + $self->pushline($type); + undef $self->{bullet}; + undef $self->{indent}; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^\[($asciidoc_RE_STYLES)\]$/)) { + my $type = $1; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline($line."\n"); + if ($type eq "verse") { + $wrapped_mode = 0; + } + undef $self->{bullet}; + undef $self->{indent}; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^\[(['"]?)(verse|quote)\1, +(.*)\]$/)) { + my $quote = $1 || ''; + my $type = $2; + my $arg = $3; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + my $t = $self->translate($arg, + $self->{ref}, + "$type", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline("[$quote$type$quote, $t]\n"); + @comments=(); + $wrapped_mode = 1; + if ($type eq "verse") { + $wrapped_mode = 0; + } + $self->{type} = $type; + undef $self->{bullet}; + undef $self->{indent}; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^\[icon="(.*)"\]$/)) { + my $arg = $1; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + my $t = $self->translate($arg, + $self->{ref}, + "icon", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline("[icon=\"$t\"]\n"); + @comments=(); + $wrapped_mode = 1; + undef $self->{bullet}; + undef $self->{indent}; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^\[icons=None, +caption="(.*)"\]$/)) { + my $arg = $1; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + my $t = $self->translate($arg, + $self->{ref}, + "caption", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline("[icons=None, caption=\"$t\"]\n"); + @comments=(); + $wrapped_mode = 1; + undef $self->{bullet}; + undef $self->{indent}; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^(\s*)([*_+`'#[:alnum:]].*)((?:::|;;|\?\?|:-)(?: *\\)?)$/)) { + my $indent = $1; + my $label = $2; + my $labelend = $3; + # Found labeled list + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + $self->{bullet} = ""; + $self->{indent} = $indent; + my $t = $self->translate($label, + $self->{ref}, + "Labeled list", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline("$indent$t$labelend\n"); + @comments=(); + } elsif (not defined $self->{verbatim} and + ($line =~ m/^(\s*)(\S.*)((?:::|;;)\s+)(.*)$/)) { + my $indent = $1; + my $label = $2; + my $labelend = $3; + my $labeltext = $4; + # Found Horizontal Labeled Lists + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=$labeltext."\n"; + $wrapped_mode = 1; + $self->{bullet} = ""; + $self->{indent} = $indent; + my $t = $self->translate($label, + $self->{ref}, + "Labeled list", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline("$indent$t$labelend"); + @comments=(); + } elsif (not defined $self->{verbatim} and + ($line =~ m/^\:(\S.*?)(:\s*)(.*)$/)) { + my $attrname = $1; + my $attrsep = $2; + my $attrvalue = $3; + # Found a Attribute entry + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + undef $self->{bullet}; + undef $self->{indent}; + my $t = $self->translate($attrvalue, + $self->{ref}, + "Attribute :$attrname:", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline(":$attrname$attrsep$t\n"); + @comments=(); + } elsif (not defined $self->{verbatim} and + ($line !~ m/^\.\./) and ($line =~ m/^\.(\S.*)$/)) { + my $title = $1; + # Found block title + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + undef $self->{bullet}; + undef $self->{indent}; + my $t = $self->translate($title, + $self->{ref}, + "Block title", + "comment" => join("\n", @comments), + "wrap" => 0); + $self->pushline(".$t\n"); + @comments=(); + } elsif (not defined $self->{verbatim} and + ($line =~ m/^(\s*)((?:[-*o+]|(?:[0-9]+[.\)])|(?:[a-z][.\)])|\([0-9]+\)|\.|\.\.)\s+)(.*)$/)) { + my $indent = $1||""; + my $bullet = $2; + my $text = $3; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph = $text."\n"; + $self->{indent} = $indent; + $self->{bullet} = $bullet; + } elsif (not defined $self->{verbatim} and + ($line =~ m/^((?: +)(.*)$/)) { + my $bullet = $1; + my $text = $2; + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph = $text."\n"; + $self->{indent} = ""; + $self->{bullet} = $bullet; + } elsif (not defined $self->{verbatim} and + (defined $self->{bullet} and $line =~ m/^(\s+)(.*)$/)) { + my $indent = $1; + my $text = $2; + if (not defined $self->{indent}) { + $paragraph .= $text."\n"; $self->{indent} = $indent; - my $t = $self->translate($label, - $self->{ref}, - "Labeled list", - "wrap" => 0); - $self->pushline("$indent$t$labelend\n"); - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^(\s*)(\S.*)((?:::|;;)\s+)(.*)$/)) { - my $indent = $1; - my $label = $2; - my $labelend = $3; - my $labeltext = $4; - # Found Horizontal Labeled Lists + } elsif (length($paragraph) and (length($self->{bullet}) + length($self->{indent}) == length($indent))) { + $paragraph .= $text."\n"; + } else { do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=$labeltext."\n"; - $wrapped_mode = 1; - $self->{bullet} = ""; - $self->{indent} = $indent; - my $t = $self->translate($label, - $self->{ref}, - "Labeled list", - "wrap" => 0); - $self->pushline("$indent$t$labelend"); - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^\:(\S.*?)(:\s*)(.*)$/)) { - my $attrname = $1; - my $attrsep = $2; - my $attrvalue = $3; - # Found a Attribute entry - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - undef $self->{bullet}; - undef $self->{indent}; - my $t = $self->translate($attrvalue, - $self->{ref}, - "Attribute :$attrname:", - "wrap" => 0); - $self->pushline(":$attrname$attrsep$t\n"); - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line !~ m/^\.\./) and ($line =~ m/^\.(\S.*)$/)) { - my $title = $1; - # Found block title - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - undef $self->{bullet}; - undef $self->{indent}; - my $t = $self->translate($title, - $self->{ref}, - "Block title", - "wrap" => 0); - $self->pushline(".$t\n"); - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^(\s*)((?:[-*o+]|(?:[0-9]+[.\)])|(?:[a-z][.\)])|\([0-9]+\)|\.|\.\.)\s+)(.*)$/)) { - my $indent = $1||""; - my $bullet = $2; - my $text = $3; - do_paragraph($self,$paragraph,$wrapped_mode); $paragraph = $text."\n"; $self->{indent} = $indent; - $self->{bullet} = $bullet; - } elsif ($asciidoc and not defined $self->{verbatim} and - ($line =~ m/^((?: +)(.*)$/)) { - my $bullet = $1; - my $text = $2; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph = $text."\n"; - $self->{indent} = ""; - $self->{bullet} = $bullet; - } elsif ($asciidoc and not defined $self->{verbatim} and - (defined $self->{bullet} and $line =~ m/^(\s+)(.*)$/)) { - my $indent = $1; - my $text = $2; - if (not defined $self->{indent}) { - $paragraph .= $text."\n"; - $self->{indent} = $indent; - } elsif (length($paragraph) and (length($self->{bullet}) + length($self->{indent}) == length($indent))) { - $paragraph .= $text."\n"; - } else { + $self->{bullet} = ""; + } + } else { + return parse_fallback($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); + } + return ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); +} - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph = $text."\n"; - $self->{indent} = $indent; - $self->{bullet} = ""; - } - } elsif ($markdown and - (not defined($self->{verbatim})) and - ($line =~ m/^(={4,}|-{4,})$/) and - (defined($paragraph) )and - ($paragraph =~ m/^[^\n]*\n$/s) and - (length($paragraph) == (length($line)+1))) { - # XXX: There can be any number of underlining according - # to the documentation. This detection, which avoid - # translating the formatting, is only supported if - # the underlining has the same size as the header text. - # Found title - $wrapped_mode = 0; - my $level = $line; - $level =~ s/^(.).*$/$1/; - my $t = $self->translate($paragraph, - $self->{ref}, - "Title $level", - "wrap" => 0); - $self->pushline($t); - $paragraph=""; - $wrapped_mode = 1; - $self->pushline(($level x (length($t)-1))."\n"); - } elsif ($markdown and - ($line =~ m/^(#{1,6})( +)(.*?)( +\1)?$/)) { - my $titlelevel1 = $1; - my $titlespaces = $2; - my $title = $3; - my $titlelevel2 = $4||""; - # Found one line title +sub parse_markdown { + my ($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = @_; + if (($line =~ m/^(={4,}|-{4,})$/) and + (defined($paragraph) ) and + ($paragraph =~ m/^[^\n]*\n$/s) and + (length($paragraph) == (length($line)+1))) { + # XXX: There can be any number of underlining according + # to the documentation. This detection, which avoid + # translating the formatting, is only supported if + # the underlining has the same size as the header text. + # Found title + $wrapped_mode = 0; + my $level = $line; + $level =~ s/^(.).*$/$1/; + my $t = $self->translate($paragraph, + $self->{ref}, + "Title $level", + "wrap" => 0); + $self->pushline($t); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline(($level x (length($t)-1))."\n"); + } elsif ($line =~ m/^(#{1,6})( +)(.*?)( +\1)?$/) { + my $titlelevel1 = $1; + my $titlespaces = $2; + my $title = $3; + my $titlelevel2 = $4||""; + # Found one line title + do_paragraph($self,$paragraph,$wrapped_mode); + $wrapped_mode = 0; + $paragraph=""; + my $t = $self->translate($title, + $self->{ref}, + "Title $titlelevel1", + "wrap" => 0); + $self->pushline($titlelevel1.$titlespaces.$t.$titlelevel2."\n"); + $wrapped_mode = 1; + } elsif (($paragraph eq "") and + ($line =~ /^((\*\s*){3,}|(-\s*){3,}|(_\s*){3,})$/)) { + # Horizontal rule + $wrapped_mode = 1; + $self->pushline($line."\n"); + } elsif ( $line =~ /^\s*\[\[\!\S+\s*$/ # macro begin + or $line =~ /^\s*"""\s*\]\]\s*$/) { # """ textblock inside macro end + # Avoid translating Markdown lines containing only markup + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph=""; + $wrapped_mode = 1; + $self->pushline("$line\n"); + } elsif ( $line =~ /^#/ # headline + or $line =~ /^\s*\[\[\!\S[^\]]*\]\]\s*$/) { # sole macro + # Preserve some Markdown markup as a single line + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph="$line\n"; + $wrapped_mode = 0; + $end_of_paragraph = 1; + } elsif ($line =~ /^"""/) { # """ textblock inside macro end + # Markdown markup needing separation _before_ this line + do_paragraph($self,$paragraph,$wrapped_mode); + $paragraph="$line\n"; + $wrapped_mode = 1; + } else { + return parse_fallback($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); + } + return ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); +} + +sub parse { + my $self = shift; + my ($line,$ref); + my $paragraph=""; + my $wrapped_mode = 1; + my $expect_header = 1; + my $end_of_paragraph = 0; + ($line,$ref)=$self->shiftline(); + my $file = $ref; + $file =~ s/:[0-9]+$// if defined($line); + while (defined($line)) { + $ref =~ m/^(.*):[0-9]+$/; + if ($1 ne $file) { + $file = $1; do_paragraph($self,$paragraph,$wrapped_mode); - $wrapped_mode = 0; $paragraph=""; - my $t = $self->translate($title, - $self->{ref}, - "Title $titlelevel1", - "wrap" => 0); - $self->pushline($titlelevel1.$titlespaces.$t.$titlelevel2."\n"); $wrapped_mode = 1; - } elsif ($markdown and - ($paragraph eq "") and - ($line =~ /^((\*\s*){3,}|(-\s*){3,}|(_\s*){3,})$/)) { - # Horizontal rule - $wrapped_mode = 1; - $self->pushline($line."\n"); - } elsif ($line =~ /^-- $/) { - # Break paragraphs on email signature hint - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - $self->pushline($line."\n"); - } elsif ( $line =~ /^=+$/ - or $line =~ /^_+$/ - or $line =~ /^-+$/) { - $wrapped_mode = 0; - $paragraph .= $line."\n"; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - } elsif ($markdown and - ( $line =~ /^\s*\[\[\!\S+\s*$/ # macro begin - or $line =~ /^\s*"""\s*\]\]\s*$/)) { # """ textblock inside macro end - # Avoid translating Markdown lines containing only markup - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph=""; - $wrapped_mode = 1; - $self->pushline("$line\n"); - } elsif ($markdown and - ( $line =~ /^#/ # headline - or $line =~ /^\s*\[\[\!\S[^\]]*\]\]\s*$/)) { # sole macro - # Preserve some Markdown markup as a single line - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph="$line\n"; - $wrapped_mode = 0; - $end_of_paragraph = 1; - } elsif ($markdown and - ( $line =~ /^"""/)) { # """ textblock inside macro end - # Markdown markup needing separation _before_ this line - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph="$line\n"; - $wrapped_mode = 1; - } elsif ($tabs eq "split" and $line =~ m/\t/ and $paragraph !~ m/\t/s) { - $wrapped_mode = 0; - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph = "$line\n"; - $wrapped_mode = 0; - } elsif ($tabs eq "split" and $line !~ m/\t/ and $paragraph =~ m/\t/s) { - do_paragraph($self,$paragraph,$wrapped_mode); - $paragraph = "$line\n"; - $wrapped_mode = 1; - } else { - if ($line =~ /^\s/) { - # A line starting by a space indicates a non-wrap - # paragraph - $wrapped_mode = 0; - } - if ($markdown and - ( $line =~ /\S $/ # explicit newline - or $line =~ /"""$/)) { # """ textblock inside macro begin - # Markdown markup needing separation _after_ this line - $end_of_paragraph = 1; - } else { - undef $self->{bullet}; - undef $self->{indent}; - } - if ($fortunes) { - $line =~ s/%%(.*)$//; - } -# TODO: comments - $paragraph .= $line."\n"; + $expect_header = 1; } + + chomp($line); + $self->{ref}="$ref"; + ($paragraph,$wrapped_mode,$expect_header,$end_of_paragraph) = &$parse_func($self,$line,$ref,$paragraph,$wrapped_mode,$expect_header,$end_of_paragraph); # paragraphs starting by a bullet, or numbered # or paragraphs with a line containing many consecutive spaces # (more than 3) @@ -811,7 +899,9 @@ my $t = $self->translate($paragraph, $self->{ref}, $type, + "comment" => join("\n", @comments), "wrap" => $wrap); + @comments = (); if (defined $self->{bullet}) { my $bullet = $self->{bullet}; my $indent1 = $self->{indent}; Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/TransTractor.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/TransTractor.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/TransTractor.pm (revision 2323) @@ -11,7 +11,7 @@ use subs qw(makespace); use vars qw($VERSION @ISA @EXPORT); -$VERSION="0.41.1"; +$VERSION="0.44"; @ISA = qw(DynaLoader); @EXPORT = qw(new process translate read write readpo writepo @@ -131,28 +131,28 @@ my $first=1; my ($line,$lref)=$self->shiftline(); while (defined($line)) { - if ($line =~ m/

/ && !$first--; ) { - # Not the first time we see

. - # Reput the current line in input, - # and put the built paragraph to output - $self->unshiftline($line,$lref); + if ($line =~ m/

/ && !$first--; ) { + # Not the first time we see

. + # Reput the current line in input, + # and put the built paragraph to output + $self->unshiftline($line,$lref); - # Now that the document is formed, translate it: - # - Remove the leading tag - $paragraph =~ s/^

//s; + # Now that the document is formed, translate it: + # - Remove the leading tag + $paragraph =~ s/^

//s; - # - push to output the leading tag (untranslated) and the - # rest of the paragraph (translated) - $self->pushline( "

" + # - push to output the leading tag (untranslated) and the + # rest of the paragraph (translated) + $self->pushline( "

" . $document->translate($paragraph,$pararef) ); - next PARAGRAPH; - } else { - # Append to the paragraph - $paragraph .= $line; - $pararef = $lref unless(length($pararef)); - } + next PARAGRAPH; + } else { + # Append to the paragraph + $paragraph .= $line; + $pararef = $lref unless(length($pararef)); + } # Reinit the loop ($line,$lref)=$self->shiftline(); @@ -275,63 +275,63 @@ # Build the args for new() my %newparams = (); foreach (keys %params) { - next if ($_ eq 'po_in_name' || - $_ eq 'po_out_name' || - $_ eq 'file_in_name' || - $_ eq 'file_in_charset' || - $_ eq 'file_out_name' || - $_ eq 'file_out_charset' || - $_ eq 'addendum' || - $_ eq 'addendum_charset'); - $newparams{$_}=$params{$_}; + next if ($_ eq 'po_in_name' || + $_ eq 'po_out_name' || + $_ eq 'file_in_name' || + $_ eq 'file_in_charset' || + $_ eq 'file_out_name' || + $_ eq 'file_out_charset' || + $_ eq 'addendum' || + $_ eq 'addendum_charset'); + $newparams{$_}=$params{$_}; } $self->detected_charset($params{'file_in_charset'}); $self->{TT}{'file_out_charset'}=$params{'file_out_charset'}; if (defined($self->{TT}{'file_out_charset'}) and - length($self->{TT}{'file_out_charset'})) { - $self->{TT}{'file_out_encoder'} = find_encoding($self->{TT}{'file_out_charset'}); + length($self->{TT}{'file_out_charset'})) { + $self->{TT}{'file_out_encoder'} = find_encoding($self->{TT}{'file_out_charset'}); } $self->{TT}{'addendum_charset'}=$params{'addendum_charset'}; chdir $params{'srcdir'} - if (defined $params{'srcdir'}); + if (defined $params{'srcdir'}); foreach my $file (@{$params{'po_in_name'}}) { - print STDERR "readpo($file)... " if $self->debug(); - $self->readpo($file); - print STDERR "done.\n" if $self->debug() + print STDERR "readpo($file)... " if $self->debug(); + $self->readpo($file); + print STDERR "done.\n" if $self->debug() } foreach my $file (@{$params{'file_in_name'}}) { - print STDERR "read($file)..." if $self->debug(); - $self->read($file); - print STDERR "done.\n" if $self->debug(); + print STDERR "read($file)..." if $self->debug(); + $self->read($file); + print STDERR "done.\n" if $self->debug(); } print STDERR "parse..." if $self->debug(); $self->parse(); print STDERR "done.\n" if $self->debug(); foreach my $file (@{$params{'addendum'}}) { - print STDERR "addendum($file)..." if $self->debug(); - $self->addendum($file) || die "An addendum failed\n"; - print STDERR "done.\n" if $self->debug(); + print STDERR "addendum($file)..." if $self->debug(); + $self->addendum($file) || die "An addendum failed\n"; + print STDERR "done.\n" if $self->debug(); } chdir $params{'destdir'} - if (defined $params{'destdir'}); + if (defined $params{'destdir'}); if (defined $params{'file_out_name'}) { - print STDERR "write(".$params{'file_out_name'}.")... " - if $self->debug(); - $self->write($params{'file_out_name'}); - print STDERR "done.\n" if $self->debug(); + print STDERR "write(".$params{'file_out_name'}.")... " + if $self->debug(); + $self->write($params{'file_out_name'}); + print STDERR "done.\n" if $self->debug(); } chdir $params{'srcdir'} - if (defined $params{'srcdir'}); + if (defined $params{'srcdir'}); if (defined $params{'po_out_name'}) { - print STDERR "writepo(".$params{'po_out_name'}.")... " - if $self->debug(); - $self->writepo($params{'po_out_name'}); - print STDERR "done.\n" if $self->debug(); + print STDERR "writepo(".$params{'po_out_name'}.")... " + if $self->debug(); + $self->writepo($params{'po_out_name'}); + print STDERR "done.\n" if $self->debug(); } chdir $params{'calldir'} - if (defined $params{'calldir'}); + if (defined $params{'calldir'}); return $self; } @@ -372,10 +372,10 @@ $self->{TT}{doc_in}=(); $self->{TT}{doc_out}=(); if (defined $options{'verbose'}) { - $self->{TT}{verbose} = $options{'verbose'}; + $self->{TT}{verbose} = $options{'verbose'}; } if (defined $options{'debug'}) { - $self->{TT}{debug} = $options{'debug'}; + $self->{TT}{debug} = $options{'debug'}; } # Input document is in ascii until we prove the opposite (in read()) $self->{TT}{ascii_input}=1; @@ -383,7 +383,6 @@ # document isn't in ascii) $self->{TT}{utf_mode}=0; - return $self; } @@ -407,33 +406,33 @@ sub read() { my $self=shift; my $filename=shift - or croak wrap_msg(dgettext("po4a", "Can't read from file without having a filename")); + or croak wrap_msg(dgettext("po4a", "Can't read from file without having a filename")); my $linenum=0; open INPUT,"<$filename" - or croak wrap_msg(dgettext("po4a", "Can't read from %s: %s"), $filename, $!); + or croak wrap_msg(dgettext("po4a", "Can't read from %s: %s"), $filename, $!); while (defined (my $textline = )) { - $linenum++; - my $ref="$filename:$linenum"; - $textline =~ s/\r$//; - my @entry=($textline,$ref); - push @{$self->{TT}{doc_in}}, @entry; + $linenum++; + my $ref="$filename:$linenum"; + $textline =~ s/\r$//; + my @entry=($textline,$ref); + push @{$self->{TT}{doc_in}}, @entry; - if (!defined($self->{TT}{'file_in_charset'})) { - # Detect if this file has non-ascii characters - if($self->{TT}{ascii_input}) { - my $decoder = guess_encoding($textline); - if (!ref($decoder) or $decoder !~ /Encode::XS=/) { - # We have detected a non-ascii line - $self->{TT}{ascii_input} = 0; - # Save the reference for future error message - $self->{TT}{non_ascii_ref} ||= $ref; - } - } - } + if (!defined($self->{TT}{'file_in_charset'})) { + # Detect if this file has non-ascii characters + if($self->{TT}{ascii_input}) { + my $decoder = guess_encoding($textline); + if (!ref($decoder) or $decoder !~ /Encode::XS=/) { + # We have detected a non-ascii line + $self->{TT}{ascii_input} = 0; + # Save the reference for future error message + $self->{TT}{non_ascii_ref} ||= $ref; + } + } + } } close INPUT - or croak wrap_msg(dgettext("po4a", "Can't close %s after reading: %s"), $filename, $!); + or croak wrap_msg(dgettext("po4a", "Can't close %s after reading: %s"), $filename, $!); } @@ -446,29 +445,29 @@ sub write { my $self=shift; my $filename=shift - or croak wrap_msg(dgettext("po4a", "Can't write to a file without filename")); + or croak wrap_msg(dgettext("po4a", "Can't write to a file without filename")); my $fh; if ($filename eq '-') { - $fh=\*STDOUT; + $fh=\*STDOUT; } else { - # make sure the directory in which we should write the localized file exists - my $dir = $filename; - if ($dir =~ m|/|) { - $dir =~ s|/[^/]*$||; + # make sure the directory in which we should write the localized file exists + my $dir = $filename; + if ($dir =~ m|/|) { + $dir =~ s|/[^/]*$||; - File::Path::mkpath($dir, 0, 0755) # Croaks on error - if (length ($dir) && ! -e $dir); - } - open $fh,">$filename" - or croak wrap_msg(dgettext("po4a", "Can't write to %s: %s"), $filename, $!); + File::Path::mkpath($dir, 0, 0755) # Croaks on error + if (length ($dir) && ! -e $dir); + } + open $fh,">$filename" + or croak wrap_msg(dgettext("po4a", "Can't write to %s: %s"), $filename, $!); } map { print $fh $_ } $self->docheader(); map { print $fh $_ } @{$self->{TT}{doc_out}}; if ($filename ne '-') { - close $fh or croak wrap_msg(dgettext("po4a", "Can't close %s after writing: %s"), $filename, $!); + close $fh or croak wrap_msg(dgettext("po4a", "Can't close %s after writing: %s"), $filename, $!); } } @@ -541,63 +540,65 @@ my ($filename,$header)=shift; my ($errcode,$mode,$position,$boundary,$bmode,$content)= - (1,"","","","",""); + (1,"","","","",""); unless (open (INS, "<$filename")) { - warn wrap_msg(dgettext("po4a", "Can't read from %s: %s"), $filename, $!); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "Can't read from %s: %s"), $filename, $!); + goto END_PARSE_ADDFILE; } unless (defined ($header=) && $header) { - warn wrap_msg(dgettext("po4a", "Can't read po4a header from %s."), $filename); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "Can't read po4a header from %s."), $filename); + goto END_PARSE_ADDFILE; } unless ($header =~ s/PO4A-HEADER://i) { - warn wrap_msg(dgettext("po4a", "First line of %s does not look like a po4a header."), $filename); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "First line of %s does not look like a po4a header."), $filename); + goto END_PARSE_ADDFILE; } foreach my $part (split(/;/,$header)) { - unless ($part =~ m/^\s*([^=]*)=(.*)$/) { - warn wrap_msg(dgettext("po4a", "Syntax error in po4a header of %s, near \"%s\""), $filename, $part); - goto END_PARSE_ADDFILE; - } - my ($key,$value)=($1,$2); - $key=lc($key); - if ($key eq 'mode') { $mode=lc($value); - } elsif ($key eq 'position') { $position=$value; - } elsif ($key eq 'endboundary') { - $boundary=$value; - $bmode='after'; - } elsif ($key eq 'beginboundary') { - $boundary=$value; - $bmode='before'; - } else { - warn wrap_msg(dgettext("po4a", "Invalid argument in the po4a header of %s: %s"), $filename, $key); - goto END_PARSE_ADDFILE; - } + unless ($part =~ m/^\s*([^=]*)=(.*)$/) { + warn wrap_msg(dgettext("po4a", "Syntax error in po4a header of %s, near \"%s\""), $filename, $part); + goto END_PARSE_ADDFILE; + } + my ($key,$value)=($1,$2); + $key=lc($key); + if ($key eq 'mode') { + $mode=lc($value); + } elsif ($key eq 'position') { + $position=$value; + } elsif ($key eq 'endboundary') { + $boundary=$value; + $bmode='after'; + } elsif ($key eq 'beginboundary') { + $boundary=$value; + $bmode='before'; + } else { + warn wrap_msg(dgettext("po4a", "Invalid argument in the po4a header of %s: %s"), $filename, $key); + goto END_PARSE_ADDFILE; + } } unless (length($mode)) { - warn wrap_msg(dgettext("po4a", "The po4a header of %s does not define the mode."), $filename); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "The po4a header of %s does not define the mode."), $filename); + goto END_PARSE_ADDFILE; } unless ($mode eq "before" || $mode eq "after") { - warn wrap_msg(dgettext("po4a", "Mode invalid in the po4a header of %s: should be 'before' or 'after' not %s."), $filename, $mode); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "Mode invalid in the po4a header of %s: should be 'before' or 'after' not %s."), $filename, $mode); + goto END_PARSE_ADDFILE; } unless (length($position)) { - warn wrap_msg(dgettext("po4a", "The po4a header of %s does not define the position."), $filename); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "The po4a header of %s does not define the position."), $filename); + goto END_PARSE_ADDFILE; } unless ($mode eq "before" || length($boundary)) { - warn wrap_msg(dgettext("po4a", "No ending boundary given in the po4a header, but mode=after.")); - goto END_PARSE_ADDFILE; + warn wrap_msg(dgettext("po4a", "No ending boundary given in the po4a header, but mode=after.")); + goto END_PARSE_ADDFILE; } while (defined(my $line = )) { - $content .= $line; + $content .= $line; } close INS; @@ -617,15 +618,15 @@ print STDERR "Apply addendum $filename..." if $self->debug(); unless ($filename) { - warn wrap_msg(dgettext("po4a", - "Can't apply addendum when not given the filename")); - return 0; + warn wrap_msg(dgettext("po4a", + "Can't apply addendum when not given the filename")); + return 0; } die wrap_msg(dgettext("po4a", "Addendum %s does not exist."), $filename) unless -e $filename; my ($errcode,$mode,$position,$boundary,$bmode,$content)= - addendum_parse($filename); + addendum_parse($filename); return 0 if ($errcode); print STDERR "mode=$mode;pos=$position;bound=$boundary;bmode=$bmode;ctn=$content\n" @@ -635,68 +636,68 @@ # suppose it's already in the output document's charset if (defined($self->{TT}{'addendum_charset'}) && length($self->{TT}{'addendum_charset'})) { - Encode::from_to($content,$self->{TT}{'addendum_charset'}, - $self->get_out_charset); + Encode::from_to($content,$self->{TT}{'addendum_charset'}, + $self->get_out_charset); } my $found = scalar grep { /$position/ } @{$self->{TT}{doc_out}}; if ($found == 0) { - warn wrap_msg(dgettext("po4a", - "No candidate position for the addendum %s."), $filename); - return 0; + warn wrap_msg(dgettext("po4a", + "No candidate position for the addendum %s."), $filename); + return 0; } if ($found > 1) { - warn wrap_msg(dgettext("po4a", - "More than one candidate position found for the addendum %s."), $filename); - return 0; + warn wrap_msg(dgettext("po4a", + "More than one candidate position found for the addendum %s."), $filename); + return 0; } if ($mode eq "before") { - if ($self->verbose() > 1 || $self->debug() ) { - map { print STDERR wrap_msg(dgettext("po4a", "Addendum '%s' applied before this line: %s"), $filename, $_) if (/$position/); - } @{$self->{TT}{doc_out}}; - } - @{$self->{TT}{doc_out}} = map { /$position/ ? ($content,$_) : $_ + if ($self->verbose() > 1 || $self->debug() ) { + map { print STDERR wrap_msg(dgettext("po4a", "Addendum '%s' applied before this line: %s"), $filename, $_) if (/$position/); + } @{$self->{TT}{doc_out}}; + } + @{$self->{TT}{doc_out}} = map { /$position/ ? ($content,$_) : $_ } @{$self->{TT}{doc_out}}; } else { - my @newres=(); + my @newres=(); - do { - # make sure it doesn't whine on empty document - my $line = scalar @{$self->{TT}{doc_out}} ? shift @{$self->{TT}{doc_out}} : ""; - push @newres,$line; - my $outline=mychomp($line); - $outline =~ s/^[ \t]*//; + do { + # make sure it doesn't whine on empty document + my $line = scalar @{$self->{TT}{doc_out}} ? shift @{$self->{TT}{doc_out}} : ""; + push @newres,$line; + my $outline=mychomp($line); + $outline =~ s/^[ \t]*//; - if ($line =~ m/$position/) { - while ($line=shift @{$self->{TT}{doc_out}}) { - last if ($line=~/$boundary/); - push @newres,$line; - } - if (defined $line) { - if ($bmode eq 'before') { - print wrap_msg(dgettext("po4a", - "Addendum '%s' applied before this line: %s"), - $filename, $outline) - if ($self->verbose() > 1 || $self->debug()); - push @newres,$content; - push @newres,$line; - } else { - print wrap_msg(dgettext("po4a", - "Addendum '%s' applied after the line: %s."), - $filename, $outline) - if ($self->verbose() > 1 || $self->debug()); - push @newres,$line; - push @newres,$content; - } - } else { - print wrap_msg(dgettext("po4a", "Addendum '%s' applied at the end of the file."), $filename) - if ($self->verbose() > 1 || $self->debug()); - push @newres,$content; - } - } - } while (scalar @{$self->{TT}{doc_out}}); - @{$self->{TT}{doc_out}} = @newres; + if ($line =~ m/$position/) { + while ($line=shift @{$self->{TT}{doc_out}}) { + last if ($line=~/$boundary/); + push @newres,$line; + } + if (defined $line) { + if ($bmode eq 'before') { + print wrap_msg(dgettext("po4a", + "Addendum '%s' applied before this line: %s"), + $filename, $outline) + if ($self->verbose() > 1 || $self->debug()); + push @newres,$content; + push @newres,$line; + } else { + print wrap_msg(dgettext("po4a", + "Addendum '%s' applied after the line: %s."), + $filename, $outline) + if ($self->verbose() > 1 || $self->debug()); + push @newres,$line; + push @newres,$content; + } + } else { + print wrap_msg(dgettext("po4a", "Addendum '%s' applied at the end of the file."), $filename) + if ($self->verbose() > 1 || $self->debug()); + push @newres,$content; + } + } + } while (scalar @{$self->{TT}{doc_out}}); + @{$self->{TT}{doc_out}} = @newres; } print STDERR "done.\n" if $self->debug(); return 1; @@ -739,12 +740,12 @@ sub shiftline { my ($line,$ref)=(shift @{$_[0]->{TT}{doc_in}}, - shift @{$_[0]->{TT}{doc_in}}); + shift @{$_[0]->{TT}{doc_in}}); return ($line,$ref); } sub unshiftline { - my $self = shift; - unshift @{$self->{TT}{doc_in}},@_; + my $self = shift; + unshift @{$self->{TT}{doc_in}},@_; } sub pushline { push @{$_[0]->{TT}{doc_out}}, $_[1] if defined $_[1]; } @@ -782,7 +783,7 @@ a hash. For example: $self->translate("string","ref","type", - 'wrap' => 1); + 'wrap' => 1); =over @@ -838,29 +839,29 @@ # map { $validoption{$_}=1 } (split(/ /,$validoption)); # foreach (keys %options) { - # Carp::confess "internal error: translate() called with unknown arg $_. Valid options: $validoption" - # unless $validoption{$_}; + # Carp::confess "internal error: translate() called with unknown arg $_. Valid options: $validoption" + # unless $validoption{$_}; # } my $in_charset; if ($self->{TT}{ascii_input}) { - $in_charset = "ascii"; + $in_charset = "ascii"; } else { - if (defined($self->{TT}{'file_in_charset'}) and - length($self->{TT}{'file_in_charset'}) and - $self->{TT}{'file_in_charset'} !~ m/ascii/i) { - $in_charset=$self->{TT}{'file_in_charset'}; - } else { - # FYI, the document charset have to be determined *before* we see the first - # string to recode. - die wrap_mod("po4a", dgettext("po4a", "Couldn't determine the input document's charset. Please specify it on the command line. (non-ASCII char at %s)"), $self->{TT}{non_ascii_ref}) - } + if (defined($self->{TT}{'file_in_charset'}) and + length($self->{TT}{'file_in_charset'}) and + $self->{TT}{'file_in_charset'} !~ m/ascii/i) { + $in_charset=$self->{TT}{'file_in_charset'}; + } else { + # FYI, the document charset have to be determined *before* we see the first + # string to recode. + die wrap_mod("po4a", dgettext("po4a", "Couldn't determine the input document's charset. Please specify it on the command line. (non-ASCII char at %s)"), $self->{TT}{non_ascii_ref}) + } } if ($self->{TT}{po_in}->get_charset ne "CHARSET") { - $string = encode_from_to($string, - $self->{TT}{'file_in_encoder'}, - $self->{TT}{po_in}{encoder}); + $string = encode_from_to($string, + $self->{TT}{'file_in_encoder'}, + $self->{TT}{po_in}{encoder}); } if (defined $options{'wrapcol'} && $options{'wrapcol'} < 0) { @@ -868,51 +869,51 @@ $options{'wrapcol'} = 76 + $options{'wrapcol'}; } my $transstring = $self->{TT}{po_in}->gettext($string, - 'wrap' => $options{'wrap'}||0, - 'wrapcol' => $options{'wrapcol'}); + 'wrap' => $options{'wrap'}||0, + 'wrapcol' => $options{'wrapcol'}); if ($self->{TT}{po_in}->get_charset ne "CHARSET") { - my $out_encoder = $self->{TT}{'file_out_encoder'}; - unless (defined $out_encoder) { - $out_encoder = find_encoding($self->get_out_charset) - } - $transstring = encode_from_to($transstring, - $self->{TT}{po_in}{encoder}, - $out_encoder); + my $out_encoder = $self->{TT}{'file_out_encoder'}; + unless (defined $out_encoder) { + $out_encoder = find_encoding($self->get_out_charset) + } + $transstring = encode_from_to($transstring, + $self->{TT}{po_in}{encoder}, + $out_encoder); } # If the input document isn't completely in ascii, we should see what to # do with the current string unless ($self->{TT}{ascii_input}) { my $out_charset = $self->{TT}{po_out}->get_charset; - # We set the output po charset + # We set the output po charset if ($out_charset eq "CHARSET") { - if ($self->{TT}{utf_mode}) { - $out_charset="UTF-8"; - } else { - $out_charset=$in_charset; - } - $self->{TT}{po_out}->set_charset($out_charset); - } - if ( $in_charset !~ /^$out_charset$/i ) { - Encode::from_to($string,$in_charset,$out_charset); - if (defined($options{'comment'}) and length($options{'comment'})) { - Encode::from_to($options{'comment'},$in_charset,$out_charset); - } - } + if ($self->{TT}{utf_mode}) { + $out_charset="UTF-8"; + } else { + $out_charset=$in_charset; + } + $self->{TT}{po_out}->set_charset($out_charset); + } + if ( $in_charset !~ /^$out_charset$/i ) { + Encode::from_to($string,$in_charset,$out_charset); + if (defined($options{'comment'}) and length($options{'comment'})) { + Encode::from_to($options{'comment'},$in_charset,$out_charset); + } + } } # the comments provided by the modules are automatic comments from the PO point of view $self->{TT}{po_out}->push('msgid' => $string, - 'reference' => $ref, - 'type' => $type, - 'automatic' => $options{'comment'}, - 'wrap' => $options{'wrap'}||0, - 'wrapcol' => $options{'wrapcol'}); + 'reference' => $ref, + 'type' => $type, + 'automatic' => $options{'comment'}, + 'wrap' => $options{'wrap'}||0, + 'wrapcol' => $options{'wrapcol'}); # if ($self->{TT}{po_in}->get_charset ne "CHARSET") { -# Encode::from_to($transstring,$self->{TT}{po_in}->get_charset, -# $self->get_out_charset); +# Encode::from_to($transstring,$self->{TT}{po_in}->get_charset, +# $self->get_out_charset); # } if ($options{'wrap'}||0) { @@ -938,9 +939,9 @@ sub verbose { if (defined $_[1]) { - $_[0]->{TT}{verbose} = $_[1]; + $_[0]->{TT}{verbose} = $_[1]; } else { - return $_[0]->{TT}{verbose} || 0; # undef and 0 have the same meaning, but one generates warnings + return $_[0]->{TT}{verbose} || 0; # undef and 0 have the same meaning, but one generates warnings } } @@ -980,7 +981,7 @@ if (defined $self->{TT}{'file_in_charset'} and length $self->{TT}{'file_in_charset'} and $self->{TT}{'file_in_charset'} !~ m/ascii/i) { - $self->{TT}{ascii_input}=0; + $self->{TT}{ascii_input}=0; } } @@ -1003,20 +1004,20 @@ # Use the value specified at the command line if (defined($self->{TT}{'file_out_charset'}) and - length($self->{TT}{'file_out_charset'})) { - $charset=$self->{TT}{'file_out_charset'}; + length($self->{TT}{'file_out_charset'})) { + $charset=$self->{TT}{'file_out_charset'}; } else { - if ($self->{TT}{utf_mode} && $self->{TT}{ascii_input}) { - $charset="UTF-8"; - } else { - $charset=$self->{TT}{po_in}->get_charset; - $charset=$self->{TT}{'file_in_charset'} - if $charset eq "CHARSET" and - defined($self->{TT}{'file_in_charset'}) and - length($self->{TT}{'file_in_charset'}); - $charset="ascii" - if $charset eq "CHARSET"; - } + if ($self->{TT}{utf_mode} && $self->{TT}{ascii_input}) { + $charset="UTF-8"; + } else { + $charset=$self->{TT}{po_in}->get_charset; + $charset=$self->{TT}{'file_in_charset'} + if $charset eq "CHARSET" and + defined($self->{TT}{'file_in_charset'}) and + length($self->{TT}{'file_in_charset'}); + $charset="ascii" + if $charset eq "CHARSET"; + } } return $charset; } @@ -1034,14 +1035,14 @@ sub recode_skipped_text { my ($self,$text)=(shift,shift); unless ($self->{TT}{'ascii_input'}) { - if(defined($self->{TT}{'file_in_charset'}) and - length($self->{TT}{'file_in_charset'}) ) { - $text = encode_from_to($text, - $self->{TT}{'file_in_encoder'}, - find_encoding($self->get_out_charset)); - } else { - die wrap_mod("po4a", dgettext("po4a", "Couldn't determine the input document's charset. Please specify it on the command line. (non-ASCII char at %s)"), $self->{TT}{non_ascii_ref}) - } + if(defined($self->{TT}{'file_in_charset'}) and + length($self->{TT}{'file_in_charset'}) ) { + $text = encode_from_to($text, + $self->{TT}{'file_in_encoder'}, + find_encoding($self->get_out_charset)); + } else { + die wrap_mod("po4a", dgettext("po4a", "Couldn't determine the input document's charset. Please specify it on the command line. (non-ASCII char at %s)"), $self->{TT}{non_ascii_ref}) + } } return $text; } @@ -1104,8 +1105,8 @@ all language, using a map-like syntax: $self->pushline_all({ "Description[".$langcode."]=". - $self->translate($line,$ref,$langcode) - }); + $self->translate($line,$ref,$langcode) + }); =back Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Common.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Common.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Common.pm (revision 2323) @@ -76,7 +76,6 @@ eval ' sub wrapi18n($$$) { Text::WrapI18N::wrap($_[0],$_[1],$_[2]) } ' } else { - # If we cannot wrap, well, that's too bad. Survive anyway. eval ' sub wrapi18n($$$) { $_[0].$_[2] } ' } @@ -105,13 +104,13 @@ my $name = shift; print sprintf(gettext( - "%s version %s.\n". - "written by Martin Quinson and Denis Barbier.\n\n". - "Copyright (C) 2002, 2003, 2004 Software in the Public Interest, Inc.\n". - "This is free software; see source code for copying\n". - "conditions. There is NO warranty; not even for\n". - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - ), $name, $Locale::Po4a::TransTractor::VERSION)."\n"; + "%s version %s.\n". + "written by Martin Quinson and Denis Barbier.\n\n". + "Copyright (C) 2002, 2003, 2004 Software in the Public Interest, Inc.\n". + "This is free software; see source code for copying\n". + "conditions. There is NO warranty; not even for\n". + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + ), $name, $Locale::Po4a::TransTractor::VERSION)."\n"; } =item @@ -165,13 +164,13 @@ my @args = @_; if (!$mod) { - # If we don't get a module name, show the message like wrap_mod does - return wrap_mod($ref, $msg, @args); + # If we don't get a module name, show the message like wrap_mod does + return wrap_mod($ref, $msg, @args); } else { - $ref .= ": "; - my $spaces = " " x min(length($ref), 15); - $msg = "$ref($mod)\n$msg"; - return wrapi18n("", $spaces, sprintf($msg, @args))."\n"; + $ref .= ": "; + my $spaces = " " x min(length($ref), 15); + $msg = "$ref($mod)\n$msg"; + return wrapi18n("", $spaces, sprintf($msg, @args))."\n"; } } Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/TeX.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/TeX.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/TeX.pm (revision 2323) @@ -730,7 +730,6 @@ $buffer =~ s/($RE_PRE_COMMENT)$RE_COMMENT([^\n]*)(\n[ \t]*)/$1$end/s; } - # translate leading commands. do { # keep the leading space to put them back after the translation of Index: branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Chooser.pm =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Chooser.pm (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/lib/Locale/Po4a/Chooser.pm (revision 2323) @@ -45,9 +45,9 @@ if ($@) { my $error=$@; warn wrap_msg(gettext("Unknown format type: %s."), $module); - warn wrap_mod("po4a::chooser", - gettext("Module loading error: %s"), $error) - if defined $options{'verbose'} && $options{'verbose'} > 0; + warn wrap_mod("po4a::chooser", + gettext("Module loading error: %s"), $error) + if defined $options{'verbose'} && $options{'verbose'} > 0; list(1); } } Index: branches/ErmaC/Enoch/package/bin/po4a/po4a-gettextize =================================================================== --- branches/ErmaC/Enoch/package/bin/po4a/po4a-gettextize (revision 2322) +++ branches/ErmaC/Enoch/package/bin/po4a/po4a-gettextize (revision 2323) @@ -186,7 +186,7 @@ my ($pofile)=('-'); my (@masterfile,@locfile,$help_fmt,$help,$type,@options); -my ($mastchar,$locchar); +my ($mastchar,$locchar)=('ascii'); Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev'); GetOptions( 'help|h' => \$help, @@ -238,7 +238,12 @@ $mastertt->read($file); } $mastertt->{TT}{utf_mode} = 1; -$mastertt->{TT}{file_in_charset} = $mastchar; +if ($mastertt->{TT}{ascii_input}) { + $mastertt->detected_charset('ascii'); +} else { + $mastertt->detected_charset($mastchar); + $mastertt->{TT}{po_in}->set_charset($mastchar); +} $mastertt->parse; @@ -253,7 +258,8 @@ } # We force the conversion to utf if the master document wasn't in ascii $transtt->{TT}{utf_mode} = !$mastertt->{TT}{ascii_input}; - $transtt->{TT}{file_in_charset} = $locchar; + $transtt->detected_charset($locchar); + $transtt->{TT}{po_in}->set_charset($locchar); $transtt->parse; my $mergedpo = Locale::Po4a::Po->gettextize($mastertt->getpoout(), Index: branches/ErmaC/Enoch/package/Resources/distribution/background =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/Enoch/package/Resources/distribution/background ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/Enoch/package/buildpkg.sh =================================================================== --- branches/ErmaC/Enoch/package/buildpkg.sh (revision 2322) +++ branches/ErmaC/Enoch/package/buildpkg.sh (revision 2323) @@ -103,7 +103,7 @@ choice_group_exclusive[0]="" # Package name -declare -r packagename="Chameleon" +declare -r packagename="Enoch" # Package identifiers declare -r chameleon_package_identity="org.chameleon" @@ -1145,7 +1145,7 @@ makedistribution () { declare -r distributionDestDir="${SYMROOT}" - declare -r distributionFilename="${packagename// /}-${CHAMELEON_VERSION}-r${CHAMELEON_REVISION}.pkg" + declare -r distributionFilename="${packagename// /}-rev.${CHAMELEON_REVISION}.pkg" declare -r distributionFilePath="${distributionDestDir}/${distributionFilename}" rm -f "${distributionDestDir}/${packagename// /}"*.pkg @@ -1199,7 +1199,8 @@ ditto --noextattr --noqtn "${PKGROOT}/Resources/common" "${PKG_BUILD_DIR}/${packagename}/Resources/en.lproj" # CleanUp the directory - find "${PKG_BUILD_DIR}/${packagename}" \( -type d -name '.svn' \) -o -name '.DS_Store' -depth -exec rm -rf {} \; + find "${PKG_BUILD_DIR}/${packagename}" -name .svn -print0 | xargs -0 rm -rf + find "${PKG_BUILD_DIR}/${packagename}" -name '*.DS_Store' -type f -delete find "${PKG_BUILD_DIR}/${packagename}" -type d -depth -empty -exec rmdir {} \; # Remove empty directories # Make substitutions for version, revision, stage, developers, credits, etc.. @@ -1231,13 +1232,13 @@ echo "" echo -e $COL_GREEN" Build info." echo -e $COL_GREEN" ===========" - echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}" - echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" - echo -e $COL_BLUE" Version: "$COL_RESET"$CHAMELEON_VERSION" - echo -e $COL_BLUE" Stage: "$COL_RESET"$CHAMELEON_STAGE" - echo -e $COL_BLUE" Date/Time: "$COL_RESET"$CHAMELEON_BUILDDATE" - echo -e $COL_BLUE" Built by: "$COL_RESET"$CHAMELEON_WHOBUILD" - echo -e $COL_BLUE" Copyright $CHAMELEON_CPRYEAR ""$COL_RESET" + echo -e $COL_CYAN" Package name: "$COL_RESET"${distributionFilename}" + echo -e $COL_CYAN" MD5: "$COL_RESET"$md5" + echo -e $COL_CYAN" Version: "$COL_RESET"$CHAMELEON_VERSION" + echo -e $COL_CYAN" Stage: "$COL_RESET"$CHAMELEON_STAGE" + echo -e $COL_CYAN" Date/Time: "$COL_RESET"$CHAMELEON_BUILDDATE" + echo -e $COL_CYAN" Built by: "$COL_RESET"$CHAMELEON_WHOBUILD" + echo -e $COL_CYAN" Copyright $CHAMELEON_CPRYEAR ""$COL_RESET" echo "" } Index: branches/ErmaC/Enoch/TODO =================================================================== --- branches/ErmaC/Enoch/TODO (revision 2322) +++ branches/ErmaC/Enoch/TODO (revision 2323) @@ -15,7 +15,7 @@ - Case insensitive parsing for the bootConfig options: should help the common/novice user to setup more easily. -- Find out how we can avoid section overlap with the xcode4.4 LD version (we must first reduce the size of the bootloader but it's not enought, maybe we should use a thing comparable to the gnu ld.script, QUESTION: is the xcode4.4 linker still suitable to build standalone app ? ) + ==================================== DONE Index: branches/ErmaC/Enoch/doc/BootHelp.txt =================================================================== --- branches/ErmaC/Enoch/doc/BootHelp.txt (revision 2322) +++ branches/ErmaC/Enoch/doc/BootHelp.txt (revision 2323) @@ -120,9 +120,35 @@ (default path is /private/var/vm/sleepimage). DropSSDT=Yes Skip the SSDT tables while relocating the ACPI tables. + Drop=Yes Skip:[HPET, SLIC, SBST, ECDT, ASF! or DMAR] + DSDT= Use an alternate DSDT.aml file (default path: /DSDT.aml /Extra/DSDT.aml bt(0,0)/Extra/DSDT.aml). + HPET= Use an alternate HPET.aml file + (default path: /HPET.aml + /Extra/HPET.aml bt(0,0)/Extra/HPET.aml). + SBST= Use an alternate SBST.aml file + (default path: /SBST.aml + /Extra/SBST.aml bt(0,0)/Extra/SBST.aml). + ECDT= Use an alternate ECDT.aml file + (default path: /ECDT.aml + /Extra/ECDT.aml bt(0,0)/Extra/ECDT.aml). + ASFT= Use an alternate ASFT.aml file + (default path: /ASFT.aml + /Extra/ASFT.aml bt(0,0)/Extra/ASFT.aml). + DMAR= Use an alternate DMAR.aml file + (default path: /DMAR.aml + /Extra/DMAR.aml bt(0,0)/Extra/DMAR.aml). + APIC= Use an alternate APIC.aml file + (default path: /APIC.aml + /Extra/APIC.aml bt(0,0)/Extra/APIC.aml). + MCFG= Use an alternate MCFG.aml file + (default path: /MCFG.aml + /Extra/MCFG.aml bt(0,0)/Extra/MCFG.aml). + FADT= Use an alternate FADT.aml file + (default path: /FADT.aml + /Extra/FADT.aml bt(0,0)/Extra/FADT.aml). GenerateCStates=Yes Enable auto generation of processor idle sleep states (C-States). Index: branches/ErmaC/Enoch/Make.rules =================================================================== --- branches/ErmaC/Enoch/Make.rules (revision 2322) +++ branches/ErmaC/Enoch/Make.rules (revision 2323) @@ -10,9 +10,8 @@ endif AS = as LD = ld -CC = cc -CPP = c++ - +CC = gcc +CPP = g++ PAX = /bin/pax NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc @@ -40,39 +39,65 @@ #OMIT_FRAME_POINTER_CFLAG=-fomit-frame-pointer OMIT_FRAME_POINTER_CFLAG= --include $(OBJROOT)/*.Makedep - -$(OBJROOT)/%.o32: %.c +$(OBJROOT)/%.o32_nodep: %.c @echo "\t[CC32] $<" - @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -MM -M -o $@.Makedep @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@ -$(OBJROOT)/%.o64: %.c +$(OBJROOT)/%.o64_nodep: %.c @echo "\t[CC64] $<" - @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -MM -M -o $@.Makedep @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@ $(OBJROOT)/%.o: %.c @echo "\t[CC] $<" - @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -MM -M -o $@.Makedep - @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ + @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \ + -MD -dependency-file $(OBJROOT)/$*.d + @cat "$(OBJROOT)/$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$(OBJROOT)/$*.d" +$(OBJROOT)/%.o32: %.c + @echo "\t[CC32] $<" + @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@ \ + -MD -dependency-file $(OBJROOT)/$*.d + @cat "$(OBJROOT)/$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$(OBJROOT)/$*.d" + +$(OBJROOT)/%.o64: %.c + @echo "\t[CC64] $<" + @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@ \ + -MD -dependency-file $(OBJROOT)/$*.d + @cat "$(OBJROOT)/$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$(OBJROOT)/$*.d" + $(OBJROOT)/%.o: %.m @echo "\t[M] $<" - @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -MM -M -o $@.Makedep - @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ + @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \ + -MD -dependency-file $(OBJROOT)/$*.d + @cat "$(OBJROOT)/$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$(OBJROOT)/$*.d" $(OBJROOT)/%.o: %.cpp @echo "\t[CPP] $<" - @$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -MM -M -o $@.Makedep - @$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@ + @$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@ \ + -MD -dependency-file $(OBJROOT)/$*.d + @cat "$(OBJROOT)/$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$(OBJROOT)/$*.d" +$(OBJROOT)/boot2.o: + @echo "\t[AS] boot2.s" + @$(CC) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \ + -MD -dependency-file $*.d + @cat "$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$*.d" + $(OBJROOT)/%.o: %.s @echo "\t[AS] $<" - @$(CC) $(CPPFLAGS) -c $(INC) -arch i386 $< -MM -M -o $@.Makedep - @$(CC) $(CPPFLAGS) -c $(INC) -arch i386 $< -o $@ + @$(CC) $(CPPFLAGS) -c $(INC) -arch i386 -o $@ $< \ + -MD -dependency-file $*.d + @cat "$*.d" >>"$(OBJROOT)/Makedep" + @rm -f "$*.d" + CONFIG_FILES=$(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h $(SRCROOT)/autoconf.inc $(SRCROOT)/.config $(CONFIG_FILES): $(SRCROOT)/.config @echo "\t[MAKE] config" Index: branches/ErmaC/Enoch/CHANGES =================================================================== --- branches/ErmaC/Enoch/CHANGES (revision 2322) +++ branches/ErmaC/Enoch/CHANGES (revision 2323) @@ -20,14 +20,57 @@ - Fix warnings/errors from new llvm/clang (xcode 4.6) - Fix base64 decode, fixes Issue http://forge.voodooprojects.org/p/chameleon/issues/320/ - meklort : FileNVRAM module import +- Merge more cparm's (security, stability, bugs fixes) improvements from his branch. +- cparm : Added two boot options for High resolution display and reboot on kernel panic - cparm : Added a workaroud for Xcode 4.4.x compatibility 504B030414030100630004731141000000007D0000008B00000003000B0062696E01990700020041450308001AED80DA50DF6080B0390FE095B3BC129E1FC27C104EC97897EF27CD1175766CB18C66FF42EFB7023911BDFD5E4BC9AEEC32FF3473963F70B255581D7B74DE9F - cparm : Fixed a buffer overflow in the plist loader +- Add more nVidia and Ati Device and Subdevice IDs. +- Substitutes some simpler command in place of md which fixes this first issue + credits to bltz http://forge.voodooprojects.org/p/chameleon/issues/279/ +- Fix crash with missing *_o.png image + credits to bltz http://forge.voodooprojects.org/p/chameleon/issues/280/ +- General code cleanups. +- This revision is devoted to Samantha, AKA DHP or Revogirl in the OSx86 scene. + A young talent we lost prematurely. + Part of her work will now live on in the Chameleon source code. + Changes: code cleaned, improvements taken from Revoboot. + http://www.insanelymac.com/forum/index.php?showtopic=259090 +- Apply patch by Andrey B http://forge.voodooprojects.org/p/chameleon/issues/270/ +- cparm : Added a Sata module, known as YellowIconFixer in my branch, useful to fix yellow icon issue (can also fix an issue with the apple's dvd player application in moutain lion) - cparm : Ported the nvidia plist helper (less time to spend on the device id more time to code :-) ) -- cparm : Added a Sata module, known as YellowIconFixer in my branch, useful to fix yellow icon issue (can also fix an issue with the apple's dvd player application in moutain lion) - , for now not added in the pkg script !!! - +- Added Recovery Icon for Default Theme (TODO) (credits to blackosx). +- Merge Intel Graphics 4000 device IDs from Chimera (Commit 1999). +- Merge more cparm's (security, stability, bugs fixes) improvements from his branch. + http://forge.voodooprojects.org/p/chameleon/source/tree/HEAD/branches/cparm +- Merge "Restart fix Removed" from trunk r1992 by Slice's patch +- Added nVidia process sub-dev ids. +- Merge EnableHDMIAudio changes from commit 1950 by Cosmosis Jones. +- Merge patch by Geoff Seeley http://forge.voodooprojects.org/p/chameleon/issues/59/ +- Apply patch by Michael Seydl http://forge.voodooprojects.org/p/chameleon/issues/48/ +- Apply patch by Michael Seydl http://forge.voodooprojects.org/p/chameleon/issues/247/ +- Apply patch by rafi rafi http://forge.voodooprojects.org/p/chameleon/issues/246/ +- Added ID for Radeon HD5570 and some subID: http://forge.voodooprojects.org/p/chameleon/issues/243/ +- Merge cparm's (security, stability, bugs fixes) improvements from his branch. +- Added ID and correct FB for: http://forge.voodooprojects.org/p/chameleon/issues/238/ +- Added next coming CHIPSET and ID definition (Mosts of it commented) ML? + (found via netkas.org): http://lists.freedesktop.org/archives/dri-devel/2012-March/020388.html +- Merge IVY Bridge stuff from Chimera Branch. +- Added boot support for Mountain Lion 10.8 (credits to ErmaC) & updated the default theme (credits to blackosx) +- cparm : Fixed naming convention for raid hfs devices in gui +- Added support for using UUIDs with ext2 filesystems (credits to bitz): http://forge.voodooprojects.org/p/chameleon/issues/208/ +- Added Guerrero's patch on gui.c: http://forge.voodooprojects.org/p/chameleon/issues/178/ - cparm : Ported the OS detection to the trunk, updated the default theme to v 1.1 (credit to blackosx) - +- Merge correction for "Invalid package length algorithm in aml_generator.c" (credits to rphilipson) + http://forum.voodooprojects.org/index.php/topic,2297.0.html +- Added scorpius's patch (to get an unstretched boot screen for nVidia cards on DVI) in boot0.s, + disabled by default: http://forum.voodooprojects.org/index.php/topic,2158.0.html +- Added exFAT volume label support (FAT64) support (credit to dmazar): + http://forum.voodooprojects.org/index.php/topic,2095.0.html +- disableIRQs() http://www.insanelymac.com/forum/index.php?s=&showtopic=255866&view=findpost&p=1677779 + Port of original patch by: CPARM (who basically did this in boot.c) Thanks! + The ACPI specification dictates that the 8259 (PC-AT compatible) vectors + must be disabled (that is, masked) when enabling the ACPI APIC operation + but this isn't done (apparently) on all mobo's and thus we do that here. - Added AtiPorts option to GraphicsEnabler, so users can override the default number of ports. It proved to be useful when used to limit the number of ports that a framebuffer registers, which seems to be a requirement on laptops that can only use 2 ports at the same time.