Index: branches/valv/version =================================================================== --- branches/valv/version (revision 708) +++ branches/valv/version (revision 709) @@ -1 +1 @@ -5.1.3 +5.1.4 Index: branches/valv/artwork/themes/embed/theme.plist =================================================================== --- branches/valv/artwork/themes/embed/theme.plist (revision 708) +++ branches/valv/artwork/themes/embed/theme.plist (revision 709) @@ -4,80 +4,86 @@ Author Blackosx + Version + 1.0 + Enabled no - Version - 1.0 + + screen_width + 1024 + screen_height + 768 + screen_textmargin_h + 10 + screen_textmargin_v + 10 + screen_bgcolor + #767f73 + background_pos_x 50% background_pos_y 0 - boot_bgcolor - #AAAAAA - boot_height - 1080 - boot_width - 1920 - bootprompt_bgcolor - #3e3e3e - bootprompt_height - 20 + + logo_pos_x + + logo_pos_y + 5% + logo_bgcolor + #000000 + logo_transparency + 255 + + devices_pos_x + + devices_pos_y + + devices_bgcolor + #767f73 + devices_transparency + 0 + devices_max_visible + 5 + devices_iconspacing + 35 + devices_layout + horizontal + bootprompt_pos_x bootprompt_pos_y -6 + bootprompt_width + 40% + bootprompt_height + 20 bootprompt_textmargin_h 10 bootprompt_textmargin_v 5 + bootprompt_bgcolor + #3e3e3e bootprompt_transparency 1 - bootprompt_width - 40% - countdown_pos_x - - countdown_pos_y - -20% - devices_bgcolor - #767f73 - devices_iconspacing - 35 - devices_layout - horizontal - devices_max_visible - 5 - devices_pos_x - - devices_pos_y - - devices_transparency - 0 - infobox_bgcolor - #3e3e3e - infobox_height - 320 + infobox_pos_x infobox_pos_y 30% + infobox_width + 660 + infobox_height + 320 infobox_textmargin_h 10 infobox_textmargin_v 10 + infobox_bgcolor + #3e3e3e infobox_transparency 35 - infobox_width - 660 - logo_bgcolor - #000000 - logo_pos_x - - logo_pos_y - 5% - logo_transparency - 255 - menu_bgcolor - #3e3e3e + menu_pos_x menu_pos_y @@ -86,25 +92,30 @@ 10 menu_textmargin_v 5 + menu_bgcolor + #3e3e3e menu_transparency 1 - progressbar_height - 40 + progressbar_pos_x progressbar_pos_y -30% progressbar_width 100 - screen_bgcolor - #767f73 - screen_height - 1080 - screen_textmargin_h - 10 - screen_textmargin_v - 10 - screen_width - 1920 + progressbar_height + 40 + + countdown_pos_x + + countdown_pos_y + -20% + + boot_width + 1024 + boot_height + 768 + boot_bgcolor + #AAAAAA Index: branches/valv/i386/libsaio/ati_resolution.c =================================================================== --- branches/valv/i386/libsaio/ati_resolution.c (revision 708) +++ branches/valv/i386/libsaio/ati_resolution.c (revision 709) @@ -78,7 +78,7 @@ *x = modeTiming[idx + 1].hActive; *y = modeTiming[idx + 1].vActive; - return TRUE; + return true; } bool atiSetMode_2(sModeTable * table, uint8_t idx, uint32_t* x, uint32_t* y) @@ -100,5 +100,5 @@ *x = modeTiming[idx + 1].hActive; *y = modeTiming[idx + 1].hActive; - return TRUE; + return true; } Index: branches/valv/i386/libsaio/device_tree.c =================================================================== --- branches/valv/i386/libsaio/device_tree.c (revision 708) +++ branches/valv/i386/libsaio/device_tree.c (revision 709) @@ -397,7 +397,7 @@ _PrintTree(node, 0); } -#if 0 +//#if 0 void DT__PrintFlattenedNode(DTEntry entry, int level) { @@ -536,6 +536,6 @@ return 0; } +//#endif #endif -#endif Index: branches/valv/i386/libsaio/vbe.h =================================================================== --- branches/valv/i386/libsaio/vbe.h (revision 708) +++ branches/valv/i386/libsaio/vbe.h (revision 709) @@ -271,7 +271,7 @@ typedef unsigned long VBEPalette[256]; extern int getVBEInfo(void *vinfo_p); -extern int getEDID(void * edidBlock, UInt8 blocks_left); +//extern int getEDID(void * edidBlock, UInt8 blocks_left); extern int getVBEModeInfo(int mode, void *minfo_p); extern int getVBEDACFormat(unsigned char *format); extern int setVBEDACFormat(unsigned char format); Index: branches/valv/i386/libsaio/gma.c =================================================================== --- branches/valv/i386/libsaio/gma.c (revision 708) +++ branches/valv/i386/libsaio/gma.c (revision 709) @@ -108,15 +108,15 @@ devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1)); devprop_add_value(device, "device_type", (uint8_t*)"display", 8); - if ((model == (char *)"Mobile GMA950") || - (model == (char *)"Mobile GMA3150")) + if ((model == (char *)"Mobile GMA950") + || (model == (char *)"Mobile GMA3150")) { devprop_add_value(device, "AAPL,HasPanel", reg_TRUE, 4); devprop_add_value(device, "built-in", &BuiltIn, 1); devprop_add_value(device, "class-code", ClassFix, 4); } - else if ((model == (char *)"Desktop GMA950") || - (model == (char *)"Desktop GMA3150")) + else if ((model == (char *)"Desktop GMA950") + || (model == (char *)"Desktop GMA3150")) { BuiltIn = 0x01; devprop_add_value(device, "built-in", &BuiltIn, 1); Index: branches/valv/i386/libsaio/aml_generator.c =================================================================== --- branches/valv/i386/libsaio/aml_generator.c (revision 708) +++ branches/valv/i386/libsaio/aml_generator.c (revision 709) @@ -22,12 +22,12 @@ case AML_CHUNK_QWORD: case AML_CHUNK_ALIAS: verbose("aml_add_to_parent: Node doesn't support child nodes!"); - return FALSE; + return false; case AML_CHUNK_NAME: if (parent->First) { verbose("aml_add_to_parent: Name node could have one child only!"); - return FALSE; + return false; } break; @@ -43,10 +43,10 @@ parent->Last = node; - return TRUE; + return true; } - return FALSE; + return false; } struct aml_chunk* aml_create_node(struct aml_chunk* parent) @@ -173,7 +173,7 @@ { if (strlen(name) < 4) { - verbose("aml_fill_simple_name: simple name %s has incorrect lengh! Must be 4", name); + verbose("aml_fill_simple_name: simple name %s has incorrect lengh! Must be 4\n", name); return 0; } @@ -190,7 +190,7 @@ if ((len % 4) > 1 || count == 0) { - verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16 etc.", name); + verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16 etc\n", name); return 0; } Index: branches/valv/i386/libsaio/autoresolution.c =================================================================== --- branches/valv/i386/libsaio/autoresolution.c (revision 708) +++ branches/valv/i386/libsaio/autoresolution.c (revision 709) @@ -14,7 +14,7 @@ */ #include "libsaio.h" -#include "autoresolution.h" +//#include "autoresolution.h" #include "nvidia_resolution.h" #include "ati_resolution.h" #include "gma_resolution.h" @@ -216,7 +216,7 @@ while ( i != 0 ) { table->id = tablesCount - i; - PRINT("New table with id : %d\n", table->id); + PRINT("New table with id: %d\n", table->id); // opening the chain if it's the first table if (i == tablesCount) @@ -240,7 +240,7 @@ } -void closeVbios(vBiosMap * map); +//void closeVbios(vBiosMap * map); azi: dup - declared on header vBiosMap * openVbios(chipsetType forcedChipset) { @@ -369,8 +369,8 @@ { PRINT("Closing VBios\n"); //make sure to turn autoResolution off - if (gAutoResolution == TRUE) - gAutoResolution = FALSE; + if (gAutoResolution == true) + gAutoResolution = false; // if we saved the vBios, free the copy if (map->biosBackupPtr != NULL) @@ -386,14 +386,14 @@ { if (table->backup != NULL) { - PRINT("Table #%d : Freeing backup\t", table->id); + PRINT("Table #%d: Freeing backup\t", table->id); FREE(table->backup); PRINT("[OK]\n"); } if (table != NULL) { - PRINT("Table #%d : Freeing\t\t", table->id); + PRINT("Table #%d: Freeing\t\t", table->id); FREE(table); PRINT("[OK]\n"); } @@ -412,7 +412,7 @@ void unlockVbios(vBiosMap * map) { - map->unlocked = TRUE; + map->unlocked = true; switch (map->chipset) { @@ -472,7 +472,7 @@ void relockVbios(vBiosMap * map) { - map->unlocked = FALSE; + map->unlocked = false; switch (map->chipset) { @@ -610,11 +610,11 @@ x = map->currentX; y = map->currentY; - PRINT("Patching Table #%d : \n", table->id); + PRINT("Patching Table #%d: \n", table->id); map->setMode(table, i, &x, &y); #ifdef AUTORES_DEBUG - getc(); + pause(); #endif table = table->next; @@ -622,4 +622,4 @@ relockVbios(map); return; -} +} Index: branches/valv/i386/libsaio/autoresolution.h =================================================================== --- branches/valv/i386/libsaio/autoresolution.h (revision 708) +++ branches/valv/i386/libsaio/autoresolution.h (revision 709) @@ -1,4 +1,3 @@ - /* Copied from 915 resolution created by steve tomljenovic * * This code is based on the techniques used in : @@ -13,6 +12,7 @@ * * This source code is into the public domain. */ + #ifndef __915_RESOLUTION_H #define __915_RESOLUTION_H @@ -38,13 +38,13 @@ #define VBIOS_START 0xc0000 #define VBIOS_SIZE 0x10000 -#define FALSE 0 -#define TRUE 1 +#define false 0 +#define true 1 bool gAutoResolution; +UInt32 params[4]; - typedef struct { uint8_t width; Index: branches/valv/i386/libsaio/nvidia.c =================================================================== --- branches/valv/i386/libsaio/nvidia.c (revision 708) +++ branches/valv/i386/libsaio/nvidia.c (revision 709) @@ -81,8 +81,8 @@ 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_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_dcfg_0[] = {0xff, 0xff, 0xff, 0xff}; @@ -391,11 +391,16 @@ { 0x10DE065C, "Quadro FX 770M" }, { 0x10DE065F, "GeForce G210" }, { 0x10DE06C0, "GeForce GTX 480" }, + { 0x10DE06C3, "GeForce GTX D12U" }, { 0x10DE06C4, "GeForce GTX 465" }, { 0x10DE06CA, "GeForce GTX 480M" }, { 0x10DE06CD, "GeForce GTX 470" }, { 0x10DE06D1, "Tesla C2050" }, // TODO: sub-device id: 0x0771 { 0x10DE06D1, "Tesla C2070" }, // TODO: sub-device id: 0x0772 + { 0x10DE06D8, "Quadro 6000" }, + { 0x10DE06D9, "Quadro 5000" }, + { 0x10DE06DA, "Quadro 5000M" }, + { 0x10DE06DC, "Quadro 6000" }, { 0x10DE06DD, "Quadro 4000" }, { 0x10DE06DE, "Tesla M2050" }, // TODO: sub-device id: 0x0846 { 0x10DE06DE, "Tesla M2070" }, // TODO: sub-device id: ? @@ -452,7 +457,7 @@ { 0x10DE0871, "GeForce 9200" }, { 0x10DE0872, "GeForce G102M" }, { 0x10DE0873, "GeForce G102M" }, - { 0x10DE0874, "ION" }, + { 0x10DE0874, "ION 9300M" }, { 0x10DE0876, "ION" }, { 0x10DE087A, "GeForce 9400" }, { 0x10DE087D, "ION 9400M" }, @@ -503,12 +508,45 @@ { 0x10DE0CB0, "GeForce GTS 350M" }, { 0x10DE0CB1, "GeForce GT 360M" }, { 0x10DE0CBC, "Quadro FX 1800M" }, + { 0x10DE0DC0, "GeForce GT 440" }, + { 0x10DE0DC1, "D12-P1-35" }, + { 0x10DE0DC2, "D12-P1-35" }, { 0x10DE0DC4, "GeForce GTS 450" }, + { 0x10DE0DC5, "GeForce GTS 450" }, + { 0x10DE0DC6, "GeForce GTS 450" }, + { 0x10DE0DCA, "GF10x" }, + { 0x10DE0DD1, "GeForce GTX 460M" }, + { 0x10DE0DD2, "GeForce GT 445M" }, + { 0x10DE0DD3, "GeForce GT 435M" }, + { 0x10DE0DD8, "Quadro 2000" }, + { 0x10DE0DDE, "GF106-ES" }, + { 0x10DE0DDF, "GF106-INT" }, { 0x10DE0DE1, "GeForce GT 430" }, + { 0x10DE0DE2, "GeForce GT 420" }, + { 0x10DE0DEB, "GeForce GT 555M" }, + { 0x10DE0DEE, "GeForce GT 415M" }, { 0x10DE0DF0, "GeForce GT 425M" }, + { 0x10DE0DF1, "GeForce GT 420M" }, + { 0x10DE0DF2, "GeForce GT 435M" }, + { 0x10DE0DF3, "GeForce GT 420M" }, + { 0x10DE0DF8, "Quadro 600" }, + { 0x10DE0DFE, "GF108 ES" }, + { 0x10DE0DFF, "GF108 INT" }, + { 0x10DE0E21, "D12U-25" }, { 0x10DE0E22, "GeForce GTX 460" }, + { 0x10DE0E23, "GeForce GTX 460 SE" }, { 0x10DE0E24, "GeForce GTX 460" }, + { 0x10DE0E25, "D12U-50" }, + { 0x10DE0E30, "GeForce GTX 470M" }, + { 0x10DE0E38, "GF104GL" }, + { 0x10DE0E3E, "GF104-ES" }, + { 0x10DE0E3F, "GF104-INT" }, { 0x10DE1080, "GeForce GTX 580" }, + { 0x10DE1081, "D13U" }, + { 0x10DE1082, "D13U" }, + { 0x10DE1083, "D13U" }, + { 0x10DE1098, "D13U" }, + { 0x10DE109A, "N12E-Q5" }, { 0x10DE10C3, "GeForce 8400 GS" } }; @@ -593,6 +631,7 @@ return PATCH_ROM_FAILED; } } else { + printf("ERROR: dcbtable_version is 0x%X\n", dcbtable_version); return PATCH_ROM_FAILED; } @@ -817,11 +856,11 @@ vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK; } else if (nvCardType >= NV_ARCH_C0) { - vram_size = REG32(NVC0_MEM_CTRLR_COUNT); + vram_size = REG32(NVC0_MEM_CTRLR_COUNT) << 20; vram_size *= REG32(NVC0_MEM_CTRLR_RAM_AMOUNT); - vram_size <<= 20; } - else { + else + { vram_size = REG32(NV04_PFB_FIFO_DATA); vram_size |= (vram_size & 0xff) << 32; vram_size &= 0xffffffff00ll; @@ -863,9 +902,7 @@ devicepath = get_pci_dev_path(nvda_dev); bar[0] = pci_config_read32(nvda_dev->dev.addr, 0x10 ); regs = (uint8_t *) (bar[0] & ~0x0f); - - delay(50); - + //delay(50); // get card type nvCardType = (REG32(0) >> 20) & 0x1ff; @@ -1007,19 +1044,21 @@ } } -//#if DEBUG_NVCAP +#if DEBUG_NVCAP printf("NVCAP: %02x%02x%02x%02x-%02x%02x%02x%02x-%02x%02x%02x%02x-%02x%02x%02x%02x-%02x%02x%02x%02x\n", default_NVCAP[0], default_NVCAP[1], default_NVCAP[2], default_NVCAP[3], default_NVCAP[4], default_NVCAP[5], default_NVCAP[6], default_NVCAP[7], default_NVCAP[8], default_NVCAP[9], default_NVCAP[10], default_NVCAP[11], default_NVCAP[12], default_NVCAP[13], default_NVCAP[14], default_NVCAP[15], default_NVCAP[16], default_NVCAP[17], default_NVCAP[18], default_NVCAP[19]); -//#endif +#endif - if (getValueForKey(kdcfg0, &value, &len, &bootInfo->bootConfig) && len == DCFG0_LEN * 2) { + if (getValueForKey(kdcfg0, &value, &len, &bootInfo->bootConfig) && len == DCFG0_LEN * 2) + { uint8_t new_dcfg0[DCFG0_LEN]; - - if (hex2bin(value, new_dcfg0, DCFG0_LEN) == 0) { + + if (hex2bin(value, new_dcfg0, DCFG0_LEN) == 0) + { verbose("Using user supplied @0,display-cfg\n"); memcpy(default_dcfg_0, new_dcfg0, DCFG0_LEN); } @@ -1030,10 +1069,12 @@ default_dcfg_0[0], default_dcfg_0[1], default_dcfg_0[2], default_dcfg_0[3], default_dcfg_0[4]); //#endif - if (getValueForKey(kdcfg1, &value, &len, &bootInfo->bootConfig) && len == DCFG1_LEN * 2) { + if (getValueForKey(kdcfg1, &value, &len, &bootInfo->bootConfig) && len == DCFG1_LEN * 2) + { uint8_t new_dcfg1[DCFG1_LEN]; - - if (hex2bin(value, new_dcfg1, DCFG1_LEN) == 0) { + + if (hex2bin(value, new_dcfg1, DCFG1_LEN) == 0) + { verbose("Using user supplied @1,display-cfg\n"); memcpy(default_dcfg_1, new_dcfg1, DCFG1_LEN); } @@ -1052,9 +1093,8 @@ devprop_add_value(device, "@0,display-cfg", default_dcfg_0, DCFG0_LEN); devprop_add_value(device, "@1,display-cfg", default_dcfg_1, DCFG1_LEN); devprop_add_value(device, "NVPM", default_NVPM, 28); - if (getBoolForKey(kVBIOS, &doit, &bootInfo->bootConfig) && doit) { + if (getBoolForKey(kVBIOS, &doit, &bootInfo->bootConfig) && doit) devprop_add_value(device, "vbios", rom, (nvBiosOveride > 0) ? nvBiosOveride : (rom[2] * 512)); - } stringdata = malloc(sizeof(uint8_t) * string->length); memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); Index: branches/valv/i386/libsaio/acpi.h =================================================================== --- branches/valv/i386/libsaio/acpi.h (revision 708) +++ branches/valv/i386/libsaio/acpi.h (revision 709) @@ -21,132 +21,132 @@ // TODO Migrate struct acpi_2_rsdp { - char Signature[8]; - uint8_t Checksum; - char OEMID[6]; - uint8_t Revision; - uint32_t RsdtAddress; - uint32_t Length; - uint64_t XsdtAddress; - uint8_t ExtendedChecksum; - char Reserved[3]; + char Signature[8]; + uint8_t Checksum; + char OEMID[6]; + uint8_t Revision; + uint32_t RsdtAddress; + uint32_t Length; + uint64_t XsdtAddress; + uint8_t ExtendedChecksum; + char Reserved[3]; } __attribute__((packed)); // TODO Migrate struct acpi_2_rsdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; + char Signature[4]; + uint32_t Length; + uint8_t Revision; + uint8_t Checksum; + char OEMID[6]; + char OEMTableId[8]; + uint32_t OEMRevision; + uint32_t CreatorId; + uint32_t CreatorRevision; } __attribute__((packed)); // TODO Migrate struct acpi_2_xsdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; + char Signature[4]; + uint32_t Length; + uint8_t Revision; + uint8_t Checksum; + char OEMID[6]; + char OEMTableId[8]; + uint32_t OEMRevision; + uint32_t CreatorId; + uint32_t CreatorRevision; } __attribute__((packed)); // TODO Migrate struct acpi_2_gas { - uint8_t Address_Space_ID; - uint8_t Register_Bit_Width; - uint8_t Register_Bit_Offset; - uint8_t Access_Size; - uint64_t Address; + uint8_t Address_Space_ID; + uint8_t Register_Bit_Width; + uint8_t Register_Bit_Offset; + uint8_t Access_Size; + uint64_t Address; } __attribute__((packed)); // TODO Migrate struct acpi_2_ssdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; + char Signature[4]; + uint32_t Length; + uint8_t Revision; + uint8_t Checksum; + char OEMID[6]; + char OEMTableId[8]; + uint32_t OEMRevision; + uint32_t CreatorId; + uint32_t CreatorRevision; } __attribute__((packed)); // TODO Migrate struct acpi_2_dsdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; + char Signature[4]; + uint32_t Length; + uint8_t Revision; + uint8_t Checksum; + char OEMID[6]; + char OEMTableId[8]; + uint32_t OEMRevision; + uint32_t CreatorId; + uint32_t CreatorRevision; } __attribute__((packed)); // TODO Migrate struct acpi_2_fadt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; - uint32_t FIRMWARE_CTRL; - uint32_t DSDT; - uint8_t INT_MODEL; // JrCs - uint8_t Preferred_PM_Profile; // JrCs - uint16_t SCI_INT; - uint32_t SMI_CMD; - uint8_t ACPI_ENABLE; - uint8_t ACPI_DISABLE; - uint8_t S4BIOS_REQ; - uint8_t PSTATE_CNT; - uint32_t PM1a_EVT_BLK; - uint32_t PM1b_EVT_BLK; - uint32_t PM1a_CNT_BLK; - uint32_t PM1b_CNT_BLK; - uint32_t PM2_CNT_BLK; - uint32_t PM_TMR_BLK; - uint32_t GPE0_BLK; - uint32_t GPE1_BLK; - uint8_t PM1_EVT_LEN; - uint8_t PM1_CNT_LEN; - uint8_t PM2_CNT_LEN; - uint8_t PM_TMR_LEN; - uint8_t GPE0_BLK_LEN; - uint8_t GPE1_BLK_LEN; - uint8_t GPE1_BASE; - uint8_t CST_CNT; - uint16_t P_LVL2_LAT; - uint16_t P_LVL3_LAT; - uint16_t FLUSH_SIZE; - uint16_t FLUSH_STRIDE; - uint8_t DUTY_OFFSET; - uint8_t DUTY_WIDTH; - uint8_t DAY_ALRM; - uint8_t MON_ALRM; - uint8_t CENTURY; - uint16_t IAPC_BOOT_ARCH; - uint8_t Reserved1; - uint32_t Flags; + char Signature[4]; + uint32_t Length; + uint8_t Revision; + uint8_t Checksum; + char OEMID[6]; + char OEMTableId[8]; + uint32_t OEMRevision; + uint32_t CreatorId; + uint32_t CreatorRevision; + uint32_t FIRMWARE_CTRL; + uint32_t DSDT; + uint8_t INT_MODEL; // JrCs + uint8_t Preferred_PM_Profile; // JrCs + uint16_t SCI_INT; + uint32_t SMI_CMD; + uint8_t ACPI_ENABLE; + uint8_t ACPI_DISABLE; + uint8_t S4BIOS_REQ; + uint8_t PSTATE_CNT; + uint32_t PM1a_EVT_BLK; + uint32_t PM1b_EVT_BLK; + uint32_t PM1a_CNT_BLK; + uint32_t PM1b_CNT_BLK; + uint32_t PM2_CNT_BLK; + uint32_t PM_TMR_BLK; + uint32_t GPE0_BLK; + uint32_t GPE1_BLK; + uint8_t PM1_EVT_LEN; + uint8_t PM1_CNT_LEN; + uint8_t PM2_CNT_LEN; + uint8_t PM_TMR_LEN; + uint8_t GPE0_BLK_LEN; + uint8_t GPE1_BLK_LEN; + uint8_t GPE1_BASE; + uint8_t CST_CNT; + uint16_t P_LVL2_LAT; + uint16_t P_LVL3_LAT; + uint16_t FLUSH_SIZE; + uint16_t FLUSH_STRIDE; + uint8_t DUTY_OFFSET; + uint8_t DUTY_WIDTH; + uint8_t DAY_ALRM; + uint8_t MON_ALRM; + uint8_t CENTURY; + uint16_t IAPC_BOOT_ARCH; + uint8_t Reserved1; + uint32_t Flags; struct acpi_2_gas RESET_REG; - uint8_t RESET_VALUE; - uint8_t Reserved2[3]; - uint64_t X_FIRMWARE_CTRL; - uint64_t X_DSDT; + uint8_t RESET_VALUE; + uint8_t Reserved2[3]; + uint64_t X_FIRMWARE_CTRL; + uint64_t X_DSDT; struct acpi_2_gas X_PM1a_EVT_BLK; struct acpi_2_gas X_PM1b_EVT_BLK; struct acpi_2_gas X_PM1a_CNT_BLK; Index: branches/valv/i386/libsaio/cpu.c =================================================================== --- branches/valv/i386/libsaio/cpu.c (revision 708) +++ branches/valv/i386/libsaio/cpu.c (revision 709) @@ -137,7 +137,13 @@ 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.NoThreads = bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16); - p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1; + if(p->CPU.Vendor == 0x68747541) + { + do_cpuid(0x80000008, p->CPU.CPUID[8]); + p->CPU.NoCores = bitfield(p->CPU.CPUID[8][2], 7, 0) + 1; + } + else + p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1; p->CPU.Model += (p->CPU.ExtModel << 4); @@ -211,19 +217,44 @@ { if (p->CPU.Family == 0x06) { + // valv: to be moved! + /*if(p->CPU.CPUID[CPUID_0][0] >= 11) + { + if((p->CPU.CPUID[0xB][1] != 0) && (bitfield(p->CPU.CPUID[CPUID_1][3], 28, 28))) + }*/ + + /*int CoreOk = 0; + int ThreadOk = 0; + int lvlType, lvlShift; + do + { + if(p->CPU.CPUID[0xB][1] == 0) break; + lvlType = bitfield(p->CPU.CPUID[0xB][2], 15, 8); + lvlShift = bitfield(p->CPU.CPUID[0xB][0], 4, 0); + switch(lvlType) + }*/ int intelCPU = p->CPU.Model; int Stepp = p->CPU.Stepping; int bus; switch (intelCPU) { + // valv: hoardcoded to BrandString for now, till the code above is ready! + case 0x2a: // Sandy Bridge, 32nm + if((strstr(p->CPU.BrandString, "i3")) + || (strstr(p->CPU.BrandString, "i5-2390T")) + || (strstr(p->CPU.BrandString, "i5-2100S"))) + p->CPU.NoCores = 2; + else p->CPU.NoCores = 4; + if(strstr(p->CPU.BrandString, "i7")) + p->CPU.NoThreads = 8; + else p->CPU.NoThreads = 4; case 0xc: // Core i7 & Atom if (strstr(p->CPU.BrandString, "Atom")) goto teleport1; case 0x1a: // Core i7 LGA1366, Xeon 5500, "Bloomfield", "Gainstown", 45nm case 0x1e: // Core i7, i5 LGA1156, "Clarksfield", "Lynnfield", "Jasper", 45nm case 0x1f: // Core i7, i5, Nehalem case 0x25: // Core i7, i5, i3 LGA1156, "Westmere", "Clarkdale", "Arrandale", 32nm - case 0x2a: // Sandy Bridge, 32nm case 0x2c: // Core i7 LGA1366, Six-core, "Westmere", "Gulftown", 32nm case 0x2e: // Core i7, Nehalem-Ex Xeon, "Beckton" case 0x2f: // Core i7, Nehalem-Ex Xeon, "Eagleton" @@ -392,9 +423,7 @@ { msr32.hi |= (1 << (36 - 32)); // EMTTM wrmsr(MSR_IA32_MISC_ENABLE, msr32); - } - if(tmfix) - { + msr32 = rdmsr(PIC_SENS_CFG); msr32.lo |= (1 << 21); wrmsr(PIC_SENS_CFG, msr32); Index: branches/valv/i386/libsaio/disk.c =================================================================== --- branches/valv/i386/libsaio/disk.c (revision 708) +++ branches/valv/i386/libsaio/disk.c (revision 709) @@ -1703,21 +1703,21 @@ static const struct NamedValue fdiskTypes[] = { - { FDISK_NTFS, "Windows NTFS" }, + { FDISK_NTFS, "Windows NTFS" }, { FDISK_DOS12, "Windows FAT12" }, { FDISK_DOS16B, "Windows FAT16" }, { FDISK_DOS16S, "Windows FAT16" }, { FDISK_DOS16SLBA, "Windows FAT16" }, { FDISK_SMALLFAT32, "Windows FAT32" }, { FDISK_FAT32, "Windows FAT32" }, - { FDISK_FREEBSD, "FreeBSD" }, - { FDISK_OPENBSD, "OpenBSD" }, - { FDISK_LINUX, "Linux" }, - { FDISK_UFS, "Apple UFS" }, - { FDISK_HFS, "Apple HFS" }, - { FDISK_BOOTER, "Apple Boot/UFS" }, - { 0xCD, "CD-ROM" }, - { 0x00, 0 } /* must be last */ + { FDISK_FREEBSD, "FreeBSD" }, + { FDISK_OPENBSD, "OpenBSD" }, + { FDISK_LINUX, "Linux" }, + { FDISK_UFS, "Apple UFS" }, + { FDISK_HFS, "Apple HFS" }, + { FDISK_BOOTER, "Apple Boot/UFS" }, + { 0xCD, "CD-ROM" }, + { 0x00, 0 } /* must be last */ }; //========================================================================== Index: branches/valv/i386/libsaio/nvidia_resolution.c =================================================================== --- branches/valv/i386/libsaio/nvidia_resolution.c (revision 708) +++ branches/valv/i386/libsaio/nvidia_resolution.c (revision 709) @@ -121,7 +121,7 @@ saveTables(map->modeTables); #ifdef AUTORES_DEBUG - getc(); + pause(); #endif return map; @@ -214,5 +214,5 @@ idx++; } } - return TRUE; + return true; } Index: branches/valv/i386/libsaio/hpet.c =================================================================== --- branches/valv/i386/libsaio/hpet.c (revision 708) +++ branches/valv/i386/libsaio/hpet.c (revision 709) @@ -174,7 +174,6 @@ printf(" Failed to force enable HPET\n"); } break; - } } } Index: branches/valv/i386/libsaio/edid.c =================================================================== --- branches/valv/i386/libsaio/edid.c (revision 708) +++ branches/valv/i386/libsaio/edid.c (revision 709) @@ -13,7 +13,7 @@ #include "vbe.h" #include "bootstruct.h" #include "graphics.h" -#include "boot.h" +//#include "boot.h" //static biosBuf_t bb; @@ -34,7 +34,7 @@ free( edidInfo ); } else { - // TODO: check *all* resolutions reported and eithe ruse the highest, or the native resolution (if there is a flag for that) + // TODO: check all reported resolutions and either use highest or native (if there is a flag for that) xResolution = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4); yResolution = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4); @@ -55,7 +55,6 @@ } } - unsigned char* readEDID() { SInt16 last_reported = -1; @@ -71,7 +70,7 @@ do { - // TODO: This currently only retrieves the *last* block, make the block buffer expand as needed / calculated from the first block + // TODO: This currently retrieves the last block only. Expand the block buffer as needed / calculated from first block bzero( edidInfo, EDID_BLOCK_SIZE); Index: branches/valv/i386/libsaio/gma_resolution.c =================================================================== --- branches/valv/i386/libsaio/gma_resolution.c (revision 708) +++ branches/valv/i386/libsaio/gma_resolution.c (revision 709) @@ -86,7 +86,7 @@ return 0; } - PRINT("Mode Table at offset : 0x%x\n", (table->pointer) - map->biosPtr); + PRINT("Mode Table at offset: 0x%x\n", (table->pointer) - map->biosPtr); /* * Determine size of mode table @@ -101,30 +101,30 @@ } table->modeCount = table->size; - PRINT("Mode Table size : %d\n", table->modeCount); + PRINT("Mode Table size: %d\n", table->modeCount); /* * Figure out what type of bios we have * order of detection is important */ - if (detectBiosType(map, TRUE, sizeof(vbiosModelineType3))) + if (detectBiosType(map, true, sizeof(vbiosModelineType3))) { map->bios = BT_3; map->setMode = intelSetMode_3; - PRINT("Bios Type : BT_3\n"); + PRINT("Bios Type: BT_3\n"); } - else if (detectBiosType(map, TRUE, sizeof(vbiosModelineType2))) + else if (detectBiosType(map, true, sizeof(vbiosModelineType2))) { map->bios = BT_2; map->setMode = intelSetMode_2; - PRINT("Bios Type : BT_2\n"); + PRINT("Bios Type: BT_2\n"); } - else if (detectBiosType(map, FALSE, sizeof(vbiosResolutionType1))) + else if (detectBiosType(map, false, sizeof(vbiosResolutionType1))) { map->bios = BT_1; map->setMode = intelSetMode_1; - PRINT("Bios Type : BT_1\n"); + PRINT("Bios Type: BT_1\n"); } else { @@ -277,4 +277,4 @@ *y = res->modelines[0].vActive1 + 1; return true; -} \ No newline at end of file +} Index: branches/valv/i386/boot2/graphics.c =================================================================== --- branches/valv/i386/boot2/graphics.c (revision 708) +++ branches/valv/i386/boot2/graphics.c (revision 709) @@ -429,47 +429,43 @@ // Set the mode with default refresh rate. #ifdef AUTORES_DEBUG printf("Is about to set mode #%d with resolution %dx%d\n", mode, minfo.XResolution, minfo.YResolution); + sleep(2); #endif - err = setVBEMode( mode | kLinearFrameBufferBit, NULL ); + err = setVBEMode( mode | kLinearFrameBufferBit, NULL ); - if ( err != errSuccess ) - { - break; + if ( err != errSuccess ) + { #ifdef AUTORES_DEBUG - printf("setVBEMode failed to set mode %d (%dx%d) with error #%d\n", - mode, minfo.XResolution, minfo.YResolution, err); - getc(); + printf("setVBEMode failed to set mode %d (%dx%d) with error #%d\n", + mode, minfo.XResolution, minfo.YResolution, err); + sleep(2); #endif - } + break; + } - // Set 8-bit color palette. + // Set 8-bit color palette. - if ( minfo.BitsPerPixel == 8 ) - { - VBEPalette palette; - setupPalette( &palette, appleClut8 ); - if ((err = setVBEPalette(palette)) != errSuccess) - { - break; - } - } + if ( minfo.BitsPerPixel == 8 ) + { + VBEPalette palette; + setupPalette( &palette, appleClut8 ); + if((err = setVBEPalette(palette)) != errSuccess) + break; + } - // Is this required for buggy Video BIOS implementations? - // On which adapter? + // Is this required for buggy Video BIOS implementations? On which adapter? + if ( minfo.BytesPerScanline == 0 ) + minfo.BytesPerScanline = ( minfo.XResolution * minfo.BitsPerPixel ) >> 3; - if ( minfo.BytesPerScanline == 0 ) - minfo.BytesPerScanline = ( minfo.XResolution * - minfo.BitsPerPixel ) >> 3; + // Update KernBootStruct using info provided by the selected + // VESA mode. - // Update KernBootStruct using info provided by the selected - // VESA mode. - - bootArgs->Video.v_display = GRAPHICS_MODE; - bootArgs->Video.v_width = minfo.XResolution; - bootArgs->Video.v_height = minfo.YResolution; - bootArgs->Video.v_depth = minfo.BitsPerPixel; - bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; - bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); + bootArgs->Video.v_display = GRAPHICS_MODE; + bootArgs->Video.v_width = minfo.XResolution; + bootArgs->Video.v_height = minfo.YResolution; + bootArgs->Video.v_depth = minfo.BitsPerPixel; + bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; + bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); #if AUTORES_DEBUG gui.screen.mm = minfo.MemoryModel; gui.screen.attr = minfo.ModeAttributes; @@ -1042,8 +1038,7 @@ //========================================================================== // getNumberArrayFromProperty -int -getNumberArrayFromProperty( const char * propKey, +int getNumberArrayFromProperty( const char * propKey, unsigned long numbers[], unsigned long maxArrayCount ) { Index: branches/valv/i386/boot2/boot.c =================================================================== --- branches/valv/i386/boot2/boot.c (revision 708) +++ branches/valv/i386/boot2/boot.c (revision 709) @@ -80,7 +80,7 @@ BVRef menuBVR; BVRef bvChain; bool useGUI; -bool autoResolution; +//bool autoResolution; //static void selectBiosDevice(void); static unsigned long Adler32(unsigned char *buffer, long length); @@ -186,7 +186,18 @@ } usb_loop(); + + //Azi:autoresolution - while testing, i didn't got any problems when booting without + // closing Vbios... closing it just in case. (check again later!) + if ((gAutoResolution == true) && map) + { + closeVbios(map); + // gAutoResolution was just set to false on closeVbios(); + // we need it to be "true" for drawBootGraphics(). + gAutoResolution = true; + } + // If we were in text mode, switch to graphics mode. // This will draw the boot graphics unless we are in // verbose mode. @@ -327,26 +338,26 @@ getc(); #endif - useGUI = TRUE; + useGUI = true; // Override useGUI default getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig); // Before initGui, patch the video bios with the correct resolution - UInt32 params[4]; - params[3] = 0; - gAutoResolution = TRUE; + gAutoResolution = false; // Override AutoResolution default getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig); - //Open the VBios and store VBios or Tables - map = openVbios(CT_UNKWN); + - if (gAutoResolution == TRUE) + if (gAutoResolution == true) { - //Get Resolution from Graphics Mode key or EDID + params[3] = 0; + //Open the VBios and store VBios or Tables + map = openVbios(CT_UNKWN); + //Get resolution from Graphics Mode key or EDID int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4); if (count < 3) getResolution(params); @@ -360,15 +371,19 @@ #ifdef AUTORES_DEBUG printf("Resolution: %dx%d\n",params[0], params[1]); #endif - //perfom the actual VBIOS patching + //perfom the actual VBIOS patching if (params[0] != 0 && params[1] != 0) patchVbios(map, params[0], params[1], params[2], 0, 0); + + if (bootArgs->Video.v_display == VGA_TEXT_MODE) + { + gui.screen.width = params[0]; + gui.screen.height = params[1]; + } } - - if (useGUI) { - /* XXX AsereBLN handle error */ - initGUI(); - } + + if (useGUI && initGUI()) + useGUI = false; setBootGlobals(bvChain); @@ -434,17 +449,17 @@ /* * AutoResolution - Reapply the patch or cancel if Graphics Mode was incorrect * or EDID Info was insane - */ - getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig); - - //Restore the vbios for Cancelation - if ((gAutoResolution == FALSE) && map) + */ + getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig); + + // Restore and close the vbios for cancelation + if ((gAutoResolution == false) && map) { restoreVbios(map); - closeVbios(map); + closeVbios(map); } - - if ((gAutoResolution == TRUE) && map) + + if ((gAutoResolution == true) && map) { // If mode has been switched during boot menu // use the new resolution @@ -476,26 +491,14 @@ closeVbios(map); } - + // Find out which mac os version we're booting. getOSVersion(gMacOSVersion); - if (platformCPUFeature(CPU_FEATURE_EM64T)) { - archCpuType = CPU_TYPE_X86_64; - } else { + if(((getValueForKey(karch, &val, &len, &bootInfo->bootConfig)) && (strncmp(val, "i386", 4) == 0)) + || (!platformCPUFeature(CPU_FEATURE_EM64T))) archCpuType = CPU_TYPE_I386; - } - if (getValueForKey(karch, &val, &len, &bootInfo->bootConfig)) { - if (strncmp(val, "i386", 4) == 0) { - archCpuType = CPU_TYPE_I386; - } - } - if (getValueForKey(k32BitModeFlag, &val, &len, &bootInfo->bootConfig)) { - archCpuType = CPU_TYPE_I386; - } - if (getValueForKey(k64BitModeFlag, &val, &len, &bootInfo->bootConfig)) { - archCpuType = CPU_TYPE_X86_64; - } + else archCpuType = CPU_TYPE_X86_64; if (!getBoolForKey (kWake, &tryresume, &bootInfo->bootConfig)) { tryresume = true; Index: branches/valv/i386/boot2/boot.h =================================================================== --- branches/valv/i386/boot2/boot.h (revision 708) +++ branches/valv/i386/boot2/boot.h (revision 709) @@ -31,7 +31,7 @@ #include "libsaio.h" #include "autoresolution.h" - + #if DEBUG #ifndef AUTORES_DEBUG #define AUTORES_DEBUG @@ -142,24 +142,25 @@ #define kEnableC4State "EnableC4State" /* acpi_patcher.c */ /* valv: added these keys */ -#define kFixFSB "FixFSB" /* cpu.c */ -#define kbusratio "busratio" /* cpu.c */ -#define kForceFSB "ForceFSB" /* cpu.c */ -#define kC2EEnable "C2E" /* cpu.c */ -#define kC4EEnable "C4E" /* cpu.c */ +#define kFixFSB "FixFSB" /* cpu.c */ +#define kbusratio "busratio" /* cpu.c */ +#define kForceFSB "ForceFSB" /* cpu.c */ +#define kC2EEnable "C2E" /* cpu.c */ +#define kC4EEnable "C4E" /* cpu.c */ #define kHardC4EEnable "HC4E" /* cpu.c */ -#define kFixTM "FixTM" /* cpu.c */ -#define kdcfg0 "display_0" /* nvidia.c */ -#define kdcfg1 "display_1" /* nvidia.c */ -#define kpstates "PStates" /* acpi_patcher.c */ -#define kEnableC6State "EnableC6State" /* acpi_patcher.c */ -#define kmaxVoltage "maxVolt" /* acpi_patcher.c */ -#define kminVoltage "minVolt" /* acpi_patcher.c */ +#define kFixTM "FixTM" /* cpu.c */ +#define kdcfg0 "display_0" /* nvidia.c */ +#define kdcfg1 "display_1" /* nvidia.c */ +#define kpstates "PStates" /* acpi_patcher.c */ +#define kEnableC6State "EnableC6State" /* acpi_patcher.c */ +#define kmaxVoltage "maxVolt" /* acpi_patcher.c */ +#define kminVoltage "minVolt" /* acpi_patcher.c */ #define kmoreVoltage "moreVolt" /* acpi_patcher.c */ #define klessVoltage "lessVolt" /* acpi_patcher.c */ -#define kTjmax "Tjmax" /* acpi_patcher.c */ -#define kpstart "PStart" /* acpi_patcher.c */ -#define kGenerateTStates "GenerateTStates" /* apci_patcher.c */ +#define kTjmax "Tjmax" /* acpi_patcher.c */ +#define kpstart "PStart" /* acpi_patcher.c */ +#define kGenerateTStates "GenerateTStates" /* apci_patcher.c */ +#define kPatchKrn "PatchKernel" /* drivers.c */ /* * Flags to the booter or kernel @@ -169,8 +170,6 @@ #define kIgnoreCachesFlag "-f" #define kIgnoreBootFileFlag "-F" #define kSingleUserModeFlag "-s" -#define k32BitModeFlag "-x32" -#define k64BitModeFlag "-x64" /* * Booter behavior control Index: branches/valv/i386/boot2/drivers.c =================================================================== --- branches/valv/i386/boot2/drivers.c (revision 708) +++ branches/valv/i386/boot2/drivers.c (revision 709) @@ -816,7 +816,9 @@ ret = ThinFatFile(&binary, &len); } - patch_kernel(binary); + bool patchkrn = false; + getBoolForKey(kPatchKrn, &patchkrn, &bootInfo->bootConfig); + if(patchkrn) patch_kernel(binary); ret = DecodeMachO(binary, rentry, raddr, rsize); Index: branches/valv/i386/boot2/gui.c =================================================================== --- branches/valv/i386/boot2/gui.c (revision 708) +++ branches/valv/i386/boot2/gui.c (revision 709) @@ -718,26 +718,27 @@ /* * AutoResolution */ - if (gAutoResolution == TRUE) //Get Resolution from Graphics Mode key + if (gAutoResolution == true) { + //Get Resolution from Graphics Mode key count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4); + //If no Graphics Mode key, get it from EDID if ( count < 3 ) { - //If no Graphics Mode key, get it from EDID getResolution(screen_params); PRINT("Resolution : %dx%d (EDID)\n",screen_params[0], screen_params[1]); - } else - PRINT("Resolution : %dx%d (Graphics Mode key)\n",screen_params[0], screen_params[1]); - } + } + else PRINT("Resolution : %dx%d (Graphics Mode key)\n",screen_params[0], screen_params[1]); + } else { // parse screen size parameters - if(getIntForKey("screen_width", &val, &bootInfo->themeConfig)) + if(getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0) screen_params[0] = val; else screen_params[0] = DEFAULT_SCREEN_WIDTH; - if(getIntForKey("screen_height", &val, &bootInfo->themeConfig)) + if(getIntForKey("screen_height", &val, &bootInfo->themeConfig) && val > 0) screen_params[1] = val; else screen_params[1] = DEFAULT_SCREEN_HEIGHT; @@ -896,42 +897,40 @@ { BVRef param = menuItems[start + i].param; - bool isSelected = ((start + i) == selection) ? true : false; + bool isSelected = ((start + i) == selection) ? true : false; if (isSelected) { - if (param->flags & kBVFlagNativeBoot) - { - infoMenuNativeBoot = true; - } - else - { - infoMenuNativeBoot = false; - if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END) - infoMenuSelection = 0; - } - + if (param->flags & kBVFlagNativeBoot) + infoMenuNativeBoot = true; + else + { + infoMenuNativeBoot = false; + if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END) + infoMenuSelection = 0; + } + if(gui.menu.draw) drawInfoMenuItems(); #ifdef AUTORES_DEBUG #define DEBUG #endif #ifdef DEBUG - gui.debug.cursor = pos( 10, 100); - dprintf( &gui.screen, "label %s\n", param->label ); - dprintf( &gui.screen, "biosdev 0x%x\n", param->biosdev ); - dprintf( &gui.screen, "type 0x%x\n", param->type ); - dprintf( &gui.screen, "flags 0x%x\n", param->flags ); - dprintf( &gui.screen, "part_no %d\n", param->part_no ); - dprintf( &gui.screen, "part_boff 0x%x\n", param->part_boff ); - dprintf( &gui.screen, "part_type 0x%x\n", param->part_type ); - dprintf( &gui.screen, "bps 0x%x\n", param->bps ); - dprintf( &gui.screen, "name %s\n", param->name ); - dprintf( &gui.screen, "type_name %s\n", param->type_name ); - dprintf( &gui.screen, "modtime %d\n", param->modTime ); - dprintf( &gui.screen, "width %d\n", gui.screen.width); - dprintf( &gui.screen, "height %d\n", gui.screen.height); - dprintf( &gui.screen, "attr: 0x%x\n", gui.screen.attr); - dprintf( &gui.screen, "mm: %d\n", gui.screen.mm); + gui.debug.cursor = pos( 10, 100); + dprintf( &gui.screen, "label %s\n", param->label ); + dprintf( &gui.screen, "biosdev 0x%x\n", param->biosdev ); + dprintf( &gui.screen, "type 0x%x\n", param->type ); + dprintf( &gui.screen, "flags 0x%x\n", param->flags ); + dprintf( &gui.screen, "part_no %d\n", param->part_no ); + dprintf( &gui.screen, "part_boff 0x%x\n", param->part_boff ); + dprintf( &gui.screen, "part_type 0x%x\n", param->part_type ); + dprintf( &gui.screen, "bps 0x%x\n", param->bps ); + dprintf( &gui.screen, "name %s\n", param->name ); + dprintf( &gui.screen, "type_name %s\n", param->type_name ); + dprintf( &gui.screen, "modtime %d\n", param->modTime ); + dprintf( &gui.screen, "width %d\n", gui.screen.width); + dprintf( &gui.screen, "height %d\n", gui.screen.height); + dprintf( &gui.screen, "attr: 0x%x\n", gui.screen.attr); + dprintf( &gui.screen, "mm: %d\n", gui.screen.mm); #endif #ifdef AUTORES_DEBUG @@ -962,24 +961,21 @@ gui.redraw = true; updateVRAM(); - } - + void clearGraphicBootPrompt() { // clear text buffer prompt[0] = '\0'; prompt_pos=0; - - if( gui.bootprompt.draw == true ) + if(gui.bootprompt.draw == true) { gui.bootprompt.draw = false; gui.redraw = true; // this causes extra frames to be drawn //updateVRAM(); } - return; } @@ -1889,29 +1885,30 @@ /* * AutoResolution */ - if (gAutoResolution == TRUE) + if (gAutoResolution == true) { //Get Resolution from Graphics Mode key count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4); + + //If no Graphics Mode key, get resolution from EDID if ( count < 3 ) - //If no Graphics Mode key, get resolution from EDID getResolution(screen_params); } else { // parse screen size parameters - if(getIntForKey("boot_width", &pos, &bootInfo->themeConfig)) + if(getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0) screen_params[0] = pos; else screen_params[0] = DEFAULT_SCREEN_WIDTH; - if(getIntForKey("boot_height", &pos, &bootInfo->themeConfig)) + if(getIntForKey("boot_height", &pos, &bootInfo->themeConfig) && pos > 0) screen_params[1] = pos; else screen_params[1] = DEFAULT_SCREEN_HEIGHT; } - // Save current screen resolution. + // Save current screen resolution. oldScreenWidth = gui.screen.width; oldScreenHeight = gui.screen.height; Index: branches/valv/i386/boot2/kernel_patcher.c =================================================================== --- branches/valv/i386/boot2/kernel_patcher.c (revision 708) +++ branches/valv/i386/boot2/kernel_patcher.c (revision 709) @@ -90,20 +90,24 @@ switch(Platform.CPU.Model) { // Known good CPU's, no reason to patch kernel - case 13: - case CPUID_MODEL_YONAH: - case CPUID_MODEL_MEROM: - case CPUID_MODEL_PENRYN: - case CPUID_MODEL_NEHALEM: - case CPUID_MODEL_FIELDS: - case CPUID_MODEL_DALES: - case CPUID_MODEL_NEHALEM_EX: + case 0x0C: + if (strstr(Platform.CPU.BrandString, "Atom")) goto atom; + case 0x0D: + case 0x0E: + case 0x0F: + case 0x17: + case 0x1A: + case 0x1E: + case 0x1F: + case 0x2E: break; // Known unsuported CPU's - case CPUID_MODEL_ATOM: + case 0x1C: + case 0x27: + atom: // TODO: Impersonate CPU based on user selection - patch_cpuid_set_info(kernelData, CPUFAMILY_INTEL_PENRYN, CPUID_MODEL_PENRYN); // Impersonate Penryn CPU + patch_cpuid_set_info(kernelData, CPUFAMILY_INTEL_PENRYN, 0x17); // Impersonate Penryn CPU break; // Unknown CPU's Index: branches/valv/i386/boot2/gui.h =================================================================== --- branches/valv/i386/boot2/gui.h (revision 708) +++ branches/valv/i386/boot2/gui.h (revision 709) @@ -98,14 +98,14 @@ uint32_t font_console_color; // Color for consle font AARRGGBB bool draw; // Draw flag //resolution specifics - uint16_t htotal; - uint16_t vtotal; - uint16_t hsyncstart; - uint16_t hsyncend; - uint16_t vsyncstart; - uint16_t vsyncend; - uint8_t mm; - uint16_t attr; + uint16_t htotal; + uint16_t vtotal; + uint16_t hsyncstart; + uint16_t hsyncend; + uint16_t vsyncstart; + uint16_t vsyncend; + uint8_t mm; + uint16_t attr; } window_t; /* Index: branches/valv/i386/boot2/kernel_patcher.h =================================================================== --- branches/valv/i386/boot2/kernel_patcher.h (revision 708) +++ branches/valv/i386/boot2/kernel_patcher.h (revision 709) @@ -9,17 +9,6 @@ #ifndef __BOOT2_KERNEL_PATCHER_H #define __BOOT2_KERNEL_PATCHER_H - -#define CPUID_MODEL_YONAH 14 -#define CPUID_MODEL_MEROM 15 -#define CPUID_MODEL_PENRYN 23 -#define CPUID_MODEL_NEHALEM 26 -#define CPUID_MODEL_ATOM 28 -#define CPUID_MODEL_FIELDS 30 /* Lynnfield, Clarksfield, Jasper */ -#define CPUID_MODEL_DALES 31 /* Havendale, Auburndale */ -#define CPUID_MODEL_NEHALEM_EX 46 - - void patch_kernel(void* kernelData); #define KERNEL_64 1 Index: branches/valv/i386/boot2/options.c =================================================================== --- branches/valv/i386/boot2/options.c (revision 708) +++ branches/valv/i386/boot2/options.c (revision 709) @@ -736,8 +736,9 @@ // 18seven's Quick-args macro bool f8 = false, altf = false, shiftf = false, alts = false, - altv = false, x32 = false, x64 = false, altx = false; - while (readKeyboardStatus()) { + altv = false, altx = false; // x32 = false, x64 = false; + while (readKeyboardStatus()) + { key = bgetc (); if (key == 0x4200) f8 = true; if (key == 0x2100) altf = true; @@ -745,9 +746,9 @@ if (key == 0x1F00) alts = true; if (key == 0x2F00) altv = true; if (key == 0x2D00) altx = true; - if (key == 0x0004) x32 = true; +/* if (key == 0x0004) x32 = true; if (key == 0x0007) x64 = true; - } +*/ } // If user typed F8, abort quiet mode, and display the menu. if (f8) { @@ -776,7 +777,7 @@ if ((gBootMode & kBootModeQuiet) && firstRun && altx) { addBootArg(kSafeModeFlag); } - +/* if ((gBootMode & kBootModeQuiet) && firstRun && x32) { addBootArg(k32BitModeFlag); } @@ -784,7 +785,7 @@ if ((gBootMode & kBootModeQuiet) && firstRun && x64) { addBootArg(k64BitModeFlag); } - +*/ if (bootArgs->Video.v_display == VGA_TEXT_MODE) { setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow); @@ -1009,91 +1010,91 @@ case kEscapeKey: clearBootArgs(); break; - + case kF2Key: - - /* - * AutoResolution - Reapply the patch if Graphics Mode was incorrect - * or EDID Info was insane - */ + + /* + * AutoResolution - Reapply the patch if Graphics Mode was incorrect or EDID Info was insane + */ + + if ((gAutoResolution == TRUE) && map) + { + // get the new Graphics Mode key + processBootOptions(); - //get the new Graphics Mode key - processBootOptions(); - if ((gAutoResolution == TRUE) && map) + UInt32 params[4]; + params[3] = 0; + //Has the target Resolution Changed ? + int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4); + if ( count < 3 ) + getResolution(params); + + if ((params[0] != 0) && (params[1] != 0) + && (params[0] != map->currentX) && (params[1] != map->currentY)) { - UInt32 params[4]; - params[3] = 0; - //Has the target Resolution Changed ? - int count = getNumberArrayFromProperty(kGraphicsModeKey, params, 4); - if ( count < 3 ) - getResolution(params); - - if ( (params[0] != 0) && (params[1] != 0) - && (params[0] != map->currentX) && (params[1] != map->currentY)) + + //Go back to TEXT mode while we change the mode + if (bootArgs->Video.v_display == GRAPHICS_MODE) { + CursorState cursorState; - //Go back to TEXT mode while we change the mode - if (bootArgs->Video.v_display == GRAPHICS_MODE) + setVideoMode(VGA_TEXT_MODE, 0); + + setCursorPosition(0, 0, 0); + clearScreenRows(0, kScreenLastRow); + changeCursor( 0, 0, kCursorTypeHidden, &cursorState ); + + //Reapply patch in case resolution have changed + + patchVbios(map, params[0], params[1], params[2], 0, 0); + + if (useGUI && (gui.initialised == true)) + initGUI(); + // Make sure all values are set + if (bootArgs->Video.v_display != GRAPHICS_MODE) + bootArgs->Video.v_display = GRAPHICS_MODE; + + if (!useGUI) + useGUI = true; + + // redraw the background buffer + drawBackground(); + gui.devicelist.draw = true; + gui.redraw = true; + if (!(gBootMode & kBootModeQuiet)) { - CursorState cursorState; + bool showBootBanner = true; - setVideoMode(VGA_TEXT_MODE, 0); - - setCursorPosition(0, 0, 0); - clearScreenRows(0, kScreenLastRow); - changeCursor( 0, 0, kCursorTypeHidden, &cursorState ); - - //Reapply patch in case resolution have changed - - patchVbios(map, params[0], params[1], params[2], 0, 0); - - if (useGUI && (gui.initialised == true)) - initGUI(); - // Make sure all values are set - if (bootArgs->Video.v_display != GRAPHICS_MODE) - bootArgs->Video.v_display = GRAPHICS_MODE; - - if (!useGUI) - useGUI = true; - - // redraw the background buffer - drawBackground(); - gui.devicelist.draw = true; - gui.redraw = true; - if (!(gBootMode & kBootModeQuiet)) - { - bool showBootBanner = true; + // Check config file. + getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig); + if (showBootBanner) + // Display banner and show hardware info. + gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024); - // Check if "Boot Banner"=N switch is present in config file. - getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig); - if (showBootBanner) - // Display banner and show hardware info. - gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024); - - // redraw background - memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4); - } - - nextRow = kMenuTopRow; - showPrompt = true; - - if (gDeviceCount) - { - showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); - nextRow += min( gDeviceCount, kMenuMaxItems ) + 3; - } - - // Show the boot prompt. - showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); - showBootPrompt( nextRow, showPrompt ); - - //this is used to avoid resetting the incorrect mode while quiting the boot menu - map->hasSwitched = true; + // redraw background + memcpy(gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4); } + + nextRow = kMenuTopRow; + showPrompt = true; + + if (gDeviceCount) + { + showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); + nextRow += min( gDeviceCount, kMenuMaxItems ) + 3; + } + + // Show the boot prompt. + showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); + showBootPrompt( nextRow, showPrompt ); + + //this is used to avoid resetting the incorrect mode while quiting the boot menu + map->hasSwitched = true; } - clearBootArgs(); - key = 0; } + clearBootArgs(); + key = 0; + } break; case kF5Key: @@ -1118,31 +1119,33 @@ // New behavior: // Switch between text & graphic interfaces // Only Permitted if started in graphics interface - if (useGUI) { - setVideoMode(VGA_TEXT_MODE, 0); + if (useGUI) + { + setVideoMode(VGA_TEXT_MODE, 0); - setCursorPosition(0, 0, 0); - clearScreenRows(0, kScreenLastRow); + setCursorPosition(0, 0, 0); + clearScreenRows(0, kScreenLastRow); - // Display banner and show hardware info. - printf(bootBanner, (bootInfo->convmem + bootInfo->extmem) / 1024); - printf(getVBEInfoString()); + // Display banner and show hardware info. + printf(bootBanner, (bootInfo->convmem + bootInfo->extmem) / 1024); + printf(getVBEInfoString()); - clearScreenRows(kMenuTopRow, kMenuTopRow + 2); - changeCursor(0, kMenuTopRow, kCursorTypeHidden, 0); + clearScreenRows(kMenuTopRow, kMenuTopRow + 2); + changeCursor(0, kMenuTopRow, kCursorTypeHidden, 0); - nextRow = kMenuTopRow; - showPrompt = true; + nextRow = kMenuTopRow; + showPrompt = true; - if (gDeviceCount) { - printf("Use \30\31 keys to select the startup volume."); - showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems); - nextRow += min(gDeviceCount, kMenuMaxItems) + 3; - } + if (gDeviceCount) + { + printf("Use \30\31 keys to select the startup volume."); + showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems); + nextRow += min(gDeviceCount, kMenuMaxItems) + 3; + } - showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); - showBootPrompt(nextRow, showPrompt); - //changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 ); + showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); + showBootPrompt(nextRow, showPrompt); + //changeCursor( 0, kMenuTopRow, kCursorTypeUnderline, 0 ); /* * AutoResolution - make sure all values are set @@ -1150,18 +1153,20 @@ bootArgs->Video.v_display = VGA_TEXT_MODE; useGUI = false; - } else { - gui.redraw = true; - setVideoMode(GRAPHICS_MODE, 0); - - /* - * AutoResolution - make sure all values are set - */ - bootArgs->Video.v_display = GRAPHICS_MODE; - useGUI = true; - - updateVRAM(); - } + } + else + { + gui.redraw = true; + setVideoMode(GRAPHICS_MODE, 0); + + /* + * AutoResolution - make sure all values are set + */ + bootArgs->Video.v_display = GRAPHICS_MODE; + useGUI = true; + + updateVRAM(); + } key = 0; break; Index: branches/valv/revision =================================================================== --- branches/valv/revision (revision 708) +++ branches/valv/revision (revision 709) @@ -1 +1 @@ -665:706 \ No newline at end of file +665:707 \ No newline at end of file