ReactOS  0.4.14-dev-342-gdc047f9
osl.c File Reference
#include "precomp.h"
#include <pseh/pseh2.h>
#include <debug.h>
Include dependency graph for osl.c:

Go to the source code of this file.

Classes

struct  _ACPI_SEM
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _ACPI_SEM ACPI_SEM
 
typedef struct _ACPI_SEMPACPI_SEM
 

Functions

ACPI_STATUS AcpiOsInitialize (void)
 
ACPI_STATUS AcpiOsTerminate (void)
 
ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer (void)
 
ACPI_STATUS AcpiOsPredefinedOverride (const ACPI_PREDEFINED_NAMES *PredefinedObject, ACPI_STRING *NewValue)
 
ACPI_STATUS AcpiOsTableOverride (ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable)
 
ACPI_STATUS AcpiOsPhysicalTableOverride (ACPI_TABLE_HEADER *ExistingTable, ACPI_PHYSICAL_ADDRESS *NewAddress, UINT32 *NewTableLength)
 
voidAcpiOsMapMemory (ACPI_PHYSICAL_ADDRESS phys, ACPI_SIZE length)
 
void AcpiOsUnmapMemory (void *virt, ACPI_SIZE length)
 
ACPI_STATUS AcpiOsGetPhysicalAddress (void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
 
voidAcpiOsAllocate (ACPI_SIZE size)
 
void AcpiOsFree (void *ptr)
 
BOOLEAN AcpiOsReadable (void *Memory, ACPI_SIZE Length)
 
BOOLEAN AcpiOsWritable (void *Memory, ACPI_SIZE Length)
 
ACPI_THREAD_ID AcpiOsGetThreadId (void)
 
ACPI_STATUS AcpiOsExecute (ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context)
 
void AcpiOsSleep (UINT64 milliseconds)
 
void AcpiOsStall (UINT32 microseconds)
 
ACPI_STATUS AcpiOsCreateMutex (ACPI_MUTEX *OutHandle)
 
void AcpiOsDeleteMutex (ACPI_MUTEX Handle)
 
ACPI_STATUS AcpiOsAcquireMutex (ACPI_MUTEX Handle, UINT16 Timeout)
 
void AcpiOsReleaseMutex (ACPI_MUTEX Handle)
 
ACPI_STATUS AcpiOsCreateSemaphore (UINT32 MaxUnits, UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle)
 
ACPI_STATUS AcpiOsDeleteSemaphore (ACPI_SEMAPHORE Handle)
 
ACPI_STATUS AcpiOsWaitSemaphore (ACPI_SEMAPHORE Handle, UINT32 Units, UINT16 Timeout)
 
ACPI_STATUS AcpiOsSignalSemaphore (ACPI_SEMAPHORE Handle, UINT32 Units)
 
ACPI_STATUS AcpiOsCreateLock (ACPI_SPINLOCK *OutHandle)
 
void AcpiOsDeleteLock (ACPI_SPINLOCK Handle)
 
ACPI_CPU_FLAGS AcpiOsAcquireLock (ACPI_SPINLOCK Handle)
 
void AcpiOsReleaseLock (ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
 
BOOLEAN NTAPI OslIsrStub (PKINTERRUPT Interrupt, PVOID ServiceContext)
 
UINT32 AcpiOsInstallInterruptHandler (UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine, void *Context)
 
ACPI_STATUS AcpiOsRemoveInterruptHandler (UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine)
 
ACPI_STATUS AcpiOsReadMemory (ACPI_PHYSICAL_ADDRESS Address, UINT64 *Value, UINT32 Width)
 
ACPI_STATUS AcpiOsWriteMemory (ACPI_PHYSICAL_ADDRESS Address, UINT64 Value, UINT32 Width)
 
ACPI_STATUS AcpiOsReadPort (ACPI_IO_ADDRESS Address, UINT32 *Value, UINT32 Width)
 
ACPI_STATUS AcpiOsWritePort (ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width)
 
BOOLEAN OslIsPciDevicePresent (ULONG BusNumber, ULONG SlotNumber)
 
ACPI_STATUS AcpiOsReadPciConfiguration (ACPI_PCI_ID *PciId, UINT32 Reg, UINT64 *Value, UINT32 Width)
 
ACPI_STATUS AcpiOsWritePciConfiguration (ACPI_PCI_ID *PciId, UINT32 Reg, UINT64 Value, UINT32 Width)
 
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf (const char *Fmt,...)
 
void AcpiOsVprintf (const char *Fmt, va_list Args)
 
void AcpiOsRedirectOutput (void *Destination)
 
UINT64 AcpiOsGetTimer (void)
 
void AcpiOsWaitEventsComplete (void)
 
ACPI_STATUS AcpiOsSignal (UINT32 Function, void *Info)
 
ACPI_STATUS AcpiOsEnterSleep (UINT8 SleepState, UINT32 RegaValue, UINT32 RegbValue)
 
ACPI_STATUS AcpiOsGetLine (char *Buffer, UINT32 BufferLength, UINT32 *BytesRead)
 

Variables

static PKINTERRUPT AcpiInterrupt
 
static BOOLEAN AcpiInterruptHandlerRegistered = FALSE
 
static ACPI_OSD_HANDLER AcpiIrqHandler = NULL
 
static PVOID AcpiIrqContext = NULL
 
static ULONG AcpiIrqNumber = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file osl.c.

Typedef Documentation

◆ ACPI_SEM

◆ PACPI_SEM

Function Documentation

◆ AcpiOsAcquireLock()

ACPI_CPU_FLAGS AcpiOsAcquireLock ( ACPI_SPINLOCK  Handle)

Definition at line 498 of file osl.c.

500 {
501  KIRQL OldIrql;
502 
504  {
506  }
507  else
508  {
510  }
511 
512  return (ACPI_CPU_FLAGS)OldIrql;
513 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
UCHAR KIRQL
Definition: env_spec_w32.h:591
_In_ HANDLE Handle
Definition: extypes.h:390
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

Referenced by AcpiClearGpe(), AcpiDisableGpe(), AcpiEnableGpe(), AcpiEvAcquireGlobalLock(), AcpiEvAsynchEnableGpe(), AcpiEvDeleteGpeBlock(), AcpiEvDeleteGpeXrupt(), AcpiEvDetectGpe(), AcpiEvGetGpeXruptBlock(), AcpiEvGlobalLockHandler(), AcpiEvGpeDetect(), AcpiEvInstallGpeBlock(), AcpiEvInstallGpeHandler(), AcpiEvRemoveAllSciHandlers(), AcpiEvSciDispatch(), AcpiEvWalkGpeList(), AcpiFinishGpe(), AcpiGetGpeStatus(), AcpiHwClearAcpiStatus(), AcpiInstallSciHandler(), AcpiMarkGpeForWake(), AcpiMaskGpe(), AcpiRemoveGpeHandler(), AcpiRemoveSciHandler(), AcpiSetGpe(), AcpiSetGpeWakeMask(), AcpiSetupGpeForWake(), AcpiUtUpdateRefCount(), and AcpiWriteBitRegister().

◆ AcpiOsAcquireMutex()

ACPI_STATUS AcpiOsAcquireMutex ( ACPI_MUTEX  Handle,
UINT16  Timeout 
)

Definition at line 306 of file osl.c.

309 {
310  if (!Handle)
311  {
312  DPRINT1("Bad parameter\n");
313  return AE_BAD_PARAMETER;
314  }
315 
316  /* Check what the caller wants us to do */
317  if (Timeout == ACPI_DO_NOT_WAIT)
318  {
319  /* Try to acquire without waiting */
321  return AE_TIME;
322  }
323  else
324  {
325  /* Block until we get it */
327  }
328 
329  return AE_OK;
330 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_TIME
Definition: acexcep.h:125
_In_ HANDLE Handle
Definition: extypes.h:390
#define ACPI_DO_NOT_WAIT
Definition: actypes.h:502
BOOLEAN FASTCALL ExTryToAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:39
* PFAST_MUTEX
Definition: extypes.h:17
static ULONG Timeout
Definition: ping.c:61
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiAcquireMutex(), AcpiExSystemWaitMutex(), AcpiInstallInterface(), AcpiInstallInterfaceHandler(), AcpiRemoveInterface(), AcpiUpdateInterfaces(), AcpiUtAcquireMutex(), AcpiUtAcquireReadLock(), AcpiUtAcquireWriteLock(), AcpiUtInitializeInterfaces(), AcpiUtInterfaceTerminate(), AcpiUtOsiImplementation(), and AcpiUtReleaseReadLock().

◆ AcpiOsAllocate()

void* AcpiOsAllocate ( ACPI_SIZE  size)

Definition at line 160 of file osl.c.

161 {
162  DPRINT("AcpiOsAllocate size %d\n",size);
163  return ExAllocatePoolWithTag(NonPagedPool, size, 'ipcA');
164 }
void DPRINT(...)
Definition: polytest.cpp:61
GLsizeiptr size
Definition: glext.h:5919
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350

Referenced by AcpiOsAllocateZeroed(), and AcpiUtInitializeBuffer().

◆ AcpiOsCreateLock()

ACPI_STATUS AcpiOsCreateLock ( ACPI_SPINLOCK OutHandle)

Definition at line 463 of file osl.c.

465 {
467 
468  if (!OutHandle)
469  {
470  DPRINT1("Bad parameter\n");
471  return AE_BAD_PARAMETER;
472  }
473 
475  if (!SpinLock) return AE_NO_MEMORY;
476 
478 
479  *OutHandle = (ACPI_SPINLOCK)SpinLock;
480 
481  return AE_OK;
482 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
#define ACPI_SPINLOCK
Definition: actypes.h:283
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvInitGlobalLockHandler(), and AcpiUtMutexInitialize().

◆ AcpiOsCreateMutex()

ACPI_STATUS AcpiOsCreateMutex ( ACPI_MUTEX OutHandle)

Definition at line 271 of file osl.c.

273 {
275 
276  if (!OutHandle)
277  {
278  DPRINT1("Bad parameter\n");
279  return AE_BAD_PARAMETER;
280  }
281 
283  if (!Mutex) return AE_NO_MEMORY;
284 
286 
287  *OutHandle = (ACPI_MUTEX)Mutex;
288 
289  return AE_OK;
290 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
Definition: Mutex.h:15
FAST_MUTEX
Definition: extypes.h:17
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
* PFAST_MUTEX
Definition: extypes.h:17
static PFAST_MUTEX Mutex
Definition: timer.c:22
#define DPRINT1
Definition: precomp.h:8
#define ACPI_MUTEX
Definition: actypes.h:273
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsCreateMethodMutex(), AcpiExCreateMutex(), AcpiNsRootInitialize(), AcpiUtCopySimpleObject(), AcpiUtCreateMutex(), AcpiUtCreateRwLock(), and AcpiUtMutexInitialize().

◆ AcpiOsCreateSemaphore()

ACPI_STATUS AcpiOsCreateSemaphore ( UINT32  MaxUnits,
UINT32  InitialUnits,
ACPI_SEMAPHORE OutHandle 
)

Definition at line 352 of file osl.c.

356 {
357  PACPI_SEM Sem;
358 
359  if (!OutHandle)
360  {
361  DPRINT1("Bad parameter\n");
362  return AE_BAD_PARAMETER;
363  }
364 
365  Sem = ExAllocatePoolWithTag(NonPagedPool, sizeof(ACPI_SEM), 'LpcA');
366  if (!Sem) return AE_NO_MEMORY;
367 
368  Sem->CurrentUnits = InitialUnits;
370  KeInitializeSpinLock(&Sem->Lock);
371 
372  *OutHandle = (ACPI_SEMAPHORE)Sem;
373 
374  return AE_OK;
375 }
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
KEVENT Event
Definition: osl.c:347
#define ACPI_SEMAPHORE
Definition: actypes.h:287
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
Definition: osl.c:345
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UINT32 CurrentUnits
Definition: osl.c:346
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define DPRINT1
Definition: precomp.h:8
KSPIN_LOCK Lock
Definition: osl.c:348
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExCreateEvent(), AcpiExSystemResetEvent(), AcpiNsRootInitialize(), and AcpiUtCopySimpleObject().

◆ AcpiOsDeleteLock()

void AcpiOsDeleteLock ( ACPI_SPINLOCK  Handle)

Definition at line 485 of file osl.c.

487 {
488  if (!Handle)
489  {
490  DPRINT1("Bad parameter\n");
491  return;
492  }
493 
494  ExFreePoolWithTag(Handle, 'LpcA');
495 }
_In_ HANDLE Handle
Definition: extypes.h:390
#define DPRINT1
Definition: precomp.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by AcpiEvRemoveGlobalLockHandler(), and AcpiUtMutexTerminate().

◆ AcpiOsDeleteMutex()

void AcpiOsDeleteMutex ( ACPI_MUTEX  Handle)

Definition at line 293 of file osl.c.

295 {
296  if (!Handle)
297  {
298  DPRINT1("Bad parameter\n");
299  return;
300  }
301 
302  ExFreePoolWithTag(Handle, 'LpcA');
303 }
_In_ HANDLE Handle
Definition: extypes.h:390
#define DPRINT1
Definition: precomp.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by AcpiUtDeleteInternalObj(), AcpiUtDeleteMutex(), AcpiUtDeleteRwLock(), and AcpiUtMutexTerminate().

◆ AcpiOsDeleteSemaphore()

ACPI_STATUS AcpiOsDeleteSemaphore ( ACPI_SEMAPHORE  Handle)

Definition at line 378 of file osl.c.

380 {
381  if (!Handle)
382  {
383  DPRINT1("Bad parameter\n");
384  return AE_BAD_PARAMETER;
385  }
386 
387  ExFreePoolWithTag(Handle, 'LpcA');
388 
389  return AE_OK;
390 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
_In_ HANDLE Handle
Definition: extypes.h:390
#define DPRINT1
Definition: precomp.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExSystemResetEvent(), and AcpiUtDeleteInternalObj().

◆ AcpiOsEnterSleep()

ACPI_STATUS AcpiOsEnterSleep ( UINT8  SleepState,
UINT32  RegaValue,
UINT32  RegbValue 
)

Definition at line 932 of file osl.c.

936 {
937  DPRINT1("Entering sleep state S%u.\n", SleepState);
938  return AE_OK;
939 }
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiHwExtendedSleep(), and AcpiHwLegacySleep().

◆ AcpiOsExecute()

ACPI_STATUS AcpiOsExecute ( ACPI_EXECUTE_TYPE  Type,
ACPI_OSD_EXEC_CALLBACK  Function,
void Context 
)

Definition at line 224 of file osl.c.

228 {
229  HANDLE ThreadHandle;
232 
233  DPRINT("AcpiOsExecute\n");
234 
236  NULL,
238  NULL,
239  NULL);
240 
241  Status = PsCreateSystemThread(&ThreadHandle,
244  NULL,
245  NULL,
247  Context);
248  if (!NT_SUCCESS(Status))
249  return AE_ERROR;
250 
251  ZwClose(ThreadHandle);
252 
253  return AE_OK;
254 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
KSTART_ROUTINE * PKSTART_ROUTINE
Definition: ketypes.h:487
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define AE_OK
Definition: acexcep.h:97
#define AE_ERROR
Definition: acexcep.h:109

Referenced by AcpiEvAsynchExecuteGpeMethod(), AcpiEvGpeDispatch(), and AcpiEvQueueNotifyRequest().

◆ AcpiOsFree()

void AcpiOsFree ( void ptr)

Definition at line 167 of file osl.c.

168 {
169  if (!ptr)
170  DPRINT1("Attempt to free null pointer!!!\n");
171  ExFreePoolWithTag(ptr, 'ipcA');
172 }
static PVOID ptr
Definition: dispmode.c:27
#define DPRINT1
Definition: precomp.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by acpi_evaluate_reference(), AcpiEvaluateObjectTyped(), and AcpiUtDeleteCaches().

◆ AcpiOsGetLine()

ACPI_STATUS AcpiOsGetLine ( char Buffer,
UINT32  BufferLength,
UINT32 BytesRead 
)

Definition at line 942 of file osl.c.

946 {
947  DPRINT1("File reading not supported\n");
948  return AE_ERROR;
949 }
#define DPRINT1
Definition: precomp.h:8
#define AE_ERROR
Definition: acexcep.h:109

◆ AcpiOsGetPhysicalAddress()

ACPI_STATUS AcpiOsGetPhysicalAddress ( void LogicalAddress,
ACPI_PHYSICAL_ADDRESS *  PhysicalAddress 
)

Definition at line 140 of file osl.c.

143 {
144  PHYSICAL_ADDRESS PhysAddr;
145 
146  if (!LogicalAddress || !PhysicalAddress)
147  {
148  DPRINT1("Bad parameter\n");
149  return AE_BAD_PARAMETER;
150  }
151 
152  PhysAddr = MmGetPhysicalAddress(LogicalAddress);
153 
154  *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)PhysAddr.QuadPart;
155 
156  return AE_OK;
157 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
#define DPRINT1
Definition: precomp.h:8
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:682
#define AE_OK
Definition: acexcep.h:97
LONGLONG QuadPart
Definition: typedefs.h:112

◆ AcpiOsGetRootPointer()

ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer ( void  )

Definition at line 43 of file osl.c.

45 {
46  ACPI_PHYSICAL_ADDRESS pa = 0;
47 
48  DPRINT("AcpiOsGetRootPointer\n");
49 
51  return pa;
52 }
ACPI_STATUS ACPI_INIT_FUNCTION AcpiFindRootPointer(ACPI_PHYSICAL_ADDRESS *TableAddress)
Definition: tbxfroot.c:160
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by acpi_create_volatile_registry_tables(), and AcpiInitializeTables().

◆ AcpiOsGetThreadId()

ACPI_THREAD_ID AcpiOsGetThreadId ( void  )

Definition at line 217 of file osl.c.

218 {
219  /* Thread ID must be non-zero */
220  return (ULONG_PTR)PsGetCurrentThreadId() + 1;
221 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
PsGetCurrentThreadId
Definition: CrNtStubs.h:7

Referenced by AcpiAcquireGlobalLock(), AcpiDsBeginMethodExecution(), AcpiExAcquireGlobalLock(), AcpiUtAcquireMutex(), AcpiUtCreateThreadState(), and AcpiUtReleaseMutex().

◆ AcpiOsGetTimer()

UINT64 AcpiOsGetTimer ( void  )

Definition at line 884 of file osl.c.

886 {
887  LARGE_INTEGER CurrentTime;
888 
889  KeQuerySystemTime(&CurrentTime);
890  return CurrentTime.QuadPart;
891 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by AcpiDsExecBeginControlOp(), AcpiDsExecEndControlOp(), AcpiExDoDebugObject(), and AcpiExOpcode_0A_0T_1R().

◆ AcpiOsInitialize()

ACPI_STATUS AcpiOsInitialize ( void  )

Definition at line 21 of file osl.c.

22 {
23  DPRINT("AcpiOsInitialize called\n");
24 
25 #ifndef NDEBUG
26  /* Verboseness level of the acpica core */
27  AcpiDbgLevel = 0x00FFFFFF;
28  AcpiDbgLayer = 0xFFFFFFFF;
29 #endif
30 
31  return AE_OK;
32 }
void DPRINT(...)
Definition: polytest.cpp:61
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiInitializeSubsystem().

◆ AcpiOsInstallInterruptHandler()

UINT32 AcpiOsInstallInterruptHandler ( UINT32  InterruptNumber,
ACPI_OSD_HANDLER  ServiceRoutine,
void Context 
)

Definition at line 548 of file osl.c.

552 {
553  ULONG Vector;
554  KIRQL DIrql;
557 
559  {
560  DPRINT1("Reregister interrupt attempt failed\n");
561  return AE_ALREADY_EXISTS;
562  }
563 
564  if (!ServiceRoutine)
565  {
566  DPRINT1("Bad parameter\n");
567  return AE_BAD_PARAMETER;
568  }
569 
570  DPRINT("AcpiOsInstallInterruptHandler()\n");
572  Internal,
573  0,
574  InterruptNumber,
575  InterruptNumber,
576  &DIrql,
577  &Affinity);
578 
579  AcpiIrqNumber = InterruptNumber;
583 
585  &AcpiInterrupt,
586  OslIsrStub,
587  NULL,
588  NULL,
589  Vector,
590  DIrql,
591  DIrql,
593  TRUE,
594  Affinity,
595  FALSE);
596 
597  if (!NT_SUCCESS(Status))
598  {
599  DPRINT("Could not connect to interrupt %d\n", Vector);
600  return AE_ERROR;
601  }
602  return AE_OK;
603 }
static ACPI_OSD_HANDLER AcpiIrqHandler
Definition: osl.c:16
#define TRUE
Definition: types.h:120
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
static ULONG AcpiIrqNumber
Definition: osl.c:18
BOOLEAN NTAPI OslIsrStub(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: osl.c:533
LONG NTSTATUS
Definition: precomp.h:26
static PKINTERRUPT AcpiInterrupt
Definition: osl.c:14
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
Definition: irq.c:22
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
static PVOID AcpiIrqContext
Definition: osl.c:17
Status
Definition: gdiplustypes.h:24
ULONG_PTR KAFFINITY
Definition: compat.h:75
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG Vector
Definition: iofuncs.h:798
#define DPRINT1
Definition: precomp.h:8
static BOOLEAN AcpiInterruptHandlerRegistered
Definition: osl.c:15
struct tagContext Context
Definition: acpixf.h:1030
unsigned int ULONG
Definition: retypes.h:1
#define AE_OK
Definition: acexcep.h:97
#define AE_ERROR
Definition: acexcep.h:109
_In_ PKSERVICE_ROUTINE ServiceRoutine
Definition: iofuncs.h:798

Referenced by AcpiEvGetGpeXruptBlock(), and AcpiEvInstallSciHandler().

◆ AcpiOsMapMemory()

void* AcpiOsMapMemory ( ACPI_PHYSICAL_ADDRESS  phys,
ACPI_SIZE  length 
)

Definition at line 108 of file osl.c.

111 {
113  PVOID Ptr;
114 
115  DPRINT("AcpiOsMapMemory(phys 0x%p size 0x%X)\n", phys, length);
116 
117  Address.QuadPart = (ULONG)phys;
119  if (!Ptr)
120  {
121  DPRINT1("Mapping failed\n");
122  }
123 
124  return Ptr;
125 }
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
static WCHAR Address[46]
Definition: ping.c:68
void DPRINT(...)
Definition: polytest.cpp:61
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

Referenced by acpi_create_volatile_registry_tables(), AcpiExSystemMemorySpaceHandler(), AcpiFindRootPointer(), AcpiGetTableHeader(), AcpiTbAcquireTable(), AcpiTbAcquireTempTable(), and AcpiTbParseRootTable().

◆ AcpiOsPhysicalTableOverride()

ACPI_STATUS AcpiOsPhysicalTableOverride ( ACPI_TABLE_HEADER ExistingTable,
ACPI_PHYSICAL_ADDRESS *  NewAddress,
UINT32 NewTableLength 
)

Definition at line 89 of file osl.c.

93 {
94  if (!ExistingTable || !NewAddress || !NewTableLength)
95  {
96  DPRINT1("Invalid parameter\n");
97  return AE_BAD_PARAMETER;
98  }
99 
100  /* No override */
101  *NewAddress = 0;
102  *NewTableLength = 0;
103 
104  return AE_OK;
105 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiTbOverrideTable().

◆ AcpiOsPredefinedOverride()

ACPI_STATUS AcpiOsPredefinedOverride ( const ACPI_PREDEFINED_NAMES PredefinedObject,
ACPI_STRING NewValue 
)

Definition at line 55 of file osl.c.

58 {
59  if (!PredefinedObject || !NewValue)
60  {
61  DPRINT1("Invalid parameter\n");
62  return AE_BAD_PARAMETER;
63  }
64 
65  /* No override */
66  *NewValue = NULL;
67 
68  return AE_OK;
69 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsRootInitialize().

◆ AcpiOsPrintf()

◆ AcpiOsReadable()

BOOLEAN AcpiOsReadable ( void Memory,
ACPI_SIZE  Length 
)

Definition at line 175 of file osl.c.

178 {
179  BOOLEAN Ret = FALSE;
180 
181  _SEH2_TRY
182  {
183  ProbeForRead(Memory, Length, sizeof(UCHAR));
184  Ret = TRUE;
185  }
187  {
188  Ret = FALSE;
189  }
190  _SEH2_END;
191 
192  return Ret;
193 }
#define TRUE
Definition: types.h:120
static ULONGLONG Memory
Definition: CcMapData_drv.c:35
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

◆ AcpiOsReadMemory()

ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS  Address,
UINT64 Value,
UINT32  Width 
)

Definition at line 634 of file osl.c.

638 {
639  DPRINT("AcpiOsReadMemory %p\n", Address);
640  switch (Width)
641  {
642  case 8:
643  *Value = (*(PUCHAR)(ULONG_PTR)Address);
644  break;
645 
646  case 16:
647  *Value = (*(PUSHORT)(ULONG_PTR)Address);
648  break;
649 
650  case 32:
651  *Value = (*(PULONG)(ULONG_PTR)Address);
652  break;
653 
654  case 64:
656  break;
657 
658  default:
659  DPRINT1("AcpiOsReadMemory got bad width: %d\n",Width);
660  return (AE_BAD_PARAMETER);
661  break;
662  }
663  return (AE_OK);
664 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
unsigned char * PUCHAR
Definition: retypes.h:3
uint32_t ULONG_PTR
Definition: typedefs.h:63
static WCHAR Address[46]
Definition: ping.c:68
void DPRINT(...)
Definition: polytest.cpp:61
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:390
#define AE_OK
Definition: acexcep.h:97
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by AcpiHwRead().

◆ AcpiOsReadPciConfiguration()

ACPI_STATUS AcpiOsReadPciConfiguration ( ACPI_PCI_ID PciId,
UINT32  Reg,
UINT64 Value,
UINT32  Width 
)

Definition at line 793 of file osl.c.

798 {
800 
801  slot.u.AsULONG = 0;
802  slot.u.bits.DeviceNumber = PciId->Device;
803  slot.u.bits.FunctionNumber = PciId->Function;
804 
805  DPRINT("AcpiOsReadPciConfiguration, slot=0x%X, func=0x%X\n", slot.u.AsULONG, Reg);
806 
807  if (!OslIsPciDevicePresent(PciId->Bus, slot.u.AsULONG))
808  return AE_NOT_FOUND;
809 
810  /* Width is in BITS */
812  PciId->Bus,
813  slot.u.AsULONG,
814  Value,
815  Reg,
816  (Width >> 3));
817 
818  return AE_OK;
819 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
struct _slot slot
Definition: vfat.h:196
UINT16 Bus
Definition: actypes.h:1327
BOOLEAN OslIsPciDevicePresent(ULONG BusNumber, ULONG SlotNumber)
Definition: osl.c:760
UINT16 Device
Definition: actypes.h:1328
void DPRINT(...)
Definition: polytest.cpp:61
#define AE_NOT_FOUND
Definition: acexcep.h:113
ULONG NTAPI HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:73
Definition: vfat.h:184
UINT16 Function
Definition: actypes.h:1329
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExPciConfigSpaceHandler(), and AcpiHwGetPciDeviceInfo().

◆ AcpiOsReadPort()

ACPI_STATUS AcpiOsReadPort ( ACPI_IO_ADDRESS  Address,
UINT32 Value,
UINT32  Width 
)

Definition at line 701 of file osl.c.

705 {
706  DPRINT("AcpiOsReadPort %p, width %d\n",Address,Width);
707 
708  switch (Width)
709  {
710  case 8:
712  break;
713 
714  case 16:
716  break;
717 
718  case 32:
720  break;
721 
722  default:
723  DPRINT1("AcpiOsReadPort got bad width: %d\n",Width);
724  return (AE_BAD_PARAMETER);
725  break;
726  }
727  return (AE_OK);
728 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
Definition: portio.c:70
uint32_t ULONG_PTR
Definition: typedefs.h:63
static WCHAR Address[46]
Definition: ping.c:68
void DPRINT(...)
Definition: polytest.cpp:61
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
USHORT NTAPI READ_PORT_USHORT(IN PUSHORT Port)
Definition: portio.c:63
#define AE_OK
Definition: acexcep.h:97
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by AcpiHwReadPort().

◆ AcpiOsRedirectOutput()

void AcpiOsRedirectOutput ( void Destination)

Definition at line 876 of file osl.c.

878 {
879  /* No-op */
880  DPRINT1("Output redirection not supported\n");
881 }
#define DPRINT1
Definition: precomp.h:8

◆ AcpiOsReleaseLock()

void AcpiOsReleaseLock ( ACPI_SPINLOCK  Handle,
ACPI_CPU_FLAGS  Flags 
)

Definition at line 516 of file osl.c.

519 {
521 
522  if (OldIrql >= DISPATCH_LEVEL)
523  {
525  }
526  else
527  {
529  }
530 }
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ HANDLE Handle
Definition: extypes.h:390
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by AcpiClearGpe(), AcpiDisableGpe(), AcpiEnableGpe(), AcpiEvAcquireGlobalLock(), AcpiEvAsynchEnableGpe(), AcpiEvDeleteGpeBlock(), AcpiEvDeleteGpeXrupt(), AcpiEvDetectGpe(), AcpiEvGetGpeXruptBlock(), AcpiEvGlobalLockHandler(), AcpiEvGpeDetect(), AcpiEvInstallGpeBlock(), AcpiEvInstallGpeHandler(), AcpiEvRemoveAllSciHandlers(), AcpiEvSciDispatch(), AcpiEvWalkGpeList(), AcpiFinishGpe(), AcpiGetGpeStatus(), AcpiHwClearAcpiStatus(), AcpiInstallSciHandler(), AcpiMarkGpeForWake(), AcpiMaskGpe(), AcpiRemoveGpeHandler(), AcpiRemoveSciHandler(), AcpiSetGpe(), AcpiSetGpeWakeMask(), AcpiSetupGpeForWake(), AcpiUtUpdateRefCount(), and AcpiWriteBitRegister().

◆ AcpiOsReleaseMutex()

◆ AcpiOsRemoveInterruptHandler()

ACPI_STATUS AcpiOsRemoveInterruptHandler ( UINT32  InterruptNumber,
ACPI_OSD_HANDLER  ServiceRoutine 
)

Definition at line 606 of file osl.c.

609 {
610  DPRINT("AcpiOsRemoveInterruptHandler()\n");
611 
612  if (!ServiceRoutine)
613  {
614  DPRINT1("Bad parameter\n");
615  return AE_BAD_PARAMETER;
616  }
617 
619  {
623  }
624  else
625  {
626  DPRINT1("Trying to remove non-existing interrupt handler\n");
627  return AE_NOT_EXIST;
628  }
629 
630  return AE_OK;
631 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
static PKINTERRUPT AcpiInterrupt
Definition: osl.c:14
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:140
void DPRINT(...)
Definition: polytest.cpp:61
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define DPRINT1
Definition: precomp.h:8
static BOOLEAN AcpiInterruptHandlerRegistered
Definition: osl.c:15
#define AE_OK
Definition: acexcep.h:97
_In_ PKSERVICE_ROUTINE ServiceRoutine
Definition: iofuncs.h:798

Referenced by AcpiEvDeleteGpeXrupt(), and AcpiEvRemoveAllSciHandlers().

◆ AcpiOsSignal()

ACPI_STATUS AcpiOsSignal ( UINT32  Function,
void Info 
)

Definition at line 904 of file osl.c.

907 {
908  ACPI_SIGNAL_FATAL_INFO *FatalInfo = Info;
909 
910  switch (Function)
911  {
912  case ACPI_SIGNAL_FATAL:
913  if (Info)
914  DPRINT1 ("AcpiOsBreakpoint: %d %d %d ****\n", FatalInfo->Type, FatalInfo->Code, FatalInfo->Argument);
915  else
916  DPRINT1 ("AcpiOsBreakpoint ****\n");
917  break;
919  if (Info)
920  DPRINT1 ("AcpiOsBreakpoint: %s ****\n", Info);
921  else
922  DPRINT1 ("AcpiOsBreakpoint ****\n");
923  break;
924  }
925 
926  ASSERT(FALSE);
927 
928  return (AE_OK);
929 }
struct TraceInfo Info
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ACPI_SIGNAL_BREAKPOINT
Definition: acpiosxf.h:74
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97
#define ACPI_SIGNAL_FATAL
Definition: acpiosxf.h:73

Referenced by AcpiDsExecEndControlOp(), and AcpiExOpcode_3A_0T_0R().

◆ AcpiOsSignalSemaphore()

ACPI_STATUS AcpiOsSignalSemaphore ( ACPI_SEMAPHORE  Handle,
UINT32  Units 
)

Definition at line 439 of file osl.c.

442 {
443  PACPI_SEM Sem = Handle;
444  KIRQL OldIrql;
445 
446  if (!Handle)
447  {
448  DPRINT1("Bad parameter\n");
449  return AE_BAD_PARAMETER;
450  }
451 
452  KeAcquireSpinLock(&Sem->Lock, &OldIrql);
453 
454  Sem->CurrentUnits += Units;
456 
458 
459  return AE_OK;
460 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
KEVENT Event
Definition: osl.c:347
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: osl.c:345
_In_ HANDLE Handle
Definition: extypes.h:390
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
UINT32 CurrentUnits
Definition: osl.c:346
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
KSPIN_LOCK Lock
Definition: osl.c:348
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiEvGlobalLockHandler(), and AcpiExSystemSignalEvent().

◆ AcpiOsSleep()

void AcpiOsSleep ( UINT64  milliseconds)

Definition at line 257 of file osl.c.

258 {
259  DPRINT("AcpiOsSleep %d\n", milliseconds);
260  KeStallExecutionProcessor(milliseconds*1000);
261 }
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99

Referenced by AcpiExSystemDoSleep().

◆ AcpiOsStall()

void AcpiOsStall ( UINT32  microseconds)

Definition at line 264 of file osl.c.

265 {
266  DPRINT("AcpiOsStall %d\n",microseconds);
267  KeStallExecutionProcessor(microseconds);
268 }
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99

Referenced by AcpiEnterSleepStateS4bios(), AcpiExSystemDoStall(), AcpiHwLegacySleep(), and AcpiHwSetMode().

◆ AcpiOsTableOverride()

ACPI_STATUS AcpiOsTableOverride ( ACPI_TABLE_HEADER ExistingTable,
ACPI_TABLE_HEADER **  NewTable 
)

Definition at line 72 of file osl.c.

75 {
76  if (!ExistingTable || !NewTable)
77  {
78  DPRINT1("Invalid parameter\n");
79  return AE_BAD_PARAMETER;
80  }
81 
82  /* No override */
83  *NewTable = NULL;
84 
85  return AE_OK;
86 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiTbOverrideTable().

◆ AcpiOsTerminate()

ACPI_STATUS AcpiOsTerminate ( void  )

Definition at line 35 of file osl.c.

36 {
37  DPRINT("AcpiOsTerminate() called\n");
38 
39  return AE_OK;
40 }
void DPRINT(...)
Definition: polytest.cpp:61
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiTerminate().

◆ AcpiOsUnmapMemory()

void AcpiOsUnmapMemory ( void virt,
ACPI_SIZE  length 
)

Definition at line 128 of file osl.c.

131 {
132  DPRINT("AcpiOsMapMemory(phys 0x%p size 0x%X)\n", virt, length);
133 
134  ASSERT(virt);
135 
136  MmUnmapIoSpace(virt, length);
137 }
void DPRINT(...)
Definition: polytest.cpp:61
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193

Referenced by acpi_create_volatile_registry_tables(), AcpiEvSystemMemoryRegionSetup(), AcpiExSystemMemorySpaceHandler(), AcpiFindRootPointer(), AcpiGetTableHeader(), AcpiTbAcquireTempTable(), AcpiTbParseRootTable(), and AcpiTbReleaseTable().

◆ AcpiOsVprintf()

void AcpiOsVprintf ( const char Fmt,
va_list  Args 
)

Definition at line 865 of file osl.c.

868 {
869 #ifndef NDEBUG
870  vDbgPrintEx (-1, DPFLTR_ERROR_LEVEL, Fmt, Args);
871 #endif
872  return;
873 }
char ** Args
Definition: acdebug.h:347
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#define DPFLTR_ERROR_LEVEL
Definition: main.cpp:32

Referenced by AcpiBiosError(), AcpiBiosException(), AcpiBiosWarning(), AcpiError(), AcpiException(), AcpiInfo(), AcpiOsPrintf(), AcpiUtPredefinedBiosError(), AcpiUtPredefinedInfo(), AcpiUtPredefinedWarning(), and AcpiWarning().

◆ AcpiOsWaitEventsComplete()

void AcpiOsWaitEventsComplete ( void  )

Definition at line 894 of file osl.c.

895 {
896  /*
897  * Wait for all asynchronous events to complete.
898  * This implementation does nothing.
899  */
900  return;
901 }

Referenced by AcpiRemoveGpeHandler(), and AcpiRemoveNotifyHandler().

◆ AcpiOsWaitSemaphore()

ACPI_STATUS AcpiOsWaitSemaphore ( ACPI_SEMAPHORE  Handle,
UINT32  Units,
UINT16  Timeout 
)

Definition at line 393 of file osl.c.

397 {
398  PACPI_SEM Sem = Handle;
399  KIRQL OldIrql;
400 
401  if (!Handle)
402  {
403  DPRINT1("Bad parameter\n");
404  return AE_BAD_PARAMETER;
405  }
406 
407  KeAcquireSpinLock(&Sem->Lock, &OldIrql);
408 
409  /* Make sure we can wait if we have fewer units than we need */
410  if ((Timeout == ACPI_DO_NOT_WAIT) && (Sem->CurrentUnits < Units))
411  {
412  /* We can't so we must bail now */
414  return AE_TIME;
415  }
416 
417  /* Time to block until we get enough units */
418  while (Sem->CurrentUnits < Units)
419  {
422  Executive,
423  KernelMode,
424  FALSE,
425  NULL);
426  KeAcquireSpinLock(&Sem->Lock, &OldIrql);
427  }
428 
429  Sem->CurrentUnits -= Units;
430 
431  if (Sem->CurrentUnits != 0) KeSetEvent(&Sem->Event, IO_NO_INCREMENT, FALSE);
432 
434 
435  return AE_OK;
436 }
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
KEVENT Event
Definition: osl.c:347
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define AE_TIME
Definition: acexcep.h:125
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
UCHAR KIRQL
Definition: env_spec_w32.h:591
smooth NULL
Definition: ftsmooth.c:416
Definition: osl.c:345
_In_ HANDLE Handle
Definition: extypes.h:390
#define ACPI_DO_NOT_WAIT
Definition: actypes.h:502
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
UINT32 CurrentUnits
Definition: osl.c:346
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
static ULONG Timeout
Definition: ping.c:61
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
KSPIN_LOCK Lock
Definition: osl.c:348
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExSystemWaitSemaphore().

◆ AcpiOsWritable()

BOOLEAN AcpiOsWritable ( void Memory,
ACPI_SIZE  Length 
)

Definition at line 196 of file osl.c.

199 {
200  BOOLEAN Ret = FALSE;
201 
202  _SEH2_TRY
203  {
204  ProbeForWrite(Memory, Length, sizeof(UCHAR));
205  Ret = TRUE;
206  }
208  {
209  Ret = FALSE;
210  }
211  _SEH2_END;
212 
213  return Ret;
214 }
#define TRUE
Definition: types.h:120
static ULONGLONG Memory
Definition: CcMapData_drv.c:35
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char UCHAR
Definition: xmlstorage.h:181
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

◆ AcpiOsWriteMemory()

ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS  Address,
UINT64  Value,
UINT32  Width 
)

Definition at line 667 of file osl.c.

671 {
672  DPRINT("AcpiOsWriteMemory %p\n", Address);
673  switch (Width)
674  {
675  case 8:
677  break;
678 
679  case 16:
681  break;
682 
683  case 32:
685  break;
686 
687  case 64:
689  break;
690 
691  default:
692  DPRINT1("AcpiOsWriteMemory got bad width: %d\n",Width);
693  return (AE_BAD_PARAMETER);
694  break;
695  }
696 
697  return (AE_OK);
698 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
unsigned char * PUCHAR
Definition: retypes.h:3
uint32_t ULONG_PTR
Definition: typedefs.h:63
static WCHAR Address[46]
Definition: ping.c:68
void DPRINT(...)
Definition: polytest.cpp:61
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:390
#define AE_OK
Definition: acexcep.h:97
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by AcpiHwWrite().

◆ AcpiOsWritePciConfiguration()

ACPI_STATUS AcpiOsWritePciConfiguration ( ACPI_PCI_ID PciId,
UINT32  Reg,
UINT64  Value,
UINT32  Width 
)

Definition at line 822 of file osl.c.

827 {
828  ULONG buf = Value;
830 
831  slot.u.AsULONG = 0;
832  slot.u.bits.DeviceNumber = PciId->Device;
833  slot.u.bits.FunctionNumber = PciId->Function;
834 
835  DPRINT("AcpiOsWritePciConfiguration, slot=0x%x\n", slot.u.AsULONG);
836  if (!OslIsPciDevicePresent(PciId->Bus, slot.u.AsULONG))
837  return AE_NOT_FOUND;
838 
839  /* Width is in BITS */
841  PciId->Bus,
842  slot.u.AsULONG,
843  &buf,
844  Reg,
845  (Width >> 3));
846 
847  return AE_OK;
848 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
struct _slot slot
Definition: vfat.h:196
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
UINT16 Bus
Definition: actypes.h:1327
BOOLEAN OslIsPciDevicePresent(ULONG BusNumber, ULONG SlotNumber)
Definition: osl.c:760
UINT16 Device
Definition: actypes.h:1328
void DPRINT(...)
Definition: polytest.cpp:61
#define AE_NOT_FOUND
Definition: acexcep.h:113
Definition: vfat.h:184
unsigned int ULONG
Definition: retypes.h:1
UINT16 Function
Definition: actypes.h:1329
ULONG NTAPI HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:123
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiExPciConfigSpaceHandler().

◆ AcpiOsWritePort()

ACPI_STATUS AcpiOsWritePort ( ACPI_IO_ADDRESS  Address,
UINT32  Value,
UINT32  Width 
)

Definition at line 731 of file osl.c.

735 {
736  DPRINT("AcpiOsWritePort %p, width %d\n",Address,Width);
737  switch (Width)
738  {
739  case 8:
741  break;
742 
743  case 16:
745  break;
746 
747  case 32:
749  break;
750 
751  default:
752  DPRINT1("AcpiOsWritePort got bad width: %d\n",Width);
753  return (AE_BAD_PARAMETER);
754  break;
755  }
756  return (AE_OK);
757 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
unsigned char * PUCHAR
Definition: retypes.h:3
uint32_t ULONG_PTR
Definition: typedefs.h:63
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
static WCHAR Address[46]
Definition: ping.c:68
void DPRINT(...)
Definition: polytest.cpp:61
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
#define AE_OK
Definition: acexcep.h:97
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by AcpiHwWritePort(), and AcpiReset().

◆ OslIsPciDevicePresent()

BOOLEAN OslIsPciDevicePresent ( ULONG  BusNumber,
ULONG  SlotNumber 
)

Definition at line 760 of file osl.c.

761 {
762  UINT32 ReadLength;
763  PCI_COMMON_CONFIG PciConfig;
764 
765  /* Detect device presence by reading the PCI configuration space */
766 
768  BusNumber,
769  SlotNumber,
770  &PciConfig,
771  0,
772  sizeof(PciConfig));
773  if (ReadLength == 0)
774  {
775  DPRINT("PCI device is not present\n");
776  return FALSE;
777  }
778 
779  ASSERT(ReadLength >= 2);
780 
781  if (PciConfig.VendorID == PCI_INVALID_VENDORID)
782  {
783  DPRINT("Invalid vendor ID in PCI configuration space\n");
784  return FALSE;
785  }
786 
787  DPRINT("PCI device is present\n");
788 
789  return TRUE;
790 }
#define TRUE
Definition: types.h:120
unsigned int UINT32
void DPRINT(...)
Definition: polytest.cpp:61
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3245
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
ULONG NTAPI HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:73

Referenced by AcpiOsReadPciConfiguration(), and AcpiOsWritePciConfiguration().

◆ OslIsrStub()

BOOLEAN NTAPI OslIsrStub ( PKINTERRUPT  Interrupt,
PVOID  ServiceContext 
)

Definition at line 533 of file osl.c.

536 {
537  INT32 Status;
538 
539  Status = (*AcpiIrqHandler)(AcpiIrqContext);
540 
542  return TRUE;
543  else
544  return FALSE;
545 }
#define TRUE
Definition: types.h:120
#define ACPI_INTERRUPT_HANDLED
Definition: actypes.h:1239
static PVOID AcpiIrqContext
Definition: osl.c:17
Status
Definition: gdiplustypes.h:24
signed int INT32

Referenced by AcpiOsInstallInterruptHandler().

Variable Documentation

◆ AcpiInterrupt

PKINTERRUPT AcpiInterrupt
static

Definition at line 14 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler(), and AcpiOsRemoveInterruptHandler().

◆ AcpiInterruptHandlerRegistered

BOOLEAN AcpiInterruptHandlerRegistered = FALSE
static

Definition at line 15 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler(), and AcpiOsRemoveInterruptHandler().

◆ AcpiIrqContext

PVOID AcpiIrqContext = NULL
static

Definition at line 17 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler(), and OslIsrStub().

◆ AcpiIrqHandler

ACPI_OSD_HANDLER AcpiIrqHandler = NULL
static

Definition at line 16 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler().

◆ AcpiIrqNumber

ULONG AcpiIrqNumber = 0
static

Definition at line 18 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler().