ReactOS  0.4.15-dev-1201-gb2cf5a4
nsutils.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "amlcode.h"
Include dependency graph for nsutils.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_NAMESPACE
 

Functions

void AcpiNsPrintNodePathname (ACPI_NAMESPACE_NODE *Node, const char *Message)
 
ACPI_OBJECT_TYPE AcpiNsGetType (ACPI_NAMESPACE_NODE *Node)
 
UINT32 AcpiNsLocal (ACPI_OBJECT_TYPE Type)
 
void AcpiNsGetInternalNameLength (ACPI_NAMESTRING_INFO *Info)
 
ACPI_STATUS AcpiNsBuildInternalName (ACPI_NAMESTRING_INFO *Info)
 
ACPI_STATUS AcpiNsInternalizeName (const char *ExternalName, char **ConvertedName)
 
ACPI_STATUS AcpiNsExternalizeName (UINT32 InternalNameLength, const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName)
 
ACPI_NAMESPACE_NODEAcpiNsValidateHandle (ACPI_HANDLE Handle)
 
void AcpiNsTerminate (void)
 
UINT32 AcpiNsOpensScope (ACPI_OBJECT_TYPE Type)
 
ACPI_STATUS AcpiNsGetNodeUnlocked (ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode)
 
ACPI_STATUS AcpiNsGetNode (ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_NAMESPACE

Definition at line 50 of file nsutils.c.

Function Documentation

◆ AcpiNsBuildInternalName()

ACPI_STATUS AcpiNsBuildInternalName ( ACPI_NAMESTRING_INFO Info)

Definition at line 267 of file nsutils.c.

269 {
270  UINT32 NumSegments = Info->NumSegments;
271  char *InternalName = Info->InternalName;
272  const char *ExternalName = Info->NextExternalChar;
273  char *Result = NULL;
274  UINT32 i;
275 
276 
277  ACPI_FUNCTION_TRACE (NsBuildInternalName);
278 
279 
280  /* Setup the correct prefixes, counts, and pointers */
281 
282  if (Info->FullyQualified)
283  {
284  InternalName[0] = AML_ROOT_PREFIX;
285 
286  if (NumSegments <= 1)
287  {
288  Result = &InternalName[1];
289  }
290  else if (NumSegments == 2)
291  {
292  InternalName[1] = AML_DUAL_NAME_PREFIX;
293  Result = &InternalName[2];
294  }
295  else
296  {
297  InternalName[1] = AML_MULTI_NAME_PREFIX;
298  InternalName[2] = (char) NumSegments;
299  Result = &InternalName[3];
300  }
301  }
302  else
303  {
304  /*
305  * Not fully qualified.
306  * Handle Carats first, then append the name segments
307  */
308  i = 0;
309  if (Info->NumCarats)
310  {
311  for (i = 0; i < Info->NumCarats; i++)
312  {
313  InternalName[i] = AML_PARENT_PREFIX;
314  }
315  }
316 
317  if (NumSegments <= 1)
318  {
319  Result = &InternalName[i];
320  }
321  else if (NumSegments == 2)
322  {
323  InternalName[i] = AML_DUAL_NAME_PREFIX;
324  Result = &InternalName[(ACPI_SIZE) i+1];
325  }
326  else
327  {
328  InternalName[i] = AML_MULTI_NAME_PREFIX;
329  InternalName[(ACPI_SIZE) i+1] = (char) NumSegments;
330  Result = &InternalName[(ACPI_SIZE) i+2];
331  }
332  }
333 
334  /* Build the name (minus path separators) */
335 
336  for (; NumSegments; NumSegments--)
337  {
338  for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
339  {
340  if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
341  (*ExternalName == 0))
342  {
343  /* Pad the segment with underscore(s) if segment is short */
344 
345  Result[i] = '_';
346  }
347  else
348  {
349  /* Convert the character to uppercase and save it */
350 
351  Result[i] = (char) toupper ((int) *ExternalName);
352  ExternalName++;
353  }
354  }
355 
356  /* Now we must have a path separator, or the pathname is bad */
357 
358  if (!ACPI_IS_PATH_SEPARATOR (*ExternalName) &&
359  (*ExternalName != 0))
360  {
362  }
363 
364  /* Move on the next segment */
365 
366  ExternalName++;
368  }
369 
370  /* Terminate the string */
371 
372  *Result = 0;
373 
374  if (Info->FullyQualified)
375  {
376  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
377  InternalName, InternalName));
378  }
379  else
380  {
381  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
382  InternalName, InternalName));
383  }
384 
386 }
struct TraceInfo Info
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ACPI_IS_PATH_SEPARATOR(c)
Definition: acmacros.h:403
unsigned int UINT32
#define AE_BAD_PATHNAME
Definition: acexcep.h:153
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
int toupper(int c)
Definition: utclib.c:881
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsInternalizeName().

