Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Module Name: utosi - Support for the _OSI predefined control method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define _COMPONENT          ACPI_UTILITIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) ACPI_MODULE_NAME("utosi")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * ACPICA policy for new _OSI strings:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * It is the stated policy of ACPICA that new _OSI strings will be integrated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * into this module as soon as possible after they are defined. It is strongly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * recommended that all ACPICA hosts mirror this policy and integrate any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * changes to this module as soon as possible. There are several historical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * reasons behind this policy:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * 1) New BIOSs tend to test only the case where the host responds TRUE to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *    the latest version of Windows, which would respond to the latest/newest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *    _OSI string. Not responding TRUE to the latest version of Windows will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *    risk executing untested code paths throughout the DSDT and SSDTs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * 2) If a new _OSI string is recognized only after a significant delay, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *    has the potential to cause problems on existing working machines because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *    of the possibility that a new and different path through the ASL code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *    will be executed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * 3) New _OSI strings are tending to come out about once per year. A delay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *    in recognizing a new string for a significant amount of time risks the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *    release of another string which only compounds the initial problem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * Strings supported by the _OSI predefined control method (which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * implemented internally within this module.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * March 2009: Removed "Linux" as this host no longer wants to respond true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * for this string. Basically, the only safe OS strings are windows-related
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * and in many or most cases represent the only test path within the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * BIOS-provided ASL code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * The last element of each entry is used to track the newest version of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * Windows that the BIOS has requested.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) static struct acpi_interface_info acpi_default_supported_interfaces[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	/* Operating System Vendor Strings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	{"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000},	/* Windows 2000 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	{"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP},	/* Windows XP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	{"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1},	/* Windows XP SP1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	{"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003},	/* Windows Server 2003 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	{"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2},	/* Windows XP SP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	{"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1},	/* Windows Server 2003 SP1 - Added 03/2006 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	{"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA},	/* Windows vista - Added 03/2006 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	{"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008},	/* Windows Server 2008 - Added 09/2009 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	{"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1},	/* Windows Vista SP1 - Added 09/2009 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	{"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2},	/* Windows Vista SP2 - Added 09/2010 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	{"Windows 2009", NULL, 0, ACPI_OSI_WIN_7},	/* Windows 7 and Server 2008 R2 - Added 09/2009 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	{"Windows 2012", NULL, 0, ACPI_OSI_WIN_8},	/* Windows 8 and Server 2012 - Added 08/2012 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	{"Windows 2013", NULL, 0, ACPI_OSI_WIN_8_1},	/* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	{"Windows 2015", NULL, 0, ACPI_OSI_WIN_10},	/* Windows 10 - Added 03/2015 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	{"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1},	/* Windows 10 version 1607 - Added 12/2017 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	{"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2},	/* Windows 10 version 1703 - Added 12/2017 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	{"Windows 2017.2", NULL, 0, ACPI_OSI_WIN_10_RS3},	/* Windows 10 version 1709 - Added 02/2018 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	{"Windows 2018", NULL, 0, ACPI_OSI_WIN_10_RS4},	/* Windows 10 version 1803 - Added 11/2018 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	{"Windows 2018.2", NULL, 0, ACPI_OSI_WIN_10_RS5},	/* Windows 10 version 1809 - Added 11/2018 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	{"Windows 2019", NULL, 0, ACPI_OSI_WIN_10_19H1},	/* Windows 10 version 1903 - Added 08/2019 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/* Feature Group Strings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	{"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	 * All "optional" feature group strings (features that are implemented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	 * by the host) should be dynamically modified to VALID by the host via
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	 * acpi_install_interface or acpi_update_interfaces. Such optional feature
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	 * group strings are set as INVALID by default here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	{"Module Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	{"Processor Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	{"3.0 Thermal Model", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	{"3.0 _SCP Extensions", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	{"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * FUNCTION:    acpi_ut_initialize_interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * PARAMETERS:  None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * DESCRIPTION: Initialize the global _OSI supported interfaces list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) acpi_status acpi_ut_initialize_interfaces(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	acpi_gbl_supported_interfaces = acpi_default_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	/* Link the static list of supported interfaces */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	for (i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	     i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	     i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		acpi_default_supported_interfaces[i].next =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		    &acpi_default_supported_interfaces[(acpi_size)i + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	acpi_os_release_mutex(acpi_gbl_osi_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * FUNCTION:    acpi_ut_interface_terminate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * PARAMETERS:  None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * DESCRIPTION: Delete all interfaces in the global list. Sets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  *              acpi_gbl_supported_interfaces to NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) acpi_status acpi_ut_interface_terminate(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	struct acpi_interface_info *next_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	next_interface = acpi_gbl_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	while (next_interface) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		acpi_gbl_supported_interfaces = next_interface->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		if (next_interface->flags & ACPI_OSI_DYNAMIC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 			/* Only interfaces added at runtime can be freed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 			ACPI_FREE(next_interface->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 			ACPI_FREE(next_interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 			/* Interface is in static list. Reset it to invalid or valid. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 			if (next_interface->flags & ACPI_OSI_DEFAULT_INVALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 				next_interface->flags |= ACPI_OSI_INVALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 				next_interface->flags &= ~ACPI_OSI_INVALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		next_interface = acpi_gbl_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	acpi_os_release_mutex(acpi_gbl_osi_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  * FUNCTION:    acpi_ut_install_interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  * PARAMETERS:  interface_name      - The interface to install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * DESCRIPTION: Install the interface into the global interface list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  *              Caller MUST hold acpi_gbl_osi_mutex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) acpi_status acpi_ut_install_interface(acpi_string interface_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	struct acpi_interface_info *interface_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	/* Allocate info block and space for the name string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	interface_info =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	    ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	if (!interface_info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		return (AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	interface_info->name = ACPI_ALLOCATE_ZEROED(strlen(interface_name) + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	if (!interface_info->name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		ACPI_FREE(interface_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		return (AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	/* Initialize new info and insert at the head of the global list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	strcpy(interface_info->name, interface_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	interface_info->flags = ACPI_OSI_DYNAMIC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	interface_info->next = acpi_gbl_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	acpi_gbl_supported_interfaces = interface_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * FUNCTION:    acpi_ut_remove_interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  * PARAMETERS:  interface_name      - The interface to remove
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  * DESCRIPTION: Remove the interface from the global interface list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  *              Caller MUST hold acpi_gbl_osi_mutex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) acpi_status acpi_ut_remove_interface(acpi_string interface_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	struct acpi_interface_info *previous_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	struct acpi_interface_info *next_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	previous_interface = next_interface = acpi_gbl_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	while (next_interface) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 		if (!strcmp(interface_name, next_interface->name)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			 * Found: name is in either the static list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 			 * or was added at runtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 			if (next_interface->flags & ACPI_OSI_DYNAMIC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 				/* Interface was added dynamically, remove and free it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 				if (previous_interface == next_interface) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 					acpi_gbl_supported_interfaces =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 					    next_interface->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 				} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 					previous_interface->next =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 					    next_interface->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 				ACPI_FREE(next_interface->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 				ACPI_FREE(next_interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 				/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 				 * Interface is in static list. If marked invalid, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 				 * it does not actually exist. Else, mark it invalid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 				if (next_interface->flags & ACPI_OSI_INVALID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 					return (AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 				next_interface->flags |= ACPI_OSI_INVALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 			return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		previous_interface = next_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 		next_interface = next_interface->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	/* Interface was not found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	return (AE_NOT_EXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * FUNCTION:    acpi_ut_update_interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  * PARAMETERS:  action              - Actions to be performed during the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  *                                    update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  *              strings or/and feature group strings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  *              Caller MUST hold acpi_gbl_osi_mutex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) acpi_status acpi_ut_update_interfaces(u8 action)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	struct acpi_interface_info *next_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	next_interface = acpi_gbl_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	while (next_interface) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		if (((next_interface->flags & ACPI_OSI_FEATURE) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		     (action & ACPI_FEATURE_STRINGS)) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 		    (!(next_interface->flags & ACPI_OSI_FEATURE) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 		     (action & ACPI_VENDOR_STRINGS))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 			if (action & ACPI_DISABLE_INTERFACES) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 				/* Mark the interfaces as invalid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 				next_interface->flags |= ACPI_OSI_INVALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 			} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 				/* Mark the interfaces as valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 				next_interface->flags &= ~ACPI_OSI_INVALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 		next_interface = next_interface->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)  * FUNCTION:    acpi_ut_get_interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)  * PARAMETERS:  interface_name      - The interface to find
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * RETURN:      struct acpi_interface_info if found. NULL if not found.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * DESCRIPTION: Search for the specified interface name in the global list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  *              Caller MUST hold acpi_gbl_osi_mutex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	struct acpi_interface_info *next_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	next_interface = acpi_gbl_supported_interfaces;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	while (next_interface) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		if (!strcmp(interface_name, next_interface->name)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 			return (next_interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 		next_interface = next_interface->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	return (NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  * FUNCTION:    acpi_ut_osi_implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  * PARAMETERS:  walk_state          - Current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  *              Integer: TRUE (0) if input string is matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  *                       FALSE (-1) if string is not matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  * DESCRIPTION: Implementation of the _OSI predefined control method. When
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  *              an invocation of _OSI is encountered in the system AML,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  *              control is transferred to this function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  * (August 2016)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  * Note:  _OSI is now defined to return "Ones" to indicate a match, for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  * compatibility with other ACPI implementations. On a 32-bit DSDT, Ones
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  * is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)  * (ACPI_UINT64_MAX).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)  * This function always returns ACPI_UINT64_MAX for TRUE, and later code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)  * will truncate this to 32 bits if necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	union acpi_operand_object *string_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	union acpi_operand_object *return_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	struct acpi_interface_info *interface_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	acpi_interface_handler interface_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	u64 return_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	ACPI_FUNCTION_TRACE(ut_osi_implementation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	/* Validate the string input argument (from the AML caller) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	string_desc = walk_state->arguments[0].object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		return_ACPI_STATUS(AE_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	/* Create a return object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	if (!return_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 		return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	/* Default return value is 0, NOT SUPPORTED */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	return_value = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 		acpi_ut_remove_reference(return_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	/* Lookup the interface in the global _OSI list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	interface_info = acpi_ut_get_interface(string_desc->string.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	if (interface_info && !(interface_info->flags & ACPI_OSI_INVALID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 		 * The interface is supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 		 * Update the osi_data if necessary. We keep track of the latest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 		 * version of Windows that has been requested by the BIOS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 		if (interface_info->value > acpi_gbl_osi_data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 			acpi_gbl_osi_data = interface_info->value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 		return_value = ACPI_UINT64_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	acpi_os_release_mutex(acpi_gbl_osi_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	 * Invoke an optional _OSI interface handler. The host OS may wish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 	 * to do some interface-specific handling. For example, warn about
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	 * certain interfaces or override the true/false support value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	interface_handler = acpi_gbl_interface_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	if (interface_handler) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 		if (interface_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 		    (string_desc->string.pointer, (u32)return_value)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 			return_value = ACPI_UINT64_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 			      "ACPI: BIOS _OSI(\"%s\") is %ssupported\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 			      string_desc->string.pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 			      return_value == 0 ? "not " : ""));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	/* Complete the return object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	return_desc->integer.value = return_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	walk_state->return_desc = return_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }