Index: branches/cparm/CHANGES =================================================================== --- branches/cparm/CHANGES (revision 1734) +++ branches/cparm/CHANGES (revision 1735) @@ -1,3 +1,13 @@ +- Chameleon can now boot the Lion Auto-Installer partition (additionally, on a GPT disk this enable the option "Localize my Mac" of iCloud) +- Added a first version of amlsgn (NOTE: This tool can can sign an aml file for your machine (with the UUID) or for your machine model, this can be useful + with multiple machines w/o an identical model, combined with acpicodec and the option "LoadSignedAmlOnly", you can make sure that Chameleon will load the good + aml files (even if you have about 50 dsdt files named differently in your Acpi directory and each one for a different machine) ) +- Applied Guerrero's patch on gui.c (http://forge.voodooprojects.org/p/chameleon/issues/view/attachment/152/gui.diff) +- Added a theme compatible with the OS detection/Volume feature (credit to Enzo for LoginToLion, see http://forum.voodooprojects.org/index.php?topic=2125.0 for more.) +- Fixed a mistake with the smbios.plist loading process +- Reworked the OS detection/Volume (NOTE: now embedded into the core and executed much earlier ) + + - Added Haiku support (credit to scorpius) - Added EXFAT (FAT64) support (credit to dmazar) - Added JrCs fixes (see trunk v1716 v1719) @@ -37,7 +47,7 @@ - Updated keymapper ... - Applied scorpius's patch (to get an unstretched boot screen for nVidia cards on DVI) in boot0.s , disabled by default, see - http://forum.voodooprojects.org/index.php/topic,2158.msg10345/boardseen.html#new - for more info. -- Applied Vladimir Zidar's hibernate patch on hibernateEnabler +- Applied Vladimir Zidar's hibernate patch on hibernateEnabler. - Applied "Intel HD Graphics 3000" patch to gma.c (credit: ???) , found at - http://www.darwinx86.net/forum/61-section-francaise-/1880-espace-de-discussion-anval?limit=10&start=60#6247 - - Added AMD support (most of the code is derived from the trunk, MUST BE ENABLED BY HAND IN CPU.C) see - http://forge.voodooprojects.org/p/chameleon/issues/163/ - Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_tiger.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_tiger.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/text_scroll_prev.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/text_scroll_prev.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsraid.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsraid.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/logo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/logo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_sl.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_sl.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_lion_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_lion_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_ext3.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_ext3.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_leo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_leo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/boot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/boot.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_single_user.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_single_user.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_ntfs_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_ntfs_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_fat_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_fat_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_freebsd_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_freebsd_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_scroll_prev.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_scroll_prev.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_openbsd.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_openbsd.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_ignore_caches.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_ignore_caches.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_verbose_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_verbose_disabled.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_lion.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_lion.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_boot.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_boot.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/font_console.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/font_console.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_freebsd.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_freebsd.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_fat.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_fat.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_ntfs.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_ntfs.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_single_user_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_single_user_disabled.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/font_small.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/font_small.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/text_scroll_next.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/text_scroll_next.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_cdrom_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_cdrom_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_ignore_caches_disabled.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_ignore_caches_disabled.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_selection.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_selection.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_video_info.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_video_info.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_memory_info.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_memory_info.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_generic_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_generic_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_selection.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_selection.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/theme.plist =================================================================== --- branches/cparm/artwork/themes/LoginToLion/theme.plist (revision 0) +++ branches/cparm/artwork/themes/LoginToLion/theme.plist (revision 1735) @@ -0,0 +1,110 @@ + + + + + Author + Enzo + Enabled + no + Version + 1.0 + background_pos_x + + background_pos_y + + boot_bgcolor + #AAAAAA + boot_height + 768 + boot_width + 1024 + bootprompt_bgcolor + #232427 + bootprompt_height + 20 + bootprompt_pos_x + + bootprompt_pos_y + -2 + bootprompt_textmargin_h + 10 + bootprompt_textmargin_v + 5 + bootprompt_transparency + 60 + bootprompt_width + 40% + countdown_pos_x + + countdown_pos_y + -28% + devices_bgcolor + #232427 + devices_iconspacing + 80 + devices_layout + horizontal + devices_max_visible + 5 + devices_pos_x + + devices_pos_y + 38% + devices_transparency + 255 + infobox_bgcolor + #232427 + infobox_height + 406 + infobox_pos_x + + infobox_pos_y + + infobox_textmargin_h + 10 + infobox_textmargin_v + 10 + infobox_transparency + 60 + infobox_width + 800 + logo_bgcolor + #000000 + logo_pos_x + + logo_pos_y + 25% + logo_transparency + 255 + menu_bgcolor + #3c3e42 + menu_pos_x + + menu_pos_y + -5% + menu_textmargin_h + 10 + menu_textmargin_v + 5 + menu_transparency + 255 + progressbar_height + 40 + progressbar_pos_x + + progressbar_pos_y + -33% + progressbar_width + 100 + screen_bgcolor + #3c3e42 + screen_height + 768 + screen_textmargin_h + 10 + screen_textmargin_v + 10 + screen_width + 1024 + + Index: branches/cparm/artwork/themes/LoginToLion/device_scroll_next.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_scroll_next.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_tiger_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_tiger_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_help.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_help.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsraid_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsraid_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_sl_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_sl_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/background.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/background.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_ext3_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_ext3_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_leo_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_hfsplus_leo_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_cdrom.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_cdrom.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_openbsd_o.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_openbsd_o.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/progress_bar_background.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/progress_bar_background.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/progress_bar.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/progress_bar.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/menu_verbose.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/menu_verbose.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/artwork/themes/LoginToLion/device_generic.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: branches/cparm/artwork/themes/LoginToLion/device_generic.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: branches/cparm/i386/libsaio/bootstruct.c =================================================================== --- branches/cparm/i386/libsaio/bootstruct.c (revision 1734) +++ branches/cparm/i386/libsaio/bootstruct.c (revision 1735) @@ -153,32 +153,7 @@ void reserveKern107BootStruct(void) -{ - //bootArgs107 = (boot_args_107 *)AllocateKernelMemory(sizeof(boot_args_107)); - - /* Common Darwin boot arguments */ - /* - bootArgs107->Revision = bootArgs->Header.Revision ; - bootArgs107->Version = bootArgs->Header.Version ; - bcopy(bootArgs->CommandLine, bootArgs107->CommandLine, BOOT_LINE_LENGTH); - bootArgs107->MemoryMap = bootArgs->MemoryMap ; - bootArgs107->MemoryMapSize = bootArgs->MemoryMapSize ; - bootArgs107->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize ; - bootArgs107->MemoryMapDescriptorVersion = bootArgs->MemoryMapDescriptorVersion ; - bootArgs107->Video = bootArgs->Video ; - bootArgs107->deviceTreeP = bootArgs->deviceTreeP ; - bootArgs107->deviceTreeLength = bootArgs->deviceTreeLength ; - bootArgs107->kaddr = bootArgs->kaddr ; - bootArgs107->ksize = bootArgs->ksize ; - bootArgs107->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart ; - bootArgs107->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount ; - bootArgs107->efiSystemTable = bootArgs->efiSystemTable ; - bootArgs107->efiMode = bootArgs->efiMode ; - bootArgs107->performanceDataStart = bootArgs->performanceDataStart ; - bootArgs107->performanceDataSize = bootArgs->performanceDataSize ; - bootArgs107->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart ; - */ - +{ init_boot_args(107); /* Darwin 10.7 specific boot arguments */ @@ -194,30 +169,7 @@ void reserveKernLegacyBootStruct(void) -{ - //bootArgsLegacy = (boot_args_legacy *)AllocateKernelMemory(sizeof(boot_args_legacy)); - /* - bootArgsLegacy->Revision = bootArgs->Header.Revision ; - bootArgsLegacy->Version = bootArgs->Header.Version ; - bcopy(bootArgs->CommandLine, bootArgsLegacy->CommandLine, BOOT_LINE_LENGTH); - bootArgsLegacy->MemoryMap = bootArgs->MemoryMap ; - bootArgsLegacy->MemoryMapSize = bootArgs->MemoryMapSize ; - bootArgsLegacy->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize ; - bootArgsLegacy->MemoryMapDescriptorVersion = bootArgs->MemoryMapDescriptorVersion ; - bootArgsLegacy->Video = bootArgs->Video ; - bootArgsLegacy->deviceTreeP = bootArgs->deviceTreeP ; - bootArgsLegacy->deviceTreeLength = bootArgs->deviceTreeLength ; - bootArgsLegacy->kaddr = bootArgs->kaddr ; - bootArgsLegacy->ksize = bootArgs->ksize ; - bootArgsLegacy->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart ; - bootArgsLegacy->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount ; - bootArgsLegacy->efiSystemTable = bootArgs->efiSystemTable ; - bootArgsLegacy->efiMode = bootArgs->efiMode ; - bootArgsLegacy->performanceDataStart = bootArgs->performanceDataStart ; - bootArgsLegacy->performanceDataSize = bootArgs->performanceDataSize ; - bootArgsLegacy->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart ; -*/ - +{ init_boot_args(Legacy); } Index: branches/cparm/i386/libsaio/disk.c =================================================================== --- branches/cparm/i386/libsaio/disk.c (revision 1734) +++ branches/cparm/i386/libsaio/disk.c (revision 1735) @@ -91,6 +91,14 @@ #define DBG(x...) #endif +#ifndef MIN +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#endif + +#ifndef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#endif + #ifdef APPLE_PARTITION_MAP_SUPPORT #define UINT_MAX 0xffffffff /* max value for an unsigned int, defined in . */ #include @@ -188,6 +196,7 @@ #ifdef APPLE_PARTITION_MAP_SUPPORT static BVRef diskScanAPMBootVolumes( int biosdev, int * countPtr ); #endif +static bool getOSVersion(BVRef bvr, char *str); //========================================================================== @@ -1510,14 +1519,67 @@ } } +static bool getOSVersion(BVRef bvr, char *str) +{ + bool valid = false; + config_file_t systemVersion; + char dirSpec[512]; + long flags, time; + + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (!loadConfigFile(dirSpec, &systemVersion)) + { + valid = true; + } + else + { + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (!loadConfigFile(dirSpec, &systemVersion)) + { + sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); + + valid = true; + } + else + { + sprintf(dirSpec, "hd(%d,%d)/", BIOS_DEV_UNIT(bvr), bvr->part_no); + + if (GetFileInfo(dirSpec, "Mac OS X Install Data", &flags, &time) == 0) + { + *str = '\0'; + strncat(str, "10.7", 4); + return true; + } + } + } + + if (valid) + { + const char *val; + int len; + + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) + { + // getValueForKey uses const char for val + // so copy it and trim + *str = '\0'; + strncat(str, val, MIN(len, 4)); + } + else + valid = false; + } + + return valid; +} + //========================================================================== static void scanFSLevelBVRSettings(BVRef chain) { BVRef bvr; - char dirSpec[512], fileSpec[512]; int ret; - long flags, time; #ifdef BOOT_HELPER_SUPPORT char label[BVSTRLEN]; int fh, fileSize, error; @@ -1564,18 +1626,10 @@ // if (bvr->flags & kBVFlagNativeBoot) { - sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/", BIOS_DEV_UNIT(bvr), bvr->part_no); - strcpy(fileSpec, "SystemVersion.plist"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); - - if (ret == -1) + if (getOSVersion(bvr,bvr->OSVersion) == true) { - strcpy(fileSpec, "ServerVersion.plist"); - ret = GetFileInfo(dirSpec, fileSpec, &flags, &time); + bvr->flags |= kBVFlagSystemVolume; } - - if (!ret) - bvr->flags |= kBVFlagSystemVolume; } } Index: branches/cparm/i386/libsaio/saio_types.h =================================================================== --- branches/cparm/i386/libsaio/saio_types.h (revision 1734) +++ branches/cparm/i386/libsaio/saio_types.h (revision 1735) @@ -207,6 +207,7 @@ char altlabel[BVSTRLEN]; /* partition volume label */ bool filtered; /* newFilteredBVChain() will set to TRUE */ bool visible; /* will shown in the device list */ + char OSVersion[8]; }; enum { Index: branches/cparm/i386/libsaio/fake_efi.c =================================================================== --- branches/cparm/i386/libsaio/fake_efi.c (revision 1734) +++ branches/cparm/i386/libsaio/fake_efi.c (revision 1735) @@ -743,14 +743,12 @@ Node *efiNode = DT__AddChild(node, "efi"); { - extern char gMacOSVersion[]; - // Set up the /efi/runtime-services table node similar to the way a child node of configuration-table // is set up. That is, name and table properties Node *runtimeServicesNode = DT__AddChild(efiNode, "runtime-services"); Node *kernelCompatibilityNode = 0; // ??? not sure that it should be used like that (because it's maybe the kernel capability and not the cpu capability) - if (gMacOSVersion[3] > '6') + if (gBootVolume->OSVersion[3] > '6') { kernelCompatibilityNode = DT__AddChild(efiNode, "kernel-compatibility"); DT__AddProperty(kernelCompatibilityNode, "i386", sizeof(uint32_t), (EFI_UINT32*)&DEVICE_SUPPORTED); @@ -845,12 +843,10 @@ void setupSmbiosConfigFile(const char *filename) { - //static bool readSmbConfigFile = true; + static bool readSmbConfigFile = true; - if (&bootInfo->bootConfig == 0) - //if (readSmbConfigFile == true) + if (readSmbConfigFile == true) { - verbose("loading smbios plist\n"); char dirSpecSMBIOS[128] = ""; const char *override_pathname = NULL; int len = 0, err = 0; @@ -878,7 +874,7 @@ { verbose("No SMBIOS config file found.\n"); } - //readSmbConfigFile = false; + readSmbConfigFile = false; } } Index: branches/cparm/i386/boot2/boot.c =================================================================== --- branches/cparm/i386/boot2/boot.c (revision 1734) +++ branches/cparm/i386/boot2/boot.c (revision 1735) @@ -87,7 +87,6 @@ bool gOverrideKernel; char gBootKernelCacheFile[512]; char gMKextName[512]; -char gMacOSVersion[8]; char *gRootDevice = NULL; #ifndef OPTION_ROM @@ -111,7 +110,6 @@ static inline void malloc_error(char *addr, size_t size); #endif static int ExecKernel(void *binary); -static bool getOSVersion(char *str); static void getRootDevice(); #ifdef NBP_SUPPORT static bool gUnloadPXEOnExit = false; @@ -199,10 +197,10 @@ bootArgs->kaddr = bootArgs->ksize = 0; - if(gMacOSVersion[3] <= '6') + if(gBootVolume->OSVersion[3] <= '6') { bootArgs->Header.Version = kBootArgsVersion1; - bootArgs->Header.Revision = gMacOSVersion[3]; + bootArgs->Header.Revision = gBootVolume->OSVersion[3]; } else { @@ -211,7 +209,7 @@ bootArgs->Header.Version = kBootArgsVersion; bootArgs->Header.Revision = kBootArgsRevision; #else - if(gMacOSVersion[3] == '7') + if(gBootVolume->OSVersion[3] == '7') { bootArgs->Header.Version = 2; bootArgs->Header.Revision = 0; @@ -337,9 +335,9 @@ execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL, NULL, NULL); // Notify modules that the kernel is about to be started - if (gMacOSVersion[3] <= '6') + if (gBootVolume->OSVersion[3] <= '6') reserveKernLegacyBootStruct(); - else if (gMacOSVersion[3] == '7') + else if (gBootVolume->OSVersion[3] == '7') reserveKern107BootStruct(); #if UNUSED @@ -351,7 +349,7 @@ IMPS_LAPIC_WRITE(LAPIC_LVT1, LAPIC_ICR_DM_NMI); #endif - switch (gMacOSVersion[3]) { + switch (gBootVolume->OSVersion[3]) { case '4': case '5': case '6': @@ -592,10 +590,7 @@ // Other status (e.g. 0) means that we should proceed with boot. execute_hook("GUI_PreBoot", NULL, NULL, NULL, NULL, NULL, NULL); - - // Find out which version mac os we're booting. - getOSVersion(gMacOSVersion); - + if (getValueForKey(karch, &val, &len, &bootInfo->bootConfig) && val) { if (strncmp(val, "x86_64", 4) == 0) @@ -647,7 +642,7 @@ trycache = false; } - verbose("Loading Darwin %s\n", gMacOSVersion); + verbose("Loading Darwin %s\n", gBootVolume->OSVersion); { long cachetime, kerneltime, exttime; if (trycache && !forcecache) do { @@ -701,7 +696,7 @@ { bootFile = gBootKernelCacheFile; verbose("Loading kernel cache %s\n", bootFile); - if (gMacOSVersion[3] > '6') + if (gBootVolume->OSVersion[3] > '6') { ret = LoadThinFatFile(bootFile, &binary); if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) @@ -853,11 +848,11 @@ } else { - if(gMacOSVersion[3] > '6') + if(gBootVolume->OSVersion[3] > '6') { sprintf(gBootKernelCacheFile, "%s", kDefaultCachePath); } - else if(gMacOSVersion[3] <= '6') + else if(gBootVolume->OSVersion[3] <= '6') { PlatformInfo *platformInfo = malloc(sizeof(PlatformInfo)); @@ -908,7 +903,7 @@ DBG("Adler32: %08lX\n",bootInfo->adler32); - if (gMacOSVersion[3] < '6') + if (gBootVolume->OSVersion[3] < '6') { long flags, cachetime; int ret = -1; @@ -1017,39 +1012,6 @@ gRootDevice = (char* )val; } -static bool getOSVersion(char *str) -{ - bool valid = false; - config_file_t systemVersion; - - if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) - { - valid = true; - } - else if (!loadConfigFile("System/Library/CoreServices/ServerVersion.plist", &systemVersion)) - { - valid = true; - } - - if (valid) - { - const char *val; - int len; - - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) - { - // getValueForKey uses const char for val - // so copy it and trim - *str = '\0'; - strncat(str, val, MIN(len, 4)); - } - else - valid = false; - } - - return valid; -} - static bool find_file_with_ext(const char* dir, const char *ext, const char * name_compare, size_t ext_size) { char* name; Index: branches/cparm/i386/boot2/drivers.c =================================================================== --- branches/cparm/i386/boot2/drivers.c (revision 1734) +++ branches/cparm/i386/boot2/drivers.c (revision 1735) @@ -40,7 +40,6 @@ #include "drivers.h" #include "modules.h" -extern char gMacOSVersion[]; extern char gBootKernelCacheFile[]; static ModulePtr gModuleHead, gModuleTail; @@ -126,7 +125,7 @@ #endif // First try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "/Extra/%s/", &gMacOSVersion); + sprintf(dirSpecExtra, "/Extra/%s/", &gBootVolume->OSVersion); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // Next try to load Extra extensions from the selected root partition. @@ -138,7 +137,7 @@ if (!(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no)) { // First try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); + sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gBootVolume->OSVersion); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // Next we'll try the base @@ -762,7 +761,7 @@ printf("adler mismatch\n"); return -1; } - if (((gBootMode & kBootModeSafe) == 0) && (gBootKernelCacheFile[0] != '\0') && gMacOSVersion[3] > '6') + if (((gBootMode & kBootModeSafe) == 0) && (gBootKernelCacheFile[0] != '\0') && gBootVolume->OSVersion[3] > '6') bootInfo->adler32 = kernel_header->adler32; } Index: branches/cparm/i386/modules/NetbookInstaller/NBI.c =================================================================== --- branches/cparm/i386/modules/NetbookInstaller/NBI.c (revision 1734) +++ branches/cparm/i386/modules/NetbookInstaller/NBI.c (revision 1735) @@ -29,9 +29,6 @@ #endif extern long FileLoadDrivers(char *dirSpec, long plugin); -extern char gMacOSVersion; - - extern long LoadDriverMKext(char *fileSpec); extern long LoadDriverPList(char *dirSpec, char *name, long bundleType); Index: branches/cparm/i386/modules/RamDiskLoader/ramdisk.h =================================================================== --- branches/cparm/i386/modules/RamDiskLoader/ramdisk.h (revision 1734) +++ branches/cparm/i386/modules/RamDiskLoader/ramdisk.h (revision 1735) @@ -35,7 +35,6 @@ extern BVRef gRAMDiskVolume; extern bool gRAMDiskBTAliased; -extern char gMacOSVersion; extern long FileLoadDrivers(char *dirSpec, long plugin); extern void setRAMDiskBTHook(bool mode); Index: branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c =================================================================== --- branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c (revision 1734) +++ branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c (revision 1735) @@ -54,7 +54,7 @@ break; case 1: // First try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "rd(0,0)/Extra/%s/", &gMacOSVersion); + sprintf(dirSpecExtra, "rd(0,0)/Extra/%s/", &gBootVolume->OSVersion); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // Next we'll try the base @@ -64,7 +64,7 @@ break; case 2: // First try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); + sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gBootVolume->OSVersion); if (FileLoadDrivers(dirSpecExtra, 0) != 0) { // Next we'll try the base Index: branches/cparm/i386/modules/GUI/gui.c =================================================================== --- branches/cparm/i386/modules/GUI/gui.c (revision 1734) +++ branches/cparm/i386/modules/GUI/gui.c (revision 1735) @@ -80,6 +80,11 @@ #endif static int getImageIndexByName(const char *name); +static int destroyFont(font_t *font); +static int unloadGraphics(void); +static int freeBackBuffer( window_t *window ); +static bool is_image_loaded(int i); + #define LOADPNG(src, img, alt_img) if (loadThemeImage(src, #img, alt_img) != 0) { return 1; } #ifndef MIN @@ -497,6 +502,38 @@ return 0; } + +static int unloadGraphics(void) +{ + int i; + + destroyFont(&font_console); + destroyFont(&font_small); + for (i = 0; i < sizeof(images) / sizeof(images[0]); i++) + { + if (images[i].image) + { + if (images[i].image->pixels) free(images[i].image->pixels); + free (images[i].image); + images[i].image = 0; + } + } + return 0; +} + +static int freeBackBuffer( window_t *window ) +{ + if (gui.backbuffer && gui.backbuffer->pixels) + { + free(gui.backbuffer->pixels); + free(gui.backbuffer); + gui.backbuffer = 0; + return 0; + } + + return 1; +} + #if UNUSED pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height ) { @@ -959,7 +996,7 @@ if (ret) printf("Failed to load Default Theme : %s !! \n", THEME_NAME_DEFAULT); } - } + } return ret; } @@ -1049,103 +1086,24 @@ } } } + + // Loading error occurred, freeing resources + freeWindowBuffer(&gui.menu); + freeWindowBuffer(&gui.infobox); + freeWindowBuffer(&gui.bootprompt); + freeWindowBuffer(&gui.devicelist); + freeWindowBuffer(&gui.screen); + freeBackBuffer(&gui.screen); + unloadGraphics(); + return 1; } -/************************************************* - * - * Volume Versioning Management - */ - -volume_t* volumeList = NULL; - - -bool add_volume(char* Version, BVRef bvr) -{ - volume_t* new_volume= malloc(sizeof(volume_t)); - - if (new_volume) - { - new_volume->next = volumeList; - - volumeList = new_volume; - - strlcpy(new_volume->version,Version,sizeof(new_volume->version)+1); - new_volume->bvr = bvr; - return true; - } - - return false; - -} - -bool get_volume_version(char *str,BVRef bvr) -{ - volume_t* volume = volumeList; - while(volume) - { - if (volume->bvr == bvr) { - strlcpy(str,volume->version,sizeof(volume->version)+1); - return true; - } - volume = volume->next; - } - return false; -} - -static bool getOSVersionForVolume(char *str, BVRef bvr) -{ - bool valid = false; - - if (get_volume_version(str,bvr) == false) - { - char dirSpec[128]; - char dirSpec2[128]; - config_file_t systemVersion; - - sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); - sprintf(dirSpec2, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); - - if (!loadConfigFile(dirSpec, &systemVersion)) - { - valid = true; - } - else if (!loadConfigFile(dirSpec2, &systemVersion)) - { - valid = true; - } - - if (valid) - { - const char *val; - int len; - - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) - { - // getValueForKey uses const char for val - // so copy it and trim - *str = '\0'; - strncat(str, val, MIN(len, 4)); - add_volume(str, bvr); - } - else - valid = false; - } - } - else - { - valid = true; - } - - return valid; -} - static bool is_image_loaded(int i) { return (images[i].image != NULL) ? true : false; } -/*************************************************/ static void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected) { int devicetype; @@ -1157,16 +1115,12 @@ switch (device->part_type) { case kPartitionTypeHFS: - { - char VolumeMacOSVersion[8]; - + { #ifdef BOOT_HELPER_SUPPORT // Use HFS or HFSRAID icon depending on bvr flags. if (device->flags & kBVFlagBooter) { - - getOSVersionForRaidVolume(VolumeMacOSVersion,device); - - switch (VolumeMacOSVersion[3]) { + + switch (device->OSVersion[3]) { case '7': devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric; break; @@ -1186,11 +1140,9 @@ } else #endif - { + { - getOSVersionForVolume(VolumeMacOSVersion,device); - - switch (VolumeMacOSVersion[3]) { + switch (device->OSVersion[3]) { case '7': devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric; break; @@ -1264,192 +1216,6 @@ } -#if 0 -static void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected) -{ - int devicetype; - - if( diskIsCDROM(device) ) - devicetype = iDeviceCDROM; // Use CDROM icon - else - { - switch (device->part_type) - { - case kPartitionTypeHFS: - { - bool hfs_img_replacement_found = false; - char VolumeMacOSVersion[8]; - -#ifdef BOOT_HELPER_SUPPORT - // Use HFS or HFSRAID icon depending on bvr flags. - if (device->flags & kBVFlagBooter) { - - if (getOSVersionForRaidVolume(VolumeMacOSVersion,device)) - { - int i ; - if (VolumeMacOSVersion[3] == '7') { - if ((i = getImageIndexByName("device_hfsplus_raid_lion")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } else if (VolumeMacOSVersion[3] == '6') { - if ((i = getImageIndexByName("device_hfsplus_raid_sl")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } else if (VolumeMacOSVersion[3] == '5') { - if ((i = getImageIndexByName("device_hfsplus_raid_leo")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } else if (VolumeMacOSVersion[3] == '4') { - if ((i = getImageIndexByName("device_hfsplus_raid_tiger")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } - } - - switch (VolumeMacOSVersion[3]) { - case '7': - devicetype = (hfs_img_replacement_found) ? iDeviceHFSRAID_Lion : iDeviceHFSRAID; - break; - case '6': - devicetype = (hfs_img_replacement_found) ? iDeviceHFSRAID_SL : iDeviceHFSRAID; - break; - case '5': - devicetype = (hfs_img_replacement_found) ? iDeviceHFSRAID_Leo : iDeviceHFSRAID; - break; - case '4': - devicetype = (hfs_img_replacement_found) ? iDeviceHFSRAID_Tiger : iDeviceHFSRAID; - break; - default: - devicetype = iDeviceHFSRAID; - break; - } - - } else -#endif - { - - if (getOSVersionForVolume(VolumeMacOSVersion,device)) - { - - int i ; - if (VolumeMacOSVersion[3] == '7') { - if ((i = getImageIndexByName("device_hfsplus_lion")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } else if (VolumeMacOSVersion[3] == '6') { - if ((i = getImageIndexByName("device_hfsplus_sl")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } else if (VolumeMacOSVersion[3] == '5') { - if ((i = getImageIndexByName("device_hfsplus_leo")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } else if (VolumeMacOSVersion[3] == '4') { - if ((i = getImageIndexByName("device_hfsplus_tiger")) >= 0) - { - if (images[i].image != NULL) { - hfs_img_replacement_found = true; - } - } - } - - } - - switch (VolumeMacOSVersion[3]) { - case '7': - devicetype = (hfs_img_replacement_found) ? iDeviceHFS_Lion : iDeviceHFS; - break; - case '6': - devicetype = (hfs_img_replacement_found) ? iDeviceHFS_SL : iDeviceHFS; - break; - case '5': - devicetype = (hfs_img_replacement_found) ? iDeviceHFS_Leo : iDeviceHFS; - break; - case '4': - devicetype = (hfs_img_replacement_found) ? iDeviceHFS_Tiger : iDeviceHFS; - break; - default: - devicetype = iDeviceHFS; - break; - } - - } - - break; - - } - case kPartitionTypeHPFS: - devicetype = iDeviceNTFS; // Use HPFS / NTFS icon - break; - - case kPartitionTypeFAT16: - devicetype = iDeviceFAT16; // Use FAT16 icon - break; - - case kPartitionTypeFAT32: - devicetype = iDeviceFAT32; // Use FAT32 icon - break; - - case kPartitionTypeEXT3: - devicetype = iDeviceEXT3; // Use EXT2/3 icon - break; - - case kPartitionTypeFreeBSD: - devicetype = iDeviceFreeBSD; // Use FreeBSD icon - break; - - case kPartitionTypeOpenBSD: - devicetype = iDeviceOpenBSD; // Use OpenBSD icon - break; - - case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */ - devicetype = iDeviceBEFS;// Use BEFS / Haiku icon - break; - - default: - devicetype = iDeviceGeneric; // Use Generic icon - break; - } - } - - // Draw the selection image and use the next (device_*_o) image for the selected item. - if (isSelected) - { - blend(images[iSelection].image, buffer, centeredAt(images[iSelection].image, p)); - devicetype++; // selec override image - } - - // draw icon - blend( images[devicetype].image, buffer, centeredAt( images[devicetype].image, p )); - - p.y += (images[iSelection].image->height / 2) + font_console.chars[0]->height; - - // draw volume label - drawStrCenteredAt( device->label, &font_small, buffer, p); - -} -#endif void drawDeviceList (int start, int end, int selection) { int i; @@ -2023,6 +1789,21 @@ drawStr(text, font, blendInto, p); } +static int destroyFont(font_t *font) +{ + int i; + for (i = 0; i < CHARACTERS_COUNT; i++) + { + if (font->chars[i]) + { + if (font->chars[i]->pixels) free (font->chars[i]->pixels); + free (font->chars[i]); + font->chars[i] = 0; + } + } + return 0; +} + static int initFont(font_t *font, image_t *data) { unsigned int x = 0, y = 0, x2 = 0, x3 = 0; Index: branches/cparm/i386/modules/GUI/gui.h =================================================================== --- branches/cparm/i386/modules/GUI/gui.h (revision 1734) +++ branches/cparm/i386/modules/GUI/gui.h (revision 1735) @@ -70,15 +70,6 @@ } image_t; /* - * Volume structure. - */ -typedef struct volume_t { - char version[8]; - BVRef bvr; - struct volume_t* next; -} volume_t; - -/* * Font structure. */ typedef struct { Index: branches/cparm/i386/modules/HibernateEnabler/resume.c =================================================================== --- branches/cparm/i386/modules/HibernateEnabler/resume.c (revision 1734) +++ branches/cparm/i386/modules/HibernateEnabler/resume.c (revision 1735) @@ -17,8 +17,6 @@ #include "resume.h" #include "graphic_utils.h" -extern char gMacOSVersion[]; - extern int previewTotalSectors; extern int previewLoadedSectors; extern uint8_t *previewSaveunder; @@ -283,7 +281,7 @@ IOHibernateImageHeader * header = &_header; long buffer; - if(gMacOSVersion[3] == '7') + if(gBootVolume->OSVersion[3] == '7') { HibernateBoot107(image_filename); return; Index: branches/cparm/i386/util/Intel_Acpi/datatype.h =================================================================== --- branches/cparm/i386/util/Intel_Acpi/datatype.h (revision 0) +++ branches/cparm/i386/util/Intel_Acpi/datatype.h (revision 1735) @@ -0,0 +1,56 @@ +/* +Copyright (c) 2010, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef DATATYPE_H +#define DATATYPE_H + +#include +#include +#include + +typedef uint8_t U8; +typedef uint16_t U16; +typedef uint32_t U32; +typedef uint64_t U64; + +/* +//typedef uint32_t bool; +#ifndef false +#define true 1 +#endif + +#ifndef false +#define false 0 +#endif +*/ +#ifndef NULL +#define NULL ((void *) 0) +#endif + + +#endif /* DATATYPE_H */ Property changes on: branches/cparm/i386/util/Intel_Acpi/datatype.h ___________________________________________________________________ Added: svn:executable + * Index: branches/cparm/i386/util/Intel_Acpi/ppm.h =================================================================== --- branches/cparm/i386/util/Intel_Acpi/ppm.h (revision 0) +++ branches/cparm/i386/util/Intel_Acpi/ppm.h (revision 1735) @@ -0,0 +1,289 @@ +/* +Copyright (c) 2010, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef ppm_h +#define ppm_h + +#include "datatype.h" + +#define PROFILE_ALL +//#define PROFILE_NEHALEM_EP_DP +//#define PROFILE_WESTMERE_EP_UP_DP +//#define PROFILE_NEHALEM_EX_MP +//#define PROFILE_WESTMERE_EX_MP +//#define PROFILE_SANDYBRIDGE_UP + +#if defined(PROFILE_ALL) || defined(PROFILE_WESTMERE_EX_MP) + +#define MAX_CPU_SOCKETS 8 // max count of cpu packages (any range of APIC IDs is ok) +#define MAX_LOGICAL_CPU 256 // max count of cpu found in MADT +#define MAX_CORES 32 // Based on full range of Core APID ID values (max of 5 bits for core APIC ID mask) + +#elif defined(PROFILE_NEHALEM_EX_MP) + +#define MAX_CPU_SOCKETS 8 // max count of cpu packages (any range of APIC IDs is ok) +#define MAX_LOGICAL_CPU 128 // max count of cpu found in MADT +#define MAX_CORES 16 // Based on full range of Core APID ID values (max of 4 bits for core APIC ID mask) + +#elif defined(PROFILE_WESTMERE_EP_UP_DP) + +#define MAX_CPU_SOCKETS 2 // max count of cpu packages (any range of APIC IDs is ok) +#define MAX_LOGICAL_CPU 64 // max count of cpu found in MADT +#define MAX_CORES 16 // Based on full range of Core APID ID values (max of 4 bits for core APIC ID mask) + +#elif defined(PROFILE_NEHALEM_EP_UP_DP) + +#define MAX_CPU_SOCKETS 2 // max count of cpu packages (any range of APIC IDs is ok) +#define MAX_LOGICAL_CPU 32 // max count of cpu found in MADT +#define MAX_CORES 8 // Based on full range of Core APID ID values (max of 3 bits for core APIC ID mask) + +#elif defined(PROFILE_SANDY_BRIDGE_UP) + +#define MAX_CPU_SOCKETS 1 // max count of cpu packages (any range of APIC IDs is ok) +#define MAX_LOGICAL_CPU 8 // max count of cpu found in MADT +#define MAX_CORES 4 + +#endif + +#define MAX_PSTATES 16 +#define MAX_CSTATES 4 +#define MAX_TSTATES 15 + +//Define ACPI_CSD to force building ACPI _CSD +//#define BUILD_ACPI_CSD + +#ifndef DWORD_REGS_TYPEDEF +#define DWORD_REGS_TYPEDEF +typedef struct dword_regs { + U32 _eax; + U32 _ebx; + U32 _ecx; + U32 _edx; +} DWORD_REGS; +#endif + +typedef struct acpi_tables { + // Define the Storage Locations for all the ACPI Table Pointers. + ACPI_TABLE_DSDT *DsdtPointer; // Differentiated System Description Table (RSDP->RSDT->FACP->DSDT) + ACPI_TABLE_DSDT *DsdtPointer64; // Differentiated System Description Table (RSDP->XSDT->FACP->XDSDT) + ACPI_TABLE_FADT *FacpPointer; // Fixed ACPI Description Table (RSDP->RSDT->FACP) + ACPI_TABLE_FACS *FacsPointer; // Firmware ACPI Control Structure (RSDP->RSDT->FACP->FACS) + ACPI_TABLE_FACS *FacsPointer64; // Firmware ACPI Control Structure (RSDP->XSDT->FACP->XFACS) + ACPI_TABLE_RSDP *RsdPointer; // Root System Description Pointer Structure (RSDP) + ACPI_TABLE_RSDT *RsdtPointer; // Root System Description Table (RSDP->RSDT) + ACPI_TABLE_MADT *MadtPointer; // Multiple APIC Description Table (RSDP->RSDT->APIC) + ACPI_TABLE_MADT *MadtPointer64; // Multiple APIC Description Table (RSDP->XSDT->APIC) + ACPI_TABLE_XSDT *XsdtPointer; // Extended Root System Description Table (RSDP->XSDT) + ACPI_TABLE_FADT *FacpPointer64; // Fixed ACPI Description Table (RSDP->XSDT->FACP) +} ACPI_TABLES; + +typedef struct pstate { + U32 frequency; + U32 power; + U32 ratio; + U32 translatency; + U32 bmlatency; + U32 control; + U32 status; +} PSTATE; + +typedef struct pkg_pstates { + U32 num_pstates; + PSTATE pstate[MAX_PSTATES]; +} PKG_PSTATES; + +typedef struct tstate { + U32 freqpercent; + U32 power; + U32 latency; + U32 control; + U32 status; +} TSTATE; + +typedef struct pkg_tstates { + U32 num_tstates; + TSTATE tstate[MAX_TSTATES]; +} PKG_TSTATES; + +typedef enum cstate_encoding { + IO_REDIRECTION = 0, + NATIVE_MWAIT = 1, +} CSTATE_ENCODING; + +typedef enum cpu_cstate { + CPU_C1 = 1, + //CPU_C2 = 2, + CPU_C3_ACPI_C2 = 3, + CPU_C3_ACPI_C3 = 4, + CPU_C4 = 5, + CPU_C6 = 6, + CPU_C7 = 7, +} CPU_CSTATE; + +typedef struct cstate { + U8 type; + U16 latency; + U32 power; +} CSTATE; + +typedef struct pkg_cstates { + U32 num_cstates; + CSTATE cstate[MAX_CSTATES]; + ACPI_GENERIC_ADDRESS gas[MAX_CSTATES]; +} PKG_CSTATES; + +typedef struct cpu_details { + U32 present; + U32 x2apic_id; + U32 socket_id; + U32 intra_package_mask_width; + U32 intra_package_mask; + U32 smt_mask_width; + U32 smt_select_mask; + U32 core_select_mask; + DWORD_REGS cpuid1; + DWORD_REGS cpuid5; + DWORD_REGS cpuid6; + DWORD_REGS cpuidB_0; + DWORD_REGS cpuidB_1; + U32 eist_cpuid_feature_flag; + U32 turbo_cpuid_feature_flag; + U32 turbo_misc_enables_feature_flag; + U32 invariant_apic_timer_flag; + U32 tdc_limit; + U32 tdp_limit; + U32 turbo_available; + U32 max_ratio_as_mfg; + U32 max_ratio_as_cfg; + U32 min_ratio; + U32 tdc_tdp_limits_for_turbo_flag; + U32 ratio_limits_for_turbo_flag; + U32 xe_available; + U32 logical_processor_count_from_madt; + U32 core_logical_processor_count_from_madt[MAX_CORES]; + + PKG_PSTATES pkg_pstates; + + PKG_CSTATES pkg_mwait_cstates; + PKG_CSTATES pkg_io_cstates; + + PKG_TSTATES pkg_tstates; + + U32 package_cstate_limit; + U32 core_c1_supported; + U32 core_c2_supported; + U32 core_c3_supported; + U32 core_c4_supported; + U32 core_c6_supported; + U32 core_c7_supported; + U32 mwait_supported; + U32 acpi_support_cpuid_feature_flag; + U32 energy_perf_bias_supported; + + U64 package_power_limit; + U64 package_power_sku_unit; +} CPU_DETAILS; + +typedef struct socket_info { + U32 signature; + U32 socket_count; + CPU_DETAILS cpu[MAX_CPU_SOCKETS]; +} SOCKET_INFO; + +typedef struct lapic_info { + U32 processorId; + U32 apicId; + U32 pkg_index; + U32 core_apic_id; + U32 core_index; + PROCESSOR_NUMBER_TO_NAMESEG *namepath; + U32 madt_type; + U32 uid; +} LAPIC_INFO; + +typedef struct proc_info { + U32 processorId; + U32 apicId; +} PROC_INFO; + +typedef struct madt_info { + U32 lapic_count; + LAPIC_INFO lapic[MAX_LOGICAL_CPU]; +} MADT_INFO; + +typedef struct rsdt_info { + U32 proc_count; + PROC_INFO processor[MAX_LOGICAL_CPU]; +} RSDT_INFO; + +typedef struct smp_exit_state { + U32 signature; + + // Number of Failure or Informative codes included in the buffer + U32 error_code_count; + + // Buffer of Failure or Informative codes + U32 error_codes[10]; +} SMP_EXIT_STATE; + +typedef enum smp_exit_code { + // Generic successful + SMP_EXIT_CODE_OK = 1, + + // Generic failure + EXIT_CODE_FAILED = 2, + + // First logical processor for this socket unable to find available structure + EXIT_CODE_FAILED_SOCKET_PROXY_SAVE = 3, +} SMP_EXIT_CODE; + +typedef struct ppm_host { + U32 signature; + + U32 pstates_enabled; + U32 pstate_coordination; + U32 turbo_enabled; + U32 cstates_enabled; + U32 tstates_enabled; + U32 performance_per_watt; + + ACPI_TABLES acpi_tables; + + + RSDT_INFO rsdt_info; + MADT_INFO madt_info; + SOCKET_INFO skt_info; + + PPM_SETUP_OPTIONS *options; + + SMP_EXIT_STATE smp_exit_state; + + U32 detected_cpu_family; +} PPM_HOST; + +#endif // ppm_h Property changes on: branches/cparm/i386/util/Intel_Acpi/ppm.h ___________________________________________________________________ Added: svn:executable + * Index: branches/cparm/i386/util/Intel_Acpi/ppmsetup.h =================================================================== --- branches/cparm/i386/util/Intel_Acpi/ppmsetup.h (revision 0) +++ branches/cparm/i386/util/Intel_Acpi/ppmsetup.h (revision 1735) @@ -0,0 +1,371 @@ +/* +Copyright (c) 2010, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef ppmsetup_h +#define ppmsetup_h + +#include "datatype.h" + +#define CURRENT_PPM_RCM_INTERFACE_SPECIFICATION 11 + +#ifndef nameseg_defined +#define nameseg_defined +#define NAMESEG(s) (((U32)(s[0]) << 0) \ + |((U32)(s[1]) << 8) \ + |((U32)(s[2]) << 16) \ + |((U32)(s[3]) << 24)) +#endif + +typedef enum ssdt_loc_flag { + // Flag indicating the SSDT ACPI structure should be built in a stack-based + // buffer. If the SSDT is successfully created, then the following occurs: + // (1) the RSDT ACPI structure is moved lower in memory and updated to + // include a pointer to the new SSDT. + // (2) the SSDT APCI structure is copied into memory just above the moved + // RSDT structure + // (3) the RSD ACPI structure is updated to included the new location of + // the just moved RSDT ACPI structure + // Note: The XSDT is not updated! + // + // NOTE: THIS OPTION WILL DEPRECATED AND REMOVED + // IN A FUTURE VERSION OF THIS SPECIFICATION. + SSDT_LOC_FLAG_ACPI_RECLAIM = 0, + + // Flag indicating the SSDT should be built directly in the memory region + // provided by the ssdt_mem_addr option parameter. + // If the SSDT is successfully created, then the following occurs: + // (1) the RSDT ACPI structure is moved lower in memory and updated to + // include a pointer to the new SSDT. + // (2) the RSD ACPI structure is updated to include the new location of the + // RSDT ACPI structure. + // Note: The XSDT is not updated! + // + // NOTE: THIS OPTION WILL DEPRECATED AND REMOVED + // IN A FUTURE VERSION OF THIS SPECIFICATION. + SSDT_LOC_FLAG_ADDR_PROVIDED = 1, + + // Flag indicating the SSDT should be built directly in the memory region + // provided by the ssdt_mem_addr option parameter. + // After SSDT is successfully created, no further processing occurs. + SSDT_LOC_FLAG_ADDR_PROVIDED_NO_INSERT = 2, + + // Flag indicating the SSDT should be built directly in the memory region + // provided by the ssdt_mem_addr option parameter. + // After SSDT is successfully created, then the following occurs: + // (1) the RSDT ACPI structure is not moved but is updated to + // include a 32-bit pointer to the new SSDT. + // (2) If the XSDT exists, it is not moved but is updated to + // include a 64-bit pointer to the new SSDT. + SSDT_LOC_FLAG_ADDR_PROVIDED_INSERT = 3, +} SSDT_LOC_FLAG; + +typedef enum exit_code { + // PPM RCM completed all initialization successfully + EXIT_CODE_PPM_COMPLETED = 1, + + // Failed building P-state table + EXIT_CODE_FAILED_BUILD_PSTATES = 2, + + EXIT_CODE_PPM_EIST_DISABLED = 3, + + // Failed to find ACPI tables + EXIT_CODE_FAILED_FIND_ACPI_TABLES = 4, + + // Failed to process the ACPI MADT structure + EXIT_CODE_FAILED_PROCESS_MADT = 5, + + // Failed to resolve ACPI MADT structure against available logical + // processors + EXIT_CODE_FAILED_PROCESS_MADT_INFO = 6, + + // Failed to build ACPI SSDT structure + EXIT_CODE_FAILED_PROCESS_SSDT = 7, + + // Failed to build and intialize HOST structure + EXIT_CODE_FAILED_HOST_INIT = 8, + + // Failed during wake of all NBSP to gather processor information + EXIT_CODE_FAILED_COLLECT_SOCKET_INFO = 9, + + // Failed to resolve target configuration between desired options and + // processor features + EXIT_CODE_FAILED_DETERMINE_CONFIGURATION = 0x0a, + + // No SSDT ACPI struture was created + EXIT_CODE_NO_SSDT_CREATED = 0x0b, + + // Failed to build Cstates correctly + EXIT_CODE_FAILED_BUILD_CSTATES = 0x0c, + + // Failed to build Tstates correctly + EXIT_CODE_FAILED_BUILD_TSTATES = 0x0d, + + // Failed to find package index of logical processor listed in MADT ACPI table + EXIT_CODE_FAILED_FIND_PKG_INDEX_FROM_LAPIC = 0x0e, + + // Failed with invalid input provided for SSDT location flag + EXIT_CODE_FAILED_INVALID_SSDT_LOCATION_FLAG = 0x0f, + + // Failed with no logical processors found in MADT + EXIT_CODE_FAILED_NO_LAPIC_FOUND_IN_MADT = 0x10, + + // Failed with SSDT size exceeded during SSDT creation + EXIT_CODE_FAILED_SSDT_SIZE_EXCEEDED = 0x11, + + // Failed to build ACPI SSDT structure + EXIT_CODE_FAILED_BUILD_SSDT = 0x12, + + // Failed with core index of logical processor listed in MADT ACPI table exceeding max + EXIT_CODE_MAX_CORES_EXCEEDED = 0x13, + + // Failed to find CPU Scope from array of ACPI processor number to ACPI CPU NameSeg structures + EXIT_CODE_FAILED_FIND_CPU_SCOPE_NAME_SEG = 0x14, + + // Failed to update FADT + EXIT_CODE_FAILED_UPDATE_FADT = 0x15, + + // GPF detected + EXIT_CODE_GPF_DETECTED = 0x16, + + // Failed with invalid SSDT buffer address + EXIT_CODE_INVALID_SSDT_ADDR = 0x17, + + // Failed with invalid SSDT buffer length + EXIT_CODE_INVALID_SSDT_LEN = 0x18, +} EXIT_CODE; + +typedef struct exit_state { + // 1 = success, 0 = failure + U32 return_status; + + // Number of Failure or Informative codes included in the buffer + U32 error_code_count; + + // Buffer of Failure or Informative codes + U32 error_codes[10]; + + // This 32-bit physical memory address specifies the final location for the + // SSDT ACPI structure built by the PPM RC. + U32 ssdt_mem_addr; + + // This value specifies the final size of the SSDT ACPI structure for the + // SSDT ACPI structure built by the PPM RC. + U32 ssdt_mem_size; + + // The final state for the P-state initialization + // 1=enabled; 0=disabled + U32 pstates_enabled; + + // The final state for the Turbo feature initialization + // 1=enabled; 0=disabled + U32 turbo_enabled; + + // The final state for the C-state initialization + // 1=enabled; 0=disabled + U32 cstates_enabled; + + // The final state for the T-state initialization + // 1=enabled; 0=disabled + U32 tstates_enabled; +} EXIT_STATE; + +typedef enum cpu_namespace_flag { + // Flag indicating the SSDT ACPI structure should be built + // using ACPI 1.0 compliant processor namespace "_PR" + CPU_NAMESPACE_PR = 0, + + // Flag indicating the SSDT ACPI structure should be built + // using ACPI 2.0+ compliant processor namespace "_SB" + CPU_NAMESPACE_SB = 1, +} CPU_NAMESPACE_FLAG; + +// Define the total number of required NameSegs to reach the DSDT processor +// device or object declarations +#define MAX_SUPPORTED_CPU_NAMESEGS 3 + +typedef struct processor_number_to_nameseg { + // Contains one of the ACPI processor ID values used in a + // ACPI Declare Processor statement in the DSDT or XSDT + U32 acpi_processor_number; + + // Number of NameSpace segments in NamePath to processor devices/objects + U32 seg_count; + + // Contains the corresponding ACPI Name Scope in the form + // of a series of NameSegs constituting the NamePath to a + // processor device or object declaration + U32 nameseg[MAX_SUPPORTED_CPU_NAMESEGS]; +} PROCESSOR_NUMBER_TO_NAMESEG; + +typedef struct ppm_setup_options { + // This 32-bit physical memory address specifies a read-write memory region + // below 1MB. Minimum size is 8KB. This memory is used by the callback as + // the SIPI target and stack for each AP. This region is not required to be + // cacheable. + U32 mem_region_below_1M; + + // Number of CPU sockets which exist on the platform + U32 num_sockets; + + // Desired state for the P-state initialization + // 1=enabled; 0=disabled + U32 pstates_enabled; + + // Desired state for the P-state hardware coordination + // ACPI_PSD_COORD_TYPE_SW_ALL = 0xFC + // ACPI_PSD_COORD_TYPE_SW_ANY = 0xFD + // ACPI_PSD_COORD_TYPE_HW_ALL = 0xFE + U32 pstate_coordination; + + // Desired state for the Turbo state initialization + // 1=enabled; 0=disabled + U32 turbo_enabled; + + // Desired state for the C-state initialization + // 1=enabled; 0=disabled + U32 cstates_enabled; + + // Desired state for the C1E initialization + // 1=enabled; 0=disabled + U32 c1e_enabled; + + // Desired state for the processor core C3 state included in the _CST + // 0= processor core C3 cannot be used as an ACPI C state + // 2= processor core C3 can be used as an ACPI C2 state + // 3= processor core C3 can be used as an ACPI C3 state + // 4= processor core C3 can be used as an ACPI C2 state + // if Invariant APIC Timer detected, else not used as ACPI C state + // 5= processor core C3 can be used as an ACPI C2 state + // if Invariant APIC Timer detected, else APIC C3 state + U32 c3_enabled; + + // Desired state for the processor core C6 state included in the _CST as an + // ACPI C3 state. + // 1= processor core C6 can be used as an ACPI C3 state + // 0= processor core C6 cannot be used as an ACPI C3 state + U32 c6_enabled; + + // Desired state for the processor core C7 state included in the _CST as an + // ACPI C3 state. + // 1= processor core C7 can be used as an ACPI C7 state + // 0= processor core C7 cannot be used as an ACPI C7 state + U32 c7_enabled; + + // Desired state for providing alternate ACPI _CST structure using MWAIT + // extensions + // 1= Alternate _CST using MWAIT extension is enabled for OSPM use + // 0= Alternate _CST using MWAIT extension is disabled for OSPM use + U32 mwait_enabled; + + // Power management base address used for processors + U32 pmbase; + + // Desired state for the C-state package limit. + // Note: The C-state package limit may be further limited by the + // capabilities of the processor + // 000b = C0 (No package C-state support) + // 001b = C1 (Behavior is the same as 000b) + // 010b = C3 + // 011b = C6 + // 100b = C7 + // 111b = No package C-state limit + U32 package_cstate_limit; + + // Desired state for the T-state initialization + // 1=enabled; 0=disabled + U32 tstates_enabled; + + // This 32-bit physical memory address specifies a read-write memory region + // for the SSDT ACPI structure built by the PPM RC. Minimum size is 16KB. + U32 ssdt_mem_addr; + + // This value specifies the size of the SSDT memory region. Minimum size is + // 16KB. + U32 ssdt_mem_size; + + // This value specifies the PPM RCM behavior related to creation and + // incorporation of the new SSDT ACPI structure. See definition of the + // SSDT_LOC_FLAG for acceptable values. + U32 ssdt_loc_flag; + + // This value specifies the PPM RCM behavior related to creation and + // incorporation of the new SSDT ACPI structure. If all power management + // features are disabled by input options, the SSDT can still be created + // for debug review. + // 1 = Create SSDT even if all power management features are disabled + // 0 = Do not create SSDT if all power management features are disabled + U32 ssdt_force_creation; + + // Exit structure intended to convey state to the caller and/or subsequent + // init code + EXIT_STATE exit_state; + + // Flag indicating the processor namespace that should be used in the + // SSDT ACPI structure for each CPU. + // See definition of the CPU_NAMESPACE_FLAG for acceptable values. + U32 cpu_namespace_flag; + + // This version number identifies the PPM RCM specification. + // Specifically denotes the version of this structure definition is compliant + // with with file nehalem-ppm-rcm-vX.txt where X is the version number. + // PPMSETUP.C should always use the version definition from the top of + // this file called CURRENT_PPM_RCM_INTERFACE_SPECIFICATION. + U32 ppm_rcm_interface_specification; + + // This flag indicates whether or not after all AP Wakes are completed, + // that the AP should be forced to jump to the real mode address specified + // in the realmode_callback_address field below. + // realmode_callback = 0 means leave AP in INIT or Wait For SIPI (WFS) state + // realmode_callback = 1 means AP should jump to real mode address specified below + U32 realmode_callback_flag; + + // This file contains the real mode callback address which AP must jump to after + // INIT_SIPI_SIPI sequences used to force AP initalization for PPM. + // Upper 16-bits specify target real mode segment for a far 16-bit jump instruction + // Lower 16-bits specify target real mode offset for a far 16-bit jump instruction + U32 realmode_callback_address; + + // Number of ACPI processor number to ACPI CPU NameSeg structures + U32 cpu_map_count; + + // Array of ACPI processor number to ACPI CPU NameSeg structures + PROCESSOR_NUMBER_TO_NAMESEG *cpu_map; + + // This flag indicates whether or not PPM RC should update an existing ACPI FADT. + // modify_fadt_flag = 0 means do not modify existing ACPI FADT structure + // modify_fadt_flag = 1 means do check and if needed, modify existing ACPI FADT structure + U32 modify_fadt_flag; + + // Desired state for the performance_per_watt optimizations + // performance_per_watt = 2 means "Low Power" + // performance_per_watt = 1 means "Power Optimized or Power Balanced" + // performance_per_watt = 0 means "Traditional or Max Performance" + U32 performance_per_watt; +} PPM_SETUP_OPTIONS; + +#endif // ppmsetup_h Property changes on: branches/cparm/i386/util/Intel_Acpi/ppmsetup.h ___________________________________________________________________ Added: svn:executable + * Index: branches/cparm/i386/util/Intel_Acpi/acpidecode.h =================================================================== --- branches/cparm/i386/util/Intel_Acpi/acpidecode.h (revision 0) +++ branches/cparm/i386/util/Intel_Acpi/acpidecode.h (revision 1735) @@ -0,0 +1,59 @@ +/* +Copyright (c) 2010, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef ACPI_DECODE_H +#define ACPI_DECODE_H + +#include "datatype.h" +#include "intel_acpi.h" +#include "ppm.h" + +/* acpidecode.h contains functions needed only for decoding ACPI to produce the + * inputs to the PPM code, but not needed for encoding ACPI as done inside the + * PPM code. */ + +#define ACPI_NAMESPACE_MAX_DEPTH 10 + +struct acpi_namespace { + U32 nameseg[ACPI_NAMESPACE_MAX_DEPTH]; + U32 depth; +}; + +/* Globals used for retrieving ACPI processor structures from the DSDT */ + +#define CPU_MAP_LIMIT 256 /* Any bigger than 256 and we'd have to support the x2APIC structures, which we don't yet anyway. */ + +struct acpi_processor { + struct acpi_namespace ns; + U8 id; + U32 pmbase; +}; + +#define ACPI_NAMESPATH_STR_MAX_LEN 2 /* \_ */ + (4 * ACPI_NAMESPACE_MAX_DEPTH ) + (ACPI_NAMESPACE_MAX_DEPTH - 1 /*max number of . */ ) + 1 /* eof */ + +#endif /* ACPI_DECODE_H */ Property changes on: branches/cparm/i386/util/Intel_Acpi/acpidecode.h ___________________________________________________________________ Added: svn:executable + * Index: branches/cparm/i386/util/Intel_Acpi/intel_acpi.h =================================================================== --- branches/cparm/i386/util/Intel_Acpi/intel_acpi.h (revision 0) +++ branches/cparm/i386/util/Intel_Acpi/intel_acpi.h (revision 1735) @@ -0,0 +1,692 @@ +/* Per ACPI 3.0a spec */ + +/* + Copyright (c) 2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __LIBSAIO_INTEL_ACPI_H +#define __LIBSAIO_INTEL_ACPI_H + +#include "datatype.h" +#include "ppmsetup.h" +// +// All tables and structures must be byte-packed to match the ACPI specification +#pragma pack(1) + +#define ACPI_SIG_DSDT "DSDT" // Differentiated System Description Table +#define ACPI_SIG_FADT "FACP" // Fixed ACPI Description Table +#define ACPI_SIG_FACS "FACS" // Firmware ACPI Control Structure +#define ACPI_SIG_PSDT "PSDT" // Persistent System Description Table +#define ACPI_SIG_RSDP "RSD PTR " // Root System Description Pointer +#define ACPI_SIG_RSDT "RSDT" // Root System Description Table +#define ACPI_SIG_XSDT "XSDT" // Extended System Description Table +#define ACPI_SIG_SSDT "SSDT" // Secondary System Description Table +#define ACPI_RSDP_NAME "RSDP" // Short name for RSDP, not signature +#define ACPI_SIG_MADT "APIC" // Multiple APIC Description Table +#define ACPI_SIG_SBST "SBST" // Smart Battery Specification Table +#define ACPI_SIG_ECDT "ECDT" // Embedded Controller Boot Resources Table +#define ACPI_SIG_ASF "ASF!" // Alert Standard Format table +#define ACPI_SIG_DMAR "DMAR" // DMA Remapping table +#define ACPI_SIG_HPET "HPET" // High Precision Event Timer table +#define ACPI_SIG_MCFG "MCFG" // PCI Memory Mapped Configuration table +#define ACPI_SIG_UEFI "UEFI" // Uefi Boot Optimization Table + + +#ifndef nameseg_defined +#define nameseg_defined +#define NAMESEG(s) (((U32)(s[0]) << 0) \ +|((U32)(s[1]) << 8) \ +|((U32)(s[2]) << 16) \ +|((U32)(s[3]) << 24)) +#endif + +#define NAMESEG64(s) (((U64)(s[0]) << 0) \ +|((U64)(s[1]) << 8) \ +|((U64)(s[2]) << 16) \ +|((U64)(s[3]) << 24) \ +|((U64)(s[4]) << 32) \ +|((U64)(s[5]) << 40) \ +|((U64)(s[6]) << 48) \ +|((U64)(s[7]) << 56)) \ + + +// Data Objects Encoding values. +#define AML_EXT_OP_PREFIX 0x5B + +// Name Space Modifier Objects Encoding values. +#define AML_NAME_OP 0x08 // Name operator. +#define AML_SCOPE_OP 0x10 // Scope operator. + +// Named Objects Encoding values. +#define AML_MUTEX_OP 0x01 +#define AML_METHOD_OP 0x14 // Method operator. +#define AML_OPREGION_OP 0x80 // Operation Region operator. +#define AML_FIELD_OP 0x81 +#define AML_DEVICE_OP 0x82 +#define AML_PROCESSOR_OP 0x83 // Processor operator. + +// Type2 Opcodes Encoding values. +#define AML_NULL_NAME 0x00 +#define AML_ZERO_OP 0x00 +#define AML_ALIAS_OP 0x06 +#define AML_ONE_OP 0x01 +#define AML_BYTE_OP 0x0a +#define AML_WORD_OP 0x0b +#define AML_DWORD_OP 0x0c +#define AML_STRING_OP 0x0d +#define AML_QWORD_OP 0x0e +#define AML_BUFFER_OP 0x11 +#define AML_PACKAGE_OP 0x12 +#define AML_COND_REF_OF_OP 0x12 // Requires AML_EXT_OP_PREFIX +#define AML_CREATE_FIELD_OP 0x13 // Requires AML_EXT_OP_PREFIX +#define AML_DUAL_NAME_PREFIX 0x2e +#define AML_MULTI_NAME_PREFIX 0x2f +#define AML_REVISION_OP 0x30 // Requires AML_EXT_OP_PREFIX +#define AML_DEBUG_OP 0x31 +#define AML_ROOT_PREFIX 0x5c +#define AML_PARENT_PREFIX 0x5e +#define AML_LOCAL0_OP 0x60 +#define AML_LOCAL1_OP 0x61 +#define AML_LOCAL2_OP 0x62 +#define AML_LOCAL3_OP 0x63 +#define AML_LOCAL4_OP 0x64 +#define AML_LOCAL5_OP 0x65 +#define AML_LOCAL6_OP 0x66 +#define AML_LOCAL7_OP 0x67 +#define AML_ARG0_OP 0x68 +#define AML_ARG1_OP 0x69 +#define AML_ARG2_OP 0x6A +#define AML_ARG3_OP 0x6B +#define AML_ARG4_OP 0x6C +#define AML_ARG5_OP 0x6D +#define AML_ARG6_OP 0x6E +#define AML_STORE_OP 0x70 +#define AML_CONCAT_OP 0x73 +#define AML_SUBTRACT_OP 0x74 +#define AML_MULTIPLY_OP 0x77 +#define AML_AND_OP 0x7B +#define AML_END_TAG_OP 0x79 +#define AML_GEN_REG_FIELD 0x82 +#define AML_PROCESSOR_OP 0x83 +#define AML_INDEXFIELD_OP 0x86 // Requires AML_EXT_OP_PREFIX +#define AML_SIZEOF_OP 0x87 +#define AML_INDEX_OP 0x88 +#define AML_CREATE_DWORD_FIELD_OP 0x8A +#define AML_LAND_OP 0x90 +#define AML_LOR_OP 0x91 +#define AML_LNOT_OP 0x92 +#define AML_LEQUAL_OP 0x93 +#define AML_LGREATER_OP 0x94 +#define AML_LLESS_OP 0x95 +#define AML_IF_OP 0xA0 +#define AML_ELSE_OP 0xA1 +#define AML_RETURN_OP 0xA4 +#define AML_ONES_OP 0xFF + +#define GAS_TYPE_FFH 0x7f +#define GAS_TYPE_SYSTEM_IO 0x01 +#define GAS_VENDOR_INTEL 0x01 +#define GAS_CLASS_CODE_NATIVE 0x02 + +// Define the Generic System Description Table Structure. +// This common header is used by all tables except the RSDP and FACS. +// The define is used for direct inclusion of header into other ACPI tables +typedef struct acpi_table_header { + U8 Signature[4]; // ASCII table signature + U32 Length; // Length of table in bytes, including this header + U8 Revision; // ACPI Specification minor version # + U8 Checksum; // To make checksum of entire table == 0 + U8 OemId[6]; // ASCII OEM identification + U8 OemTableId[8]; // ASCII OEM table identification + U32 OemRevision; // OEM revision number + U8 AslCompilerId[4]; // ASCII ASL compiler vendor ID + U32 AslCompilerRevision; // ASL compiler version +} ACPI_TABLE_HEADER; + +// GAS - Generic Address Structure (ACPI 2.0+) +typedef struct acpi_generic_address { + U8 SpaceId; // Address space where struct or register exists + U8 BitWidth; // Size in bits of given register + U8 BitOffset; // Bit offset within the register + U8 AccessWidth; // Minimum Access size (ACPI 3.0) + U64 Address; // 64-bit address of struct or register +} ACPI_GENERIC_ADDRESS; + +// RSDP - Root System Description Pointer (Signature is "RSD PTR ") +typedef struct acpi_table_rsdp { + U8 Signature[8]; // ACPI signature, contains "RSD PTR " + U8 Checksum; // ACPI 1.0 checksum + U8 OemId[6]; // OEM identification + U8 Revision; // Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ + U32 RsdtPhysicalAddress; // 32-bit physical address of the RSDT + U32 Length; // Table length in bytes, including header (ACPI 2.0+) + U64 XsdtPhysicalAddress; // 64-bit physical address of the XSDT (ACPI 2.0+) + U8 ExtendedChecksum; // Checksum of entire table (ACPI 2.0+) + U8 Reserved[3]; // Reserved, must be zero +} ACPI_TABLE_RSDP; + +#define ACPI_RSDP_REV0_SIZE 20 // Size of original ACPI 1.0 RSDP + +// RSDT - Root System Description Table +typedef struct acpi_table_rsdt { + ACPI_TABLE_HEADER Header; // Common ACPI table header + U32 TableOffsetEntry[1]; // Array of pointers to ACPI tables +} ACPI_TABLE_RSDT; + + +// XSDT - Root System Description Table +typedef struct acpi_table_xsdt { + ACPI_TABLE_HEADER Header; // Common ACPI table header + U64 TableOffsetEntry[1]; // Array of pointers to ACPI tables +} ACPI_TABLE_XSDT; + +// DSDT - Differentiated System Description Table +typedef struct acpi_table_dsdt { + ACPI_TABLE_HEADER Header; // Common ACPI table header + U32 EntryStart; +} ACPI_TABLE_DSDT; + +// FACS - Firmware ACPI Control Structure (FACS) +typedef struct acpi_table_facs { + U8 Signature[4]; // ASCII table signature + U32 Length; // Length of structure, in bytes + U32 HardwareSignature; // Hardware configuration signature + U32 FirmwareWakingVector; // 32-bit physical address of the Firmware Waking Vector + U32 GlobalLock; // Global Lock for shared hardware resources + U32 Flags; + U64 XFirmwareWakingVector; // 64-bit version of the Firmware Waking Vector (ACPI 2.0+) + U8 Version; // Version of this table (ACPI 2.0+) + U8 Reserved[31]; // Reserved, must be zero +} ACPI_TABLE_FACS; + +// SBST - Smart Battery Specification Table - Version 1 +typedef struct acpi_table_sbst +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + U32 WarningLevel; + U32 LowLevel; + U32 CriticalLevel; + +} ACPI_TABLE_SBST; + +// ASF - Alert Standard Format table (Signature "ASF!") +typedef struct acpi_table_asf +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_ASF; + +// DMAR - DMA Remapping table - Version 1 +typedef struct acpi_table_dmar +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + U8 Width; /* Host Address Width */ + U8 Flags; + U8 Reserved[10]; + +} ACPI_TABLE_DMAR; + +// HPET - High Precision Event Timer table - Version 1 +typedef struct acpi_table_hpet +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + U32 Id; /* Hardware ID of event timer block */ + ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */ + U8 Sequence; /* HPET sequence number */ + U16 MinimumTick; /* Main counter min tick, periodic mode */ + U8 Flags; + +} ACPI_TABLE_HPET; + +//MCFG - PCI Memory Mapped Configuration table and sub-table - Version 1 +typedef struct acpi_table_mcfg +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + U8 Reserved[8]; + +} ACPI_TABLE_MCFG; + +//UEFI - UEFI Boot optimization Table - Version 1 +typedef struct acpi_table_uefi +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + U8 Identifier[16]; /* UUID identifier */ + U16 DataOffset; /* Offset of remaining data in table */ + +} ACPI_TABLE_UEFI; + +// ECDT - Embedded Controller Boot Resources Table - Version 1 +typedef struct acpi_table_ecdt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + ACPI_GENERIC_ADDRESS Control; /* Address of EC command/status register */ + ACPI_GENERIC_ADDRESS Data; /* Address of EC data register */ + U32 Uid; /* Unique ID - must be same as the EC _UID method */ + U8 Gpe; /* The GPE for the EC */ + U8 Id[1]; /* Full namepath of the EC in the ACPI namespace */ + +} ACPI_TABLE_ECDT; + +// FADT - Fixed ACPI Description Table (Signature "FACP") +typedef struct acpi_table_fadt { + ACPI_TABLE_HEADER Header; // Common ACPI table header + U32 Facs; // 32-bit physical address of FACS + U32 Dsdt; // 32-bit physical address of DSDT + U8 Model; // System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ + U8 PreferredProfile; // Conveys preferred power management profile to OSPM. + U16 SciInterrupt; // System vector of SCI interrupt + U32 SmiCommand; // 32-bit Port address of SMI command port + U8 AcpiEnable; // Value to write to smi_cmd to enable ACPI + U8 AcpiDisable; // Value to write to smi_cmd to disable ACPI + U8 S4BiosRequest; // Value to write to SMI CMD to enter S4BIOS state + U8 PstateControl; // Processor performance state control + U32 Pm1aEventBlock; // 32-bit Port address of Power Mgt 1a Event Reg Blk + U32 Pm1bEventBlock; // 32-bit Port address of Power Mgt 1b Event Reg Blk + U32 Pm1aControlBlock; // 32-bit Port address of Power Mgt 1a Control Reg Blk + U32 Pm1bControlBlock; // 32-bit Port address of Power Mgt 1b Control Reg Blk + U32 Pm2ControlBlock; // 32-bit Port address of Power Mgt 2 Control Reg Blk + U32 PmTimerBlock; // 32-bit Port address of Power Mgt Timer Ctrl Reg Blk + U32 Gpe0Block; // 32-bit Port address of General Purpose Event 0 Reg Blk + U32 Gpe1Block; // 32-bit Port address of General Purpose Event 1 Reg Blk + U8 Pm1EventLength; // Byte Length of ports at Pm1xEventBlock + U8 Pm1ControlLength; // Byte Length of ports at Pm1xControlBlock + U8 Pm2ControlLength; // Byte Length of ports at Pm2ControlBlock + U8 PmTimerLength; // Byte Length of ports at PmTimerBlock + U8 Gpe0BlockLength; // Byte Length of ports at Gpe0Block + U8 Gpe1BlockLength; // Byte Length of ports at Gpe1Block + U8 Gpe1Base; // Offset in GPE number space where GPE1 events start + U8 CstControl; // Support for the _CST object and C States change notification + U16 C2Latency; // Worst case HW latency to enter/exit C2 state + U16 C3Latency; // Worst case HW latency to enter/exit C3 state + U16 FlushSize; // Processor's memory cache line width, in bytes + U16 FlushStride; // Number of flush strides that need to be read + U8 DutyOffset; // Processor duty cycle index in processor's P_CNT reg + U8 DutyWidth; // Processor duty cycle value bit width in P_CNT register. + U8 DayAlarm; // Index to day-of-month alarm in RTC CMOS RAM + U8 MonthAlarm; // Index to month-of-year alarm in RTC CMOS RAM + U8 Century; // Index to century in RTC CMOS RAM + U16 BootFlags; // IA-PC Boot Architecture Flags. See Table 5-10 for description + U8 Reserved; // Reserved, must be zero + U32 Flags; // Miscellaneous flag bits (see below for individual flags) + ACPI_GENERIC_ADDRESS ResetRegister; // 64-bit address of the Reset register + U8 ResetValue; // Value to write to the ResetRegister port to reset the system + U8 Reserved4[3]; // Reserved, must be zero + U64 XFacs; // 64-bit physical address of FACS + U64 XDsdt; // 64-bit physical address of DSDT + ACPI_GENERIC_ADDRESS XPm1aEventBlock; // 64-bit Extended Power Mgt 1a Event Reg Blk address + ACPI_GENERIC_ADDRESS XPm1bEventBlock; // 64-bit Extended Power Mgt 1b Event Reg Blk address + ACPI_GENERIC_ADDRESS XPm1aControlBlock; // 64-bit Extended Power Mgt 1a Control Reg Blk address + ACPI_GENERIC_ADDRESS XPm1bControlBlock; // 64-bit Extended Power Mgt 1b Control Reg Blk address + ACPI_GENERIC_ADDRESS XPm2ControlBlock; // 64-bit Extended Power Mgt 2 Control Reg Blk address + ACPI_GENERIC_ADDRESS XPmTimerBlock; // 64-bit Extended Power Mgt Timer Ctrl Reg Blk address + ACPI_GENERIC_ADDRESS XGpe0Block; // 64-bit Extended General Purpose Event 0 Reg Blk address + ACPI_GENERIC_ADDRESS XGpe1Block; // 64-bit Extended General Purpose Event 1 Reg Blk address +} ACPI_TABLE_FADT; + +// SSDT - Secondary System Description Table +typedef struct acpi_table_ssdt { + ACPI_TABLE_HEADER Header; // Common ACPI table header +} ACPI_TABLE_SSDT; + +//MADT - Multiple APIC Description Table +typedef struct acpi_table_madt { + ACPI_TABLE_HEADER Header; // Common ACPI table header + U32 Address; // Physical address of local APIC + U32 Flags; +} ACPI_TABLE_MADT; + + +// Values for subtable type in ACPI_SUBTABLE_HEADER +enum AcpiMadtType { + ACPI_MADT_TYPE_LOCAL_APIC = 0, + ACPI_MADT_TYPE_IO_APIC = 1, + ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, + ACPI_MADT_TYPE_NMI_SOURCE = 3, + ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, + ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, + ACPI_MADT_TYPE_IO_SAPIC = 6, + ACPI_MADT_TYPE_LOCAL_SAPIC = 7, + ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, + ACPI_MADT_TYPE_X2APIC = 9, + ACPI_MADT_TYPE_RESERVED = 10 // 10 and greater are reserved +}; + +// Common Sub-table header (used in MADT, SRAT, etc.) +typedef struct acpi_subtable_header { + U8 Type; + U8 Length; +} ACPI_SUBTABLE_HEADER; + +// MADT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER + +// 0: Processor Local APIC +typedef struct acpi_madt_local_apic { + ACPI_SUBTABLE_HEADER Header; + U8 ProcessorId; // ACPI processor id + U8 Id; // Processor's local APIC id + U32 LapicFlags; +} ACPI_MADT_LOCAL_APIC; + +// 1: IO APIC +typedef struct acpi_madt_io_apic { + ACPI_SUBTABLE_HEADER Header; + U8 Id; // I/O APIC ID + U8 Reserved; // Reserved - must be zero + U32 Address; // APIC physical address + U32 GlobalIrqBase; // Global system interrupt where INTI lines start +} ACPI_MADT_IO_APIC; + +// 2: Interrupt Override +typedef struct acpi_madt_interrupt_override { + ACPI_SUBTABLE_HEADER Header; + U8 Bus; // 0 - ISA + U8 SourceIrq; // Interrupt source (IRQ) + U32 GlobalIrq; // Global system interrupt + U16 IntiFlags; +} ACPI_MADT_INTERRUPT_OVERRIDE; + +// 3: NMI Source +typedef struct acpi_madt_nmi_source { + ACPI_SUBTABLE_HEADER Header; + U16 IntiFlags; + U32 GlobalIrq; // Global system interrupt +} ACPI_MADT_NMI_SOURCE; + +// 4: Local APIC NMI +typedef struct acpi_madt_local_apic_nmi { + ACPI_SUBTABLE_HEADER Header; + U8 ProcessorId; // ACPI processor id + U16 IntiFlags; + U8 Lint; // LINTn to which NMI is connected +} ACPI_MADT_LOCAL_APIC_NMI; + +// 5: Address Override +typedef struct acpi_madt_local_apic_override { + ACPI_SUBTABLE_HEADER Header; + U16 Reserved; // Reserved, must be zero + U64 Address; // APIC physical address +} ACPI_MADT_LOCAL_APIC_OVERRIDE; + +// 6: I/O Sapic +typedef struct acpi_madt_io_sapic { + ACPI_SUBTABLE_HEADER Header; + U8 Id; // I/O SAPIC ID + U8 Reserved; // Reserved, must be zero + U32 GlobalIrqBase; // Global interrupt for SAPIC start + U64 Address; // SAPIC physical address +} ACPI_MADT_IO_SAPIC; + +// 7: Local Sapic +typedef struct acpi_madt_local_sapic { + ACPI_SUBTABLE_HEADER Header; + U8 ProcessorId; // ACPI processor id + U8 Id; // SAPIC ID + U8 Eid; // SAPIC EID + U8 Reserved[3]; // Reserved, must be zero + U32 LapicFlags; + U32 Uid; // Numeric UID - ACPI 3.0 + char UidString[1]; // String UID - ACPI 3.0 +} ACPI_MADT_LOCAL_SAPIC; + +// 8: Platform Interrupt Source +typedef struct acpi_madt_interrupt_source { + ACPI_SUBTABLE_HEADER Header; + U16 IntiFlags; + U8 Type; // 1=PMI, 2=INIT, 3=corrected + U8 Id; // Processor ID + U8 Eid; // Processor EID + U8 IoSapicVector; // Vector value for PMI interrupts + U32 GlobalIrq; // Global system interrupt + U32 Flags; // Interrupt Source Flags +} ACPI_MADT_INTERRUPT_SOURCE; + +// 9: Processor X2APIC +typedef struct acpi_madt_x2apic { + ACPI_SUBTABLE_HEADER Header; + U16 Reserved; // Must be zero + U32 x2apicId; // Processor's X2APIC ID + U32 x2apicFlags; + U32 UID; +} ACPI_MADT_X2APIC; + +// Common flags fields for MADT subtables + +// MADT Local APIC flags (LapicFlags) +#define ACPI_MADT_ENABLED (1) // 00: Processor is usable if set + +// MADT MPS INTI flags (IntiFlags) +#define ACPI_MADT_POLARITY_MASK (3) // 00-01: Polarity of APIC I/O input signals +#define ACPI_MADT_TRIGGER_MASK (3<<2) // 02-03: Trigger mode of APIC input signals + +// Values for MPS INTI flags +#define ACPI_MADT_POLARITY_CONFORMS 0 +#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1 +#define ACPI_MADT_POLARITY_RESERVED 2 +#define ACPI_MADT_POLARITY_ACTIVE_LOW 3 + +#define ACPI_MADT_TRIGGER_CONFORMS (0) +#define ACPI_MADT_TRIGGER_EDGE (1<<2) +#define ACPI_MADT_TRIGGER_RESERVED (2<<2) +#define ACPI_MADT_TRIGGER_LEVEL (3<<2) + +#define ACPI_COORD_TYPE_SW_ALL 0xFC +#define ACPI_COORD_TYPE_SW_ANY 0xFD +#define ACPI_COORD_TYPE_HW_ALL 0xFE + +typedef struct packageLength { + U8 packageLength0; + U8 packageLength1; +} ACPI_PACKAGE_LENGTH; + +typedef struct acpi_scope { + U8 scopeOpcode; + ACPI_PACKAGE_LENGTH pkgLength; + U8 rootChar; +} ACPI_SCOPE; + +typedef struct dual_name_path { + U8 prefix; + U32 nameseg[2]; +} DUAL_NAME_PATH; + +typedef struct multi_name_path { + U8 prefix; + U8 segCount; + U32 nameseg[MAX_SUPPORTED_CPU_NAMESEGS]; +} MULTI_NAME_PATH; + +typedef struct generic_register { + U8 genericRegisterField; + ACPI_PACKAGE_LENGTH pkgLength; + ACPI_GENERIC_ADDRESS gas; +} ACPI_GENERIC_REGISTER; + +typedef struct package { + U8 packageOpcode; + ACPI_PACKAGE_LENGTH pkgLength; + U8 numElements; +} ACPI_PACKAGE; + +typedef struct small_package { + U8 packageOpcode; + U8 packageLength; + U8 numElements; +} ACPI_SMALL_PACKAGE; + +typedef struct small_buffer { + U8 bufferOpcode; + U8 packageLength; +} ACPI_SMALL_BUFFER; + +typedef struct end_tag { + U8 endTagField; + U8 checksum; +} ACPI_END_TAG; + +typedef struct return_name_seg { + U8 returnOpcode; + U32 name; +} ACPI_RETURN_NAME_SEG; + +typedef struct return_package { + U8 returnOpcode; + ACPI_PACKAGE package; +} ACPI_RETURN_PACKAGE; + +typedef struct return_zero { + U8 returnOpcode; + U8 zeroOpcode; +} ACPI_RETURN_ZERO; + +typedef struct return_opcode { + U8 returnOpcode; + U8 opcodeToReturn; +} ACPI_RETURN_OPCODE; + +typedef struct byteConst { + U8 byteOpcode; + U8 byteData; +} ACPI_BYTE_CONST; + +typedef struct wordConst { + U8 wordOpcode; + U16 wordData; +} ACPI_WORD_CONST; + +typedef struct dwordConst { + U8 dwordOpcode; + U32 dwordData; +} ACPI_DWORD_CONST; + +typedef struct small_method { + U8 methodOpcode; + U8 packageLength; + U32 name; + U8 methodFlags; +} ACPI_SMALL_METHOD; + +typedef struct method { + U8 methodOpcode; + ACPI_PACKAGE_LENGTH pkgLength; + U32 name; + U8 methodFlags; +} ACPI_METHOD; + +typedef struct namePath { + U8 nameOpcode; + U32 name; +} ACPI_NAME_PATH; + +typedef struct named_dword { + ACPI_NAME_PATH namePath; + ACPI_DWORD_CONST dword; +} ACPI_NAMED_DWORD; + +typedef struct rootNamePath { + U8 nameOpcode; + U8 rootPrefix; + U32 name; +} ACPI_ROOT_NAME_PATH; + +typedef struct root_named_dword { + ACPI_ROOT_NAME_PATH rootNamePath; + ACPI_DWORD_CONST dword; +} ACPI_ROOT_NAMED_DWORD; + +typedef struct named_object { + ACPI_NAME_PATH namePath; + ACPI_PACKAGE package; +} ACPI_NAMED_OBJECT; + +typedef struct small_named_object { + ACPI_NAME_PATH namePath; + ACPI_SMALL_PACKAGE package; +} ACPI_SMALL_NAMED_OBJECT; + +typedef struct create_dword_field { + ACPI_NAME_PATH namePath; + ACPI_SMALL_PACKAGE package; +} ACPI_CREATE_DWORD_FIELD; + +typedef struct tstate_package { + ACPI_SMALL_PACKAGE package; + ACPI_DWORD_CONST FreqPercent; + ACPI_DWORD_CONST Power; + ACPI_DWORD_CONST TransLatency; + ACPI_DWORD_CONST Control; + ACPI_DWORD_CONST Status; +} ACPI_TSTATE_PACKAGE; + +typedef struct pstate_package { + ACPI_SMALL_PACKAGE package; + ACPI_DWORD_CONST CoreFreq; + ACPI_DWORD_CONST Power; + ACPI_DWORD_CONST TransLatency; + ACPI_DWORD_CONST BMLatency; + ACPI_DWORD_CONST Control; + ACPI_DWORD_CONST Status; +} ACPI_PSTATE_PACKAGE; + +typedef struct psd_package { + ACPI_SMALL_PACKAGE package; + ACPI_BYTE_CONST NumberOfEntries; + ACPI_BYTE_CONST Revision; + ACPI_DWORD_CONST Domain; + ACPI_DWORD_CONST CoordType; + ACPI_DWORD_CONST NumProcessors; +} ACPI_PSD_PACKAGE; + +typedef struct csd_package { + ACPI_SMALL_PACKAGE package; + ACPI_BYTE_CONST NumberOfEntries; + ACPI_BYTE_CONST Revision; + ACPI_DWORD_CONST Domain; + ACPI_DWORD_CONST CoordType; + ACPI_DWORD_CONST NumProcessors; + ACPI_DWORD_CONST Index; +} ACPI_CSD_PACKAGE; + +typedef struct tsd_package { + ACPI_SMALL_PACKAGE package; + ACPI_BYTE_CONST NumberOfEntries; + ACPI_BYTE_CONST Revision; + ACPI_DWORD_CONST Domain; + ACPI_DWORD_CONST CoordType; + ACPI_DWORD_CONST NumProcessors; +} ACPI_TSD_PACKAGE; + +typedef struct processor { + U8 processorOpCode; + U8 packageLength; + U8 numElements; + ACPI_BYTE_CONST ProcID; + ACPI_DWORD_CONST PblkAddr; + ACPI_BYTE_CONST PblkLen; +} ACPI_PROCESSOR; + +#pragma pack() + +#endif /* !__LIBSAIO_INTEL_ACPI_H */ Property changes on: branches/cparm/i386/util/Intel_Acpi/intel_acpi.h ___________________________________________________________________ Added: svn:executable + * Index: branches/cparm/i386/util/amlsgn.m =================================================================== --- branches/cparm/i386/util/amlsgn.m (revision 0) +++ branches/cparm/i386/util/amlsgn.m (revision 1735) @@ -0,0 +1,363 @@ +/* + Copyright (c) 2010, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public + * Source License Version 2.0 (the 'License'). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + + +#import +#import + +#include "Intel_Acpi/acpidecode.h" +#include "Intel_Acpi/ppmsetup.h" + +unsigned long uuid32; +#define UUID_LEN 16 +#define UUID_STR_LEN UUID_LEN*2 + 8 +typedef int8_t EFI_CHAR8; + +unsigned long +adler32( unsigned char * buffer, long length ); +U8 GetChecksum(void *mem_addr, U32 mem_size); +void SetChecksum(struct acpi_table_header *header); +const char * getStringFromUUID(const EFI_CHAR8* eUUID); + + +unsigned long +adler32( unsigned char * buffer, long length ) +{ + long cnt; + unsigned long result, lowHalf, highHalf; + + lowHalf = 1; + highHalf = 0; + + for ( cnt = 0; cnt < length; cnt++ ) + { + if ((cnt % 5000) == 0) + { + lowHalf %= 65521L; + highHalf %= 65521L; + } + + lowHalf += buffer[cnt]; + highHalf += lowHalf; + } + + lowHalf %= 65521L; + highHalf %= 65521L; + + result = (highHalf << 16) | lowHalf; + + return result; +} + +//------------------------------------------------------------------------------- +// +// Procedure: GetChecksum - Performs byte checksum +// +//------------------------------------------------------------------------------- +U8 GetChecksum(void *mem_addr, U32 mem_size) +{ + U8 *current = mem_addr; + U8 *end = current + mem_size; + U8 checksum = 0; + + for (; current < end; current++) + checksum = checksum + *current; + + return (checksum); +} + +void SetChecksum(struct acpi_table_header *header) +{ + header->Checksum = 0; + header->Checksum = 0 - GetChecksum(header, header->Length); +} + + +/** Transform a 16 bytes hexadecimal value UUID to a string */ +/* getStringFromUUID : credit to Rekursor (see convert.c) */ +const char * getStringFromUUID(const EFI_CHAR8* eUUID) +{ + static char msg[UUID_STR_LEN] = ""; + if (!eUUID) return ""; + const unsigned char * uuid = (unsigned char*) eUUID; + sprintf(msg, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + uuid[0], uuid[1], uuid[2], uuid[3], + uuid[4], uuid[5], uuid[6], uuid[7], + uuid[8], uuid[9], uuid[10],uuid[11], + uuid[12],uuid[13],uuid[14],uuid[15]); + return msg ; +} + +int main (int argc, const char * argv[]) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + mach_port_t masterPort; + + io_registry_entry_t entry,entry2; + + kern_return_t err; + + CFDataRef data; + + CFAllocatorRef allocator=kCFAllocatorDefault; + + const UInt8* rawdata = NULL; + + UInt32 uuid32 = 0; + UInt32 Model32 = 0; + const char *cfilename ; + NSString *filename, *fullfilename ; + NSArray *namechunks; + NSMutableArray *chunks; + char * input, *output, dirspec[512]; + NSString *outStr, *inStr; + + if (argc > 3 || argc < 2) { + printf("Usage: amlsgn input(as a file) output(as a directory)\n"); + return 1; + } else if (argc == 2) { + + /* Creating output string */ + inStr = [NSString stringWithUTF8String:argv[1]]; + chunks = [[NSMutableArray alloc] init]; + [chunks addObjectsFromArray:[inStr componentsSeparatedByString: @"/"]]; + + fullfilename = [chunks lastObject]; + namechunks = [fullfilename componentsSeparatedByString: @"."]; + filename = [namechunks objectAtIndex:0]; + cfilename = [filename UTF8String]; + + [chunks removeLastObject]; + outStr = [chunks componentsJoinedByString: @"/"]; + + } else { + inStr = [NSString stringWithUTF8String:argv[1]]; + BOOL isDirectory= FALSE; + if ([[NSFileManager defaultManager] fileExistsAtPath:outStr isDirectory:&isDirectory]) { + + if (isDirectory == FALSE) { + chunks = [[NSMutableArray alloc] init]; + [chunks addObjectsFromArray:[inStr componentsSeparatedByString: @"/"]]; + + [chunks removeLastObject]; + outStr = [chunks componentsJoinedByString: @"/"]; + } else { + outStr = [NSString stringWithUTF8String:argv[2]]; + + } + } + + } + + do { + BOOL isDirectory= FALSE; + if ([[NSFileManager defaultManager] fileExistsAtPath:outStr isDirectory:&isDirectory] && isDirectory) { + + if ([[NSFileManager defaultManager] isWritableFileAtPath:outStr]) + break; + } + + outStr = [NSHomeDirectory() stringByAppendingPathComponent: @"Desktop"]; + + } while (0); + + + err = IOMasterPort(MACH_PORT_NULL, &masterPort); + + if (err == KERN_SUCCESS){ + + entry2=IORegistryEntryFromPath(masterPort, [@"IODeviceTree:/efi" UTF8String]); + + if (entry2!=MACH_PORT_NULL) { + + data = IORegistryEntrySearchCFProperty( entry2, kIOServicePlane, CFSTR("motherboard-name"), allocator, kIORegistryIterateRecursively); + + if (data != NULL) { + rawdata=CFDataGetBytePtr(data); + + int len = 0; + + char *ModelStr = ( char* )rawdata; + + if (len = strlen(ModelStr)) + { + Model32 = OSSwapHostToBigInt32(adler32( (unsigned char *) ModelStr, len )); + + printf("uuid32 0x%lu uuidStr %s\n",(unsigned long)Model32,ModelStr); + + UInt8 mem[1024*1024]; + + bzero(mem, sizeof(mem)); + + int fdIn = open([inStr UTF8String], O_RDONLY, 0666); + + if (-1 == fdIn) { + printf("Error while opening the file \n"); + return 1; + } + + size_t nbRead = read(fdIn, (void*)mem, sizeof(mem)); + if (nbRead <= 0) { + printf("Error: Unable to read the file\n"); + close(fdIn); + return 1; + } + + ACPI_TABLE_HEADER * head = (ACPI_TABLE_HEADER *)mem; + + close(fdIn); + + head->OemRevision = Model32; + + SetChecksum(head); + + { + char dir[1024]; + + sprintf(dir,"%s/%s.%s.aml",[outStr UTF8String],cfilename,ModelStr); + + int fdOut = open(dir, O_WRONLY | O_CREAT, 0666); + + if (-1 == fdOut) { + printf("Error: Can't save the file\n"); + return 1; + } + write(fdOut, mem, head->Length); + + close(fdOut); + } + } + + IOObjectRelease(entry2); + + goto out; + } + + } + + printf("No Model entry \n"); + + entry=IORegistryEntryFromPath(masterPort, [@"IODeviceTree:/efi/platform" UTF8String]); + + if (entry!=MACH_PORT_NULL){ + + + data = IORegistryEntrySearchCFProperty( entry, kIOServicePlane, CFSTR("system-id"), allocator, kIORegistryIterateRecursively); + + if (data != NULL) { + rawdata=CFDataGetBytePtr(data); + + + const char *uuidStr = getStringFromUUID(( EFI_CHAR8* )rawdata); + + if (strlen(uuidStr)) + { + uuid32 = OSSwapHostToBigInt32(adler32( (unsigned char *) uuidStr, UUID_STR_LEN )); + + printf("uuid32 : 0x%lu\n",(unsigned long)uuid32); + printf("uuidStr : %s\n",uuidStr); + + UInt8 mem[1024*1024]; + + bzero(mem, sizeof(mem)); + + int fdIn = open([inStr UTF8String], O_RDONLY, 0666); + + if (-1 == fdIn) { + printf("Error while opening the file \n"); + return 1; + } + + size_t nbRead = read(fdIn, (void*)mem, sizeof(mem)); + if (nbRead <= 0) { + printf("Error: Unable to read the file\n"); + close(fdIn); + return 1; + } + + ACPI_TABLE_HEADER * head = (ACPI_TABLE_HEADER *)mem; + + close(fdIn); + + head->OemRevision = uuid32; + + SetChecksum(head); + + { + char dir[1024]; + + sprintf(dir,"%s/%s.%lu.aml",[outStr UTF8String],cfilename,(unsigned long)uuid32); + + int fdOut = open(dir, O_WRONLY | O_CREAT, 0666); + + if (-1 == fdOut) { + printf("Error: Can't save the file\n"); + return 1; + } + write(fdOut, mem, head->Length); + + close(fdOut); + } + } + + IOObjectRelease(entry); + + goto out; + + } + } + printf("No UUID entry\n"); + + } +out: + [pool drain]; + return 0; +} Index: branches/cparm/i386/util/Makefile =================================================================== --- branches/cparm/i386/util/Makefile (revision 1734) +++ branches/cparm/i386/util/Makefile (revision 1735) @@ -32,6 +32,11 @@ bdmesg: bdmesg.o $(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -mmacosx-version-min=10.5 -o $(SYMROOT)/$(@F) bdmesg.o +amlsgn: + $(CC) -arch i386 -framework IOKit -framework Foundation -mmacosx-version-min=10.5 amlsgn.m -o $(SYMROOT)/amlsgn + + + include ../MakeInc.dir #dependencies