Index: branches/ErmaC/Trunk/i386/libsaio/xml.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/xml.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/xml.c (revision 1987) @@ -715,14 +715,14 @@ return 0; } - size = length = FixDataMatchingTag(buffer, kXMLTagInteger); - if (length == -1) return -1; - - tmpTag = NewTag(); - if (tmpTag == 0) return -1; - - integer = 0; + size = length = FixDataMatchingTag(buffer, kXMLTagInteger); + if (length == -1) return -1; + tmpTag = NewTag(); + if (tmpTag == 0) return -1; + + integer = 0; + if(size > 1 && (val[1] == 'x' || val[1] == 'X')) // Hex value { val += 2; @@ -1223,4 +1223,4 @@ return true; } return false; -} \ No newline at end of file +} Index: branches/ErmaC/Trunk/i386/libsaio/asm.s =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/asm.s (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/asm.s (revision 1987) @@ -82,7 +82,7 @@ * New boot0 (boot1 has been deprecated). Booter must now reside in its own partition, no disk label required. * * Revision 1.1.1.2 1999/08/04 21:16:57 wsanchez - * Impoort of boot-66 + * Import of boot-66 * * Revision 1.3 1999/08/04 21:12:12 wsanchez * Update APSL @@ -344,11 +344,11 @@ // // Port of original patch by: CPARM (who basically did this in boot.c) Thanks! // +// +LABEL(_disableIRQs) // The ACPI specification dictates that the 8259 (PC-AT compatible) vectors // must be disabled (that is, masked) when enabling the ACPI APIC operation // but this isn't done (apparently) on all mobo's and thus we do that here. -// -LABEL(_disableIRQs) push %eax // Saving register data Index: branches/ErmaC/Trunk/i386/libsaio/xml.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/xml.h (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/xml.h (revision 1987) @@ -48,20 +48,20 @@ extern string_ref* ref_strings; -#define kXMLTagPList "plist " -#define kXMLTagDict "dict" -#define kXMLTagKey "key" -#define kXMLTagString "string" -#define kXMLTagInteger "integer" -#define kXMLTagData "data" -#define kXMLTagDate "date" -#define kXMLTagFalse "false/" -#define kXMLTagTrue "true/" -#define kXMLTagArray "array" +#define kXMLTagPList "plist " +#define kXMLTagDict "dict" +#define kXMLTagKey "key" +#define kXMLTagString "string" +#define kXMLTagInteger "integer" +#define kXMLTagData "data" +#define kXMLTagDate "date" +#define kXMLTagFalse "false/" +#define kXMLTagTrue "true/" +#define kXMLTagArray "array" +#define kXMLTagReference "reference" +#define kXMLStringID "ID=" +#define kXMLStringIDRef "IDREF=" -#define kXMLStringID "ID=" -#define kXMLStringIDRef "IDREF=" - #define kPropCFBundleIdentifier ("CFBundleIdentifier") #define kPropCFBundleExecutable ("CFBundleExecutable") #define kPropOSBundleRequired ("OSBundleRequired") Index: branches/ErmaC/Trunk/i386/libsaio/hfs.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/hfs.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/hfs.c (revision 1987) @@ -300,9 +300,10 @@ } getDeviceDescription(ih, devStr); +/* verbose("Read HFS%s file: [%s/%s] %d bytes.\n", (gIsHFSPlus ? "+" : ""), devStr, filePath, (uint32_t)length); - +*/ return length; } Index: branches/ErmaC/Trunk/i386/libsaio/gma.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/gma.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/gma.c (revision 1987) @@ -10,13 +10,14 @@ #include "platform.h" #include "device_inject.h" #include "gma.h" +#include "graphics.h" #ifndef DEBUG_GMA #define DEBUG_GMA 0 #endif #if DEBUG_GMA -#define DBG(x...) printf(x) +#define DBG(x...) verbose(x) #else #define DBG(x...) #endif @@ -188,20 +189,21 @@ devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1)); devprop_add_value(device, "device_type", (uint8_t*)"display", 8); - if ((strcmp("Mobile GMA950", model) == 0) || (strcmp("Mobile GMA3150",model) == 0)) + 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 ((strcmp("Desktop GMA950", model) == 0) || (strcmp("Desktop GMA3150",model) == 0)) + else if ((model == (char *)"Desktop GMA950") || (model == (char *)"Desktop GMA3150")) { BuiltIn = 0x01; devprop_add_value(device, "built-in", &BuiltIn, 1); devprop_add_value(device, "class-code", ClassFix, 4); } - else if (strcmp("GMAX3100",model) == 0) + else if (model == (char *)"GMAX3100") { + BuiltIn = gDualLink; devprop_add_value(device, "AAPL,HasPanel", GMAX3100_vals[0], 4); devprop_add_value(device, "AAPL,SelfRefreshSupported", GMAX3100_vals[1], 4); devprop_add_value(device, "AAPL,aux-power-connected", GMAX3100_vals[2], 4); @@ -212,80 +214,83 @@ devprop_add_value(device, "AAPL01,DataJustify", GMAX3100_vals[7], 4); devprop_add_value(device, "AAPL01,Depth", GMAX3100_vals[8], 4); devprop_add_value(device, "AAPL01,Dither", GMAX3100_vals[9], 4); - devprop_add_value(device, "AAPL01,DualLink", GMAX3100_vals[10], 4); + devprop_add_value(device, "AAPL01,DualLink", &BuiltIn, 1); //GMAX3100_vals[10] devprop_add_value(device, "AAPL01,Height", GMAX3100_vals[10], 4); devprop_add_value(device, "AAPL01,Interlace", GMAX3100_vals[11], 4); devprop_add_value(device, "AAPL01,Inverter", GMAX3100_vals[12], 4); devprop_add_value(device, "AAPL01,InverterCurrent", GMAX3100_vals[13], 4); - devprop_add_value(device, "AAPL01,InverterCurrency", GMAX3100_vals[15], 4); +// devprop_add_value(device, "AAPL01,InverterCurrency", GMAX3100_vals[15], 4); devprop_add_value(device, "AAPL01,LinkFormat", GMAX3100_vals[14], 4); devprop_add_value(device, "AAPL01,LinkType", GMAX3100_vals[15], 4); devprop_add_value(device, "AAPL01,Pipe", GMAX3100_vals[16], 4); devprop_add_value(device, "AAPL01,PixelFormat", GMAX3100_vals[17], 4); devprop_add_value(device, "AAPL01,Refresh", GMAX3100_vals[18], 4); devprop_add_value(device, "AAPL01,Stretch", GMAX3100_vals[19], 4); + devprop_add_value(device, "AAPL01,InverterFrequency", GMAX3100_vals[20], 4); devprop_add_value(device, "class-code", ClassFix, 4); + devprop_add_value(device, "subsystem-vendor-id", GMAX3100_vals[21], 4); + devprop_add_value(device, "subsystem-id", GMAX3100_vals[22], 4); } else if (model == (char *)"Intel HD Graphics 2000 Mobile") { - devprop_add_value(device, "class-code", ClassFix, 4); - devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); - devprop_add_value(device, "AAPL00,PixelFormat", HD2000_vals[0], 4); - devprop_add_value(device, "AAPL00,T1", HD2000_vals[1], 4); - devprop_add_value(device, "AAPL00,T2", HD2000_vals[2], 4); - devprop_add_value(device, "AAPL00,T3", HD2000_vals[3], 4); - devprop_add_value(device, "AAPL00,T4", HD2000_vals[4], 4); - devprop_add_value(device, "AAPL00,T5", HD2000_vals[5], 4); - devprop_add_value(device, "AAPL00,T6", HD2000_vals[6], 4); - devprop_add_value(device, "AAPL00,T7", HD2000_vals[7], 4); - devprop_add_value(device, "AAPL00,LinkType", HD2000_vals[8], 4); - devprop_add_value(device, "AAPL00,LinkFormat", HD2000_vals[9], 4); - devprop_add_value(device, "AAPL00,DualLink", HD2000_vals[10], 4); - devprop_add_value(device, "AAPL00,Dither", HD2000_vals[11], 4); - devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4); - devprop_add_value(device, "graphic-options", HD2000_vals[13], 4); - devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18); - devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20); + devprop_add_value(device, "class-code", ClassFix, 4); + devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); + devprop_add_value(device, "AAPL00,PixelFormat", HD2000_vals[0], 4); + devprop_add_value(device, "AAPL00,T1", HD2000_vals[1], 4); + devprop_add_value(device, "AAPL00,T2", HD2000_vals[2], 4); + devprop_add_value(device, "AAPL00,T3", HD2000_vals[3], 4); + devprop_add_value(device, "AAPL00,T4", HD2000_vals[4], 4); + devprop_add_value(device, "AAPL00,T5", HD2000_vals[5], 4); + devprop_add_value(device, "AAPL00,T6", HD2000_vals[6], 4); + devprop_add_value(device, "AAPL00,T7", HD2000_vals[7], 4); + devprop_add_value(device, "AAPL00,LinkType", HD2000_vals[8], 4); + devprop_add_value(device, "AAPL00,LinkFormat", HD2000_vals[9], 4); + devprop_add_value(device, "AAPL00,DualLink", HD2000_vals[10], 4); + devprop_add_value(device, "AAPL00,Dither", HD2000_vals[11], 4); + devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4); + devprop_add_value(device, "graphic-options", HD2000_vals[13], 4); + devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18); + devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20); } else if (model == (char *)"Intel HD Graphics 3000 Mobile") { - devprop_add_value(device, "class-code", ClassFix, 4); - devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); - devprop_add_value(device, "AAPL00,PixelFormat", HD3000_vals[0], 4); - devprop_add_value(device, "AAPL00,T1", HD3000_vals[1], 4); - devprop_add_value(device, "AAPL00,T2", HD3000_vals[2], 4); - devprop_add_value(device, "AAPL00,T3", HD3000_vals[3], 4); - devprop_add_value(device, "AAPL00,T4", HD3000_vals[4], 4); - devprop_add_value(device, "AAPL00,T5", HD3000_vals[5], 4); - devprop_add_value(device, "AAPL00,T6", HD3000_vals[6], 4); - devprop_add_value(device, "AAPL00,T7", HD3000_vals[7], 4); - devprop_add_value(device, "AAPL00,LinkType", HD3000_vals[8], 4); - devprop_add_value(device, "AAPL00,LinkFormat", HD3000_vals[9], 4); - devprop_add_value(device, "AAPL00,DualLink", HD3000_vals[10], 4); - devprop_add_value(device, "AAPL00,Dither", HD3000_vals[11], 4); - devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4); - devprop_add_value(device, "graphic-options", HD3000_vals[13], 4); - devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18); - devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20); + devprop_add_value(device, "class-code", ClassFix, 4); + devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); + devprop_add_value(device, "AAPL00,PixelFormat", HD3000_vals[0], 4); + devprop_add_value(device, "AAPL00,T1", HD3000_vals[1], 4); + devprop_add_value(device, "AAPL00,T2", HD3000_vals[2], 4); + devprop_add_value(device, "AAPL00,T3", HD3000_vals[3], 4); + devprop_add_value(device, "AAPL00,T4", HD3000_vals[4], 4); + devprop_add_value(device, "AAPL00,T5", HD3000_vals[5], 4); + devprop_add_value(device, "AAPL00,T6", HD3000_vals[6], 4); + devprop_add_value(device, "AAPL00,T7", HD3000_vals[7], 4); + devprop_add_value(device, "AAPL00,LinkType", HD3000_vals[8], 4); + devprop_add_value(device, "AAPL00,LinkFormat", HD3000_vals[9], 4); + devprop_add_value(device, "AAPL00,DualLink", HD3000_vals[10], 4); + devprop_add_value(device, "AAPL00,Dither", HD3000_vals[11], 4); + devprop_add_value(device, "AAPL00,DataJustify", HD3000_vals[12], 4); + devprop_add_value(device, "graphic-options", HD3000_vals[13], 4); + devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18); + devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20); } else if (model == (char *)"Intel HD Graphics 2000") { - devprop_add_value(device, "built-in", &BuiltIn, 1); - devprop_add_value(device, "class-code", ClassFix, 4); - devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id)); - devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); - devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18); - devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20); + devprop_add_value(device, "built-in", &BuiltIn, 1); + devprop_add_value(device, "class-code", ClassFix, 4); + devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id)); + devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); + devprop_add_value(device, "AAPL,tbl-info", HD2000_tbl_info, 18); + devprop_add_value(device, "AAPL,os-info", HD2000_os_info, 20); } else if (model == (char *)"Intel HD Graphics 3000") { - devprop_add_value(device, "built-in", &BuiltIn, 1); - devprop_add_value(device, "class-code", ClassFix, 4); + devprop_add_value(device, "built-in", &BuiltIn, 1); + devprop_add_value(device, "class-code", ClassFix, 4); device_id = 0x00000126; // Inject a valid mobile GPU device id instead of patching kexts - devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id)); - devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); - devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18); - devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20); + devprop_add_value(device, "device-id", (uint8_t*)&device_id, sizeof(device_id)); + devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); + devprop_add_value(device, "AAPL,tbl-info", HD3000_tbl_info, 18); + devprop_add_value(device, "AAPL,os-info", HD3000_os_info, 20); } stringdata = malloc(sizeof(uint8_t) * string->length); Index: branches/ErmaC/Trunk/i386/libsaio/befs.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/befs.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/befs.c (revision 1987) @@ -29,7 +29,9 @@ char * buf=malloc (BeFSProbeSize); str[0]=0; if (!buf) + { return; + } Seek(ih, 0); Read(ih, (long)buf, BeFSProbeSize); if (!BeFSProbe (buf)) Index: branches/ErmaC/Trunk/i386/libsaio/device_inject.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/device_inject.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/device_inject.c (revision 1987) @@ -158,7 +158,7 @@ if(!numpaths) { - free(device); + free(device); return NULL; } @@ -193,7 +193,7 @@ { if((string->entries = (struct DevPropDevice**)malloc(sizeof(device)))== NULL) { - free(device); + free(device); return NULL; } } @@ -257,7 +257,7 @@ memcpy(newdata, device->data, offset); } } - + memcpy(newdata + offset, data, length); device->length += length; @@ -364,21 +364,21 @@ int devprop_add_network_template(struct DevPropDevice *device, uint16_t vendor_id) { uint8_t builtin = 0x0; - + if(device) { - + if((vendor_id != 0x168c) && (builtin_set == 0)) { builtin_set = 1; builtin = 0x01; } - + if(!devprop_add_value(device, "built-in", (uint8_t*)&builtin, 1)) { return 0; } - + devices_number++; return 1; } @@ -386,7 +386,7 @@ { return 0; } - + } void set_eth_builtin(pci_dt_t *eth_dev) Index: branches/ErmaC/Trunk/i386/libsaio/dram_controllers.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/dram_controllers.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/dram_controllers.c (revision 1987) @@ -503,14 +503,14 @@ { 0x8086, 0x2A10, "GME965/GLE960", setup_p35, get_fsb_im965, get_timings_im965 }, { 0x8086, 0x2A40, "PM/GM45/47", setup_p35, get_fsb_im965, get_timings_im965 }, - { 0x8086, 0x29B0, "Q35", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x29B0, "Q35", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x29C0, "P35/G33", setup_p35, get_fsb_i965, get_timings_p35 }, - { 0x8086, 0x29D0, "Q33", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x29D0, "Q33", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x29E0, "X38/X48", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E00, "Eaglelake", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E10, "Q45/Q43", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0x2E20, "P45/G45", setup_p35, get_fsb_i965, get_timings_p35 }, - { 0x8086, 0x2E30, "G41", setup_p35, get_fsb_i965, get_timings_p35 }, + { 0x8086, 0x2E30, "G41", setup_p35, get_fsb_i965, get_timings_p35 }, { 0x8086, 0xD131, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, { 0x8086, 0xD132, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, @@ -522,6 +522,7 @@ { 0x8086, 0x3405, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, { 0x8086, 0x3406, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, { 0x8086, 0x3407, "NHM IMC", setup_nhm, get_fsb_nhm, get_timings_nhm }, + }; static const char *memory_channel_types[] = Index: branches/ErmaC/Trunk/i386/libsaio/nvidia.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 1987) @@ -59,7 +59,7 @@ #endif #if DEBUG_NVIDIA -#define DBG(x...) printf(x) +#define DBG(x...) verbose(x) #else #define DBG(x...) #endif @@ -99,16 +99,14 @@ static uint8_t default_dcfg_0[] = {0x03, 0x01, 0x03, 0x00}; static uint8_t default_dcfg_1[] = {0xff, 0xff, 0x00, 0x01}; -// uint8_t connector_type_1[] = {0x00, 0x08, 0x00, 0x00}; - #define DCFG0_LEN ( sizeof(default_dcfg_0) / sizeof(uint8_t) ) #define DCFG1_LEN ( sizeof(default_dcfg_1) / sizeof(uint8_t) ) static uint8_t default_NVPM[]= { - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; #define NVPM_LEN ( sizeof(default_NVPM) / sizeof(uint8_t) ) @@ -157,6 +155,46 @@ // 01B0 - 01BF // 01C0 - 01CF // 01D0 - 01DF + { 0x10DE01D7, 0x1025006C, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x10250090, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x10250096, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x10250100, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x10250107, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x10250110, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x10250112, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x102501C2, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x102501C8, "Acer GeForce Go 7300" }, + { 0x10DE01D7, 0x102801C2, "Dell Quadro NVS 110M" }, + { 0x10DE01D7, 0x102801C8, "Dell GeForce Go 7300" }, + { 0x10DE01D7, 0x102801CC, "Dell Quadro NVS 110M" }, + { 0x10DE01D7, 0x102801D7, "Dell GeForce Go 7300" }, + { 0x10DE01D7, 0x102801E2, "Dell GeForce Go 7300" }, + { 0x10DE01D7, 0x102801F9, "Dell GeForce Go 7300" }, + { 0x10DE01D7, 0x102801FE, "Dell GeForce Go 7300" }, + { 0x10DE01D7, 0x10282003, "Dell GeForce Go 7300" }, + { 0x10DE01D7, 0x10338848, "NEC GeForce Go 7300" }, + { 0x10DE01D7, 0x103C30B2, "HP GeForce Go 7300" }, + { 0x10DE01D7, 0x103C30B7, "HP GeForce Go 7300" }, + { 0x10DE01D7, 0x10431212, "Asus GeForce Go 7300" }, + { 0x10DE01D7, 0x104313A2, "Asus GeForce Go 7300" }, + { 0x10DE01D7, 0x10431441, "Asus GeForce Go 7300" }, + { 0x10DE01D7, 0x10DE0000, "nVidia GeForce Go 7300" }, + { 0x10DE01D7, 0x10DE014B, "nVidia Quadro NVS 110M" }, + { 0x10DE01D7, 0x11790001, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x11790002, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x1179FF00, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x1179FF01, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x1179FF02, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x1179FF10, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x1179FF31, "Toshiba GeForce Go 7300" }, + { 0x10DE01D7, 0x13DC1172, "Netbost GeForce Go 7300" }, + { 0x10DE01D7, 0x144D8063, "Samsung GeForce Go 7300" }, + { 0x10DE01D7, 0x144DC024, "Samsung GeForce Go 7300" }, + { 0x10DE01D7, 0x144DC026, "Samsung GeForce Go 7300" }, + { 0x10DE01D7, 0x144DC513, "Samsung GeForce Go 7300" }, + { 0x10DE01D7, 0x14C00012, "Compal GeForce Go 7300" }, + + { 0x10DE01D7, 0xC0181631, "GeForce Go 7300" }, { 0x10DE01D8, 0x10250090, "Acer GeForce Go 7400" }, { 0x10DE01D8, 0x102801C8, "Dell GeForce Go 7400" }, { 0x10DE01D8, 0x102801CC, "Dell Quadro NVS 120M" }, @@ -337,6 +375,7 @@ { 0x10DE05E2, 0x104382C4, "Asus GTX 260" }, { 0x10DE05E2, 0x104382CF, "Asus GTX 260" }, { 0x10DE05E2, 0x104382E3, "Asus GTX 260" }, + { 0x10DE05E2, 0x104382EB, "ASUS ENGTX260" }, { 0x10DE05E2, 0x10B00801, "Gainward GTX 260" }, { 0x10DE05E2, 0x10DE0585, "nVidia GTX 260" }, { 0x10DE05E2, 0x10DE0617, "nVidia GTX 260" }, @@ -963,7 +1002,7 @@ { 0x10DE01D2, NV_SUB_IDS, "GeForce 7550 LE" }, { 0x10DE01D3, NV_SUB_IDS, "GeForce 7300 SE/7200 GS" }, { 0x10DE01D6, NV_SUB_IDS, "GeForce Go 7200" }, - { 0x10DE01D7, NV_SUB_IDS, "Quadro NVS 110M / GeForce Go 7300" }, // 71 SubID + { 0x10DE01D7, NV_SUB_IDS, "Quadro NVS 110M / GeForce Go 7300" }, { 0x10DE01D8, NV_SUB_IDS, "GeForce Go 7400" }, { 0x10DE01D9, NV_SUB_IDS, "GeForce Go 7450" }, { 0x10DE01DA, NV_SUB_IDS, "Quadro NVS 110M" }, Index: branches/ErmaC/Trunk/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1987) @@ -804,7 +804,11 @@ { 0x6818, 0x042F1043, CHIP_FAMILY_PITCAIRN, "Asus HD 7870", kNull }, { 0x6818, 0x04311043, CHIP_FAMILY_PITCAIRN, "Asus HD 7870", kNull }, { 0x6818, 0x0B041002, CHIP_FAMILY_PITCAIRN, "ATI Radeon HD 7870", kNull }, + { 0x6818, 0x201C1787, CHIP_FAMILY_PITCAIRN, "ATI Radeon HD 7870", kNull }, + { 0x6818, 0x23211787, CHIP_FAMILY_PITCAIRN, "ATI Radeon HD 7870", kNull }, { 0x6818, 0x25541458, CHIP_FAMILY_PITCAIRN, "Gigabyte HD 7870", kNull }, + { 0x6818, 0x27401462, CHIP_FAMILY_PITCAIRN, "ATI Radeon HD 7870", kNull }, + { 0x6818, 0x32501682, CHIP_FAMILY_PITCAIRN, "ATI Radeon HD 7870", kNull }, { 0x6818, 0xE217174B, CHIP_FAMILY_PITCAIRN, "ATI Radeon HD 7870", kNull }, { 0x6819, 0x04311043, CHIP_FAMILY_PITCAIRN, "Asus HD 7850", kNull }, @@ -974,12 +978,12 @@ /* IGP */ - { 0x791E, 0x00000000, CHIP_FAMILY_RS690, "ATI Radeon IGP ", kNull }, - { 0x791F, 0x00000000, CHIP_FAMILY_RS690, "ATI Radeon IGP ", kNull }, - { 0x796C, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon IGP ", kNull }, - { 0x796D, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon IGP ", kNull }, - { 0x796E, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon IGP ", kNull }, - { 0x796F, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon HD ", kNull }, + { 0x791E, 0x00000000, CHIP_FAMILY_RS690, "ATI Radeon IGP ", kNull }, + { 0x791F, 0x00000000, CHIP_FAMILY_RS690, "ATI Radeon IGP ", kNull }, + { 0x796C, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon IGP ", kNull }, + { 0x796D, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon IGP ", kNull }, + { 0x796E, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon IGP ", kNull }, + { 0x796F, 0x00000000, CHIP_FAMILY_RS740, "ATI Radeon HD ", kNull }, /* standard/default models */ @@ -993,15 +997,16 @@ { 0x940F, 0x00000000, CHIP_FAMILY_R600, "ATI Radeon HD 2900 GT", kNull }, { 0x9440, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4800 Series", kMotmot }, - { 0x9441, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4870 X2", kMotmot }, + { 0x9441, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4870 X2", kMotmot }, { 0x9442, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4800 Series", kMotmot }, { 0x9443, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4850 X2", kMotmot }, + { 0x9444, 0x00000000, CHIP_FAMILY_RV770, "ATI FirePro V8750 (FireGL)", kMotmot }, { 0x944A, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4800 Series", kMotmot }, { 0x944C, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4800 Series", kMotmot }, { 0x944E, 0x00000000, CHIP_FAMILY_RV770, "ATI Radeon HD 4700 Series", kMotmot }, - { 0x9450, 0x00000000, CHIP_FAMILY_RV770, "AMD FireStream 9270", kMotmot }, - { 0x9452, 0x00000000, CHIP_FAMILY_RV770, "AMD FireStream 9250", kMotmot }, + { 0x9450, 0x00000000, CHIP_FAMILY_RV770, "AMD FireStream 9270", kMotmot }, + { 0x9452, 0x00000000, CHIP_FAMILY_RV770, "AMD FireStream 9250", kMotmot }, { 0x9460, 0x00000000, CHIP_FAMILY_RV790, "ATI Radeon HD 4800 Series", kMotmot }, { 0x9462, 0x00000000, CHIP_FAMILY_RV790, "ATI Radeon HD 4800 Series", kMotmot }, @@ -1102,6 +1107,7 @@ { 0x6898, 0x00000000, CHIP_FAMILY_CYPRESS, "ATI Radeon HD 5800 Series", kUakari }, { 0x6899, 0x00000000, CHIP_FAMILY_CYPRESS, "ATI Radeon HD 5800 Series", kUakari }, +// { 0x689B, 0x00000000, CHIP_FAMILY_???, "AMD Radeon HD 6800 Series", kNull }, { 0x689C, 0x00000000, CHIP_FAMILY_HEMLOCK, "ATI Radeon HD 5900 Series", kUakari }, { 0x689E, 0x00000000, CHIP_FAMILY_CYPRESS, "ATI Radeon HD 5800 Series", kUakari }, Index: branches/ErmaC/Trunk/i386/libsaio/sys.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/sys.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/sys.c (revision 1987) @@ -798,11 +798,11 @@ hd++; } - // Also scanning CD/DVD drive. + // Also scanning CD/DVD drive. if (biosDevIsCDROM(gBIOSDev)) { - bvCount = 0; - scanBootVolumes(gBIOSDev, &bvCount); + bvCount = 0; + scanBootVolumes(gBIOSDev, &bvCount); } } @@ -1000,7 +1000,7 @@ if (*cp == RP) cp++; biosdev = dp->biosdev + unit; - bvr = newBootVolumeRef(biosdev, part); + bvr = newBootVolumeRef(biosdev, part); if(bvr == NULL) return NULL; Index: branches/ErmaC/Trunk/i386/libsaio/nvidia.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/nvidia.h (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/nvidia.h (revision 1987) @@ -70,9 +70,9 @@ uint8_t size; /* Size in multiples of 512 */ }; -#define NV_SUB_IDS 0x00000000 +#define NV_SUB_IDS 0x00000000 #define NV_PMC_OFFSET 0x000000 -#define NV_PMC_SIZE 0x2ffff +#define NV_PMC_SIZE 0x2ffff #define NV_PDISPLAY_OFFSET 0x610000 #define NV_PDISPLAY_SIZE 0x10000 @@ -81,10 +81,10 @@ #define NV_PRAMIN_OFFSET 0x00700000 #define NV_PRAMIN_SIZE 0x00100000 #define NV04_PFB_FIFO_DATA 0x0010020c -#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK 0xfff00000 -#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT 20 -#define NVC0_MEM_CTRLR_COUNT 0x00121c74 -#define NVC0_MEM_CTRLR_RAM_AMOUNT 0x0010f20c +#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK 0xfff00000 +#define NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_SHIFT 20 +#define NVC0_MEM_CTRLR_COUNT 0x00121c74 +#define NVC0_MEM_CTRLR_RAM_AMOUNT 0x0010f20c #define NV_PBUS_PCI_NV_20 0x00001850 #define NV_PBUS_PCI_NV_20_ROM_SHADOW_DISABLED (0 << 0) Index: branches/ErmaC/Trunk/i386/libsaio/platform.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/platform.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/platform.c (revision 1987) @@ -29,9 +29,12 @@ /** Return if a CPU feature specified by feature is activated (true) or not (false) */ bool platformCPUFeature(uint32_t feature) { - if (Platform.CPU.Features & feature) { + if (Platform.CPU.Features & feature) + { return true; - } else { + } + else + { return false; } } Index: branches/ErmaC/Trunk/i386/libsaio/cpu.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/cpu.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/cpu.c (revision 1987) @@ -140,7 +140,7 @@ * Hz so we need to convert our milliseconds to seconds. Since we're * dividing by the milliseconds, we simply multiply by 1000. */ - + /* Unlike linux, we're not limited to 32-bit, but we do need to take care * that we're going to multiply by 1000 first so we do need at least some * arithmetic headroom. For now, 32-bit should be enough. @@ -227,13 +227,13 @@ uint64_t msr, flex_ratio; uint8_t maxcoef, maxdiv, currcoef, bus_ratio_max, currdiv; const char *newratio; - int len, myfsb; + int len, myfsb; uint8_t bus_ratio_min; uint32_t max_ratio, min_ratio; - + max_ratio = min_ratio = myfsb = bus_ratio_min = 0; maxcoef = maxdiv = bus_ratio_max = currcoef = currdiv = 0; - + /* get cpuid values */ do_cpuid(0x00000000, p->CPU.CPUID[CPUID_0]); do_cpuid(0x00000001, p->CPU.CPUID[CPUID_1]); @@ -248,7 +248,7 @@ else if ((p->CPU.CPUID[CPUID_80][0] & 0x0000000f) >= 1) { do_cpuid(0x80000001, p->CPU.CPUID[CPUID_81]); } - + #if DEBUG_CPU { int i; @@ -260,7 +260,7 @@ } } #endif - + p->CPU.Vendor = p->CPU.CPUID[CPUID_0][1]; p->CPU.Signature = p->CPU.CPUID[CPUID_1][0]; p->CPU.Stepping = bitfield(p->CPU.CPUID[CPUID_1][0], 3, 0); @@ -268,9 +268,9 @@ p->CPU.Family = bitfield(p->CPU.CPUID[CPUID_1][0], 11, 8); p->CPU.ExtModel = bitfield(p->CPU.CPUID[CPUID_1][0], 19, 16); p->CPU.ExtFamily = bitfield(p->CPU.CPUID[CPUID_1][0], 27, 20); - + p->CPU.Model += (p->CPU.ExtModel << 4); - + if (p->CPU.Vendor == CPUID_VENDOR_INTEL && p->CPU.Family == 0x06 && p->CPU.Model >= CPUID_MODEL_NEHALEM && @@ -292,7 +292,7 @@ p->CPU.NoThreads = bitfield(p->CPU.CPUID[CPUID_1][1], 23, 16); p->CPU.NoCores = bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1; } - + /* get brand string (if supported) */ /* Copyright: from Apple's XNU cpuid.c */ if (p->CPU.CPUID[CPUID_80][0] > 0x80000004) { @@ -352,7 +352,7 @@ if (p->CPU.NoThreads > p->CPU.NoCores) { p->CPU.Features |= CPU_FEATURE_HTT; } - + tscFrequency = measure_tsc_frequency(); DBG("cpu freq classic = 0x%016llx\n", tscFrequency); /* if usual method failed */ @@ -366,7 +366,7 @@ } fsbFrequency = 0; cpuFrequency = 0; - + if ((p->CPU.Vendor == CPUID_VENDOR_INTEL) && ((p->CPU.Family == 0x06) || (p->CPU.Family == 0x0f))) { int intelCPU = p->CPU.Model; if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) || (p->CPU.Family == 0x0f && p->CPU.Model >= 0x03)) { @@ -408,7 +408,7 @@ } } } - + if (bus_ratio_max) { fsbFrequency = (tscFrequency / bus_ratio_max); } @@ -424,9 +424,9 @@ max_ratio = atoi(newratio); max_ratio = (max_ratio * 10); if (len >= 3) max_ratio = (max_ratio + 5); - + verbose("Bus-Ratio: min=%d, max=%s\n", bus_ratio_min, newratio); - + // extreme overclockers may love 320 ;) if ((max_ratio >= min_ratio) && (max_ratio <= 320)) { cpuFrequency = (fsbFrequency * max_ratio) / 10; @@ -440,7 +440,7 @@ /*if (bus_ratio_max > 0) bus_ratio = flex_ratio;*/ p->CPU.MaxRatio = max_ratio; p->CPU.MinRatio = min_ratio; - + myfsb = fsbFrequency / 1000000; verbose("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", myfsb, max_ratio); currcoef = bus_ratio_max; @@ -452,7 +452,7 @@ maxdiv = bitfield(msr, 46, 46); /* Non-integer bus ratio for the current-multi (undocumented)*/ currdiv = bitfield(msr, 14, 14); - + // This will always be model >= 3 if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) || (p->CPU.Family == 0x0f)) { @@ -463,7 +463,7 @@ /* XXX */ maxcoef = currcoef; } - + if (maxcoef) { if (maxdiv) { fsbFrequency = ((tscFrequency * 2) / ((maxcoef * 2) + 1)); @@ -493,7 +493,7 @@ maxcoef = bitfield(msr, 21, 16) / 2 + 4; currcoef = bitfield(msr, 5, 0) / 2 + 4; break; - + case 0x01: /* K10 */ msr = rdmsr64(K10_COFVID_STATUS); do_cpuid2(0x00000006, 0, p->CPU.CPUID[CPUID_6]); @@ -509,22 +509,22 @@ maxcoef = bitfield(msr, 54, 49) / 2 + 4; currcoef = bitfield(msr, 5, 0) + 0x10; currdiv = 2 << bitfield(msr, 8, 6); - + break; - + case 0x05: /* K14 */ msr = rdmsr64(K10_COFVID_STATUS); currcoef = (bitfield(msr, 54, 49) + 0x10) << 2; currdiv = (bitfield(msr, 8, 4) + 1) << 2; currdiv += bitfield(msr, 3, 0); - + break; - + case 0x02: /* K11 */ // not implimented break; } - + if (maxcoef) { if (currdiv) @@ -534,7 +534,7 @@ fsbFrequency = ((tscFrequency * currdiv) / currcoef); else fsbFrequency = ((cpuFrequency * currdiv) / currcoef); - + DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv); } else { if (!cpuFrequency) @@ -568,7 +568,7 @@ DBG("cpu freq = 0x%016llxn", timeRDTSC() * 20); #endif - + p->CPU.MaxCoef = maxcoef; p->CPU.MaxDiv = maxdiv; p->CPU.CurrCoef = currcoef; @@ -576,7 +576,7 @@ p->CPU.TSCFrequency = tscFrequency; p->CPU.FSBFrequency = fsbFrequency; p->CPU.CPUFrequency = cpuFrequency; - + // keep formatted with spaces instead of tabs DBG("CPU: Brand String: %s\n", p->CPU.BrandString); DBG("CPU: Vendor/Family/ExtFamily: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Family, p->CPU.ExtFamily); Index: branches/ErmaC/Trunk/i386/libsaio/platform.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/platform.h (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/platform.h (revision 1987) @@ -83,7 +83,7 @@ #define SMB_MEM_TYPE_DDR 18 #define SMB_MEM_TYPE_DDR2 19 #define SMB_MEM_TYPE_FBDIMM 20 -#define SMB_MEM_TYPE_DDR3 24 // Supported in 10.5.6+ AppleSMBIOS +#define SMB_MEM_TYPE_DDR3 24 // Supported in 10.5.6+ AppleSMBIOS /* Memory Configuration Types */ #define SMB_MEM_CHANNEL_UNKNOWN 0 @@ -138,7 +138,7 @@ char BrandString[48]; // 48 Byte Branding String uint32_t CPUID[CPUID_MAX][4]; // CPUID 0..4, 80..81 Raw Values } CPU; - + struct RAM { uint64_t Frequency; // Ram Frequency uint32_t Divider; // Memory divider @@ -151,15 +151,15 @@ uint8_t Type; // Standard SMBIOS v2.5 Memory Type RamSlotInfo_t DIMM[MAX_RAM_SLOTS]; // Information about each slot } RAM; - + struct DMI { - int MaxMemorySlots; // number of memory slots populated by SMBIOS - int CntMemorySlots; // number of memory slots counted - int MemoryModules; // number of memory modules installed - int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot + int MaxMemorySlots; // number of memory slots populated by SMBIOS + int CntMemorySlots; // number of memory slots counted + int MemoryModules; // number of memory modules installed + int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot } DMI; - - uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) + + uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) uint8_t *UUID; } PlatformInfo_t; Index: branches/ErmaC/Trunk/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/disk.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/disk.c (revision 1987) @@ -80,11 +80,13 @@ #include "disk.h" // For EFI_GUID #include "efi.h" -#include "efi_tables.h" + typedef struct gpt_hdr gpt_hdr; typedef struct gpt_ent gpt_ent; +#include "efi_tables.h" + #define PROBEFS_SIZE BPS * 4 /* buffer size for filesystem probe */ #define CD_BPS 2048 /* CD-ROM block size */ #define N_CACHE_SECS (BIOS_LEN / BPS) /* Must be a multiple of 4 for CD-ROMs */ @@ -92,43 +94,31 @@ #define kAPMSector 2 /* Sector number of Apple partition map */ #define kAPMCDSector 8 /* Translated sector of Apple partition map on a CD */ -/* - * IORound and IOTrunc convenience functions, in the spirit - * of vm's round_page() and trunc_page(). - */ -#define IORound(value,multiple) \ - ((((value) + (multiple) - 1) / (multiple)) * (multiple)) +// IORound and IOTrunc convenience functions, in the spirit of vm's round_page() and trunc_page(). +#define IORound(value, multiple) ((((value) + (multiple) - 1) / (multiple)) * (multiple)) +#define IOTrunc(value, multiple) (((value) / (multiple)) * (multiple)); -#define IOTrunc(value,multiple) \ - (((value) / (multiple)) * (multiple)); +// trackbuf points to the start of the track cache. Biosread() +// will store the sectors read from disk to this memory area. +static char * const trackbuf = (char *) ptov(BIOS_ADDR); -/* - * trackbuf points to the start of the track cache. Biosread() - * will store the sectors read from disk to this memory area. - * - * biosbuf points to a sector within the track cache, and is - * updated by Biosread(). - */ -static char * const trackbuf = (char *) ptov(BIOS_ADDR); +// biosbuf points to a sector within the track cache, and is updated by Biosread(). static char * biosbuf; -/* - * Map a disk drive to bootable volumes contained within. - */ -struct DiskBVMap { - int biosdev; // BIOS device number (unique) - BVRef bvr; // chain of boot volumes on the disk - int bvrcnt; // number of boot volumes - struct DiskBVMap * next; // linkage to next mapping +// Map a disk drive to bootable volumes contained within. +struct DiskBVMap +{ + int biosdev; // BIOS device number (unique). + BVRef bvr; // Chain of boot volumes on the disk. + int bvrcnt; // Number of boot volumes. + struct DiskBVMap * next; // Linkage to next mapping. }; static struct DiskBVMap * gDiskBVMap = NULL; static struct disk_blk0 * gBootSector = NULL; -// Function pointers to be filled in if ramdisks are available: -int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno, - unsigned int byteoff, - unsigned int byteCount, void * buffer ) = NULL; +// Function pointers to be filled in when a ramdisk is available: +int (*p_ramdiskReadBytes)(int biosdev, unsigned int blkno, unsigned int byteoff, unsigned int byteCount, void * buffer) = NULL; int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip) = NULL; static bool getOSVersion(BVRef bvr, char *str); @@ -137,275 +127,294 @@ //========================================================================== -static int getDriveInfo( int biosdev, struct driveInfo *dip ) +static int getDriveInfo(int biosdev, struct driveInfo *dip) { - static struct driveInfo cached_di; - int cc; - - // Real BIOS devices are 8-bit, so anything above that is for internal use. - // Don't cache ramdisk drive info since it doesn't require several BIOS - // calls and is thus not worth it. - if(biosdev >= 0x100) - { - if(p_get_ramdisk_info != NULL) - cc = (*p_get_ramdisk_info)(biosdev, dip); - else - cc = -1; - if(cc < 0) - { - dip->valid = 0; - return -1; - } - else - return 0; - } + static struct driveInfo cached_di; + int cc; - if ( !cached_di.valid || biosdev != cached_di.biosdev ) - { + // Real BIOS devices are 8-bit, so anything above that is for internal use. + // Don't cache ramdisk drive info since it doesn't require several BIOS + // calls and is thus not worth it. + if (biosdev >= 0x100) + { + if (p_get_ramdisk_info != NULL) + { + cc = (*p_get_ramdisk_info)(biosdev, dip); + } + else + { + cc = -1; + } + if (cc < 0) + { + dip->valid = 0; + return -1; + } + else + { + return 0; + } + } + + if (!cached_di.valid || biosdev != cached_di.biosdev) + { cc = get_drive_info(biosdev, &cached_di); - if (cc < 0) { - cached_di.valid = 0; - DEBUG_DISK(("get_drive_info returned error\n")); - return (-1); // BIOS call error + + if (cc < 0) + { + cached_di.valid = 0; + DEBUG_DISK(("get_drive_info returned error\n")); + return (-1); // BIOS call error + } } - } - bcopy(&cached_di, dip, sizeof(cached_di)); + bcopy(&cached_di, dip, sizeof(cached_di)); - return 0; + return 0; } //========================================================================== // Maps (E)BIOS return codes to message strings. -struct NamedValue { - unsigned char value; - const char * name; +struct NamedValue +{ + unsigned char value; + const char * name; }; -static const char * getNameForValue( const struct NamedValue * nameTable, - unsigned char value ) +static const char * getNameForValue(const struct NamedValue * nameTable, unsigned char value) { - const struct NamedValue * np; + const struct NamedValue * np; - for ( np = nameTable; np->value; np++) - if (np->value == value) - return np->name; - - return NULL; + for ( np = nameTable; np->value; np++) + { + if (np->value == value) + { + return np->name; + } + } + return NULL; } #define ECC_CORRECTED_ERR 0x11 static const struct NamedValue bios_errors[] = { - { 0x10, "Media error" }, - { 0x11, "Corrected ECC error" }, - { 0x20, "Controller or device error" }, - { 0x40, "Seek failed" }, - { 0x80, "Device timeout" }, - { 0xAA, "Drive not ready" }, - { 0x00, 0 } + { 0x10, "Media error" }, + { 0x11, "Corrected ECC error" }, + { 0x20, "Controller or device error" }, + { 0x40, "Seek failed" }, + { 0x80, "Device timeout" }, + { 0xAA, "Drive not ready" }, + { 0x00, 0 } }; static const char * bios_error(int errnum) { - static char errorstr[] = "Error 0x00"; - const char * errname; + static char errorstr[] = "Error 0x00"; + const char * errname; - errname = getNameForValue( bios_errors, errnum ); - if ( errname ) return errname; + errname = getNameForValue(bios_errors, errnum); - sprintf(errorstr, "Error 0x%02x", errnum); - return errorstr; // No string, print error code only + if (errname) + { + return errname; + } + + sprintf(errorstr, "Error 0x%02x", errnum); + return errorstr; // No string, print error code only } //========================================================================== -// Use BIOS INT13 calls to read the sector specified. This function will -// also perform read-ahead to cache a few subsequent sector to the sector -// cache. +// Use BIOS INT13 calls to read the sector specified. This function will also +// perform read-ahead to cache a few subsequent sector to the sector cache. // -// Return: -// 0 on success, or an error code from INT13/F2 or INT13/F42 BIOS call. +// Returns 0 on success, or an error code from INT13/F2 or INT13/F42 BIOS call. static bool cache_valid = false; -static int Biosread( int biosdev, unsigned long long secno ) +static int Biosread(int biosdev, unsigned long long secno) { - static int xbiosdev, xcyl, xhead; - static unsigned int xsec, xnsecs; - struct driveInfo di; + static int xbiosdev, xcyl, xhead; + static unsigned int xsec, xnsecs; + struct driveInfo di; - int rc = -1; - int cyl, head, sec; - int tries = 0; - int bps, divisor; + int rc = -1; + int cyl, head, sec; + int tries = 0; + int bps, divisor; - if (getDriveInfo(biosdev, &di) < 0) { - return -1; - } - if (di.no_emulation) { - /* Always assume 2k block size; BIOS may lie about geometry */ - bps = 2048; - } else { - bps = di.di.params.phys_nbps; - if (bps == 0) { - return -1; - } - } - divisor = bps / BPS; + if (getDriveInfo(biosdev, &di) < 0) + { + return -1; + } + if (di.no_emulation) + { + /* Always assume 2k block size; BIOS may lie about geometry */ + bps = 2048; + } + else + { + bps = di.di.params.phys_nbps; - DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps)); + if (bps == 0) + { + return -1; + } + } + divisor = bps / BPS; - // To read the disk sectors, use EBIOS if we can. Otherwise, - // revert to the standard BIOS calls. + DEBUG_DISK(("Biosread dev %x sec %d bps %d\n", biosdev, secno, bps)); - if ((biosdev >= kBIOSDevTypeHardDrive) && - (di.uses_ebios & EBIOS_FIXED_DISK_ACCESS)) - { - if (cache_valid && - (biosdev == xbiosdev) && - (secno >= xsec) && - ((unsigned int)secno < (xsec + xnsecs))) - { - biosbuf = trackbuf + (BPS * (secno - xsec)); - return 0; - } + // To read the disk sectors, use EBIOS if we can. Otherwise, + // revert to the standard BIOS calls. - xnsecs = N_CACHE_SECS; - xsec = (secno / divisor) * divisor; - cache_valid = false; + if ((biosdev >= kBIOSDevTypeHardDrive) && (di.uses_ebios & EBIOS_FIXED_DISK_ACCESS)) + { + if (cache_valid && (biosdev == xbiosdev) && (secno >= xsec) && ((unsigned int)secno < (xsec + xnsecs))) + { + biosbuf = trackbuf + (BPS * (secno - xsec)); + return 0; + } - while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5)) - { - if (rc == ECC_CORRECTED_ERR) { - /* Ignore corrected ECC errors */ - rc = 0; - break; - } - error(" EBIOS read error: %s\n", bios_error(rc), rc); - error(" Block 0x%x Sectors %d\n", secno, xnsecs); - sleep(1); - } - } - else - { - /* spc = spt * heads */ - int spc = (di.di.params.phys_spt * di.di.params.phys_heads); - cyl = secno / spc; - head = (secno % spc) / di.di.params.phys_spt; - sec = secno % di.di.params.phys_spt; + xnsecs = N_CACHE_SECS; + xsec = (secno / divisor) * divisor; + cache_valid = false; - if (cache_valid && - (biosdev == xbiosdev) && - (cyl == xcyl) && - (head == xhead) && - ((unsigned int)sec >= xsec) && - ((unsigned int)sec < (xsec + xnsecs))) - { - // this sector is in trackbuf cache - biosbuf = trackbuf + (BPS * (sec - xsec)); - return 0; - } + while ((rc = ebiosread(biosdev, secno / divisor, xnsecs / divisor)) && (++tries < 5)) + { + if (rc == ECC_CORRECTED_ERR) + { + /* Ignore corrected ECC errors */ + rc = 0; + break; + } - // Cache up to a track worth of sectors, but do not cross a - // track boundary. + error(" EBIOS read error: %s\n", bios_error(rc), rc); + error(" Block 0x%x Sectors %d\n", secno, xnsecs); + sleep(1); + } + } - xcyl = cyl; - xhead = head; - xsec = sec; - xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS; - cache_valid = false; + else + { + /* spc = spt * heads */ + int spc = (di.di.params.phys_spt * di.di.params.phys_heads); + cyl = secno / spc; + head = (secno % spc) / di.di.params.phys_spt; + sec = secno % di.di.params.phys_spt; - while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) && - (++tries < 5)) - { - if (rc == ECC_CORRECTED_ERR) { - /* Ignore corrected ECC errors */ - rc = 0; - break; - } - error(" BIOS read error: %s\n", bios_error(rc), rc); - error(" Block %d, Cyl %d Head %d Sector %d\n", - secno, cyl, head, sec); - sleep(1); - } - } + if (cache_valid && (biosdev == xbiosdev) && (cyl == xcyl) && + (head == xhead) && ((unsigned int)sec < (xsec + xnsecs))) + { + // this sector is in trackbuf cache + biosbuf = trackbuf + (BPS * (sec - xsec)); + return 0; + } - // If the BIOS reported success, mark the sector cache as valid. + // Cache up to a track worth of sectors, but do not cross a track boundary. - if (rc == 0) { - cache_valid = true; - } - biosbuf = trackbuf + (secno % divisor) * BPS; - xbiosdev = biosdev; + xcyl = cyl; + xhead = head; + xsec = sec; + xnsecs = ((unsigned int)(sec + N_CACHE_SECS) > di.di.params.phys_spt) ? (di.di.params.phys_spt - sec) : N_CACHE_SECS; + + cache_valid = false; + + while ((rc = biosread(biosdev, cyl, head, sec, xnsecs)) && (++tries < 5)) + { + if (rc == ECC_CORRECTED_ERR) + { + /* Ignore corrected ECC errors */ + rc = 0; + break; + } + error(" BIOS read error: %s\n", bios_error(rc), rc); + error(" Block %d, Cyl %d Head %d Sector %d\n", + secno, cyl, head, sec); + sleep(1); + } + } + + // If the BIOS reported success, mark the sector cache as valid. + + if (rc == 0) + { + cache_valid = true; + } + + biosbuf = trackbuf + (secno % divisor) * BPS; + xbiosdev = biosdev; - spinActivityIndicator(xnsecs); + spinActivityIndicator(xnsecs); - return rc; + return rc; } //========================================================================== -int testBiosread( int biosdev, unsigned long long secno ) +int testBiosread(int biosdev, unsigned long long secno) { return Biosread(biosdev, secno); } //========================================================================== -static int readBytes( int biosdev, unsigned long long blkno, - unsigned int byteoff, - unsigned int byteCount, void * buffer ) +static int readBytes(int biosdev, unsigned long long blkno, unsigned int byteoff, unsigned int byteCount, void * buffer) { - // ramdisks require completely different code for reading. - if(p_ramdiskReadBytes != NULL && biosdev >= 0x100) - return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer); + // ramdisks require completely different code for reading. + if(p_ramdiskReadBytes != NULL && biosdev >= 0x100) + { + return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer); + } - char * cbuf = (char *) buffer; - int error; - int copy_len; + char * cbuf = (char *) buffer; + int error; + int copy_len; - DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__, - biosdev, blkno, byteCount, (unsigned)cbuf)); + DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__, biosdev, blkno, byteCount, (unsigned)cbuf)); - for ( ; byteCount; cbuf += copy_len, blkno++ ) - { - error = Biosread( biosdev, blkno ); - if ( error ) - { - DEBUG_DISK(("error\n")); - return (-1); - } + for (; byteCount; cbuf += copy_len, blkno++) + { + error = Biosread(biosdev, blkno); - copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount; - bcopy( biosbuf + byteoff, cbuf, copy_len ); - byteCount -= copy_len; - byteoff = 0; - } + if (error) + { + DEBUG_DISK(("error\n")); + return (-1); + } - DEBUG_DISK(("done\n")); + copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount; + bcopy( biosbuf + byteoff, cbuf, copy_len ); + byteCount -= copy_len; + byteoff = 0; + } - return 0; + DEBUG_DISK(("done\n")); + + return 0; } //========================================================================== static int isExtendedFDiskPartition( const struct fdisk_part * part ) { - static unsigned char extParts[] = - { - 0x05, /* Extended */ - 0x0f, /* Win95 extended */ - 0x85, /* Linux extended */ - }; + static unsigned char extParts[] = + { + 0x05, /* Extended */ + 0x0f, /* Win95 extended */ + 0x85, /* Linux extended */ + }; - unsigned int i; + unsigned int i; - for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++) - { - if (extParts[i] == part->systid) return 1; - } - return 0; + for (i = 0; i < sizeof(extParts)/sizeof(extParts[0]); i++) + { + if (extParts[i] == part->systid) + { + return 1; + } + } + return 0; } //========================================================================== @@ -413,87 +422,88 @@ static int getNextFDiskPartition( int biosdev, int * partno, const struct fdisk_part ** outPart ) { - static int sBiosdev = -1; - static int sNextPartNo; - static unsigned int sFirstBase; - static unsigned int sExtBase; - static unsigned int sExtDepth; - static struct fdisk_part * sExtPart; - struct fdisk_part * part; + static int sBiosdev = -1; + static int sNextPartNo; + static unsigned int sFirstBase; + static unsigned int sExtBase; + static unsigned int sExtDepth; + static struct fdisk_part * sExtPart; + struct fdisk_part * part; - if ( sBiosdev != biosdev || *partno < 0 ) - { - // Fetch MBR. - if ( readBootSector( biosdev, DISK_BLK0, 0 ) ) return 0; + if ( sBiosdev != biosdev || *partno < 0 ) + { + // Fetch MBR. + if ( readBootSector( biosdev, DISK_BLK0, 0 ) ) return 0; - sBiosdev = biosdev; - sNextPartNo = 0; - sFirstBase = 0; - sExtBase = 0; - sExtDepth = 0; - sExtPart = NULL; - } + sBiosdev = biosdev; + sNextPartNo = 0; + sFirstBase = 0; + sExtBase = 0; + sExtDepth = 0; + sExtPart = NULL; + } - while (1) - { - part = NULL; + while (1) + { + part = NULL; - if ( sNextPartNo < FDISK_NPART ) - { - part = (struct fdisk_part *) gBootSector->parts[sNextPartNo]; - } - else if ( sExtPart ) - { - unsigned int blkno = sExtPart->relsect + sFirstBase; + if ( sNextPartNo < FDISK_NPART ) + { + part = (struct fdisk_part *) gBootSector->parts[sNextPartNo]; + } + else if ( sExtPart ) + { + unsigned int blkno = sExtPart->relsect + sFirstBase; - // Save the block offset of the first extended partition. + // Save the block offset of the first extended partition. - if (sExtDepth == 0) { - sFirstBase = blkno; - } - sExtBase = blkno; + if (sExtDepth == 0) + { + sFirstBase = blkno; + } + sExtBase = blkno; - // Load extended partition table. + // Load extended partition table. - if ( readBootSector( biosdev, blkno, 0 ) == 0 ) - { - sNextPartNo = 0; - sExtDepth++; - sExtPart = NULL; - continue; - } - // Fall through to part == NULL - } + if ( readBootSector( biosdev, blkno, 0 ) == 0 ) + { + sNextPartNo = 0; + sExtDepth++; + sExtPart = NULL; + continue; + } + // Fall through to part == NULL + } - if ( part == NULL ) break; // Reached end of partition chain. + if ( part == NULL ) break; // Reached end of partition chain. - // Advance to next partition number. + // Advance to next partition number. - sNextPartNo++; + sNextPartNo++; - if ( isExtendedFDiskPartition(part) ) - { - sExtPart = part; - continue; - } + if ( isExtendedFDiskPartition(part) ) + { + sExtPart = part; + continue; + } - // Skip empty slots. + // Skip empty slots. - if ( part->systid == 0x00 ) - { - continue; - } + if ( part->systid == 0x00 ) + { + continue; + } - // Change relative offset to an absolute offset. - part->relsect += sExtBase; + // Change relative offset to an absolute offset. + part->relsect += sExtBase; - *outPart = part; - *partno = sExtDepth ? (int)(sExtDepth + FDISK_NPART) : sNextPartNo; + *outPart = part; + *partno = sExtDepth ? (int)(sExtDepth + FDISK_NPART) : sNextPartNo; - break; - } + break; + } - return (part != NULL); + return (part != NULL); } //========================================================================== @@ -509,27 +519,29 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); - if ( bvr ) - { - bzero(bvr, sizeof(*bvr)); + BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); + if ( bvr ) + { + bzero(bvr, sizeof(*bvr)); - bvr->biosdev = biosdev; - bvr->part_no = partno; - bvr->part_boff = blkoff; - bvr->part_type = part->systid; - bvr->fs_loadfile = loadFunc; - bvr->fs_readfile = readFunc; - bvr->fs_getdirentry = getdirFunc; - bvr->fs_getfileblock= getBlockFunc; - bvr->fs_getuuid = getUUIDFunc; - bvr->description = getDescriptionFunc; - bvr->type = type; - bvr->bv_free = bvFreeFunc; + bvr->biosdev = biosdev; + bvr->part_no = partno; + bvr->part_boff = blkoff; + bvr->part_type = part->systid; + bvr->fs_loadfile = loadFunc; + bvr->fs_readfile = readFunc; + bvr->fs_getdirentry = getdirFunc; + bvr->fs_getfileblock= getBlockFunc; + bvr->fs_getuuid = getUUIDFunc; + bvr->description = getDescriptionFunc; + bvr->type = type; + bvr->bv_free = bvFreeFunc; - if ((part->bootid & FDISK_ACTIVE) && (part->systid == FDISK_HFS)) - bvr->flags |= kBVFlagPrimary; - + if ((part->bootid & FDISK_ACTIVE) && (part->systid == FDISK_HFS)) + { + bvr->flags |= kBVFlagPrimary; + } + // Probe the filesystem. if ( initFunc ) @@ -540,8 +552,7 @@ { // filesystem probe failed. - DEBUG_DISK(("%s: failed probe on dev %x part %d\n", - __FUNCTION__, biosdev, partno)); + DEBUG_DISK(("%s: failed probe on dev %x part %d\n", __FUNCTION__, biosdev, partno)); (*bvr->bv_free)(bvr); bvr = NULL; @@ -561,8 +572,11 @@ bvr = NULL; } } - if (bvr) bvr->flags |= bvrFlags; - return bvr; + + if (bvr) bvr->flags |= bvrFlags; + { + return bvr; + } } //========================================================================== @@ -612,8 +626,7 @@ { // filesystem probe failed. - DEBUG_DISK(("%s: failed probe on dev %x part %d\n", - __FUNCTION__, biosdev, partno)); + DEBUG_DISK(("%s: failed probe on dev %x part %d\n", __FUNCTION__, biosdev, partno)); (*bvr->bv_free)(bvr); bvr = NULL; @@ -638,22 +651,30 @@ //========================================================================== // GUID's in LE form: -// HFS+ partition - 48465300-0000-11AA-AA11-00306543ECAC +// http://en.wikipedia.org/wiki/GUID_Partition_Table +// 00000000-0000-0000-0000-000000000000 - Unused Entry partition +// 024DEE41-33E7-11D3-9D69-0008C781F39F - MBR partition scheme +// C12A7328-F81F-11D2-BA4B-00A0C93EC93B - turbo - or an EFI System Partition +EFI_GUID const GPT_EFISYS_GUID = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } }; +// 21686148-6449-6E6F-744E-656564454649 - BIOS Boot partition +// E3C9E316-0B5C-4DB8-817D-F92DF00215AE - Microsoft Reserved Partition +EFI_GUID const GPT_BASICDATA2_GUID = { 0xE3C9E316, 0x0B5C, 0x4DB8, { 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } }; +// EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 - zef - Basic Data Partition - for foreign OS support +EFI_GUID const GPT_BASICDATA_GUID = { 0xEBD0A0A2, 0xB9E5, 0x4433, { 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 } }; +// 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3 - Logical Disk Manager metadata partition +// AF9B60A0-1431-4F62-BC68-3311714A69AD - Logical Disk Manager data partition +// DE94BBA4-06D1-4D40-A16A-BFD50179D6AC - Windows Recovery Environment +// 48465300-0000-11AA-AA11-00306543ECAC - Hierarchical File System Plus (HFS+) partition EFI_GUID const GPT_HFS_GUID = { 0x48465300, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } }; - -// turbo - Apple Boot Partition - 426F6F74-0000-11AA-AA11-00306543ECAC +// 55465300-0000-11AA-AA11-00306543ECAC - Apple UFS +// 52414944-0000-11AA-AA11-00306543ECAC - Apple RAID partition +// 426F6F74-0000-11AA-AA11-00306543ECAC - turbo - Apple Boot Partition EFI_GUID const GPT_BOOT_GUID = { 0x426F6F74, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } }; +// 4C616265-6C00-11AA-AA11-00306543ECAC - Apple Label +// 5265636F-7665-11AA-AA11-00306543ECAC - Apple TV Recovery partition +// 53746F72-6167-11AA-AA11-00306543ECAC - Apple Core Storage (i.e. Lion FileVault) partition (Apple_Boot Recovery HD) +// EFI_GUID const GPT_RECOVERY_GUID = { 0x53746F72, 0x6167, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } }; -// turbo - or an EFI System Partition - C12A7328-F81F-11D2-BA4B-00A0C93EC93B -EFI_GUID const GPT_EFISYS_GUID = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } }; - -// zef - Basic Data Partition - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 for foreign OS support -EFI_GUID const GPT_BASICDATA_GUID = { 0xEBD0A0A2, 0xB9E5, 0x4433, { 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 } }; - -// Microsoft Reserved Partition - E3C9E316-0B5C-4DB8-817DF92DF00215AE -EFI_GUID const GPT_BASICDATA2_GUID = { 0xE3C9E316, 0x0B5C, 0x4DB8, { 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } }; - - BVRef newGPTBVRef( int biosdev, int partno, unsigned int blkoff, const gpt_ent * part, FSInit initFunc, FSLoadFile loadFunc, @@ -1348,6 +1369,11 @@ 0, 0, 0, 0, 0, 0, NTFSGetDescription, (BVFree)free, 0, kBIOSDevTypeHardDrive, 0); break; + case FDISK_LINUX: + bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap, + 0, 0, 0, 0, 0, 0, EX2GetDescription, + (BVFree)free, 0, kBIOSDevTypeHardDrive, 0); + break; default: bvr = newGPTBVRef(biosdev, gptID, gptMap->ent_lba_start, gptMap, @@ -1583,7 +1609,7 @@ BVRef diskScanBootVolumes( int biosdev, int * countPtr ) { - struct DiskBVMap * map; + struct DiskBVMap * map = NULL; BVRef bvr; int count = 0; @@ -1850,13 +1876,13 @@ volStart = strbreak(entryStart, &volEnd, &volLen); if(!volLen) continue; - + aliasStart = strbreak(volEnd, 0, &aliasLen); if(!aliasLen) continue; - + if ( matchVolumeToString(bvr, volStart, volLen) ) - { + { strncat(str, aliasStart, MIN(strMaxLen, aliasLen)); free(aliasList); @@ -1877,25 +1903,25 @@ return; type = (unsigned char) bvr->part_type; - + if (useDeviceDescription) { int len = getDeviceDescription(bvr, str); if(len >= strMaxLen) return; - + strcpy(str + len, " "); len++; strMaxLen -= len; p += len; } - + /* See if a partition rename is preferred */ if(getVolumeLabelAlias(bvr, p, strMaxLen)) { strncpy(bvr->label, p, strMaxLen); return; // we're done here no need to seek for real name } - + // // Get the volume label using filesystem specific functions // or use the alternate volume label if available. @@ -1916,32 +1942,39 @@ strncpy(p, name, strMaxLen); } } - + // Set the devices label sprintf(bvr->label, p); } //========================================================================== -int readBootSector( int biosdev, unsigned int secno, void * buffer ) +int readBootSector(int biosdev, unsigned int secno, void * buffer) { - struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer; - int error; + int error; + struct disk_blk0 * bootSector = (struct disk_blk0 *) buffer; - if ( bootSector == NULL ) - { - if ( gBootSector == NULL ) - { - gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); - if ( gBootSector == NULL ) return -1; - } + if (bootSector == NULL) + { + if (gBootSector == NULL) + { + gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); + + if (gBootSector == NULL) + { + return -1; + } + } + bootSector = gBootSector; - } + } - error = readBytes( biosdev, secno, 0, BPS, bootSector ); - if ( error || bootSector->signature != DISK_SIGNATURE ) - return -1; + error = readBytes(biosdev, secno, 0, BPS, bootSector); - return 0; + if (error || bootSector->signature != DISK_SIGNATURE) + { + return -1; + } + return 0; } /* @@ -1985,7 +2018,7 @@ //========================================================================== // Handle seek request from filesystem modules. -void diskSeek( BVRef bvr, long long position ) +void diskSeek(BVRef bvr, long long position) { bvr->fs_boff = position / BPS; bvr->fs_byteoff = position % BPS; Index: branches/ErmaC/Trunk/i386/libsaio/pci_setup.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/pci_setup.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/pci_setup.c (revision 1987) @@ -6,7 +6,14 @@ #include "nvidia.h" #include "modules.h" +#define DEBUG_PCI 0 +#if DEBUG_PCI +#define DBG(x...) msglog(x) +#else +#define DBG(x...) +#endif + extern bool setup_ati_devprop(pci_dt_t *ati_dev); extern void set_eth_builtin(pci_dt_t *eth_dev); extern void notify_usb_dev(pci_dt_t *pci_dev); @@ -14,6 +21,8 @@ extern pci_dt_t *dram_controller_dev; +uint16_t vgaVendor; + void setup_pci_devs(pci_dt_t *pci_dt) { char *devicepath; @@ -33,18 +42,23 @@ switch (current->class_id) { case PCI_CLASS_BRIDGE_HOST: + DBG("Setup BRIDGE_HOST \n"); if (current->dev.addr == PCIADDR(0, 0, 0)) dram_controller_dev = current; break; case PCI_CLASS_NETWORK_ETHERNET: + DBG("Setup ETHERNET %s enabled\n", do_eth_devprop?"":"no"); if (do_eth_devprop) set_eth_builtin(current); break; case PCI_CLASS_DISPLAY_VGA: + DBG("GraphicsEnabler %s enabled\n", do_gfx_devprop?"":"no"); if (do_gfx_devprop) - switch (current->vendor_id) + { + vgaVendor = current->vendor_id; + switch (vgaVendor) { case PCI_VENDOR_ID_ATI: setup_ati_devprop(current); @@ -58,20 +72,23 @@ setup_nvidia_devprop(current); break; } + } break; case PCI_CLASS_SERIAL_USB: + DBG("USB fix \n"); notify_usb_dev(current); break; case PCI_CLASS_BRIDGE_ISA: + DBG("Force HPET %s enabled\n", do_enable_hpet?"":"no"); if (do_enable_hpet) force_enable_hpet(current); break; } execute_hook("PCIDevice", current, NULL, NULL, NULL); - + DBG("setup_pci_devs current devID=%08x\n", current->device_id); setup_pci_devs(current->children); current = current->next; } Index: branches/ErmaC/Trunk/i386/libsaio/cpu.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/cpu.h (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/cpu.h (revision 1987) @@ -16,17 +16,17 @@ #define CPU_STRING_UNKNOWN "Unknown CPU Type" -#define MSR_IA32_PERF_STATUS 0x00000198 -#define MSR_IA32_PERF_CONTROL 0x199 -#define MSR_IA32_EXT_CONFIG 0x00EE -#define MSR_FLEX_RATIO 0x194 -#define MSR_TURBO_RATIO_LIMIT 0x1AD -#define MSR_PLATFORM_INFO 0xCE -#define MSR_CORE_THREAD_COUNT 0x35 // Undocumented -#define MSR_IA32_PLATFORM_ID 0x17 +#define MSR_IA32_PLATFORM_ID 0x17 +#define MSR_IA32_PERF_STATUS 0x198 +#define MSR_IA32_PERF_CONTROL 0x199 +#define MSR_IA32_EXT_CONFIG 0xEE +#define MSR_FLEX_RATIO 0x194 +#define MSR_TURBO_RATIO_LIMIT 0x1AD +#define MSR_PLATFORM_INFO 0xCE +#define MSR_CORE_THREAD_COUNT 0x35 // Undocumented -#define K8_FIDVID_STATUS 0xC0010042 -#define K10_COFVID_STATUS 0xC0010071 +#define K8_FIDVID_STATUS 0xC0010042 +#define K10_COFVID_STATUS 0xC0010071 #define MSR_AMD_MPERF 0x000000E7 #define MSR_AMD_APERF 0x000000E8 @@ -41,11 +41,16 @@ #define CALIBRATE_LATCH ((CLKNUM * CALIBRATE_TIME_MSEC + 1000/2)/1000) // CPUID Values +#define CPUID_MODEL_DOTHAN 13 // Dothan #define CPUID_MODEL_YONAH 14 // Intel Mobile Core Solo, Duo #define CPUID_MODEL_MEROM 15 // Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx +#define CPUID_MODEL_CONROE 15 +#define CPUID_MODEL_CELERON 22 #define CPUID_MODEL_PENRYN 23 // Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx +#define CPUID_MODEL_WOLFDALE 23 #define CPUID_MODEL_NEHALEM 26 // Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) #define CPUID_MODEL_ATOM 28 // Intel Atom (45nm) +#define CPUID_MODEL_XEON_MP 29 #define CPUID_MODEL_FIELDS 30 // Intel Core i5, i7, Xeon X34xx LGA1156 (45nm) #define CPUID_MODEL_DALES 31 // Havendale, Auburndale #define CPUID_MODEL_DALES_32NM 37 // Intel Core i3, i5 LGA1156 (32nm) @@ -56,7 +61,6 @@ #define CPUID_MODEL_WESTMERE_EX 47 // Intel Xeon E7 #define CPUID_MODEL_IVYBRIDGE 58 // Intel Core i5, i7 LGA1155 (22nm) - static inline uint64_t rdtsc64(void) { uint64_t ret; Index: branches/ErmaC/Trunk/i386/libsaio/smbios.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/smbios.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/smbios.c (revision 1987) @@ -80,7 +80,7 @@ // defaults for a MacBook #define kDefaultMacBookFamily "MacBook" #define kDefaultMacBook "MacBook4,1" -#define kDefaultMacBookBIOSVersion " MB41.88Z.0073.B00.0903051113" +#define kDefaultMacBookBIOSVersion " MB41.88Z.0073.B00.0809221748" // defaults for a MacBook Pro #define kDefaultMacBookProFamily "MacBookPro" @@ -200,8 +200,12 @@ {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, assetTagNumber), NULL, NULL, NULL}, {kSMBTypeBaseBoard, kSMBString, getFieldOffset(SMBBaseBoard, locationInChassis), NULL, NULL, NULL}, + //------------------------------------------------------------------------------------------------------------------------- + // SystemEnclosure + //------------------------------------------------------------------------------------------------------------------------- + {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, manufacturer), + kSMBBaseBoardManufacturerKey, NULL, &defaultBaseBoard.manufacturer }, - //------------------------------------------------------------------------------------------------------------------------- // ProcessorInformation //------------------------------------------------------------------------------------------------------------------------- @@ -830,4 +834,3 @@ structHeader = (SMBStructHeader *)structPtr; } } - Index: branches/ErmaC/Trunk/i386/libsaio/pci.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/pci.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/pci.c (revision 1987) @@ -6,6 +6,7 @@ #include "libsaio.h" #include "bootstruct.h" +#include "boot.h" #include "pci.h" #include "pci_root.h" @@ -14,7 +15,7 @@ #endif #if DEBUG_PCI -#define DBG(x...) printf(x) +#define DBG(x...) verbose(x) #else #define DBG(x...) #endif @@ -95,6 +96,7 @@ new->vendor_id = id & 0xffff; new->device_id = (id >> 16) & 0xffff; new->subsys_id.subsys_id = pci_config_read32(pci_addr, PCI_SUBSYSTEM_VENDOR_ID); + new->subclass = pci_config_read8(pci_addr, PCI_CLASS_PROG); new->class_id = pci_config_read16(pci_addr, PCI_CLASS_DEVICE); new->parent = start; @@ -144,6 +146,12 @@ void build_pci_dt(void) { root_pci_dev = malloc(sizeof(pci_dt_t)); + + if (!root_pci_dev) + { + return; + } + gRootPCIDev = (void*)root_pci_dev; bzero(root_pci_dev, sizeof(pci_dt_t)); enable_pci_devs(); scan_pci_bus(root_pci_dev, 0); @@ -193,9 +201,9 @@ current = pci_dt; while (current) { - printf("%02x:%02x.%x [%04x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n", + printf("%02x:%02x.%x [%04x%02x] [%04x:%04x] (subsys [%04x:%04x]):: %s\n", current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func, - current->class_id, current->vendor_id, current->device_id, + current->class_id, current->subclass, current->vendor_id, current->device_id, current->subsys_id.subsys.vendor_id, current->subsys_id.subsys.device_id, get_pci_dev_path(current)); dump_pci_dt(current->children); Index: branches/ErmaC/Trunk/i386/libsaio/convert.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/convert.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/convert.c (revision 1987) @@ -94,9 +94,7 @@ hexNibble = hexStr[hexStrIdx]; // ignore all chars except valid hex numbers - if ( (hexNibble >= '0' && hexNibble <= '9') || - (hexNibble >= 'A' && hexNibble <= 'F') || - (hexNibble >= 'a' && hexNibble <= 'f') ) + if ( (hexNibble >= '0' && hexNibble <= '9') || (hexNibble >= 'A' && hexNibble <= 'F') || (hexNibble >= 'a' && hexNibble <= 'f') ) { hexByte[hexNibbleIdx++] = hexNibble; Index: branches/ErmaC/Trunk/i386/libsaio/pci.h =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/pci.h (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/pci.h (revision 1987) @@ -23,10 +23,10 @@ } pci_dev_t; typedef struct pci_dt_t { - pci_dev_t dev; + pci_dev_t dev; - uint16_t vendor_id; - uint16_t device_id; + uint16_t vendor_id; + uint16_t device_id; union { struct { @@ -34,10 +34,11 @@ uint16_t device_id; } subsys; uint32_t subsys_id; - } subsys_id; + }subsys_id; + uint8_t revision; + uint8_t subclass; + uint16_t class_id; - uint16_t class_id; - struct pci_dt_t *parent; struct pci_dt_t *children; struct pci_dt_t *next; @@ -57,6 +58,7 @@ extern char *get_pci_dev_path(pci_dt_t *); extern void build_pci_dt(void); extern void dump_pci_dt(pci_dt_t *); +extern void setup_pci_devs(pci_dt_t *pci_dt); /* Option ROM header */ typedef struct { Index: branches/ErmaC/Trunk/i386/libsaio/msdos.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/msdos.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/msdos.c (revision 1987) @@ -778,8 +778,10 @@ } getDeviceDescription(ih, devStr); +/* verbose("Read FAT%d file: [%s/%s] %d bytes.\n", msdosfatbits, devStr, filePath, (uint32_t)( toread<0 ) ? wastoread : wastoread-toread); +*/ free (buf); if (toread<0) return wastoread; Index: branches/ErmaC/Trunk/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/fake_efi.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsaio/fake_efi.c (revision 1987) @@ -450,7 +450,7 @@ dst = (EFI_CHAR16*) malloc( ((*len)+1) * 2 ); for (; i < (*len); i++) dst[i] = src[i]; dst[(*len)] = '\0'; - *len = ((*len)+1)*2; // return the CHAR16 bufsize in cluding zero terminated CHAR16 + *len = ((*len)+1)*2; // return the CHAR16 bufsize including zero terminated CHAR16 return dst; } @@ -622,6 +622,7 @@ /* * Populate the chosen node */ + void setupChosenNode() { Node *chosenNode; Index: branches/ErmaC/Trunk/i386/boot2/graphics.h =================================================================== --- branches/ErmaC/Trunk/i386/boot2/graphics.h (revision 1986) +++ branches/ErmaC/Trunk/i386/boot2/graphics.h (revision 1987) @@ -18,6 +18,7 @@ #define DEFAULT_SCREEN_WIDTH 1024 #define DEFAULT_SCREEN_HEIGHT 768 +extern int gDualLink; int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData); unsigned long lookUpCLUTIndex( unsigned char index, unsigned char depth ); Index: branches/ErmaC/Trunk/i386/boot2/boot.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/boot.c (revision 1986) +++ branches/ErmaC/Trunk/i386/boot2/boot.c (revision 1987) @@ -75,7 +75,10 @@ char gRootDevice[ROOT_DEVICE_SIZE]; char gMKextName[512]; char gMacOSVersion[8]; -int bvCount = 0, gDeviceCount = 0; +void *gRootPCIDev; + +int gDualLink; +int bvCount = 0, gDeviceCount = 0; //int menucount = 0; long gBootMode; /* defaults to 0 == kBootModeNormal */ BVRef bvr, menuBVR, bvChain; Index: branches/ErmaC/Trunk/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Trunk/i386/boot2/boot.h (revision 1986) +++ branches/ErmaC/Trunk/i386/boot2/boot.h (revision 1987) @@ -196,6 +196,10 @@ extern bool gScanSingleDrive; extern bool useGUI; +extern void *gRootPCIDev; + +extern uint16_t vgaVendor;; + /* * Boot Modes */ Index: branches/ErmaC/Trunk/i386/boot2/modules.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/modules.c (revision 1986) +++ branches/ErmaC/Trunk/i386/boot2/modules.c (revision 1987) @@ -367,7 +367,7 @@ } else { - verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic); + //verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic); //getchar(); return NULL; } Index: branches/ErmaC/Trunk/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/gui.c (revision 1986) +++ branches/ErmaC/Trunk/i386/boot2/gui.c (revision 1987) @@ -845,6 +845,7 @@ // set our screen structure with the mode width & height gui.screen.width = screen_params[0]; gui.screen.height = screen_params[1]; + gDualLink =((screen_params[0] * screen_params[1]) > (1<<20))?1:0; // load graphics otherwise fail and return if (loadGraphics() == 0) { Index: branches/ErmaC/Trunk/i386/Cconfig =================================================================== --- branches/ErmaC/Trunk/i386/Cconfig (revision 1986) +++ branches/ErmaC/Trunk/i386/Cconfig (revision 1987) @@ -4,7 +4,7 @@ config OPTIMIZATION_LEVEL string "Optimization Level" - default "-Oz" + default "-Os" ---help--- Specify the level to compile chameleon with. Index: branches/ErmaC/Trunk/i386/libsa/strtol.c =================================================================== --- branches/ErmaC/Trunk/i386/libsa/strtol.c (revision 1986) +++ branches/ErmaC/Trunk/i386/libsa/strtol.c (revision 1987) @@ -148,7 +148,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -220,7 +220,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -291,7 +291,7 @@ break; if (c >= base) break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + if ((any < 0 || acc > cutoff) || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; Index: branches/ErmaC/Trunk/i386/libsa/memory.h =================================================================== --- branches/ErmaC/Trunk/i386/libsa/memory.h (revision 1986) +++ branches/ErmaC/Trunk/i386/libsa/memory.h (revision 1987) @@ -57,7 +57,7 @@ #define BOOT2_SEG 0x2000 #define BOOT2_OFS 0x0200 // 512 byte disk sector offset -#define BOOT2_MAX_LENGTH 0x6FE00 // Maximum size for boot2 is currentl 447kb +#define BOOT2_MAX_LENGTH 0x6FE00 // Maximum size for boot2 is currentl 447kb #define BIOS_ADDR 0x8000 // BIOS disk I/O buffer #define BIOS_LEN 0x8000 // 32K - divisible by 512 and 2048