◆ AcpiNsExternalizeName()

ACPI_STATUS AcpiNsExternalizeName ( UINT32  InternalNameLength,
const char InternalName,
UINT32 ConvertedNameLength,
char **  ConvertedName 
)

Definition at line 470 of file nsutils.c.

475 {
476  UINT32 NamesIndex = 0;
477  UINT32 NumSegments = 0;
479  UINT32 PrefixLength = 0;
480  UINT32 i = 0;
481  UINT32 j = 0;
482 
483 
484  ACPI_FUNCTION_TRACE (NsExternalizeName);
485 
486 
487  if (!InternalNameLength ||
488  !InternalName ||
489  !ConvertedName)
490  {
492  }
493 
494  /* Check for a prefix (one '\' | one or more '^') */
495 
496  switch (InternalName[0])
497  {
498  case AML_ROOT_PREFIX:
499 
500  PrefixLength = 1;
501  break;
502 
503  case AML_PARENT_PREFIX:
504 
505  for (i = 0; i < InternalNameLength; i++)
506  {
507  if (ACPI_IS_PARENT_PREFIX (InternalName[i]))
508  {
509  PrefixLength = i + 1;
510  }
511  else
512  {
513  break;
514  }
515  }
516 
517  if (i == InternalNameLength)
518  {
519  PrefixLength = i;
520  }
521 
522  break;
523 
524  default:
525 
526  break;
527  }
528 
529  /*
530  * Check for object names. Note that there could be 0-255 of these
531  * 4-byte elements.
532  */
533  if (PrefixLength < InternalNameLength)
534  {
535  switch (InternalName[PrefixLength])
536  {
538 
539  /* <count> 4-byte names */
540 
541  NamesIndex = PrefixLength + 2;
542  NumSegments = (UINT8)
543  InternalName[(ACPI_SIZE) PrefixLength + 1];
544  break;
545 
547 
548  /* Two 4-byte names */
549 
550  NamesIndex = PrefixLength + 1;
551  NumSegments = 2;
552  break;
553 
554  case 0:
555 
556  /* NullName */
557 
558  NamesIndex = 0;
559  NumSegments = 0;
560  break;
561 
562  default:
563 
564  /* one 4-byte name */
565 
566  NamesIndex = PrefixLength;
567  NumSegments = 1;
568  break;
569  }
570  }
571 
572  /*
573  * Calculate the length of ConvertedName, which equals the length
574  * of the prefix, length of all object names, length of any required
575  * punctuation ('.') between object names, plus the NULL terminator.
576  */
577  RequiredLength = PrefixLength + (4 * NumSegments) +
578  ((NumSegments > 0) ? (NumSegments - 1) : 0) + 1;
579 
580  /*
581  * Check to see if we're still in bounds. If not, there's a problem
582  * with InternalName (invalid format).
583  */
584  if (RequiredLength > InternalNameLength)
585  {
586  ACPI_ERROR ((AE_INFO, "Invalid internal name"));
588  }
589 
590  /* Build the ConvertedName */
591 
592  *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength);
593  if (!(*ConvertedName))
594  {
596  }
597 
598  j = 0;
599 
600  for (i = 0; i < PrefixLength; i++)
601  {
602  (*ConvertedName)[j++] = InternalName[i];
603  }
604 
605  if (NumSegments > 0)
606  {
607  for (i = 0; i < NumSegments; i++)
608  {
609  if (i > 0)
610  {
611  (*ConvertedName)[j++] = '.';
612  }
613 
614  /* Copy and validate the 4-char name segment */
615 
616  ACPI_COPY_NAMESEG (&(*ConvertedName)[j],
617  &InternalName[NamesIndex]);
618  AcpiUtRepairName (&(*ConvertedName)[j]);
619 
620  j += ACPI_NAMESEG_SIZE;
621  NamesIndex += ACPI_NAMESEG_SIZE;
622  }
623  }
624 
625  if (ConvertedNameLength)
626  {
627  *ConvertedNameLength = (UINT32) RequiredLength;
628  }
629 
631 }
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
void AcpiUtRepairName(char *Name)
Definition: utstring.c:183
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
#define AE_BAD_PATHNAME
Definition: acexcep.h:153
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
#define AE_INFO
Definition: acoutput.h:230
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define AML_PARENT_PREFIX
Definition: amlcode.h:70
#define AML_ROOT_PREFIX
Definition: amlcode.h:69
#define ACPI_COPY_NAMESEG(dest, src)
Definition: actypes.h:562
#define ACPI_IS_PARENT_PREFIX(c)
Definition: acmacros.h:402
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsResolvePackageElement(), AcpiNsBuildPrefixedPathname(), and AcpiNsLookup().

