diff options
author | marks <marks@FreeBSD.org> | 2004-12-01 23:14:10 +0000 |
---|---|---|
committer | marks <marks@FreeBSD.org> | 2004-12-01 23:14:10 +0000 |
commit | 93c2522130390c12e9ae98f3278c17f381a0db90 (patch) | |
tree | 4910f03edb15ce309eeb1b58facc922df30dd767 /sys/contrib/dev/acpica/utobject.c | |
parent | f84f460530aa9bde251160a8ebad4c1048e94251 (diff) | |
download | FreeBSD-src-93c2522130390c12e9ae98f3278c17f381a0db90.zip FreeBSD-src-93c2522130390c12e9ae98f3278c17f381a0db90.tar.gz |
Vendor import of Intel ACPI-CA 20041119
Diffstat (limited to 'sys/contrib/dev/acpica/utobject.c')
-rw-r--r-- | sys/contrib/dev/acpica/utobject.c | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index f9e4283..5965891 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 86 $ + * $Revision: 90 $ * *****************************************************************************/ @@ -232,9 +232,8 @@ AcpiUtCreateBufferObject ( ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize); - /* - * Create a new Buffer object - */ + /* Create a new Buffer object */ + BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!BufferDesc) { @@ -271,6 +270,63 @@ AcpiUtCreateBufferObject ( /******************************************************************************* * + * FUNCTION: AcpiUtCreateStringObject + * + * PARAMETERS: StringSize - Size of string to be created. Does not + * include NULL terminator, this is added + * automatically. + * + * RETURN: Pointer to a new String object + * + * DESCRIPTION: Create a fully initialized string object + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiUtCreateStringObject ( + ACPI_SIZE StringSize) +{ + ACPI_OPERAND_OBJECT *StringDesc; + char *String; + + + ACPI_FUNCTION_TRACE_U32 ("UtCreateStringObject", StringSize); + + + /* Create a new String object */ + + StringDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); + if (!StringDesc) + { + return_PTR (NULL); + } + + /* + * Allocate the actual string buffer -- (Size + 1) for NULL terminator. + * NOTE: Zero-length strings are NULL terminated + */ + String = ACPI_MEM_CALLOCATE (StringSize + 1); + if (!String) + { + ACPI_REPORT_ERROR (("CreateString: could not allocate size %X\n", + (UINT32) StringSize)); + AcpiUtRemoveReference (StringDesc); + return_PTR (NULL); + } + + /* Complete string object initialization */ + + StringDesc->String.Pointer = String; + StringDesc->String.Length = (UINT32) StringSize; + + /* Return the new string descriptor */ + + return_PTR (StringDesc); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtValidInternalObject * * PARAMETERS: Object - Object to be validated |