xref: /linux/drivers/acpi/acpica/dbconvert.c (revision 11b3125073d16929403d3aa7b2ae6a482060a937)
195857638SErik Schmauss // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
299575102SLv Zheng /*******************************************************************************
399575102SLv Zheng  *
499575102SLv Zheng  * Module Name: dbconvert - debugger miscellaneous conversion routines
599575102SLv Zheng  *
699575102SLv Zheng  ******************************************************************************/
799575102SLv Zheng 
899575102SLv Zheng #include <acpi/acpi.h>
999575102SLv Zheng #include "accommon.h"
1099575102SLv Zheng #include "acdebug.h"
1199575102SLv Zheng 
1299575102SLv Zheng #define _COMPONENT          ACPI_CA_DEBUGGER
1399575102SLv Zheng ACPI_MODULE_NAME("dbconvert")
1499575102SLv Zheng 
1599575102SLv Zheng #define DB_DEFAULT_PKG_ELEMENTS     33
1699575102SLv Zheng /*******************************************************************************
1799575102SLv Zheng  *
1899575102SLv Zheng  * FUNCTION:    acpi_db_hex_char_to_value
1999575102SLv Zheng  *
2099575102SLv Zheng  * PARAMETERS:  hex_char            - Ascii Hex digit, 0-9|a-f|A-F
2199575102SLv Zheng  *              return_value        - Where the converted value is returned
2299575102SLv Zheng  *
2399575102SLv Zheng  * RETURN:      Status
2499575102SLv Zheng  *
2599575102SLv Zheng  * DESCRIPTION: Convert a single hex character to a 4-bit number (0-16).
2699575102SLv Zheng  *
2799575102SLv Zheng  ******************************************************************************/
acpi_db_hex_char_to_value(int hex_char,u8 * return_value)2899575102SLv Zheng acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value)
2999575102SLv Zheng {
3099575102SLv Zheng 	u8 value;
3199575102SLv Zheng 
3299575102SLv Zheng 	/* Digit must be ascii [0-9a-fA-F] */
3399575102SLv Zheng 
3499575102SLv Zheng 	if (!isxdigit(hex_char)) {
3599575102SLv Zheng 		return (AE_BAD_HEX_CONSTANT);
3699575102SLv Zheng 	}
3799575102SLv Zheng 
3899575102SLv Zheng 	if (hex_char <= 0x39) {
3999575102SLv Zheng 		value = (u8)(hex_char - 0x30);
4099575102SLv Zheng 	} else {
4199575102SLv Zheng 		value = (u8)(toupper(hex_char) - 0x37);
4299575102SLv Zheng 	}
4399575102SLv Zheng 
4499575102SLv Zheng 	*return_value = value;
4599575102SLv Zheng 	return (AE_OK);
4699575102SLv Zheng }
4799575102SLv Zheng 
4899575102SLv Zheng /*******************************************************************************
4999575102SLv Zheng  *
5099575102SLv Zheng  * FUNCTION:    acpi_db_hex_byte_to_binary
5199575102SLv Zheng  *
5299575102SLv Zheng  * PARAMETERS:  hex_byte            - Double hex digit (0x00 - 0xFF) in format:
5399575102SLv Zheng  *                                    hi_byte then lo_byte.
5499575102SLv Zheng  *              return_value        - Where the converted value is returned
5599575102SLv Zheng  *
5699575102SLv Zheng  * RETURN:      Status
5799575102SLv Zheng  *
5899575102SLv Zheng  * DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255).
5999575102SLv Zheng  *
6099575102SLv Zheng  ******************************************************************************/
6199575102SLv Zheng 
acpi_db_hex_byte_to_binary(char * hex_byte,u8 * return_value)6299575102SLv Zheng static acpi_status acpi_db_hex_byte_to_binary(char *hex_byte, u8 *return_value)
6399575102SLv Zheng {
6499575102SLv Zheng 	u8 local0;
6599575102SLv Zheng 	u8 local1;
6699575102SLv Zheng 	acpi_status status;
6799575102SLv Zheng 
6899575102SLv Zheng 	/* High byte */
6999575102SLv Zheng 
7099575102SLv Zheng 	status = acpi_db_hex_char_to_value(hex_byte[0], &local0);
7199575102SLv Zheng 	if (ACPI_FAILURE(status)) {
7299575102SLv Zheng 		return (status);
7399575102SLv Zheng 	}
7499575102SLv Zheng 
7599575102SLv Zheng 	/* Low byte */
7699575102SLv Zheng 
7799575102SLv Zheng 	status = acpi_db_hex_char_to_value(hex_byte[1], &local1);
7899575102SLv Zheng 	if (ACPI_FAILURE(status)) {
7999575102SLv Zheng 		return (status);
8099575102SLv Zheng 	}
8199575102SLv Zheng 
8299575102SLv Zheng 	*return_value = (u8)((local0 << 4) | local1);
8399575102SLv Zheng 	return (AE_OK);
8499575102SLv Zheng }
8599575102SLv Zheng 
8699575102SLv Zheng /*******************************************************************************
8799575102SLv Zheng  *
8899575102SLv Zheng  * FUNCTION:    acpi_db_convert_to_buffer
8999575102SLv Zheng  *
9099575102SLv Zheng  * PARAMETERS:  string              - Input string to be converted
9199575102SLv Zheng  *              object              - Where the buffer object is returned
9299575102SLv Zheng  *
9399575102SLv Zheng  * RETURN:      Status
9499575102SLv Zheng  *
9599575102SLv Zheng  * DESCRIPTION: Convert a string to a buffer object. String is treated a list
9699575102SLv Zheng  *              of buffer elements, each separated by a space or comma.
9799575102SLv Zheng  *
9899575102SLv Zheng  ******************************************************************************/
9999575102SLv Zheng 
10099575102SLv Zheng static acpi_status
acpi_db_convert_to_buffer(char * string,union acpi_object * object)10199575102SLv Zheng acpi_db_convert_to_buffer(char *string, union acpi_object *object)
10299575102SLv Zheng {
10399575102SLv Zheng 	u32 i;
10499575102SLv Zheng 	u32 j;
10599575102SLv Zheng 	u32 length;
10699575102SLv Zheng 	u8 *buffer;
10799575102SLv Zheng 	acpi_status status;
10899575102SLv Zheng 
10945abdc99SErik Schmauss 	/* Skip all preceding white space */
11045abdc99SErik Schmauss 
11145abdc99SErik Schmauss 	acpi_ut_remove_whitespace(&string);
11245abdc99SErik Schmauss 
11399575102SLv Zheng 	/* Generate the final buffer length */
11499575102SLv Zheng 
11599575102SLv Zheng 	for (i = 0, length = 0; string[i];) {
11699575102SLv Zheng 		i += 2;
11799575102SLv Zheng 		length++;
11899575102SLv Zheng 
11999575102SLv Zheng 		while (string[i] && ((string[i] == ',') || (string[i] == ' '))) {
12099575102SLv Zheng 			i++;
12199575102SLv Zheng 		}
12299575102SLv Zheng 	}
12399575102SLv Zheng 
12499575102SLv Zheng 	buffer = ACPI_ALLOCATE(length);
12599575102SLv Zheng 	if (!buffer) {
12699575102SLv Zheng 		return (AE_NO_MEMORY);
12799575102SLv Zheng 	}
12899575102SLv Zheng 
12999575102SLv Zheng 	/* Convert the command line bytes to the buffer */
13099575102SLv Zheng 
13199575102SLv Zheng 	for (i = 0, j = 0; string[i];) {
13299575102SLv Zheng 		status = acpi_db_hex_byte_to_binary(&string[i], &buffer[j]);
13399575102SLv Zheng 		if (ACPI_FAILURE(status)) {
13499575102SLv Zheng 			ACPI_FREE(buffer);
13599575102SLv Zheng 			return (status);
13699575102SLv Zheng 		}
13799575102SLv Zheng 
13899575102SLv Zheng 		j++;
13999575102SLv Zheng 		i += 2;
14099575102SLv Zheng 		while (string[i] && ((string[i] == ',') || (string[i] == ' '))) {
14199575102SLv Zheng 			i++;
14299575102SLv Zheng 		}
14399575102SLv Zheng 	}
14499575102SLv Zheng 
14599575102SLv Zheng 	object->type = ACPI_TYPE_BUFFER;
14699575102SLv Zheng 	object->buffer.pointer = buffer;
14799575102SLv Zheng 	object->buffer.length = length;
14899575102SLv Zheng 	return (AE_OK);
14999575102SLv Zheng }
15099575102SLv Zheng 
15199575102SLv Zheng /*******************************************************************************
15299575102SLv Zheng  *
15399575102SLv Zheng  * FUNCTION:    acpi_db_convert_to_package
15499575102SLv Zheng  *
15599575102SLv Zheng  * PARAMETERS:  string              - Input string to be converted
15699575102SLv Zheng  *              object              - Where the package object is returned
15799575102SLv Zheng  *
15899575102SLv Zheng  * RETURN:      Status
15999575102SLv Zheng  *
16099575102SLv Zheng  * DESCRIPTION: Convert a string to a package object. Handles nested packages
16199575102SLv Zheng  *              via recursion with acpi_db_convert_to_object.
16299575102SLv Zheng  *
16399575102SLv Zheng  ******************************************************************************/
16499575102SLv Zheng 
acpi_db_convert_to_package(char * string,union acpi_object * object)16599575102SLv Zheng acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
16699575102SLv Zheng {
16799575102SLv Zheng 	char *this;
16899575102SLv Zheng 	char *next;
16999575102SLv Zheng 	u32 i;
17099575102SLv Zheng 	acpi_object_type type;
17199575102SLv Zheng 	union acpi_object *elements;
17299575102SLv Zheng 	acpi_status status;
17399575102SLv Zheng 
17499575102SLv Zheng 	elements =
17599575102SLv Zheng 	    ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
17699575102SLv Zheng 				 sizeof(union acpi_object));
177*a5242874SPei Xiao 	if (!elements)
178*a5242874SPei Xiao 		return (AE_NO_MEMORY);
17999575102SLv Zheng 
18099575102SLv Zheng 	this = string;
18199575102SLv Zheng 	for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {
18299575102SLv Zheng 		this = acpi_db_get_next_token(this, &next, &type);
18399575102SLv Zheng 		if (!this) {
18499575102SLv Zheng 			break;
18599575102SLv Zheng 		}
18699575102SLv Zheng 
18799575102SLv Zheng 		/* Recursive call to convert each package element */
18899575102SLv Zheng 
18999575102SLv Zheng 		status = acpi_db_convert_to_object(type, this, &elements[i]);
19099575102SLv Zheng 		if (ACPI_FAILURE(status)) {
19199575102SLv Zheng 			acpi_db_delete_objects(i + 1, elements);
19299575102SLv Zheng 			ACPI_FREE(elements);
19399575102SLv Zheng 			return (status);
19499575102SLv Zheng 		}
19599575102SLv Zheng 
19699575102SLv Zheng 		this = next;
19799575102SLv Zheng 	}
19899575102SLv Zheng 
19999575102SLv Zheng 	object->type = ACPI_TYPE_PACKAGE;
20099575102SLv Zheng 	object->package.count = i;
20199575102SLv Zheng 	object->package.elements = elements;
20299575102SLv Zheng 	return (AE_OK);
20399575102SLv Zheng }
20499575102SLv Zheng 
20599575102SLv Zheng /*******************************************************************************
20699575102SLv Zheng  *
20799575102SLv Zheng  * FUNCTION:    acpi_db_convert_to_object
20899575102SLv Zheng  *
20999575102SLv Zheng  * PARAMETERS:  type                - Object type as determined by parser
21099575102SLv Zheng  *              string              - Input string to be converted
21199575102SLv Zheng  *              object              - Where the new object is returned
21299575102SLv Zheng  *
21399575102SLv Zheng  * RETURN:      Status
21499575102SLv Zheng  *
21503440c4eSMasahiro Yamada  * DESCRIPTION: Convert a typed and tokenized string to a union acpi_object. Typing:
21699575102SLv Zheng  *              1) String objects were surrounded by quotes.
21799575102SLv Zheng  *              2) Buffer objects were surrounded by parentheses.
21899575102SLv Zheng  *              3) Package objects were surrounded by brackets "[]".
21999575102SLv Zheng  *              4) All standalone tokens are treated as integers.
22099575102SLv Zheng  *
22199575102SLv Zheng  ******************************************************************************/
22299575102SLv Zheng 
22399575102SLv Zheng acpi_status
acpi_db_convert_to_object(acpi_object_type type,char * string,union acpi_object * object)22499575102SLv Zheng acpi_db_convert_to_object(acpi_object_type type,
22599575102SLv Zheng 			  char *string, union acpi_object *object)
22699575102SLv Zheng {
22799575102SLv Zheng 	acpi_status status = AE_OK;
22899575102SLv Zheng 
22999575102SLv Zheng 	switch (type) {
23099575102SLv Zheng 	case ACPI_TYPE_STRING:
23199575102SLv Zheng 
23299575102SLv Zheng 		object->type = ACPI_TYPE_STRING;
23399575102SLv Zheng 		object->string.pointer = string;
23499575102SLv Zheng 		object->string.length = (u32)strlen(string);
23599575102SLv Zheng 		break;
23699575102SLv Zheng 
23799575102SLv Zheng 	case ACPI_TYPE_BUFFER:
23899575102SLv Zheng 
23999575102SLv Zheng 		status = acpi_db_convert_to_buffer(string, object);
24099575102SLv Zheng 		break;
24199575102SLv Zheng 
24299575102SLv Zheng 	case ACPI_TYPE_PACKAGE:
24399575102SLv Zheng 
24499575102SLv Zheng 		status = acpi_db_convert_to_package(string, object);
24599575102SLv Zheng 		break;
24699575102SLv Zheng 
24799575102SLv Zheng 	default:
24899575102SLv Zheng 
24999575102SLv Zheng 		object->type = ACPI_TYPE_INTEGER;
250fe97d287SBob Moore 		status = acpi_ut_strtoul64(string, &object->integer.value);
25199575102SLv Zheng 		break;
25299575102SLv Zheng 	}
25399575102SLv Zheng 
25499575102SLv Zheng 	return (status);
25599575102SLv Zheng }
25699575102SLv Zheng 
25799575102SLv Zheng /*******************************************************************************
25899575102SLv Zheng  *
25999575102SLv Zheng  * FUNCTION:    acpi_db_encode_pld_buffer
26099575102SLv Zheng  *
26199575102SLv Zheng  * PARAMETERS:  pld_info            - _PLD buffer struct (Using local struct)
26299575102SLv Zheng  *
26399575102SLv Zheng  * RETURN:      Encode _PLD buffer suitable for return value from _PLD
26499575102SLv Zheng  *
26599575102SLv Zheng  * DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros
26699575102SLv Zheng  *
26799575102SLv Zheng  ******************************************************************************/
26899575102SLv Zheng 
acpi_db_encode_pld_buffer(struct acpi_pld_info * pld_info)26999575102SLv Zheng u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)
27099575102SLv Zheng {
27199575102SLv Zheng 	u32 *buffer;
27299575102SLv Zheng 	u32 dword;
27399575102SLv Zheng 
27499575102SLv Zheng 	buffer = ACPI_ALLOCATE_ZEROED(ACPI_PLD_BUFFER_SIZE);
27599575102SLv Zheng 	if (!buffer) {
27699575102SLv Zheng 		return (NULL);
27799575102SLv Zheng 	}
27899575102SLv Zheng 
27999575102SLv Zheng 	/* First 32 bits */
28099575102SLv Zheng 
28199575102SLv Zheng 	dword = 0;
28299575102SLv Zheng 	ACPI_PLD_SET_REVISION(&dword, pld_info->revision);
28399575102SLv Zheng 	ACPI_PLD_SET_IGNORE_COLOR(&dword, pld_info->ignore_color);
28499575102SLv Zheng 	ACPI_PLD_SET_RED(&dword, pld_info->red);
28599575102SLv Zheng 	ACPI_PLD_SET_GREEN(&dword, pld_info->green);
28699575102SLv Zheng 	ACPI_PLD_SET_BLUE(&dword, pld_info->blue);
28799575102SLv Zheng 	ACPI_MOVE_32_TO_32(&buffer[0], &dword);
28899575102SLv Zheng 
28999575102SLv Zheng 	/* Second 32 bits */
29099575102SLv Zheng 
29199575102SLv Zheng 	dword = 0;
29299575102SLv Zheng 	ACPI_PLD_SET_WIDTH(&dword, pld_info->width);
29399575102SLv Zheng 	ACPI_PLD_SET_HEIGHT(&dword, pld_info->height);
29499575102SLv Zheng 	ACPI_MOVE_32_TO_32(&buffer[1], &dword);
29599575102SLv Zheng 
29699575102SLv Zheng 	/* Third 32 bits */
29799575102SLv Zheng 
29899575102SLv Zheng 	dword = 0;
29999575102SLv Zheng 	ACPI_PLD_SET_USER_VISIBLE(&dword, pld_info->user_visible);
30099575102SLv Zheng 	ACPI_PLD_SET_DOCK(&dword, pld_info->dock);
30199575102SLv Zheng 	ACPI_PLD_SET_LID(&dword, pld_info->lid);
30299575102SLv Zheng 	ACPI_PLD_SET_PANEL(&dword, pld_info->panel);
30399575102SLv Zheng 	ACPI_PLD_SET_VERTICAL(&dword, pld_info->vertical_position);
30499575102SLv Zheng 	ACPI_PLD_SET_HORIZONTAL(&dword, pld_info->horizontal_position);
30599575102SLv Zheng 	ACPI_PLD_SET_SHAPE(&dword, pld_info->shape);
30699575102SLv Zheng 	ACPI_PLD_SET_ORIENTATION(&dword, pld_info->group_orientation);
30799575102SLv Zheng 	ACPI_PLD_SET_TOKEN(&dword, pld_info->group_token);
30899575102SLv Zheng 	ACPI_PLD_SET_POSITION(&dword, pld_info->group_position);
30999575102SLv Zheng 	ACPI_PLD_SET_BAY(&dword, pld_info->bay);
31099575102SLv Zheng 	ACPI_MOVE_32_TO_32(&buffer[2], &dword);
31199575102SLv Zheng 
31299575102SLv Zheng 	/* Fourth 32 bits */
31399575102SLv Zheng 
31499575102SLv Zheng 	dword = 0;
31599575102SLv Zheng 	ACPI_PLD_SET_EJECTABLE(&dword, pld_info->ejectable);
31699575102SLv Zheng 	ACPI_PLD_SET_OSPM_EJECT(&dword, pld_info->ospm_eject_required);
31799575102SLv Zheng 	ACPI_PLD_SET_CABINET(&dword, pld_info->cabinet_number);
31899575102SLv Zheng 	ACPI_PLD_SET_CARD_CAGE(&dword, pld_info->card_cage_number);
31999575102SLv Zheng 	ACPI_PLD_SET_REFERENCE(&dword, pld_info->reference);
32099575102SLv Zheng 	ACPI_PLD_SET_ROTATION(&dword, pld_info->rotation);
32199575102SLv Zheng 	ACPI_PLD_SET_ORDER(&dword, pld_info->order);
32299575102SLv Zheng 	ACPI_MOVE_32_TO_32(&buffer[3], &dword);
32399575102SLv Zheng 
32499575102SLv Zheng 	if (pld_info->revision >= 2) {
32599575102SLv Zheng 
32699575102SLv Zheng 		/* Fifth 32 bits */
32799575102SLv Zheng 
32899575102SLv Zheng 		dword = 0;
32999575102SLv Zheng 		ACPI_PLD_SET_VERT_OFFSET(&dword, pld_info->vertical_offset);
33099575102SLv Zheng 		ACPI_PLD_SET_HORIZ_OFFSET(&dword, pld_info->horizontal_offset);
33199575102SLv Zheng 		ACPI_MOVE_32_TO_32(&buffer[4], &dword);
33299575102SLv Zheng 	}
33399575102SLv Zheng 
33499575102SLv Zheng 	return (ACPI_CAST_PTR(u8, buffer));
33599575102SLv Zheng }
33699575102SLv Zheng 
33799575102SLv Zheng /*******************************************************************************
33899575102SLv Zheng  *
33999575102SLv Zheng  * FUNCTION:    acpi_db_dump_pld_buffer
34099575102SLv Zheng  *
34199575102SLv Zheng  * PARAMETERS:  obj_desc            - Object returned from _PLD method
34299575102SLv Zheng  *
34399575102SLv Zheng  * RETURN:      None.
34499575102SLv Zheng  *
34599575102SLv Zheng  * DESCRIPTION: Dumps formatted contents of a _PLD return buffer.
34699575102SLv Zheng  *
34799575102SLv Zheng  ******************************************************************************/
34899575102SLv Zheng 
34999575102SLv Zheng #define ACPI_PLD_OUTPUT     "%20s : %-6X\n"
35099575102SLv Zheng 
acpi_db_dump_pld_buffer(union acpi_object * obj_desc)35199575102SLv Zheng void acpi_db_dump_pld_buffer(union acpi_object *obj_desc)
35299575102SLv Zheng {
35399575102SLv Zheng 	union acpi_object *buffer_desc;
35499575102SLv Zheng 	struct acpi_pld_info *pld_info;
35599575102SLv Zheng 	u8 *new_buffer;
35699575102SLv Zheng 	acpi_status status;
35799575102SLv Zheng 
35899575102SLv Zheng 	/* Object must be of type Package with at least one Buffer element */
35999575102SLv Zheng 
36099575102SLv Zheng 	if (obj_desc->type != ACPI_TYPE_PACKAGE) {
36199575102SLv Zheng 		return;
36299575102SLv Zheng 	}
36399575102SLv Zheng 
36499575102SLv Zheng 	buffer_desc = &obj_desc->package.elements[0];
36599575102SLv Zheng 	if (buffer_desc->type != ACPI_TYPE_BUFFER) {
36699575102SLv Zheng 		return;
36799575102SLv Zheng 	}
36899575102SLv Zheng 
36999575102SLv Zheng 	/* Convert _PLD buffer to local _PLD struct */
37099575102SLv Zheng 
37199575102SLv Zheng 	status = acpi_decode_pld_buffer(buffer_desc->buffer.pointer,
37299575102SLv Zheng 					buffer_desc->buffer.length, &pld_info);
37399575102SLv Zheng 	if (ACPI_FAILURE(status)) {
37499575102SLv Zheng 		return;
37599575102SLv Zheng 	}
37699575102SLv Zheng 
37799575102SLv Zheng 	/* Encode local _PLD struct back to a _PLD buffer */
37899575102SLv Zheng 
37999575102SLv Zheng 	new_buffer = acpi_db_encode_pld_buffer(pld_info);
38099575102SLv Zheng 	if (!new_buffer) {
381c340e5f0SColin Ian King 		goto exit;
38299575102SLv Zheng 	}
38399575102SLv Zheng 
38499575102SLv Zheng 	/* The two bit-packed buffers should match */
38599575102SLv Zheng 
38699575102SLv Zheng 	if (memcmp(new_buffer, buffer_desc->buffer.pointer,
38799575102SLv Zheng 		   buffer_desc->buffer.length)) {
38899575102SLv Zheng 		acpi_os_printf
38999575102SLv Zheng 		    ("Converted _PLD buffer does not compare. New:\n");
39099575102SLv Zheng 
39199575102SLv Zheng 		acpi_ut_dump_buffer(new_buffer,
39299575102SLv Zheng 				    buffer_desc->buffer.length, DB_BYTE_DISPLAY,
39399575102SLv Zheng 				    0);
39499575102SLv Zheng 	}
39599575102SLv Zheng 
39699575102SLv Zheng 	/* First 32-bit dword */
39799575102SLv Zheng 
39899575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Revision", pld_info->revision);
39999575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_IgnoreColor",
40099575102SLv Zheng 		       pld_info->ignore_color);
40199575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Red", pld_info->red);
40299575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Green", pld_info->green);
40399575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Blue", pld_info->blue);
40499575102SLv Zheng 
40599575102SLv Zheng 	/* Second 32-bit dword */
40699575102SLv Zheng 
40799575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Width", pld_info->width);
40899575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Height", pld_info->height);
40999575102SLv Zheng 
41099575102SLv Zheng 	/* Third 32-bit dword */
41199575102SLv Zheng 
41299575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_UserVisible",
41399575102SLv Zheng 		       pld_info->user_visible);
41499575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Dock", pld_info->dock);
41599575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Lid", pld_info->lid);
41699575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Panel", pld_info->panel);
41799575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalPosition",
41899575102SLv Zheng 		       pld_info->vertical_position);
41999575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalPosition",
42099575102SLv Zheng 		       pld_info->horizontal_position);
42199575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Shape", pld_info->shape);
42299575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupOrientation",
42399575102SLv Zheng 		       pld_info->group_orientation);
42499575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupToken",
42599575102SLv Zheng 		       pld_info->group_token);
42699575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupPosition",
42799575102SLv Zheng 		       pld_info->group_position);
42899575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Bay", pld_info->bay);
42999575102SLv Zheng 
43099575102SLv Zheng 	/* Fourth 32-bit dword */
43199575102SLv Zheng 
43299575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Ejectable", pld_info->ejectable);
43399575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_EjectRequired",
43499575102SLv Zheng 		       pld_info->ospm_eject_required);
43599575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CabinetNumber",
43699575102SLv Zheng 		       pld_info->cabinet_number);
43799575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CardCageNumber",
43899575102SLv Zheng 		       pld_info->card_cage_number);
43999575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Reference", pld_info->reference);
44099575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Rotation", pld_info->rotation);
44199575102SLv Zheng 	acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Order", pld_info->order);
44299575102SLv Zheng 
44399575102SLv Zheng 	/* Fifth 32-bit dword */
44499575102SLv Zheng 
44599575102SLv Zheng 	if (buffer_desc->buffer.length > 16) {
44699575102SLv Zheng 		acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalOffset",
44799575102SLv Zheng 			       pld_info->vertical_offset);
44899575102SLv Zheng 		acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalOffset",
44999575102SLv Zheng 			       pld_info->horizontal_offset);
45099575102SLv Zheng 	}
45199575102SLv Zheng 
45299575102SLv Zheng 	ACPI_FREE(new_buffer);
453c340e5f0SColin Ian King exit:
454c340e5f0SColin Ian King 	ACPI_FREE(pld_info);
45599575102SLv Zheng }
456