◆ AcpiNsGetInternalNameLength()

void AcpiNsGetInternalNameLength ( ACPI_NAMESTRING_INFO Info)

Definition at line 183 of file nsutils.c.

185 {
186  const char *NextExternalChar;
187  UINT32 i;
188 
189 
191 
192 
193  NextExternalChar = Info->ExternalName;
194  Info->NumCarats = 0;
195  Info->NumSegments = 0;
196  Info->FullyQualified = FALSE;
197 
198  /*
199  * For the internal name, the required length is 4 bytes per segment,
200  * plus 1 each for RootPrefix, MultiNamePrefixOp, segment count,
201  * trailing null (which is not really needed, but no there's harm in
202  * putting it there)
203  *
204  * strlen() + 1 covers the first NameSeg, which has no path separator
205  */
206  if (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
207  {
208  Info->FullyQualified = TRUE;
209  NextExternalChar++;
210 
211  /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */
212 
213  while (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
214  {
215  NextExternalChar++;
216  }
217  }
218  else
219  {
220  /* Handle Carat prefixes */
221 
222  while (ACPI_IS_PARENT_PREFIX (*NextExternalChar))
223  {
224  Info->NumCarats++;
225  NextExternalChar++;
226  }
227  }
228 
229  /*
230  * Determine the number of ACPI name "segments" by counting the number of
231  * path separators within the string. Start with one segment since the
232  * segment count is [(# separators) + 1], and zero separators is ok.
233  */
234  if (*NextExternalChar)
235  {
236  Info->NumSegments = 1;
237  for (i = 0; NextExternalChar[i]; i++)
238  {
239  if (ACPI_IS_PATH_SEPARATOR (NextExternalChar[i]))
240  {
241  Info->NumSegments++;
242  }
243  }
244  }
245 
246  Info->Length = (ACPI_NAMESEG_SIZE * Info->NumSegments) +
247  4 + Info->NumCarats;
248 
249  Info->NextExternalChar = NextExternalChar;
250 }
#define TRUE
Definition: types.h:120
struct TraceInfo Info
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
#define ACPI_IS_PATH_SEPARATOR(c)
Definition: acmacros.h:403
unsigned int UINT32
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_IS_PARENT_PREFIX(c)
Definition: acmacros.h:402
#define ACPI_IS_ROOT_PREFIX(c)
Definition: acmacros.h:401
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415

Referenced by AcpiNsInternalizeName().

◆ AcpiNsGetNode()

ACPI_STATUS AcpiNsGetNode ( ACPI_NAMESPACE_NODE PrefixNode,
const char Pathname,
UINT32  Flags,
ACPI_NAMESPACE_NODE **  ReturnNode 
)

Definition at line 863 of file nsutils.c.

868 {
870 
871 
872  ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
873 
874 
876  if (ACPI_FAILURE (Status))
877  {
879  }
880 
881  Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname,
882  Flags, ReturnNode);
883 
886 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiNsGetNodeUnlocked(ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode)
Definition: nsutils.c:777
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING Pathname
Definition: acpixf.h:700

Referenced by AcpiGetHandle(), AcpiNsEvaluate(), AcpiNsRepair_TSS(), AcpiNsRootInitialize(), and AcpiUtMethodError().

◆ AcpiNsGetNodeUnlocked()

ACPI_STATUS AcpiNsGetNodeUnlocked ( ACPI_NAMESPACE_NODE PrefixNode,
const char Pathname,
UINT32  Flags,
ACPI_NAMESPACE_NODE **  ReturnNode 
)

Definition at line 777 of file nsutils.c.

782 {
783  ACPI_GENERIC_STATE ScopeInfo;
785  char *InternalPath;
786 
787 
788  ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname));
789 
790 
791  /* Simplest case is a null pathname */
792 
793  if (!Pathname)
794  {
795  *ReturnNode = PrefixNode;
796  if (!PrefixNode)
797  {
798  *ReturnNode = AcpiGbl_RootNode;
799  }
800 
802  }
803 
804  /* Quick check for a reference to the root */
805 
806  if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1]))
807  {
808  *ReturnNode = AcpiGbl_RootNode;
810  }
811 
812  /* Convert path to internal representation */
813 
815  if (ACPI_FAILURE (Status))
816  {
818  }
819 
820  /* Setup lookup scope (search starting point) */
821 
822  ScopeInfo.Scope.Node = PrefixNode;
823 
824  /* Lookup the name in the namespace */
825 
828  NULL, ReturnNode);
829  if (ACPI_FAILURE (Status))
830  {
831  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n",
833  }
834 
837 }
ACPI_STATUS AcpiNsInternalizeName(const char *ExternalName, char **ConvertedName)
Definition: nsutils.c:405
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
UINT32 ACPI_STATUS
Definition: actypes.h:460
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
const char * AcpiFormatException(ACPI_STATUS Status)
Definition: utexcep.c:70
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
#define ACPI_IS_ROOT_PREFIX(c)
Definition: acmacros.h:401
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING Pathname
Definition: acpixf.h:700

