ReactOS  0.4.14-dev-1007-g90d795b
utaddress.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
Include dependency graph for utaddress.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

ACPI_STATUS AcpiUtAddAddressRange (ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, ACPI_NAMESPACE_NODE *RegionNode)
 
void AcpiUtRemoveAddressRange (ACPI_ADR_SPACE_TYPE SpaceId, ACPI_NAMESPACE_NODE *RegionNode)
 
UINT32 AcpiUtCheckAddressRange (ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, BOOLEAN Warn)
 
void AcpiUtDeleteAddressLists (void)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 49 of file utaddress.c.

Function Documentation

◆ AcpiUtAddAddressRange()

ACPI_STATUS AcpiUtAddAddressRange ( ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_PHYSICAL_ADDRESS  Address,
UINT32  Length,
ACPI_NAMESPACE_NODE RegionNode 
)

Definition at line 78 of file utaddress.c.

83 {
84  ACPI_ADDRESS_RANGE *RangeInfo;
85 
86 
87  ACPI_FUNCTION_TRACE (UtAddAddressRange);
88 
89 
92  {
94  }
95 
96  /* Allocate/init a new info block, add it to the appropriate list */
97 
98  RangeInfo = ACPI_ALLOCATE (sizeof (ACPI_ADDRESS_RANGE));
99  if (!RangeInfo)
100  {
102  }
103 
104  RangeInfo->StartAddress = Address;
105  RangeInfo->EndAddress = (Address + Length - 1);
106  RangeInfo->RegionNode = RegionNode;
107 
108  RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId];
109  AcpiGbl_AddressRangeList[SpaceId] = RangeInfo;
110 
112  "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n",
113  AcpiUtGetNodeName (RangeInfo->RegionNode),
115  ACPI_FORMAT_UINT64 (RangeInfo->EndAddress)));
116 
118 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_PHYSICAL_ADDRESS StartAddress
Definition: aclocal.h:851
#define ACPI_ALLOCATE(a)
Definition: actypes.h:384
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 ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:828
#define ACPI_ADR_SPACE_SYSTEM_IO
Definition: actypes.h:853
static WCHAR Address[46]
Definition: ping.c:68
ACPI_PHYSICAL_ADDRESS EndAddress
Definition: aclocal.h:852
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct acpi_address_range * Next
Definition: aclocal.h:849
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_DB_NAMES
Definition: acoutput.h:166
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
ACPI_NAMESPACE_NODE * RegionNode
Definition: aclocal.h:850
#define ACPI_ADR_SPACE_SYSTEM_MEMORY
Definition: actypes.h:852
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsEvalRegionOperands(), and AcpiDsGetRegionArguments().

◆ AcpiUtCheckAddressRange()

UINT32 AcpiUtCheckAddressRange ( ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_PHYSICAL_ADDRESS  Address,
UINT32  Length,
BOOLEAN  Warn 
)

Definition at line 211 of file utaddress.c.

216 {
217  ACPI_ADDRESS_RANGE *RangeInfo;
218  ACPI_PHYSICAL_ADDRESS EndAddress;
219  char *Pathname;
220  UINT32 OverlapCount = 0;
221 
222 
223  ACPI_FUNCTION_TRACE (UtCheckAddressRange);
224 
225 
228  {
229  return_UINT32 (0);
230  }
231 
232  RangeInfo = AcpiGbl_AddressRangeList[SpaceId];
233  EndAddress = Address + Length - 1;
234 
235  /* Check entire list for all possible conflicts */
236 
237  while (RangeInfo)
238  {
239  /*
240  * Check if the requested address/length overlaps this
241  * address range. There are four cases to consider:
242  *
243  * 1) Input address/length is contained completely in the
244  * address range
245  * 2) Input address/length overlaps range at the range start
246  * 3) Input address/length overlaps range at the range end
247  * 4) Input address/length completely encompasses the range
248  */
249  if ((Address <= RangeInfo->EndAddress) &&
250  (EndAddress >= RangeInfo->StartAddress))
251  {
252  /* Found an address range overlap */
253 
254  OverlapCount++;
255  if (Warn) /* Optional warning message */
256  {
258 
260  "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)",
263  ACPI_FORMAT_UINT64 (EndAddress),
264  ACPI_FORMAT_UINT64 (RangeInfo->StartAddress),
265  ACPI_FORMAT_UINT64 (RangeInfo->EndAddress),
266  Pathname));
268  }
269  }
270 
271  RangeInfo = RangeInfo->Next;
272  }
273 
274  return_UINT32 (OverlapCount);
275 }
#define ACPI_FREE(a)
Definition: actypes.h:386
#define TRUE
Definition: types.h:120
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
#define return_UINT32(s)
Definition: acoutput.h:501
ACPI_PHYSICAL_ADDRESS StartAddress
Definition: aclocal.h:851
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 ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:828
#define ACPI_ADR_SPACE_SYSTEM_IO
Definition: actypes.h:853
const char * AcpiUtGetRegionName(UINT8 SpaceId)
Definition: utdecode.c:124
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
static WCHAR Address[46]
Definition: ping.c:68
ACPI_PHYSICAL_ADDRESS EndAddress
Definition: aclocal.h:852
Definition: video.h:581
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:373
struct acpi_address_range * Next
Definition: aclocal.h:849
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
ACPI_NAMESPACE_NODE * RegionNode
Definition: aclocal.h:850
#define ACPI_ADR_SPACE_SYSTEM_MEMORY
Definition: actypes.h:852
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 AcpiCheckAddressRange().

