Index: branches/ErmaC/Enoch/i386/libsaio/gma.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/gma.c (revision 2739) +++ branches/ErmaC/Enoch/i386/libsaio/gma.c (revision 2740) @@ -48,10 +48,6 @@ #define DEBUG_GMA 0 #endif -#ifndef DEBUG_BDW - #define DEBUG_BDW 1 -#endif - #if DEBUG_GMA #define DBG(x...) printf(x) #else @@ -69,10 +65,8 @@ static uint8_t default_aapl_haswell[] = { 0x00,0x00,0x26,0x0c }; // haswell_ig_vals[7] #define AAPL_LEN_HSW ( sizeof(default_aapl_haswell) / sizeof(uint8_t) ) -#if DEBUG_BDW static uint8_t default_aapl_broadwell[] = { 0x00,0x00,0x1e,0x16 }; // broadwell_ig_vals[2] #define AAPL_LEN_BDW ( sizeof(default_aapl_broadwell) / sizeof(uint8_t) ) -#endif uint8_t GMAX3100_vals[23][4] = { { 0x01,0x00,0x00,0x00 }, //0 "AAPL,HasPanel" @@ -135,7 +129,6 @@ { 0x04,0x00,0x12,0x04 } // 16 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3 }; -#if DEBUG_BDW uint8_t broadwell_ig_vals[19][4] = { { 0x00,0x00,0x06,0x16 }, // 0 - 16060000 Broadwell GT1 (Intel HD Graphics) { 0x00,0x00,0x0e,0x16 }, // 1 - 160e0000 Broadwell GT1 (Intel HD Graphics) @@ -157,7 +150,6 @@ { 0x05,0x00,0x26,0x16 }, // 17 - 16260005 Broadwell GT3 (MacBook Air) (Intel HD Graphics 6000) { 0x06,0x00,0x26,0x16 } // 18 - 16260006 Broadwell GT3 (MacBook Air) (Intel HD Graphics 6000) }; -#endif uint8_t HD2000_vals[16][4] = { { 0x00,0x00,0x00,0x00 }, //0 "AAPL00,PixelFormat" @@ -869,7 +861,6 @@ break; -#if DEBUG_BDW /* Broadwell */ /* HD Graphics 5300 Mobile, HD Graphics 6000 Mobile, HD Graphics 6100 Mobile */ case GMA_BROADWELL_BDW_0bd0: // 0bd0 @@ -939,7 +930,7 @@ devprop_add_value(device, "class-code", ClassFix, 4); break; -#endif // DEBUG_BDW + default: break; } Index: branches/ErmaC/Enoch/i386/boot2/graphics.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2739) +++ branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2740) @@ -397,7 +397,7 @@ //========================================================================== // Simple decompressor for boot images encoded in RLE format. -char * decodeRLE( const void * rleData, int rleBlocks, int outBytes ) +char *decodeRLE( const void *rleData, int rleBlocks, int outBytes ) { char *out, *cp; @@ -483,82 +483,84 @@ // err = setVBEMode( mode | kLinearFrameBufferBit, NULL ); // } - // Set the mode with default refresh rate. + // Set the mode with default refresh rate. - err = setVBEMode(mode | kLinearFrameBufferBit, NULL); + err = setVBEMode(mode | kLinearFrameBufferBit, NULL); - if (err != errSuccess) - { - break; - } + if (err != errSuccess) + { + 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); } while ( 0 ); - return err; + return err; } //============================================================================== int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData ) { - int cnt; - unsigned char *img = 0; - unsigned short *img16; - unsigned long *img32; + int cnt; + unsigned char *img = 0; + unsigned short *img16; + unsigned long *img32; - switch ( VIDEO(depth) ) { - case 16 : - img16 = malloc(width * height * 2); - if ( !img16 ) break; - for (cnt = 0; cnt < (width * height); cnt++) - img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16); - img = (unsigned char *)img16; - break; + switch ( VIDEO(depth) ) + { + case 16 : + img16 = malloc(width * height * 2); + if ( !img16 ) break; + for (cnt = 0; cnt < (width * height); cnt++) + img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16); + img = (unsigned char *)img16; + break; - case 32 : - img32 = malloc(width * height * 4); - if ( !img32 ) break; - for (cnt = 0; cnt < (width * height); cnt++) - img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32); - img = (unsigned char *)img32; - break; + case 32 : + img32 = malloc(width * height * 4); + if ( !img32 ) break; + for (cnt = 0; cnt < (width * height); cnt++) + img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32); + img = (unsigned char *)img32; + break; - default : - img = malloc(width * height); - bcopy(imageData, img, width * height); - break; - } - *newImageData = img; - return 0; + default : + img = malloc(width * height); + bcopy(imageData, img, width * height); + break; + } + *newImageData = img; + return 0; } //============================================================================== @@ -860,14 +862,17 @@ unsigned short y, unsigned short width, unsigned short height, - unsigned char * data ) + unsigned char *data ) { unsigned short drawWidth; + long pixelBytes = VIDEO(depth) / 8; + unsigned char * vram = (unsigned char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x; drawWidth = MIN(width, VIDEO(width) - x); height = MIN(height, VIDEO(height) - y); + while ( height-- ) { bcopy( data, vram, drawWidth * pixelBytes ); @@ -928,13 +933,13 @@ void drawPreview(void *src, uint8_t * saveunder) { - uint8_t * screen; + uint8_t *screen; uint32_t rowBytes, pixelShift; uint32_t x, y; int32_t blob; uint32_t alpha, in, color, result; - uint8_t * out; - void *uncomp; + uint8_t *out; + void *uncomp; int origwidth, origheight, origbpx; uint32_t saveindex[kIOHibernateProgressCount] = { 0 }; @@ -959,6 +964,7 @@ screen = (uint8_t *) VIDEO (baseAddr); rowBytes = VIDEO (rowBytes); + // Set the screen to 75% grey. drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */); } @@ -1022,12 +1028,12 @@ void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select) { - uint8_t * screen; - uint32_t rowBytes, pixelShift; - uint32_t x, y; - int32_t blob, lastBlob; - uint32_t alpha, in, color, result; - uint8_t * out; + uint8_t *screen; + uint32_t rowBytes, pixelShift; + uint32_t x, y; + int32_t blob, lastBlob; + uint32_t alpha, in, color, result; + uint8_t *out; uint32_t saveindex[kIOHibernateProgressCount] = { 0 }; pixelShift = VIDEO(depth) >> 4; Index: branches/ErmaC/Enoch/i386/boot2/lzvn.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/lzvn.c (revision 2739) +++ branches/ErmaC/Enoch/i386/boot2/lzvn.c (revision 2740) @@ -62,9 +62,10 @@ const void *src, size_t src_size) { + const uint64_t rdi = (const uint64_t)dst; + size_t rax = 0; - const uint64_t rdi = (const uint64_t)dst; uint64_t rsi = dst_size; uint64_t rcx = src_size; uint64_t rdx = (uint64_t)src; Index: branches/ErmaC/Enoch/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2739) +++ branches/ErmaC/Enoch/i386/boot2/boot.c (revision 2740) @@ -105,7 +105,7 @@ //static void selectBiosDevice(void); /** options.c **/ -extern char* msgbuf; +extern char *msgbuf; void showTextBuffer(char *buf, int size); //========================================================================== Index: branches/ErmaC/Enoch/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2739) +++ branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2740) @@ -289,7 +289,7 @@ unsigned short height, const unsigned char *imageData, unsigned char **newImageData ); -extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes ); +extern char *decodeRLE( const void *rleData, int rleBlocks, int outBytes ); extern void drawBootGraphics(void); extern void drawPreview(void *src, uint8_t *saveunder); extern int getVideoMode(void); Index: branches/ErmaC/Enoch/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2739) +++ branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2740) @@ -1336,8 +1336,7 @@ // ==================================================================== -static inline -void vramwrite (void *data, int width, int height) +static inline void vramwrite (void *data, int width, int height) { if (VIDEO (depth) == 32 && VIDEO (rowBytes) == gui.backbuffer->width * 4) { @@ -1417,14 +1416,13 @@ struct putc_info //Azi: exists on console.c & printf.c { - char * str; - char * last_str; + char *str; + char *last_str; }; // ==================================================================== -static int -sputc(int c, struct putc_info * pi) //Azi: same as above +static int sputc(int c, struct putc_info * pi) //Azi: same as above { if (pi->last_str) { @@ -2327,9 +2325,9 @@ // ==================================================================== -uint16_t bootImageWidth = 0; -uint16_t bootImageHeight = 0; -uint8_t *bootImageData = NULL; +uint16_t bootImageWidth = 0; +uint16_t bootImageHeight = 0; +uint8_t *bootImageData = NULL; static bool usePngImage = true; //========================================================================== @@ -2364,10 +2362,13 @@ int length; const char *dummyVal; int oldScreenWidth, oldScreenHeight; - bool legacy_logo; - uint16_t x, y; - - if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->chameleonConfig) && legacy_logo) + bool legacy_logo = true; // ErmaC: Legacy Logo is enabled by default + + uint16_t x, y; + + getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->chameleonConfig); + + if ( legacy_logo ) { usePngImage = false; } @@ -2417,8 +2418,8 @@ } else { - // Fill the background to 75% grey (same as BootX). - drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01); + // Fill the background to 75% grey (same as BootX). + drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01); } if ((bootImageData) && (usePngImage)) @@ -2431,25 +2432,25 @@ } else { - uint8_t *appleBootPict; - bootImageData = NULL; - bootImageWidth = kAppleBootWidth; - bootImageHeight = kAppleBootHeight; + uint8_t *appleBootPict; + bootImageData = NULL; + bootImageWidth = kAppleBootWidth; + bootImageHeight = kAppleBootHeight; - // Prepare the data for the default Apple boot image. - appleBootPict = (uint8_t *) decodeRLE(gAppleBootPictRLE, kAppleBootRLEBlocks, bootImageWidth * bootImageHeight); + // Prepare the data for the default Apple boot image. + appleBootPict = (uint8_t *) decodeRLE(gAppleBootPictRLE, kAppleBootRLEBlocks, bootImageWidth * bootImageHeight); if (appleBootPict) { - convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData); + convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData); if (bootImageData) { - x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2; - y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2; + x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2; + y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2; drawDataRectangle(x, y, kAppleBootWidth, kAppleBootHeight, bootImageData); free(bootImageData); } - free(appleBootPict); - } + free(appleBootPict); + } } } // ====================================================================