void AcpiUtDumpBufferToFile ( ACPI_FILE File, UINT8 *Buffer, UINT32 Count, UINT32 Display, UINT32 BaseOffset) { UINT32 i = 0; UINT32 j; UINT32 Temp32; UINT8 BufChar; if (!Buffer) { fprintf (File, "Null Buffer Pointer in DumpBuffer!\n"); return; } if ((Count < 4) || (Count & 0x01)) { Display = DB_BYTE_DISPLAY; } /* Nasty little dump buffer routine! */ while (i < Count) { /* Print current offset */ fprintf (File, "%8.4X: ", (BaseOffset + i)); /* Print 16 hex chars */ for (j = 0; j < 16;) { if (i + j >= Count) { /* Dump fill spaces */ fprintf (File, "%*s", ((Display * 2) + 1), " "); j += Display; continue; } switch (Display) { case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ fprintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]); break; case DB_WORD_DISPLAY: ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); fprintf (File, "%04X ", Temp32); break; case DB_DWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); fprintf (File, "%08X ", Temp32); break; case DB_QWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); fprintf (File, "%08X", Temp32); ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); fprintf (File, "%08X ", Temp32); break; } j += Display; } /* * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ fprintf (File, " "); for (j = 0; j < 16; j++) { if (i + j >= Count) { fprintf (File, "\n"); return; } BufChar = Buffer[(ACPI_SIZE) i + j]; if (isprint (BufChar)) { fprintf (File, "%c", BufChar); } else { fprintf (File, "."); } } /* Done with that line. */ fprintf (File, "\n"); i += 16; } return; }
void AcpiUtDumpBuffer2 ( UINT8 *Buffer, UINT32 Count, UINT32 Display) { ACPI_NATIVE_UINT i = 0; ACPI_NATIVE_UINT j; UINT32 Temp32; UINT8 BufChar; if ((Count < 4) || (Count & 0x01)) { Display = DB_BYTE_DISPLAY; } /* Nasty little dump buffer routine! */ while (i < Count) { /* Print current offset */ AcpiOsPrintf ("%6.4X: ", (UINT32) i); /* Print 16 hex chars */ for (j = 0; j < 16;) { if (i + j >= Count) { /* Dump fill spaces */ AcpiOsPrintf ("%*s", ((Display * 2) + 1), " "); j += (ACPI_NATIVE_UINT) Display; continue; } switch (Display) { case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ AcpiOsPrintf ("%02X ", Buffer[i + j]); break; case DB_WORD_DISPLAY: ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%04X ", Temp32); break; case DB_DWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%08X ", Temp32); break; case DB_QWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); AcpiOsPrintf ("%08X", Temp32); ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]); AcpiOsPrintf ("%08X ", Temp32); break; } j += (ACPI_NATIVE_UINT) Display; } /* * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ AcpiOsPrintf (" "); for (j = 0; j < 16; j++) { if (i + j >= Count) { AcpiOsPrintf ("\n"); return; } BufChar = Buffer[i + j]; if (ACPI_IS_PRINT (BufChar)) { AcpiOsPrintf ("%c", BufChar); } else { AcpiOsPrintf ("."); } } /* Done with that line. */ AcpiOsPrintf ("\n"); i += 16; } return; }
void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) { u32 i = 0; u32 j; u32 temp32; u8 buf_char; if (!buffer) { acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n"); return; } if ((count < 4) || (count & 0x01)) { display = DB_BYTE_DISPLAY; } /* Nasty little dump buffer routine! */ while (i < count) { /* Print current offset */ acpi_os_printf("%6.4X: ", i); /* Print 16 hex chars */ for (j = 0; j < 16;) { if (i + j >= count) { /* Dump fill spaces */ acpi_os_printf("%*s", ((display * 2) + 1), " "); j += display; continue; } switch (display) { case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ acpi_os_printf("%02X ", buffer[(acpi_size) i + j]); break; case DB_WORD_DISPLAY: ACPI_MOVE_16_TO_32(&temp32, &buffer[(acpi_size) i + j]); acpi_os_printf("%04X ", temp32); break; case DB_DWORD_DISPLAY: ACPI_MOVE_32_TO_32(&temp32, &buffer[(acpi_size) i + j]); acpi_os_printf("%08X ", temp32); break; case DB_QWORD_DISPLAY: ACPI_MOVE_32_TO_32(&temp32, &buffer[(acpi_size) i + j]); acpi_os_printf("%08X", temp32); ACPI_MOVE_32_TO_32(&temp32, &buffer[(acpi_size) i + j + 4]); acpi_os_printf("%08X ", temp32); break; } j += display; } /* * Print the ASCII equivalent characters but watch out for the bad * unprintable ones (printable chars are 0x20 through 0x7E) */ acpi_os_printf(" "); for (j = 0; j < 16; j++) { if (i + j >= count) { acpi_os_printf("\n"); return; } buf_char = buffer[(acpi_size) i + j]; if (ACPI_IS_PRINT(buf_char)) { acpi_os_printf("%c", buf_char); } else { acpi_os_printf("."); } } /* Done with that line. */ acpi_os_printf("\n"); i += 16; } return; }
acpi_status acpi_find_root_pointer(acpi_size *table_address) { u8 *table_ptr; u8 *mem_rover; u32 physical_address; ACPI_FUNCTION_TRACE(acpi_find_root_pointer); /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ table_ptr = acpi_os_map_memory((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH); if (!table_ptr) { ACPI_ERROR((AE_INFO, "Could not map memory at 0x%8.8X for length %u", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS(AE_NO_MEMORY); } ACPI_MOVE_16_TO_32(&physical_address, table_ptr); /* Convert segment part to physical address */ physical_address <<= 4; acpi_os_unmap_memory(table_ptr, ACPI_EBDA_PTR_LENGTH); /* EBDA present? */ if (physical_address > 0x400) { /* * 1b) Search EBDA paragraphs (EBDA is required to be a * minimum of 1K length) */ table_ptr = acpi_os_map_memory((acpi_physical_address) physical_address, ACPI_EBDA_WINDOW_SIZE); if (!table_ptr) { ACPI_ERROR((AE_INFO, "Could not map memory at 0x%8.8X for length %u", physical_address, ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS(AE_NO_MEMORY); } mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr, ACPI_EBDA_WINDOW_SIZE); acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ physical_address += (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); *table_address = physical_address; return_ACPI_STATUS(AE_OK); } } /* * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ table_ptr = acpi_os_map_memory((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE); if (!table_ptr) { ACPI_ERROR((AE_INFO, "Could not map memory at 0x%8.8X for length %u", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS(AE_NO_MEMORY); } mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ physical_address = (u32) (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, table_ptr)); *table_address = physical_address; return_ACPI_STATUS(AE_OK); } /* A valid RSDP was not found */ ACPI_BIOS_ERROR((AE_INFO, "A valid RSDP was not found")); return_ACPI_STATUS(AE_NOT_FOUND); }
ACPI_STATUS AcpiFindRootPointer ( ACPI_SIZE *TableAddress) { UINT8 *TablePtr; UINT8 *MemRover; UINT32 PhysicalAddress; ACPI_FUNCTION_TRACE (AcpiFindRootPointer); /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ TablePtr = AcpiOsMapMemory ( (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH); if (!TablePtr) { ACPI_ERROR ((AE_INFO, "Could not map memory at 0x%8.8X for length %u", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS (AE_NO_MEMORY); } ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr); /* Convert segment part to physical address */ PhysicalAddress <<= 4; AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH); /* EBDA present? */ if (PhysicalAddress > 0x400) { /* * 1b) Search EBDA paragraphs (EBDA is required to be a * minimum of 1K length) */ TablePtr = AcpiOsMapMemory ( (ACPI_PHYSICAL_ADDRESS) PhysicalAddress, ACPI_EBDA_WINDOW_SIZE); if (!TablePtr) { ACPI_ERROR ((AE_INFO, "Could not map memory at 0x%8.8X for length %u", PhysicalAddress, ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS (AE_NO_MEMORY); } MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE); AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE); if (MemRover) { /* Return the physical address */ PhysicalAddress += (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr); *TableAddress = PhysicalAddress; return_ACPI_STATUS (AE_OK); } } /* * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ TablePtr = AcpiOsMapMemory ( (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE); if (!TablePtr) { ACPI_ERROR ((AE_INFO, "Could not map memory at 0x%8.8X for length %u", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS (AE_NO_MEMORY); } MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE); if (MemRover) { /* Return the physical address */ PhysicalAddress = (UINT32) (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr)); *TableAddress = PhysicalAddress; return_ACPI_STATUS (AE_OK); } /* A valid RSDP was not found */ ACPI_BIOS_ERROR ((AE_INFO, "A valid RSDP was not found")); return_ACPI_STATUS (AE_NOT_FOUND); }
void acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, u32 arg_type, union acpi_parse_object *arg) { ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); switch (arg_type) { case ARGP_BYTEDATA: acpi_ps_init_op(arg, AML_BYTE_OP); arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml); parser_state->aml++; break; case ARGP_WORDDATA: acpi_ps_init_op(arg, AML_WORD_OP); /* Get 2 bytes from the AML stream */ ACPI_MOVE_16_TO_32(&arg->common.value.integer, parser_state->aml); parser_state->aml += 2; break; case ARGP_DWORDDATA: acpi_ps_init_op(arg, AML_DWORD_OP); /* Get 4 bytes from the AML stream */ ACPI_MOVE_32_TO_32(&arg->common.value.integer, parser_state->aml); parser_state->aml += 4; break; case ARGP_QWORDDATA: acpi_ps_init_op(arg, AML_QWORD_OP); /* Get 8 bytes from the AML stream */ ACPI_MOVE_64_TO_64(&arg->common.value.integer, parser_state->aml); parser_state->aml += 8; break; case ARGP_CHARLIST: acpi_ps_init_op(arg, AML_STRING_OP); arg->common.value.string = (char *)parser_state->aml; while (ACPI_GET8(parser_state->aml) != '\0') { parser_state->aml++; } parser_state->aml++; break; case ARGP_NAME: case ARGP_NAMESTRING: acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); arg->common.value.name = acpi_ps_get_next_namestring(parser_state); break; default: ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); break; } return_VOID; }
void acpi_ut_dump_buffer ( u8 *buffer, u32 count, u32 display, u32 component_id) { acpi_native_uint i = 0; acpi_native_uint j; u32 temp32; u8 buf_char; /* Only dump the buffer if tracing is enabled */ if (!((ACPI_LV_TABLES & acpi_dbg_level) && (component_id & acpi_dbg_layer))) { return; } if ((count < 4) || (count & 0x01)) { display = DB_BYTE_DISPLAY; } /* Nasty little dump buffer routine! */ while (i < count) { /* Print current offset */ acpi_os_printf ("%6.4X: ", (u32) i); /* Print 16 hex chars */ for (j = 0; j < 16;) { if (i + j >= count) { /* Dump fill spaces */ acpi_os_printf ("%*s", ((display * 2) + 1), " "); j += display; continue; } switch (display) { default: /* Default is BYTE display */ acpi_os_printf ("%02X ", buffer[i + j]); break; case DB_WORD_DISPLAY: ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); acpi_os_printf ("%04X ", temp32); break; case DB_DWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); acpi_os_printf ("%08X ", temp32); break; case DB_QWORD_DISPLAY: ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); acpi_os_printf ("%08X", temp32); ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); acpi_os_printf ("%08X ", temp32); break; } j += display; } /* * Print the ASCII equivalent characters * But watch out for the bad unprintable ones... */ acpi_os_printf (" "); for (j = 0; j < 16; j++) { if (i + j >= count) { acpi_os_printf ("\n"); return; } buf_char = buffer[i + j]; if ((buf_char > 0x1F && buf_char < 0x2E) || (buf_char > 0x2F && buf_char < 0x61) || (buf_char > 0x60 && buf_char < 0x7F)) { acpi_os_printf ("%c", buf_char); } else { acpi_os_printf ("."); } } /* Done with that line. */ acpi_os_printf ("\n"); i += 16; } return; }
static acpi_status acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) { u8 *table_ptr; u8 *mem_rover; u32 physical_address; acpi_status status; ACPI_FUNCTION_TRACE("tb_find_rsdp"); /* * Scan supports either logical addressing or physical addressing */ if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ status = acpi_os_map_memory((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH, (void *)&table_ptr); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS(status); } ACPI_MOVE_16_TO_32(&physical_address, table_ptr); /* Convert segment part to physical address */ physical_address <<= 4; acpi_os_unmap_memory(table_ptr, ACPI_EBDA_PTR_LENGTH); /* EBDA present? */ if (physical_address > 0x400) { /* * 1b) Search EBDA paragraphs (EBDa is required to be a * minimum of 1_k length) */ status = acpi_os_map_memory((acpi_physical_address) physical_address, ACPI_EBDA_WINDOW_SIZE, (void *)&table_ptr); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", physical_address, ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS(status); } mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr, ACPI_EBDA_WINDOW_SIZE); acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ physical_address += ACPI_PTR_DIFF(mem_rover, table_ptr); table_info->physical_address = (acpi_physical_address) physical_address; return_ACPI_STATUS(AE_OK); } } /* * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ status = acpi_os_map_memory((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE, (void *)&table_ptr); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS(status); } mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, table_ptr); table_info->physical_address = (acpi_physical_address) physical_address; return_ACPI_STATUS(AE_OK); } } /* * Physical addressing */ else { /* 1a) Get the location of the EBDA */ ACPI_MOVE_16_TO_32(&physical_address, ACPI_EBDA_PTR_LOCATION); physical_address <<= 4; /* Convert segment to physical address */ /* EBDA present? */ if (physical_address > 0x400) { /* * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of * 1_k length) */ mem_rover = acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR (physical_address), ACPI_EBDA_WINDOW_SIZE); if (mem_rover) { /* Return the physical address */ table_info->physical_address = ACPI_TO_INTEGER(mem_rover); return_ACPI_STATUS(AE_OK); } } /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ mem_rover = acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), ACPI_HI_RSDP_WINDOW_SIZE); if (mem_rover) { /* Found it, return the physical address */ table_info->physical_address = ACPI_TO_INTEGER(mem_rover); return_ACPI_STATUS(AE_OK); } } /* A valid RSDP was not found */ ACPI_REPORT_ERROR(("No valid RSDP was found\n")); return_ACPI_STATUS(AE_NOT_FOUND); }