Index: branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c (revision 2364) +++ branches/ErmaC/Enoch/i386/libsaio/acpi_patcher.c (revision 2365) @@ -147,7 +147,7 @@ return tableAddr; } close (fd); - verbose("Couldn't allocate memory for table \n", dirspec); + printf("Couldn't allocate memory for table \n", dirspec); } //printf("Couldn't find table %s\n", filename); return NULL; @@ -776,7 +776,7 @@ DBG("New @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT); - DBG("FADT: Using custom DSDT!\n"); + verbose("FADT: Using custom DSDT!\n"); } // Correct the checksum @@ -798,8 +798,9 @@ if(acpi20_p) { addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20"); } else { - DBG("no ACPI 2\n"); - } return 1; + verbose("No ACPI 2.\n"); + } + return 1; } /* Setup ACPI. Replace DSDT if DSDT.aml is found */ @@ -1161,7 +1162,7 @@ rsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j]; } - DBG("RSDT: Added %d SSDT table(s)\n", ssdt_count); + verbose("RSDT: Added %d SSDT table(s)\n", ssdt_count); } @@ -1174,7 +1175,7 @@ DBG("New checksum %d at %x\n", rsdt_mod->Checksum,rsdt_mod); } else { rsdp_mod->RsdtAddress=0; - verbose("RSDT not found or RSDT incorrect\n"); + printf("RSDT not found or RSDT incorrect\n"); } if (version) { @@ -1350,7 +1351,7 @@ fadt->Length); if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000) { - DBG("FADT incorrect or after 4GB. Dropping XSDT\n"); + verbose("FADT incorrect or after 4GB. Dropping XSDT\n"); goto drop_xsdt; } @@ -1401,7 +1402,7 @@ xsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j]; } - DBG("Added %d SSDT table(s) into XSDT\n", ssdt_count); + verbose("Added %d SSDT table(s) into XSDT\n", ssdt_count); } // Correct the checksum of XSDT @@ -1417,7 +1418,7 @@ */ rsdp_mod->XsdtAddress=0xffffffffffffffffLL; - DBG("XSDT not found or XSDT incorrect\n"); + verbose("XSDT not found or XSDT incorrect\n"); } } Index: branches/ErmaC/Enoch/i386/libsaio/aml_generator.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/aml_generator.c (revision 2364) +++ branches/ErmaC/Enoch/i386/libsaio/aml_generator.c (revision 2365) @@ -16,15 +16,15 @@ { switch (parent->Type) { - case AML_CHUNK_NONE: - case AML_CHUNK_BYTE: - case AML_CHUNK_WORD: - case AML_CHUNK_DWORD: - case AML_CHUNK_QWORD: - case AML_CHUNK_ALIAS: + case AML_ONES_OP: + case AML_BYTE_PREFIX: + case AML_WORD_PREFIX: + case AML_DWORD_PREFIX: + case AML_QWORD_PREFIX: + case AML_ALIAS_OP: verbose("aml_add_to_parent: Node doesn't support child nodes!\n"); return false; - case AML_CHUNK_NAME: + case AML_NAME_OP: if (parent->First) { verbose("aml_add_to_parent: Name node supports only one child node!\n"); return false; @@ -88,7 +88,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_NONE; + node->Type = AML_ONES_OP; node->Length = (uint16_t)size; node->Buffer = malloc(node->Length); memcpy(node->Buffer, buffer, node->Length); @@ -102,7 +102,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_BYTE; + node->Type = AML_BYTE_PREFIX; node->Length = 1; node->Buffer = malloc(node->Length); node->Buffer[0] = value; @@ -115,7 +115,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_WORD; + node->Type = AML_WORD_PREFIX; node->Length = 2; node->Buffer = malloc(node->Length); node->Buffer[0] = value & 0xff; @@ -129,7 +129,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_DWORD; + node->Type = AML_DWORD_PREFIX; node->Length = 4; node->Buffer = malloc(node->Length); node->Buffer[0] = value & 0xff; @@ -145,7 +145,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_QWORD; + node->Type = AML_QWORD_PREFIX; node->Length = 8; node->Buffer = malloc(node->Length); node->Buffer[0] = value & 0xff; @@ -225,7 +225,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_SCOPE; + node->Type = AML_SCOPE_OP; aml_fill_name(node, name); } @@ -237,7 +237,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_NAME; + node->Type = AML_NAME_OP; aml_fill_name(node, name); } @@ -250,7 +250,7 @@ if (node) { unsigned int offset = aml_fill_name(node, name); - node->Type = AML_CHUNK_METHOD; + node->Type = AML_METHOD_OP; node->Length++; node->Buffer[offset] = args; @@ -264,7 +264,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_PACKAGE; + node->Type = AML_PACKAGE_OP; node->Length = 1; node->Buffer = malloc(node->Length); @@ -277,7 +277,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_ALIAS; + node->Type = AML_ALIAS_OP; node->Length = 8; node->Buffer = malloc(node->Length); @@ -293,7 +293,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_RETURN; + node->Type = AML_RETURN_OP; aml_fill_name(node, name); } @@ -305,7 +305,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_RETURN; + node->Type = AML_RETURN_OP; aml_add_byte(node, value); } @@ -317,7 +317,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_DEVICE; + node->Type = AML_EXT_DEVICE_OP; aml_fill_name(node, name); } @@ -329,7 +329,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_LOCAL0; + node->Type = AML_LOCAL0; node->Length = 1; } @@ -354,10 +354,10 @@ if (node) { int offset = 0; - node->Type = AML_CHUNK_BUFFER; + node->Type = AML_BUFFER_OP; node->Length = (uint8_t)(size + 2); node->Buffer = malloc (node->Length); - node->Buffer[offset++] = AML_CHUNK_BYTE; //0x0A + node->Buffer[offset++] = AML_BYTE_PREFIX; //0x0A node->Buffer[offset++] = (char)size; memcpy(node->Buffer+offset,data, node->Length); } @@ -372,10 +372,10 @@ if (node) { unsigned int offset = 0; unsigned int len = strlen(StringBuf); - node->Type = AML_CHUNK_BUFFER; + node->Type = AML_BUFFER_OP; node->Length = (uint8_t)(len + 3); node->Buffer = malloc (node->Length); - node->Buffer[offset++] = AML_CHUNK_BYTE; + node->Buffer[offset++] = AML_BYTE_PREFIX; node->Buffer[offset++] = (char)len; memcpy(node->Buffer+offset, StringBuf, len); node->Buffer[offset+len] = '\0'; @@ -390,7 +390,7 @@ if (node) { int len = strlen(StringBuf); - node->Type = AML_CHUNK_STRING; + node->Type = AML_STRING_PREFIX; node->Length = (uint8_t)(len + 1); node->Buffer = malloc (len); memcpy(node->Buffer, StringBuf, len); @@ -405,7 +405,7 @@ AML_CHUNK* node = aml_create_node(parent); if (node) { - node->Type = AML_CHUNK_RETURN; + node->Type = AML_RETURN_OP; //aml_add_byte(node, value); } @@ -441,31 +441,31 @@ } switch (node->Type) { - case AML_CHUNK_NONE: + case AML_ONES_OP: case AML_STORE_OP: - case AML_CHUNK_LOCAL0: + case AML_LOCAL0: node->Size += node->Length; break; - case AML_CHUNK_METHOD: - case AML_CHUNK_SCOPE: - case AML_CHUNK_BUFFER: + case AML_METHOD_OP: + case AML_SCOPE_OP: + case AML_BUFFER_OP: node->Size += 1 + node->Length; node->Size += aml_get_size_length(node->Size); break; - case AML_CHUNK_DEVICE: + case AML_EXT_DEVICE_OP: node->Size += 2 + node->Length; node->Size += aml_get_size_length(node->Size); break; - case AML_CHUNK_PACKAGE: + case AML_PACKAGE_OP: node->Buffer[0] = child_count; node->Size += 1 + node->Length; node->Size += aml_get_size_length(node->Size); break; - case AML_CHUNK_BYTE: + case AML_BYTE_PREFIX: if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) { node->Size += node->Length; } else { @@ -473,13 +473,13 @@ } break; - case AML_CHUNK_WORD: - case AML_CHUNK_DWORD: - case AML_CHUNK_QWORD: - case AML_CHUNK_ALIAS: - case AML_CHUNK_NAME: - case AML_CHUNK_RETURN: - case AML_CHUNK_STRING: + case AML_WORD_PREFIX: + case AML_DWORD_PREFIX: + case AML_QWORD_PREFIX: + case AML_ALIAS_OP: + case AML_NAME_OP: + case AML_RETURN_OP: + case AML_STRING_PREFIX: node->Size += 1 + node->Length; break; } @@ -564,32 +564,32 @@ AML_CHUNK* child = node->First; switch (node->Type) { - case AML_CHUNK_NONE: + case AML_ONES_OP: offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; - case AML_CHUNK_LOCAL0: + case AML_LOCAL0: case AML_STORE_OP: offset = aml_write_byte(node->Type, buffer, offset); break; - case AML_CHUNK_DEVICE: - offset = aml_write_byte(AML_CHUNK_OP, buffer, offset); + case AML_EXT_DEVICE_OP: + offset = aml_write_byte(AML_EXT_OP, buffer, offset); offset = aml_write_byte(node->Type, buffer, offset); offset = aml_write_size(node->Size-2, buffer, offset); offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; - case AML_CHUNK_SCOPE: - case AML_CHUNK_METHOD: - case AML_CHUNK_PACKAGE: - case AML_CHUNK_BUFFER: + case AML_SCOPE_OP: + case AML_METHOD_OP: + case AML_PACKAGE_OP: + case AML_BUFFER_OP: offset = aml_write_byte(node->Type, buffer, offset); offset = aml_write_size(node->Size-1, buffer, offset); offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; - case AML_CHUNK_BYTE: + case AML_BYTE_PREFIX: if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1) { offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); } else { @@ -598,13 +598,13 @@ } break; - case AML_CHUNK_WORD: - case AML_CHUNK_DWORD: - case AML_CHUNK_QWORD: - case AML_CHUNK_ALIAS: - case AML_CHUNK_NAME: - case AML_CHUNK_RETURN: - case AML_CHUNK_STRING: + case AML_WORD_PREFIX: + case AML_DWORD_PREFIX: + case AML_QWORD_PREFIX: + case AML_ALIAS_OP: + case AML_NAME_OP: + case AML_RETURN_OP: + case AML_STRING_PREFIX: offset = aml_write_byte(node->Type, buffer, offset); offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset); break; Index: branches/ErmaC/Enoch/i386/libsaio/aml_generator.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/aml_generator.h (revision 2364) +++ branches/ErmaC/Enoch/i386/libsaio/aml_generator.h (revision 2365) @@ -15,48 +15,157 @@ // // Primary OpCode // -#define AML_CHUNK_ZERO 0x00 // AML_ZERO_OP -#define AML_CHUNK_ONE 0x01 // AML_ONE_OP -#define AML_CHUNK_ALIAS 0x06 // AML_ALIAS_OP -#define AML_CHUNK_NAME 0x08 // AML_NAME_OP -#define AML_CHUNK_BYTE 0x0A // AML_BYTE_PREFIX -#define AML_CHUNK_WORD 0x0B // AML_WORD_PREFIX -#define AML_CHUNK_DWORD 0x0C // AML_DWORD_PREFIX -#define AML_CHUNK_STRING 0x0D // AML_STRING_PREFIX -#define AML_CHUNK_QWORD 0x0E // AML_QWORD_PREFIX -#define AML_CHUNK_SCOPE 0x10 // AML_SCOPE_OP -#define AML_CHUNK_BUFFER 0x11 // AML_BUFFER_OP -#define AML_CHUNK_PACKAGE 0x12 // AML_PACKAGE_OP -#define AML_CHUNK_VAR_PACKAGE 0x13 // AML_VAR_PACKAGE_OP -#define AML_CHUNK_METHOD 0x14 // AML_METHOD_OP -#define AML_CHUNK_STRING_BUFFER 0x15 // -#define AML_CHUNK_LOCAL0 0x60 // AML_LOCAL0 -#define AML_CHUNK_LOCAL1 0x61 // AML_LOCAL1 -#define AML_CHUNK_LOCAL2 0x62 // AML_LOCAL2 -#define AML_CHUNK_LOCAL3 0x63 // AML_LOCAL3 -#define AML_CHUNK_LOCAL4 0x64 // AML_LOCAL4 -#define AML_CHUNK_LOCAL5 0x65 // AML_LOCAL5 -#define AML_CHUNK_LOCAL6 0x66 // AML_LOCAL6 -#define AML_CHUNK_LOCAL7 0x67 // AML_LOCAL7 -#define AML_CHUNK_ARG0 0x68 // AML_ARG0 -#define AML_CHUNK_ARG1 0x69 // AML_ARG1 -#define AML_CHUNK_ARG2 0x6A // AML_ARG2 -#define AML_CHUNK_ARG3 0x6B // AML_ARG3 -#define AML_CHUNK_ARG4 0x6C // AML_ARG4 -#define AML_CHUNK_ARG5 0x6D // AML_ARG5 -#define AML_CHUNK_ARG6 0x6E // AML_ARG6 -#define AML_STORE_OP 0x70 // AML_STORE_OP -#define AML_CHUNK_REFOF 0x71 // AML_REF_OF_OP -#define AML_CHUNK_RETURN 0xA4 // AML_RETURN_OP -#define AML_CHUNK_BRECK 0xA5 // AML_BREAK_OP -#define AML_CHUNK_NONE 0xff // AML_ONES_OP +#define AML_ZERO_OP 0x00 +#define AML_ONE_OP 0x01 +#define AML_ALIAS_OP 0x06 +#define AML_NAME_OP 0x08 +#define AML_BYTE_PREFIX 0x0A +#define AML_WORD_PREFIX 0x0B +#define AML_DWORD_PREFIX 0x0C +#define AML_STRING_PREFIX 0x0D +#define AML_QWORD_PREFIX 0x0E +#define AML_SCOPE_OP 0x10 +#define AML_BUFFER_OP 0x11 +#define AML_PACKAGE_OP 0x12 +#define AML_VAR_PACKAGE_OP 0x13 +#define AML_METHOD_OP 0x14 +#define AML_STRING_BUFFER 0x15 +#define AML_DUAL_NAME_PREFIX 0x2e +#define AML_MULTI_NAME_PREFIX 0x2f +#define AML_NAME_CHAR_A 0x41 +#define AML_NAME_CHAR_B 0x42 +#define AML_NAME_CHAR_C 0x43 +#define AML_NAME_CHAR_D 0x44 +#define AML_NAME_CHAR_E 0x45 +#define AML_NAME_CHAR_F 0x46 +#define AML_NAME_CHAR_G 0x47 +#define AML_NAME_CHAR_H 0x48 +#define AML_NAME_CHAR_I 0x49 +#define AML_NAME_CHAR_J 0x4a +#define AML_NAME_CHAR_K 0x4b +#define AML_NAME_CHAR_L 0x4c +#define AML_NAME_CHAR_M 0x4d +#define AML_NAME_CHAR_N 0x4e +#define AML_NAME_CHAR_O 0x4f +#define AML_NAME_CHAR_P 0x50 +#define AML_NAME_CHAR_Q 0x51 +#define AML_NAME_CHAR_R 0x52 +#define AML_NAME_CHAR_S 0x53 +#define AML_NAME_CHAR_T 0x54 +#define AML_NAME_CHAR_U 0x55 +#define AML_NAME_CHAR_V 0x56 +#define AML_NAME_CHAR_W 0x57 +#define AML_NAME_CHAR_X 0x58 +#define AML_NAME_CHAR_Y 0x59 +#define AML_NAME_CHAR_Z 0x5a +#define AML_ROOT_CHAR 0x5c +#define AML_PARENT_PREFIX_CHAR 0x5e +#define AML_NAME_CHAR__ 0x5f +#define AML_LOCAL0 0x60 +#define AML_LOCAL1 0x61 +#define AML_LOCAL2 0x62 +#define AML_LOCAL3 0x63 +#define AML_LOCAL4 0x64 +#define AML_LOCAL5 0x65 +#define AML_LOCAL6 0x66 +#define AML_LOCAL7 0x67 +#define AML_ARG0 0x68 +#define AML_ARG1 0x69 +#define AML_ARG2 0x6A +#define AML_ARG3 0x6B +#define AML_ARG4 0x6C +#define AML_ARG5 0x6D +#define AML_ARG6 0x6E +#define AML_STORE_OP 0x70 +#define AML_REF_OF_OP 0x71 +#define AML_ADD_OP 0x72 +#define AML_CONCAT_OP 0x73 +#define AML_SUBTRACT_OP 0x74 +#define AML_INCREMENT_OP 0x75 +#define AML_DECREMENT_OP 0x76 +#define AML_MULTIPLY_OP 0x77 +#define AML_DIVIDE_OP 0x78 +#define AML_SHIFT_LEFT_OP 0x79 +#define AML_SHIFT_RIGHT_OP 0x7a +#define AML_AND_OP 0x7b +#define AML_NAND_OP 0x7c +#define AML_OR_OP 0x7d +#define AML_NOR_OP 0x7e +#define AML_XOR_OP 0x7f +#define AML_NOT_OP 0x80 +#define AML_FIND_SET_LEFT_BIT_OP 0x81 +#define AML_FIND_SET_RIGHT_BIT_OP 0x82 +#define AML_DEREF_OF_OP 0x83 +#define AML_CONCAT_RES_OP 0x84 +#define AML_MOD_OP 0x85 +#define AML_NOTIFY_OP 0x86 +#define AML_SIZE_OF_OP 0x87 +#define AML_INDEX_OP 0x88 +#define AML_MATCH_OP 0x89 +#define AML_CREATE_DWORD_FIELD_OP 0x8a +#define AML_CREATE_WORD_FIELD_OP 0x8b +#define AML_CREATE_BYTE_FIELD_OP 0x8c +#define AML_CREATE_BIT_FIELD_OP 0x8d +#define AML_OBJECT_TYPE_OP 0x8e +#define AML_CREATE_QWORD_FIELD_OP 0x8f +#define AML_LAND_OP 0x90 +#define AML_LOR_OP 0x91 +#define AML_LNOT_OP 0x92 +#define AML_LEQUAL_OP 0x93 +#define AML_LGREATER_OP 0x94 +#define AML_LLESS_OP 0x95 +#define AML_TO_BUFFER_OP 0x96 +#define AML_TO_DEC_STRING_OP 0x97 +#define AML_TO_HEX_STRING_OP 0x98 +#define AML_TO_INTEGER_OP 0x99 +#define AML_TO_STRING_OP 0x9c +#define AML_COPY_OBJECT_OP 0x9d +#define AML_MID_OP 0x9e +#define AML_CONTINUE_OP 0x9f +#define AML_IF_OP 0xa0 +#define AML_ELSE_OP 0xa1 +#define AML_WHILE_OP 0xa2 +#define AML_NOOP_OP 0xa3 +#define AML_RETURN_OP 0xA4 +#define AML_BREAK_OP 0xA5 +#define AML_BREAK_POINT_OP 0xcc +#define AML_ONES_OP 0xff + // // Extended OpCode // -#define AML_CHUNK_OP 0x5B // AML_EXT_OP -#define AML_CHUNK_DEVICE 0x82 // AML_EXT_DEVICE_OP -#define AML_CHUNK_PROCESSOR 0x83 // AML_EXT_PROCESSOR_OP +#define AML_EXT_OP 0x5B +#define AML_EXT_MUTEX_OP 0x01 +#define AML_EXT_EVENT_OP 0x02 +#define AML_EXT_COND_REF_OF_OP 0x12 +#define AML_EXT_CREATE_FIELD_OP 0x13 +#define AML_EXT_LOAD_TABLE_OP 0x1f +#define AML_EXT_LOAD_OP 0x20 +#define AML_EXT_STALL_OP 0x21 +#define AML_EXT_SLEEP_OP 0x22 +#define AML_EXT_ACQUIRE_OP 0x23 +#define AML_EXT_SIGNAL_OP 0x24 +#define AML_EXT_WAIT_OP 0x25 +#define AML_EXT_RESET_OP 0x26 +#define AML_EXT_RELEASE_OP 0x27 +#define AML_EXT_FROM_BCD_OP 0x28 +#define AML_EXT_TO_BCD_OP 0x29 +#define AML_EXT_UNLOAD_OP 0x2a +#define AML_EXT_REVISION_OP 0x30 +#define AML_EXT_DEBUG_OP 0x31 +#define AML_EXT_FATAL_OP 0x32 +#define AML_EXT_TIMER_OP 0x33 +#define AML_EXT_REGION_OP 0x80 +#define AML_EXT_FIELD_OP 0x81 +#define AML_EXT_DEVICE_OP 0x82 +#define AML_EXT_PROCESSOR_OP 0x83 +#define AML_EXT_POWER_RES_OP 0x84 +#define AML_EXT_THERMAL_ZONE_OP 0x85 +#define AML_EXT_INDEX_FIELD_OP 0x86 +#define AML_EXT_BANK_FIELD_OP 0x87 +#define AML_EXT_DATA_REGION_OP 0x88 + struct aml_chunk { uint8_t Type; uint16_t Length;