Index: branches/ErmaC/version =================================================================== --- branches/ErmaC/version (revision 1395) +++ branches/ErmaC/version (revision 1396) @@ -1 +1 @@ -2.0 +2.1_pkg_stuff Index: branches/ErmaC/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/i386/libsaio/acpi_patcher.c (revision 1395) +++ branches/ErmaC/i386/libsaio/acpi_patcher.c (revision 1396) @@ -86,7 +86,7 @@ } return NULL; } -/* The folowing ACPI Table search algo. should be reused anywhere needed:*/ +/** The folowing ACPI Table search algo. should be reused anywhere needed:*/ int search_and_get_acpi_fd(const char * filename, const char ** outDirspec) { int fd = 0; @@ -205,23 +205,23 @@ 0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */ 0x43, 0x70, 0x75, 0x43, 0x73, 0x74, 0x00, 0x00, /* CpuCst.. */ 0x00, 0x10, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* ....INTL */ - 0x31, 0x03, 0x10, 0x20 /* 1.._ */ + 0x31, 0x03, 0x10, 0x20 /* 1.._ */ }; - char resource_template_register_fixedhw[] = + char resource_template_register_fixedhw[] = { - 0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F, - 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F, + 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x79, 0x00 }; - - char resource_template_register_systemio[] = + + char resource_template_register_systemio[] = { 0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x01, - 0x08, 0x00, 0x00, 0x15, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x79, 0x00, - }; - + 0x08, 0x00, 0x00, 0x15, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x79, 0x00, + }; + if (Platform.CPU.Vendor != 0x756E6547) { verbose ("Not an Intel platform: C-States will not be generated !!!\n"); return NULL; @@ -239,20 +239,20 @@ return NULL; } - if (acpi_cpu_count == 0) + if (acpi_cpu_count == 0) get_acpi_cpu_names((void*)dsdt, dsdt->Length); - if (acpi_cpu_count > 0) + if (acpi_cpu_count > 0) { bool c2_enabled = false; bool c3_enabled = false; bool c4_enabled = false; - bool cst_using_sustemio = false; + bool cst_using_systemio = false; getBoolForKey(kEnableC2State, &c2_enabled, &bootInfo->chameleonConfig); getBoolForKey(kEnableC3State, &c3_enabled, &bootInfo->chameleonConfig); getBoolForKey(kEnableC4State, &c4_enabled, &bootInfo->chameleonConfig); - getBoolForKey(kCSTUsingSystemIO, &cst_using_sustemio, &bootInfo->chameleonConfig); + getBoolForKey(kCSTUsingSystemIO, &cst_using_systemio, &bootInfo->chameleonConfig); c2_enabled = c2_enabled | (fadt->C2_Latency < 100); c3_enabled = c3_enabled | (fadt->C3_Latency < 1000); @@ -260,121 +260,119 @@ unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + (c3_enabled ? 1 : 0); struct 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_add_byte(pack, cstates_count); + 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_add_byte(pack, cstates_count); - struct aml_chunk* tmpl = aml_add_package(pack); - if (cst_using_sustemio) - { - // C1 - resource_template_register_fixedhw[8] = 0x00; - 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 - - uint8_t p_blk_lo, p_blk_hi; - - if (c2_enabled) // C2 - { - p_blk_lo = acpi_cpu_p_blk + 4; - p_blk_hi = (acpi_cpu_p_blk + 4) >> 8; - - tmpl = aml_add_package(pack); - 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 - } - - if (c4_enabled) // C4 - { - p_blk_lo = acpi_cpu_p_blk + 5; - p_blk_hi = (acpi_cpu_p_blk + 5) >> 8; - - tmpl = aml_add_package(pack); - 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 - } - else if (c3_enabled) // C3 - { - p_blk_lo = acpi_cpu_p_blk + 5; - p_blk_hi = (acpi_cpu_p_blk + 5) >> 8; - - tmpl = aml_add_package(pack); - 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_dword(tmpl, 0x0000015e); // Power - } - - } - else - { - // C1 - 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_dword(tmpl, 0x000003e8); // Power - - resource_template_register_fixedhw[18] = 0x03; - - if (c2_enabled) // C2 - { - 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_dword(tmpl, 0x000001f4); // Power - } - - if (c4_enabled) // C4 - { - 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_dword(tmpl, 0x000000C8); // Power - } - else if (c3_enabled) - { - 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_dword(tmpl, 0x0000015e); // Power - } - } - + struct aml_chunk* tmpl = aml_add_package(pack); + if (cst_using_systemio) + { + // C1 + resource_template_register_fixedhw[8] = 0x00; + 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 - // Aliaces - int i; - for (i = 0; i < acpi_cpu_count; i++) + uint8_t p_blk_lo, p_blk_hi; + + if (c2_enabled) // C2 { - char name[9]; - sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]); + p_blk_lo = acpi_cpu_p_blk + 4; + p_blk_hi = (acpi_cpu_p_blk + 4) >> 8; - scop = aml_add_scope(root, name); - aml_add_alias(scop, "CST_", "_CST"); + tmpl = aml_add_package(pack); + 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 } + + if (c4_enabled) // C4 + { + p_blk_lo = acpi_cpu_p_blk + 5; + p_blk_hi = (acpi_cpu_p_blk + 5) >> 8; + + tmpl = aml_add_package(pack); + 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 + } + else if (c3_enabled) // C3 + { + p_blk_lo = acpi_cpu_p_blk + 5; + p_blk_hi = (acpi_cpu_p_blk + 5) >> 8; + + tmpl = aml_add_package(pack); + 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_dword(tmpl, 0x0000015e); // Power + } + } + else + { + // C1 + 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_dword(tmpl, 0x000003e8); // Power + + resource_template_register_fixedhw[18] = 0x03; + + if (c2_enabled) // C2 + { + 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_dword(tmpl, 0x000001f4); // Power + } + + if (c4_enabled) // C4 + { + 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_dword(tmpl, 0x000000C8); // Power + } + else if (c3_enabled) + { + 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_dword(tmpl, 0x0000015e); // Power + } + } + // Aliaces + int i; + for (i = 0; i < acpi_cpu_count; i++) + { + char name[9]; + sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]); + + scop = aml_add_scope(root, name); + aml_add_alias(scop, "CST_", "_CST"); + } + aml_calculate_size(root); struct acpi_2_ssdt *ssdt = (struct acpi_2_ssdt *)AllocateKernelMemory(root->Size); @@ -388,12 +386,12 @@ aml_destroy_node(root); //dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length); - + verbose ("SSDT with CPU C-States generated successfully\n"); return ssdt; } - else + else { verbose ("ACPI CPUs not found: C-States not generated !!!\n"); } Index: branches/ErmaC/i386/libsaio/pci_root.c =================================================================== --- branches/ErmaC/i386/libsaio/pci_root.c (revision 1395) +++ branches/ErmaC/i386/libsaio/pci_root.c (revision 1396) @@ -45,6 +45,8 @@ int getPciRootUID(void) { + char dsdt_dirSpec[128]; + void *new_dsdt; const char *val; int len,fsize; @@ -73,7 +75,18 @@ goto out; } - int fd = search_and_get_acpi_fd("DSDT.aml", &dsdt_filename); + + // Try using the file specified with the DSDT option + if (getValueForKey(kDSDT, &dsdt_filename, &len, &bootInfo->chameleonConfig)) + { + sprintf(dsdt_dirSpec, dsdt_filename); + } + else + { + sprintf(dsdt_dirSpec, "DSDT.aml"); + } + + int fd = search_and_get_acpi_fd(dsdt_dirSpec, &dsdt_filename); // Check booting partition if (fd<0) Index: branches/ErmaC/i386/libsaio/fdisk.h =================================================================== --- branches/ErmaC/i386/libsaio/fdisk.h (revision 1395) +++ branches/ErmaC/i386/libsaio/fdisk.h (revision 1396) @@ -35,28 +35,28 @@ #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_SIGNATURE 0xAA55 /* signature of the boot record */ -#define FDISK_NPART 4 /* number of entries in fdisk table */ -#define FDISK_ACTIVE 0x80 /* indicator of active partition */ -#define FDISK_NEXTNAME 0xA7 /* indicator of NeXT partition */ -#define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ -#define FDISK_DOS16S 0x04 /* 16-bit fat < 32MB dos partition */ -#define FDISK_DOSEXT 0x05 /* extended dos partition */ -#define FDISK_DOS16B 0x06 /* 16-bit fat >= 32MB dos partition */ -#define FDISK_NTFS 0x07 /* NTFS partition */ -#define FDISK_SMALLFAT32 0x0b /* FAT32 partition */ -#define FDISK_FAT32 0x0c /* FAT32 partition */ -#define FDISK_DOS16SLBA 0x0e -#define FDISK_LINUX 0x83 +#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_ACTIVE 0x80 /* indicator of active partition */ +#define FDISK_NEXTNAME 0xA7 /* indicator of NeXT partition */ +#define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ +#define FDISK_DOS16S 0x04 /* 16-bit fat < 32MB dos partition */ +#define FDISK_DOSEXT 0x05 /* extended dos partition */ +#define FDISK_DOS16B 0x06 /* 16-bit fat >= 32MB dos partition */ +#define FDISK_NTFS 0x07 /* NTFS partition */ +#define FDISK_SMALLFAT32 0x0b /* FAT32 partition */ +#define FDISK_FAT32 0x0c /* FAT32 partition */ +#define FDISK_DOS16SLBA 0x0e +#define FDISK_LINUX 0x83 #define FDISK_OPENBSD 0xa6 /* OpenBSD FFS partition */ #define FDISK_FREEBSD 0xa5 /* FreeBSD UFS2 partition */ #define FDISK_BEFS 0xeb /* Haiku BeFS partition */ -#define FDISK_UFS 0xa8 /* Apple UFS partition */ -#define FDISK_HFS 0xaf /* Apple HFS partition */ -#define FDISK_BOOTER 0xab /* Apple booter partition */ +#define FDISK_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). Index: branches/ErmaC/i386/libsaio/nvidia.c =================================================================== --- branches/ErmaC/i386/libsaio/nvidia.c (revision 1395) +++ branches/ErmaC/i386/libsaio/nvidia.c (revision 1396) @@ -67,7 +67,7 @@ #define NVIDIA_ROM_SIZE 0x10000 #define PATCH_ROM_SUCCESS 1 -#define PATCH_ROM_SUCCESS_HAS_LVDS 2 +#define PATCH_ROM_SUCCESS_HAS_LVDS 2 #define PATCH_ROM_FAILED 0 #define MAX_NUM_DCB_ENTRIES 16 #define TYPE_GROUPED 0xff @@ -76,12 +76,12 @@ const char *nvidia_compatible_0[] = { "@0,compatible", "NVDA,NVMac" }; const char *nvidia_compatible_1[] = { "@1,compatible", "NVDA,NVMac" }; -const char *nvidia_device_type_0[] = { "@0,device_type", "display" }; -const char *nvidia_device_type_1[] = { "@1,device_type", "display" }; +const char *nvidia_device_type_0[] = { "@0,device_type", "display" }; +const char *nvidia_device_type_1[] = { "@1,device_type", "display" }; const char *nvidia_device_type[] = { "device_type", "NVDA,Parent" }; -const char *nvidia_name_0[] = { "@0,name", "NVDA,Display-A" }; -const char *nvidia_name_1[] = { "@1,name", "NVDA,Display-B" }; -const char *nvidia_slot_name[] = { "AAPL,slot-name", "Slot-1" }; +const char *nvidia_name_0[] = { "@0,name", "NVDA,Display-A" }; +const char *nvidia_name_1[] = { "@1,name", "NVDA,Display-B" }; +const char *nvidia_slot_name[] = { "AAPL,slot-name", "Slot-1" }; static uint8_t default_NVCAP[]= { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, @@ -588,7 +588,7 @@ { 0x10DE0871, "GeForce 9200" }, { 0x10DE0872, "GeForce G102M" }, { 0x10DE0873, "GeForce G102M" }, - { 0x10DE0874, "ION 9300M" }, + { 0x10DE0874, "ION 9300M" }, { 0x10DE0876, "ION" }, { 0x10DE087A, "GeForce 9400" }, { 0x10DE087D, "ION 9400M" }, Index: branches/ErmaC/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/i386/libsaio/ati.c (revision 1395) +++ branches/ErmaC/i386/libsaio/ati.c (revision 1396) @@ -1303,33 +1303,56 @@ } } +// card->ports = 2; // default - Azi: default is card_configs + + if (card->info->chip_family >= CHIP_FAMILY_CEDAR) + { + card->flags |= EVERGREEN; +// card->ports = 3; //Azi: use the AtiPorts key if needed + } + // atN = 0; + // Check AtiConfig key for a framebuffer name, card->cfg_name = getStringForKey(kAtiConfig, &bootInfo->chameleonConfig); + // if none, if (!card->cfg_name) { + // use the device fb key on radeon_cards, to retrive the default name from card_configs. card->cfg_name = card_configs[card->info->cfg_name].name; - card->ports = card_configs[card->info->cfg_name].ports; + // and leave ports alone! +// card->ports = card_configs[card->info->cfg_name].ports; + + // which means one of the fb's or kNull + verbose("Framebuffer set to device's default: %s\n", card->cfg_name); } else { - for (i = 0; i < kCfgEnd; i++) - if (strcmp(card->cfg_name, card_configs[i].name) == 0) - card->ports = card_configs[i].ports; + // else, use the fb name returned by AtiConfig. + verbose("(AtiConfig) Framebuffer set to: %s\n", card->cfg_name); } - if (card->info->chip_family >= CHIP_FAMILY_CEDAR) + // Check AtiPorts key for nr of ports, + card->ports = getIntForKey(kAtiPorts, &n_ports, &bootInfo->chameleonConfig); + // if a value bigger than 0 ?? is found, (do we need >= 0 ?? that's null FB on card_configs) + if (n_ports > 0) { - card->flags |= EVERGREEN; - card->ports = 3; //Azi: not sure of the usefulness ?? + card->ports = n_ports; // use it. + verbose("(AtiPorts) Nr of ports set to: %d\n", card->ports); + } + else// if (card->cfg_name > 0) // do we want 0 ports if fb is kNull or mistyped ? + { + // else, match fb name with card_configs list and retrive default nr of ports. + for (i = 0; i < kCfgEnd; i++) + if (strcmp(card->cfg_name, card_configs[i].name) == 0) + card->ports = card_configs[i].ports; // default + + verbose("Nr of ports set to framebuffer's default: %d\n", card->ports); } +// else +// card->ports = 2/1 ?; // set a min if 0 ports ? +// verbose("Nr of ports set to min: %d\n", card->ports); - getIntForKey(kAtiPorts, &n_ports, &bootInfo->bootConfig); - if (n_ports > 0){ - card->ports = n_ports; - verbose("AtiPorts set to %d\n",n_ports); //AniV - } - sprintf(name, "ATY,%s", card->cfg_name); aty_name.type = kStr; aty_name.size = strlen(name) + 1; Index: branches/ErmaC/i386/libsaio/cpu.c =================================================================== --- branches/ErmaC/i386/libsaio/cpu.c (revision 1395) +++ branches/ErmaC/i386/libsaio/cpu.c (revision 1396) @@ -1,5 +1,5 @@ /* - * Copyright 2008 Islam Ahmed Zaid. All rights reserved. + * Copyright 2008 Islam Ahmed Zaid. All rights reserved. * AsereBLN: 2009: cleanup and bugfix */ @@ -24,222 +24,170 @@ */ static uint64_t measure_tsc_frequency(void) { - uint64_t tscStart; - uint64_t tscEnd; - uint64_t tscDelta = 0xffffffffffffffffULL; - unsigned long pollCount; - uint64_t retval = 0; - int i; - - /* Time how many TSC ticks elapse in 30 msec using the 8254 PIT - * counter 2. We run this loop 3 times to make sure the cache - * is hot and we take the minimum delta from all of the runs. - * That is to say that we're biased towards measuring the minimum - * number of TSC ticks that occur while waiting for the timer to - * expire. That theoretically helps avoid inconsistencies when - * running under a VM if the TSC is not virtualized and the host - * steals time. The TSC is normally virtualized for VMware. - */ - for(i = 0; i < 10; ++i) - { - enable_PIT2(); - set_PIT2_mode0(CALIBRATE_LATCH); - tscStart = rdtsc64(); - pollCount = poll_PIT2_gate(); - tscEnd = rdtsc64(); - /* The poll loop must have run at least a few times for accuracy */ - if(pollCount <= 1) - continue; - /* The TSC must increment at LEAST once every millisecond. We - * should have waited exactly 30 msec so the TSC delta should - * be >= 30. Anything less and the processor is way too slow. - */ - if((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC) - continue; - // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) - if( (tscEnd - tscStart) < tscDelta ) - tscDelta = tscEnd - tscStart; - } - /* tscDelta is now the least number of TSC ticks the processor made in - * a timespan of 0.03 s (e.g. 30 milliseconds) - * Linux thus divides by 30 which gives the answer in kiloHertz because - * 1 / ms = kHz. But we're xnu and most of the rest of the code uses - * Hz so we need to convert our milliseconds to seconds. Since we're - * dividing by the milliseconds, we simply multiply by 1000. - */ - - /* Unlike linux, we're not limited to 32-bit, but we do need to take care - * that we're going to multiply by 1000 first so we do need at least some - * arithmetic headroom. For now, 32-bit should be enough. - * Also unlike Linux, our compiler can do 64-bit integer arithmetic. - */ - if(tscDelta > (1ULL<<32)) - retval = 0; - else - { - retval = tscDelta * 1000 / 30; - } - disable_PIT2(); - return retval; + uint64_t tscStart; + uint64_t tscEnd; + uint64_t tscDelta = 0xffffffffffffffffULL; + unsigned long pollCount; + uint64_t retval = 0; + int i; + + /* Time how many TSC ticks elapse in 30 msec using the 8254 PIT + * counter 2. We run this loop 3 times to make sure the cache + * is hot and we take the minimum delta from all of the runs. + * That is to say that we're biased towards measuring the minimum + * number of TSC ticks that occur while waiting for the timer to + * expire. That theoretically helps avoid inconsistencies when + * running under a VM if the TSC is not virtualized and the host + * steals time. The TSC is normally virtualized for VMware. + */ + for(i = 0; i < 10; ++i) + { + enable_PIT2(); + set_PIT2_mode0(CALIBRATE_LATCH); + tscStart = rdtsc64(); + pollCount = poll_PIT2_gate(); + tscEnd = rdtsc64(); + /* The poll loop must have run at least a few times for accuracy */ + if (pollCount <= 1) + continue; + /* The TSC must increment at LEAST once every millisecond. + * We should have waited exactly 30 msec so the TSC delta should + * be >= 30. Anything less and the processor is way too slow. + */ + if ((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC) + continue; + // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) + if ( (tscEnd - tscStart) < tscDelta ) + tscDelta = tscEnd - tscStart; + } + /* tscDelta is now the least number of TSC ticks the processor made in + * a timespan of 0.03 s (e.g. 30 milliseconds) + * Linux thus divides by 30 which gives the answer in kiloHertz because + * 1 / ms = kHz. But we're xnu and most of the rest of the code uses + * Hz so we need to convert our milliseconds to seconds. Since we're + * dividing by the milliseconds, we simply multiply by 1000. + */ + + /* Unlike linux, we're not limited to 32-bit, but we do need to take care + * that we're going to multiply by 1000 first so we do need at least some + * arithmetic headroom. For now, 32-bit should be enough. + * Also unlike Linux, our compiler can do 64-bit integer arithmetic. + */ + if (tscDelta > (1ULL<<32)) + retval = 0; + else + { + retval = tscDelta * 1000 / 30; + } + disable_PIT2(); + return retval; } -#if 0 /* - * DFE: Measures the Max Performance Frequency in Hz (64-bit) - */ -static uint64_t measure_mperf_frequency(void) -{ - uint64_t mperfStart; - uint64_t mperfEnd; - uint64_t mperfDelta = 0xffffffffffffffffULL; - unsigned long pollCount; - uint64_t retval = 0; - int i; - - /* Time how many MPERF ticks elapse in 30 msec using the 8254 PIT - * counter 2. We run this loop 3 times to make sure the cache - * is hot and we take the minimum delta from all of the runs. - * That is to say that we're biased towards measuring the minimum - * number of MPERF ticks that occur while waiting for the timer to - * expire. - */ - for(i = 0; i < 10; ++i) - { - enable_PIT2(); - set_PIT2_mode0(CALIBRATE_LATCH); - mperfStart = rdmsr64(MSR_AMD_MPERF); - pollCount = poll_PIT2_gate(); - mperfEnd = rdmsr64(MSR_AMD_MPERF); - /* The poll loop must have run at least a few times for accuracy */ - if(pollCount <= 1) - continue; - /* The MPERF must increment at LEAST once every millisecond. We - * should have waited exactly 30 msec so the MPERF delta should - * be >= 30. Anything less and the processor is way too slow. - */ - if((mperfEnd - mperfStart) <= CALIBRATE_TIME_MSEC) - continue; - // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) - if( (mperfEnd - mperfStart) < mperfDelta ) - mperfDelta = mperfEnd - mperfStart; - } - /* mperfDelta is now the least number of MPERF ticks the processor made in - * a timespan of 0.03 s (e.g. 30 milliseconds) - */ - - if(mperfDelta > (1ULL<<32)) - retval = 0; - else - { - retval = mperfDelta * 1000 / 30; - } - disable_PIT2(); - return retval; -} -#endif -/* + * Original comment/code: + * "DFE: Measures the Max Performance Frequency in Hz (64-bit)" + * * Measures the Actual Performance Frequency in Hz (64-bit) + * (just a naming change, mperf --> aperf ) */ static uint64_t measure_aperf_frequency(void) { - uint64_t aperfStart; - uint64_t aperfEnd; - uint64_t aperfDelta = 0xffffffffffffffffULL; - unsigned long pollCount; - uint64_t retval = 0; - int i; - - /* Time how many APERF ticks elapse in 30 msec using the 8254 PIT - * counter 2. We run this loop 3 times to make sure the cache - * is hot and we take the minimum delta from all of the runs. - * That is to say that we're biased towards measuring the minimum - * number of APERF ticks that occur while waiting for the timer to - * expire. - */ - for(i = 0; i < 10; ++i) - { - enable_PIT2(); - set_PIT2_mode0(CALIBRATE_LATCH); - aperfStart = rdmsr64(MSR_AMD_APERF); - pollCount = poll_PIT2_gate(); - aperfEnd = rdmsr64(MSR_AMD_APERF); - /* The poll loop must have run at least a few times for accuracy */ - if(pollCount <= 1) - continue; - /* The TSC must increment at LEAST once every millisecond. We - * should have waited exactly 30 msec so the APERF delta should - * be >= 30. Anything less and the processor is way too slow. - */ - if((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC) - continue; - // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) - if( (aperfEnd - aperfStart) < aperfDelta ) - aperfDelta = aperfEnd - aperfStart; - } - /* mperfDelta is now the least number of MPERF ticks the processor made in - * a timespan of 0.03 s (e.g. 30 milliseconds) - */ - - if(aperfDelta > (1ULL<<32)) - retval = 0; - else - { - retval = aperfDelta * 1000 / 30; - } - disable_PIT2(); - return retval; + uint64_t aperfStart; + uint64_t aperfEnd; + uint64_t aperfDelta = 0xffffffffffffffffULL; + unsigned long pollCount; + uint64_t retval = 0; + int i; + + /* Time how many APERF ticks elapse in 30 msec using the 8254 PIT + * counter 2. We run this loop 3 times to make sure the cache + * is hot and we take the minimum delta from all of the runs. + * That is to say that we're biased towards measuring the minimum + * number of APERF ticks that occur while waiting for the timer to + * expire. + */ + for(i = 0; i < 10; ++i) + { + enable_PIT2(); + set_PIT2_mode0(CALIBRATE_LATCH); + aperfStart = rdmsr64(MSR_AMD_APERF); + pollCount = poll_PIT2_gate(); + aperfEnd = rdmsr64(MSR_AMD_APERF); + /* The poll loop must have run at least a few times for accuracy */ + if (pollCount <= 1) + continue; + /* The TSC must increment at LEAST once every millisecond. + * We should have waited exactly 30 msec so the APERF delta should + * be >= 30. Anything less and the processor is way too slow. + */ + if ((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC) + continue; + // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) + if ( (aperfEnd - aperfStart) < aperfDelta ) + aperfDelta = aperfEnd - aperfStart; + } + /* mperfDelta is now the least number of MPERF ticks the processor made in + * a timespan of 0.03 s (e.g. 30 milliseconds) + */ + + if (aperfDelta > (1ULL<<32)) + retval = 0; + else + { + retval = aperfDelta * 1000 / 30; + } + disable_PIT2(); + return retval; } - /* * Calculates the FSB and CPU frequencies using specific MSRs for each CPU * - multi. is read from a specific MSR. In the case of Intel, there is: - * a max multi. (used to calculate the FSB freq.), - * and a current multi. (used to calculate the CPU freq.) + * a max multi. (used to calculate the FSB freq.), + * and a current multi. (used to calculate the CPU freq.) * - fsbFrequency = tscFrequency / multi * - cpuFrequency = fsbFrequency * multi */ - 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; - const char *newratio; - int len, myfsb; - uint8_t bus_ratio_min; - uint32_t max_ratio, min_ratio; - + const char *newratio; + int len, myfsb; + uint8_t bus_ratio_min; + uint32_t max_ratio, min_ratio; + 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]); do_cpuid(0x00000002, p->CPU.CPUID[CPUID_2]); do_cpuid(0x00000003, p->CPU.CPUID[CPUID_3]); - do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]); + do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]); do_cpuid(0x80000000, p->CPU.CPUID[CPUID_80]); - if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 8) { - do_cpuid(0x80000008, p->CPU.CPUID[CPUID_88]); - do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]); + if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 8) { + do_cpuid(0x80000008, p->CPU.CPUID[CPUID_88]); + do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]); } - else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) { + else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) { do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]); } - - + #if DEBUG_CPU { int i; printf("CPUID Raw Values:\n"); for (i=0; iCPU.CPUID[i][0], p->CPU.CPUID[i][1], - p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]); + p->CPU.CPUID[i][0], p->CPU.CPUID[i][1], + p->CPU.CPUID[i][2], p->CPU.CPUID[i][3]); } } #endif + p->CPU.Vendor = p->CPU.CPUID[CPUID_0][1]; p->CPU.Signature = p->CPU.CPUID[CPUID_1][0]; p->CPU.Stepping = bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0); @@ -248,34 +196,35 @@ p->CPU.ExtModel = bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16); p->CPU.ExtFamily = bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20); - p->CPU.Model += (p->CPU.ExtModel << 4); - - if (p->CPU.Vendor == CPUID_VENDOR_INTEL && - p->CPU.Family == 0x06 && - p->CPU.Model >= CPUID_MODEL_NEHALEM && - p->CPU.Model != CPUID_MODEL_ATOM // MSR is *NOT* available on the Intel Atom CPU - ) - { - msr = rdmsr64(MSR_CORE_THREAD_COUNT); // Undocumented MSR in Nehalem and newer CPUs - p->CPU.NoCores = bitfield((uint32_t)msr, 31, 16); // Using undocumented MSR to get actual values - p->CPU.NoThreads = bitfield((uint32_t)msr, 15, 0); // Using undocumented MSR to get actual values + p->CPU.Model += (p->CPU.ExtModel << 4); + + if (p->CPU.Vendor == CPUID_VENDOR_INTEL && + p->CPU.Family == 0x06 && + p->CPU.Model >= CPUID_MODEL_NEHALEM && + p->CPU.Model != CPUID_MODEL_ATOM // MSR is *NOT* available on the Intel Atom CPU + ) + { + msr = rdmsr64(MSR_CORE_THREAD_COUNT); // Undocumented MSR in Nehalem and newer CPUs + p->CPU.NoCores = bitfield((uint32_t)msr, 31, 16); // Using undocumented MSR to get actual values + p->CPU.NoThreads = bitfield((uint32_t)msr, 15, 0); // Using undocumented MSR to get actual values } - else if (p->CPU.Vendor == CPUID_VENDOR_AMD) - { - p->CPU.NoThreads = bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16); - p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_88][2], 7, 0) + 1; - } - else - { - p->CPU.NoThreads = bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16); // Use previous method for Cores and Threads - p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1; + else if (p->CPU.Vendor == CPUID_VENDOR_AMD) + { + p->CPU.NoThreads = bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16); + p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_88][2], 7, 0) + 1; } + else + { + // Use previous method for Cores and Threads + p->CPU.NoThreads = bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16); + p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1; + } /* get brand string (if supported) */ /* Copyright: from Apple's XNU cpuid.c */ if (p->CPU.CPUID[CPUID_80][0] > 0x80000004) { uint32_t reg[4]; - char str[128], *s; + char str[128], *s; /* * The brand string 48 bytes (max), guaranteed to * be NULL terminated. @@ -290,15 +239,15 @@ if (*s != ' ') break; } - strlcpy(p->CPU.BrandString, s, sizeof(p->CPU.BrandString)); + strlcpy(p->CPU.BrandString, s, sizeof(p->CPU.BrandString)); if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, MIN(sizeof(p->CPU.BrandString), strlen(CPU_STRING_UNKNOWN) + 1))) { - /* - * This string means we have a firmware-programmable brand string, - * and the firmware couldn't figure out what sort of CPU we have. - */ - p->CPU.BrandString[0] = '\0'; - } + /* + * This string means we have a firmware-programmable brand string, + * and the firmware couldn't figure out what sort of CPU we have. + */ + p->CPU.BrandString[0] = '\0'; + } } /* setup features */ @@ -330,52 +279,52 @@ if (p->CPU.NoThreads > p->CPU.NoCores) { p->CPU.Features |= CPU_FEATURE_HTT; } - + tscFrequency = measure_tsc_frequency(); fsbFrequency = 0; cpuFrequency = 0; - + 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)) { /* Nehalem CPU model */ - if (p->CPU.Family == 0x06 && (p->CPU.Model == CPU_MODEL_NEHALEM || - p->CPU.Model == CPU_MODEL_FIELDS || - p->CPU.Model == CPU_MODEL_DALES || - p->CPU.Model == CPU_MODEL_DALES_32NM || - p->CPU.Model == CPU_MODEL_WESTMERE || - p->CPU.Model == CPU_MODEL_NEHALEM_EX || - p->CPU.Model == CPU_MODEL_WESTMERE_EX || - p->CPU.Model == CPU_MODEL_SANDY || - p->CPU.Model == CPU_MODEL_SANDY_XEON)) { + if (p->CPU.Family == 0x06 && (p->CPU.Model == CPU_MODEL_NEHALEM || + p->CPU.Model == CPU_MODEL_FIELDS || + p->CPU.Model == CPU_MODEL_DALES || + p->CPU.Model == CPU_MODEL_DALES_32NM || + p->CPU.Model == CPU_MODEL_WESTMERE || + p->CPU.Model == CPU_MODEL_NEHALEM_EX || + p->CPU.Model == CPU_MODEL_WESTMERE_EX || + p->CPU.Model == CPU_MODEL_SANDY || + p->CPU.Model == CPU_MODEL_SANDY_XEON)) { msr = rdmsr64(MSR_PLATFORM_INFO); - DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0)); - bus_ratio_max = bitfield(msr, 14, 8); - bus_ratio_min = bitfield(msr, 46, 40); //valv: not sure about this one (Remarq.1) + DBG("msr(%d): platform_info %08x\n", __LINE__, bitfield(msr, 31, 0)); + bus_ratio_max = bitfield(msr, 14, 8); + bus_ratio_min = bitfield(msr, 46, 40); //valv: not sure about this one (Remarq.1) msr = rdmsr64(MSR_FLEX_RATIO); - DBG("msr(%d): flex_ratio %08x\n", __LINE__, bitfield(msr, 31, 0)); - if (bitfield(msr, 16, 16)) { - flex_ratio = bitfield(msr, 14, 8); + DBG("msr(%d): flex_ratio %08x\n", __LINE__, bitfield(msr, 31, 0)); + if (bitfield(msr, 16, 16)) { + flex_ratio = bitfield(msr, 14, 8); /* bcc9: at least on the gigabyte h67ma-ud2h, - where the cpu multipler can't be changed to - allow overclocking, the flex_ratio msr has unexpected (to OSX) - contents. These contents cause mach_kernel to - fail to compute the bus ratio correctly, instead - causing the system to crash since tscGranularity - is inadvertently set to 0. - */ + where the cpu multipler can't be changed to + allow overclocking, the flex_ratio msr has unexpected (to OSX) + contents. These contents cause mach_kernel to + fail to compute the bus ratio correctly, instead + causing the system to crash since tscGranularity + is inadvertently set to 0. + */ if (flex_ratio == 0) { /* Clear bit 16 (evidently the presence bit) */ wrmsr64(MSR_FLEX_RATIO, (msr & 0xFFFFFFFFFFFEFFFFULL)); msr = rdmsr64(MSR_FLEX_RATIO); - verbose("Unusable flex ratio detected. Patched MSR now %08x\n", bitfield(msr, 31, 0)); + verbose("Unusable flex ratio detected. Patched MSR now %08x\n", bitfield(msr, 31, 0)); } else { if (bus_ratio_max > flex_ratio) { bus_ratio_max = flex_ratio; } } } - + if (bus_ratio_max) { fsbFrequency = (tscFrequency / bus_ratio_max); } @@ -391,9 +340,9 @@ max_ratio = atoi(newratio); max_ratio = (max_ratio * 10); if (len >= 3) max_ratio = (max_ratio + 5); - + verbose("Bus-Ratio: min=%d, max=%s\n", bus_ratio_min, newratio); - + // extreme overclockers may love 320 ;) if ((max_ratio >= min_ratio) && (max_ratio <= 320)) { cpuFrequency = (fsbFrequency * max_ratio) / 10; @@ -404,32 +353,33 @@ } } //valv: to be uncommented if Remarq.1 didn't stick - /*if(bus_ratio_max > 0) bus_ratio = flex_ratio;*/ + /*if (bus_ratio_max > 0) bus_ratio = flex_ratio;*/ p->CPU.MaxRatio = max_ratio; p->CPU.MinRatio = min_ratio; - + myfsb = fsbFrequency / 1000000; verbose("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", myfsb, max_ratio); currcoef = bus_ratio_max; } 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); + DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, bitfield(msr, 31, 0)); + currcoef = bitfield(msr, 12, 8); /* Non-integer bus ratio for the max-multi*/ - maxdiv = bitfield(msr, 46, 46); + maxdiv = bitfield(msr, 46, 46); /* Non-integer bus ratio for the current-multi (undocumented)*/ - currdiv = bitfield(msr, 14, 14); - - if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || (p->CPU.Family == 0x0f)) // This will always be model >= 3 + currdiv = bitfield(msr, 14, 14); + + // This will always be model >= 3 + if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || (p->CPU.Family == 0x0f)) { /* On these models, maxcoef defines TSC freq */ - maxcoef = bitfield(msr, 44, 40); + maxcoef = bitfield(msr, 44, 40); } else { /* On lower models, currcoef defines TSC freq */ /* XXX */ maxcoef = currcoef; } - + if (maxcoef) { if (maxdiv) { fsbFrequency = ((tscFrequency * 2) / ((maxcoef * 2) + 1)); @@ -450,105 +400,108 @@ p->CPU.Features |= CPU_FEATURE_MOBILE; } } - 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; - currcoef = bitfield(msr, 5, 0) / 2 + 4; - break; - - case 0x01: /* K10 */ - msr = rdmsr64(K10_COFVID_STATUS); - do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]); - if(bitfield(p->CPU.CPUID[CPUID_6][2], 0, 0) == 1) // EffFreq: effective frequency interface - { - //uint64_t mperf = measure_mperf_frequency(); - uint64_t aperf = measure_aperf_frequency(); - cpuFrequency = aperf; - } - // NOTE: tsc runs at the maccoeff (non turbo) - // *not* at the turbo frequency. - maxcoef = bitfield(msr, 54, 49) / 2 + 4; - currcoef = bitfield(msr, 5, 0) + 0x10; - currdiv = 2 << bitfield(msr, 8, 6); - - break; - - case 0x05: /* K14 */ - msr = rdmsr64(K10_COFVID_STATUS); - currcoef = (bitfield(msr, 54, 49) + 0x10) << 2; - currdiv = (bitfield(msr, 8, 4) + 1) << 2; - currdiv += bitfield(msr, 3, 0); - - break; - - case 0x02: /* K11 */ - // not implimented - break; - } - - if (maxcoef) - { - if (currdiv) - { - if(!currcoef) currcoef = maxcoef; - if(!cpuFrequency) - fsbFrequency = ((tscFrequency * currdiv) / currcoef); - else - fsbFrequency = ((cpuFrequency * currdiv) / currcoef); - - DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); - } else { - if(!cpuFrequency) - fsbFrequency = (tscFrequency / maxcoef); - else - fsbFrequency = (cpuFrequency / maxcoef); - DBG("%d\n", currcoef); - } - } - else if (currcoef) - { - if (currdiv) - { - fsbFrequency = ((tscFrequency * currdiv) / currcoef); - DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); - } else { - fsbFrequency = (tscFrequency / currcoef); - DBG("%d\n", currcoef); - } - } - if(!cpuFrequency) cpuFrequency = tscFrequency; - } + 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; + currcoef = bitfield(msr, 5, 0) / 2 + 4; + break; + + case 0x01: /* K10 */ + msr = rdmsr64(K10_COFVID_STATUS); + do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]); + // EffFreq: effective frequency interface + if (bitfield(p->CPU.CPUID[CPUID_6][2], 0, 0) == 1) + { + //uint64_t mperf = measure_mperf_frequency(); + uint64_t aperf = measure_aperf_frequency(); + cpuFrequency = aperf; + } + // NOTE: tsc runs at the maccoeff (non turbo) + // *not* at the turbo frequency. + maxcoef = bitfield(msr, 54, 49) / 2 + 4; + currcoef = bitfield(msr, 5, 0) + 0x10; + currdiv = 2 << bitfield(msr, 8, 6); + + break; + + case 0x05: /* K14 */ + msr = rdmsr64(K10_COFVID_STATUS); + currcoef = (bitfield(msr, 54, 49) + 0x10) << 2; + currdiv = (bitfield(msr, 8, 4) + 1) << 2; + currdiv += bitfield(msr, 3, 0); + + break; + + case 0x02: /* K11 */ + // not implimented + break; + } + + if (maxcoef) + { + if (currdiv) + { + if (!currcoef) currcoef = maxcoef; + if (!cpuFrequency) + fsbFrequency = ((tscFrequency * currdiv) / currcoef); + else + fsbFrequency = ((cpuFrequency * currdiv) / currcoef); + + DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); + } else { + if (!cpuFrequency) + fsbFrequency = (tscFrequency / maxcoef); + else + fsbFrequency = (cpuFrequency / maxcoef); + DBG("%d\n", currcoef); + } + } + else if (currcoef) + { + if (currdiv) + { + fsbFrequency = ((tscFrequency * currdiv) / currcoef); + DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); + } else { + fsbFrequency = (tscFrequency / currcoef); + DBG("%d\n", currcoef); + } + } + if (!cpuFrequency) cpuFrequency = tscFrequency; + } + #if 0 - if (!fsbFrequency) { - fsbFrequency = (DEFAULT_FSB * 1000); - cpuFrequency = tscFrequency; - DBG("0 ! using the default value for FSB !\n"); - } + if (!fsbFrequency) { + fsbFrequency = (DEFAULT_FSB * 1000); + cpuFrequency = tscFrequency; + DBG("0 ! using the default value for FSB !\n"); + } #endif - - p->CPU.MaxCoef = maxcoef; - p->CPU.MaxDiv = maxdiv; - p->CPU.CurrCoef = currcoef; - p->CPU.CurrDiv = currdiv; - p->CPU.TSCFrequency = tscFrequency; - p->CPU.FSBFrequency = fsbFrequency; - p->CPU.CPUFrequency = cpuFrequency; - - 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); + + p->CPU.MaxCoef = maxcoef; + p->CPU.MaxDiv = maxdiv; + p->CPU.CurrCoef = currcoef; + p->CPU.CurrDiv = currdiv; + p->CPU.TSCFrequency = tscFrequency; + p->CPU.FSBFrequency = fsbFrequency; + 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); #if DEBUG_CPU - pause(); + pause(); #endif } Index: branches/ErmaC/i386/libsaio/stringTable.c =================================================================== --- branches/ErmaC/i386/libsaio/stringTable.c (revision 1395) +++ branches/ErmaC/i386/libsaio/stringTable.c (revision 1396) @@ -323,12 +323,19 @@ } if ((strlen(match) == key_len) && strncmp(match, key, key_len) == 0) { - *matchval = value; + // 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. */ } } + + return retval; } Index: branches/ErmaC/i386/libsaio/saio_types.h =================================================================== --- branches/ErmaC/i386/libsaio/saio_types.h (revision 1395) +++ branches/ErmaC/i386/libsaio/saio_types.h (revision 1396) @@ -213,12 +213,11 @@ }; enum { - - kPartitionTypeHFS = 0xAF, - kPartitionTypeHPFS = 0x07, - kPartitionTypeFAT16 = 0x06, - kPartitionTypeFAT32 = 0x0c, - kPartitionTypeEXT3 = 0x83, + kPartitionTypeHFS = 0xAF, + kPartitionTypeHPFS = 0x07, + kPartitionTypeFAT16 = 0x06, + kPartitionTypeFAT32 = 0x0c, + kPartitionTypeEXT3 = 0x83, kPartitionTypeBEFS = 0xEB, kPartitionTypeFreeBSD = 0xa5, kPartitionTypeOpenBSD = 0xa6 Index: branches/ErmaC/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/i386/libsaio/fake_efi.c (revision 1395) +++ branches/ErmaC/i386/libsaio/fake_efi.c (revision 1396) @@ -742,9 +742,8 @@ // Initialize the device tree setupEfiDeviceTree(); - saveOriginalSMBIOS(); + saveOriginalSMBIOS(); // Add configuration table entries to both the services table and the device tree setupEfiConfigurationTable(); } - Index: branches/ErmaC/i386/boot2/boot.c =================================================================== --- branches/ErmaC/i386/boot2/boot.c (revision 1395) +++ branches/ErmaC/i386/boot2/boot.c (revision 1396) @@ -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. @@ -21,22 +21,23 @@ * * @APPLE_LICENSE_HEADER_END@ */ + /* * 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 + * 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. + * 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 1988, 1989 by Intel Corporation */ /* @@ -49,7 +50,6 @@ * Reworked again by Curtis Galloway (galloway@NeXT.com) */ - #include "boot.h" #include "bootstruct.h" #include "fake_efi.h" @@ -60,40 +60,33 @@ #include "platform.h" #include "modules.h" -long gBootMode; /* defaults to 0 == kBootModeNormal */ -bool gOverrideKernel; -static char gBootKernelCacheFile[512]; -static char gCacheNameAdler[64 + 256]; -char *gPlatformName = gCacheNameAdler; -char gRootDevice[512]; -char gMKextName[512]; -char gMacOSVersion[8]; -bool gEnableCDROMRescan; -bool gScanSingleDrive; - -int bvCount = 0; -//int menucount = 0; -int gDeviceCount = 0; - -BVRef bvr; -BVRef menuBVR; -BVRef bvChain; -bool useGUI; - -//static void selectBiosDevice(void); -static unsigned long Adler32(unsigned char *buffer, long length); -static bool checkOSVersion(const char * version); -static bool getOSVersion(); - -static bool gUnloadPXEOnExit = false; - /* * How long to wait (in seconds) to load the * kernel after displaying the "boot:" prompt. */ #define kBootErrorTimeout 5 +bool gOverrideKernel, gEnableCDROMRescan, gScanSingleDrive, useGUI; +static bool gUnloadPXEOnExit = false; +static char gCacheNameAdler[64 + 256]; +char *gPlatformName = gCacheNameAdler; + +char gRootDevice[512]; +char gMKextName[512]; +char gMacOSVersion[8]; +static char gBootKernelCacheFile[512]; +int bvCount = 0, gDeviceCount = 0; +//int menucount = 0; +long gBootMode; /* defaults to 0 == kBootModeNormal */ +BVRef bvr, menuBVR, bvChain; + +static bool checkOSVersion(const char * version); +static bool getOSVersion(); +static unsigned long Adler32(unsigned char *buffer, long length); +//static void selectBiosDevice(void); + + //========================================================================== // Zero the BSS. @@ -111,11 +104,12 @@ static void malloc_error(char *addr, size_t size, const char *file, int line) { - stop("\nMemory allocation error! Addr=0x%x, Size=0x%x, File=%s, Line=%d\n", (unsigned)addr, (unsigned)size, file, line); + stop("\nMemory allocation error! Addr: 0x%x, Size: 0x%x, File: %s, Line: %d\n", + (unsigned)addr, (unsigned)size, file, line); } //========================================================================== -//Initializes the runtime. Right now this means zeroing the BSS and initializing malloc. +//Initializes the runtime. Right now this means zeroing the BSS and initializing malloc. // void initialize_runtime(void) { @@ -128,8 +122,8 @@ static int ExecKernel(void *binary) { - entry_t kernelEntry; - int ret; + int ret; + entry_t kernelEntry; bootArgs->kaddr = bootArgs->ksize = 0; execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); @@ -148,14 +142,14 @@ // Notify modules that the kernel has been decoded execute_hook("DecodedKernel", (void*)binary, NULL, NULL, NULL); - setupFakeEfi(); - + setupFakeEfi(); + // Load boot drivers from the specifed root path. - //if (!gHaveKernelCache) - LoadDrivers("/"); + //if (!gHaveKernelCache) + LoadDrivers("/"); - execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL); - + execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL); + clearActivityIndicator(); if (gErrors) { @@ -163,7 +157,7 @@ printf("Pausing %d seconds...\n", kBootErrorTimeout); sleep(kBootErrorTimeout); } - + md0Ramdisk(); verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); @@ -186,38 +180,36 @@ usb_loop(); - if (checkOSVersion("10.7")) - { - execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // Notify modules that the kernel is about to be started - } - else - { - execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL); // Notify modules that the kernel is about to be started - } - + // Notify modules that the kernel is about to be started + if (checkOSVersion("10.7")) + { + execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); + } + else + { + execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL); + } + // If we were in text mode, switch to graphics mode. // This will draw the boot graphics unless we are in // verbose mode. - - if(gVerboseMode) - setVideoMode( GRAPHICS_MODE, 0 ); + if (gVerboseMode) + setVideoMode( GRAPHICS_MODE, 0 ); else - drawBootGraphics(); + drawBootGraphics(); setupBooterLog(); finalizeBootStruct(); - if (checkOSVersion("10.7")) { + // Jump to kernel's entry point. There's no going back now. + if (checkOSVersion("10.7")) { // Masking out so that Lion doesn't doublefault - // Jump to kernel's entry point. There's no going back now. startprog( kernelEntry, bootArgs ); } else { - // Jump to kernel's entry point. There's no going back now. - startprog( kernelEntry, bootArgsPreLion ); } @@ -242,108 +234,114 @@ // from a block device, or by the network booter. // // arguments: -// biosdev - Value passed from boot1/NBP to specify the device -// that the booter was loaded from. +// biosdev - Value passed from boot1/NBP to specify the device +// that the booter was loaded from. // // If biosdev is kBIOSDevNetwork, then this function will return if // booting was unsuccessful. This allows the PXE firmware to try the // next boot device on its list. void common_boot(int biosdev) { - int status; - char *bootFile; - unsigned long adler32; - bool quiet; - bool firstRun = true; - bool instantMenu; - bool rescanPrompt; - 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(); - + bool quiet; + bool firstRun = true; + bool instantMenu; + bool rescanPrompt; + char *bootFile; + int status; + unsigned int allowBVFlags = kBVFlagSystemVolume | kBVFlagForeignBoot; + unsigned int denyBVFlags = kBVFlagEFISystem; + unsigned long adler32; + + // 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. + + // Setup VGA text mode. + // Not sure if it is safe to call setVideoMode() before the + // config table has been loaded. Call video_mode() instead. #if DEBUG - printf("before video_mode\n"); + printf("before video_mode\n"); #endif - video_mode( 2 ); // 80x25 mono text mode. + video_mode( 2 ); // 80x25 mono text mode. #if DEBUG - printf("after video_mode\n"); + 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(kInsantMenuKey, &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) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) { - 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); - + + // 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) + && rescanPrompt && biosDevIsCDROM(gBIOSDev)) + { + 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); - printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); - getchar(); + printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", + gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); + printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", + gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); + getchar(); #endif useGUI = true; @@ -354,59 +352,55 @@ // initGUI() returned with an error, disabling GUI. useGUI = false; } - - setBootGlobals(bvChain); - - // Parse args, load and start kernel. - while (1) { - const char *val; - int len; - int trycache; - long flags, cachetime, kerneltime, exttime, sleeptime, time; - int ret = -1; - void *binary = (void *)kLoadAddr; - bool tryresume; - bool tryresumedefault; - bool forceresume; - bool usecache = false;//true; - - // additional variable for testing alternate kernel image locations on boot helper partitions. - char bootFileSpec[512]; + + setBootGlobals(bvChain); + + // Parse args, load and start kernel. + while (1) + { + bool tryresume, tryresumedefault, forceresume; + bool usecache = false;//true; + const char *val; + int len, trycache, ret = -1; + long flags, cachetime, kerneltime, exttime, sleeptime, time; + void *binary = (void *)kLoadAddr; - // Initialize globals. - - sysConfigValid = false; - gErrors = false; - - status = getBootOptions(firstRun); - firstRun = false; - if (status == -1) continue; + // additional variable for testing alternate kernel image locations on boot helper partitions. + char bootFileSpec[512]; - status = processBootOptions(); - // Status==1 means to chainboot - if ( status == 1 ) break; - // Status==-1 means that the config file couldn't be loaded or that gBootVolume is NULL - if ( status == -1 ) - { - // gBootVolume == NULL usually means the user hit escape. - if(gBootVolume == NULL) - { - freeFilteredBVChain(bvChain); - - if (gEnableCDROMRescan) - rescanBIOSDevice(gBIOSDev); - - bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); - setBootGlobals(bvChain); - setupDeviceList(&bootInfo->themeConfig); - } - continue; - } + // Initialize globals. + sysConfigValid = false; + gErrors = false; - // Other status (e.g. 0) means that we should proceed with boot. + status = getBootOptions(firstRun); + firstRun = false; + if (status == -1) continue; + + status = processBootOptions(); + // Status == 1 means to chainboot + if ( status == 1 ) break; + // Status == -1 means that the config file couldn't be loaded or that gBootVolume is NULL + if ( status == -1 ) + { + // gBootVolume == NULL usually means the user hit escape. + if (gBootVolume == NULL) + { + freeFilteredBVChain(bvChain); + + if (gEnableCDROMRescan) + rescanBIOSDevice(gBIOSDev); + + bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); + setBootGlobals(bvChain); + setupDeviceList(&bootInfo->themeConfig); + } + 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 ) + if ( bootArgs->Video.v_display == GRAPHICS_MODE ) { gui.devicelist.draw = false; gui.bootprompt.draw = false; @@ -431,8 +425,8 @@ archCpuType = CPU_TYPE_I386; } } - - if (getValueForKey(kKernelArchKey, &val, &len, &bootInfo->chameleonConfig)) { + + if (getValueForKey(kKernelArchKey, &val, &len, &bootInfo->chameleonConfig)) { if (strncmp(val, "i386", 4) == 0) { archCpuType = CPU_TYPE_I386; } @@ -461,7 +455,7 @@ const char *tmp; BVRef bvr; if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->chameleonConfig)) - val="/private/var/vm/sleepimage"; + val = "/private/var/vm/sleepimage"; // Do this first to be sure that root volume is mounted ret = GetFileInfo(0, val, &flags, &sleeptime); @@ -477,25 +471,26 @@ break; if (!forceresume && ((sleeptime+3)modTime)) { -#if DEBUG - printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",bvr->modTime-sleeptime); -#endif +#if DEBUG + printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n", + bvr->modTime-sleeptime); +#endif break; } HibernateBoot((char *)val); break; } - + getBoolForKey(kUseKernelCache, &usecache, &bootInfo->chameleonConfig); - if(usecache) { + if (usecache) { if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) { - if(val[0] == '\\') - { - len--; - val++; - } - strlcpy(gBootKernelCacheFile, val, len+1); + if (val[0] == '\\') + { + len--; + val++; + } + strlcpy(gBootKernelCacheFile, val, len + 1); } else { //Lion @@ -504,17 +499,9 @@ } // Snow Leopard else if (checkOSVersion("10.6")) { - sprintf(gBootKernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); + sprintf(gBootKernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386) + ? "i386" : "x86_64"); int lnam = sizeof(gBootKernelCacheFile) + 9; //with adler32 - //Slice - TODO ??? - // e.g. kernelcache_i386.E102928C.qSs0 = "unsaved" cache file. - // - // See kext_tools-180.2.1/kextcache_main.c: - // "Source directory has changed since starting; " - // "not saving cache file %s." - // or - // "Source kernel has changed since starting; " - // "not saving cache file %s." char* name; long prev_time = 0; @@ -523,7 +510,8 @@ while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) { - if(((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time && strstr(name, gBootKernelCacheFile) && (name[lnam] != '.')) + if (((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time + && strstr(name, gBootKernelCacheFile) && (name[lnam] != '.')) { sprintf(gBootKernelCacheFile, "%s%s", kDefaultCachePathSnow, name); prev_time = time; @@ -542,187 +530,193 @@ } } } - - // Check for cache file. - trycache = (usecache && + + // Check for cache file. + trycache = (usecache && ((gBootMode & kBootModeSafe) == 0) && - !gOverrideKernel && - (gBootFileType == kBlockDeviceType) && - (gMKextName[0] == '\0') && - (gBootKernelCacheFile[0] != '\0')); - + !gOverrideKernel && + (gBootFileType == kBlockDeviceType) && + (gMKextName[0] == '\0') && + (gBootKernelCacheFile[0] != '\0')); + verbose("Loading Darwin %s\n", gMacOSVersion); - if (trycache) do { - ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime); - if(ret != 0) kerneltime = 0; - else if ((flags & kFileTypeMask) != kFileTypeFlat) { - trycache = 0; - break; - } + if (trycache) do { + ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime); + if (ret != 0) kerneltime = 0; + else if ((flags & kFileTypeMask) != kFileTypeFlat) { + trycache = 0; + break; + } + + ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime); + if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat) + || (cachetime < kerneltime)) { + trycache = 0; + break; + } + + ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime); + if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) + && (cachetime < exttime)) { + trycache = 0; + break; + } + + if (ret == 0 && kerneltime > exttime) { + exttime = kerneltime; + } + + if (ret == 0 && cachetime != (exttime + 1)) { + trycache = 0; + break; + } + } while (0); - ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime); - if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat) - || (cachetime < kerneltime)) { - trycache = 0; - break; - } - ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime); - if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) - && (cachetime < exttime)) { - trycache = 0; - break; - } - if (ret == 0 && kerneltime > exttime) { - exttime = kerneltime; - } - if (ret == 0 && cachetime != (exttime + 1)) { - trycache = 0; - break; - } - } while (0); - - do { - if (trycache) { - bootFile = gBootKernelCacheFile; - + do { + if (trycache) { + bootFile = gBootKernelCacheFile; + verbose("Loading kernel cache %s\n", bootFile); - - if (checkOSVersion("10.7")) { - ret = LoadThinFatFile(bootFile, &binary); + + if (checkOSVersion("10.7")) { + ret = LoadThinFatFile(bootFile, &binary); } else { - ret = LoadFile(bootFile); + ret = LoadFile(bootFile); binary = (void *)kLoadAddr; } - if (ret >= 0) - break; + if (ret >= 0) + break; verbose("Kernel cache did not load %s\n ", bootFile); - } - - if (checkOSVersion("10.7")) { - bootFile = gBootKernelCacheFile; - } - else { - sprintf(bootFile, "\%s", bootInfo->bootFile); - } - - // Try to load kernel image from alternate locations on boot helper partitions. - sprintf(bootFileSpec, "com.apple.boot.P%s", bootFile); - ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); - if (ret == -1) - { - sprintf(bootFileSpec, "com.apple.boot.R%s", bootFile); - ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); - if (ret == -1) - { - sprintf(bootFileSpec, "com.apple.boot.S%s", bootFile); - ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); - if (ret == -1) - { - // No alternate location found, using the original kernel image path. - strcpy(bootFileSpec, bootInfo->bootFile); - } - } - } - - if (checkOSVersion("10.7")) - { - //Lion, dont load kernel if haz cache - if (!trycache) - { - verbose("Loading kernel %s\n", bootFileSpec); - ret = LoadThinFatFile(bootFileSpec, &binary); - if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) - { - archCpuType = CPU_TYPE_I386; - ret = LoadThinFatFile(bootFileSpec, &binary); - } - } + } + + if (checkOSVersion("10.7")) { + bootFile = gBootKernelCacheFile; + } + else { + sprintf(bootFile, "\%s", bootInfo->bootFile); + } + + // Try to load kernel image from alternate locations on boot helper partitions. + sprintf(bootFileSpec, "com.apple.boot.P%s", bootFile); + ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); + if (ret == -1) + { + sprintf(bootFileSpec, "com.apple.boot.R%s", bootFile); + ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); + if (ret == -1) + { + sprintf(bootFileSpec, "com.apple.boot.S%s", bootFile); + ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); + if (ret == -1) + { + // No alternate location found, using the original kernel image path. + strcpy(bootFileSpec, bootInfo->bootFile); + } + } + } + + if (checkOSVersion("10.7")) + { + //Lion, dont load kernel if haz cache + if (!trycache) + { + verbose("Loading kernel %s\n", bootFileSpec); + ret = LoadThinFatFile(bootFileSpec, &binary); + if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) + { + archCpuType = CPU_TYPE_I386; + ret = LoadThinFatFile(bootFileSpec, &binary); + } + } else ret = 1; - } + } else - { - //Snow Leopard or older - verbose("Loading kernel %s\n", bootFileSpec); - ret = LoadThinFatFile(bootFileSpec, &binary); - if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) - { - archCpuType = CPU_TYPE_I386; - ret = LoadThinFatFile(bootFileSpec, &binary); - } - } - } while (0); - - clearActivityIndicator(); + { + //Snow Leopard or older + verbose("Loading kernel %s\n", bootFileSpec); + ret = LoadThinFatFile(bootFileSpec, &binary); + if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) + { + archCpuType = CPU_TYPE_I386; + ret = LoadThinFatFile(bootFileSpec, &binary); + } + } + } while (0); + + clearActivityIndicator(); + #if DEBUG - printf("Pausing..."); - sleep(8); + printf("Pausing..."); + sleep(8); #endif - - if (ret <= 0) { + + 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; - break; - } - } else { - /* Won't return if successful. */ - ret = ExecKernel(binary); - } - } - - // chainboot - if (status==1) { - if (getVideoMode() == GRAPHICS_MODE) { // if we are already in graphics-mode, - setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode + + if (gBootFileType == kNetworkDeviceType) { + // Return control back to PXE. Don't unload PXE base code. + gUnloadPXEOnExit = false; + break; + } + } else { + /* Won't return if successful. */ + ret = ExecKernel(binary); } - } + } - if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) { + // chainboot + if (status == 1) { + // if we are already in graphics-mode, + if (getVideoMode() == GRAPHICS_MODE) { + setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode. + } + } + + if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) { nbpUnloadBaseCode(); - } + } } /*! - Selects a new BIOS device, taking care to update the global state appropriately. + Selects a new BIOS device, taking care to update the global state appropriately. */ /* static void selectBiosDevice(void) { - struct DiskBVMap *oldMap = diskResetBootVolumes(gBIOSDev); - CacheReset(); - diskFreeMap(oldMap); - oldMap = NULL; - - int dev = selectAlternateBootDevice(gBIOSDev); - - BVRef bvchain = scanBootVolumes(dev, 0); - BVRef bootVol = selectBootVolume(bvchain); - gBootVolume = bootVol; - setRootVolume(bootVol); - gBIOSDev = dev; + struct DiskBVMap *oldMap = diskResetBootVolumes(gBIOSDev); + CacheReset(); + diskFreeMap(oldMap); + oldMap = NULL; + + int dev = selectAlternateBootDevice(gBIOSDev); + + BVRef bvchain = scanBootVolumes(dev, 0); + BVRef bootVol = selectBootVolume(bvchain); + gBootVolume = bootVol; + setRootVolume(bootVol); + gBIOSDev = dev; } */ bool checkOSVersion(const char * version) { - return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1]) && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); + return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1]) + && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); } bool getOSVersion() { - bool valid = false; - config_file_t systemVersion; - const char *val; - int len; - + bool valid = false; + const char *val; + int len; + config_file_t systemVersion; + if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) { valid = true; @@ -734,7 +728,7 @@ if (valid) { - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { // getValueForKey uses const char for val // so copy it and trim @@ -752,34 +746,34 @@ #define NMAX 5000 // NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 -#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); +#define DO1(buf, i) {s1 += buf[i]; s2 += s1;} +#define DO2(buf, i) DO1(buf, i); DO1(buf, i + 1); +#define DO4(buf, i) DO2(buf, i); DO2(buf, i + 2); +#define DO8(buf, i) DO4(buf, i); DO4(buf, i + 4); +#define DO16(buf) DO8(buf, 0); DO8(buf, 8); unsigned long Adler32(unsigned char *buf, long len) { - unsigned long s1 = 1; // adler & 0xffff; - unsigned long s2 = 0; // (adler >> 16) & 0xffff; - unsigned long result; - int k; - - while (len > 0) { - k = len < NMAX ? len : NMAX; - len -= k; - while (k >= 16) { - DO16(buf); - buf += 16; - k -= 16; - } - if (k != 0) do { - s1 += *buf++; - s2 += s1; - } while (--k); - s1 %= BASE; - s2 %= BASE; - } - result = (s2 << 16) | s1; - return OSSwapHostToBigInt32(result); + unsigned long s1 = 1; // adler & 0xffff; + unsigned long s2 = 0; // (adler >> 16) & 0xffff; + unsigned long result; + int k; + + while (len > 0) { + k = len < NMAX ? len : NMAX; + len -= k; + while (k >= 16) { + DO16(buf); + buf += 16; + k -= 16; + } + if (k != 0) do { + s1 += *buf++; + s2 += s1; + } while (--k); + s1 %= BASE; + s2 %= BASE; + } + result = (s2 << 16) | s1; + return OSSwapHostToBigInt32(result); } Index: branches/ErmaC/i386/boot2/boot.h =================================================================== --- branches/ErmaC/i386/boot2/boot.h (revision 1395) +++ branches/ErmaC/i386/boot2/boot.h (revision 1396) @@ -68,7 +68,7 @@ #define kRescanPromptKey "Rescan Prompt" #define kRescanKey "Rescan" #define kScanSingleDriveKey "Scan Single Drive" -#define kInsantMenuKey "Instant Menu" +#define kInstantMenuKey "Instant Menu" #define kDefaultKernel "mach_kernel" #define kGUIKey "GUI" #define kBootBannerKey "Boot Banner" Index: branches/ErmaC/i386/boot2/gui.c =================================================================== --- branches/ErmaC/i386/boot2/gui.c (revision 1395) +++ branches/ErmaC/i386/boot2/gui.c (revision 1396) @@ -887,14 +887,14 @@ infoMenuSelection = 0; } - if(gui.menu.draw) + if (gui.menu.draw) drawInfoMenuItems(); - //Azi: make this info more accessible. getBoolForKey(kShowInfoKey, &shoWinfo, &bootInfo->chameleonConfig); if (shoWinfo && showBootBanner) // no boot banner, no showinfo. { + // keep formatted with spaces instead of tabs gui.debug.cursor = pos( 10, 100); dprintf( &gui.screen, "label: %s\n", param->label ); dprintf( &gui.screen, "biosdev: 0x%x\n", param->biosdev ); @@ -927,11 +927,11 @@ } // draw prev indicator - if(start) + if (start) blend( images[iDeviceScrollPrev].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollPrev].image, p_prev ) ); // draw next indicator - if( end < gDeviceCount - 1 ) + if ( end < gDeviceCount - 1 ) blend( images[iDeviceScrollNext].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollNext].image, p_next ) ); gui.redraw = true; Index: branches/ErmaC/package/Resources/Bosnian.lproj/Description.html =================================================================== --- branches/ErmaC/package/Resources/Bosnian.lproj/Description.html (revision 0) +++ branches/ErmaC/package/Resources/Bosnian.lproj/Description.html (revision 1396) @@ -0,0 +1,36 @@ + + + + + + + + + + + +

Chameleon je kombinacija različitih komponenti bootloadera.

+

On se temelji na David Elliottovoj lažnoj EFI implementaciji dodanoj na Apple boot-132 projektu.

+

Chameleon je proširen sa slijedećim ključnim značenjima:

+


+

Nove funkcije u Chameleon 2.0

+


+

- Potpuno prilagođen grafički korisinički interfejs donosi neke boje u Darwin Bootloaderu.

+

- Start sa retail DVD-om direktno učitava ramdisk slike bez pomoći dodatnih programa.

+

- Hibernacija. Uživajte u nastavaku rada vašeg Mac OS X-a sa pregledom slike.

+

- SMBIOS zamijena tvorničkih za modifikovanu SMBIOS vrijednost.

+

- DSDT zamijena za korištenje modifikovanog, ispravljenog DSDT-a koji može riješiti nekoliko problema.

+


+

- Implementacija svojstva uređaja putem svojstva niza.

+

- hibridni boot0 / boot1h za MBR i GPT particionirane diskove.

+

- automatsko FSB kodno otkrivanje čak i za posljednje AMD procesore. 

+

- Apple softver RAID podrška.

+


+

Za detaljne informacije posjetite: http://chameleon.osx86.hu

+ + Index: branches/ErmaC/package/Resources/Bosnian.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/ErmaC/package/Resources/Bosnian.lproj/Localizable.strings ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/ErmaC/package/Resources/Bosnian.lproj/Welcome.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/package/Resources/Bosnian.lproj/Welcome.rtfd/TXT.rtf (revision 0) +++ branches/ErmaC/package/Resources/Bosnian.lproj/Welcome.rtfd/TXT.rtf (revision 1396) @@ -0,0 +1,36 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 +{\fonttbl\f0\fnil\fcharset0 LucidaGrande;} +{\colortbl;\red255\green255\blue255;\red65\green78\blue255;\red0\green0\blue255;} +\margl1440\margr1440\vieww11660\viewh12980\viewkind0 +\pard\ri0\qc + +\f0\b\fs72 \cf0 Chameleon +\fs50 \ + +\fs26 v%CHAMELEONVERSION% r%CHAMELEONREVISION% +\fs50 \ +\pard\ri0\ql\qnatural + +\fs26 \cf0 \ +\pard\ri0\qc + +\fs50 \cf2 %CHAMELEONSTAGE% +\fs26 \cf0 \ +\pard\ri0\ql\qnatural +\cf0 \ +Programeri :%DEVELOP%\ +\ +Hvala : %CREDITS%\ +\pard\tx360\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\b0\fs30 \cf0 \ +\pard\ri0\ql\qnatural + +\b\fs26 \cf0 Pkg : %PKGDEV% +\b0\fs30 \ +\pard\tx360\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural +\cf0 \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\fs26 \cf0 Copyright \'a9 2011 +\b \cf3 Bosnian translation: mlstudio} Index: branches/ErmaC/package/Resources/Bosnian.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/package/Resources/Bosnian.lproj/Conclusion.rtfd/TXT.rtf (revision 0) +++ branches/ErmaC/package/Resources/Bosnian.lproj/Conclusion.rtfd/TXT.rtf (revision 1396) @@ -0,0 +1,34 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350 +{\fonttbl\f0\fnil\fcharset0 LucidaGrande;} +{\colortbl;\red255\green255\blue255;\red65\green78\blue255;\red255\green0\blue0;} +\margl1440\margr1440\vieww11660\viewh12980\viewkind0 +\pard\ri0\qc + +\f0\b\fs72 \cf0 Chameleon +\fs50 \ + +\fs26 v%CHAMELEONVERSION% r%CHAMELEONREVISION% +\fs50 \ +\ +\cf2 %CHAMELEONSTAGE%\cf0 \ +\pard\ri0\ql\qnatural + +\fs26 \cf0 \ +\pard\ri0\qc + +\fs50 \cf3 Instalacija Kompletna! +\b0\fs26 \cf0 \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\fs18 \cf0 \ +{\field{\*\fldinst{HYPERLINK "http://chameleon.osx86.hu/"}}{\fldrslt +\fs26 http://chameleon.osx86.hu/}} +\fs26 \ +{\field{\*\fldinst{HYPERLINK "http://forum.voodooprojects.org/index.php"}}{\fldrslt http://forum.voodooprojects.org/index.php}} +\b \ +\pard\tx360\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural + +\b0\fs30 \cf0 \ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\fs26 \cf0 Copyright \'a9 2011} Index: branches/ErmaC/package/Resources/Bosnian.lproj/License.rtf =================================================================== --- branches/ErmaC/package/Resources/Bosnian.lproj/License.rtf (revision 0) +++ branches/ErmaC/package/Resources/Bosnian.lproj/License.rtf (revision 1396) @@ -0,0 +1,350 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350 +{\fonttbl\f0\fmodern\fcharset0 Courier-Bold;\f1\fmodern\fcharset0 Courier;} +{\colortbl;\red255\green255\blue255;} +\paperw12240\paperh15840\vieww22060\viewh18360\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs40 \cf0 APPLE PUBLIC SOURCE LICENSE \ + +\fs26 Version 2.0 - August 6, 2003\ +\ + +\f1\b0 Please read this License carefully before downloading this software. By downloading or using this software, you are agreeing to be bound by the terms of this License. If you do not or cannot agree to the terms of this License, please do not download or use the software.\ +\ +1. General; Definitions. This License applies to any program or other work which Apple Computer, Inc. ("Apple") makes publicly available and which contains a notice placed by Apple identifying such program or work as "Original Code" and stating that it is subject to the terms of this Apple Public Source License version 2.0 ("License"). As used in this License:\ +\ +1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is the grantor of rights, (i) claims of patents that are now or hereafter acquired, owned by or assigned to Apple and (ii) that cover subject matter contained in the Original Code, but only to the extent necessary to use, reproduce and/or distribute the Original Code without infringement; and (b) in the case where You are the grantor of rights, (i) claims of patents that are now or hereafter acquired, owned by or assigned to You and (ii) that cover subject matter in Your Modifications, taken alone or in combination with Original Code.\ +\ +1.2 "Contributor" means any person or entity that creates or contributes to the creation of Modifications.\ +\ +1.3 "Covered Code" means the Original Code, Modifications, the combination of Original Code and any Modifications, and/or any respective portions thereof.\ +\ +1.4 "Externally Deploy" means: (a) to sublicense, distribute or otherwise make Covered Code available, directly or indirectly, to anyone other than You; and/or (b) to use Covered Code, alone or as part of a Larger Work, in any way to provide a service, including but not limited to delivery of content, through electronic communication with a client other than You.\ +\ +1.5 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.\ +\ +1.6 "Modifications" mean any addition to, deletion from, and/or change\ +to, the substance and/or structure of the Original Code, any previous\ +Modifications, the combination of Original Code and any previous\ +Modifications, and/or any respective portions thereof. When code is\ +released as a series of files, a Modification is: (a) any addition to\ +or deletion from the contents of a file containing Covered Code;\ +and/or (b) any new file or other representation of computer program\ +statements that contains any part of Covered Code.\ +\ +1.7 "Original Code" means (a) the Source Code of a program or other\ +work as originally made available by Apple under this License,\ +including the Source Code of any updates or upgrades to such programs\ +or works made available by Apple under this License, and that has been\ +expressly identified by Apple as such in the header file(s) of such\ +work; and (b) the object code compiled from such Source Code and\ +originally made available by Apple under this License.\ +\ +1.8 "Source Code" means the human readable form of a program or other\ +work that is suitable for making modifications to it, including all\ +modules it contains, plus any associated interface definition files,\ +scripts used to control compilation and installation of an executable\ +(object code).\ +\ +1.9 "You" or "Your" means an individual or a legal entity exercising\ +rights under this License. For legal entities, "You" or "Your"\ +includes any entity which controls, is controlled by, or is under\ +common control with, You, where "control" means (a) the power, direct\ +or indirect, to cause the direction or management of such entity,\ +whether by contract or otherwise, or (b) ownership of fifty percent\ +(50%) or more of the outstanding shares or beneficial ownership of\ +such entity.\ +\ +2. Permitted Uses; Conditions & Restrictions. Subject to the terms\ +and conditions of this License, Apple hereby grants You, effective on\ +the date You accept this License and download the Original Code, a\ +world-wide, royalty-free, non-exclusive license, to the extent of\ +Apple's Applicable Patent Rights and copyrights covering the Original\ +Code, to do the following:\ +\ +2.1 Unmodified Code. You may use, reproduce, display, perform,\ +internally distribute within Your organization, and Externally Deploy\ +verbatim, unmodified copies of the Original Code, for commercial or\ +non-commercial purposes, provided that in each instance:\ +\ +(a) You must retain and reproduce in all copies of Original Code the\ +copyright and other proprietary notices and disclaimers of Apple as\ +they appear in the Original Code, and keep intact all notices in the\ +Original Code that refer to this License; and\ +\ +(b) You must include a copy of this License with every copy of Source\ +Code of Covered Code and documentation You distribute or Externally\ +Deploy, and You may not offer or impose any terms on such Source Code\ +that alter or restrict this License or the recipients' rights\ +hereunder, except as permitted under Section 6.\ +\ +2.2 Modified Code. You may modify Covered Code and use, reproduce,\ +display, perform, internally distribute within Your organization, and\ +Externally Deploy Your Modifications and Covered Code, for commercial\ +or non-commercial purposes, provided that in each instance You also\ +meet all of these conditions:\ +\ +(a) You must satisfy all the conditions of Section 2.1 with respect to\ +the Source Code of the Covered Code;\ +\ +(b) You must duplicate, to the extent it does not already exist, the\ +notice in Exhibit A in each file of the Source Code of all Your\ +Modifications, and cause the modified files to carry prominent notices\ +stating that You changed the files and the date of any change; and\ +\ +(c) If You Externally Deploy Your Modifications, You must make\ +Source Code of all Your Externally Deployed Modifications either\ +available to those to whom You have Externally Deployed Your\ +Modifications, or publicly available. Source Code of Your Externally\ +Deployed Modifications must be released under the terms set forth in\ +this License, including the license grants set forth in Section 3\ +below, for as long as you Externally Deploy the Covered Code or twelve\ +(12) months from the date of initial External Deployment, whichever is\ +longer. You should preferably distribute the Source Code of Your\ +Externally Deployed Modifications electronically (e.g. download from a\ +web site).\ +\ +2.3 Distribution of Executable Versions. In addition, if You\ +Externally Deploy Covered Code (Original Code and/or Modifications) in\ +object code, executable form only, You must include a prominent\ +notice, in the code itself as well as in related documentation,\ +stating that Source Code of the Covered Code is available under the\ +terms of this License with information on how and where to obtain such\ +Source Code.\ +\ +2.4 Third Party Rights. You expressly acknowledge and agree that\ +although Apple and each Contributor grants the licenses to their\ +respective portions of the Covered Code set forth herein, no\ +assurances are provided by Apple or any Contributor that the Covered\ +Code does not infringe the patent or other intellectual property\ +rights of any other entity. Apple and each Contributor disclaim any\ +liability to You for claims brought by any other entity based on\ +infringement of intellectual property rights or otherwise. As a\ +condition to exercising the rights and licenses granted hereunder, You\ +hereby assume sole responsibility to secure any other intellectual\ +property rights needed, if any. For example, if a third party patent\ +license is required to allow You to distribute the Covered Code, it is\ +Your responsibility to acquire that license before distributing the\ +Covered Code.\ +\ +3. Your Grants. In consideration of, and as a condition to, the\ +licenses granted to You under this License, You hereby grant to any\ +person or entity receiving or distributing Covered Code under this\ +License a non-exclusive, royalty-free, perpetual, irrevocable license,\ +under Your Applicable Patent Rights and other intellectual property\ +rights (other than patent) owned or controlled by You, to use,\ +reproduce, display, perform, modify, sublicense, distribute and\ +Externally Deploy Your Modifications of the same scope and extent as\ +Apple's licenses under Sections 2.1 and 2.2 above.\ +\ +4. Larger Works. You may create a Larger Work by combining Covered\ +Code with other code not governed by the terms of this License and\ +distribute the Larger Work as a single product. In each such instance,\ +You must make sure the requirements of this License are fulfilled for\ +the Covered Code or any portion thereof.\ +\ +5. Limitations on Patent License. Except as expressly stated in\ +Section 2, no other patent rights, express or implied, are granted by\ +Apple herein. Modifications and/or Larger Works may require additional\ +patent licenses from Apple which Apple may grant in its sole\ +discretion.\ +\ +6. Additional Terms. You may choose to offer, and to charge a fee for,\ +warranty, support, indemnity or liability obligations and/or other\ +rights consistent with the scope of the license granted herein\ +("Additional Terms") to one or more recipients of Covered Code.\ +However, You may do so only on Your own behalf and as Your sole\ +responsibility, and not on behalf of Apple or any Contributor. You\ +must obtain the recipient's agreement that any such Additional Terms\ +are offered by You alone, and You hereby agree to indemnify, defend\ +and hold Apple and every Contributor harmless for any liability\ +incurred by or claims asserted against Apple or such Contributor by\ +reason of any such Additional Terms.\ +\ +7. Versions of the License. Apple may publish revised and/or new\ +versions of this License from time to time. Each version will be given\ +a distinguishing version number. Once Original Code has been published\ +under a particular version of this License, You may continue to use it\ +under the terms of that version. You may also choose to use such\ +Original Code under the terms of any subsequent version of this\ +License published by Apple. No one other than Apple has the right to\ +modify the terms applicable to Covered Code created under this\ +License.\ +\ +8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in\ +part pre-release, untested, or not fully tested works. The Covered\ +Code may contain errors that could cause failures or loss of data, and\ +may be incomplete or contain inaccuracies. You expressly acknowledge\ +and agree that use of the Covered Code, or any portion thereof, is at\ +Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND\ +WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND\ +APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE\ +PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM\ +ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT\ +NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF\ +MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR\ +PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD\ +PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST\ +INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE\ +FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,\ +THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR\ +ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO\ +ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE\ +AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.\ +You acknowledge that the Covered Code is not intended for use in the\ +operation of nuclear facilities, aircraft navigation, communication\ +systems, or air traffic control machines in which case the failure of\ +the Covered Code could lead to death, personal injury, or severe\ +physical or environmental damage.\ +\ +9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO\ +EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL,\ +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING\ +TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR\ +ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,\ +TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF\ +APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\ +DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY\ +REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF\ +INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY\ +TO YOU. In no event shall Apple's total liability to You for all\ +damages (other than as may be required by applicable law) under this\ +License exceed the amount of fifty dollars ($50.00).\ +\ +10. Trademarks. This License does not grant any rights to use the\ +trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS",\ +"QuickTime", "QuickTime Streaming Server" or any other trademarks,\ +service marks, logos or trade names belonging to Apple (collectively\ +"Apple Marks") or to any trademark, service mark, logo or trade name\ +belonging to any Contributor. You agree not to use any Apple Marks in\ +or as part of the name of products derived from the Original Code or\ +to endorse or promote products derived from the Original Code other\ +than as expressly permitted by and in strict compliance at all times\ +with Apple's third party trademark usage guidelines which are posted\ +at http://www.apple.com/legal/guidelinesfor3rdparties.html.\ +\ +11. Ownership. Subject to the licenses granted under this License,\ +each Contributor retains all rights, title and interest in and to any\ +Modifications made by such Contributor. Apple retains all rights,\ +title and interest in and to the Original Code and any Modifications\ +made by or on behalf of Apple ("Apple Modifications"), and such Apple\ +Modifications will not be automatically subject to this License. Apple\ +may, at its sole discretion, choose to license such Apple\ +Modifications under this License, or on different terms from those\ +contained in this License or may choose not to license them at all.\ +\ +12. Termination.\ +\ +12.1 Termination. This License and the rights granted hereunder will\ +terminate:\ +\ +(a) automatically without notice from Apple if You fail to comply with\ +any term(s) of this License and fail to cure such breach within 30\ +days of becoming aware of such breach;\ +\ +(b) immediately in the event of the circumstances described in Section\ +13.5(b); or\ +\ +(c) automatically without notice from Apple if You, at any time during\ +the term of this License, commence an action for patent infringement\ +against Apple; provided that Apple did not first commence\ +an action for patent infringement against You in that instance.\ +\ +12.2 Effect of Termination. Upon termination, You agree to immediately\ +stop any further use, reproduction, modification, sublicensing and\ +distribution of the Covered Code. All sublicenses to the Covered Code\ +which have been properly granted prior to termination shall survive\ +any termination of this License. Provisions which, by their nature,\ +should remain in effect beyond the termination of this License shall\ +survive, including but not limited to Sections 3, 5, 8, 9, 10, 11,\ +12.2 and 13. No party will be liable to any other for compensation,\ +indemnity or damages of any sort solely as a result of terminating\ +this License in accordance with its terms, and termination of this\ +License will be without prejudice to any other right or remedy of\ +any party.\ +\ +13. Miscellaneous.\ +\ +13.1 Government End Users. The Covered Code is a "commercial item" as\ +defined in FAR 2.101. Government software and technical data rights in\ +the Covered Code include only those rights customarily provided to the\ +public as defined in this License. This customary commercial license\ +in technical data and software is provided in accordance with FAR\ +12.211 (Technical Data) and 12.212 (Computer Software) and, for\ +Department of Defense purchases, DFAR 252.227-7015 (Technical Data --\ +Commercial Items) and 227.7202-3 (Rights in Commercial Computer\ +Software or Computer Software Documentation). Accordingly, all U.S.\ +Government End Users acquire Covered Code with only those rights set\ +forth herein.\ +\ +13.2 Relationship of Parties. This License will not be construed as\ +creating an agency, partnership, joint venture or any other form of\ +legal association between or among You, Apple or any Contributor, and\ +You will not represent to the contrary, whether expressly, by\ +implication, appearance or otherwise.\ +\ +13.3 Independent Development. Nothing in this License will impair\ +Apple's right to acquire, license, develop, have others develop for\ +it, market and/or distribute technology or products that perform the\ +same or similar functions as, or otherwise compete with,\ +Modifications, Larger Works, technology or products that You may\ +develop, produce, market or distribute.\ +\ +13.4 Waiver; Construction. Failure by Apple or any Contributor to\ +enforce any provision of this License will not be deemed a waiver of\ +future enforcement of that or any other provision. Any law or\ +regulation which provides that the language of a contract shall be\ +construed against the drafter will not apply to this License.\ +\ +13.5 Severability. (a) If for any reason a court of competent\ +jurisdiction finds any provision of this License, or portion thereof,\ +to be unenforceable, that provision of the License will be enforced to\ +the maximum extent permissible so as to effect the economic benefits\ +and intent of the parties, and the remainder of this License will\ +continue in full force and effect. (b) Notwithstanding the foregoing,\ +if applicable law prohibits or restricts You from fully and/or\ +specifically complying with Sections 2 and/or 3 or prevents the\ +enforceability of either of those Sections, this License will\ +immediately terminate and You must immediately discontinue any use of\ +the Covered Code and destroy all copies of it that are in your\ +possession or control.\ +\ +13.6 Dispute Resolution. Any litigation or other dispute resolution\ +between You and Apple relating to this License shall take place in the\ +Northern District of California, and You and Apple hereby consent to\ +the personal jurisdiction of, and venue in, the state and federal\ +courts within that District with respect to this License. The\ +application of the United Nations Convention on Contracts for the\ +International Sale of Goods is expressly excluded.\ +\ +13.7 Entire Agreement; Governing Law. This License constitutes the\ +entire agreement between the parties with respect to the subject\ +matter hereof. This License shall be governed by the laws of the\ +United States and the State of California, except that body of\ +California law concerning conflicts of law.\ +\ +Where You are located in the province of Quebec, Canada, the following\ +clause applies: The parties hereby confirm that they have requested\ +that this License and all related documents be drafted in English. Les\ +parties ont exige que le present contrat et tous les documents\ +connexes soient rediges en anglais.\ +\ +EXHIBIT A.\ +\ +"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.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." } \ No newline at end of file Index: branches/ErmaC/package/buildpkg.sh =================================================================== --- branches/ErmaC/package/buildpkg.sh (revision 1395) +++ branches/ErmaC/package/buildpkg.sh (revision 1396) @@ -27,11 +27,11 @@ # ================= -develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef " +develop=" zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice, cosmo1t, cparm" -credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, DutchHockeyPro & Andy" +credits=" JrCs, mercurysquad, munky, rekursor, kalyway, Krazubu, XyZ, blackosx, DHP" -pkgdev=" blackosx, ErmaC , scrax" +pkgdev=" blackosx, ErmaC, scrax" # ================= Index: branches/ErmaC/CREDITS =================================================================== --- branches/ErmaC/CREDITS (revision 1395) +++ branches/ErmaC/CREDITS (revision 1396) @@ -3,9 +3,9 @@ Developers: ---------- -zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice +zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice, cosmo1t, cparm Thanks to: --------- -JrCs, mercurysquad, munky, rekursor, cosmolt, kalyway, Krazubu, THeKiNG, XyZ, blackosx, DHP, cparm +JrCs, mercurysquad, munky, rekursor, kalyway, Krazubu, XyZ, blackosx, DHP