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: rscreate - Create resource lists/tables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include "acresrc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define _COMPONENT          ACPI_RESOURCES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) ACPI_MODULE_NAME("rscreate")
^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)  * FUNCTION:    acpi_buffer_to_resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * PARAMETERS:  aml_buffer          - Pointer to the resource byte stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *              aml_buffer_length   - Length of the aml_buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *              resource_ptr        - Where the converted resource is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * RETURN:      Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * DESCRIPTION: Convert a raw AML buffer to a resource list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) acpi_buffer_to_resource(u8 *aml_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 			u16 aml_buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 			struct acpi_resource **resource_ptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	acpi_size list_size_needed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	void *resource;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	void *current_resource_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	ACPI_FUNCTION_TRACE(acpi_buffer_to_resource);
^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) 	 * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	 * is not required here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	/* Get the required length for the converted resource */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	    acpi_rs_get_list_length(aml_buffer, aml_buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 				    &list_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	if (status == AE_AML_NO_RESOURCE_END_TAG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	/* Allocate a buffer for the converted resource */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	resource = ACPI_ALLOCATE_ZEROED(list_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	current_resource_ptr = resource;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	if (!resource) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		return_ACPI_STATUS(AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	/* Perform the AML-to-Resource conversion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	status = acpi_ut_walk_aml_resources(NULL, aml_buffer, aml_buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 					    acpi_rs_convert_aml_to_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 					    &current_resource_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	if (status == AE_AML_NO_RESOURCE_END_TAG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		status = AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		ACPI_FREE(resource);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		*resource_ptr = resource;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) ACPI_EXPORT_SYMBOL(acpi_buffer_to_resource)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * FUNCTION:    acpi_rs_create_resource_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * PARAMETERS:  aml_buffer          - Pointer to the resource byte stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  *              output_buffer       - Pointer to the user's buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * RETURN:      Status: AE_OK if okay, else a valid acpi_status code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  *              If output_buffer is not large enough, output_buffer_length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  *              indicates how large output_buffer should be, else it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  *              indicates how may u8 elements of output_buffer are valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * DESCRIPTION: Takes the byte stream returned from a _CRS, _PRS control method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  *              execution and parses the stream to create a linked list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  *              of device resources.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			     struct acpi_buffer *output_buffer)
^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 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	u8 *aml_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	acpi_size list_size_needed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	u32 aml_buffer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	void *resource;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	ACPI_FUNCTION_TRACE(rs_create_resource_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlBuffer = %p\n", aml_buffer));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	/* Params already validated, so we don't re-validate here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	aml_buffer_length = aml_buffer->buffer.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	aml_start = aml_buffer->buffer.pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 * Pass the aml_buffer into a module that can calculate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 * the buffer size needed for the linked list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	status = acpi_rs_get_list_length(aml_start, aml_buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 					 &list_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			  status, (u32) list_size_needed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	/* Validate/Allocate/Clear caller buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	status = acpi_ut_initialize_buffer(output_buffer, list_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	/* Do the conversion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	resource = output_buffer->pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	status = acpi_ut_walk_aml_resources(NULL, aml_start, aml_buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 					    acpi_rs_convert_aml_to_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 					    &resource);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			  output_buffer->pointer, (u32) output_buffer->length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * FUNCTION:    acpi_rs_create_pci_routing_table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * PARAMETERS:  package_object          - Pointer to a package containing one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  *                                        of more ACPI_OPERAND_OBJECTs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  *              output_buffer           - Pointer to the user's buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * RETURN:      Status  AE_OK if okay, else a valid acpi_status code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  *              If the output_buffer is too small, the error will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *              AE_BUFFER_OVERFLOW and output_buffer->Length will point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  *              to the size buffer needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * DESCRIPTION: Takes the union acpi_operand_object package and creates a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  *              linked list of PCI interrupt descriptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  * NOTE: It is the caller's responsibility to ensure that the start of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  * output buffer is aligned properly (if necessary).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  *
^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_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				 struct acpi_buffer *output_buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	u8 *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	union acpi_operand_object **top_object_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	union acpi_operand_object **sub_object_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	acpi_size buffer_size_needed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	u32 number_of_elements;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	u32 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	struct acpi_pci_routing_table *user_prt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	struct acpi_namespace_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	struct acpi_buffer path_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	ACPI_FUNCTION_TRACE(rs_create_pci_routing_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	/* Params already validated, so we don't re-validate here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	/* Get the required buffer length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	    acpi_rs_get_pci_routing_table_length(package_object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 						 &buffer_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		return_ACPI_STATUS(status);
^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) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "BufferSizeNeeded = %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			  (u32) buffer_size_needed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	/* Validate/Allocate/Clear caller buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	status = acpi_ut_initialize_buffer(output_buffer, buffer_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	 * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	 * package that in turn contains an u64 Address, a u8 Pin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	 * a Name, and a u8 source_index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	top_object_list = package_object->package.elements;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	number_of_elements = package_object->package.count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	buffer = output_buffer->pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	for (index = 0; index < number_of_elements; index++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		 * Point user_prt past this current structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		 * NOTE: On the first iteration, user_prt->Length will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		 * be zero because we cleared the return buffer earlier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		buffer += user_prt->length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		 * Fill in the Length field with the information we have at this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		 * point. The minus four is to subtract the size of the u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		 * Source[4] member because it is added below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 		user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		/* Each subpackage must be of length 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		if ((*top_object_list)->package.count != 4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 				    "(PRT[%u]) Need package of length 4, found length %u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 				    index, (*top_object_list)->package.count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 			return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		 * Dereference the subpackage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 		 * The sub_object_list will now point to an array of the four IRQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		 * elements: [Address, Pin, Source, source_index]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 		sub_object_list = (*top_object_list)->package.elements;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		/* 1) First subobject: Dereference the PRT.Address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		obj_desc = sub_object_list[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 				    "(PRT[%u].Address) Need Integer, found %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 				    index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 				    acpi_ut_get_object_type_name(obj_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 			return_ACPI_STATUS(AE_BAD_DATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		user_prt->address = obj_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 		/* 2) Second subobject: Dereference the PRT.Pin */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		obj_desc = sub_object_list[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 				    "(PRT[%u].Pin) Need Integer, found %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 				    index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 				    acpi_ut_get_object_type_name(obj_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 			return_ACPI_STATUS(AE_BAD_DATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		user_prt->pin = (u32) obj_desc->integer.value;
^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) 		 * 3) Third subobject: Dereference the PRT.source_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		 * The name may be unresolved (slack mode), so allow a null object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 		obj_desc = sub_object_list[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		if (obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 			switch (obj_desc->common.type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 			case ACPI_TYPE_LOCAL_REFERENCE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 				if (obj_desc->reference.class !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 				    ACPI_REFCLASS_NAME) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 					ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 						    "(PRT[%u].Source) Need name, found Reference Class 0x%X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 						    index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 						    obj_desc->reference.class));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 					return_ACPI_STATUS(AE_BAD_DATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 				node = obj_desc->reference.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 				/* Use *remaining* length of the buffer as max for pathname */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 				path_buffer.length = output_buffer->length -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 				    (u32) ((u8 *) user_prt->source -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 					   (u8 *) output_buffer->pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 				path_buffer.pointer = user_prt->source;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 				status = acpi_ns_handle_to_pathname((acpi_handle)node, &path_buffer, FALSE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 				if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 					return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 				/* +1 to include null terminator */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 				user_prt->length +=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 				    (u32)strlen(user_prt->source) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 			case ACPI_TYPE_STRING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 				strcpy(user_prt->source,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 				       obj_desc->string.pointer);
^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) 				 * Add to the Length field the length of the string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 				 * (add 1 for terminator)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 				user_prt->length += obj_desc->string.length + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 			case ACPI_TYPE_INTEGER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 				/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 				 * If this is a number, then the Source Name is NULL, since
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 				 * the entire buffer was zeroed out, we can leave this alone.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 				 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 				 * Add to the Length field the length of the u32 NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 				 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 				user_prt->length += sizeof(u32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 				ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 					    "(PRT[%u].Source) Need Ref/String/Integer, found %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 					    index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 					    acpi_ut_get_object_type_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 					    (obj_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 				return_ACPI_STATUS(AE_BAD_DATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 			}
^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) 		/* Now align the current length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		user_prt->length =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		    (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		/* 4) Fourth subobject: Dereference the PRT.source_index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		obj_desc = sub_object_list[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 			ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 				    "(PRT[%u].SourceIndex) Need Integer, found %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 				    index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 				    acpi_ut_get_object_type_name(obj_desc)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 			return_ACPI_STATUS(AE_BAD_DATA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 		user_prt->source_index = (u32) obj_desc->integer.value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		/* Point to the next union acpi_operand_object in the top level package */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		top_object_list++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 			  output_buffer->pointer, (u32) output_buffer->length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)  * FUNCTION:    acpi_rs_create_aml_resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)  * PARAMETERS:  resource_list           - Pointer to the resource list buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)  *              output_buffer           - Where the AML buffer is returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)  * RETURN:      Status  AE_OK if okay, else a valid acpi_status code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)  *              If the output_buffer is too small, the error will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)  *              AE_BUFFER_OVERFLOW and output_buffer->Length will point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)  *              to the size buffer needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)  * DESCRIPTION: Converts a list of device resources to an AML bytestream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)  *              to be used as input for the _SRS control method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 			     struct acpi_buffer *output_buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	acpi_size aml_size_needed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	ACPI_FUNCTION_TRACE(rs_create_aml_resources);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	/* Params already validated, no need to re-validate here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ResourceList Buffer = %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 			  resource_list->pointer));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	/* Get the buffer size needed for the AML byte stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	    acpi_rs_get_aml_length(resource_list->pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 				   resource_list->length, &aml_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 			  (u32)aml_size_needed, acpi_format_exception(status)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	/* Validate/Allocate/Clear caller buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 		return_ACPI_STATUS(status);
^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) 	/* Do the conversion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	status = acpi_rs_convert_resources_to_aml(resource_list->pointer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 						  aml_size_needed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 						  output_buffer->pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 		return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 			  output_buffer->pointer, (u32) output_buffer->length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	return_ACPI_STATUS(AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) }