Index: branches/azimutz/Cleancut/i386/libsaio/xml.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/xml.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/xml.c (revision 899) @@ -67,8 +67,7 @@ return ""; } - -struct Module { +struct Module { struct Module *nextModule; long willLoad; TagPtr dict; @@ -151,7 +150,6 @@ return 0; } - // XMLGetTag(int index) // XMLTagCount( TagPtr dict ) @@ -305,41 +303,41 @@ { long length, pos; char * tagName; - - length = GetNextTag(buffer, &tagName, 0); - if (length == -1) return -1; + length = GetNextTag(buffer, &tagName, 0); + if (length == -1) return -1; + pos = length; - if (!strncmp(tagName, kXMLTagPList, 6)) - { - length = 0; - } + if (!strncmp(tagName, kXMLTagPList, 6)) + { + length = 0; + } /***** dict ****/ - else if (!strcmp(tagName, kXMLTagDict)) - { - length = ParseTagList(buffer + pos, tag, kTagTypeDict, 0); - } - else if (!strncmp(tagName, kXMLTagDict, strlen(kXMLTagDict)) && tagName[strlen(tagName)-1] == '/') - { - length = ParseTagList(buffer + pos, tag, kTagTypeDict, 1); - } - else if (!strncmp(tagName, kXMLTagDict " ", strlen(kXMLTagDict " "))) - { - length = ParseTagList(buffer + pos, tag, kTagTypeDict, 0); - } + else if (!strcmp(tagName, kXMLTagDict)) + { + length = ParseTagList(buffer + pos, tag, kTagTypeDict, 0); + } + else if (!strncmp(tagName, kXMLTagDict, strlen(kXMLTagDict)) && tagName[strlen(tagName)-1] == '/') + { + length = ParseTagList(buffer + pos, tag, kTagTypeDict, 1); + } + else if (!strncmp(tagName, kXMLTagDict " ", strlen(kXMLTagDict " "))) + { + length = ParseTagList(buffer + pos, tag, kTagTypeDict, 0); + } /***** key ****/ - else if (!strcmp(tagName, kXMLTagKey)) - { - length = ParseTagKey(buffer + pos, tag); - } + else if (!strcmp(tagName, kXMLTagKey)) + { + length = ParseTagKey(buffer + pos, tag); + } /***** string ****/ - else if (!strcmp(tagName, kXMLTagString)) - { - length = ParseTagString(buffer + pos, tag); - } - else if (!strncmp(tagName, kXMLTagString " ", strlen(kXMLTagString " "))) - { + else if (!strcmp(tagName, kXMLTagString)) + { + length = ParseTagString(buffer + pos, tag); + } + else if (!strncmp(tagName, kXMLTagString " ", strlen(kXMLTagString " "))) + { // TODO: save tag if if found if(!strncmp(tagName + strlen(kXMLTagString " "), kXMLStringID, strlen(kXMLStringID))) { @@ -350,7 +348,7 @@ tagName[cnt] = 0; char* val = tagName + strlen(kXMLTagString " " kXMLStringID "\""); while(*val) - { + { if ((*val >= '0' && *val <= '9')) // 0 - 9 { id = (id * 10) + (*val++ - '0'); @@ -360,12 +358,10 @@ printf("ParseStringID error (0x%x)\n", *val); getc(); return -1; - } - } length = ParseTagString(buffer + pos, tag); - + SaveRefString(buffer + pos, id); } else if(!strncmp(tagName + strlen(kXMLTagString " "), kXMLStringIDRef, strlen(kXMLStringIDRef))) @@ -377,7 +373,7 @@ tagName[cnt] = 0; char* val = tagName + strlen(kXMLTagString " " kXMLStringIDRef "\""); while(*val) - { + { if ((*val >= '0' && *val <= '9')) // 0 - 9 { id = (id * 10) + (*val++ - '0'); @@ -387,9 +383,7 @@ printf("ParseStringIDREF error (0x%x)\n", *val); getc(); return -1; - } - } char* str = GetRefString(id); @@ -404,16 +398,15 @@ length = 0; //printf("Located IDREF, id = %d, string = %s\n", id, str); } - - } + } /***** integer ****/ - else if (!strcmp(tagName, kXMLTagInteger)) - { - length = ParseTagInteger(buffer + pos, tag); - } - else if (!strncmp(tagName, kXMLTagInteger " ", strlen(kXMLTagInteger " "))) - { + else if (!strcmp(tagName, kXMLTagInteger)) + { + length = ParseTagInteger(buffer + pos, tag); + } + else if (!strncmp(tagName, kXMLTagInteger " ", strlen(kXMLTagInteger " "))) + { if(!strncmp(tagName + strlen(kXMLTagInteger " "), kXMLStringID, strlen(kXMLStringID))) { // ID= @@ -423,7 +416,7 @@ tagName[cnt] = 0; char* val = tagName + strlen(kXMLTagInteger " " kXMLStringID "\""); while(*val) - { + { if ((*val >= '0' && *val <= '9')) // 0 - 9 { id = (id * 10) + (*val++ - '0'); @@ -433,9 +426,7 @@ printf("ParseIntegerID error (0x%x)\n", *val); getc(); return -1; - } - } length = ParseTagInteger(buffer + pos, tag); @@ -450,7 +441,7 @@ tagName[cnt] = 0; char* val = tagName + strlen(kXMLTagInteger " " kXMLStringIDRef "\""); while(*val) - { + { if ((*val >= '0' && *val <= '9')) // 0 - 9 { id = (id * 10) + (*val++ - '0'); @@ -460,9 +451,7 @@ printf("ParseStringIDREF error (0x%x)\n", *val); getc(); return -1; - } - } int integer = (int)GetRefString(id); @@ -472,74 +461,73 @@ tmpTag->tag = 0; tmpTag->tagNext = 0; tmpTag->offset = buffer_start ? buffer - buffer_start + pos : 0; - + *tag = tmpTag; length = 0; //printf("Located IDREF, id = %d, string = %s\n", id, str); - } - else + } + else { length = ParseTagInteger(buffer + pos, tag); } } /***** data ****/ - else if (!strcmp(tagName, kXMLTagData)) - { - length = ParseTagData(buffer + pos, tag); - } + else if (!strcmp(tagName, kXMLTagData)) + { + length = ParseTagData(buffer + pos, tag); + } else if (!strncmp(tagName, kXMLTagData " ", strlen(kXMLTagData " "))) - { - length = ParseTagData(buffer + pos, tag); - } - else if (!strcmp(tagName, kXMLTagDate)) - { - length = ParseTagDate(buffer + pos, tag); - } + { + length = ParseTagData(buffer + pos, tag); + } + else if (!strcmp(tagName, kXMLTagDate)) + { + length = ParseTagDate(buffer + pos, tag); + } /***** date ****/ else if (!strncmp(tagName, kXMLTagDate " ", strlen(kXMLTagDate " "))) - { - length = ParseTagDate(buffer + pos, tag); - } + { + length = ParseTagDate(buffer + pos, tag); + } /***** false ****/ - else if (!strcmp(tagName, kXMLTagFalse)) - { - length = ParseTagBoolean(buffer + pos, tag, kTagTypeFalse); - } + else if (!strcmp(tagName, kXMLTagFalse)) + { + length = ParseTagBoolean(buffer + pos, tag, kTagTypeFalse); + } /***** true ****/ - else if (!strcmp(tagName, kXMLTagTrue)) - { - length = ParseTagBoolean(buffer + pos, tag, kTagTypeTrue); - } + else if (!strcmp(tagName, kXMLTagTrue)) + { + length = ParseTagBoolean(buffer + pos, tag, kTagTypeTrue); + } /***** array ****/ - else if (!strcmp(tagName, kXMLTagArray)) - { - length = ParseTagList(buffer + pos, tag, kTagTypeArray, 0); - } + else if (!strcmp(tagName, kXMLTagArray)) + { + length = ParseTagList(buffer + pos, tag, kTagTypeArray, 0); + } else if (!strncmp(tagName, kXMLTagArray " ", strlen(kXMLTagArray " "))) - { - length = ParseTagList(buffer + pos, tag, kTagTypeArray, 0); - } - else if (!strcmp(tagName, kXMLTagArray "/")) - { - length = ParseTagList(buffer + pos, tag, kTagTypeArray, 1); - } + { + length = ParseTagList(buffer + pos, tag, kTagTypeArray, 0); + } + else if (!strcmp(tagName, kXMLTagArray "/")) + { + length = ParseTagList(buffer + pos, tag, kTagTypeArray, 1); + } /***** unknown ****/ - else - { - *tag = 0; - length = 0; - } - - - if (length == -1) return -1; - - return pos + length; + else + { + *tag = 0; + length = 0; + } + + if (length == -1) return -1; + + return pos + length; } //========================================================================== @@ -679,8 +667,7 @@ char* val = buffer; int size; - - if(buffer[0] == '<') + if(buffer[0] == '<') { printf("Warning integer is non existant\n"); getc(); @@ -708,7 +695,7 @@ { val += 2; while(*val) - { + { if ((*val >= '0' && *val <= '9')) // 0 - 9 { integer = (integer * 16) + (*val++ - '0'); @@ -726,9 +713,7 @@ printf("ParseTagInteger hex error (0x%x) in buffer %s\n", *val, buffer); getc(); return -1; - } - } } else if ( size ) // Decimal value @@ -766,7 +751,7 @@ tmpTag->tagNext = 0; *tag = tmpTag; - + return length; } @@ -1036,7 +1021,7 @@ #if DOFREE static void FreeSymbol( char * string ) -{ +{ SymbolPtr symbol, prev; prev = 0; @@ -1081,15 +1066,12 @@ return symbol; } - - bool XMLIsType(TagPtr dict, enum xmltype type) { if(!dict) return (type == kTagTypeNone); return (dict->type == type); } - /*** Cast functions ***/ TagPtr XMLCastArray(TagPtr dict) { @@ -1098,7 +1080,6 @@ else return NULL; } - TagPtr XMLCastDict(TagPtr dict) { if(!dict) return NULL; @@ -1130,7 +1111,6 @@ } } - bool XMLCastBoolean(TagPtr dict) { if(!dict) return false; Index: branches/azimutz/Cleancut/i386/libsaio/console.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/console.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/console.c (revision 899) @@ -52,14 +52,14 @@ bool gVerboseMode; bool gErrors; -/* Kabyl: BooterLog */ -//Azi: Doubled log available size. -// 64kb are not enough to hold the full log while booting with -f argument (ignore caches). -// It also seems to fix some reported problems while booting with the mentioned argument. -// Note: 96kb are enough to hold full log, booting with -f; even so, this depends on how much -// we "play" at the boot prompt, with what patches we're playing and how much they print to the log, -// kexts loaded, etc... -// Please remove this comment when this gets checked by a "true" dev. +/** Kabyl: BooterLog + +Azi: Doubled available log size; this seems to fix some hangs and instant reboots caused by +booting with -f (ignore caches). 96kb are enough to hold full log, booting with -f; even so, +this depends on how much we "play" at the boot prompt and with what patches we're playing, +depending on how much they print to the log. +**/ //Azi: closing **/ alows colapse/expand... is this desirable?? colapsing an entire page + // will also colapse comments.... #define BOOTER_LOG_SIZE (128 * 1024) #define SAFE_LOG_SIZE 134 @@ -71,7 +71,8 @@ char * last_str; }; -static int sputc(int c, struct putc_info * pi) +static int +sputc(int c, struct putc_info * pi) //Azi: exists on printf.c & gui.c { if (pi->last_str) if (pi->str == pi->last_str) @@ -120,7 +121,6 @@ } /* Kabyl: !BooterLog */ - /* * write one character to console */ @@ -176,7 +176,7 @@ vprf(fmt, ap); { - /* Kabyl: BooterLog */ + // Kabyl: BooterLog struct putc_info pi; if (!msgbuf) @@ -197,7 +197,7 @@ int verbose(const char * fmt, ...) { va_list ap; - + va_start(ap, fmt); if (gVerboseMode) { @@ -208,7 +208,7 @@ } { - /* Kabyl: BooterLog */ + // Kabyl: BooterLog struct putc_info pi; if (!msgbuf) @@ -259,6 +259,6 @@ /** Print a "Press a key to continue..." message and wait for a key press. */ void pause() { - printf("Press a key to continue..."); + printf("Press a key to continue...\n"); getc(); } Index: branches/azimutz/Cleancut/i386/libsaio/xml.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/xml.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/xml.h (revision 899) @@ -38,7 +38,6 @@ kTagTypeArray }; - struct string_ref { char* string; @@ -63,7 +62,6 @@ #define kXMLStringID "ID=" #define kXMLStringIDRef "IDREF=" - #define kPropCFBundleIdentifier ("CFBundleIdentifier") #define kPropCFBundleExecutable ("CFBundleExecutable") #define kPropOSBundleRequired ("OSBundleRequired") Index: branches/azimutz/Cleancut/i386/libsaio/bootstruct.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/bootstruct.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/bootstruct.c (revision 899) @@ -6,7 +6,7 @@ * 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 + * 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. @@ -43,65 +43,64 @@ void initKernBootStruct( void ) { - Node *node; - int nameLen; - static int init_done = 0; - - if ( !init_done ) - { - bootArgs = (boot_args *)malloc(sizeof(boot_args)); + Node *node; + int nameLen; + static int init_done = 0; + + if ( !init_done ) + { + bootArgs = (boot_args *)malloc(sizeof(boot_args)); bootArgsPreLion = (boot_args_pre_lion *)malloc(sizeof(boot_args_pre_lion)); - bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t)); - if (bootArgs == 0 || bootInfo == 0) - stop("Couldn't allocate boot info\n"); - - bzero(bootArgs, sizeof(boot_args)); + bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t)); + if (bootArgs == 0 || bootInfo == 0) + stop("Couldn't allocate boot info\n"); + + bzero(bootArgs, sizeof(boot_args)); bzero(bootArgsPreLion, sizeof(boot_args_pre_lion)); - bzero(bootInfo, sizeof(PrivateBootInfo_t)); - - // Get system memory map. Also update the size of the - // conventional/extended memory for backwards compatibility. - - bootInfo->memoryMapCount = - getMemoryMap( bootInfo->memoryMap, kMemoryMapCountMax, - (unsigned long *) &bootInfo->convmem, - (unsigned long *) &bootInfo->extmem ); - - if ( bootInfo->memoryMapCount == 0 ) - { - // BIOS did not provide a memory map, systems with - // discontiguous memory or unusual memory hole locations - // may have problems. - - bootInfo->convmem = getConventionalMemorySize(); - bootInfo->extmem = getExtendedMemorySize(); - } - - bootInfo->configEnd = bootInfo->config; - bootArgs->Video.v_display = VGA_TEXT_MODE; - - DT__Initialize(); - - node = DT__FindNode("/", true); - if (node == 0) { - stop("Couldn't create root node"); - } - getPlatformName(platformName); - nameLen = strlen(platformName) + 1; - DT__AddProperty(node, "compatible", nameLen, platformName); - DT__AddProperty(node, "model", nameLen, platformName); - - gMemoryMapNode = DT__FindNode("/chosen/memory-map", true); - - bootArgs->Version = kBootArgsVersion; - bootArgs->Revision = kBootArgsRevision; + bzero(bootInfo, sizeof(PrivateBootInfo_t)); + // Get system memory map. Also update the size of the + // conventional/extended memory for backwards compatibility. + + bootInfo->memoryMapCount = + getMemoryMap( bootInfo->memoryMap, kMemoryMapCountMax, + (unsigned long *) &bootInfo->convmem, + (unsigned long *) &bootInfo->extmem ); + + if ( bootInfo->memoryMapCount == 0 ) + { + // BIOS did not provide a memory map, systems with + // discontiguous memory or unusual memory hole locations + // may have problems. + + bootInfo->convmem = getConventionalMemorySize(); + bootInfo->extmem = getExtendedMemorySize(); + } + + bootInfo->configEnd = bootInfo->config; + bootArgs->Video.v_display = VGA_TEXT_MODE; + + DT__Initialize(); + + node = DT__FindNode("/", true); + if (node == 0) { + stop("Couldn't create root node"); + } + getPlatformName(platformName); + nameLen = strlen(platformName) + 1; + DT__AddProperty(node, "compatible", nameLen, platformName); + DT__AddProperty(node, "model", nameLen, platformName); + + gMemoryMapNode = DT__FindNode("/chosen/memory-map", true); + + bootArgs->Version = kBootArgsVersion; + bootArgs->Revision = kBootArgsRevision; + bootArgsPreLion->Version = kBootArgsPreLionVersion; - bootArgsPreLion->Revision = kBootArgsPreLionRevision; + bootArgsPreLion->Revision = kBootArgsPreLionRevision; - init_done = 1; - } - + init_done = 1; + } } @@ -110,8 +109,9 @@ void reserveKernBootStruct(void) { - if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0') && (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7')) - { + if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0') + && (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7')) + { void *oldAddr = bootArgs; bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args)); bcopy(oldAddr, bootArgs, sizeof(boot_args)); @@ -121,34 +121,33 @@ bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion)); bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion)); } - } void finalizeBootStruct(void) { - uint32_t size; - void *addr; - int i; - EfiMemoryRange *memoryMap; - MemoryRange *range; - int memoryMapCount = bootInfo->memoryMapCount; - - if (memoryMapCount == 0) { - // XXX could make a two-part map here - stop("Unable to convert memory map into proper format\n"); - } - - // convert memory map to boot_args memory map - memoryMap = (EfiMemoryRange *)AllocateKernelMemory(sizeof(EfiMemoryRange) * memoryMapCount); - bootArgs->MemoryMap = (uint32_t)memoryMap; - bootArgs->MemoryMapSize = sizeof(EfiMemoryRange) * memoryMapCount; - bootArgs->MemoryMapDescriptorSize = sizeof(EfiMemoryRange); - bootArgs->MemoryMapDescriptorVersion = 0; - - for (i=0; imemoryMap[i]; - switch(range->type) { + uint32_t size; + void *addr; + int i; + EfiMemoryRange *memoryMap; + MemoryRange *range; + int memoryMapCount = bootInfo->memoryMapCount; + + if (memoryMapCount == 0) { + // XXX could make a two-part map here + stop("Unable to convert memory map into proper format\n"); + } + + // convert memory map to boot_args memory map + memoryMap = (EfiMemoryRange *)AllocateKernelMemory(sizeof(EfiMemoryRange) * memoryMapCount); + bootArgs->MemoryMap = (uint32_t)memoryMap; + bootArgs->MemoryMapSize = sizeof(EfiMemoryRange) * memoryMapCount; + bootArgs->MemoryMapDescriptorSize = sizeof(EfiMemoryRange); + bootArgs->MemoryMapDescriptorVersion = 0; + + for (i=0; imemoryMap[i]; + switch(range->type) { case kMemoryRangeACPI: memoryMap->Type = kEfiACPIReclaimMemory; break; @@ -162,30 +161,30 @@ default: memoryMap->Type = kEfiReservedMemoryType; break; - } - memoryMap->PhysicalStart = range->base; - memoryMap->VirtualStart = range->base; - memoryMap->NumberOfPages = range->length >> I386_PGSHIFT; - memoryMap->Attribute = 0; - } - - // copy bootFile into device tree - // XXX - - // add PCI info somehow into device tree - // XXX - - // Flatten device tree - DT__FlattenDeviceTree(0, &size); - addr = (void *)AllocateKernelMemory(size); - if (addr == 0) { - stop("Couldn't allocate device tree\n"); - } - - DT__FlattenDeviceTree((void **)&addr, &size); - bootArgs->deviceTreeP = (uint32_t)addr; - bootArgs->deviceTreeLength = size; + } + memoryMap->PhysicalStart = range->base; + memoryMap->VirtualStart = range->base; + memoryMap->NumberOfPages = range->length >> I386_PGSHIFT; + memoryMap->Attribute = 0; + } + // copy bootFile into device tree + // XXX + + // add PCI info somehow into device tree + // XXX + + // Flatten device tree + DT__FlattenDeviceTree(0, &size); + addr = (void *)AllocateKernelMemory(size); + if (addr == 0) { + stop("Couldn't allocate device tree\n"); + } + + DT__FlattenDeviceTree((void **)&addr, &size); + bootArgs->deviceTreeP = (uint32_t)addr; + bootArgs->deviceTreeLength = size; + // Copy BootArgs values to older structure memcpy(&bootArgsPreLion->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH); @@ -196,7 +195,7 @@ bootArgsPreLion->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize; bootArgsPreLion->MemoryMapDescriptorVersion = bootArgs->MemoryMapDescriptorVersion; - bootArgsPreLion->deviceTreeP = bootArgs->deviceTreeP; + bootArgsPreLion->deviceTreeP = bootArgs->deviceTreeP; bootArgsPreLion->deviceTreeLength = bootArgs->deviceTreeLength; bootArgsPreLion->kaddr = bootArgs->kaddr; @@ -211,5 +210,4 @@ bootArgsPreLion->performanceDataStart = bootArgs->performanceDataStart; bootArgsPreLion->performanceDataSize = bootArgs->performanceDataSize; bootArgsPreLion->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart; - } Index: branches/azimutz/Cleancut/i386/libsaio/bootstruct.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/bootstruct.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/bootstruct.h (revision 899) @@ -30,7 +30,7 @@ #include "bios.h" #include "device_tree.h" -/*! +/*! <--- Azi: check these! against these /** Kernel boot args global also used by booter for its own data. */ extern boot_args *bootArgs; @@ -47,7 +47,7 @@ #define CONFIG_SIZE (40 * 4096) /* - * Max size fo config data array, in bytes. + * Max size for config data array, in bytes. */ #define IO_CONFIG_DATA_SIZE 163840 @@ -125,10 +125,10 @@ char * configEnd; // pointer to end of config files char config[CONFIG_SIZE]; - config_file_t bootConfig; // boot.plist + config_file_t bootConfig; // boot.plist config_file_t overrideConfig; // additional boot.plist which can override bootConfig keys - config_file_t themeConfig; // theme.plist - config_file_t smbiosConfig; // smbios.plist + config_file_t themeConfig; // theme.plist + config_file_t smbiosConfig; // smbios.plist config_file_t helperConfig; // boot helper partition's boot.plist config_file_t ramdiskConfig; // RAMDisk.plist } PrivateBootInfo_t; Index: branches/azimutz/Cleancut/i386/libsaio/acpi_patcher.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/acpi_patcher.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/acpi_patcher.c (revision 899) @@ -490,12 +490,12 @@ case CPU_MODEL_FIELDS: case CPU_MODEL_DALES: case CPU_MODEL_DALES_32NM: - case CPU_MODEL_NEHALEM: + case CPU_MODEL_NEHALEM: case CPU_MODEL_NEHALEM_EX: case CPU_MODEL_WESTMERE: case CPU_MODEL_WESTMERE_EX: case CPU_MODEL_SANDY: - case CPU_MODEL_SANDY_XEON: + case CPU_MODEL_SANDY_XEON: { maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)... minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff; Index: branches/azimutz/Cleancut/i386/libsaio/aml_generator.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/aml_generator.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/aml_generator.c (revision 899) @@ -21,12 +21,12 @@ case AML_CHUNK_DWORD: case AML_CHUNK_QWORD: case AML_CHUNK_ALIAS: - verbose("aml_add_to_parent: node doesn't support child nodes!"); + verbose("aml_add_to_parent: node doesn't support child nodes!\n"); return false; case AML_CHUNK_NAME: if (parent->First) { - verbose("aml_add_to_parent: name node supports only one child node!"); + verbose("aml_add_to_parent: name node supports only one child node!\n"); return false; } break; @@ -173,7 +173,7 @@ { if (strlen(name) < 4) { - verbose("aml_fill_simple_name: simple name %s has incorrect lengh! Must be 4.", name); + verbose("aml_fill_simple_name: simple name %s has incorrect lengh! Must be 4.\n", name); return 0; } @@ -190,7 +190,7 @@ if ((len % 4) > 1 || count == 0) { - verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16, etc...", name); + verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16, etc...\n", name); return 0; } Index: branches/azimutz/Cleancut/i386/libsaio/usb.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/usb.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/usb.c (revision 899) @@ -38,7 +38,6 @@ // Add usb device to the list void notify_usb_dev(pci_dt_t *pci_dev) { - struct pciList* current = usbList; if(!usbList) { Index: branches/azimutz/Cleancut/i386/libsaio/fdisk.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/fdisk.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/fdisk.h (revision 899) @@ -35,25 +35,25 @@ #ifndef __LIBSAIO_FDISK_H #define __LIBSAIO_FDISK_H -#define DISK_BLK0 0 /* blkno of boot block */ -#define DISK_BLK0SZ 512 /* size of boot block */ -#define DISK_BOOTSZ 446 /* size of boot code in boot block */ -#define DISK_SIGNATURE 0xAA55 /* signature of the boot record */ -#define FDISK_NPART 4 /* number of entries in fdisk table */ -#define FDISK_ACTIVE 0x80 /* indicator of active partition */ -#define FDISK_NEXTNAME 0xA7 /* indicator of NeXT partition */ -#define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ -#define FDISK_DOS16S 0x04 /* 16-bit fat < 32MB dos partition */ -#define FDISK_DOSEXT 0x05 /* extended dos partition */ -#define FDISK_DOS16B 0x06 /* 16-bit fat >= 32MB dos partition */ -#define FDISK_NTFS 0x07 /* NTFS partition */ -#define FDISK_SMALLFAT32 0x0b /* FAT32 partition */ -#define FDISK_FAT32 0x0c /* FAT32 partition */ -#define FDISK_DOS16SLBA 0x0e -#define FDISK_LINUX 0x83 -#define FDISK_UFS 0xa8 /* Apple UFS partition */ -#define FDISK_HFS 0xaf /* Apple HFS partition */ -#define FDISK_BOOTER 0xab /* Apple booter partition */ +#define DISK_BLK0 0 /* blkno of boot block */ +#define DISK_BLK0SZ 512 /* size of boot block */ +#define DISK_BOOTSZ 446 /* size of boot code in boot block */ +#define DISK_SIGNATURE 0xAA55 /* signature of the boot record */ +#define FDISK_NPART 4 /* number of entries in fdisk table */ +#define FDISK_ACTIVE 0x80 /* indicator of active partition */ +#define FDISK_NEXTNAME 0xA7 /* indicator of NeXT partition */ +#define FDISK_DOS12 0x01 /* 12-bit fat < 10MB dos partition */ +#define FDISK_DOS16S 0x04 /* 16-bit fat < 32MB dos partition */ +#define FDISK_DOSEXT 0x05 /* extended dos partition */ +#define FDISK_DOS16B 0x06 /* 16-bit fat >= 32MB dos partition */ +#define FDISK_NTFS 0x07 /* NTFS partition */ +#define FDISK_SMALLFAT32 0x0b /* FAT32 partition */ +#define FDISK_FAT32 0x0c /* FAT32 partition */ +#define FDISK_DOS16SLBA 0x0e +#define FDISK_LINUX 0x83 +#define FDISK_UFS 0xa8 /* Apple UFS partition */ +#define FDISK_HFS 0xaf /* Apple HFS partition */ +#define FDISK_BOOTER 0xab /* Apple booter partition */ /* * Format of fdisk partion entry (if present). Index: branches/azimutz/Cleancut/i386/libsaio/platform.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/platform.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/platform.h (revision 899) @@ -28,11 +28,11 @@ #define CPU_MODEL_PENRYN 0x17 #define CPU_MODEL_NEHALEM 0x1A #define CPU_MODEL_ATOM 0x1C -#define CPU_MODEL_FIELDS 0x1E /* Lynnfield, Clarksfield, Jasper */ -#define CPU_MODEL_DALES 0x1F /* Havendale, Auburndale */ -#define CPU_MODEL_DALES_32NM 0x25 /* Clarkdale, Arrandale */ -#define CPU_MODEL_SANDY 0x2a /* Sandy bridge */ -#define CPU_MODEL_WESTMERE 0x2C /* Gulftown, Westmere-EP, Westmere-WS */ +#define CPU_MODEL_FIELDS 0x1E /* Lynnfield, Clarksfield, Jasper */ +#define CPU_MODEL_DALES 0x1F /* Havendale, Auburndale */ +#define CPU_MODEL_DALES_32NM 0x25 /* Clarkdale, Arrandale */ +#define CPU_MODEL_SANDY 0x2a /* Sandy bridge */ +#define CPU_MODEL_WESTMERE 0x2C /* Gulftown, Westmere-EP, Westmere-WS */ #define CPU_MODEL_SANDY_XEON 0x2D #define CPU_MODEL_NEHALEM_EX 0x2E #define CPU_MODEL_WESTMERE_EX 0x2F @@ -71,7 +71,7 @@ #define SMB_MEM_TYPE_DDR 18 #define SMB_MEM_TYPE_DDR2 19 #define SMB_MEM_TYPE_FBDIMM 20 -#define SMB_MEM_TYPE_DDR3 24 // Supported in 10.5.6+ AppleSMBIOS +#define SMB_MEM_TYPE_DDR3 24 // Supported in 10.5.6+ AppleSMBIOS /* Memory Configuration Types */ #define SMB_MEM_CHANNEL_UNKNOWN 0 @@ -90,44 +90,43 @@ #define UUID_LEN 16 typedef struct _RamSlotInfo_t { - uint32_t ModuleSize; // Size of Module in MB - uint32_t Frequency; // in Mhz + uint32_t ModuleSize; // Size of Module in MB + uint32_t Frequency; // in Mhz const char* Vendor; const char* PartNo; const char* SerialNo; - char* spd; // SPD Dump + char* spd; // SPD Dump bool InUse; uint8_t Type; - uint8_t BankConnections; // table type 6, see (3.3.7) + uint8_t BankConnections; // table type 6, see (3.3.7) uint8_t BankConnCnt; - } RamSlotInfo_t; typedef struct _PlatformInfo_t { struct CPU { - uint32_t Features; // CPU Features like MMX, SSE2, VT, MobileCPU - uint32_t Vendor; // Vendor - uint32_t Signature; // Signature - uint32_t Stepping; // Stepping - uint32_t Model; // Model - uint32_t ExtModel; // Extended Model - uint32_t Family; // Family - uint32_t ExtFamily; // Extended Family - uint32_t NoCores; // No Cores per Package - uint32_t NoThreads; // Threads per Package - uint8_t MaxCoef; // Max Multiplier + uint32_t Features; // CPU Features like MMX, SSE2, VT, MobileCPU + uint32_t Vendor; // Vendor + uint32_t Signature; // Signature + uint32_t Stepping; // Stepping + uint32_t Model; // Model + uint32_t ExtModel; // Extended Model + uint32_t Family; // Family + uint32_t ExtFamily; // Extended Family + uint32_t NoCores; // No Cores per Package + uint32_t NoThreads; // Threads per Package + uint8_t MaxCoef; // Max Multiplier uint8_t MaxDiv; - uint8_t CurrCoef; // Current Multiplier + uint8_t CurrCoef; // Current Multiplier uint8_t CurrDiv; - uint64_t TSCFrequency; // TSC Frequency Hz - uint64_t FSBFrequency; // FSB Frequency Hz - uint64_t CPUFrequency; // CPU Frequency Hz + uint64_t TSCFrequency; // TSC Frequency Hz + uint64_t FSBFrequency; // FSB Frequency Hz + uint64_t CPUFrequency; // CPU Frequency Hz uint32_t MaxRatio; // Max Bus Ratio uint32_t MinRatio; // Min Bus Ratio - char BrandString[48]; // 48 Byte Branding String + char BrandString[48]; // 48 Byte Branding String uint32_t CPUID[CPUID_MAX][4]; // CPUID 0..4, 80..81 Raw Values } CPU; - + struct RAM { uint64_t Frequency; // Ram Frequency uint32_t Divider; // Memory divider @@ -140,14 +139,15 @@ uint8_t Type; // Standard SMBIOS v2.5 Memory Type RamSlotInfo_t DIMM[MAX_RAM_SLOTS]; // Information about each slot } RAM; - + struct DMI { - int MaxMemorySlots; // number of memory slots polulated by SMBIOS - int CntMemorySlots; // number of memory slots counted - int MemoryModules; // number of memory modules installed - int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot + int MaxMemorySlots; // number of memory slots polulated by SMBIOS + int CntMemorySlots; // number of memory slots counted + int MemoryModules; // number of memory modules installed + int DIMM[MAX_RAM_SLOTS]; // Information and SPD mapping for each slot } DMI; - uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) + + uint8_t Type; // System Type: 1=Desktop, 2=Portable... according ACPI2.0 (FACP: PM_Profile) uint8_t *UUID; } PlatformInfo_t; Index: branches/azimutz/Cleancut/i386/libsaio/disk.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/disk.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/disk.c (revision 899) @@ -1675,19 +1675,19 @@ static const struct NamedValue fdiskTypes[] = { - { FDISK_NTFS, "Windows NTFS" }, - { FDISK_DOS12, "Windows FAT12" }, - { FDISK_DOS16B, "Windows FAT16" }, - { FDISK_DOS16S, "Windows FAT16" }, - { FDISK_DOS16SLBA, "Windows FAT16" }, - { FDISK_SMALLFAT32, "Windows FAT32" }, - { FDISK_FAT32, "Windows FAT32" }, - { FDISK_LINUX, "Linux" }, - { FDISK_UFS, "Apple UFS" }, - { FDISK_HFS, "Apple HFS" }, - { FDISK_BOOTER, "Apple Boot/UFS" }, - { 0xCD, "CD-ROM" }, - { 0x00, 0 } /* must be last */ + { FDISK_NTFS, "Windows NTFS" }, + { FDISK_DOS12, "Windows FAT12" }, + { FDISK_DOS16B, "Windows FAT16" }, + { FDISK_DOS16S, "Windows FAT16" }, + { FDISK_DOS16SLBA, "Windows FAT16" }, + { FDISK_SMALLFAT32, "Windows FAT32" }, + { FDISK_FAT32, "Windows FAT32" }, + { FDISK_LINUX, "Linux" }, + { FDISK_UFS, "Apple UFS" }, + { FDISK_HFS, "Apple HFS" }, + { FDISK_BOOTER, "Apple Boot/UFS" }, + { 0xCD, "CD-ROM" }, + { 0x00, 0 } /* must be last */ }; //========================================================================== Index: branches/azimutz/Cleancut/i386/libsaio/cpu.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/cpu.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/cpu.h (revision 899) @@ -14,7 +14,7 @@ #define bitmask(h,l) ((bit(h)|(bit(h)-1)) & ~(bit(l)-1)) #define bitfield(x,h,l) (((x) & bitmask(h,l)) >> l) -#define CPU_STRING_UNKNOWN "Unknown CPU Typ" +#define CPU_STRING_UNKNOWN "Unknown CPU Type" #define MSR_IA32_PERF_STATUS 0x198 #define MSR_IA32_PERF_CONTROL 0x199 Index: branches/azimutz/Cleancut/i386/libsaio/pci.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/pci.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/pci.h (revision 899) @@ -32,8 +32,8 @@ struct { uint16_t vendor_id; uint16_t device_id; - } subsys; - uint32_t subsys_id; + } subsys; + uint32_t subsys_id; } subsys_id; uint16_t class_id; @@ -431,10 +431,12 @@ #define PCI_PCIX_STATUS_DESIGNED_MAX_OUTSTANDING_SPLIT_TRANS 0x03800000 #define PCI_PCIX_STATUS_DESIGNED_MAX_CUMULATIVE_READ_SIZE 0x1c000000 #define PCI_PCIX_STATUS_RCVD_SC_ERR_MESS 0x20000000 /* Received Split Completion Error Message */ -#define PCI_PCIX_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ -#define PCI_PCIX_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ +#define PCI_PCIX_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ +#define PCI_PCIX_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ #define PCI_PCIX_SIZEOF 4 +//Azi: check this gui top to bottom!! + /* PCI-X Bridges */ #define PCI_PCIX_BRIDGE_SEC_STATUS 2 /* Secondary bus status register offset */ #define PCI_PCIX_BRIDGE_SEC_STATUS_64BIT 0x0001 @@ -463,166 +465,166 @@ #define PCI_PCIX_BRIDGE_SIZEOF 12 /* PCI Express */ -#define PCI_EXP_FLAGS 0x2 /* Capabilities register */ -#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ -#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ -#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ -#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ -#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ -#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ -#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ -#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ -#define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */ -#define PCI_EXP_TYPE_ROOT_INT_EP 0x9 /* Root Complex Integrated Endpoint */ -#define PCI_EXP_TYPE_ROOT_EC 0xa /* Root Complex Event Collector */ -#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ -#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ -#define PCI_EXP_DEVCAP 0x4 /* Device capabilities */ -#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ -#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ -#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ -#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ -#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ -#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ -#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ -#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ -#define PCI_EXP_DEVCAP_RBE 0x8000 /* Role-Based Error Reporting */ -#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ -#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ -#define PCI_EXP_DEVCAP_FLRESET 0x10000000 /* Function-Level Reset */ -#define PCI_EXP_DEVCTL 0x8 /* Device Control */ -#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ -#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ -#define PCI_EXP_DEVCTL_RELAXED 0x0010 /* Enable Relaxed Ordering */ -#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ -#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ -#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ -#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ -#define PCI_EXP_DEVCTL_NOSNOOP 0x0800 /* Enable No Snoop */ -#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ -#define PCI_EXP_DEVCTL_BCRE 0x8000 /* Bridge Configuration Retry Enable */ -#define PCI_EXP_DEVCTL_FLRESET 0x8000 /* Function-Level Reset [bit shared with BCRE] */ -#define PCI_EXP_DEVSTA 0xa /* Device Status */ -#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ -#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ -#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ -#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ -#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ -#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ -#define PCI_EXP_LNKCAP 0xc /* Link Capabilities */ -#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */ -#define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */ -#define PCI_EXP_LNKCAP_ASPM 0x00c00 /* Active State Power Management */ -#define PCI_EXP_LNKCAP_L0S 0x07000 /* L0s Acceptable Latency */ -#define PCI_EXP_LNKCAP_L1 0x38000 /* L1 Acceptable Latency */ -#define PCI_EXP_LNKCAP_CLOCKPM 0x40000 /* Clock Power Management */ -#define PCI_EXP_LNKCAP_SURPRISE 0x80000 /* Surprise Down Error Reporting */ -#define PCI_EXP_LNKCAP_DLLA 0x100000 /* Data Link Layer Active Reporting */ -#define PCI_EXP_LNKCAP_LBNC 0x200000 /* Link Bandwidth Notification Capability */ -#define PCI_EXP_LNKCAP_PORT 0xff000000 /* Port Number */ -#define PCI_EXP_LNKCTL 0x10 /* Link Control */ -#define PCI_EXP_LNKCTL_ASPM 0x0003 /* ASPM Control */ -#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ -#define PCI_EXP_LNKCTL_DISABLE 0x0010 /* Link Disable */ -#define PCI_EXP_LNKCTL_RETRAIN 0x0020 /* Retrain Link */ -#define PCI_EXP_LNKCTL_CLOCK 0x0040 /* Common Clock Configuration */ -#define PCI_EXP_LNKCTL_XSYNCH 0x0080 /* Extended Synch */ -#define PCI_EXP_LNKCTL_CLOCKPM 0x0100 /* Clock Power Management */ -#define PCI_EXP_LNKCTL_HWAUTWD 0x0200 /* Hardware Autonomous Width Disable */ -#define PCI_EXP_LNKCTL_BWMIE 0x0400 /* Bandwidth Mgmt Interrupt Enable */ -#define PCI_EXP_LNKCTL_AUTBWIE 0x0800 /* Autonomous Bandwidth Mgmt Interrupt Enable */ -#define PCI_EXP_LNKSTA 0x12 /* Link Status */ -#define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */ -#define PCI_EXP_LNKSTA_WIDTH 0x03f0 /* Negotiated Link Width */ -#define PCI_EXP_LNKSTA_TR_ERR 0x0400 /* Training Error (obsolete) */ -#define PCI_EXP_LNKSTA_TRAIN 0x0800 /* Link Training */ -#define PCI_EXP_LNKSTA_SL_CLK 0x1000 /* Slot Clock Configuration */ -#define PCI_EXP_LNKSTA_DL_ACT 0x2000 /* Data Link Layer in DL_Active State */ -#define PCI_EXP_LNKSTA_BWMGMT 0x4000 /* Bandwidth Mgmt Status */ -#define PCI_EXP_LNKSTA_AUTBW 0x8000 /* Autonomous Bandwidth Mgmt Status */ -#define PCI_EXP_SLTCAP 0x14 /* Slot Capabilities */ -#define PCI_EXP_SLTCAP_ATNB 0x0001 /* Attention Button Present */ -#define PCI_EXP_SLTCAP_PWRC 0x0002 /* Power Controller Present */ -#define PCI_EXP_SLTCAP_MRL 0x0004 /* MRL Sensor Present */ -#define PCI_EXP_SLTCAP_ATNI 0x0008 /* Attention Indicator Present */ -#define PCI_EXP_SLTCAP_PWRI 0x0010 /* Power Indicator Present */ -#define PCI_EXP_SLTCAP_HPS 0x0020 /* Hot-Plug Surprise */ -#define PCI_EXP_SLTCAP_HPC 0x0040 /* Hot-Plug Capable */ -#define PCI_EXP_SLTCAP_PWR_VAL 0x00007f80 /* Slot Power Limit Value */ -#define PCI_EXP_SLTCAP_PWR_SCL 0x00018000 /* Slot Power Limit Scale */ -#define PCI_EXP_SLTCAP_INTERLOCK 0x020000 /* Electromechanical Interlock Present */ -#define PCI_EXP_SLTCAP_NOCMDCOMP 0x040000 /* No Command Completed Support */ -#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ -#define PCI_EXP_SLTCTL 0x18 /* Slot Control */ -#define PCI_EXP_SLTCTL_ATNB 0x0001 /* Attention Button Pressed Enable */ -#define PCI_EXP_SLTCTL_PWRF 0x0002 /* Power Fault Detected Enable */ -#define PCI_EXP_SLTCTL_MRLS 0x0004 /* MRL Sensor Changed Enable */ -#define PCI_EXP_SLTCTL_PRSD 0x0008 /* Presence Detect Changed Enable */ -#define PCI_EXP_SLTCTL_CMDC 0x0010 /* Command Completed Interrupt Enable */ -#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ -#define PCI_EXP_SLTCTL_ATNI 0x00c0 /* Attention Indicator Control */ -#define PCI_EXP_SLTCTL_PWRI 0x0300 /* Power Indicator Control */ -#define PCI_EXP_SLTCTL_PWRC 0x0400 /* Power Controller Control */ -#define PCI_EXP_SLTCTL_INTERLOCK 0x0800 /* Electromechanical Interlock Control */ -#define PCI_EXP_SLTCTL_LLCHG 0x1000 /* Data Link Layer State Changed Enable */ -#define PCI_EXP_SLTSTA 0x1a /* Slot Status */ -#define PCI_EXP_SLTSTA_ATNB 0x0001 /* Attention Button Pressed */ -#define PCI_EXP_SLTSTA_PWRF 0x0002 /* Power Fault Detected */ -#define PCI_EXP_SLTSTA_MRLS 0x0004 /* MRL Sensor Changed */ -#define PCI_EXP_SLTSTA_PRSD 0x0008 /* Presence Detect Changed */ -#define PCI_EXP_SLTSTA_CMDC 0x0010 /* Command Completed */ -#define PCI_EXP_SLTSTA_MRL_ST 0x0020 /* MRL Sensor State */ -#define PCI_EXP_SLTSTA_PRES 0x0040 /* Presence Detect State */ -#define PCI_EXP_SLTSTA_INTERLOCK 0x0080 /* Electromechanical Interlock Status */ -#define PCI_EXP_SLTSTA_LLCHG 0x0100 /* Data Link Layer State Changed */ -#define PCI_EXP_RTCTL 0x1c /* Root Control */ -#define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */ -#define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */ -#define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */ -#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ -#define PCI_EXP_RTCTL_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ -#define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ -#define PCI_EXP_RTCAP_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ -#define PCI_EXP_RTSTA 0x20 /* Root Status */ -#define PCI_EXP_RTSTA_PME_REQID 0x0000ffff /* PME Requester ID */ -#define PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */ -#define PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */ -#define PCI_EXP_DEVCAP2 0x24 /* Device capabilities 2 */ -#define PCI_EXP_DEVCTL2 0x28 /* Device Control */ -#define PCI_EXP_DEV2_TIMEOUT_RANGE(x) ((x) & 0xf) /* Completion Timeout Ranges Supported */ -#define PCI_EXP_DEV2_TIMEOUT_VALUE(x) ((x) & 0xf) /* Completion Timeout Value */ -#define PCI_EXP_DEV2_TIMEOUT_DIS 0x0010 /* Completion Timeout Disable Supported */ -#define PCI_EXP_DEV2_ARI 0x0020 /* ARI Forwarding */ -#define PCI_EXP_DEVSTA2 0x2a /* Device Status */ -#define PCI_EXP_LNKCAP2 0x2c /* Link Capabilities */ -#define PCI_EXP_LNKCTL2 0x30 /* Link Control */ -#define PCI_EXP_LNKCTL2_SPEED(x) ((x) & 0xf) /* Target Link Speed */ -#define PCI_EXP_LNKCTL2_CMPLNC 0x0010 /* Enter Compliance */ -#define PCI_EXP_LNKCTL2_SPEED_DIS 0x0020 /* Hardware Autonomous Speed Disable */ -#define PCI_EXP_LNKCTL2_DEEMPHASIS(x) (((x) >> 6) & 1) /* Selectable De-emphasis */ -#define PCI_EXP_LNKCTL2_MARGIN(x) (((x) >> 7) & 7) /* Transmit Margin */ -#define PCI_EXP_LNKCTL2_MOD_CMPLNC 0x0400 /* Enter Modified Compliance */ -#define PCI_EXP_LNKCTL2_CMPLNC_SOS 0x0800 /* Compliance SOS */ -#define PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 1) /* Compliance De-emphasis */ -#define PCI_EXP_LNKSTA2 0x32 /* Link Status */ -#define PCI_EXP_LINKSTA2_DEEMPHASIS(x) ((x) & 1) /* Current De-emphasis Level */ -#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities */ -#define PCI_EXP_SLTCTL2 0x38 /* Slot Control */ -#define PCI_EXP_SLTSTA2 0x3a /* Slot Status */ +#define PCI_EXP_FLAGS 0x2 /* Capabilities register */ +#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ +#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ +#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ +#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ +#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ +#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ +#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ +#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ +#define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */ +#define PCI_EXP_TYPE_ROOT_INT_EP 0x9 /* Root Complex Integrated Endpoint */ +#define PCI_EXP_TYPE_ROOT_EC 0xa /* Root Complex Event Collector */ +#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ +#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ +#define PCI_EXP_DEVCAP 0x4 /* Device capabilities */ +#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ +#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ +#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ +#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ +#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ +#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ +#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ +#define PCI_EXP_DEVCAP_RBE 0x8000 /* Role-Based Error Reporting */ +#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ +#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ +#define PCI_EXP_DEVCAP_FLRESET 0x10000000 /* Function-Level Reset */ +#define PCI_EXP_DEVCTL 0x8 /* Device Control */ +#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ +#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ +#define PCI_EXP_DEVCTL_RELAXED 0x0010 /* Enable Relaxed Ordering */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ +#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ +#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ +#define PCI_EXP_DEVCTL_NOSNOOP 0x0800 /* Enable No Snoop */ +#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ +#define PCI_EXP_DEVCTL_BCRE 0x8000 /* Bridge Configuration Retry Enable */ +#define PCI_EXP_DEVCTL_FLRESET 0x8000 /* Function-Level Reset [bit shared with BCRE] */ +#define PCI_EXP_DEVSTA 0xa /* Device Status */ +#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ +#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ +#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ +#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ +#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ +#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ +#define PCI_EXP_LNKCAP 0xc /* Link Capabilities */ +#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */ +#define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */ +#define PCI_EXP_LNKCAP_ASPM 0x00c00 /* Active State Power Management */ +#define PCI_EXP_LNKCAP_L0S 0x07000 /* L0s Acceptable Latency */ +#define PCI_EXP_LNKCAP_L1 0x38000 /* L1 Acceptable Latency */ +#define PCI_EXP_LNKCAP_CLOCKPM 0x40000 /* Clock Power Management */ +#define PCI_EXP_LNKCAP_SURPRISE 0x80000 /* Surprise Down Error Reporting */ +#define PCI_EXP_LNKCAP_DLLA 0x100000 /* Data Link Layer Active Reporting */ +#define PCI_EXP_LNKCAP_LBNC 0x200000 /* Link Bandwidth Notification Capability */ +#define PCI_EXP_LNKCAP_PORT 0xff000000 /* Port Number */ +#define PCI_EXP_LNKCTL 0x10 /* Link Control */ +#define PCI_EXP_LNKCTL_ASPM 0x0003 /* ASPM Control */ +#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ +#define PCI_EXP_LNKCTL_DISABLE 0x0010 /* Link Disable */ +#define PCI_EXP_LNKCTL_RETRAIN 0x0020 /* Retrain Link */ +#define PCI_EXP_LNKCTL_CLOCK 0x0040 /* Common Clock Configuration */ +#define PCI_EXP_LNKCTL_XSYNCH 0x0080 /* Extended Synch */ +#define PCI_EXP_LNKCTL_CLOCKPM 0x0100 /* Clock Power Management */ +#define PCI_EXP_LNKCTL_HWAUTWD 0x0200 /* Hardware Autonomous Width Disable */ +#define PCI_EXP_LNKCTL_BWMIE 0x0400 /* Bandwidth Mgmt Interrupt Enable */ +#define PCI_EXP_LNKCTL_AUTBWIE 0x0800 /* Autonomous Bandwidth Mgmt Interrupt Enable */ +#define PCI_EXP_LNKSTA 0x12 /* Link Status */ +#define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */ +#define PCI_EXP_LNKSTA_WIDTH 0x03f0 /* Negotiated Link Width */ +#define PCI_EXP_LNKSTA_TR_ERR 0x0400 /* Training Error (obsolete) */ +#define PCI_EXP_LNKSTA_TRAIN 0x0800 /* Link Training */ +#define PCI_EXP_LNKSTA_SL_CLK 0x1000 /* Slot Clock Configuration */ +#define PCI_EXP_LNKSTA_DL_ACT 0x2000 /* Data Link Layer in DL_Active State */ +#define PCI_EXP_LNKSTA_BWMGMT 0x4000 /* Bandwidth Mgmt Status */ +#define PCI_EXP_LNKSTA_AUTBW 0x8000 /* Autonomous Bandwidth Mgmt Status */ +#define PCI_EXP_SLTCAP 0x14 /* Slot Capabilities */ +#define PCI_EXP_SLTCAP_ATNB 0x0001 /* Attention Button Present */ +#define PCI_EXP_SLTCAP_PWRC 0x0002 /* Power Controller Present */ +#define PCI_EXP_SLTCAP_MRL 0x0004 /* MRL Sensor Present */ +#define PCI_EXP_SLTCAP_ATNI 0x0008 /* Attention Indicator Present */ +#define PCI_EXP_SLTCAP_PWRI 0x0010 /* Power Indicator Present */ +#define PCI_EXP_SLTCAP_HPS 0x0020 /* Hot-Plug Surprise */ +#define PCI_EXP_SLTCAP_HPC 0x0040 /* Hot-Plug Capable */ +#define PCI_EXP_SLTCAP_PWR_VAL 0x00007f80 /* Slot Power Limit Value */ +#define PCI_EXP_SLTCAP_PWR_SCL 0x00018000 /* Slot Power Limit Scale */ +#define PCI_EXP_SLTCAP_INTERLOCK 0x020000 /* Electromechanical Interlock Present */ +#define PCI_EXP_SLTCAP_NOCMDCOMP 0x040000 /* No Command Completed Support */ +#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */ +#define PCI_EXP_SLTCTL 0x18 /* Slot Control */ +#define PCI_EXP_SLTCTL_ATNB 0x0001 /* Attention Button Pressed Enable */ +#define PCI_EXP_SLTCTL_PWRF 0x0002 /* Power Fault Detected Enable */ +#define PCI_EXP_SLTCTL_MRLS 0x0004 /* MRL Sensor Changed Enable */ +#define PCI_EXP_SLTCTL_PRSD 0x0008 /* Presence Detect Changed Enable */ +#define PCI_EXP_SLTCTL_CMDC 0x0010 /* Command Completed Interrupt Enable */ +#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ +#define PCI_EXP_SLTCTL_ATNI 0x00c0 /* Attention Indicator Control */ +#define PCI_EXP_SLTCTL_PWRI 0x0300 /* Power Indicator Control */ +#define PCI_EXP_SLTCTL_PWRC 0x0400 /* Power Controller Control */ +#define PCI_EXP_SLTCTL_INTERLOCK 0x0800 /* Electromechanical Interlock Control */ +#define PCI_EXP_SLTCTL_LLCHG 0x1000 /* Data Link Layer State Changed Enable */ +#define PCI_EXP_SLTSTA 0x1a /* Slot Status */ +#define PCI_EXP_SLTSTA_ATNB 0x0001 /* Attention Button Pressed */ +#define PCI_EXP_SLTSTA_PWRF 0x0002 /* Power Fault Detected */ +#define PCI_EXP_SLTSTA_MRLS 0x0004 /* MRL Sensor Changed */ +#define PCI_EXP_SLTSTA_PRSD 0x0008 /* Presence Detect Changed */ +#define PCI_EXP_SLTSTA_CMDC 0x0010 /* Command Completed */ +#define PCI_EXP_SLTSTA_MRL_ST 0x0020 /* MRL Sensor State */ +#define PCI_EXP_SLTSTA_PRES 0x0040 /* Presence Detect State */ +#define PCI_EXP_SLTSTA_INTERLOCK 0x0080 /* Electromechanical Interlock Status */ +#define PCI_EXP_SLTSTA_LLCHG 0x0100 /* Data Link Layer State Changed */ +#define PCI_EXP_RTCTL 0x1c /* Root Control */ +#define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */ +#define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */ +#define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */ +#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ +#define PCI_EXP_RTCTL_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ +#define PCI_EXP_RTCAP 0x1e /* Root Capabilities */ +#define PCI_EXP_RTCAP_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */ +#define PCI_EXP_RTSTA 0x20 /* Root Status */ +#define PCI_EXP_RTSTA_PME_REQID 0x0000ffff /* PME Requester ID */ +#define PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */ +#define PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */ +#define PCI_EXP_DEVCAP2 0x24 /* Device capabilities 2 */ +#define PCI_EXP_DEVCTL2 0x28 /* Device Control */ +#define PCI_EXP_DEV2_TIMEOUT_RANGE(x) ((x) & 0xf) /* Completion Timeout Ranges Supported */ +#define PCI_EXP_DEV2_TIMEOUT_VALUE(x) ((x) & 0xf) /* Completion Timeout Value */ +#define PCI_EXP_DEV2_TIMEOUT_DIS 0x0010 /* Completion Timeout Disable Supported */ +#define PCI_EXP_DEV2_ARI 0x0020 /* ARI Forwarding */ +#define PCI_EXP_DEVSTA2 0x2a /* Device Status */ +#define PCI_EXP_LNKCAP2 0x2c /* Link Capabilities */ +#define PCI_EXP_LNKCTL2 0x30 /* Link Control */ +#define PCI_EXP_LNKCTL2_SPEED(x) ((x) & 0xf) /* Target Link Speed */ +#define PCI_EXP_LNKCTL2_CMPLNC 0x0010 /* Enter Compliance */ +#define PCI_EXP_LNKCTL2_SPEED_DIS 0x0020 /* Hardware Autonomous Speed Disable */ +#define PCI_EXP_LNKCTL2_DEEMPHASIS(x) (((x) >> 6) & 1) /* Selectable De-emphasis */ +#define PCI_EXP_LNKCTL2_MARGIN(x) (((x) >> 7) & 7) /* Transmit Margin */ +#define PCI_EXP_LNKCTL2_MOD_CMPLNC 0x0400 /* Enter Modified Compliance */ +#define PCI_EXP_LNKCTL2_CMPLNC_SOS 0x0800 /* Compliance SOS */ +#define PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 1) /* Compliance De-emphasis */ +#define PCI_EXP_LNKSTA2 0x32 /* Link Status */ +#define PCI_EXP_LINKSTA2_DEEMPHASIS(x) ((x) & 1) /* Current De-emphasis Level */ +#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities */ +#define PCI_EXP_SLTCTL2 0x38 /* Slot Control */ +#define PCI_EXP_SLTSTA2 0x3a /* Slot Status */ /* MSI-X */ -#define PCI_MSIX_ENABLE 0x8000 -#define PCI_MSIX_MASK 0x4000 -#define PCI_MSIX_TABSIZE 0x03ff -#define PCI_MSIX_TABLE 4 -#define PCI_MSIX_PBA 8 -#define PCI_MSIX_BIR 0x7 +#define PCI_MSIX_ENABLE 0x8000 +#define PCI_MSIX_MASK 0x4000 +#define PCI_MSIX_TABSIZE 0x03ff +#define PCI_MSIX_TABLE 4 +#define PCI_MSIX_PBA 8 +#define PCI_MSIX_BIR 0x7 /* Subsystem vendor/device ID for PCI bridges */ -#define PCI_SSVID_VENDOR 4 -#define PCI_SSVID_DEVICE 6 +#define PCI_SSVID_VENDOR 4 +#define PCI_SSVID_DEVICE 6 /* Advanced Error Reporting */ #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ @@ -665,24 +667,24 @@ #define PCI_ERR_ROOT_SRC 54 /* Virtual Channel */ -#define PCI_VC_PORT_REG1 4 -#define PCI_VC_PORT_REG2 8 -#define PCI_VC_PORT_CTRL 12 -#define PCI_VC_PORT_STATUS 14 -#define PCI_VC_RES_CAP 16 -#define PCI_VC_RES_CTRL 20 -#define PCI_VC_RES_STATUS 26 +#define PCI_VC_PORT_REG1 4 +#define PCI_VC_PORT_REG2 8 +#define PCI_VC_PORT_CTRL 12 +#define PCI_VC_PORT_STATUS 14 +#define PCI_VC_RES_CAP 16 +#define PCI_VC_RES_CTRL 20 +#define PCI_VC_RES_STATUS 26 /* Power Budgeting */ -#define PCI_PWR_DSR 4 /* Data Select Register */ -#define PCI_PWR_DATA 8 /* Data Register */ +#define PCI_PWR_DSR 4 /* Data Select Register */ +#define PCI_PWR_DATA 8 /* Data Register */ #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ -#define PCI_PWR_CAP 12 /* Capability */ +#define PCI_PWR_CAP 12 /* Capability */ #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ /* Access Control Services */ @@ -713,40 +715,40 @@ #define PCI_ARI_CTRL 0x06 /* ARI Control Register */ #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ -#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ +#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ /* Address Translation Service */ #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ -#define PCI_ATS_CAP_IQD(x) ((x) & 0x1f) /* Invalidate Queue Depth */ +#define PCI_ATS_CAP_IQD(x) ((x) & 0x1f) /* Invalidate Queue Depth */ #define PCI_ATS_CTRL 0x06 /* ATS Control Register */ -#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ -#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ +#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ +#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ /* Single Root I/O Virtualization */ -#define PCI_IOV_CAP 0x04 /* SR-IOV Capability Register */ -#define PCI_IOV_CAP_VFM 0x00000001 /* VF Migration Capable */ -#define PCI_IOV_CAP_IMN(x) ((x) >> 21) /* VF Migration Interrupt Message Number */ -#define PCI_IOV_CTRL 0x08 /* SR-IOV Control Register */ -#define PCI_IOV_CTRL_VFE 0x0001 /* VF Enable */ -#define PCI_IOV_CTRL_VFME 0x0002 /* VF Migration Enable */ -#define PCI_IOV_CTRL_VFMIE 0x0004 /* VF Migration Interrupt Enable */ -#define PCI_IOV_CTRL_MSE 0x0008 /* VF MSE */ -#define PCI_IOV_CTRL_ARI 0x0010 /* ARI Capable Hierarchy */ -#define PCI_IOV_STATUS 0x0a /* SR-IOV Status Register */ -#define PCI_IOV_STATUS_MS 0x0001 /* VF Migration Status */ -#define PCI_IOV_INITIALVF 0x0c /* Number of VFs that are initially associated */ -#define PCI_IOV_TOTALVF 0x0e /* Maximum number of VFs that could be associated */ -#define PCI_IOV_NUMVF 0x10 /* Number of VFs that are available */ -#define PCI_IOV_FDL 0x12 /* Function Dependency Link */ -#define PCI_IOV_OFFSET 0x14 /* First VF Offset */ -#define PCI_IOV_STRIDE 0x16 /* Routing ID offset from one VF to the next one */ -#define PCI_IOV_DID 0x1a /* VF Device ID */ -#define PCI_IOV_SUPPS 0x1c /* Supported Page Sizes */ -#define PCI_IOV_SYSPS 0x20 /* System Page Size */ -#define PCI_IOV_BAR_BASE 0x24 /* VF BAR0, VF BAR1, ... VF BAR5 */ -#define PCI_IOV_NUM_BAR 6 /* Number of VF BARs */ -#define PCI_IOV_MSAO 0x3c /* VF Migration State Array Offset */ -#define PCI_IOV_MSA_BIR(x) ((x) & 7) /* VF Migration State BIR */ +#define PCI_IOV_CAP 0x04 /* SR-IOV Capability Register */ +#define PCI_IOV_CAP_VFM 0x00000001 /* VF Migration Capable */ +#define PCI_IOV_CAP_IMN(x) ((x) >> 21) /* VF Migration Interrupt Message Number */ +#define PCI_IOV_CTRL 0x08 /* SR-IOV Control Register */ +#define PCI_IOV_CTRL_VFE 0x0001 /* VF Enable */ +#define PCI_IOV_CTRL_VFME 0x0002 /* VF Migration Enable */ +#define PCI_IOV_CTRL_VFMIE 0x0004 /* VF Migration Interrupt Enable */ +#define PCI_IOV_CTRL_MSE 0x0008 /* VF MSE */ +#define PCI_IOV_CTRL_ARI 0x0010 /* ARI Capable Hierarchy */ +#define PCI_IOV_STATUS 0x0a /* SR-IOV Status Register */ +#define PCI_IOV_STATUS_MS 0x0001 /* VF Migration Status */ +#define PCI_IOV_INITIALVF 0x0c /* Number of VFs that are initially associated */ +#define PCI_IOV_TOTALVF 0x0e /* Maximum number of VFs that could be associated */ +#define PCI_IOV_NUMVF 0x10 /* Number of VFs that are available */ +#define PCI_IOV_FDL 0x12 /* Function Dependency Link */ +#define PCI_IOV_OFFSET 0x14 /* First VF Offset */ +#define PCI_IOV_STRIDE 0x16 /* Routing ID offset from one VF to the next one */ +#define PCI_IOV_DID 0x1a /* VF Device ID */ +#define PCI_IOV_SUPPS 0x1c /* Supported Page Sizes */ +#define PCI_IOV_SYSPS 0x20 /* System Page Size */ +#define PCI_IOV_BAR_BASE 0x24 /* VF BAR0, VF BAR1, ... VF BAR5 */ +#define PCI_IOV_NUM_BAR 6 /* Number of VF BARs */ +#define PCI_IOV_MSAO 0x3c /* VF Migration State Array Offset */ +#define PCI_IOV_MSA_BIR(x) ((x) & 7) /* VF Migration State BIR */ #define PCI_IOV_MSA_OFFSET(x) ((x) & 0xfffffff8) /* VF Migration State Offset */ /* @@ -758,64 +760,64 @@ * 2:0 = function */ #define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) -#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) -#define PCI_FUNC(devfn) ((devfn) & 0x07) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) /* Device classes and subclasses */ -#define PCI_CLASS_NOT_DEFINED 0x0000 -#define PCI_CLASS_NOT_DEFINED_VGA 0x0001 +#define PCI_CLASS_NOT_DEFINED 0x0000 +#define PCI_CLASS_NOT_DEFINED_VGA 0x0001 + +#define PCI_BASE_CLASS_STORAGE 0x01 +#define PCI_CLASS_STORAGE_SCSI 0x0100 +#define PCI_CLASS_STORAGE_IDE 0x0101 +#define PCI_CLASS_STORAGE_FLOPPY 0x0102 +#define PCI_CLASS_STORAGE_IPI 0x0103 +#define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_ATA 0x0105 +#define PCI_CLASS_STORAGE_SATA 0x0106 +#define PCI_CLASS_STORAGE_SAS 0x0107 +#define PCI_CLASS_STORAGE_OTHER 0x0180 -#define PCI_BASE_CLASS_STORAGE 0x01 -#define PCI_CLASS_STORAGE_SCSI 0x0100 -#define PCI_CLASS_STORAGE_IDE 0x0101 -#define PCI_CLASS_STORAGE_FLOPPY 0x0102 -#define PCI_CLASS_STORAGE_IPI 0x0103 -#define PCI_CLASS_STORAGE_RAID 0x0104 -#define PCI_CLASS_STORAGE_ATA 0x0105 -#define PCI_CLASS_STORAGE_SATA 0x0106 -#define PCI_CLASS_STORAGE_SAS 0x0107 -#define PCI_CLASS_STORAGE_OTHER 0x0180 - -#define PCI_BASE_CLASS_NETWORK 0x02 -#define PCI_CLASS_NETWORK_ETHERNET 0x0200 +#define PCI_BASE_CLASS_NETWORK 0x02 +#define PCI_CLASS_NETWORK_ETHERNET 0x0200 #define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 -#define PCI_CLASS_NETWORK_FDDI 0x0202 -#define PCI_CLASS_NETWORK_ATM 0x0203 -#define PCI_CLASS_NETWORK_ISDN 0x0204 -#define PCI_CLASS_NETWORK_OTHER 0x0280 +#define PCI_CLASS_NETWORK_FDDI 0x0202 +#define PCI_CLASS_NETWORK_ATM 0x0203 +#define PCI_CLASS_NETWORK_ISDN 0x0204 +#define PCI_CLASS_NETWORK_OTHER 0x0280 -#define PCI_BASE_CLASS_DISPLAY 0x03 -#define PCI_CLASS_DISPLAY_VGA 0x0300 -#define PCI_CLASS_DISPLAY_XGA 0x0301 -#define PCI_CLASS_DISPLAY_3D 0x0302 -#define PCI_CLASS_DISPLAY_OTHER 0x0380 +#define PCI_BASE_CLASS_DISPLAY 0x03 +#define PCI_CLASS_DISPLAY_VGA 0x0300 +#define PCI_CLASS_DISPLAY_XGA 0x0301 +#define PCI_CLASS_DISPLAY_3D 0x0302 +#define PCI_CLASS_DISPLAY_OTHER 0x0380 -#define PCI_BASE_CLASS_MULTIMEDIA 0x04 -#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 -#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 -#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 +#define PCI_BASE_CLASS_MULTIMEDIA 0x04 +#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 +#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 +#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 #define PCI_CLASS_MULTIMEDIA_AUDIO_DEV 0x0403 -#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 +#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 -#define PCI_BASE_CLASS_MEMORY 0x05 -#define PCI_CLASS_MEMORY_RAM 0x0500 -#define PCI_CLASS_MEMORY_FLASH 0x0501 -#define PCI_CLASS_MEMORY_OTHER 0x0580 +#define PCI_BASE_CLASS_MEMORY 0x05 +#define PCI_CLASS_MEMORY_RAM 0x0500 +#define PCI_CLASS_MEMORY_FLASH 0x0501 +#define PCI_CLASS_MEMORY_OTHER 0x0580 -#define PCI_BASE_CLASS_BRIDGE 0x06 -#define PCI_CLASS_BRIDGE_HOST 0x0600 -#define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_CLASS_BRIDGE_EISA 0x0602 -#define PCI_CLASS_BRIDGE_MC 0x0603 -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 -#define PCI_CLASS_BRIDGE_NUBUS 0x0606 -#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 -#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 -#define PCI_CLASS_BRIDGE_PCI_SEMI 0x0609 -#define PCI_CLASS_BRIDGE_IB_TO_PCI 0x060a -#define PCI_CLASS_BRIDGE_OTHER 0x0680 +#define PCI_BASE_CLASS_BRIDGE 0x06 +#define PCI_CLASS_BRIDGE_HOST 0x0600 +#define PCI_CLASS_BRIDGE_ISA 0x0601 +#define PCI_CLASS_BRIDGE_EISA 0x0602 +#define PCI_CLASS_BRIDGE_MC 0x0603 +#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 +#define PCI_CLASS_BRIDGE_NUBUS 0x0606 +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 +#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 +#define PCI_CLASS_BRIDGE_PCI_SEMI 0x0609 +#define PCI_CLASS_BRIDGE_IB_TO_PCI 0x060a +#define PCI_CLASS_BRIDGE_OTHER 0x0680 #define PCI_BASE_CLASS_COMMUNICATION 0x07 #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 @@ -824,11 +826,11 @@ #define PCI_CLASS_COMMUNICATION_MODEM 0x0703 #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 -#define PCI_BASE_CLASS_SYSTEM 0x08 -#define PCI_CLASS_SYSTEM_PIC 0x0800 -#define PCI_CLASS_SYSTEM_DMA 0x0801 -#define PCI_CLASS_SYSTEM_TIMER 0x0802 -#define PCI_CLASS_SYSTEM_RTC 0x0803 +#define PCI_BASE_CLASS_SYSTEM 0x08 +#define PCI_CLASS_SYSTEM_PIC 0x0800 +#define PCI_CLASS_SYSTEM_DMA 0x0801 +#define PCI_CLASS_SYSTEM_TIMER 0x0802 +#define PCI_CLASS_SYSTEM_RTC 0x0803 #define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 #define PCI_CLASS_SYSTEM_OTHER 0x0880 Index: branches/azimutz/Cleancut/i386/libsaio/biosfn.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/biosfn.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/biosfn.c (revision 899) @@ -470,56 +470,55 @@ /* Check to see if the passed-in drive is in El Torito no-emulation mode. */ int is_no_emulation(int drive) { - struct packet { - unsigned char packet_size; - unsigned char media_type; - unsigned char drive_num; - unsigned char ctrlr_index; - unsigned long lba; - unsigned short device_spec; - unsigned short buffer_segment; - unsigned short load_segment; - unsigned short sector_count; - unsigned char cyl_count; - unsigned char sec_count; - unsigned char head_count; - unsigned char reseved; - } __attribute__((packed)); - static struct packet pkt; - - bzero(&pkt, sizeof(pkt)); - pkt.packet_size = 0x13; - - bb.intno = 0x13; - bb.eax.r.h = 0x4b; - bb.eax.r.l = 0x01; // subfunc: get info - bb.edx.r.l = drive; - bb.esi.rr = NORMALIZED_OFFSET((unsigned)&pkt); - bb.ds = NORMALIZED_SEGMENT((unsigned)&pkt); - - bios(&bb); + struct packet { + unsigned char packet_size; + unsigned char media_type; + unsigned char drive_num; + unsigned char ctrlr_index; + unsigned long lba; + unsigned short device_spec; + unsigned short buffer_segment; + unsigned short load_segment; + unsigned short sector_count; + unsigned char cyl_count; + unsigned char sec_count; + unsigned char head_count; + unsigned char reseved; + } __attribute__((packed)); + static struct packet pkt; + + bzero(&pkt, sizeof(pkt)); + pkt.packet_size = 0x13; + + bb.intno = 0x13; + bb.eax.r.h = 0x4b; + bb.eax.r.l = 0x01; // subfunc: get info + bb.edx.r.l = drive; + bb.esi.rr = NORMALIZED_OFFSET((unsigned)&pkt); + bb.ds = NORMALIZED_SEGMENT((unsigned)&pkt); + + bios(&bb); #if DEBUG - printf("el_torito info drive %x\n", drive); - - printf("--> cf %x, eax %x\n", bb.flags.cf, bb.eax.rr); - - printf("pkt_size: %x\n", pkt.packet_size); - printf("media_type: %x\n", pkt.media_type); - printf("drive_num: %x\n", pkt.drive_num); - printf("device_spec: %x\n", pkt.device_spec); - printf("press a key->\n");getc(); + printf("el_torito info drive %x\n", drive); + + printf("--> cf %x, eax %x\n", bb.flags.cf, bb.eax.rr); + + printf("pkt_size: %x\n", pkt.packet_size); + printf("media_type: %x\n", pkt.media_type); + printf("drive_num: %x\n", pkt.drive_num); + printf("device_spec: %x\n", pkt.device_spec); + printf("press a key->\n");getc(); #endif - - /* Some BIOSes erroneously return cf = 1 */ - /* Just check to see if the drive number is the same. */ - if (pkt.drive_num == drive) { - if ((pkt.media_type & 0x0F) == 0) { - /* We are in no-emulation mode. */ - return 1; + + /* Some BIOSes erroneously return cf = 1 */ + /* Just check to see if the drive number is the same. */ + if (pkt.drive_num == drive) { + if ((pkt.media_type & 0x0F) == 0) { + /* We are in no-emulation mode. */ + return 1; + } } - } - - return 0; + return 0; } #if DEBUG @@ -528,157 +527,159 @@ */ void print_drive_info(boot_drive_info_t *dp) { - // printf("buf_size = %x\n", dp->params.buf_size); - printf("info_flags = %x\n", dp->params.info_flags); - printf(" phys_cyls = %lx\n", dp->params. phys_cyls); - printf(" phys_heads = %lx\n", dp->params. phys_heads); - printf(" phys_spt = %lx\n", dp->params. phys_spt); - printf("phys_sectors = %lx%lx\n", ((unsigned long *)(&dp->params.phys_sectors))[1], - ((unsigned long *)(&dp->params.phys_sectors))[0]); - printf("phys_nbps = %x\n", dp->params.phys_nbps); - // printf("dpte_offset = %x\n", dp->params.dpte_offset); - // printf("dpte_segment = %x\n", dp->params.dpte_segment); - // printf("key = %x\n", dp->params.key); - // printf("path_len = %x\n", dp->params. path_len); - // printf("reserved1 = %x\n", dp->params. reserved1); - // printf("reserved2 = %x\n", dp->params.reserved2); - //printf("bus_type[4] = %x\n", dp->params. bus_type[4]); - //printf("interface_type[8] = %x\n", dp->params. interface_type[8]); - //printf("interface_path[8] = %x\n", dp->params. interface_path[8]); - //printf("dev_path[8] = %x\n", dp->params. dev_path[8]); - // printf("reserved3 = %x\n", dp->params. reserved3); - // printf("checksum = %x\n", dp->params. checksum); - - printf(" io_port_base = %x\n", dp->dpte.io_port_base); - printf(" control_port_base = %x\n", dp->dpte.control_port_base); - printf(" head_flags = %x\n", dp->dpte. head_flags); - printf(" vendor_info = %x\n", dp->dpte. vendor_info); - printf(" irq = %x\n", dp->dpte. irq); - // printf(" irq_unused = %x\n", dp->dpte. irq_unused); - printf(" block_count = %x\n", dp->dpte. block_count); - printf(" dma_channe = %x\n", dp->dpte. dma_channel); - printf(" dma_type = %x\n", dp->dpte. dma_type); - printf(" pio_type = %x\n", dp->dpte. pio_type); - printf(" pio_unused = %x\n", dp->dpte. pio_unused); - printf(" option_flags = %x\n", dp->dpte.option_flags); - // printf(" reserved = %x\n", dp->dpte.reserved); - printf(" revision = %x\n", dp->dpte. revision); - // printf(" checksum = %x\n", dp->dpte. checksum); +// printf("buf_size = %x\n", dp->params.buf_size); + printf("info_flags = %x\n", dp->params.info_flags); + printf("phys_cyls = %lx\n", dp->params. phys_cyls); + printf("phys_heads = %lx\n", dp->params. phys_heads); + printf("phys_spt = %lx\n", dp->params. phys_spt); + printf("phys_sectors = %lx%lx\n", ((unsigned long *)(&dp->params.phys_sectors))[1], + ((unsigned long *)(&dp->params.phys_sectors))[0]); + printf("phys_nbps = %x\n", dp->params.phys_nbps); +// printf("dpte_offset = %x\n", dp->params.dpte_offset); +// printf("dpte_segment = %x\n", dp->params.dpte_segment); +// printf("key = %x\n", dp->params.key); +// printf("path_len = %x\n", dp->params. path_len); +// printf("reserved1 = %x\n", dp->params. reserved1); +// printf("reserved2 = %x\n", dp->params.reserved2); +// printf("bus_type[4] = %x\n", dp->params. bus_type[4]); +// printf("interface_type[8] = %x\n", dp->params. interface_type[8]); +// printf("interface_path[8] = %x\n", dp->params. interface_path[8]); +// printf("dev_path[8] = %x\n", dp->params. dev_path[8]); +// printf("reserved3 = %x\n", dp->params. reserved3); +// printf("checksum = %x\n", dp->params. checksum); + printf("io_port_base = %x\n", dp->dpte.io_port_base); + printf("control_port_base = %x\n", dp->dpte.control_port_base); + printf("head_flags = %x\n", dp->dpte. head_flags); + printf("vendor_info = %x\n", dp->dpte. vendor_info); + printf("irq = %x\n", dp->dpte. irq); +// printf("irq_unused = %x\n", dp->dpte. irq_unused); + printf("block_count = %x\n", dp->dpte. block_count); + printf("dma_channe = %x\n", dp->dpte. dma_channel); + printf("dma_type = %x\n", dp->dpte. dma_type); + printf("pio_type = %x\n", dp->dpte. pio_type); + printf("pio_unused = %x\n", dp->dpte. pio_unused); + printf("option_flags = %x\n", dp->dpte.option_flags); +// printf("reserved = %x\n", dp->dpte.reserved); + printf("revision = %x\n", dp->dpte. revision); +// printf("checksum = %x\n", dp->dpte. checksum); } #endif int get_drive_info(int drive, struct driveInfo *dp) { - boot_drive_info_t *di = &dp->di; - int ret = 0; - + boot_drive_info_t *di = &dp->di; + int ret = 0; + #if UNUSED - if (maxhd == 0) { - bb.intno = 0x13; - bb.eax.r.h = 0x08; - bb.edx.r.l = 0x80; - bios(&bb); - if (bb.flags.cf == 0) - maxhd = 0x7f + bb.edx.r.l; - }; - - if (drive > maxhd) - return 0; + if (maxhd == 0) { + bb.intno = 0x13; + bb.eax.r.h = 0x08; + bb.edx.r.l = 0x80; + bios(&bb); + if (bb.flags.cf == 0) + maxhd = 0x7f + bb.edx.r.l; + }; + + if (drive > maxhd) + return 0; #endif + + bzero(dp, sizeof(struct driveInfo)); + dp->biosdev = drive; + + /* Check for El Torito no-emulation mode. */ + dp->no_emulation = is_no_emulation(drive); - bzero(dp, sizeof(struct driveInfo)); - dp->biosdev = drive; - - /* Check for El Torito no-emulation mode. */ - dp->no_emulation = is_no_emulation(drive); - - /* Check drive for EBIOS support. */ - bb.intno = 0x13; - bb.eax.r.h = 0x41; - bb.edx.r.l = drive; - bb.ebx.rr = 0x55aa; - bios(&bb); - if((bb.ebx.rr == 0xaa55) && (bb.flags.cf == 0)) { - /* Get flags for supported operations. */ - dp->uses_ebios = bb.ecx.r.l; - } - - if (dp->uses_ebios & (EBIOS_ENHANCED_DRIVE_INFO | EBIOS_LOCKING_ACCESS | EBIOS_FIXED_DISK_ACCESS)) { - /* Get EBIOS drive info. */ - static struct drive_params params; - - params.buf_size = sizeof(params); - bb.intno = 0x13; - bb.eax.r.h = 0x48; - bb.edx.r.l = drive; - bb.esi.rr = NORMALIZED_OFFSET((unsigned)¶ms); - bb.ds = NORMALIZED_SEGMENT((unsigned)¶ms); - bios(&bb); - if(bb.flags.cf != 0 /* || params.phys_sectors < 2097152 */) { - dp->uses_ebios = 0; - di->params.buf_size = 1; - } else { - bcopy(¶ms, &di->params, sizeof(params)); - - if (drive >= BASE_HD_DRIVE && - (dp->uses_ebios & EBIOS_ENHANCED_DRIVE_INFO) && - di->params.buf_size >= 30 && - !(di->params.dpte_offset == 0xFFFF && di->params.dpte_segment == 0xFFFF)) { - void *ptr = (void *)(di->params.dpte_offset + ((unsigned int)di->params.dpte_segment << 4)); - bcopy(ptr, &di->dpte, sizeof(di->dpte)); - } + /* Check drive for EBIOS support. */ + bb.intno = 0x13; + bb.eax.r.h = 0x41; + bb.edx.r.l = drive; + bb.ebx.rr = 0x55aa; + bios(&bb); + + if ((bb.ebx.rr == 0xaa55) && (bb.flags.cf == 0)) { + /* Get flags for supported operations. */ + dp->uses_ebios = bb.ecx.r.l; } - } + + if (dp->uses_ebios & (EBIOS_ENHANCED_DRIVE_INFO | EBIOS_LOCKING_ACCESS | EBIOS_FIXED_DISK_ACCESS)) { + /* Get EBIOS drive info. */ + static struct drive_params params; + + params.buf_size = sizeof(params); + bb.intno = 0x13; + bb.eax.r.h = 0x48; + bb.edx.r.l = drive; + bb.esi.rr = NORMALIZED_OFFSET((unsigned)¶ms); + bb.ds = NORMALIZED_SEGMENT((unsigned)¶ms); + bios(&bb); + + if (bb.flags.cf != 0 /* || params.phys_sectors < 2097152 */) { + dp->uses_ebios = 0; + di->params.buf_size = 1; + } + else + { + bcopy(¶ms, &di->params, sizeof(params)); + + if (drive >= BASE_HD_DRIVE && + (dp->uses_ebios & EBIOS_ENHANCED_DRIVE_INFO) && + di->params.buf_size >= 30 && + !(di->params.dpte_offset == 0xFFFF && di->params.dpte_segment == 0xFFFF)) { + void *ptr = (void *)(di->params.dpte_offset + ((unsigned int)di->params.dpte_segment << 4)); + bcopy(ptr, &di->dpte, sizeof(di->dpte)); + } + } + } /* * zef: This code will fail on recent JMicron and Intel option ROMs */ -// if (di->params.phys_heads == 0 || di->params.phys_spt == 0) { -// /* Either it's not EBIOS, or EBIOS didn't tell us. */ -// bb.intno = 0x13; -// bb.eax.r.h = 0x08; -// bb.edx.r.l = drive; -// bios(&bb); -// if (bb.flags.cf == 0 && bb.eax.r.h == 0) { -// unsigned long cyl; -// unsigned long sec; -// unsigned long hds; -// -// hds = bb.edx.r.h; -// sec = bb.ecx.r.l & 0x3F; -// if((dp->uses_ebios & EBIOS_ENHANCED_DRIVE_INFO) && (sec != 0)) { -// cyl = (di->params.phys_sectors / ((hds + 1) * sec)) - 1; -// } -// else { -// cyl = bb.ecx.r.h | ((bb.ecx.r.l & 0xC0) << 2); -// } -// di->params.phys_heads = hds; -// di->params.phys_spt = sec; -// di->params.phys_cyls = cyl; -// } else { -// ret = -1; +// if (di->params.phys_heads == 0 || di->params.phys_spt == 0) { +// /* Either it's not EBIOS, or EBIOS didn't tell us. */ +// bb.intno = 0x13; +// bb.eax.r.h = 0x08; +// bb.edx.r.l = drive; +// bios(&bb); +// if (bb.flags.cf == 0 && bb.eax.r.h == 0) { +// unsigned long cyl; +// unsigned long sec; +// unsigned long hds; +// +// hds = bb.edx.r.h; +// sec = bb.ecx.r.l & 0x3F; +// if ((dp->uses_ebios & EBIOS_ENHANCED_DRIVE_INFO) && (sec != 0)) { +// cyl = (di->params.phys_sectors / ((hds + 1) * sec)) - 1; +// } else { +// cyl = bb.ecx.r.h | ((bb.ecx.r.l & 0xC0) << 2); +// } +// di->params.phys_heads = hds; +// di->params.phys_spt = sec; +// di->params.phys_cyls = cyl; +// } else { +// ret = -1; +// } // } -// } - if (dp->no_emulation) { - /* Some BIOSes give us erroneous EBIOS support information. - * Assume that if you're on a CD, then you can use - * EBIOS disk calls. - */ - dp->uses_ebios |= EBIOS_FIXED_DISK_ACCESS; - } + if (dp->no_emulation) { + /* Some BIOSes give us erroneous EBIOS support information. + * Assume that if you're on a CD, then you can use + * EBIOS disk calls. + */ + dp->uses_ebios |= EBIOS_FIXED_DISK_ACCESS; + } #if DEBUG - print_drive_info(di); - printf("uses_ebios = 0x%x\n", dp->uses_ebios); - printf("result %d\n", ret); - printf("press a key->\n");getc(); + print_drive_info(di); + printf("uses_ebios = 0x%x\n", dp->uses_ebios); + printf("result %d\n", ret); + printf("press a key->\n");getc(); #endif - if (ret == 0) { - dp->valid = 1; - } - return ret; + if (ret == 0) { + dp->valid = 1; + } + return ret; } int ebiosEjectMedia(int biosdev) Index: branches/azimutz/Cleancut/i386/libsaio/fake_efi.c =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/fake_efi.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/fake_efi.c (revision 899) @@ -22,19 +22,19 @@ /* * Modern Darwin kernels require some amount of EFI because Apple machines all - * have EFI. Modifying the kernel source to not require EFI is of course + * have EFI. Modifying the kernel source to not require EFI is of course * possible but would have to be maintained as a separate patch because it is * unlikely that Apple wishes to add legacy support to their kernel. * * As you can see from the Apple-supplied code in bootstruct.c, it seems that * the intention was clearly to modify this booter to provide EFI-like structures - * to the kernel rather than modifying the kernel to handle non-EFI stuff. This + * to the kernel rather than modifying the kernel to handle non-EFI stuff. This * makes a lot of sense from an engineering point of view as it means the kernel * for the as yet unreleased EFI-only Macs could still be booted by the non-EFI * DTK systems so long as the kernel checked to ensure the boot tables were - * filled in appropriately. Modern xnu requires a system table and a runtime + * filled in appropriately. Modern xnu requires a system table and a runtime * services table and performs no checks whatsoever to ensure the pointers to - * these tables are non-NULL. Therefore, any modern xnu kernel will page fault + * these tables are non-NULL. Therefore, any modern xnu kernel will page fault * early on in the boot process if the system table pointer is zero. * * Even before that happens, the tsc_init function in modern xnu requires the FSB @@ -43,7 +43,7 @@ * * As of this writing, the current implementation found here is good enough * to make the currently available xnu kernel boot without modification on a - * system with an appropriate processor. With a minor source modification to + * system with an appropriate processor. With a minor source modification to * the tsc_init function to remove the explicit check for Core or Core 2 * processors the kernel can be made to boot on other processors so long as * the code can be executed by the processor and the machine contains the @@ -53,7 +53,6 @@ /*========================================================================== * Utility function to make a device tree string from an EFI_GUID */ - static inline char * mallocStringForGuid(EFI_GUID const *pGuid) { char *string = malloc(37); @@ -64,7 +63,6 @@ /*========================================================================== * Function to map 32 bit physical address to 64 bit virtual address */ - static uint64_t ptov64(uint32_t addr) { return ((uint64_t)addr | 0xFFFFFF8000000000ULL); @@ -140,10 +138,10 @@ //Azi: crc32 done in place, on the cases were it wasn't. /*static inline void fixupEfiSystemTableCRC32(EFI_SYSTEM_TABLE_64 *efiSystemTable) - { - efiSystemTable->Hdr.CRC32 = 0; - efiSystemTable->Hdr.CRC32 = crc32(0L, efiSystemTable, efiSystemTable->Hdr.HeaderSize); - }*/ +{ + efiSystemTable->Hdr.CRC32 = 0; + efiSystemTable->Hdr.CRC32 = crc32(0L, efiSystemTable, efiSystemTable->Hdr.HeaderSize); +}*/ /* * What we do here is simply allocate a fake EFI system table and a fake EFI @@ -152,7 +150,6 @@ * Because we build against modern headers with kBootArgsRevision 4 we * also take care to set efiMode = 32. */ - void setupEfiTables32(void) { // We use the fake_efi_pages struct so that we only need to do one kernel @@ -410,12 +407,12 @@ #define EFI_ACPI_TABLE_GUID \ { \ -0xeb9d2d30, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + 0xeb9d2d30, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ } #define EFI_ACPI_20_TABLE_GUID \ { \ -0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ + 0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ } EFI_GUID gEfiAcpiTableGuid = EFI_ACPI_TABLE_GUID; @@ -438,11 +435,9 @@ static const char const MODEL_PROP[] = "Model"; static const char const BOARDID_PROP[] = "board-id"; - /* * Get an smbios option string option to convert to EFI_CHAR16 string */ - static EFI_CHAR16* getSmbiosChar16(const char * key, size_t* len) { const char *src = getStringForKey(key, &bootInfo->smbiosConfig); @@ -462,7 +457,6 @@ /* * Get the SystemID from the bios dmi info */ - static EFI_CHAR8* getSmbiosUUID() { static EFI_CHAR8 uuid[UUID_LEN]; @@ -491,7 +485,6 @@ * return a binary UUID value from the overriden SystemID and SMUUID if found, * or from the bios if not, or from a fixed value if no bios value is found */ - static EFI_CHAR8* getSystemID() { // unable to determine UUID for host. Error: 35 fix @@ -517,7 +510,6 @@ * Must be called AFTER setup Acpi because we need to take care of correct * facp content to reflect in ioregs */ - void setupSystemType() { Node *node = DT__FindNode("/", false); @@ -615,7 +607,6 @@ /* * Must be called AFTER getSmbios */ - void setupBoardId() { Node *node; @@ -631,7 +622,6 @@ /* * Load the smbios.plist override config file if any */ - static void setupSmbiosConfigFile(const char *filename) { char dirSpecSMBIOS[128] = ""; @@ -663,17 +653,15 @@ verbose("No SMBIOS replacement found.\n"); } - // get a chance to scan mem dynamically if user asks for it while having the config options loaded as well, - // as opposed to when it was in scan_platform(); also load the orig. smbios so that we can access dmi info without - // patching the smbios yet - + // get a chance to scan mem dynamically if user asks for it while having the config options + // loaded as well, as opposed to when it was in scan_platform(); also load the orig. smbios + // so that we can access dmi info, without patching the smbios yet. scan_mem(); } /* * Installs all the needed configuration table entries */ - static void setupEfiConfigurationTable() { smbios_p = (EFI_PTR32)getSmbios(SMBIOS_PATCHED); @@ -729,7 +717,6 @@ /* * Entrypoint from boot.c */ - void setupFakeEfi(void) { // Generate efi device strings Index: branches/azimutz/Cleancut/i386/libsaio/saio_internal.h =================================================================== --- branches/azimutz/Cleancut/i386/libsaio/saio_internal.h (revision 898) +++ branches/azimutz/Cleancut/i386/libsaio/saio_internal.h (revision 899) @@ -47,7 +47,7 @@ extern int ebioswrite(int dev, long sec, int count); extern int get_drive_info(int drive, struct driveInfo *dp); extern int ebiosEjectMedia(int biosdev); -extern void bios_putchar(int ch); +extern void bios_putchar(int ch); extern void putca(int ch, int attr, int repeat); extern int getc(void); extern void pause(); @@ -81,7 +81,7 @@ extern void finalizeBootStruct(void); /* cache.c */ -extern void CacheReset(); +extern void CacheReset(); extern void CacheInit(CICell ih, long blockSize); extern long CacheRead(CICell ih, char *buffer, long long offset, long length, long cache); @@ -100,9 +100,9 @@ extern void stop(const char *format, ...); /* disk.c */ -extern void rescanBIOSDevice(int biosdev); +extern void rescanBIOSDevice(int biosdev); extern struct DiskBVMap* diskResetBootVolumes(int biosdev); -extern void diskFreeMap(struct DiskBVMap *map); +extern void diskFreeMap(struct DiskBVMap *map); extern int testBiosread( int biosdev, unsigned long long secno ); extern BVRef diskScanBootVolumes(int biosdev, int *count); extern void diskSeek(BVRef bvr, long long position); @@ -127,7 +127,7 @@ u_int16_t *ucslen, u_int32_t bufsize, int byte_order ); /* load.c */ -extern bool gHaveKernelCache; +extern bool gHaveKernelCache; extern long ThinFatFile(void **binary, unsigned long *length); extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize); @@ -168,7 +168,7 @@ extern int ParseXMLFile( char * buffer, TagPtr * dict ); /* sys.c */ -extern BVRef getBootVolumeRef( const char * path, const char ** outPath ); +extern BVRef getBootVolumeRef( const char * path, const char ** outPath ); extern long LoadVolumeFile(BVRef bvr, const char *fileSpec); extern long LoadFile(const char *fileSpec); extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length); Index: branches/azimutz/Cleancut/i386/boot2/Makefile =================================================================== --- branches/azimutz/Cleancut/i386/boot2/Makefile (revision 898) +++ branches/azimutz/Cleancut/i386/boot2/Makefile (revision 899) @@ -121,9 +121,6 @@ -o $(OBJROOT)/Symbols_LINKER_ONLY.dylib - - - endif @make embed_symbols # this is done in a sub process after boot.sys exists so the strings are populated correctly Index: branches/azimutz/Cleancut/i386/boot2/resume.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/resume.c (revision 898) +++ branches/azimutz/Cleancut/i386/boot2/resume.c (revision 899) @@ -106,7 +106,7 @@ size = ReadFileAtOffset (image_filename, header, 0, sizeof(IOHibernateImageHeader)); printf("header read size %x\n", size); - + imageSize = header->image1Size; codeSize = header->restore1PageCount << 12; if (kIOHibernateHeaderSignature != header->signature) @@ -126,18 +126,18 @@ #if 0 { uint32_t machineSignature; - size = GetProp(gChosenPH, kIOHibernateMachineSignatureKey, + size = GetProp(gChosenPH, kIOHibernateMachineSignatureKey, (char *)&machineSignature, sizeof(machineSignature)); if (size != sizeof(machineSignature)) machineSignature = 0; if (machineSignature != header->machineSignature) break; } #endif - + allocSize = imageSize + ((4095 + sizeof(hibernate_graphics_t)) & ~4095); - + mem_base = getmemorylimit() - allocSize;//TODO: lower this - + printf("mem_base %x\n", mem_base); // Rek : hibernate fix if (!((long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000)) @@ -146,10 +146,10 @@ getc (); return; } - + bcopy(header, (void *) mem_base, sizeof(IOHibernateImageHeader)); header = (IOHibernateImageHeader *) mem_base; - + imageSize -= sizeof(IOHibernateImageHeader); buffer = (long)(header + 1); @@ -157,19 +157,19 @@ { uint64_t preview_offset = header->fileExtentMapSize - sizeof(header->fileExtentMap) + codeSize; uint8_t progressSaveUnder[kIOHibernateProgressCount][kIOHibernateProgressSaveUnderSize]; - + ReadFileAtOffset (image_filename, (char *)buffer, sizeof(IOHibernateImageHeader), preview_offset+header->previewSize); drawPreview ((void *)(long)(buffer+preview_offset + header->previewPageListSize), &(progressSaveUnder[0][0])); previewTotalSectors = (imageSize-(preview_offset+header->previewSize))/512; previewLoadedSectors = 0; previewSaveunder = &(progressSaveUnder[0][0]); if (preview_offset+header->previewSizepreviewSize), + ReadFileAtOffset (image_filename, (char *)(long)(buffer+preview_offset+header->previewSize), sizeof(IOHibernateImageHeader)+preview_offset+header->previewSize, imageSize-(preview_offset+header->previewSize)); previewTotalSectors = 0; previewLoadedSectors = 0; - previewSaveunder = 0; + previewSaveunder = 0; #if 0 AsereBLN: check_vga_nvidia() didn't work as expected (recursion level > 0 & return value). @@ -197,9 +197,9 @@ &cryptvars->ctx.decrypt); // set the vector for the following decryptions - bcopy(((uint8_t *) header) + header->image1Size - AES_BLOCK_SIZE, + bcopy(((uint8_t *) header) + header->image1Size - AES_BLOCK_SIZE, &cryptvars->aes_iv[0], AES_BLOCK_SIZE); - + // decrypt the buffer uint32_t len = (uint32_t)(header->image1Size - header->encryptStart); aes_decrypt_cbc(((uint8_t *) header) + header->encryptStart, Index: branches/azimutz/Cleancut/i386/boot2/boot.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/boot.c (revision 898) +++ branches/azimutz/Cleancut/i386/boot2/boot.c (revision 899) @@ -134,83 +134,82 @@ static int ExecKernel(void *binary) { - entry_t kernelEntry; - int ret; - - bootArgs->kaddr = bootArgs->ksize = 0; + entry_t kernelEntry; + int ret; + + bootArgs->kaddr = bootArgs->ksize = 0; execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); - - ret = DecodeKernel(binary, - &kernelEntry, - (char **) &bootArgs->kaddr, - (int *)&bootArgs->ksize ); - - if ( ret != 0 ) - return ret; - - // Reserve space for boot args - reserveKernBootStruct(); - + + ret = DecodeKernel(binary, + &kernelEntry, + (char **) &bootArgs->kaddr, + (int *)&bootArgs->ksize ); + + if ( ret != 0 ) + return ret; + + // Reserve space for boot args + reserveKernBootStruct(); + // Notify modules that the kernel has been decoded execute_hook("DecodedKernel", (void*)binary, NULL, NULL, NULL); - // Load boot drivers from the specifed root path. - if (!gHaveKernelCache) + // Load boot drivers from the specifed root path. + if (!gHaveKernelCache) LoadDrivers("/"); - - - clearActivityIndicator(); - - if (gErrors) { - printf("Errors encountered while starting up the computer.\n"); - printf("Pausing %d seconds...\n", kBootErrorTimeout); - sleep(kBootErrorTimeout); - } - - setupFakeEfi(); - - md0Ramdisk(); - - verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); - - // Cleanup the PXE base code. - - if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) { + + + clearActivityIndicator(); + + if (gErrors) { + printf("Errors encountered while starting up the computer.\n"); + printf("Pausing %d seconds...\n", kBootErrorTimeout); + sleep(kBootErrorTimeout); + } + + setupFakeEfi(); + + md0Ramdisk(); + + verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); + + // Cleanup the PXE base code. + + if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) { if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) - { - printf("nbpUnloadBaseCode error %d\n", (int) ret); - sleep(2); - } - } - - bool dummyVal; + { + printf("nbpUnloadBaseCode error %d\n", (int) ret); + sleep(2); + } + } + + bool dummyVal; if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) { printf("Press any key to continue..."); getc(); } - + usb_loop(); - execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // Notify modules that the kernel is about to be started - // If we were in text mode, switch to graphics mode. - // This will draw the boot graphics unless we are in - // verbose mode. - - if(gVerboseMode) - setVideoMode( GRAPHICS_MODE, 0 ); - else - drawBootGraphics(); + // If we were in text mode, switch to graphics mode. + // This will draw the boot graphics unless we are in + // verbose mode. + if(gVerboseMode) + setVideoMode( GRAPHICS_MODE, 0 ); + else + drawBootGraphics(); + setupBooterLog(); - finalizeBootStruct(); + finalizeBootStruct(); if (checkOSVersion("10.7")) { // Masking out so that Lion doesn't doublefault - outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ - outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ + outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ + outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ // Jump to kernel's entry point. There's no going back now. @@ -221,12 +220,9 @@ startprog( kernelEntry, bootArgsPreLion ); } - - - - // Not reached - - return 0; + + // Not reached + return 0; } //========================================================================== @@ -495,12 +491,16 @@ else if (checkOSVersion("10.6")) { sprintf(gBootKernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); int lnam = sizeof(gBootKernelCacheFile) + 9; //with adler32 - //Slice - TODO - /* - - but the name is longer .adler32 and more... - kernelcache_i386.E102928C.qSs0 - so will opendir and scan for some files - */ + //Slice - TODO ??? + // e.g. kernelcache_i386.E102928C.qSs0 = "unsaved" cache file. + // + // See kext_tools-180.2.1/kextcache_main.c: + // "Source directory has changed since starting; " + // "not saving cache file %s." + // or + // "Source kernel has changed since starting; " + // "not saving cache file %s." + char* name; long prev_time = 0; @@ -602,7 +602,7 @@ ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); if (ret == -1) { - // Not found any alternate locations, using the original kernel image path. + // No alternate location found, using the original kernel image path. strcpy(bootFileSpec, bootFile); } } @@ -622,7 +622,7 @@ else ret = 1; } else { - //Snow leopard or older + //Snow Leopard or older verbose("Loading kernel %s\n", bootFileSpec); ret = LoadThinFatFile(bootFileSpec, &binary); if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) { @@ -630,8 +630,6 @@ ret = LoadThinFatFile(bootFileSpec, &binary); } } - - } while (0); clearActivityIndicator(); @@ -658,13 +656,13 @@ // chainboot if (status==1) { - if (getVideoMode() == GRAPHICS_MODE) { // if we are already in graphics-mode, - setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode - } + if (getVideoMode() == GRAPHICS_MODE) { // if we are already in graphics-mode, + setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode + } } if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) { - nbpUnloadBaseCode(); + nbpUnloadBaseCode(); } } Index: branches/azimutz/Cleancut/i386/boot2/boot.h =================================================================== --- branches/azimutz/Cleancut/i386/boot2/boot.h (revision 898) +++ branches/azimutz/Cleancut/i386/boot2/boot.h (revision 899) @@ -170,14 +170,14 @@ extern void spinActivityIndicator(); extern void clearActivityIndicator(); extern void drawColorRectangle( unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, - unsigned char colorIndex ); + unsigned short y, + unsigned short width, + unsigned short height, + unsigned char colorIndex ); extern void drawDataRectangle( unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, + unsigned short y, + unsigned short width, + unsigned short height, unsigned char * data ); extern int convertImage( unsigned short width, Index: branches/azimutz/Cleancut/i386/boot2/gui.c =================================================================== --- branches/azimutz/Cleancut/i386/boot2/gui.c (revision 898) +++ branches/azimutz/Cleancut/i386/boot2/gui.c (revision 899) @@ -168,7 +168,8 @@ static bool infoMenuNativeBoot = false; -static unsigned long screen_params[4] = {DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0}; // here we store the used screen resolution +// here we store the used screen resolution +static unsigned long screen_params[4] = {DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0}; static int getImageIndexByName(const char *name) { @@ -189,14 +190,14 @@ int compareIndex = (upperLimit - lowerLimit) >> 1; // Midpoint int result; - // NOTE: This algorithm assumes that the embeddedImages is sorted. - // This is currently done using the make file. If the array is every - // manualy generated, this *will* fail to work properly. + // NOTE: This algorithm assumes that the embedded images are sorted. + // This is currently done using the make file. If the array is + // generated manualy, this *will* fail to work properly. while((result = strcmp(name, embeddedImages[compareIndex].name)) != 0) { - if(result > 0) // We need to search a HIGHER index + if (result > 0) // We need to search a HIGHER index { - if(compareIndex != lowerLimit) + if (compareIndex != lowerLimit) { lowerLimit = compareIndex; } @@ -208,7 +209,7 @@ } else // We Need to search a LOWER index { - if(compareIndex != upperLimit) + if (compareIndex != upperLimit) { upperLimit = compareIndex; } @@ -1033,7 +1034,7 @@ }; static int -sputc(int c, struct putc_info * pi) +sputc(int c, struct putc_info * pi) //Azi: exists on console.c & printf.c { if (pi->last_str) if (pi->str == pi->last_str) { Index: branches/azimutz/Cleancut/i386/doc/README =================================================================== --- branches/azimutz/Cleancut/i386/doc/README (revision 898) +++ branches/azimutz/Cleancut/i386/doc/README (revision 899) @@ -20,7 +20,7 @@ For DOS compatibility reason, one extra stage of boot is required if the boot device is a hard disk. The first sector of the hard disk will - contain the MOS-DOS boot code and a boot record partition table. + contain the MS-DOS boot code and a boot record partition table. When this sector is loaded into 0000:7C00H, it will relocate itself to somewhere else and then load the first sector of the active partition into 0000:7C00H. Both UNIX and DOS use the command "fdisk" @@ -51,7 +51,7 @@ stage bootstrap loader "boot2()". In order to be able to load the big kernel image (bigger than 512K or 640K, depends on the memory configuration), the second stage boot loader will run on the protected - mode. This bootstarp loader does not have any stand alone device + mode. This bootstrap loader does not have any stand alone device drivers, all the I/O's are through the BIOS calls. Since the first stage boot code will no longer be used at this moment, the memory location of the first stage boot code (0000:1000H to 0000:1200H) will @@ -62,7 +62,7 @@ and boot data segments must not be greater than 64K. The boot loader loads the kernel image at memory location above 1 MB - to skip the memory hole between 521K/640K and 1MB. After the kernel + to skip the memory hole between 512K/640K and 1MB. After the kernel is loaded, the boot loader stores the information in the stack and then passes control to kernel. Currently, the three information passed from the boot loader to the kernel are type of the boot device, size Index: branches/azimutz/Cleancut/i386/modules/NVIDIAGraphicsEnabler/nvidia.c =================================================================== --- branches/azimutz/Cleancut/i386/modules/NVIDIAGraphicsEnabler/nvidia.c (revision 898) +++ branches/azimutz/Cleancut/i386/modules/NVIDIAGraphicsEnabler/nvidia.c (revision 899) @@ -711,12 +711,12 @@ char *p; int i; char buf[3]; - + if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) { printf("[ERROR] bin2hex input error\n"); return -1; } - + buf[2] = '\0'; p = (char *) hex; for (i=0; idev.addr, 0x10 ); regs = (uint8_t *) (bar[0] & ~0x0f); - + // get card type nvCardType = (REG32(0) >> 20) & 0x1ff; @@ -927,7 +927,6 @@ default_NVCAP[12], default_NVCAP[13], default_NVCAP[14], default_NVCAP[15], default_NVCAP[16], default_NVCAP[17], default_NVCAP[18], default_NVCAP[19]); #endif - devprop_add_nvidia_template(device); devprop_add_value(device, "NVCAP", default_NVCAP, NVCAP_LEN); Index: branches/azimutz/Cleancut/i386/libsa/printf.c =================================================================== --- branches/azimutz/Cleancut/i386/libsa/printf.c (revision 898) +++ branches/azimutz/Cleancut/i386/libsa/printf.c (revision 899) @@ -34,7 +34,7 @@ }; static int -sputc(int c, struct putc_info * pi) +sputc(int c, struct putc_info * pi) //Azi: exists on console.c & gui.c { if (pi->last_str) if (pi->str == pi->last_str) { Index: branches/azimutz/Cleancut/TODO =================================================================== --- branches/azimutz/Cleancut/TODO (revision 898) +++ branches/azimutz/Cleancut/TODO (revision 899) @@ -1,32 +1,43 @@ TODO List for Chameleon Boot Loader ==================================== -- Create a dummy module for any modules that are compiled in. This is needed for linking modules with dependencies that are not compiled in. +- Bring code closer to coding_standards.txt: + - will change spaces to tabs! If someone opposes to this, please come forward :) + +- Create a dummy module for any modules that are compiled in. This is needed for linking modules with + dependencies that are not compiled in. + - Fix the module system when booting chameleon with multiboot. Cleanup the xcode 4 fix. - Integrate Prasys current work on options and quick shortcut modified version of 18seven -- Add autodetection of efistring algorythm to enabke graphics enabler to beanbled by default while not conflicting whith other efi string overriden content +- Add auto detection of efi string algorithm, so graphics enabler can be enabled by default while not + conflicting with other efi string overridden content (original idea of Galaxy) +Azi: done? - Add a more sophisticated acpi loading mechanism to enable loading custom acpi tables when dsdtdrop=y Here's a specification to think about: - First we must care about if a forced DSDT full path has been specified (was the pb smith had in - his first tries) and take it for the DSDT path as is. - Then we have the case where no DSDT path was set where we run our usual DSDT search algorithm to find this file. - In the latter case, the file has to be named DSDT.aml and be in one of the / /Extra or bt(0,0)/Extra directory. + First we must care about if a forced DSDT full path has been specified + (was what pb smith had in his first tries) and take it for the DSDT path as is. + Then we have the case where no DSDT path was set where we run our usual DSDT search algorithm to + find this file. + In the latter case, the file has to be named DSDT.aml and be in one of the / /Extra or bt(0,0)/Extra + directory. Now a first idea to implement correctly the acpi tables loading would be: - Whatever the path was hardcoded in the DSDT option or was automatically found, we extract the path part of - the DSDT file that has been successfully found and we run a loop to enumerate all other acpi files in the same directory. - Now for each acpi file found, we should compare the name with an existing acpi table found in the system that - we would normally load and replace this usual injection by the content of the file. + Whether the path was hardcoded in the DSDT option or was automatically found, we extract the path part + of the DSDT file that has been successfully found and we run a loop to enumerate all other acpi + files in the same directory. + Now for each acpi file found, we should compare the name with an existing acpi table found in + the system that we would normally load and replace this usual injection by the content of the file. - Once DropDSDT=y is set, no other acpi table than dsdt is loaded, then it is the responsability of user - to provide any other acpi table. + Once DropDSDT=y is set, no other acpi table than dsdt is loaded, then it is the responsibility of the + user to provide any other acpi table. +Azi: done? - Add a new module capable of writing proprietary Chameleon data to ioreg: - Using the DT__xxx() API, we will creat e a set of functions to write + Using the DT__xxx() API, we will create a set of functions to write to log info, chameleon boot info to be retrieved by helper applications... the only public function for log info purpose of this module would be: logMessageToIOREG(...); // var args printf style format @@ -68,5 +79,5 @@ getc(); } - - Case unsensitive parsing for the bootConfig options: + - Case insensitive parsing for the bootConfig options: should help the common/novice user to setup more easily. Index: branches/azimutz/Cleancut/CHANGES =================================================================== --- branches/azimutz/Cleancut/CHANGES (revision 898) +++ branches/azimutz/Cleancut/CHANGES (revision 899) @@ -1,6 +1,7 @@ - Modules can now be selected between not compiled, compiled into chameleon, or compiled as modules. - New makefile + configuration system. -- Added the BOOT2_MAX_LENGTH constant in memory.h. This is now used in mboot.c to relocate the correct number of bytes for boot2. +- Added the BOOT2_MAX_LENGTH constant in memory.h. This is now used in mboot.c to relocate the correct + number of bytes for boot2. - Added new ATi/AMD Graphics Card Enabler. - Added new SMBIOS patcher. - Added module system. @@ -27,12 +28,12 @@ - Optimized cursor spinout in textmode if no verbose mode is set - Added ram table structures definitions - Added getSmbios() a param permitting to select between orig and new smbios entries -- Changed "Default Partition" behavior to accept only native system volumes or foreign partitions. +- Changed "Default Partition" behaviour to accept only native system volumes or foreign partitions. - Added NVIDIA new NVCAP customization support and support for ION gfx cards from aserebln - Added ATI new framebuffers support and new cards from PCEFI10.6 - improved ACPI file search algo by implementing a cache. - Nvidia injection fix -- pciroot would not always return correct uid in autodection mode +- pciroot would not always return correct UID in autodection mode - Fixed the hibernation problem in boot2/resume.c - Fixed all new booter versions with SystemType would override the facp value even if correct, now keeps the facp value if correct and no override has been done, implemented a best effort algo. @@ -41,18 +42,19 @@ conversions api, to be completed by function that we should reuse. - Fixed SystemType would be always forced to a value, now optionally changed - only if overriden + only if overridden - Kept SystemID as the only option to change manually the system-id For theses reasons, SystemId from bootConfig and SMUUID from smbiosConfig are now DEPRECATED. -- Integrated JrCs fadt patch (kept for RC5 the existing DSDT.aml retry algo that disappeared in his patch, should be more discussed for RC6) +- Integrated JrCs fadt patch (kept for RC5 the existing DSDT.aml retry algo that disappeared in his patch, + should be more discussed for RC6) - Added JrCs modified convention name change to coding_standards - Now malloc (ex. MALLOC in Asere patch) is renamed malloc(size) and is an alias to safe_malloc(size, file, line) with _FILE_ and _LINE_ preprocessor definitions - Added a new 'Rename Partition Feature', now permitting to rename partition like 'System reserved' to a more meaningful name - Added SystemID option permitting to change the System UUID to a fixed value. -- Added the PciRoot autodetection feature imported from pcefi10.5 +- Added the PciRoot auto detection feature imported from pcefi10.5 - Added automatic "system-id" injection from dmi bios, also compatible with SystemID boot option and former SMUUID from smbios,plist - Added "system-type' automatic injection (1=Desktop) plus override possibility Property changes on: branches/azimutz/Cleancut ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r897-898