Referenced by AcpiExLoadTableOp(), AcpiExOpcode_1A_0T_1R(), and AcpiNsGetNode().

◆ AcpiNsGetType()

ACPI_OBJECT_TYPE AcpiNsGetType ( ACPI_NAMESPACE_NODE Node)

Definition at line 120 of file nsutils.c.

122 {
123  ACPI_FUNCTION_TRACE (NsGetType);
124 
125 
126  if (!Node)
127  {
128  ACPI_WARNING ((AE_INFO, "Null Node parameter"));
130  }
131 
132  return_UINT8 (Node->Type);
133 }
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_TYPE_ANY
Definition: actypes.h:679
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define return_UINT8(s)
Definition: acoutput.h:500
Definition: dlist.c:348

Referenced by AcpiDsInitOneObject(), AcpiEvaluateObject(), AcpiExPrepFieldValue(), AcpiExResolveMultiple(), AcpiExResolveNodeToValue(), AcpiExStoreObjectToNode(), AcpiNsEvaluate(), AcpiNsInitOneObject(), AcpiNsSearchOneScope(), and AcpiUtCopyIsimpleToEsimple().

◆ AcpiNsInternalizeName()

ACPI_STATUS AcpiNsInternalizeName ( const char ExternalName,
char **  ConvertedName 
)

Definition at line 405 of file nsutils.c.

408 {
409  char *InternalName;
412 
413 
414  ACPI_FUNCTION_TRACE (NsInternalizeName);
415 
416 
417  if ((!ExternalName) ||
418  (*ExternalName == 0) ||
419  (!ConvertedName))
420  {
422  }
423 
424  /* Get the length of the new internal name */
425 
426  Info.ExternalName = ExternalName;
428 
429  /* We need a segment to store the internal name */
430 
431  InternalName = ACPI_ALLOCATE_ZEROED (Info.Length);
432  if (!InternalName)
433  {
435  }
436 
437  /* Build the name */
438 
439  Info.InternalName = InternalName;
441  if (ACPI_FAILURE (Status))
442  {
443  ACPI_FREE (InternalName);
445  }
446 
447  *ConvertedName = InternalName;
449 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiNsBuildInternalName(ACPI_NAMESTRING_INFO *Info)
Definition: nsutils.c:267
void AcpiNsGetInternalNameLength(ACPI_NAMESTRING_INFO *Info)
Definition: nsutils.c:183
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsConvertToReference(), and AcpiNsGetNodeUnlocked().

◆ AcpiNsLocal()

UINT32 AcpiNsLocal ( ACPI_OBJECT_TYPE  Type)

Definition at line 150 of file nsutils.c.

152 {
153  ACPI_FUNCTION_TRACE (NsLocal);
154 
155 
157  {
158  /* Type code out of range */
159 
160  ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
162  }
163 
165 }
BOOLEAN AcpiUtValidObjectType(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:681
Type
Definition: Type.h:6
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define return_UINT32(s)
Definition: acoutput.h:501
#define ACPI_NS_LOCAL
Definition: acnamesp.h:58
const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES]
Definition: utdecode.c:57
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_NS_NORMAL
Definition: acnamesp.h:56
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480

Referenced by AcpiNsSearchParentTree().

◆ AcpiNsOpensScope()

UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE  Type)

Definition at line 736 of file nsutils.c.

