···9999 ******************************************************************************/100100101101acpi_status102102-acpi_ev_queue_notify_request(struct acpi_namespace_node * node,103103- u32 notify_value)102102+acpi_ev_queue_notify_request(struct acpi_namespace_node *node, u32 notify_value)104103{105104 union acpi_operand_object *obj_desc;106105 union acpi_operand_object *handler_list_head = NULL;
+27-49
drivers/acpi/acpica/evregion.c
···526526527527/*******************************************************************************528528 *529529- * FUNCTION: acpi_ev_associate_reg_method530530- *531531- * PARAMETERS: region_obj - Region object532532- *533533- * RETURN: Status534534- *535535- * DESCRIPTION: Find and associate _REG method to a region536536- *537537- ******************************************************************************/538538-539539-void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj)540540-{541541- acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;542542- struct acpi_namespace_node *method_node;543543- struct acpi_namespace_node *node;544544- union acpi_operand_object *region_obj2;545545- acpi_status status;546546-547547- ACPI_FUNCTION_TRACE(ev_associate_reg_method);548548-549549- region_obj2 = acpi_ns_get_secondary_object(region_obj);550550- if (!region_obj2) {551551- return_VOID;552552- }553553-554554- node = region_obj->region.node->parent;555555-556556- /* Find any "_REG" method associated with this region definition */557557-558558- status =559559- acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,560560- &method_node);561561- if (ACPI_SUCCESS(status)) {562562- /*563563- * The _REG method is optional and there can be only one per region564564- * definition. This will be executed when the handler is attached565565- * or removed566566- */567567- region_obj2->extra.method_REG = method_node;568568- }569569-570570- return_VOID;571571-}572572-573573-/*******************************************************************************574574- *575529 * FUNCTION: acpi_ev_execute_reg_method576530 *577531 * PARAMETERS: region_obj - Region object···543589 struct acpi_evaluate_info *info;544590 union acpi_operand_object *args[3];545591 union acpi_operand_object *region_obj2;592592+ const acpi_name *reg_name_ptr =593593+ ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);594594+ struct acpi_namespace_node *method_node;595595+ struct acpi_namespace_node *node;546596 acpi_status status;547597548598 ACPI_FUNCTION_TRACE(ev_execute_reg_method);599599+600600+ if (!acpi_gbl_namespace_initialized ||601601+ region_obj->region.handler == NULL) {602602+ return_ACPI_STATUS(AE_OK);603603+ }549604550605 region_obj2 = acpi_ns_get_secondary_object(region_obj);551606 if (!region_obj2) {552607 return_ACPI_STATUS(AE_NOT_EXIST);553608 }554609555555- if (region_obj2->extra.method_REG == NULL ||556556- region_obj->region.handler == NULL ||557557- !acpi_gbl_namespace_initialized) {610610+ /*611611+ * Find any "_REG" method associated with this region definition.612612+ * The method should always be updated as this function may be613613+ * invoked after a namespace change.614614+ */615615+ node = region_obj->region.node->parent;616616+ status =617617+ acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,618618+ &method_node);619619+ if (ACPI_SUCCESS(status)) {620620+ /*621621+ * The _REG method is optional and there can be only one per622622+ * region definition. This will be executed when the handler is623623+ * attached or removed.624624+ */625625+ region_obj2->extra.method_REG = method_node;626626+ }627627+ if (region_obj2->extra.method_REG == NULL) {558628 return_ACPI_STATUS(AE_OK);559629 }560630
+1-2
drivers/acpi/acpica/evrgnini.c
···227227228228 /* Install a handler for this PCI root bridge */229229230230- status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);230230+ status = acpi_install_address_space_handler((acpi_handle)pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);231231 if (ACPI_FAILURE(status)) {232232 if (status == AE_SAME_HANDLER) {233233 /*···518518 return_ACPI_STATUS(AE_OK);519519 }520520521521- acpi_ev_associate_reg_method(region_obj);522521 region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;523522524523 node = region_obj->region.node->parent;
···11+/******************************************************************************22+ *33+ * Module Name: exconcat - Concatenate-type AML operators44+ *55+ *****************************************************************************/66+77+/*88+ * Copyright (C) 2000 - 2016, Intel Corp.99+ * All rights reserved.1010+ *1111+ * Redistribution and use in source and binary forms, with or without1212+ * modification, are permitted provided that the following conditions1313+ * are met:1414+ * 1. Redistributions of source code must retain the above copyright1515+ * notice, this list of conditions, and the following disclaimer,1616+ * without modification.1717+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer1818+ * substantially similar to the "NO WARRANTY" disclaimer below1919+ * ("Disclaimer") and any redistribution must be conditioned upon2020+ * including a substantially similar Disclaimer requirement for further2121+ * binary redistribution.2222+ * 3. Neither the names of the above-listed copyright holders nor the names2323+ * of any contributors may be used to endorse or promote products derived2424+ * from this software without specific prior written permission.2525+ *2626+ * Alternatively, this software may be distributed under the terms of the2727+ * GNU General Public License ("GPL") version 2 as published by the Free2828+ * Software Foundation.2929+ *3030+ * NO WARRANTY3131+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS3232+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT3333+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR3434+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT3535+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL3636+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS3737+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)3838+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,3939+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING4040+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE4141+ * POSSIBILITY OF SUCH DAMAGES.4242+ */4343+4444+#include <acpi/acpi.h>4545+#include "accommon.h"4646+#include "acinterp.h"4747+#include "amlresrc.h"4848+4949+#define _COMPONENT ACPI_EXECUTER5050+ACPI_MODULE_NAME("exconcat")5151+5252+/* Local Prototypes */5353+static acpi_status5454+acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,5555+ union acpi_operand_object **result_desc);5656+5757+/*******************************************************************************5858+ *5959+ * FUNCTION: acpi_ex_do_concatenate6060+ *6161+ * PARAMETERS: operand0 - First source object6262+ * operand1 - Second source object6363+ * actual_return_desc - Where to place the return object6464+ * walk_state - Current walk state6565+ *6666+ * RETURN: Status6767+ *6868+ * DESCRIPTION: Concatenate two objects with the ACPI-defined conversion6969+ * rules as necessary.7070+ * NOTE:7171+ * Per the ACPI spec (up to 6.1), Concatenate only supports Integer,7272+ * String, and Buffer objects. However, we support all objects here7373+ * as an extension. This improves the usefulness of both Concatenate7474+ * and the Printf/Fprintf macros. The extension returns a string7575+ * describing the object type for the other objects.7676+ * 02/2016.7777+ *7878+ ******************************************************************************/7979+8080+acpi_status8181+acpi_ex_do_concatenate(union acpi_operand_object *operand0,8282+ union acpi_operand_object *operand1,8383+ union acpi_operand_object **actual_return_desc,8484+ struct acpi_walk_state *walk_state)8585+{8686+ union acpi_operand_object *local_operand0 = operand0;8787+ union acpi_operand_object *local_operand1 = operand1;8888+ union acpi_operand_object *temp_operand1 = NULL;8989+ union acpi_operand_object *return_desc;9090+ char *buffer;9191+ acpi_object_type operand0_type;9292+ acpi_object_type operand1_type;9393+ acpi_status status;9494+9595+ ACPI_FUNCTION_TRACE(ex_do_concatenate);9696+9797+ /* Operand 0 preprocessing */9898+9999+ switch (operand0->common.type) {100100+ case ACPI_TYPE_INTEGER:101101+ case ACPI_TYPE_STRING:102102+ case ACPI_TYPE_BUFFER:103103+104104+ operand0_type = operand0->common.type;105105+ break;106106+107107+ default:108108+109109+ /* For all other types, get the "object type" string */110110+111111+ status =112112+ acpi_ex_convert_to_object_type_string(operand0,113113+ &local_operand0);114114+ if (ACPI_FAILURE(status)) {115115+ goto cleanup;116116+ }117117+118118+ operand0_type = ACPI_TYPE_STRING;119119+ break;120120+ }121121+122122+ /* Operand 1 preprocessing */123123+124124+ switch (operand1->common.type) {125125+ case ACPI_TYPE_INTEGER:126126+ case ACPI_TYPE_STRING:127127+ case ACPI_TYPE_BUFFER:128128+129129+ operand1_type = operand1->common.type;130130+ break;131131+132132+ default:133133+134134+ /* For all other types, get the "object type" string */135135+136136+ status =137137+ acpi_ex_convert_to_object_type_string(operand1,138138+ &local_operand1);139139+ if (ACPI_FAILURE(status)) {140140+ goto cleanup;141141+ }142142+143143+ operand1_type = ACPI_TYPE_STRING;144144+ break;145145+ }146146+147147+ /*148148+ * Convert the second operand if necessary. The first operand (0)149149+ * determines the type of the second operand (1) (See the Data Types150150+ * section of the ACPI specification). Both object types are151151+ * guaranteed to be either Integer/String/Buffer by the operand152152+ * resolution mechanism.153153+ */154154+ switch (operand0_type) {155155+ case ACPI_TYPE_INTEGER:156156+157157+ status =158158+ acpi_ex_convert_to_integer(local_operand1, &temp_operand1,159159+ 16);160160+ break;161161+162162+ case ACPI_TYPE_BUFFER:163163+164164+ status =165165+ acpi_ex_convert_to_buffer(local_operand1, &temp_operand1);166166+ break;167167+168168+ case ACPI_TYPE_STRING:169169+170170+ switch (operand1_type) {171171+ case ACPI_TYPE_INTEGER:172172+ case ACPI_TYPE_STRING:173173+ case ACPI_TYPE_BUFFER:174174+175175+ /* Other types have already been converted to string */176176+177177+ status =178178+ acpi_ex_convert_to_string(local_operand1,179179+ &temp_operand1,180180+ ACPI_IMPLICIT_CONVERT_HEX);181181+ break;182182+183183+ default:184184+185185+ status = AE_OK;186186+ break;187187+ }188188+ break;189189+190190+ default:191191+192192+ ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",193193+ operand0->common.type));194194+ status = AE_AML_INTERNAL;195195+ }196196+197197+ if (ACPI_FAILURE(status)) {198198+ goto cleanup;199199+ }200200+201201+ /* Take care with any newly created operand objects */202202+203203+ if ((local_operand1 != operand1) && (local_operand1 != temp_operand1)) {204204+ acpi_ut_remove_reference(local_operand1);205205+ }206206+207207+ local_operand1 = temp_operand1;208208+209209+ /*210210+ * Both operands are now known to be the same object type211211+ * (Both are Integer, String, or Buffer), and we can now perform212212+ * the concatenation.213213+ *214214+ * There are three cases to handle, as per the ACPI spec:215215+ *216216+ * 1) Two Integers concatenated to produce a new Buffer217217+ * 2) Two Strings concatenated to produce a new String218218+ * 3) Two Buffers concatenated to produce a new Buffer219219+ */220220+ switch (operand0_type) {221221+ case ACPI_TYPE_INTEGER:222222+223223+ /* Result of two Integers is a Buffer */224224+ /* Need enough buffer space for two integers */225225+226226+ return_desc = acpi_ut_create_buffer_object((acpi_size)227227+ ACPI_MUL_2228228+ (acpi_gbl_integer_byte_width));229229+ if (!return_desc) {230230+ status = AE_NO_MEMORY;231231+ goto cleanup;232232+ }233233+234234+ buffer = (char *)return_desc->buffer.pointer;235235+236236+ /* Copy the first integer, LSB first */237237+238238+ memcpy(buffer, &operand0->integer.value,239239+ acpi_gbl_integer_byte_width);240240+241241+ /* Copy the second integer (LSB first) after the first */242242+243243+ memcpy(buffer + acpi_gbl_integer_byte_width,244244+ &local_operand1->integer.value,245245+ acpi_gbl_integer_byte_width);246246+ break;247247+248248+ case ACPI_TYPE_STRING:249249+250250+ /* Result of two Strings is a String */251251+252252+ return_desc = acpi_ut_create_string_object(((acpi_size)253253+ local_operand0->254254+ string.length +255255+ local_operand1->256256+ string.length));257257+ if (!return_desc) {258258+ status = AE_NO_MEMORY;259259+ goto cleanup;260260+ }261261+262262+ buffer = return_desc->string.pointer;263263+264264+ /* Concatenate the strings */265265+266266+ strcpy(buffer, local_operand0->string.pointer);267267+ strcat(buffer, local_operand1->string.pointer);268268+ break;269269+270270+ case ACPI_TYPE_BUFFER:271271+272272+ /* Result of two Buffers is a Buffer */273273+274274+ return_desc = acpi_ut_create_buffer_object(((acpi_size)275275+ operand0->buffer.276276+ length +277277+ local_operand1->278278+ buffer.length));279279+ if (!return_desc) {280280+ status = AE_NO_MEMORY;281281+ goto cleanup;282282+ }283283+284284+ buffer = (char *)return_desc->buffer.pointer;285285+286286+ /* Concatenate the buffers */287287+288288+ memcpy(buffer, operand0->buffer.pointer,289289+ operand0->buffer.length);290290+ memcpy(buffer + operand0->buffer.length,291291+ local_operand1->buffer.pointer,292292+ local_operand1->buffer.length);293293+ break;294294+295295+ default:296296+297297+ /* Invalid object type, should not happen here */298298+299299+ ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",300300+ operand0->common.type));301301+ status = AE_AML_INTERNAL;302302+ goto cleanup;303303+ }304304+305305+ *actual_return_desc = return_desc;306306+307307+cleanup:308308+ if (local_operand0 != operand0) {309309+ acpi_ut_remove_reference(local_operand0);310310+ }311311+312312+ if (local_operand1 != operand1) {313313+ acpi_ut_remove_reference(local_operand1);314314+ }315315+316316+ return_ACPI_STATUS(status);317317+}318318+319319+/*******************************************************************************320320+ *321321+ * FUNCTION: acpi_ex_convert_to_object_type_string322322+ *323323+ * PARAMETERS: obj_desc - Object to be converted324324+ * return_desc - Where to place the return object325325+ *326326+ * RETURN: Status327327+ *328328+ * DESCRIPTION: Convert an object of arbitrary type to a string object that329329+ * contains the namestring for the object. Used for the330330+ * concatenate operator.331331+ *332332+ ******************************************************************************/333333+334334+static acpi_status335335+acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,336336+ union acpi_operand_object **result_desc)337337+{338338+ union acpi_operand_object *return_desc;339339+ const char *type_string;340340+341341+ type_string = acpi_ut_get_type_name(obj_desc->common.type);342342+343343+ return_desc = acpi_ut_create_string_object(((acpi_size)strlen(type_string) + 9)); /* 9 For "[ Object]" */344344+ if (!return_desc) {345345+ return (AE_NO_MEMORY);346346+ }347347+348348+ strcpy(return_desc->string.pointer, "[");349349+ strcat(return_desc->string.pointer, type_string);350350+ strcat(return_desc->string.pointer, " Object]");351351+352352+ *result_desc = return_desc;353353+ return (AE_OK);354354+}355355+356356+/*******************************************************************************357357+ *358358+ * FUNCTION: acpi_ex_concat_template359359+ *360360+ * PARAMETERS: operand0 - First source object361361+ * operand1 - Second source object362362+ * actual_return_desc - Where to place the return object363363+ * walk_state - Current walk state364364+ *365365+ * RETURN: Status366366+ *367367+ * DESCRIPTION: Concatenate two resource templates368368+ *369369+ ******************************************************************************/370370+371371+acpi_status372372+acpi_ex_concat_template(union acpi_operand_object *operand0,373373+ union acpi_operand_object *operand1,374374+ union acpi_operand_object **actual_return_desc,375375+ struct acpi_walk_state *walk_state)376376+{377377+ acpi_status status;378378+ union acpi_operand_object *return_desc;379379+ u8 *new_buf;380380+ u8 *end_tag;381381+ acpi_size length0;382382+ acpi_size length1;383383+ acpi_size new_length;384384+385385+ ACPI_FUNCTION_TRACE(ex_concat_template);386386+387387+ /*388388+ * Find the end_tag descriptor in each resource template.389389+ * Note1: returned pointers point TO the end_tag, not past it.390390+ * Note2: zero-length buffers are allowed; treated like one end_tag391391+ */392392+393393+ /* Get the length of the first resource template */394394+395395+ status = acpi_ut_get_resource_end_tag(operand0, &end_tag);396396+ if (ACPI_FAILURE(status)) {397397+ return_ACPI_STATUS(status);398398+ }399399+400400+ length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);401401+402402+ /* Get the length of the second resource template */403403+404404+ status = acpi_ut_get_resource_end_tag(operand1, &end_tag);405405+ if (ACPI_FAILURE(status)) {406406+ return_ACPI_STATUS(status);407407+ }408408+409409+ length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);410410+411411+ /* Combine both lengths, minimum size will be 2 for end_tag */412412+413413+ new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);414414+415415+ /* Create a new buffer object for the result (with one end_tag) */416416+417417+ return_desc = acpi_ut_create_buffer_object(new_length);418418+ if (!return_desc) {419419+ return_ACPI_STATUS(AE_NO_MEMORY);420420+ }421421+422422+ /*423423+ * Copy the templates to the new buffer, 0 first, then 1 follows. One424424+ * end_tag descriptor is copied from Operand1.425425+ */426426+ new_buf = return_desc->buffer.pointer;427427+ memcpy(new_buf, operand0->buffer.pointer, length0);428428+ memcpy(new_buf + length0, operand1->buffer.pointer, length1);429429+430430+ /* Insert end_tag and set the checksum to zero, means "ignore checksum" */431431+432432+ new_buf[new_length - 1] = 0;433433+ new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;434434+435435+ /* Return the completed resource template */436436+437437+ *actual_return_desc = return_desc;438438+ return_ACPI_STATUS(AE_OK);439439+}
+3-1
drivers/acpi/acpica/exconfig.c
···118118 /* Execute any module-level code that was found in the table */119119120120 acpi_ex_exit_interpreter();121121- acpi_ns_exec_module_code_list();121121+ if (acpi_gbl_group_module_level_code) {122122+ acpi_ns_exec_module_code_list();123123+ }122124 acpi_ex_enter_interpreter();123125124126 /*
+5-3
drivers/acpi/acpica/exconvrt.c
···124124 * of ACPI 3.0) is that the to_integer() operator allows both decimal125125 * and hexadecimal strings (hex prefixed with "0x").126126 */127127- status = acpi_ut_strtoul64((char *)pointer, flags, &result);127127+ status = acpi_ut_strtoul64((char *)pointer, flags,128128+ acpi_gbl_integer_byte_width,129129+ &result);128130 if (ACPI_FAILURE(status)) {129131 return_ACPI_STATUS(status);130132 }···441439 * Need enough space for one ASCII integer (plus null terminator)442440 */443441 return_desc =444444- acpi_ut_create_string_object((acpi_size) string_length);442442+ acpi_ut_create_string_object((acpi_size)string_length);445443 if (!return_desc) {446444 return_ACPI_STATUS(AE_NO_MEMORY);447445 }···520518 }521519522520 return_desc =523523- acpi_ut_create_string_object((acpi_size) string_length);521521+ acpi_ut_create_string_object((acpi_size)string_length);524522 if (!return_desc) {525523 return_ACPI_STATUS(AE_NO_MEMORY);526524 }
+1-1
drivers/acpi/acpica/excreate.c
···394394 obj_desc->processor.proc_id = (u8) operand[1]->integer.value;395395 obj_desc->processor.length = (u8) operand[3]->integer.value;396396 obj_desc->processor.address =397397- (acpi_io_address) operand[2]->integer.value;397397+ (acpi_io_address)operand[2]->integer.value;398398399399 /* Install the processor object in the parent Node */400400
···126126 ******************************************************************************/127127128128acpi_status129129-acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state,129129+acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,130130 union acpi_operand_object *obj_desc,131131 union acpi_operand_object **ret_buffer_desc)132132{···233233 * Note: Field.length is in bits.234234 */235235 length =236236- (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);236236+ (acpi_size)ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);237237238238 if (length > acpi_gbl_integer_byte_width) {239239
+3-11
drivers/acpi/acpica/exfldio.c
···164164 if (ACPI_ROUND_UP(rgn_desc->region.length,165165 obj_desc->common_field.166166 access_byte_width) >=167167- ((acpi_size) obj_desc->common_field.167167+ ((acpi_size)obj_desc->common_field.168168 base_byte_offset +169169 obj_desc->common_field.access_byte_width +170170 field_datum_byte_offset)) {···897897898898 access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width);899899900900- /*901901- * Create the bitmasks used for bit insertion.902902- * Note: This if/else is used to bypass compiler differences with the903903- * shift operator904904- */905905- if (access_bit_width == ACPI_INTEGER_BIT_SIZE) {906906- width_mask = ACPI_UINT64_MAX;907907- } else {908908- width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width);909909- }900900+ /* Create the bitmasks used for bit insertion */910901902902+ width_mask = ACPI_MASK_BITS_ABOVE_64(access_bit_width);911903 mask = width_mask &912904 ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);913905
-290
drivers/acpi/acpica/exmisc.c
···4545#include "accommon.h"4646#include "acinterp.h"4747#include "amlcode.h"4848-#include "amlresrc.h"49485049#define _COMPONENT ACPI_EXECUTER5150ACPI_MODULE_NAME("exmisc")···135136 *return_desc));136137137138 return_ACPI_STATUS(AE_OK);138138-}139139-140140-/*******************************************************************************141141- *142142- * FUNCTION: acpi_ex_concat_template143143- *144144- * PARAMETERS: operand0 - First source object145145- * operand1 - Second source object146146- * actual_return_desc - Where to place the return object147147- * walk_state - Current walk state148148- *149149- * RETURN: Status150150- *151151- * DESCRIPTION: Concatenate two resource templates152152- *153153- ******************************************************************************/154154-155155-acpi_status156156-acpi_ex_concat_template(union acpi_operand_object *operand0,157157- union acpi_operand_object *operand1,158158- union acpi_operand_object **actual_return_desc,159159- struct acpi_walk_state *walk_state)160160-{161161- acpi_status status;162162- union acpi_operand_object *return_desc;163163- u8 *new_buf;164164- u8 *end_tag;165165- acpi_size length0;166166- acpi_size length1;167167- acpi_size new_length;168168-169169- ACPI_FUNCTION_TRACE(ex_concat_template);170170-171171- /*172172- * Find the end_tag descriptor in each resource template.173173- * Note1: returned pointers point TO the end_tag, not past it.174174- * Note2: zero-length buffers are allowed; treated like one end_tag175175- */176176-177177- /* Get the length of the first resource template */178178-179179- status = acpi_ut_get_resource_end_tag(operand0, &end_tag);180180- if (ACPI_FAILURE(status)) {181181- return_ACPI_STATUS(status);182182- }183183-184184- length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);185185-186186- /* Get the length of the second resource template */187187-188188- status = acpi_ut_get_resource_end_tag(operand1, &end_tag);189189- if (ACPI_FAILURE(status)) {190190- return_ACPI_STATUS(status);191191- }192192-193193- length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);194194-195195- /* Combine both lengths, minimum size will be 2 for end_tag */196196-197197- new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);198198-199199- /* Create a new buffer object for the result (with one end_tag) */200200-201201- return_desc = acpi_ut_create_buffer_object(new_length);202202- if (!return_desc) {203203- return_ACPI_STATUS(AE_NO_MEMORY);204204- }205205-206206- /*207207- * Copy the templates to the new buffer, 0 first, then 1 follows. One208208- * end_tag descriptor is copied from Operand1.209209- */210210- new_buf = return_desc->buffer.pointer;211211- memcpy(new_buf, operand0->buffer.pointer, length0);212212- memcpy(new_buf + length0, operand1->buffer.pointer, length1);213213-214214- /* Insert end_tag and set the checksum to zero, means "ignore checksum" */215215-216216- new_buf[new_length - 1] = 0;217217- new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;218218-219219- /* Return the completed resource template */220220-221221- *actual_return_desc = return_desc;222222- return_ACPI_STATUS(AE_OK);223223-}224224-225225-/*******************************************************************************226226- *227227- * FUNCTION: acpi_ex_do_concatenate228228- *229229- * PARAMETERS: operand0 - First source object230230- * operand1 - Second source object231231- * actual_return_desc - Where to place the return object232232- * walk_state - Current walk state233233- *234234- * RETURN: Status235235- *236236- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.237237- *238238- ******************************************************************************/239239-240240-acpi_status241241-acpi_ex_do_concatenate(union acpi_operand_object *operand0,242242- union acpi_operand_object *operand1,243243- union acpi_operand_object **actual_return_desc,244244- struct acpi_walk_state *walk_state)245245-{246246- union acpi_operand_object *local_operand1 = operand1;247247- union acpi_operand_object *return_desc;248248- char *new_buf;249249- const char *type_string;250250- acpi_status status;251251-252252- ACPI_FUNCTION_TRACE(ex_do_concatenate);253253-254254- /*255255- * Convert the second operand if necessary. The first operand256256- * determines the type of the second operand, (See the Data Types257257- * section of the ACPI specification.) Both object types are258258- * guaranteed to be either Integer/String/Buffer by the operand259259- * resolution mechanism.260260- */261261- switch (operand0->common.type) {262262- case ACPI_TYPE_INTEGER:263263-264264- status =265265- acpi_ex_convert_to_integer(operand1, &local_operand1, 16);266266- break;267267-268268- case ACPI_TYPE_STRING:269269- /*270270- * Per the ACPI spec, Concatenate only supports int/str/buf.271271- * However, we support all objects here as an extension.272272- * This improves the usefulness of the Printf() macro.273273- * 12/2015.274274- */275275- switch (operand1->common.type) {276276- case ACPI_TYPE_INTEGER:277277- case ACPI_TYPE_STRING:278278- case ACPI_TYPE_BUFFER:279279-280280- status =281281- acpi_ex_convert_to_string(operand1, &local_operand1,282282- ACPI_IMPLICIT_CONVERT_HEX);283283- break;284284-285285- default:286286- /*287287- * Just emit a string containing the object type.288288- */289289- type_string =290290- acpi_ut_get_type_name(operand1->common.type);291291-292292- local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */293293- if (!local_operand1) {294294- status = AE_NO_MEMORY;295295- goto cleanup;296296- }297297-298298- strcpy(local_operand1->string.pointer, "[");299299- strcat(local_operand1->string.pointer, type_string);300300- strcat(local_operand1->string.pointer, " Object]");301301- status = AE_OK;302302- break;303303- }304304- break;305305-306306- case ACPI_TYPE_BUFFER:307307-308308- status = acpi_ex_convert_to_buffer(operand1, &local_operand1);309309- break;310310-311311- default:312312-313313- ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",314314- operand0->common.type));315315- status = AE_AML_INTERNAL;316316- }317317-318318- if (ACPI_FAILURE(status)) {319319- goto cleanup;320320- }321321-322322- /*323323- * Both operands are now known to be the same object type324324- * (Both are Integer, String, or Buffer), and we can now perform the325325- * concatenation.326326- */327327-328328- /*329329- * There are three cases to handle:330330- *331331- * 1) Two Integers concatenated to produce a new Buffer332332- * 2) Two Strings concatenated to produce a new String333333- * 3) Two Buffers concatenated to produce a new Buffer334334- */335335- switch (operand0->common.type) {336336- case ACPI_TYPE_INTEGER:337337-338338- /* Result of two Integers is a Buffer */339339- /* Need enough buffer space for two integers */340340-341341- return_desc = acpi_ut_create_buffer_object((acpi_size)342342- ACPI_MUL_2343343- (acpi_gbl_integer_byte_width));344344- if (!return_desc) {345345- status = AE_NO_MEMORY;346346- goto cleanup;347347- }348348-349349- new_buf = (char *)return_desc->buffer.pointer;350350-351351- /* Copy the first integer, LSB first */352352-353353- memcpy(new_buf, &operand0->integer.value,354354- acpi_gbl_integer_byte_width);355355-356356- /* Copy the second integer (LSB first) after the first */357357-358358- memcpy(new_buf + acpi_gbl_integer_byte_width,359359- &local_operand1->integer.value,360360- acpi_gbl_integer_byte_width);361361- break;362362-363363- case ACPI_TYPE_STRING:364364-365365- /* Result of two Strings is a String */366366-367367- return_desc = acpi_ut_create_string_object(((acpi_size)368368- operand0->string.369369- length +370370- local_operand1->371371- string.length));372372- if (!return_desc) {373373- status = AE_NO_MEMORY;374374- goto cleanup;375375- }376376-377377- new_buf = return_desc->string.pointer;378378-379379- /* Concatenate the strings */380380-381381- strcpy(new_buf, operand0->string.pointer);382382- strcat(new_buf, local_operand1->string.pointer);383383- break;384384-385385- case ACPI_TYPE_BUFFER:386386-387387- /* Result of two Buffers is a Buffer */388388-389389- return_desc = acpi_ut_create_buffer_object(((acpi_size)390390- operand0->buffer.391391- length +392392- local_operand1->393393- buffer.length));394394- if (!return_desc) {395395- status = AE_NO_MEMORY;396396- goto cleanup;397397- }398398-399399- new_buf = (char *)return_desc->buffer.pointer;400400-401401- /* Concatenate the buffers */402402-403403- memcpy(new_buf, operand0->buffer.pointer,404404- operand0->buffer.length);405405- memcpy(new_buf + operand0->buffer.length,406406- local_operand1->buffer.pointer,407407- local_operand1->buffer.length);408408- break;409409-410410- default:411411-412412- /* Invalid object type, should not happen here */413413-414414- ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",415415- operand0->common.type));416416- status = AE_AML_INTERNAL;417417- goto cleanup;418418- }419419-420420- *actual_return_desc = return_desc;421421-422422-cleanup:423423- if (local_operand1 != operand1) {424424- acpi_ut_remove_reference(local_operand1);425425- }426426- return_ACPI_STATUS(status);427139}428140429141/*******************************************************************************
···184184 /* Get the Integer values from the objects */185185186186 index = operand[1]->integer.value;187187- length = (acpi_size) operand[2]->integer.value;187187+ length = (acpi_size)operand[2]->integer.value;188188189189 /*190190 * If the index is beyond the length of the String/Buffer, or if the···198198199199 else if ((index + length) > operand[0]->string.length) {200200 length =201201- (acpi_size) operand[0]->string.length -202202- (acpi_size) index;201201+ (acpi_size)operand[0]->string.length -202202+ (acpi_size)index;203203 }204204205205 /* Strings always have a sub-pointer, not so for buffers */···209209210210 /* Always allocate a new buffer for the String */211211212212- buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1);212212+ buffer = ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);213213 if (!buffer) {214214 status = AE_NO_MEMORY;215215 goto cleanup;
+1-1
drivers/acpi/acpica/exoparg6.c
···207207 *208208 ******************************************************************************/209209210210-acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)210210+acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state)211211{212212 union acpi_operand_object **operand = &walk_state->operands[0];213213 union acpi_operand_object *return_desc = NULL;
+3-3
drivers/acpi/acpica/exregion.c
···325325 switch (function) {326326 case ACPI_READ:327327328328- status = acpi_hw_read_port((acpi_io_address) address,328328+ status = acpi_hw_read_port((acpi_io_address)address,329329 &value32, bit_width);330330 *value = value32;331331 break;332332333333 case ACPI_WRITE:334334335335- status = acpi_hw_write_port((acpi_io_address) address,336336- (u32) * value, bit_width);335335+ status = acpi_hw_write_port((acpi_io_address)address,336336+ (u32)*value, bit_width);337337 break;338338339339 default:
···334334acpi_status335335acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,336336 union acpi_operand_object *operand,337337- acpi_object_type * return_type,337337+ acpi_object_type *return_type,338338 union acpi_operand_object **return_desc)339339{340340 union acpi_operand_object *obj_desc = ACPI_CAST_PTR(void, operand);
+2-2
drivers/acpi/acpica/exresop.c
···131131132132acpi_status133133acpi_ex_resolve_operands(u16 opcode,134134- union acpi_operand_object ** stack_ptr,135135- struct acpi_walk_state * walk_state)134134+ union acpi_operand_object **stack_ptr,135135+ struct acpi_walk_state *walk_state)136136{137137 union acpi_operand_object *obj_desc;138138 acpi_status status = AE_OK;
+2-2
drivers/acpi/acpica/exstorob.c
···188188 * Clear old string and copy in the new one189189 */190190 memset(target_desc->string.pointer, 0,191191- (acpi_size) target_desc->string.length + 1);191191+ (acpi_size)target_desc->string.length + 1);192192 memcpy(target_desc->string.pointer, buffer, length);193193 } else {194194 /*···204204 }205205206206 target_desc->string.pointer =207207- ACPI_ALLOCATE_ZEROED((acpi_size) length + 1);207207+ ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);208208209209 if (!target_desc->string.pointer) {210210 return_ACPI_STATUS(AE_NO_MEMORY);
+6-6
drivers/acpi/acpica/exutils.c
···301301 *302302 * FUNCTION: acpi_ex_eisa_id_to_string303303 *304304- * PARAMETERS: compressed_id - EISAID to be converted305305- * out_string - Where to put the converted string (8 bytes)304304+ * PARAMETERS: out_string - Where to put the converted string (8 bytes)305305+ * compressed_id - EISAID to be converted306306 *307307 * RETURN: None308308 *···354354 * possible 64-bit integer.355355 * value - Value to be converted356356 *357357- * RETURN: None, string357357+ * RETURN: Converted string in out_string358358 *359359 * DESCRIPTION: Convert a 64-bit integer to decimal string representation.360360 * Assumes string buffer is large enough to hold the string. The···384384 * FUNCTION: acpi_ex_pci_cls_to_string385385 *386386 * PARAMETERS: out_string - Where to put the converted string (7 bytes)387387- * PARAMETERS: class_code - PCI class code to be converted (3 bytes)387387+ * class_code - PCI class code to be converted (3 bytes)388388 *389389- * RETURN: None389389+ * RETURN: Converted string in out_string390390 *391391 * DESCRIPTION: Convert 3-bytes PCI class code to string representation.392392 * Return buffer must be large enough to hold the string. The···417417 *418418 * PARAMETERS: space_id - ID to be validated419419 *420420- * RETURN: TRUE if valid/supported ID.420420+ * RETURN: TRUE if space_id is a valid/supported ID.421421 *422422 * DESCRIPTION: Validate an operation region space_ID.423423 *
···51515252#if (!ACPI_REDUCED_HARDWARE)5353/* Local Prototypes */5454+static u85555+acpi_hw_get_access_bit_width(struct acpi_generic_address *reg,5656+ u8 max_bit_width);5757+5458static acpi_status5559acpi_hw_read_multiple(u32 *value,5660 struct acpi_generic_address *register_a,···6662 struct acpi_generic_address *register_b);67636864#endif /* !ACPI_REDUCED_HARDWARE */6565+6666+/******************************************************************************6767+ *6868+ * FUNCTION: acpi_hw_get_access_bit_width6969+ *7070+ * PARAMETERS: reg - GAS register structure7171+ * max_bit_width - Max bit_width supported (32 or 64)7272+ *7373+ * RETURN: Status7474+ *7575+ * DESCRIPTION: Obtain optimal access bit width7676+ *7777+ ******************************************************************************/7878+7979+static u88080+acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)8181+{8282+ u64 address;8383+8484+ if (!reg->access_width) {8585+ /*8686+ * Detect old register descriptors where only the bit_width field8787+ * makes senses. The target address is copied to handle possible8888+ * alignment issues.8989+ */9090+ ACPI_MOVE_64_TO_64(&address, ®->address);9191+ if (!reg->bit_offset && reg->bit_width &&9292+ ACPI_IS_POWER_OF_TWO(reg->bit_width) &&9393+ ACPI_IS_ALIGNED(reg->bit_width, 8) &&9494+ ACPI_IS_ALIGNED(address, reg->bit_width)) {9595+ return (reg->bit_width);9696+ } else {9797+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {9898+ return (32);9999+ } else {100100+ return (max_bit_width);101101+ }102102+ }103103+ } else {104104+ return (1 << (reg->access_width + 2));105105+ }106106+}6910770108/******************************************************************************71109 *···12983acpi_hw_validate_register(struct acpi_generic_address *reg,13084 u8 max_bit_width, u64 *address)13185{8686+ u8 bit_width;8787+ u8 access_width;1328813389 /* Must have a valid pointer to a GAS structure */13490···157109 return (AE_SUPPORT);158110 }159111160160- /* Validate the bit_width */112112+ /* Validate the access_width */161113162162- if ((reg->bit_width != 8) &&163163- (reg->bit_width != 16) &&164164- (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {114114+ if (reg->access_width > 4) {165115 ACPI_ERROR((AE_INFO,166166- "Unsupported register bit width: 0x%X",167167- reg->bit_width));116116+ "Unsupported register access width: 0x%X",117117+ reg->access_width));168118 return (AE_SUPPORT);169119 }170120171171- /* Validate the bit_offset. Just a warning for now. */121121+ /* Validate the bit_width, convert access_width into number of bits */172122173173- if (reg->bit_offset != 0) {123123+ access_width = acpi_hw_get_access_bit_width(reg, max_bit_width);124124+ bit_width =125125+ ACPI_ROUND_UP(reg->bit_offset + reg->bit_width, access_width);126126+ if (max_bit_width < bit_width) {174127 ACPI_WARNING((AE_INFO,175175- "Unsupported register bit offset: 0x%X",176176- reg->bit_offset));128128+ "Requested bit width 0x%X is smaller than register bit width 0x%X",129129+ max_bit_width, bit_width));130130+ return (AE_SUPPORT);177131 }178132179133 return (AE_OK);···195145 * 64-bit values is not needed.196146 *197147 * LIMITATIONS: <These limitations also apply to acpi_hw_write>198198- * bit_width must be exactly 8, 16, or 32.199148 * space_ID must be system_memory or system_IO.200200- * bit_offset and access_width are currently ignored, as there has201201- * not been a need to implement these.202149 *203150 ******************************************************************************/204151205152acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)206153{207154 u64 address;155155+ u8 access_width;156156+ u32 bit_width;157157+ u8 bit_offset;208158 u64 value64;159159+ u32 value32;160160+ u8 index;209161 acpi_status status;210162211163 ACPI_FUNCTION_NAME(hw_read);···219167 return (status);220168 }221169222222- /* Initialize entire 32-bit return value to zero */223223-170170+ /*171171+ * Initialize entire 32-bit return value to zero, convert access_width172172+ * into number of bits based173173+ */224174 *value = 0;175175+ access_width = acpi_hw_get_access_bit_width(reg, 32);176176+ bit_width = reg->bit_offset + reg->bit_width;177177+ bit_offset = reg->bit_offset;225178226179 /*227180 * Two address spaces supported: Memory or IO. PCI_Config is228181 * not supported here because the GAS structure is insufficient229182 */230230- if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {231231- status = acpi_os_read_memory((acpi_physical_address)232232- address, &value64, reg->bit_width);183183+ index = 0;184184+ while (bit_width) {185185+ if (bit_offset >= access_width) {186186+ value32 = 0;187187+ bit_offset -= access_width;188188+ } else {189189+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {190190+ status =191191+ acpi_os_read_memory((acpi_physical_address)192192+ address +193193+ index *194194+ ACPI_DIV_8195195+ (access_width),196196+ &value64, access_width);197197+ value32 = (u32)value64;198198+ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */233199234234- *value = (u32)value64;235235- } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */200200+ status = acpi_hw_read_port((acpi_io_address)201201+ address +202202+ index *203203+ ACPI_DIV_8204204+ (access_width),205205+ &value32,206206+ access_width);207207+ }236208237237- status = acpi_hw_read_port((acpi_io_address)238238- address, value, reg->bit_width);209209+ /*210210+ * Use offset style bit masks because:211211+ * bit_offset < access_width/bit_width < access_width, and212212+ * access_width is ensured to be less than 32-bits by213213+ * acpi_hw_validate_register().214214+ */215215+ if (bit_offset) {216216+ value32 &= ACPI_MASK_BITS_BELOW(bit_offset);217217+ bit_offset = 0;218218+ }219219+ if (bit_width < access_width) {220220+ value32 &= ACPI_MASK_BITS_ABOVE(bit_width);221221+ }222222+ }223223+224224+ /*225225+ * Use offset style bit writes because "Index * AccessWidth" is226226+ * ensured to be less than 32-bits by acpi_hw_validate_register().227227+ */228228+ ACPI_SET_BITS(value, index * access_width,229229+ ACPI_MASK_BITS_ABOVE_32(access_width), value32);230230+231231+ bit_width -=232232+ bit_width > access_width ? access_width : bit_width;233233+ index++;239234 }240235241236 ACPI_DEBUG_PRINT((ACPI_DB_IO,242237 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",243243- *value, reg->bit_width, ACPI_FORMAT_UINT64(address),238238+ *value, access_width, ACPI_FORMAT_UINT64(address),244239 acpi_ut_get_region_name(reg->space_id)));245240246241 return (status);···311212acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)312213{313214 u64 address;215215+ u8 access_width;216216+ u32 bit_width;217217+ u8 bit_offset;218218+ u64 value64;219219+ u32 new_value32, old_value32;220220+ u8 index;314221 acpi_status status;315222316223 ACPI_FUNCTION_NAME(hw_write);···328223 return (status);329224 }330225226226+ /* Convert access_width into number of bits based */227227+228228+ access_width = acpi_hw_get_access_bit_width(reg, 32);229229+ bit_width = reg->bit_offset + reg->bit_width;230230+ bit_offset = reg->bit_offset;231231+331232 /*332233 * Two address spaces supported: Memory or IO. PCI_Config is333234 * not supported here because the GAS structure is insufficient334235 */335335- if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {336336- status = acpi_os_write_memory((acpi_physical_address)337337- address, (u64)value,338338- reg->bit_width);339339- } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */236236+ index = 0;237237+ while (bit_width) {238238+ /*239239+ * Use offset style bit reads because "Index * AccessWidth" is240240+ * ensured to be less than 32-bits by acpi_hw_validate_register().241241+ */242242+ new_value32 = ACPI_GET_BITS(&value, index * access_width,243243+ ACPI_MASK_BITS_ABOVE_32244244+ (access_width));340245341341- status = acpi_hw_write_port((acpi_io_address)342342- address, value, reg->bit_width);246246+ if (bit_offset >= access_width) {247247+ bit_offset -= access_width;248248+ } else {249249+ /*250250+ * Use offset style bit masks because access_width is ensured251251+ * to be less than 32-bits by acpi_hw_validate_register() and252252+ * bit_offset/bit_width is less than access_width here.253253+ */254254+ if (bit_offset) {255255+ new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);256256+ }257257+ if (bit_width < access_width) {258258+ new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);259259+ }260260+261261+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {262262+ if (bit_offset || bit_width < access_width) {263263+ /*264264+ * Read old values in order not to modify the bits that265265+ * are beyond the register bit_width/bit_offset setting.266266+ */267267+ status =268268+ acpi_os_read_memory((acpi_physical_address)269269+ address +270270+ index *271271+ ACPI_DIV_8272272+ (access_width),273273+ &value64,274274+ access_width);275275+ old_value32 = (u32)value64;276276+277277+ /*278278+ * Use offset style bit masks because access_width is279279+ * ensured to be less than 32-bits by280280+ * acpi_hw_validate_register() and bit_offset/bit_width is281281+ * less than access_width here.282282+ */283283+ if (bit_offset) {284284+ old_value32 &=285285+ ACPI_MASK_BITS_ABOVE286286+ (bit_offset);287287+ bit_offset = 0;288288+ }289289+ if (bit_width < access_width) {290290+ old_value32 &=291291+ ACPI_MASK_BITS_BELOW292292+ (bit_width);293293+ }294294+295295+ new_value32 |= old_value32;296296+ }297297+298298+ value64 = (u64)new_value32;299299+ status =300300+ acpi_os_write_memory((acpi_physical_address)301301+ address +302302+ index *303303+ ACPI_DIV_8304304+ (access_width),305305+ value64, access_width);306306+ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */307307+308308+ if (bit_offset || bit_width < access_width) {309309+ /*310310+ * Read old values in order not to modify the bits that311311+ * are beyond the register bit_width/bit_offset setting.312312+ */313313+ status =314314+ acpi_hw_read_port((acpi_io_address)315315+ address +316316+ index *317317+ ACPI_DIV_8318318+ (access_width),319319+ &old_value32,320320+ access_width);321321+322322+ /*323323+ * Use offset style bit masks because access_width is324324+ * ensured to be less than 32-bits by325325+ * acpi_hw_validate_register() and bit_offset/bit_width is326326+ * less than access_width here.327327+ */328328+ if (bit_offset) {329329+ old_value32 &=330330+ ACPI_MASK_BITS_ABOVE331331+ (bit_offset);332332+ bit_offset = 0;333333+ }334334+ if (bit_width < access_width) {335335+ old_value32 &=336336+ ACPI_MASK_BITS_BELOW337337+ (bit_width);338338+ }339339+340340+ new_value32 |= old_value32;341341+ }342342+343343+ status = acpi_hw_write_port((acpi_io_address)344344+ address +345345+ index *346346+ ACPI_DIV_8347347+ (access_width),348348+ new_value32,349349+ access_width);350350+ }351351+ }352352+353353+ /*354354+ * Index * access_width is ensured to be less than 32-bits by355355+ * acpi_hw_validate_register().356356+ */357357+ bit_width -=358358+ bit_width > access_width ? access_width : bit_width;359359+ index++;343360 }344361345362 ACPI_DEBUG_PRINT((ACPI_DB_IO,346363 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",347347- value, reg->bit_width, ACPI_FORMAT_UINT64(address),364364+ value, access_width, ACPI_FORMAT_UINT64(address),348365 acpi_ut_get_region_name(reg->space_id)));349366350367 return (status);
+4-7
drivers/acpi/acpica/hwxface.c
···9191 * compatibility with other ACPI implementations that have allowed9292 * BIOS code with bad register width values to go unnoticed.9393 */9494- status =9595- acpi_os_write_port((acpi_io_address) reset_reg->address,9696- acpi_gbl_FADT.reset_value,9797- ACPI_RESET_REGISTER_WIDTH);9494+ status = acpi_os_write_port((acpi_io_address)reset_reg->address,9595+ acpi_gbl_FADT.reset_value,9696+ ACPI_RESET_REGISTER_WIDTH);9897 } else {9998 /* Write the reset value to the reset register */10099···503504 * Evaluate the \_Sx namespace object containing the register values504505 * for this state505506 */506506- info->relative_pathname = ACPI_CAST_PTR(char,507507- acpi_gbl_sleep_state_names508508- [sleep_state]);507507+ info->relative_pathname = acpi_gbl_sleep_state_names[sleep_state];509508510509 status = acpi_ns_evaluate(info);511510 if (ACPI_FAILURE(status)) {
+4-3
drivers/acpi/acpica/nsaccess.c
···107107 continue;108108 }109109110110- status = acpi_ns_lookup(NULL, init_val->name, init_val->type,111111- ACPI_IMODE_LOAD_PASS2,112112- ACPI_NS_NO_UPSEARCH, NULL, &new_node);110110+ status =111111+ acpi_ns_lookup(NULL, (char *)init_val->name, init_val->type,112112+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,113113+ NULL, &new_node);113114 if (ACPI_FAILURE(status)) {114115 ACPI_EXCEPTION((AE_INFO, status,115116 "Could not create predefined name %s",
+5-4
drivers/acpi/acpica/nsconvert.c
···7979 /* String-to-Integer conversion */80808181 status = acpi_ut_strtoul64(original_object->string.pointer,8282- ACPI_ANY_BASE, &value);8282+ ACPI_ANY_BASE,8383+ acpi_gbl_integer_byte_width, &value);8384 if (ACPI_FAILURE(status)) {8485 return (status);8586 }···318317 ******************************************************************************/319318320319acpi_status321321-acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope,320320+acpi_ns_convert_to_unicode(struct acpi_namespace_node *scope,322321 union acpi_operand_object *original_object,323322 union acpi_operand_object **return_object)324323{···385384 ******************************************************************************/386385387386acpi_status388388-acpi_ns_convert_to_resource(struct acpi_namespace_node * scope,387387+acpi_ns_convert_to_resource(struct acpi_namespace_node *scope,389388 union acpi_operand_object *original_object,390389 union acpi_operand_object **return_object)391390{···464463 ******************************************************************************/465464466465acpi_status467467-acpi_ns_convert_to_reference(struct acpi_namespace_node * scope,466466+acpi_ns_convert_to_reference(struct acpi_namespace_node *scope,468467 union acpi_operand_object *original_object,469468 union acpi_operand_object **return_object)470469{
+7-2
drivers/acpi/acpica/nsdump.c
···8181 *8282 ******************************************************************************/83838484-void acpi_ns_print_pathname(u32 num_segments, char *pathname)8484+void acpi_ns_print_pathname(u32 num_segments, const char *pathname)8585{8686 u32 i;8787···114114 acpi_os_printf("]\n");115115}116116117117+#ifdef ACPI_OBSOLETE_FUNCTIONS118118+/* Not used at this time, perhaps later */119119+117120/*******************************************************************************118121 *119122 * FUNCTION: acpi_ns_dump_pathname···134131 ******************************************************************************/135132136133void137137-acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)134134+acpi_ns_dump_pathname(acpi_handle handle,135135+ const char *msg, u32 level, u32 component)138136{139137140138 ACPI_FUNCTION_TRACE(ns_dump_pathname);···152148 acpi_os_printf("\n");153149 return_VOID;154150}151151+#endif155152156153/*******************************************************************************157154 *
+52-20
drivers/acpi/acpica/nsinit.c
···140140{141141 acpi_status status = AE_OK;142142 struct acpi_device_walk_info info;143143+ acpi_handle handle;143144144145 ACPI_FUNCTION_TRACE(ns_initialize_devices);145146···191190 if (ACPI_SUCCESS(status)) {192191 info.num_INI++;193192 }193193+194194+ /*195195+ * Execute \_SB._INI.196196+ * There appears to be a strict order requirement for \_SB._INI,197197+ * which should be evaluated before any _REG evaluations.198198+ */199199+ status = acpi_get_handle(NULL, "\\_SB", &handle);200200+ if (ACPI_SUCCESS(status)) {201201+ memset(info.evaluate_info, 0,202202+ sizeof(struct acpi_evaluate_info));203203+ info.evaluate_info->prefix_node = handle;204204+ info.evaluate_info->relative_pathname =205205+ METHOD_NAME__INI;206206+ info.evaluate_info->parameters = NULL;207207+ info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;208208+209209+ status = acpi_ns_evaluate(info.evaluate_info);210210+ if (ACPI_SUCCESS(status)) {211211+ info.num_INI++;212212+ }213213+ }194214 }195215196216 /*···220198 * Note: Any objects accessed by the _REG methods will be automatically221199 * initialized, even if they contain executable AML (see the call to222200 * acpi_ns_initialize_objects below).201201+ *202202+ * Note: According to the ACPI specification, we actually needn't execute203203+ * _REG for system_memory/system_io operation regions, but for PCI_Config204204+ * operation regions, it is required to evaluate _REG for those on a PCI205205+ * root bus that doesn't contain _BBN object. So this code is kept here206206+ * in order not to break things.223207 */224208 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {225209 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,···620592 * Note: We know there is an _INI within this subtree, but it may not be621593 * under this particular device, it may be lower in the branch.622594 */623623- ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname624624- (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));595595+ if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||596596+ device_node->parent != acpi_gbl_root_node) {597597+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname598598+ (ACPI_TYPE_METHOD, device_node,599599+ METHOD_NAME__INI));625600626626- memset(info, 0, sizeof(struct acpi_evaluate_info));627627- info->prefix_node = device_node;628628- info->relative_pathname = METHOD_NAME__INI;629629- info->parameters = NULL;630630- info->flags = ACPI_IGNORE_RETURN_VALUE;601601+ memset(info, 0, sizeof(struct acpi_evaluate_info));602602+ info->prefix_node = device_node;603603+ info->relative_pathname = METHOD_NAME__INI;604604+ info->parameters = NULL;605605+ info->flags = ACPI_IGNORE_RETURN_VALUE;631606632632- status = acpi_ns_evaluate(info);633633-634634- if (ACPI_SUCCESS(status)) {635635- walk_info->num_INI++;636636- }607607+ status = acpi_ns_evaluate(info);608608+ if (ACPI_SUCCESS(status)) {609609+ walk_info->num_INI++;610610+ }637611#ifdef ACPI_DEBUG_OUTPUT638638- else if (status != AE_NOT_FOUND) {612612+ else if (status != AE_NOT_FOUND) {639613640640- /* Ignore error and move on to next device */614614+ /* Ignore error and move on to next device */641615642642- char *scope_name =643643- acpi_ns_get_normalized_pathname(device_node, TRUE);616616+ char *scope_name =617617+ acpi_ns_get_normalized_pathname(device_node, TRUE);644618645645- ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",646646- scope_name));647647- ACPI_FREE(scope_name);648648- }619619+ ACPI_EXCEPTION((AE_INFO, status,620620+ "during %s._INI execution",621621+ scope_name));622622+ ACPI_FREE(scope_name);623623+ }649624#endif625625+ }650626651627 /* Ignore errors from above */652628
···6262 u32 count1,6363 u8 type2, u32 count2, u32 start_index);64646565+static acpi_status6666+acpi_ns_custom_package(struct acpi_evaluate_info *info,6767+ union acpi_operand_object **elements, u32 count);6868+6569/*******************************************************************************6670 *6771 * FUNCTION: acpi_ns_check_package···139135 * PTYPE2 packages contain subpackages140136 */141137 switch (package->ret_info.type) {138138+ case ACPI_PTYPE_CUSTOM:139139+140140+ status = acpi_ns_custom_package(info, elements, count);141141+ break;142142+142143 case ACPI_PTYPE1_FIXED:143144 /*144145 * The package count is fixed and there are no subpackages···188179 if (ACPI_FAILURE(status)) {189180 return (status);190181 }182182+191183 elements++;192184 }193185 break;···235225 return (status);236226 }237227 }228228+238229 elements++;239230 }240231 break;···580569 if (sub_package->package.count < expected_count) {581570 goto package_too_small;582571 }572572+583573 if (sub_package->package.count <584574 package->ret_info.count1) {585575 expected_count = package->ret_info.count1;586576 goto package_too_small;587577 }578578+588579 if (expected_count == 0) {589580 /*590581 * Either the num_entries element was originally zero or it was···635622636623/*******************************************************************************637624 *625625+ * FUNCTION: acpi_ns_custom_package626626+ *627627+ * PARAMETERS: info - Method execution information block628628+ * elements - Pointer to the package elements array629629+ * count - Element count for the package630630+ *631631+ * RETURN: Status632632+ *633633+ * DESCRIPTION: Check a returned package object for the correct count and634634+ * correct type of all sub-objects.635635+ *636636+ * NOTE: Currently used for the _BIX method only. When needed for two or more637637+ * methods, probably a detect/dispatch mechanism will be required.638638+ *639639+ ******************************************************************************/640640+641641+static acpi_status642642+acpi_ns_custom_package(struct acpi_evaluate_info *info,643643+ union acpi_operand_object **elements, u32 count)644644+{645645+ u32 expected_count;646646+ u32 version;647647+ acpi_status status = AE_OK;648648+649649+ ACPI_FUNCTION_NAME(ns_custom_package);650650+651651+ /* Get version number, must be Integer */652652+653653+ if ((*elements)->common.type != ACPI_TYPE_INTEGER) {654654+ ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,655655+ info->node_flags,656656+ "Return Package has invalid object type for version number"));657657+ return_ACPI_STATUS(AE_AML_OPERAND_TYPE);658658+ }659659+660660+ version = (u32)(*elements)->integer.value;661661+ expected_count = 21; /* Version 1 */662662+663663+ if (version == 0) {664664+ expected_count = 20; /* Version 0 */665665+ }666666+667667+ if (count < expected_count) {668668+ ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,669669+ info->node_flags,670670+ "Return Package is too small - found %u elements, expected %u",671671+ count, expected_count));672672+ return_ACPI_STATUS(AE_AML_OPERAND_VALUE);673673+ } else if (count > expected_count) {674674+ ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,675675+ "%s: Return Package is larger than needed - "676676+ "found %u, expected %u\n",677677+ info->full_pathname, count, expected_count));678678+ }679679+680680+ /* Validate all elements of the returned package */681681+682682+ status = acpi_ns_check_package_elements(info, elements,683683+ ACPI_RTYPE_INTEGER, 16,684684+ ACPI_RTYPE_STRING, 4, 0);685685+ if (ACPI_FAILURE(status)) {686686+ return_ACPI_STATUS(status);687687+ }688688+689689+ /* Version 1 has a single trailing integer */690690+691691+ if (version > 0) {692692+ status = acpi_ns_check_package_elements(info, elements + 20,693693+ ACPI_RTYPE_INTEGER, 1,694694+ 0, 0, 20);695695+ }696696+697697+ return_ACPI_STATUS(status);698698+}699699+700700+/*******************************************************************************701701+ *638702 * FUNCTION: acpi_ns_check_package_elements639703 *640704 * PARAMETERS: info - Method execution information block···751661 if (ACPI_FAILURE(status)) {752662 return (status);753663 }664664+754665 this_element++;755666 }756667···762671 if (ACPI_FAILURE(status)) {763672 return (status);764673 }674674+765675 this_element++;766676 }767677
···5454 * be repaired on a per-name basis.5555 */5656typedef5757-acpi_status(*acpi_repair_function) (struct acpi_evaluate_info * info,5858- union acpi_operand_object5959- **return_object_ptr);5757+acpi_status (*acpi_repair_function) (struct acpi_evaluate_info * info,5858+ union acpi_operand_object **5959+ return_object_ptr);60606161typedef struct acpi_repair_info {6262 char name[ACPI_NAME_SIZE];
+4-4
drivers/acpi/acpica/nsutils.c
···272272 result = &internal_name[i];273273 } else if (num_segments == 2) {274274 internal_name[i] = AML_DUAL_NAME_PREFIX;275275- result = &internal_name[(acpi_size) i + 1];275275+ result = &internal_name[(acpi_size)i + 1];276276 } else {277277 internal_name[i] = AML_MULTI_NAME_PREFIX_OP;278278- internal_name[(acpi_size) i + 1] = (char)num_segments;279279- result = &internal_name[(acpi_size) i + 2];278278+ internal_name[(acpi_size)i + 1] = (char)num_segments;279279+ result = &internal_name[(acpi_size)i + 2];280280 }281281 }282282···456456457457 names_index = prefix_length + 2;458458 num_segments = (u8)459459- internal_name[(acpi_size) prefix_length + 1];459459+ internal_name[(acpi_size)prefix_length + 1];460460 break;461461462462 case AML_DUAL_NAME_PREFIX:
+59-60
drivers/acpi/acpica/nsxfeval.c
···256256 * Allocate a new parameter block for the internal objects257257 * Add 1 to count to allow for null terminated internal list258258 */259259- info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) info->259259+ info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)info->260260 param_count +261261 1) * sizeof(void *));262262 if (!info->parameters) {···280280 info->parameters[info->param_count] = NULL;281281 }282282283283-#if 0283283+#ifdef _FUTURE_FEATURE284284285285 /*286286 * Begin incoming argument count analysis. Check for too few args287287 * and too many args.288288 */289289-290289 switch (acpi_ns_get_type(info->node)) {291290 case ACPI_TYPE_METHOD:292291···369370 * If we are expecting a return value, and all went well above,370371 * copy the return value to an external object.371372 */372372- if (return_buffer) {373373- if (!info->return_object) {374374- return_buffer->length = 0;373373+ if (!return_buffer) {374374+ goto cleanup_return_object;375375+ }376376+377377+ if (!info->return_object) {378378+ return_buffer->length = 0;379379+ goto cleanup;380380+ }381381+382382+ if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==383383+ ACPI_DESC_TYPE_NAMED) {384384+ /*385385+ * If we received a NS Node as a return object, this means that386386+ * the object we are evaluating has nothing interesting to387387+ * return (such as a mutex, etc.) We return an error because388388+ * these types are essentially unsupported by this interface.389389+ * We don't check up front because this makes it easier to add390390+ * support for various types at a later date if necessary.391391+ */392392+ status = AE_TYPE;393393+ info->return_object = NULL; /* No need to delete a NS Node */394394+ return_buffer->length = 0;395395+ }396396+397397+ if (ACPI_FAILURE(status)) {398398+ goto cleanup_return_object;399399+ }400400+401401+ /* Dereference Index and ref_of references */402402+403403+ acpi_ns_resolve_references(info);404404+405405+ /* Get the size of the returned object */406406+407407+ status = acpi_ut_get_object_size(info->return_object,408408+ &buffer_space_needed);409409+ if (ACPI_SUCCESS(status)) {410410+411411+ /* Validate/Allocate/Clear caller buffer */412412+413413+ status = acpi_ut_initialize_buffer(return_buffer,414414+ buffer_space_needed);415415+ if (ACPI_FAILURE(status)) {416416+ /*417417+ * Caller's buffer is too small or a new one can't418418+ * be allocated419419+ */420420+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,421421+ "Needed buffer size %X, %s\n",422422+ (u32)buffer_space_needed,423423+ acpi_format_exception(status)));375424 } else {376376- if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==377377- ACPI_DESC_TYPE_NAMED) {378378- /*379379- * If we received a NS Node as a return object, this means that380380- * the object we are evaluating has nothing interesting to381381- * return (such as a mutex, etc.) We return an error because382382- * these types are essentially unsupported by this interface.383383- * We don't check up front because this makes it easier to add384384- * support for various types at a later date if necessary.385385- */386386- status = AE_TYPE;387387- info->return_object = NULL; /* No need to delete a NS Node */388388- return_buffer->length = 0;389389- }425425+ /* We have enough space for the object, build it */390426391391- if (ACPI_SUCCESS(status)) {392392-393393- /* Dereference Index and ref_of references */394394-395395- acpi_ns_resolve_references(info);396396-397397- /* Get the size of the returned object */398398-399399- status =400400- acpi_ut_get_object_size(info->return_object,401401- &buffer_space_needed);402402- if (ACPI_SUCCESS(status)) {403403-404404- /* Validate/Allocate/Clear caller buffer */405405-406406- status =407407- acpi_ut_initialize_buffer408408- (return_buffer,409409- buffer_space_needed);410410- if (ACPI_FAILURE(status)) {411411- /*412412- * Caller's buffer is too small or a new one can't413413- * be allocated414414- */415415- ACPI_DEBUG_PRINT((ACPI_DB_INFO,416416- "Needed buffer size %X, %s\n",417417- (u32)418418- buffer_space_needed,419419- acpi_format_exception420420- (status)));421421- } else {422422- /* We have enough space for the object, build it */423423-424424- status =425425- acpi_ut_copy_iobject_to_eobject426426- (info->return_object,427427- return_buffer);428428- }429429- }430430- }427427+ status =428428+ acpi_ut_copy_iobject_to_eobject(info->return_object,429429+ return_buffer);431430 }432431 }432432+433433+cleanup_return_object:433434434435 if (info->return_object) {435436 /*
···130130 ******************************************************************************/131131132132acpi_status133133-acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,134134- union acpi_parse_object * op)133133+acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,134134+ union acpi_parse_object *op)135135{136136 union acpi_parse_object *prev;137137 union acpi_parse_object *next;
···8787 return_ACPI_STATUS(AE_BAD_PARAMETER);8888 }89899090- if (((acpi_size) resource) & 0x3) {9090+ if (((acpi_size)resource) & 0x3) {91919292 /* Each internal resource struct is expected to be 32-bit aligned */9393
···5353acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,5454 u8 space_id,5555 u8 byte_width,5656- u64 address, char *register_name, u8 flags);5656+ u64 address, const char *register_name, u8 flags);57575858static void acpi_tb_convert_fadt(void);5959···6565/* Table for conversion of FADT to common internal format and FADT validation */66666767typedef struct acpi_fadt_info {6868- char *name;6868+ const char *name;6969 u16 address64;7070 u16 address32;7171 u16 length;···192192acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,193193 u8 space_id,194194 u8 byte_width,195195- u64 address, char *register_name, u8 flags)195195+ u64 address, const char *register_name, u8 flags)196196{197197 u8 bit_width;198198···344344345345 /* Obtain the DSDT and FACS tables via their addresses within the FADT */346346347347- acpi_tb_install_fixed_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt,347347+ acpi_tb_install_fixed_table((acpi_physical_address)acpi_gbl_FADT.Xdsdt,348348 ACPI_SIG_DSDT, &acpi_gbl_dsdt_index);349349350350 /* If Hardware Reduced flag is set, there is no FACS */···385385{386386 /*387387 * Check if the FADT is larger than the largest table that we expect388388- * (the ACPI 5.0 version). If so, truncate the table, and issue389389- * a warning.388388+ * (typically the current ACPI specification version). If so, truncate389389+ * the table, and issue a warning.390390 */391391 if (length > sizeof(struct acpi_table_fadt)) {392392 ACPI_BIOS_WARNING((AE_INFO,393393- "FADT (revision %u) is longer than ACPI 5.0 version, "393393+ "FADT (revision %u) is longer than %s length, "394394 "truncating length %u to %u",395395- table->revision, length,395395+ table->revision, ACPI_FADT_CONFORMANCE,396396+ length,396397 (u32)sizeof(struct acpi_table_fadt)));397398 }398399···468467469468static void acpi_tb_convert_fadt(void)470469{471471- char *name;470470+ const char *name;472471 struct acpi_generic_address *address64;473472 u32 address32;474473 u8 length;···647646 if ((address64->address && !length) ||648647 (!address64->address && length)) {649648 ACPI_BIOS_WARNING((AE_INFO,650650- "Optional FADT field %s has zero address or length: "651651- "0x%8.8X%8.8X/0x%X",652652- name,649649+ "Optional FADT field %s has valid %s but zero %s: "650650+ "0x%8.8X%8.8X/0x%X", name,651651+ (length ? "Length" :652652+ "Address"),653653+ (length ? "Address" :654654+ "Length"),653655 ACPI_FORMAT_UINT64654656 (address64->address),655657 length));
+1-1
drivers/acpi/acpica/tbfind.c
···76767777 /* Validate the input table signature */78787979- if (!acpi_is_valid_signature(signature)) {7979+ if (!acpi_ut_valid_nameseg(signature)) {8080 return_ACPI_STATUS(AE_BAD_SIGNATURE);8181 }8282
+3-3
drivers/acpi/acpica/tbinstal.c
···299299 ACPI_BIOS_ERROR((AE_INFO,300300 "Table has invalid signature [%4.4s] (0x%8.8X), "301301 "must be SSDT or OEMx",302302- acpi_ut_valid_acpi_name(new_table_desc.303303- signature.304304- ascii) ?302302+ acpi_ut_valid_nameseg(new_table_desc.303303+ signature.304304+ ascii) ?305305 new_table_desc.signature.306306 ascii : "????",307307 new_table_desc.signature.integer));
+3-30
drivers/acpi/acpica/tbutils.c
···231231 ACPI_FORMAT_UINT64(address64)));232232 }233233#endif234234- return ((acpi_physical_address) (address64));234234+ return ((acpi_physical_address)(address64));235235 }236236}237237···287287 * the XSDT if the revision is > 1 and the XSDT pointer is present,288288 * as per the ACPI specification.289289 */290290- address = (acpi_physical_address) rsdp->xsdt_physical_address;290290+ address = (acpi_physical_address)rsdp->xsdt_physical_address;291291 table_entry_size = ACPI_XSDT_ENTRY_SIZE;292292 } else {293293 /* Root table is an RSDT (32-bit physical addresses) */294294295295- address = (acpi_physical_address) rsdp->rsdt_physical_address;295295+ address = (acpi_physical_address)rsdp->rsdt_physical_address;296296 table_entry_size = ACPI_RSDT_ENTRY_SIZE;297297 }298298···379379380380 acpi_os_unmap_memory(table, length);381381 return_ACPI_STATUS(AE_OK);382382-}383383-384384-/*******************************************************************************385385- *386386- * FUNCTION: acpi_is_valid_signature387387- *388388- * PARAMETERS: signature - Sig string to be validated389389- *390390- * RETURN: TRUE if signature is has 4 valid ACPI characters391391- *392392- * DESCRIPTION: Validate an ACPI table signature.393393- *394394- ******************************************************************************/395395-396396-u8 acpi_is_valid_signature(char *signature)397397-{398398- u32 i;399399-400400- /* Validate each character in the signature */401401-402402- for (i = 0; i < ACPI_NAME_SIZE; i++) {403403- if (!acpi_ut_valid_acpi_char(signature[i], i)) {404404- return (FALSE);405405- }406406- }407407-408408- return (TRUE);409382}
···8282 * their customized default region handlers.8383 */8484 status = acpi_ev_install_region_handlers();8585- if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) {8585+ if (ACPI_FAILURE(status)) {8686 ACPI_EXCEPTION((AE_INFO, status,8787 "During Region initialization"));8888 return_ACPI_STATUS(status);
···11+/******************************************************************************22+ *33+ * Module Name: utascii - Utility ascii functions44+ *55+ *****************************************************************************/66+77+/*88+ * Copyright (C) 2000 - 2016, Intel Corp.99+ * All rights reserved.1010+ *1111+ * Redistribution and use in source and binary forms, with or without1212+ * modification, are permitted provided that the following conditions1313+ * are met:1414+ * 1. Redistributions of source code must retain the above copyright1515+ * notice, this list of conditions, and the following disclaimer,1616+ * without modification.1717+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer1818+ * substantially similar to the "NO WARRANTY" disclaimer below1919+ * ("Disclaimer") and any redistribution must be conditioned upon2020+ * including a substantially similar Disclaimer requirement for further2121+ * binary redistribution.2222+ * 3. Neither the names of the above-listed copyright holders nor the names2323+ * of any contributors may be used to endorse or promote products derived2424+ * from this software without specific prior written permission.2525+ *2626+ * Alternatively, this software may be distributed under the terms of the2727+ * GNU General Public License ("GPL") version 2 as published by the Free2828+ * Software Foundation.2929+ *3030+ * NO WARRANTY3131+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS3232+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT3333+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR3434+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT3535+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL3636+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS3737+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)3838+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,3939+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING4040+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE4141+ * POSSIBILITY OF SUCH DAMAGES.4242+ */4343+4444+#include <acpi/acpi.h>4545+#include "accommon.h"4646+4747+/*******************************************************************************4848+ *4949+ * FUNCTION: acpi_ut_valid_nameseg5050+ *5151+ * PARAMETERS: name - The name or table signature to be examined.5252+ * Four characters, does not have to be a5353+ * NULL terminated string.5454+ *5555+ * RETURN: TRUE if signature is has 4 valid ACPI characters5656+ *5757+ * DESCRIPTION: Validate an ACPI table signature.5858+ *5959+ ******************************************************************************/6060+6161+u8 acpi_ut_valid_nameseg(char *name)6262+{6363+ u32 i;6464+6565+ /* Validate each character in the signature */6666+6767+ for (i = 0; i < ACPI_NAME_SIZE; i++) {6868+ if (!acpi_ut_valid_name_char(name[i], i)) {6969+ return (FALSE);7070+ }7171+ }7272+7373+ return (TRUE);7474+}7575+7676+/*******************************************************************************7777+ *7878+ * FUNCTION: acpi_ut_valid_name_char7979+ *8080+ * PARAMETERS: char - The character to be examined8181+ * position - Byte position (0-3)8282+ *8383+ * RETURN: TRUE if the character is valid, FALSE otherwise8484+ *8585+ * DESCRIPTION: Check for a valid ACPI character. Must be one of:8686+ * 1) Upper case alpha8787+ * 2) numeric8888+ * 3) underscore8989+ *9090+ * We allow a '!' as the last character because of the ASF! table9191+ *9292+ ******************************************************************************/9393+9494+u8 acpi_ut_valid_name_char(char character, u32 position)9595+{9696+9797+ if (!((character >= 'A' && character <= 'Z') ||9898+ (character >= '0' && character <= '9') || (character == '_'))) {9999+100100+ /* Allow a '!' in the last position */101101+102102+ if (character == '!' && position == 3) {103103+ return (TRUE);104104+ }105105+106106+ return (FALSE);107107+ }108108+109109+ return (TRUE);110110+}111111+112112+/*******************************************************************************113113+ *114114+ * FUNCTION: acpi_ut_check_and_repair_ascii115115+ *116116+ * PARAMETERS: name - Ascii string117117+ * count - Number of characters to check118118+ *119119+ * RETURN: None120120+ *121121+ * DESCRIPTION: Ensure that the requested number of characters are printable122122+ * Ascii characters. Sets non-printable and null chars to <space>.123123+ *124124+ ******************************************************************************/125125+126126+void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count)127127+{128128+ u32 i;129129+130130+ for (i = 0; i < count; i++) {131131+ repaired_name[i] = (char)name[i];132132+133133+ if (!name[i]) {134134+ return;135135+ }136136+ if (!isprint(name[i])) {137137+ repaired_name[i] = ' ';138138+ }139139+ }140140+}
+12-12
drivers/acpi/acpica/utbuffer.c
···106106 default: /* Default is BYTE display */107107108108 acpi_os_printf("%02X ",109109- buffer[(acpi_size) i + j]);109109+ buffer[(acpi_size)i + j]);110110 break;111111112112 case DB_WORD_DISPLAY:113113114114 ACPI_MOVE_16_TO_32(&temp32,115115- &buffer[(acpi_size) i + j]);115115+ &buffer[(acpi_size)i + j]);116116 acpi_os_printf("%04X ", temp32);117117 break;118118119119 case DB_DWORD_DISPLAY:120120121121 ACPI_MOVE_32_TO_32(&temp32,122122- &buffer[(acpi_size) i + j]);122122+ &buffer[(acpi_size)i + j]);123123 acpi_os_printf("%08X ", temp32);124124 break;125125126126 case DB_QWORD_DISPLAY:127127128128 ACPI_MOVE_32_TO_32(&temp32,129129- &buffer[(acpi_size) i + j]);129129+ &buffer[(acpi_size)i + j]);130130 acpi_os_printf("%08X", temp32);131131132132 ACPI_MOVE_32_TO_32(&temp32,133133- &buffer[(acpi_size) i + j +133133+ &buffer[(acpi_size)i + j +134134 4]);135135 acpi_os_printf("%08X ", temp32);136136 break;···158158 acpi_os_printf("// ");159159 }160160161161- buf_char = buffer[(acpi_size) i + j];161161+ buf_char = buffer[(acpi_size)i + j];162162 if (isprint(buf_char)) {163163 acpi_os_printf("%c", buf_char);164164 } else {···274274 default: /* Default is BYTE display */275275276276 acpi_ut_file_printf(file, "%02X ",277277- buffer[(acpi_size) i + j]);277277+ buffer[(acpi_size)i + j]);278278 break;279279280280 case DB_WORD_DISPLAY:281281282282 ACPI_MOVE_16_TO_32(&temp32,283283- &buffer[(acpi_size) i + j]);283283+ &buffer[(acpi_size)i + j]);284284 acpi_ut_file_printf(file, "%04X ", temp32);285285 break;286286287287 case DB_DWORD_DISPLAY:288288289289 ACPI_MOVE_32_TO_32(&temp32,290290- &buffer[(acpi_size) i + j]);290290+ &buffer[(acpi_size)i + j]);291291 acpi_ut_file_printf(file, "%08X ", temp32);292292 break;293293294294 case DB_QWORD_DISPLAY:295295296296 ACPI_MOVE_32_TO_32(&temp32,297297- &buffer[(acpi_size) i + j]);297297+ &buffer[(acpi_size)i + j]);298298 acpi_ut_file_printf(file, "%08X", temp32);299299300300 ACPI_MOVE_32_TO_32(&temp32,301301- &buffer[(acpi_size) i + j +301301+ &buffer[(acpi_size)i + j +302302 4]);303303 acpi_ut_file_printf(file, "%08X ", temp32);304304 break;···318318 return;319319 }320320321321- buf_char = buffer[(acpi_size) i + j];321321+ buf_char = buffer[(acpi_size)i + j];322322 if (isprint(buf_char)) {323323 acpi_ut_file_printf(file, "%c", buf_char);324324 } else {
···205205 *206206 * FUNCTION: acpi_ut_strtoul64207207 *208208- * PARAMETERS: string - Null terminated string209209- * base - Radix of the string: 16 or ACPI_ANY_BASE;210210- * ACPI_ANY_BASE means 'in behalf of to_integer'211211- * ret_integer - Where the converted integer is returned208208+ * PARAMETERS: string - Null terminated string209209+ * base - Radix of the string: 16 or 10 or210210+ * ACPI_ANY_BASE211211+ * max_integer_byte_width - Maximum allowable integer,in bytes:212212+ * 4 or 8 (32 or 64 bits)213213+ * ret_integer - Where the converted integer is214214+ * returned212215 *213216 * RETURN: Status and Converted value214217 *215218 * DESCRIPTION: Convert a string into an unsigned value. Performs either a216216- * 32-bit or 64-bit conversion, depending on the current mode217217- * of the interpreter.219219+ * 32-bit or 64-bit conversion, depending on the input integer220220+ * size (often the current mode of the interpreter).218221 *219219- * NOTES: acpi_gbl_integer_byte_width should be set to the proper width.222222+ * NOTES: Negative numbers are not supported, as they are not supported223223+ * by ACPI.224224+ *225225+ * acpi_gbl_integer_byte_width should be set to the proper width.220226 * For the core ACPICA code, this width depends on the DSDT221221- * version. For iASL, the default byte width is always 8.227227+ * version. For iASL, the default byte width is always 8 for the228228+ * parser, but error checking is performed later to flag cases229229+ * where a 64-bit constant is defined in a 32-bit DSDT/SSDT.222230 *223231 * Does not support Octal strings, not needed at this time.224232 *225225- * There is an earlier version of the function after this one,226226- * below. It is slightly different than this one, and the two227227- * may eventually may need to be merged. (01/2016).228228- *229233 ******************************************************************************/230234231231-acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)235235+acpi_status236236+acpi_ut_strtoul64(char *string,237237+ u32 base, u32 max_integer_byte_width, u64 *ret_integer)232238{233239 u32 this_digit = 0;234240 u64 return_value = 0;235241 u64 quotient;236242 u64 dividend;237237- u32 to_integer_op = (base == ACPI_ANY_BASE);238238- u32 mode32 = (acpi_gbl_integer_byte_width == 4);239243 u8 valid_digits = 0;240244 u8 sign_of0x = 0;241245 u8 term = 0;···248244249245 switch (base) {250246 case ACPI_ANY_BASE:247247+ case 10:251248 case 16:252249253250 break;···270265 string++;271266 }272267273273- if (to_integer_op) {268268+ if (base == ACPI_ANY_BASE) {274269 /*275275- * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.270270+ * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.276271 * We need to determine if it is decimal or hexadecimal.277272 */278273 if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {···289284 /* Any string left? Check that '0x' is not followed by white space. */290285291286 if (!(*string) || isspace((int)*string) || *string == '\t') {292292- if (to_integer_op) {287287+ if (base == ACPI_ANY_BASE) {293288 goto error_exit;294289 } else {295290 goto all_done;···297292 }298293299294 /*300300- * Perform a 32-bit or 64-bit conversion, depending upon the current301301- * execution mode of the interpreter295295+ * Perform a 32-bit or 64-bit conversion, depending upon the input296296+ * byte width302297 */303303- dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;298298+ dividend = (max_integer_byte_width <= ACPI_MAX32_BYTE_WIDTH) ?299299+ ACPI_UINT32_MAX : ACPI_UINT64_MAX;304300305301 /* Main loop: convert the string to a 32- or 64-bit integer */306302···329323 }330324331325 if (term) {332332- if (to_integer_op) {326326+ if (base == ACPI_ANY_BASE) {333327 goto error_exit;334328 } else {335329 break;···344338345339 valid_digits++;346340347347- if (sign_of0x348348- && ((valid_digits > 16)349349- || ((valid_digits > 8) && mode32))) {341341+ if (sign_of0x && ((valid_digits > 16) ||342342+ ((valid_digits > 8)343343+ && (max_integer_byte_width <=344344+ ACPI_MAX32_BYTE_WIDTH)))) {350345 /*351346 * This is to_integer operation case.352352- * No any restrictions for string-to-integer conversion,347347+ * No restrictions for string-to-integer conversion,353348 * see ACPI spec.354349 */355350 goto error_exit;···362355 "ient, NULL);363356364357 if (return_value > quotient) {365365- if (to_integer_op) {358358+ if (base == ACPI_ANY_BASE) {366359 goto error_exit;367360 } else {368361 break;···385378 return_ACPI_STATUS(AE_OK);386379387380error_exit:388388- /* Base was set/validated above */381381+382382+ /* Base was set/validated above (10 or 16) */389383390384 if (base == 10) {391385 return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);···396388}397389398390#ifdef _OBSOLETE_FUNCTIONS399399-/* TBD: use version in ACPICA main code base? */400400-/* DONE: 01/2016 */391391+/* Removed: 01/2016 */401392402393/*******************************************************************************403394 *
···67676868static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper);69697070-/* Module globals */7171-7272-static const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";7373-static const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";7474-7570/*******************************************************************************7671 *7772 * FUNCTION: acpi_ut_bound_string_length···264269265270 sign = '\0';266271 if (type & ACPI_FORMAT_SIGN) {267267- if ((s64) number < 0) {272272+ if ((s64)number < 0) {268273 sign = '-';269269- number = -(s64) number;274274+ number = -(s64)number;270275 width--;271276 } else if (type & ACPI_FORMAT_SIGN_PLUS) {272277 sign = '+';···404409 width = -1;405410 if (isdigit((int)*format)) {406411 format = acpi_ut_scan_number(format, &number);407407- width = (s32) number;412412+ width = (s32)number;408413 } else if (*format == '*') {409414 ++format;410415 width = va_arg(args, int);···421426 ++format;422427 if (isdigit((int)*format)) {423428 format = acpi_ut_scan_number(format, &number);424424- precision = (s32) number;429429+ precision = (s32)number;425430 } else if (*format == '*') {426431 ++format;427432 precision = va_arg(args, int);···550555 if (qualifier == 'L') {551556 number = va_arg(args, u64);552557 if (type & ACPI_FORMAT_SIGN) {553553- number = (s64) number;558558+ number = (s64)number;554559 }555560 } else if (qualifier == 'l') {556561 number = va_arg(args, unsigned long);557562 if (type & ACPI_FORMAT_SIGN) {558558- number = (s32) number;563563+ number = (s32)number;559564 }560565 } else if (qualifier == 'h') {561566 number = (u16)va_arg(args, int);562567 if (type & ACPI_FORMAT_SIGN) {563563- number = (s16) number;568568+ number = (s16)number;564569 }565570 } else {566571 number = va_arg(args, unsigned int);
+2-69
drivers/acpi/acpica/utstring.c
···130130 } else {131131 /* All others will be Hex escapes */132132133133- acpi_os_printf("\\x%2.2X", (s32) string[i]);133133+ acpi_os_printf("\\x%2.2X", (s32)string[i]);134134 }135135 break;136136 }···141141 if (i == max_length && string[i]) {142142 acpi_os_printf("...");143143 }144144-}145145-146146-/*******************************************************************************147147- *148148- * FUNCTION: acpi_ut_valid_acpi_char149149- *150150- * PARAMETERS: char - The character to be examined151151- * position - Byte position (0-3)152152- *153153- * RETURN: TRUE if the character is valid, FALSE otherwise154154- *155155- * DESCRIPTION: Check for a valid ACPI character. Must be one of:156156- * 1) Upper case alpha157157- * 2) numeric158158- * 3) underscore159159- *160160- * We allow a '!' as the last character because of the ASF! table161161- *162162- ******************************************************************************/163163-164164-u8 acpi_ut_valid_acpi_char(char character, u32 position)165165-{166166-167167- if (!((character >= 'A' && character <= 'Z') ||168168- (character >= '0' && character <= '9') || (character == '_'))) {169169-170170- /* Allow a '!' in the last position */171171-172172- if (character == '!' && position == 3) {173173- return (TRUE);174174- }175175-176176- return (FALSE);177177- }178178-179179- return (TRUE);180180-}181181-182182-/*******************************************************************************183183- *184184- * FUNCTION: acpi_ut_valid_acpi_name185185- *186186- * PARAMETERS: name - The name to be examined. Does not have to187187- * be NULL terminated string.188188- *189189- * RETURN: TRUE if the name is valid, FALSE otherwise190190- *191191- * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:192192- * 1) Upper case alpha193193- * 2) numeric194194- * 3) underscore195195- *196196- ******************************************************************************/197197-198198-u8 acpi_ut_valid_acpi_name(char *name)199199-{200200- u32 i;201201-202202- ACPI_FUNCTION_ENTRY();203203-204204- for (i = 0; i < ACPI_NAME_SIZE; i++) {205205- if (!acpi_ut_valid_acpi_char(name[i], i)) {206206- return (FALSE);207207- }208208- }209209-210210- return (TRUE);211144}212145213146/*******************************************************************************···186253 /* Check each character in the name */187254188255 for (i = 0; i < ACPI_NAME_SIZE; i++) {189189- if (acpi_ut_valid_acpi_char(name[i], i)) {256256+ if (acpi_ut_valid_name_char(name[i], i)) {190257 continue;191258 }192259
···11-/******************************************************************************22- *33- * Name: acmsvcex.h - Extra VC specific defines, etc.44- *55- *****************************************************************************/66-77-/*88- * Copyright (C) 2000 - 2016, Intel Corp.99- * All rights reserved.1010- *1111- * Redistribution and use in source and binary forms, with or without1212- * modification, are permitted provided that the following conditions1313- * are met:1414- * 1. Redistributions of source code must retain the above copyright1515- * notice, this list of conditions, and the following disclaimer,1616- * without modification.1717- * 2. Redistributions in binary form must reproduce at minimum a disclaimer1818- * substantially similar to the "NO WARRANTY" disclaimer below1919- * ("Disclaimer") and any redistribution must be conditioned upon2020- * including a substantially similar Disclaimer requirement for further2121- * binary redistribution.2222- * 3. Neither the names of the above-listed copyright holders nor the names2323- * of any contributors may be used to endorse or promote products derived2424- * from this software without specific prior written permission.2525- *2626- * Alternatively, this software may be distributed under the terms of the2727- * GNU General Public License ("GPL") version 2 as published by the Free2828- * Software Foundation.2929- *3030- * NO WARRANTY3131- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS3232- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT3333- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR3434- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT3535- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL3636- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS3737- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)3838- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,3939- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING4040- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE4141- * POSSIBILITY OF SUCH DAMAGES.4242- */4343-4444-#ifndef __ACMSVCEX_H__4545-#define __ACMSVCEX_H__4646-4747-/* Debug support. */4848-4949-#ifdef _DEBUG5050-#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */5151-#include <crtdbg.h>5252-#endif5353-5454-#endif /* __ACMSVCEX_H__ */
-49
include/acpi/platform/acwinex.h
···11-/******************************************************************************22- *33- * Name: acwinex.h - Extra OS specific defines, etc.44- *55- *****************************************************************************/66-77-/*88- * Copyright (C) 2000 - 2016, Intel Corp.99- * All rights reserved.1010- *1111- * Redistribution and use in source and binary forms, with or without1212- * modification, are permitted provided that the following conditions1313- * are met:1414- * 1. Redistributions of source code must retain the above copyright1515- * notice, this list of conditions, and the following disclaimer,1616- * without modification.1717- * 2. Redistributions in binary form must reproduce at minimum a disclaimer1818- * substantially similar to the "NO WARRANTY" disclaimer below1919- * ("Disclaimer") and any redistribution must be conditioned upon2020- * including a substantially similar Disclaimer requirement for further2121- * binary redistribution.2222- * 3. Neither the names of the above-listed copyright holders nor the names2323- * of any contributors may be used to endorse or promote products derived2424- * from this software without specific prior written permission.2525- *2626- * Alternatively, this software may be distributed under the terms of the2727- * GNU General Public License ("GPL") version 2 as published by the Free2828- * Software Foundation.2929- *3030- * NO WARRANTY3131- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS3232- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT3333- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR3434- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT3535- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL3636- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS3737- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)3838- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,3939- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING4040- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE4141- * POSSIBILITY OF SUCH DAMAGES.4242- */4343-4444-#ifndef __ACWINEX_H__4545-#define __ACWINEX_H__4646-4747-/* Windows uses VC */4848-4949-#endif /* __ACWINEX_H__ */
···68686969 /* Make sure signature is all ASCII and a valid ACPI name */70707171- if (!acpi_ut_valid_acpi_name(table->signature)) {7171+ if (!acpi_ut_valid_nameseg(table->signature)) {7272 acpi_log_error("Table signature (0x%8.8X) is invalid\n",7373 *(u32 *)table->signature);7474 return (FALSE);···286286287287 /* Convert argument to an integer physical address */288288289289- status = acpi_ut_strtoul64(ascii_address, 0, &long_address);289289+ status = acpi_ut_strtoul64(ascii_address, ACPI_ANY_BASE,290290+ ACPI_MAX64_BYTE_WIDTH, &long_address);290291 if (ACPI_FAILURE(status)) {291292 acpi_log_error("%s: Could not convert to a physical address\n",292293 ascii_address);293294 return (-1);294295 }295296296296- address = (acpi_physical_address) long_address;297297+ address = (acpi_physical_address)long_address;297298 status = acpi_os_get_table_by_address(address, &table);298299 if (ACPI_FAILURE(status)) {299300 acpi_log_error("Could not get table at 0x%8.8X%8.8X, %s\n",···405404 table = ap_get_table_from_file(pathname, &file_size);406405 if (!table) {407406 return (-1);407407+ }408408+409409+ if (!acpi_ut_valid_nameseg(table->signature)) {410410+ acpi_log_error411411+ ("No valid ACPI signature was found in input file %s\n",412412+ pathname);408413 }409414410415 /* File must be at least as long as the table length */
+2-1
tools/power/acpi/tools/acpidump/apmain.c
···209209 case 'r': /* Dump tables from specified RSDP */210210211211 status =212212- acpi_ut_strtoul64(acpi_gbl_optarg, 0,212212+ acpi_ut_strtoul64(acpi_gbl_optarg, ACPI_ANY_BASE,213213+ ACPI_MAX64_BYTE_WIDTH,213214 &gbl_rsdp_base);214215 if (ACPI_FAILURE(status)) {215216 acpi_log_error