const char * AeDecodeMessageId ( UINT16 MessageId) { UINT32 Index; const char **MessageTable; /* Main ASL Compiler messages */ if (MessageId <= ASL_MSG_MAIN_COMPILER_END) { MessageTable = AslCompilerMsgs; Index = MessageId; if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs)) { return ("[Unknown ASL Compiler exception ID]"); } } /* Data Table Compiler messages */ else if (MessageId <= ASL_MSG_TABLE_COMPILER_END) { MessageTable = AslTableCompilerMsgs; Index = MessageId - ASL_MSG_TABLE_COMPILER; if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs)) { return ("[Unknown Table Compiler exception ID]"); } } /* Preprocessor messages */ else if (MessageId <= ASL_MSG_PREPROCESSOR_END) { MessageTable = AslPreprocessorMsgs; Index = MessageId - ASL_MSG_PREPROCESSOR; if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) { return ("[Unknown Preprocessor exception ID]"); } } /* Everything else is unknown */ else { return ("[Unknown exception/component ID]"); } return (MessageTable[Index]); }
ACPI_STATUS AcpiUtInitializeInterfaces ( void) { ACPI_STATUS Status; UINT32 i; Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); } AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces; /* Link the static list of supported interfaces */ for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++) { AcpiDefaultSupportedInterfaces[i].Next = &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1]; } AcpiOsReleaseMutex (AcpiGbl_OsiMutex); return (AE_OK); }
ACPI_STATUS AeInstallLateHandlers ( void) { ACPI_STATUS Status; UINT32 i; #if (!ACPI_REDUCED_HARDWARE) if (!AcpiGbl_ReducedHardware) { /* Install a user SCI handler */ Status = AeInstallSciHandler (); AE_CHECK_OK (AeInstallSciHandler, Status); /* Install some fixed event handlers */ Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL); AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL); AE_CHECK_OK (AcpiInstallFixedEventHandler, Status); } #endif /* !ACPI_REDUCED_HARDWARE */ AeMyContext.Connection = NULL; AeMyContext.AccessLength = 0xA5; /* * We will install a handler for each EC device, directly under the EC * device definition. This is unlike the other handlers which we install * at the root node. Also install memory and I/O handlers at any PCI * devices. */ AeInstallDeviceHandlers (); /* * Install handlers for some of the "device driver" address spaces * such as SMBus, etc. */ for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) { /* Install handler at the root object */ Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT, SpaceIdList[i], AeRegionHandler, AeRegionInit, &AeMyContext); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not install an OpRegion handler for %s space(%u)", AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i])); return (Status); } } return (AE_OK); }
acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) { acpi_status status; union acpi_operand_object *string_desc; union acpi_operand_object *return_desc; acpi_native_uint i; ACPI_FUNCTION_TRACE(ut_osi_implementation); /* Validate the string input argument */ string_desc = walk_state->arguments[0].object; if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { return_ACPI_STATUS(AE_TYPE); } /* Create a return object */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Default return value is SUPPORTED */ return_desc->integer.value = ACPI_UINT32_MAX; walk_state->return_desc = return_desc; /* Compare input string to static table of supported interfaces */ for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { if (!ACPI_STRCMP (string_desc->string.pointer, acpi_interfaces_supported[i])) { /* The interface is supported */ return_ACPI_STATUS(AE_CTRL_TERMINATE); } } /* * Did not match the string in the static table, call the host OSL to * check for a match with one of the optional strings (such as * "Module Device", "3.0 Thermal Model", etc.) */ status = acpi_os_validate_interface(string_desc->string.pointer); if (ACPI_SUCCESS(status)) { /* The interface is supported */ return_ACPI_STATUS(AE_CTRL_TERMINATE); } /* The interface is not supported */ return_desc->integer.value = 0; return_ACPI_STATUS(AE_CTRL_TERMINATE); }
acpi_status acpi_osi_invalidate(char *interface) { int i; for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) { *acpi_interfaces_supported[i] = '\0'; return AE_OK; } } return AE_NOT_FOUND; }
acpi_status acpi_ut_initialize_interfaces(void) { u32 i; (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); acpi_gbl_supported_interfaces = acpi_default_supported_interfaces; /* Link the static list of supported interfaces */ for (i = 0; i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1); i++) { acpi_default_supported_interfaces[i].next = &acpi_default_supported_interfaces[(acpi_size) i + 1]; } acpi_os_release_mutex(acpi_gbl_osi_mutex); return (AE_OK); }
const char * AeDecodeExceptionLevel ( UINT8 Level) { /* Range check on Level */ if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel)) { return ("Unknown exception level"); } /* Differentiate the string type to be used (IDE is all lower case) */ if (AslGbl_VerboseErrors) { return (AslErrorLevel[Level]); } return (AslErrorLevelIde[Level]); }
void AcpiDbDisplayHandlers ( void) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_ADR_SPACE_TYPE SpaceId; UINT32 i; /* Operation region handlers */ AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) { for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) { SpaceId = AcpiGbl_SpaceIdList[i]; HandlerObj = ObjDesc->Device.Handler; AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); while (HandlerObj) { if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); goto FoundHandler; } HandlerObj = HandlerObj->AddressSpace.Next; } /* There is no handler for this SpaceId */ AcpiOsPrintf ("None\n"); FoundHandler:; } /* Find all handlers for user-defined SpaceIDs */ HandlerObj = ObjDesc->Device.Handler; while (HandlerObj) { if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, "User-defined ID", HandlerObj->AddressSpace.SpaceId); AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); } HandlerObj = HandlerObj->AddressSpace.Next; } } #if (!ACPI_REDUCED_HARDWARE) /* Fixed event handlers */ AcpiOsPrintf ("\nFixed Event Handlers:\n"); for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); if (AcpiGbl_FixedEventHandlers[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_FixedEventHandlers[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } #endif /* !ACPI_REDUCED_HARDWARE */ /* Miscellaneous global handlers */ AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) { AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); if (AcpiGbl_HandlerList[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_HandlerList[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } /* Other handlers that are installed throughout the namespace */ AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, NULL, NULL, NULL); }
void acpi_db_display_handlers(void) { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj; acpi_adr_space_type space_id; u32 i; /* Operation region handlers */ acpi_os_printf("\nOperation Region Handlers at the namespace root:\n"); obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node); if (obj_desc) { for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) { space_id = acpi_gbl_space_id_list[i]; acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_region_name((u8)space_id), space_id); handler_obj = acpi_ev_find_region_handler(space_id, obj_desc->common_notify. handler); if (handler_obj) { acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, (handler_obj->address_space. handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", handler_obj->address_space. handler); goto found_handler; } /* There is no handler for this space_id */ acpi_os_printf("None\n"); found_handler: ; } /* Find all handlers for user-defined space_IDs */ handler_obj = obj_desc->common_notify.handler; while (handler_obj) { if (handler_obj->address_space.space_id >= ACPI_USER_REGION_BEGIN) { acpi_os_printf(ACPI_PREDEFINED_PREFIX, "User-defined ID", handler_obj->address_space. space_id); acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, (handler_obj->address_space. handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", handler_obj->address_space. handler); } handler_obj = handler_obj->address_space.next; } } #if (!ACPI_REDUCED_HARDWARE) /* Fixed event handlers */ acpi_os_printf("\nFixed Event Handlers:\n"); for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_event_name(i), i); if (acpi_gbl_fixed_event_handlers[i].handler) { acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User", acpi_gbl_fixed_event_handlers[i]. handler); } else { acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } #endif /* !ACPI_REDUCED_HARDWARE */ /* Miscellaneous global handlers */ acpi_os_printf("\nMiscellaneous Global Handlers:\n"); for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_handler_list); i++) { acpi_os_printf(ACPI_HANDLER_NAME_STRING, acpi_gbl_handler_list[i].name); if (acpi_gbl_handler_list[i].handler) { acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User", acpi_gbl_handler_list[i].handler); } else { acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } /* Other handlers that are installed throughout the namespace */ acpi_os_printf("\nOperation Region Handlers for specific devices:\n"); (void)acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_db_display_non_root_handlers, NULL, NULL, NULL); }
ACPI_STATUS AcpiUtOsiImplementation ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *StringDesc; ACPI_OPERAND_OBJECT *ReturnDesc; UINT32 ReturnValue; UINT32 i; ACPI_FUNCTION_TRACE (UtOsiImplementation); /* Validate the string input argument */ StringDesc = WalkState->Arguments[0].Object; if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING)) { return_ACPI_STATUS (AE_TYPE); } /* Create a return object */ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!ReturnDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Default return value is 0, NOT SUPPORTED */ ReturnValue = 0; /* Compare input string to static table of supported interfaces */ for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++) { if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i].Name)) { /* * The interface is supported. * Update the OsiData if necessary. We keep track of the latest * version of Windows that has been requested by the BIOS. */ if (AcpiInterfacesSupported[i].Value > AcpiGbl_OsiData) { AcpiGbl_OsiData = AcpiInterfacesSupported[i].Value; } ReturnValue = ACPI_UINT32_MAX; goto Exit; } } /* * Did not match the string in the static table, call the host OSL to * check for a match with one of the optional strings (such as * "Module Device", "3.0 Thermal Model", etc.) */ Status = AcpiOsValidateInterface (StringDesc->String.Pointer); if (ACPI_SUCCESS (Status)) { /* The interface is supported */ ReturnValue = ACPI_UINT32_MAX; } Exit: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) is %ssupported\n", StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); /* Complete the return value */ ReturnDesc->Integer.Value = ReturnValue; WalkState->ReturnDesc = ReturnDesc; return_ACPI_STATUS (AE_OK); }
void AcpiDbDisplayHandlers ( void) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_ADR_SPACE_TYPE SpaceId; UINT32 i; /* Operation region handlers */ AcpiOsPrintf ("\nOperation Region Handlers:\n"); ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) { for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) { SpaceId = AcpiGbl_SpaceIdList[i]; HandlerObj = ObjDesc->Device.Handler; AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); while (HandlerObj) { if (i == HandlerObj->AddressSpace.SpaceId) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); goto FoundHandler; } HandlerObj = HandlerObj->AddressSpace.Next; } /* There is no handler for this SpaceId */ AcpiOsPrintf ("None\n"); FoundHandler:; } } /* Fixed event handlers */ AcpiOsPrintf ("\nFixed Event Handlers:\n"); for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); if (AcpiGbl_FixedEventHandlers[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_FixedEventHandlers[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } /* Miscellaneous global handlers */ AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) { AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); if (AcpiGbl_HandlerList[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_HandlerList[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } }
acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) { acpi_status status; union acpi_operand_object *string_desc; union acpi_operand_object *return_desc; u32 return_value; u32 i; ACPI_FUNCTION_TRACE(ut_osi_implementation); /* Validate the string input argument */ string_desc = walk_state->arguments[0].object; if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { return_ACPI_STATUS(AE_TYPE); } /* Create a return object */ return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); if (!return_desc) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Default return value is 0, NOT SUPPORTED */ return_value = 0; /* Compare input string to static table of supported interfaces */ for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { if (!ACPI_STRCMP(string_desc->string.pointer, acpi_interfaces_supported[i].name)) { /* * The interface is supported. * Update the osi_data if necessary. We keep track of the latest * version of Windows that has been requested by the BIOS. */ if (acpi_interfaces_supported[i].value > acpi_gbl_osi_data) { acpi_gbl_osi_data = acpi_interfaces_supported[i].value; } return_value = ACPI_UINT32_MAX; goto exit; } } /* * Did not match the string in the static table, call the host OSL to * check for a match with one of the optional strings (such as * "Module Device", "3.0 Thermal Model", etc.) */ status = acpi_os_validate_interface(string_desc->string.pointer); if (ACPI_SUCCESS(status)) { /* The interface is supported */ return_value = ACPI_UINT32_MAX; } exit: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) is %ssupported\n", string_desc->string.pointer, return_value == 0 ? "not " : "")); /* Complete the return value */ return_desc->integer.value = return_value; walk_state->return_desc = return_desc; return_ACPI_STATUS (AE_OK); }