738 {
740 
741 
743  {
744  /* type code out of range */
745 
746  ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
747  return (ACPI_NS_NORMAL);
748  }
749 
751 }
Type
Definition: Type.h:6
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define ACPI_TYPE_LOCAL_MAX
Definition: actypes.h:730
#define ACPI_NS_NEWSCOPE
Definition: acnamesp.h:57
unsigned int UINT32
const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES]
Definition: utdecode.c:57
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_NS_NORMAL
Definition: acnamesp.h:56

Referenced by AcpiDsExecBeginOp(), AcpiDsLoad1BeginOp(), AcpiDsLoad1EndOp(), AcpiDsLoad2BeginOp(), AcpiDsLoad2EndOp(), AcpiNsLookup(), and AcpiPsParseLoop().

◆ AcpiNsPrintNodePathname()

void AcpiNsPrintNodePathname ( ACPI_NAMESPACE_NODE Node,
const char Message 
)

Definition at line 75 of file nsutils.c.

78 {
81 
82 
83  if (!Node)
84  {
85  AcpiOsPrintf ("[NULL NAME]");
86  return;
87  }
88 
89  /* Convert handle to full pathname and print it (with supplied message) */
90 
92 
94  if (ACPI_SUCCESS (Status))
95  {
96  if (Message)
97  {
98  AcpiOsPrintf ("%s ", Message);
99  }
100 
101  AcpiOsPrintf ("%s", (char *) Buffer.Pointer);
102  ACPI_FREE (Buffer.Pointer);
103  }
104 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define TRUE
Definition: types.h:120
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_ALLOCATE_LOCAL_BUFFER
Definition: actypes.h:1038
Definition: bufpool.h:45
ACPI_STATUS AcpiNsHandleToPathname(ACPI_HANDLE TargetHandle, ACPI_BUFFER *Buffer, BOOLEAN NoTrailing)
Definition: nsnames.c:187
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
CHAR Message[80]
Definition: alive.c:5
Status
Definition: gdiplustypes.h:24
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
Definition: dlist.c:348

Referenced by AcpiPsParseAml(), and AcpiUtMethodError().

◆ AcpiNsTerminate()

void AcpiNsTerminate ( void  )

Definition at line 693 of file nsutils.c.

695 {
697 
698 
699  ACPI_FUNCTION_TRACE (NsTerminate);
700 
701 
702  /*
703  * Free the entire namespace -- all nodes and all objects
704  * attached to the nodes
705  */
706  AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
707 
708  /* Delete any objects attached to the root node */
709 
711  if (ACPI_FAILURE (Status))
712  {
713  return_VOID;
714  }
715 
716  AcpiNsDeleteNode (AcpiGbl_RootNode);
718 
719  ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
720  return_VOID;
721 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define return_VOID
Definition: acoutput.h:495
void AcpiNsDeleteNamespaceSubtree(ACPI_NAMESPACE_NODE *ParentHandle)
Definition: nsalloc.c:399
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiNsDeleteNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:117
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85

Referenced by AcpiUtSubsystemShutdown().

◆ AcpiNsValidateHandle()

ACPI_NAMESPACE_NODE* AcpiNsValidateHandle ( ACPI_HANDLE  Handle)

Definition at line 655 of file nsutils.c.

657 {
658 
660 
661 
662  /* Parameter validation */
663 
664  if ((!Handle) || (Handle == ACPI_ROOT_OBJECT))
665  {
666  return (AcpiGbl_RootNode);
667  }
668 
669  /* We can at least attempt to verify the handle */
670 
672  {
673  return (NULL);
674  }
675 
677 }
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define ACPI_ROOT_OBJECT
Definition: actypes.h:500
_In_ HANDLE Handle
Definition: extypes.h:390
#define ACPI_DESC_TYPE_NAMED
Definition: acobject.h:575
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiAttachData(), AcpiDetachData(), AcpiEvaluateObject(), AcpiEvInstallHandler(), AcpiEvRegRun(), AcpiGetData(), AcpiGetHandle(), AcpiGetNextObject(), AcpiGetObjectInfo(), AcpiGetParent(), AcpiGetType(), AcpiInstallAddressSpaceHandler(), AcpiInstallGpeBlock(), AcpiNsGetDeviceCallback(), AcpiNsHandleToName(), AcpiNsHandleToPathname(), AcpiRemoveAddressSpaceHandler(), AcpiRemoveGpeBlock(), AcpiRsValidateParameters(), and AcpiWalkNamespace().