◆ AcpiUtDeleteAddressLists()

void AcpiUtDeleteAddressLists ( void  )

Definition at line 292 of file utaddress.c.

294 {
295  ACPI_ADDRESS_RANGE *Next;
296  ACPI_ADDRESS_RANGE *RangeInfo;
297  int i;
298 
299 
300  /* Delete all elements in all address range lists */
301 
302  for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
303  {
304  Next = AcpiGbl_AddressRangeList[i];
305 
306  while (Next)
307  {
308  RangeInfo = Next;
309  Next = RangeInfo->Next;
310  ACPI_FREE (RangeInfo);
311  }
312 
313  AcpiGbl_AddressRangeList[i] = NULL;
314  }
315 }
#define ACPI_FREE(a)
Definition: actypes.h:386
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
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_ADDRESS_RANGE_MAX
Definition: acconfig.h:148
struct acpi_address_range * Next
Definition: aclocal.h:849

Referenced by AcpiUtTerminate().

◆ AcpiUtRemoveAddressRange()

void AcpiUtRemoveAddressRange ( ACPI_ADR_SPACE_TYPE  SpaceId,
ACPI_NAMESPACE_NODE RegionNode 
)

Definition at line 139 of file utaddress.c.

142 {
143  ACPI_ADDRESS_RANGE *RangeInfo;
144  ACPI_ADDRESS_RANGE *Prev;
145 
146 
147  ACPI_FUNCTION_TRACE (UtRemoveAddressRange);
148 
149 
152  {
153  return_VOID;
154  }
155 
156  /* Get the appropriate list head and check the list */
157 
158  RangeInfo = Prev = AcpiGbl_AddressRangeList[SpaceId];
159  while (RangeInfo)
160  {
161  if (RangeInfo->RegionNode == RegionNode)
162  {
163  if (RangeInfo == Prev) /* Found at list head */
164  {
165  AcpiGbl_AddressRangeList[SpaceId] = RangeInfo->Next;
166  }
167  else
168  {
169  Prev->Next = RangeInfo->Next;
170  }
171 
173  "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n",
174  AcpiUtGetNodeName (RangeInfo->RegionNode),
175  ACPI_FORMAT_UINT64 (RangeInfo->StartAddress),
176  ACPI_FORMAT_UINT64 (RangeInfo->EndAddress)));
177 
178  ACPI_FREE (RangeInfo);
179  return_VOID;
180  }
181 
182  Prev = RangeInfo;
183  RangeInfo = RangeInfo->Next;
184  }
185 
186  return_VOID;
187 }
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_PHYSICAL_ADDRESS StartAddress
Definition: aclocal.h:851
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 ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:828
#define ACPI_ADR_SPACE_SYSTEM_IO
Definition: actypes.h:853
ACPI_PHYSICAL_ADDRESS EndAddress
Definition: aclocal.h:852
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define return_VOID
Definition: acoutput.h:495
struct acpi_address_range * Next
Definition: aclocal.h:849
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_DB_NAMES
Definition: acoutput.h:166
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
ACPI_NAMESPACE_NODE * RegionNode
Definition: aclocal.h:850
#define ACPI_ADR_SPACE_SYSTEM_MEMORY
Definition: actypes.h:852

Referenced by AcpiNsDetachObject(), and AcpiUtDeleteInternalObj().