Index: branches/azimutz/Cleancut/i386/libsaio/xml.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/xml.c (revision 947) +++ branches/azimutz/Cleancut/i386/libsaio/xml.c (revision 948) @@ -106,7 +106,6 @@ }; -#define USEMALLOC 1 #define DOFREE 1 static long ParseTagList(char *buffer, TagPtr *tag, long type, long empty); @@ -909,11 +908,7 @@ if (gTagsFree == 0) { -#if USEMALLOC tag = (TagPtr)malloc(kTagsPerBlock * sizeof(Tag)); -#else - tag = (TagPtr)AllocateBootXMemory(kTagsPerBlock * sizeof(Tag)); -#endif if (tag == 0) return 0; // Initalize the new tags. @@ -991,11 +986,7 @@ // Add the new symbol. if (symbol == 0) { -#if USEMALLOC symbol = (SymbolPtr)malloc(sizeof(Symbol) + 1 + strlen(string)); -#else - symbol = (SymbolPtr)AllocateBootXMemory(sizeof(Symbol) + 1 + strlen(string)); -#endif if (symbol == 0) //return 0; stop("NULL symbol!"); Index: branches/azimutz/Cleancut/i386/libsaio/bootstruct.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/bootstruct.h (revision 947) +++ branches/azimutz/Cleancut/i386/libsaio/bootstruct.h (revision 948) @@ -38,7 +38,13 @@ extern Node *gMemoryMapNode; #define VGA_TEXT_MODE 0 +//defined in /usr/../boot.h +//#define GRAPHICS_MODE 1 +//#define FB_TEXT_MODE 2 + + + /* * Maximum number of boot drivers that can be loaded. */ Index: branches/azimutz/Cleancut/i386/boot2/drivers.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/drivers.c (revision 947) +++ branches/azimutz/Cleancut/i386/boot2/drivers.c (revision 948) @@ -183,6 +183,47 @@ } else if ( gBootFileType == kBlockDeviceType ) { + if(!gHaveKernelCache) + { + // Non-prelinked kernel, load system mkext. + // NOTE: In it's default state, XNU cannot be both prelinked, and load additional drivers + // from the bootloader. There is, however, a patch that changes this and allows + // for both to occure. + + // Also try to load Extensions from boot helper partitions. + if (gBootVolume->flags & kBVFlagBooter) + { + strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) + { + strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) + { + strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); + FileLoadDrivers(dirSpecExtra, 0); + } + } + } + + if (gMKextName[0] != '\0') + { + verbose("LoadDrivers: Loading from [%s]\n", gMKextName); + if ( LoadDriverMKext(gMKextName) != 0 ) + { + error("Could not load %s\n", gMKextName); + return -1; + } + } + else + { + strcpy(gExtensionsSpec, dirSpec); + strcat(gExtensionsSpec, "System/Library/"); + FileLoadDrivers(gExtensionsSpec, 0); + } + + } + + // First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0). if (gRAMDiskVolume && !gRAMDiskBTAliased) { @@ -209,37 +250,6 @@ } } } - - // Also try to load Extensions from boot helper partitions. - if (gBootVolume->flags & kBVFlagBooter) - { - strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); - FileLoadDrivers(dirSpecExtra, 0); - } - } - } - - if (gMKextName[0] != '\0') - { - verbose("LoadDrivers: Loading from [%s]\n", gMKextName); - if ( LoadDriverMKext(gMKextName) != 0 ) - { - error("Could not load %s\n", gMKextName); - return -1; - } - } - else - { - strcpy(gExtensionsSpec, dirSpec); - strcat(gExtensionsSpec, "System/Library/"); - FileLoadDrivers(gExtensionsSpec, 0); - } } else { @@ -792,10 +802,10 @@ if (kernel_header->root_path[0] && strcmp(gBootFile, kernel_header->root_path)) return -1; #endif - + uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size); binary = buffer = malloc(uncompressed_size); - + size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); if (uncompressed_size != size) { @@ -808,6 +818,9 @@ return -1; } } + + // Notify modules that the kernel has been decompressed, is about to be decoded + execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL); ret = ThinFatFile(&binary, &len); if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64) Index: branches/azimutz/Cleancut/i386/boot2/boot.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/boot.c (revision 947) +++ branches/azimutz/Cleancut/i386/boot2/boot.c (revision 948) @@ -155,8 +155,7 @@ execute_hook("DecodedKernel", (void*)binary, NULL, NULL, NULL); // Load boot drivers from the specifed root path. - if (!gHaveKernelCache) - LoadDrivers("/"); + LoadDrivers("/"); clearActivityIndicator(); @@ -486,7 +485,7 @@ break; } - if(getBoolForKey(kUseKernelCache, &usecache, &bootInfo->bootConfig)) { + if(getBoolForKey(kUseKernelCache, &usecache, &bootInfo->bootConfig) && usecache) { if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) { strlcpy(gBootKernelCacheFile, val, len+1); } Index: branches/azimutz/Cleancut/i386/boot2/gui.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/gui.c (revision 947) +++ branches/azimutz/Cleancut/i386/boot2/gui.c (revision 948) @@ -142,10 +142,9 @@ extern MenuItem *menuItems; -char prompt[BOOT_STRING_LEN]; +//char prompt[BOOT_STRING_LEN]; +extern char gBootArgs[BOOT_STRING_LEN]; -int prompt_pos=0; - char prompt_text[] = "boot: "; menuitem_t infoMenuItems[] = @@ -911,8 +910,8 @@ void clearGraphicBootPrompt() { // clear text buffer - prompt[0] = '\0'; - prompt_pos=0; + //prompt[0] = '\0'; + //prompt_pos=0; if( gui.bootprompt.draw == true ) @@ -928,15 +927,6 @@ void updateGraphicBootPrompt(int key) { - if ( key == kBackspaceKey ) - prompt[--prompt_pos] = '\0'; - else - { - prompt[prompt_pos] = key; - prompt_pos++; - prompt[prompt_pos] = '\0'; - } - fillPixmapWithColor( gui.bootprompt.pixmap, gui.bootprompt.bgcolor); makeRoundedCorners( gui.bootprompt.pixmap); @@ -950,12 +940,12 @@ position_t p_prompt = pos( p_text.x + ( ( strlen(prompt_text) ) * font_console.chars[0]->width ), p_text.y ); // calculate the position of the cursor - int offset = ( prompt_pos - ( ( gui.bootprompt.width / font_console.chars[0]->width ) - strlen(prompt_text) - 2 ) ); + int offset = ( strlen(gBootArgs) - ( ( gui.bootprompt.width / font_console.chars[0]->width ) - strlen(prompt_text) - 2 ) ); if ( offset < 0) offset = 0; - drawStr( prompt+offset, &font_console, gui.bootprompt.pixmap, p_prompt); + drawStr( gBootArgs, &font_console, gui.bootprompt.pixmap, p_prompt); gui.menu.draw = false; gui.bootprompt.draw = true; Index: branches/azimutz/Cleancut/i386/boot2/options.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/options.c (revision 947) +++ branches/azimutz/Cleancut/i386/boot2/options.c (revision 948) @@ -172,7 +172,7 @@ //========================================================================== -static char gBootArgs[BOOT_STRING_LEN]; +char gBootArgs[BOOT_STRING_LEN]; static char * gBootArgsPtr = gBootArgs; static char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1; static char booterCommand[BOOT_STRING_LEN]; @@ -206,11 +206,11 @@ extern char bootRescanPrompt[]; if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { - changeCursor( 0, row, kCursorTypeUnderline, 0 ); - clearScreenRows( row, kScreenLastRow ); + changeCursor( strlen(gBootArgs), row, kCursorTypeUnderline, 0 ); + //clearScreenRows( row, kScreenLastRow ); } - clearBootArgs(); + //clearBootArgs(); if (visible) { if (bootArgs->Video.v_display == VGA_TEXT_MODE) { @@ -218,11 +218,12 @@ printf( bootRescanPrompt ); } else { printf( bootPrompt ); + printf( gBootArgs ); } } } else { if (bootArgs->Video.v_display == GRAPHICS_MODE) { - clearGraphicBootPrompt(); +// clearGraphicBootPrompt(); } else { printf("Press Enter to start up the foreign OS. "); } @@ -252,22 +253,25 @@ { setCursorPosition( x, y, 0 ); putca(' ', 0x07, 1); - } else - updateGraphicBootPrompt(kBackspaceKey); - - *gBootArgsPtr-- = '\0'; - } + } + + *gBootArgsPtr-- = '\0'; + updateGraphicBootPrompt(kBackspaceKey); + } + else + { + *gBootArgsPtr = '\0'; + if( bootArgs->Video.v_display == VGA_TEXT_MODE ) putca(' ', 0x07, 1); + updateGraphicBootPrompt(kBackspaceKey); + } break; default: if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd) { - if( bootArgs->Video.v_display == VGA_TEXT_MODE ) - putchar(key); // echo to screen - else - updateGraphicBootPrompt(key); - *gBootArgsPtr++ = key; + *gBootArgsPtr++ = key; + updateGraphicBootPrompt(key); } break; Index: branches/azimutz/Cleancut/i386/modules/uClibcxx/Makefile =================================================================== --- branches/azimutz/Cleancut/i386/modules/uClibcxx/Makefile (revision 947) +++ branches/azimutz/Cleancut/i386/modules/uClibcxx/Makefile (revision 948) @@ -1,5 +1,6 @@ - MODULE_NAME = uClibcxx +MODULE_DESCRIPTION = This module provides a minimalistic c++ runtime library for use in other modules. This does not provide functionality by itself, instead it is used to allow for the c++ language to be used in other modules. Please note that rtti and exceptions has both been disabled. +MODULE_AUTHOR = MODULE_VERSION = "0.2.2" MODULE_COMPAT_VERSION = "0.2.2" MODULE_START = $(MODULE_NAME)_start Index: branches/azimutz/Cleancut/i386/modules/Resolution/915resolution.c =================================================================== --- branches/azimutz/Cleancut/i386/modules/Resolution/915resolution.c (revision 947) +++ branches/azimutz/Cleancut/i386/modules/Resolution/915resolution.c (revision 948) @@ -11,8 +11,8 @@ #ifndef _RESOLUTION_H_ #define _RESOLUTION_H_ -#include "libsaio.h" -#include "edid.h" +//#include "libsaio.h" +//#include "edid.h" //included #include "915resolution.h" @@ -21,8 +21,8 @@ UInt32 x = 0, y = 0, bp = 0; getResolution(&x, &y, &bp); + verbose("getResolution: %dx%dx%d\n", (int)x, (int)y, (int)bp); - if (x != 0 && y != 0 && bp != 0) @@ -321,7 +321,7 @@ int i = 0; while (i < 512) - { // we don't need to look through the whole bios, just the firs 512 bytes + { // we don't need to look through the whole bios, just the first 512 bytes if (( map->bios_ptr[i] == 'N') && (map->bios_ptr[i+1] == 'V') && (map->bios_ptr[i+2] == 'I') @@ -581,8 +581,13 @@ char* edidInfo = readEDID(); if(!edidInfo) return 1; - - mode->pixel_clock = (edidInfo[55] << 8) | edidInfo[54]; +//Slice + if(!fb_parse_edid((struct EDID *)edidInfo, mode)) + { + free( edidInfo ); + return 1; + } +/* mode->pixel_clock = (edidInfo[55] << 8) | edidInfo[54]; mode->h_active = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4); mode->h_blanking = ((edidInfo[58] & 0x0F) << 8) | edidInfo[57]; mode->v_active = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4); @@ -591,8 +596,8 @@ mode->h_sync_width = (edidInfo[65] & 0x30) | edidInfo[63]; mode->v_sync_offset = (edidInfo[65] & 0x0C) | ((edidInfo[64] & 0x0C) >> 2); mode->v_sync_width = ((edidInfo[65] & 0x3) << 2) | (edidInfo[64] & 0x03); +*/ - free( edidInfo ); if(!mode->h_active) return 1; @@ -631,6 +636,9 @@ // for (i=0; i < map->mode_table_size; i++) { // if (map->mode_table[0].mode == mode) { switch(map->bios) { + case BT_INTEL: + return; + case BT_1: { vbios_resolution_type1 * res = map_type1_resolution(map, map->mode_table[i].resolution); Index: branches/azimutz/Cleancut/i386/modules/Resolution/include/edid.h =================================================================== --- branches/azimutz/Cleancut/i386/modules/Resolution/include/edid.h (revision 947) +++ branches/azimutz/Cleancut/i386/modules/Resolution/include/edid.h (revision 948) @@ -5,18 +5,168 @@ * Created by Evan Lojewski on 12/1/09. * Copyright 2009. All rights reserved. * + * Slice 2010, based on Joblo works */ +//#ifndef __EDID_H__ +//#define __EDID_H__ -#ifndef _EDID_H_ -#define _EDID_H_ #include "libsaio.h" #define EDID_BLOCK_SIZE 128 #define EDID_V1_BLOCKS_TO_GO_OFFSET 126 +//Slice - some more info about EDID +#define EDID_LENGTH 0x80 +#define EDID_HEADER 0x00 +#define EDID_HEADER_END 0x07 +#define ID_MANUFACTURER_NAME 0x08 +#define ID_MANUFACTURER_NAME_END 0x09 +#define ID_MODEL 0x0a + +#define ID_SERIAL_NUMBER 0x0c + +#define MANUFACTURE_WEEK 0x10 +#define MANUFACTURE_YEAR 0x11 + +#define EDID_STRUCT_VERSION 0x12 +#define EDID_STRUCT_REVISION 0x13 + +#define EDID_STRUCT_DISPLAY 0x14 + +#define DPMS_FLAGS 0x18 +#define ESTABLISHED_TIMING_1 0x23 +#define ESTABLISHED_TIMING_2 0x24 +#define MANUFACTURERS_TIMINGS 0x25 + +/* standard timings supported */ +#define STD_TIMING 8 +#define STD_TIMING_DESCRIPTION_SIZE 2 +#define STD_TIMING_DESCRIPTIONS_START 0x26 + +#define DETAILED_TIMING_DESCRIPTIONS_START 0x36 +#define DETAILED_TIMING_DESCRIPTION_SIZE 18 +#define NO_DETAILED_TIMING_DESCRIPTIONS 4 + +#define DETAILED_TIMING_DESCRIPTION_1 0x36 +#define DETAILED_TIMING_DESCRIPTION_2 0x48 +#define DETAILED_TIMING_DESCRIPTION_3 0x5a +#define DETAILED_TIMING_DESCRIPTION_4 0x6c + +#define DESCRIPTOR_DATA 5 + +#define UPPER_NIBBLE( x ) \ +(((128|64|32|16) & (x)) >> 4) + +#define LOWER_NIBBLE( x ) \ +((1|2|4|8) & (x)) + +#define COMBINE_HI_8LO( hi, lo ) \ +( (((unsigned)hi) << 8) | (unsigned)lo ) + +#define COMBINE_HI_4LO( hi, lo ) \ +( (((unsigned)hi) << 4) | (unsigned)lo ) + +#define PIXEL_CLOCK_LO (unsigned)block[ 0 ] +#define PIXEL_CLOCK_HI (unsigned)block[ 1 ] +#define PIXEL_CLOCK (COMBINE_HI_8LO( PIXEL_CLOCK_HI,PIXEL_CLOCK_LO )*10000) +#define H_ACTIVE_LO (unsigned)block[ 2 ] +#define H_BLANKING_LO (unsigned)block[ 3 ] +#define H_ACTIVE_HI UPPER_NIBBLE( (unsigned)block[ 4 ] ) +#define H_ACTIVE COMBINE_HI_8LO( H_ACTIVE_HI, H_ACTIVE_LO ) +#define H_BLANKING_HI LOWER_NIBBLE( (unsigned)block[ 4 ] ) +#define H_BLANKING COMBINE_HI_8LO( H_BLANKING_HI, H_BLANKING_LO ) + +#define V_ACTIVE_LO (unsigned)block[ 5 ] +#define V_BLANKING_LO (unsigned)block[ 6 ] +#define V_ACTIVE_HI UPPER_NIBBLE( (unsigned)block[ 7 ] ) +#define V_ACTIVE COMBINE_HI_8LO( V_ACTIVE_HI, V_ACTIVE_LO ) +#define V_BLANKING_HI LOWER_NIBBLE( (unsigned)block[ 7 ] ) +#define V_BLANKING COMBINE_HI_8LO( V_BLANKING_HI, V_BLANKING_LO ) + +#define H_SYNC_OFFSET_LO (unsigned)block[ 8 ] +#define H_SYNC_WIDTH_LO (unsigned)block[ 9 ] + +#define V_SYNC_OFFSET_LO UPPER_NIBBLE( (unsigned)block[ 10 ] ) +#define V_SYNC_WIDTH_LO LOWER_NIBBLE( (unsigned)block[ 10 ] ) + +#define V_SYNC_WIDTH_HI ((unsigned)block[ 11 ] & (1|2)) +#define V_SYNC_OFFSET_HI (((unsigned)block[ 11 ] & (4|8)) >> 2) + +#define H_SYNC_WIDTH_HI (((unsigned)block[ 11 ] & (16|32)) >> 4) +#define H_SYNC_OFFSET_HI (((unsigned)block[ 11 ] & (64|128)) >> 6) + +#define V_SYNC_WIDTH COMBINE_HI_4LO( V_SYNC_WIDTH_HI, V_SYNC_WIDTH_LO ) +#define V_SYNC_OFFSET COMBINE_HI_4LO( V_SYNC_OFFSET_HI, V_SYNC_OFFSET_LO ) + +#define H_SYNC_WIDTH COMBINE_HI_4LO( H_SYNC_WIDTH_HI, H_SYNC_WIDTH_LO ) +#define H_SYNC_OFFSET COMBINE_HI_4LO( H_SYNC_OFFSET_HI, H_SYNC_OFFSET_LO ) + +#define H_SIZE_LO (unsigned)block[ 12 ] +#define V_SIZE_LO (unsigned)block[ 13 ] + +#define H_SIZE_HI UPPER_NIBBLE( (unsigned)block[ 14 ] ) +#define V_SIZE_HI LOWER_NIBBLE( (unsigned)block[ 14 ] ) + +#define H_SIZE COMBINE_HI_8LO( H_SIZE_HI, H_SIZE_LO ) +#define V_SIZE COMBINE_HI_8LO( V_SIZE_HI, V_SIZE_LO ) + +#define H_BORDER (unsigned)block[ 15 ] +#define V_BORDER (unsigned)block[ 16 ] + +#define FLAGS (unsigned)block[ 17 ] + +#define INTERLACED (FLAGS&128) +#define SYNC_TYPE (FLAGS&3<<3) /* bits 4,3 */ +#define SYNC_SEPARATE (3<<3) +#define HSYNC_POSITIVE (FLAGS & 4) +#define VSYNC_POSITIVE (FLAGS & 2) + +#define V_MIN_RATE block[ 5 ] +#define V_MAX_RATE block[ 6 ] +#define H_MIN_RATE block[ 7 ] +#define H_MAX_RATE block[ 8 ] +#define MAX_PIXEL_CLOCK (((int)block[ 9 ]) * 10) +#define GTF_SUPPORT block[10] + +#define DPMS_ACTIVE_OFF (1 << 5) +#define DPMS_SUSPEND (1 << 6) +#define DPMS_STANDBY (1 << 7) + +struct EDID +{ + UInt8 header[8]; //0 + UInt8 vendorProduct[4]; //8 + UInt8 serialNumber[4]; //12 + UInt8 weekOfManufacture; //16 + UInt8 yearOfManufacture; //17 + UInt8 version; //18 + UInt8 revision; //19 + UInt8 displayParams[5]; //20 + UInt8 colorCharacteristics[10]; //25 + UInt8 establishedTimings[3]; //35 + UInt16 standardTimings[8]; //38 + UInt8 detailedTimings[72]; //54 + UInt8 extension; //126 + UInt8 checksum; //127 +}; + + +typedef struct _edid_mode { + unsigned short pixel_clock; + unsigned short h_active; + unsigned short h_blanking; + unsigned short v_active; + unsigned short v_blanking; + unsigned short h_sync_offset; + unsigned short h_sync_width; + unsigned short v_sync_offset; + unsigned short v_sync_width; +} edid_mode; + + char* readEDID(); +void getResolution(UInt32* x, UInt32* y, UInt32* bp); +int fb_parse_edid(struct EDID *edid, edid_mode* var); int getEDID( void * edidBlock, UInt8 block); -void getResolution(UInt32* x, UInt32* y, UInt32* bp); - -#endif /* _EDID_H_ */ \ No newline at end of file +//#endif \ No newline at end of file Index: branches/azimutz/Cleancut/i386/modules/Resolution/edid.c =================================================================== --- branches/azimutz/Cleancut/i386/modules/Resolution/edid.c (revision 947) +++ branches/azimutz/Cleancut/i386/modules/Resolution/edid.c (revision 948) @@ -4,21 +4,253 @@ * * Created by Evan Lojewski on 12/1/09. * Copyright 2009. All rights reserved. - * + * + * Slice 2010, based on Joblo works */ +//#include "libsaio.h" #include "edid.h" #include "vbe.h" #include "graphics.h" - +#include "boot.h" +//---------------------------------------------------------------------------------- +#define FBMON_FIX_HEADER 1 +#define FBMON_FIX_INPUT 2 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +//---------------------------------------------------------------------------------- +/* +struct broken_edid { + const char manufacturer[4]; + UInt32 model; + UInt32 fix; +}; + +//---------------------------------------------------------------------------------- + +broken_edid brokendb[] = { + // DEC FR-PCXAV-YZ * + { "DEC", 0x073a, FBMON_FIX_HEADER,}, + // ViewSonic PF775a * + { "VSC", 0x5a44, FBMON_FIX_INPUT, } +}; +//---------------------------------------------------------------------------------- +*/ +const unsigned char edid_v1_header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; + +//---------------------------------------------------------------------------------- +int edid_compare(unsigned char *edid1, unsigned char *edid2) +{ + int result = 0; + unsigned char *block = edid1 + ID_MANUFACTURER_NAME, manufacturer1[4], manufacturer2[4];; + manufacturer1[0] = ((block[0] & 0x7c) >> 2) + '@'; + manufacturer1[1] = ((block[0] & 0x03) << 3) + ((block[1] & 0xe0) >> 5) + '@'; + manufacturer1[2] = (block[1] & 0x1f) + '@'; + manufacturer1[3] = 0; + + block = edid2 + ID_MANUFACTURER_NAME; + manufacturer2[0] = ((block[0] & 0x7c) >> 2) + '@'; + manufacturer2[1] = ((block[0] & 0x03) << 3) + ((block[1] & 0xe0) >> 5) + '@'; + manufacturer2[2] = (block[1] & 0x1f) + '@'; + manufacturer2[3] = 0; + int x; + for(x = 0; x < 4; x++) + { + if(manufacturer1[x] == manufacturer2[x]) + result++; + } + + return result; +} + +int check_edid(unsigned char *edid) +{ + unsigned char *block = edid + ID_MANUFACTURER_NAME, manufacturer[4]; + //unsigned char *b; + UInt32 model; + //int i, fix = 0, ret = 0; + + manufacturer[0] = ((block[0] & 0x7c) >> 2) + '@'; + manufacturer[1] = ((block[0] & 0x03) << 3) + + ((block[1] & 0xe0) >> 5) + '@'; + manufacturer[2] = (block[1] & 0x1f) + '@'; + manufacturer[3] = 0; + model = block[2] + (block[3] << 8); +/* + for (i = 0; i < (int)ARRAY_SIZE(brokendb); i++) { + if (!strncmp((const char *)manufacturer, brokendb[i].manufacturer, 4) && + brokendb[i].model == model) { + DEBG("ATIFB: The EDID Block of " + "Manufacturer: %s Model: 0x%08lx is known to " + "be broken,\n", manufacturer, model); + fix = brokendb[i].fix; + break; + } + } + + switch (fix) { + case FBMON_FIX_HEADER: + for (i = 0; i < 8; i++) { + if (edid[i] != edid_v1_header[i]) + ret = fix; + } + break; + case FBMON_FIX_INPUT: + b = edid + EDID_STRUCT_DISPLAY; + /// Only if display is GTF capable will + //the input type be reset to analog * + if (b[4] & 0x01 && b[0] & 0x80) + ret = fix; + break; + } +*/ + return 0; //ret; +} + +//---------------------------------------------------------------------------------- + +static void fix_edid(unsigned char *edid, int fix) +{ + unsigned char *b; + + switch (fix) { + case FBMON_FIX_HEADER: + msglog("EDID: trying a header reconstruct\n"); + memcpy(edid, edid_v1_header, 8); + break; + case FBMON_FIX_INPUT: + msglog("EDID: trying to fix input type\n"); + b = edid + EDID_STRUCT_DISPLAY; + b[0] &= ~0x80; + edid[127] += 0x80; + } +} + +//---------------------------------------------------------------------------------- + +int edid_checksum(unsigned char *edid) +{ + unsigned char i, csum = 0, all_null = 0; + int err = 0, fix = check_edid(edid); + + if (fix) + fix_edid(edid, fix); + + for (i = 0; i < EDID_LENGTH; i++) { + csum += edid[i]; + all_null |= edid[i]; + } + + if (csum == 0x00 && all_null) { + /* checksum passed, everything's good */ + err = 1; + } + + return err; +} + +//---------------------------------------------------------------------------------- + +static int edid_check_header(unsigned char *edid) +{ + int i, err = 1, fix = check_edid(edid); + + if (fix) + fix_edid(edid, fix); + + for (i = 0; i < 8; i++) { + if (edid[i] != edid_v1_header[i]) + err = 0; + } + + return err; +} +//------------------------------------------------------------------------ +bool verifyEDID(unsigned char *edid) +{ + if (edid == NULL || !edid_checksum(edid) || !edid_check_header(edid)) + { + return false; + } + return true; +} + +int edid_is_timing_block(unsigned char *block) +{ + if ((block[0] != 0x00) || (block[1] != 0x00) || + (block[2] != 0x00) || (block[4] != 0x00)) + return 1; + else + return 0; +} +//---------------------------------------------------------------------------------- + +int fb_parse_edid(struct EDID *edid, edid_mode* var) //(struct EDID *edid, UInt32* x, UInt32* y) +{ + int i; + unsigned char *block; + + if(!verifyEDID((unsigned char *)edid)) return 1; + + block = (unsigned char *)edid + DETAILED_TIMING_DESCRIPTIONS_START; //54 + + for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) { + if (edid_is_timing_block(block)) { + var->h_active = H_ACTIVE; + var->v_active = V_ACTIVE; + var->h_sync_offset = H_SYNC_OFFSET; + var->h_sync_width = H_SYNC_WIDTH; + var->h_blanking = H_BLANKING; + var->v_blanking = V_BLANKING; + var->pixel_clock = PIXEL_CLOCK; + var->h_sync_width = H_SYNC_WIDTH; + var->v_sync_width = V_SYNC_WIDTH; + /* + var->xres = var->xres_virtual = H_ACTIVE; + var->yres = var->yres_virtual = V_ACTIVE; + var->height = var->width = -1; + var->right_margin = H_SYNC_OFFSET; + var->left_margin = (H_ACTIVE + H_BLANKING) - + (H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH); + var->upper_margin = V_BLANKING - V_SYNC_OFFSET - + V_SYNC_WIDTH; + var->lower_margin = V_SYNC_OFFSET; + var->hsync_len = H_SYNC_WIDTH; + var->vsync_len = V_SYNC_WIDTH; + var->pixclock = PIXEL_CLOCK; + var->pixclock /= 1000; + var->pixclock = KHZ2PICOS(var->pixclock); + + if (HSYNC_POSITIVE) + var->sync |= FB_SYNC_HOR_HIGH_ACT; + if (VSYNC_POSITIVE) + var->sync |= FB_SYNC_VERT_HIGH_ACT; + */ + return 1; + } + } + return 0; +} + void getResolution(UInt32* x, UInt32* y, UInt32* bp) { +// int val; static UInt32 xResolution, yResolution, bpResolution; +/* + if(getIntForKey(kScreenWidth, &val, &bootInfo->bootConfig)) + { + xResolution = val; + } + + if(getIntForKey(kScreenHeight, &val, &bootInfo->bootConfig)) + { + yResolution = val; + } +*/ + bpResolution = 32; // assume 32bits - bpResolution = 32; // assume 32bits if(!xResolution || !yResolution || !bpResolution) { @@ -26,18 +258,46 @@ char* edidInfo = readEDID(); if(!edidInfo) return; - + edid_mode mode; // TODO: check *all* resolutions reported and either use the highest, or the native resolution (if there is a flag for that) - xResolution = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4); - yResolution = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4); + //xResolution = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4); + //yResolution = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4); + //Slice - done here - //printf("H Active = %d", edidInfo[56] | ((edidInfo[58] & 0xF0) << 4) ); - //printf("V Active = %d", edidInfo[59] | ((edidInfo[61] & 0xF0) << 4) ); + if(fb_parse_edid((struct EDID *)edidInfo, &mode) == 0) + { + xResolution = DEFAULT_SCREEN_WIDTH; + yResolution = DEFAULT_SCREEN_HEIGHT; + } + else { + xResolution = mode.h_active; + yResolution = mode.v_active; + } + + /* + 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x32 0x0C + 0x00 0xDF 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF 0x00 + 0x0C 0xDF 0x00 0x00 0x12 0x03 0x21 0x78 0xE9 0x99 + 0x53 0x28 0xFF 0xFF 0x32 0xDF 0x00 0x12 0x80 0x78 + 0xD5 0x53 0x26 0x00 0x01 0x01 0x01 0x01 0xFF 0x00 + 0xDF 0x00 0x03 0x78 0x99 0x28 0x00 0x01 0x01 0x01 + 0x01 0x21 0x84 0x20 0xFF 0x0C 0x00 0x03 0x0A 0x53 + 0x54 0x01 0x01 0x01 0xDE 0x84 0x56 0x00 0xA0 0x30 + 0xFF 0xDF 0x12 0x78 0x53 0x00 0x01 0x01 0x01 0x84 + 0x00 0x18 0x84 0x00 0x00 0x57 0xFF 0x00 0x80 0x99 + 0x54 0x01 0x01 0x21 0x20 0x00 0x50 0x00 0x00 0x35 + 0x57 0xFE 0x00 0x00 0x78 0x28 0x01 0x01 0x21 0x20 + 0x18 0x30 0x00 0x57 0x34 0xFE 0xAA 0x9A + + */ + //msglog("H Active = %d ", edidInfo[56] | ((edidInfo[58] & 0xF0) << 4) ); + //msglog("V Active = %d \n", edidInfo[59] | ((edidInfo[61] & 0xF0) << 4) ); + free( edidInfo ); - if(!xResolution) xResolution = DEFAULT_SCREEN_WIDTH; - if(!yResolution) yResolution = DEFAULT_SCREEN_HEIGHT; + //if(!xResolution) xResolution = DEFAULT_SCREEN_WIDTH; + //if(!yResolution) yResolution = DEFAULT_SCREEN_HEIGHT; } @@ -57,7 +317,7 @@ SInt16 status; UInt16 blocks_left = 1; - +// msglog("readEDID\n"); do { // TODO: This currently only retrieves the *last* block, make the block buffer expand as needed / calculated from the first block @@ -67,16 +327,16 @@ status = getEDID(edidInfo, blocks_left); - //printf("Buffer location: 0x%X\n", SEG(buffer) << 16 | OFF(buffer)); - /* + msglog("Buffer location: 0x%X status: %d\n", SEG(edidInfo) << 16 | OFF(edidInfo), status); + int j, i; for (j = 0; j < 8; j++) { - for(i = 0; i < 16; i++) printf("0x%X ", ebiosInfo[((i+1) * (j + 1)) - 1]); - + for(i = 0; i < 16; i++) msglog("0x%02X ", edidInfo[((i+1) * (j + 1)) - 1]); + msglog("\n"); } - printf("\n"); - */ + + if(status == 0) { //if( edidInfo[0] == 0x00 || edidInfo[0] == 0xFF) @@ -89,7 +349,7 @@ if ( reported > blocks_left ) { - printf("EDID claims %d more blocks left\n", reported); + msglog("EDID claims %d more blocks left\n", reported); } if ( (last_reported <= reported && last_reported != -1) @@ -98,8 +358,8 @@ //|| reported == MAGIC ) { - printf("Last reported %d\n", last_reported); - printf( "EDID blocks left is wrong.\n" + msglog("Last reported %d\n", last_reported); + msglog( "EDID blocks left is wrong.\n" "Your EDID is probably invalid.\n"); return 0; } @@ -115,9 +375,9 @@ } else { - printf("Invalid block %d\n", blocks_left); - printf("Header1 = %d", memcmp(edidInfo, header1, sizeof(header1)) ); - printf("Header2 = %d", memcmp(edidInfo, header2, sizeof(header2)) ); + msglog("Invalid block %d\n", blocks_left); + msglog("Header1 = %d", memcmp(edidInfo, header1, sizeof(header1)) ); + msglog("Header2 = %d", memcmp(edidInfo, header2, sizeof(header2)) ); return 0; } } @@ -146,4 +406,3 @@ bios( &bb ); return(bb.eax.r.h); } - Index: branches/azimutz/Cleancut/i386/modules/Resolution/915resolution.h =================================================================== --- branches/azimutz/Cleancut/i386/modules/Resolution/915resolution.h (revision 947) +++ branches/azimutz/Cleancut/i386/modules/Resolution/915resolution.h (revision 948) @@ -8,12 +8,14 @@ */ +#ifndef __RESOLUTION_H +#define __RESOLUTION_H + #include "shortatombios.h" #include "edid.h" -#ifndef __RESOLUTION_H -#define __RESOLUTION_H - +//Slice - moved to edid.h +/* typedef struct _edid_mode { unsigned short pixel_clock; unsigned short h_active; @@ -25,9 +27,9 @@ unsigned short v_sync_offset; unsigned short v_sync_width; } edid_mode; +*/ - void patchVideoBios(); @@ -116,7 +118,7 @@ typedef enum { - BT_UNKNOWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA + BT_UNKNOWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA, BT_INTEL } bios_type; Index: branches/azimutz/Cleancut/i386/modules/klibc/Makefile =================================================================== --- branches/azimutz/Cleancut/i386/modules/klibc/Makefile (revision 947) +++ branches/azimutz/Cleancut/i386/modules/klibc/Makefile (revision 948) @@ -1,4 +1,6 @@ MODULE_NAME = klibc +MODULE_DESCRIPTION = This module provides a standard c library for modules to link to if the library provided by chameleon is insufficient. This is currently only used by the uClibc++ library. +MODULE_AUTHOR = MODULE_VERSION = "1.5.20" MODULE_COMPAT_VERSION = "1.5.20" MODULE_START = $(MODULE_NAME)_start Index: branches/azimutz/Cleancut/i386/modules/HelloWorld/Makefile =================================================================== --- branches/azimutz/Cleancut/i386/modules/HelloWorld/Makefile (revision 947) +++ branches/azimutz/Cleancut/i386/modules/HelloWorld/Makefile (revision 948) @@ -1,4 +1,6 @@ MODULE_NAME = HelloWorld +MODULE_DESCRIPTION = This module provides an example implementation of a module. Should not be used for regular bootup +MODULE_AUTHOR = MODULE_VERSION = "1.0.0" MODULE_COMPAT_VERSION = "1.0.0" MODULE_START = $(MODULE_NAME)_start Index: branches/azimutz/Cleancut/Make.rules =================================================================== --- branches/azimutz/Cleancut/Make.rules (revision 947) +++ branches/azimutz/Cleancut/Make.rules (revision 948) @@ -71,7 +71,7 @@ $(OBJROOT)/boot2.o: @echo "\t[AS] boot2.s" - @cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \ + @$(CC) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \ -MD -dependency-file $*.d @md -u $(OBJROOT)/Makedep -f -d $*.d Property changes on: branches/azimutz/Cleancut ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r930-947