diff options
Diffstat (limited to 'sys/contrib/dev/acpica/components/resources/rsutils.c')
-rw-r--r-- | sys/contrib/dev/acpica/components/resources/rsutils.c | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/sys/contrib/dev/acpica/components/resources/rsutils.c b/sys/contrib/dev/acpica/components/resources/rsutils.c index c0e7b78..a3a7ed3 100644 --- a/sys/contrib/dev/acpica/components/resources/rsutils.c +++ b/sys/contrib/dev/acpica/components/resources/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -174,7 +174,7 @@ AcpiRsMoveData ( case ACPI_RSC_MOVE_SERIAL_VEN: case ACPI_RSC_MOVE_SERIAL_RES: - ACPI_MEMCPY (Destination, Source, ItemCount); + memcpy (Destination, Source, ItemCount); return; /* @@ -185,20 +185,23 @@ AcpiRsMoveData ( case ACPI_RSC_MOVE16: case ACPI_RSC_MOVE_GPIO_PIN: - ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i], - &ACPI_CAST_PTR (UINT16, Source)[i]); + ACPI_MOVE_16_TO_16 ( + &ACPI_CAST_PTR (UINT16, Destination)[i], + &ACPI_CAST_PTR (UINT16, Source)[i]); break; case ACPI_RSC_MOVE32: - ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i], - &ACPI_CAST_PTR (UINT32, Source)[i]); + ACPI_MOVE_32_TO_32 ( + &ACPI_CAST_PTR (UINT32, Destination)[i], + &ACPI_CAST_PTR (UINT32, Source)[i]); break; case ACPI_RSC_MOVE64: - ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i], - &ACPI_CAST_PTR (UINT64, Source)[i]); + ACPI_MOVE_64_TO_64 ( + &ACPI_CAST_PTR (UINT64, Destination)[i], + &ACPI_CAST_PTR (UINT64, Source)[i]); break; default: @@ -248,18 +251,18 @@ AcpiRsSetResourceLength ( { /* Large descriptor -- bytes 1-2 contain the 16-bit length */ - ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength); + ACPI_MOVE_16_TO_16 ( + &Aml->LargeHeader.ResourceLength, &ResourceLength); } else { - /* Small descriptor -- bits 2:0 of byte 0 contain the length */ - + /* + * Small descriptor -- bits 2:0 of byte 0 contain the length + * Clear any existing length, preserving descriptor type bits + */ Aml->SmallHeader.DescriptorType = (UINT8) - - /* Clear any existing length, preserving descriptor type bits */ - - ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - + ((Aml->SmallHeader.DescriptorType & + ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) | ResourceLength); } } @@ -378,8 +381,8 @@ AcpiRsGetResourceSource ( AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength); /* - * ResourceSource is present if the length of the descriptor is longer than - * the minimum length. + * ResourceSource is present if the length of the descriptor is longer + * than the minimum length. * * Note: Some resource descriptors will have an additional null, so * we add 1 to the minimum length. @@ -397,8 +400,8 @@ AcpiRsGetResourceSource ( * String destination pointer is not specified; Set the String * pointer to the end of the current ResourceSource structure. */ - ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource, - sizeof (ACPI_RESOURCE_SOURCE)); + ResourceSource->StringPtr = ACPI_ADD_PTR ( + char, ResourceSource, sizeof (ACPI_RESOURCE_SOURCE)); } /* @@ -408,15 +411,17 @@ AcpiRsGetResourceSource ( * * Zero the entire area of the buffer. */ - TotalLength = (UINT32) ACPI_STRLEN ( + TotalLength = (UINT32) strlen ( ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1; + TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength); - ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength); + memset (ResourceSource->StringPtr, 0, TotalLength); /* Copy the ResourceSource string to the destination */ - ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr, + ResourceSource->StringLength = AcpiRsStrcpy ( + ResourceSource->StringPtr, ACPI_CAST_PTR (char, &AmlResourceSource[1])); return ((ACPI_RS_LENGTH) TotalLength); @@ -477,14 +482,15 @@ AcpiRsSetResourceSource ( /* Copy the ResourceSource string */ - ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]), + strcpy (ACPI_CAST_PTR (char, &AmlResourceSource[1]), ResourceSource->StringPtr); /* * Add the length of the string (+ 1 for null terminator) to the * final descriptor length */ - DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1); + DescriptorLength += ((ACPI_RSDESC_SIZE) + ResourceSource->StringLength + 1); } /* Return the new total length of the AML descriptor */ @@ -527,8 +533,8 @@ AcpiRsGetPrtMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT, - ACPI_BTYPE_PACKAGE, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -581,8 +587,8 @@ AcpiRsGetCrsMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -636,8 +642,8 @@ AcpiRsGetPrsMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -691,8 +697,8 @@ AcpiRsGetAeiMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -734,7 +740,7 @@ AcpiRsGetAeiMethodData ( ACPI_STATUS AcpiRsGetMethodData ( ACPI_HANDLE Handle, - char *Path, + const char *Path, ACPI_BUFFER *RetBuffer) { ACPI_OPERAND_OBJECT *ObjDesc; @@ -748,7 +754,8 @@ AcpiRsGetMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), + Status = AcpiUtEvaluateObject ( + ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), Path, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { |