ReactOS 0.4.17-dev-523-gf6fcb59
osl.c File Reference
#include "precomp.h"
#include <arc/arc.h>
#include <reactos/drivers/acpi/acpi.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
 
#define TAG_ACPI_LOADER_RSDP_TABLE   'RpcA'
 

Typedefs

typedef struct _ACPI_SEM ACPI_SEM
 
typedef struct _ACPI_SEMPACPI_SEM
 

Functions

NTSYSAPI PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry (_In_ PCONFIGURATION_COMPONENT_DATA Child, _In_ CONFIGURATION_CLASS Class, _In_ CONFIGURATION_TYPE Type, _In_opt_ PULONG ComponentKey, _Inout_ PCONFIGURATION_COMPONENT_DATA *NextLink)
 
static UCHAR AcpiChecksumBuffer (_In_reads_bytes_(Length) const UCHAR *Buffer, _In_ ULONG Length)
 
static PACPI_BIOS_MULTI_NODE AcpiGetLoaderAcpiBiosNode (VOID)
 
static ACPI_PHYSICAL_ADDRESS AcpiBuildLoaderRootPointer (VOID)
 
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
 
NTSYSAPI PLOADER_PARAMETER_BLOCK KeLoaderBlock
 
static ACPI_TABLE_RSDPAcpiLoaderRsdp = NULL
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file osl.c.

◆ TAG_ACPI_LOADER_RSDP_TABLE

#define TAG_ACPI_LOADER_RSDP_TABLE   'RpcA'

Definition at line 16 of file osl.c.

Typedef Documentation

◆ ACPI_SEM

◆ PACPI_SEM

Function Documentation

◆ AcpiBuildLoaderRootPointer()

static ACPI_PHYSICAL_ADDRESS AcpiBuildLoaderRootPointer ( VOID  )
static

Definition at line 107 of file osl.c.

108{
109 PACPI_BIOS_MULTI_NODE NodeData;
110 ACPI_TABLE_HEADER *RootTable;
112
113 if (AcpiLoaderRsdp != NULL)
114 {
116 return (ACPI_PHYSICAL_ADDRESS)PhysicalAddress.QuadPart;
117 }
118
119 NodeData = AcpiGetLoaderAcpiBiosNode();
120 if (!NodeData || (NodeData->RsdtAddress.QuadPart == 0))
121 goto Failure;
122
123 RootTable = MmMapIoSpace(NodeData->RsdtAddress, sizeof(*RootTable), MmNonCached);
124 if (!RootTable)
125 {
126 DPRINT1("Unable to map loader ACPI root table at 0x%I64x\n",
127 NodeData->RsdtAddress.QuadPart);
128 goto Failure;
129 }
130
132 sizeof(*AcpiLoaderRsdp),
134 if (!AcpiLoaderRsdp)
135 {
136 DPRINT1("Unable to allocate synthetic RSDP for loader ACPI tables\n");
137 goto Failure;
138 }
139
142 sizeof(AcpiLoaderRsdp->Signature));
144
146 {
148 AcpiLoaderRsdp->Length = sizeof(*AcpiLoaderRsdp);
150 }
152 {
153 if (NodeData->RsdtAddress.QuadPart > MAXULONG)
154 {
155 DPRINT1("Loader RSDT address does not fit in 32 bits: 0x%I64x\n",
156 NodeData->RsdtAddress.QuadPart);
157 goto Failure;
158 }
159
162 }
163 else
164 {
165 DPRINT1("Loader ACPI root table has unexpected signature '%.4s'\n",
166 RootTable->Signature);
167 goto Failure;
168 }
169
172 if (AcpiLoaderRsdp->Revision >= 2)
173 {
176 sizeof(*AcpiLoaderRsdp));
177 }
178
179 MmUnmapIoSpace(RootTable, sizeof(*RootTable));
181 return (ACPI_PHYSICAL_ADDRESS)PhysicalAddress.QuadPart;
182
183Failure:
184 if (AcpiLoaderRsdp)
185 {
188 }
189 if (RootTable)
190 MmUnmapIoSpace(RootTable, sizeof(*RootTable));
191 return 0;
192}
#define ACPI_SIG_RSDP
Definition: actbl.h:72
#define ACPI_SIG_XSDT
Definition: actbl.h:74
#define ACPI_SIG_RSDT
Definition: actbl.h:73
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define ACPI_RSDP_CHECKSUM_LENGTH
Definition: acconfig.h:210
#define NonPagedPool
Definition: env_spec_w32.h:307
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
#define RtlEqualMemory(dst, src, len)
Definition: kdvm.h:18
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
static ACPI_TABLE_RSDP * AcpiLoaderRsdp
Definition: osl.c:37
#define TAG_ACPI_LOADER_RSDP_TABLE
Definition: osl.c:16
static PACPI_BIOS_MULTI_NODE AcpiGetLoaderAcpiBiosNode(VOID)
Definition: osl.c:57
static UCHAR AcpiChecksumBuffer(_In_reads_bytes_(Length) const UCHAR *Buffer, _In_ ULONG Length)
Definition: osl.c:41
PHYSICAL_ADDRESS RsdtAddress
Definition: acpi.h:21
char Signature[ACPI_NAMESEG_SIZE]
Definition: actbl.h:108
UINT8 ExtendedChecksum
Definition: actbl.h:158
UINT32 Length
Definition: actbl.h:156
UINT8 Revision
Definition: actbl.h:154
UINT64 XsdtPhysicalAddress
Definition: actbl.h:157
char OemId[ACPI_OEM_ID_SIZE]
Definition: actbl.h:153
UINT32 RsdtPhysicalAddress
Definition: actbl.h:155
UINT8 Checksum
Definition: actbl.h:152
char Signature[8]
Definition: actbl.h:151
#define MAXULONG
Definition: typedefs.h:251
unsigned char UCHAR
Definition: typedefs.h:53
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
@ MmNonCached
Definition: mmtypes.h:129

Referenced by AcpiOsInitialize().

◆ AcpiChecksumBuffer()

static UCHAR AcpiChecksumBuffer ( _In_reads_bytes_(Length) const UCHAR Buffer,
_In_ ULONG  Length 
)
static

Definition at line 41 of file osl.c.

44{
46 UCHAR Sum;
47
48 Sum = 0;
49 for (Index = 0; Index < Length; ++Index)
50 Sum = (UCHAR)(Sum + Buffer[Index]);
51
52 return (UCHAR)(0 - Sum);
53}
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by AcpiBuildLoaderRootPointer().

◆ AcpiGetLoaderAcpiBiosNode()

static PACPI_BIOS_MULTI_NODE AcpiGetLoaderAcpiBiosNode ( VOID  )
static

Definition at line 57 of file osl.c.

58{
59 PCONFIGURATION_COMPONENT_DATA ComponentEntry = NULL;
62
64 return NULL;
65
69 NULL,
70 &Next);
71 while (ComponentEntry)
72 {
73 if ((ComponentEntry->ComponentEntry.Identifier != NULL) &&
74 !_stricmp(ComponentEntry->ComponentEntry.Identifier, "ACPI BIOS"))
75 {
76 break;
77 }
78
79 Next = ComponentEntry;
83 NULL,
84 &Next);
85 }
86
87 if (!ComponentEntry)
88 return NULL;
89
90 ResourceList = ComponentEntry->ConfigurationData;
91 if (!ResourceList ||
93 FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[1]) +
95 (ResourceList->Count < 1) ||
96 (ResourceList->PartialDescriptors[0].Type != CmResourceTypeDeviceSpecific))
97 {
98 DPRINT1("Loader ACPI BIOS node is missing valid device-specific data\n");
99 return NULL;
100 }
101
103}
#define _stricmp
Definition: cat.c:22
NTSYSAPI PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry(_In_ PCONFIGURATION_COMPONENT_DATA Child, _In_ CONFIGURATION_CLASS Class, _In_ CONFIGURATION_TYPE Type, _In_opt_ PULONG ComponentKey, _Inout_ PCONFIGURATION_COMPONENT_DATA *NextLink)
Definition: config.c:21
NTSYSAPI PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:28
#define CmResourceTypeDeviceSpecific
Definition: restypes.h:108
@ AdapterClass
Definition: arc.h:102
@ MultiFunctionAdapter
Definition: arc.h:125
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
CONFIGURATION_COMPONENT ComponentEntry
Definition: arc.h:287
ULONG ConfigurationDataLength
Definition: arc.h:167
PCONFIGURATION_COMPONENT_DATA ConfigurationRoot
Definition: arc.h:840
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by AcpiBuildLoaderRootPointer().

◆ AcpiOsAcquireLock()

ACPI_CPU_FLAGS AcpiOsAcquireLock ( ACPI_SPINLOCK  Handle)

Definition at line 690 of file osl.c.

692{
694
696 {
698 }
699 else
700 {
702 }
703
704 return (ACPI_CPU_FLAGS)OldIrql;
705}
#define ACPI_CPU_FLAGS
Definition: actypes.h:252
UCHAR KIRQL
Definition: env_spec_w32.h:591
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG Handle
Definition: gdb_input.c:15
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
Definition: ke.h:125
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

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 498 of file osl.c.

501{
502 if (!Handle)
503 {
504 DPRINT1("Bad parameter\n");
505 return AE_BAD_PARAMETER;
506 }
507
508 /* Check what the caller wants us to do */
510 {
511 /* Try to acquire without waiting */
513 return AE_TIME;
514 }
515 else
516 {
517 /* Block until we get it */
519 }
520
521 return AE_OK;
522}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_TIME
Definition: acexcep.h:125
#define AE_OK
Definition: acexcep.h:97
#define ACPI_DO_NOT_WAIT
Definition: actypes.h:502
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
BOOLEAN FASTCALL ExTryToAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:39
static ULONG Timeout
Definition: ping.c:61
* PFAST_MUTEX
Definition: extypes.h:17

◆ AcpiOsAllocate()

void * AcpiOsAllocate ( ACPI_SIZE  size)

Definition at line 352 of file osl.c.

353{
354 DPRINT("AcpiOsAllocate size %d\n",size);
355 return ExAllocatePoolWithTag(NonPagedPool, size, 'ipcA');
356}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
GLsizeiptr size
Definition: glext.h:5919
#define DPRINT
Definition: sndvol32.h:73

◆ AcpiOsCreateLock()

ACPI_STATUS AcpiOsCreateLock ( ACPI_SPINLOCK OutHandle)

Definition at line 655 of file osl.c.

657{
659
660 if (!OutHandle)
661 {
662 DPRINT1("Bad parameter\n");
663 return AE_BAD_PARAMETER;
664 }
665
667 if (!SpinLock) return AE_NO_MEMORY;
668
670
671 *OutHandle = (ACPI_SPINLOCK)SpinLock;
672
673 return AE_OK;
674}
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_SPINLOCK
Definition: actypes.h:283
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228

Referenced by AcpiEvInitGlobalLockHandler(), and AcpiUtMutexInitialize().

◆ AcpiOsCreateMutex()

ACPI_STATUS AcpiOsCreateMutex ( ACPI_MUTEX 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 (!Mutex) return AE_NO_MEMORY;
476
478
479 *OutHandle = (ACPI_MUTEX)Mutex;
480
481 return AE_OK;
482}
#define ACPI_MUTEX
Definition: actypes.h:273
Definition: Mutex.h:16
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
FAST_MUTEX
Definition: extypes.h:17

◆ AcpiOsCreateSemaphore()

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

Definition at line 544 of file osl.c.

548{
549 PACPI_SEM Sem;
550
551 if (!OutHandle)
552 {
553 DPRINT1("Bad parameter\n");
554 return AE_BAD_PARAMETER;
555 }
556
557 Sem = ExAllocatePoolWithTag(NonPagedPool, sizeof(ACPI_SEM), 'LpcA');
558 if (!Sem) return AE_NO_MEMORY;
559
560 Sem->CurrentUnits = InitialUnits;
563
564 *OutHandle = (ACPI_SEMAPHORE)Sem;
565
566 return AE_OK;
567}
#define ACPI_SEMAPHORE
Definition: actypes.h:287
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
@ SynchronizationEvent
Definition: osl.c:537
KEVENT Event
Definition: osl.c:539
UINT32 CurrentUnits
Definition: osl.c:538
KSPIN_LOCK Lock
Definition: osl.c:540

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

◆ AcpiOsDeleteLock()

void AcpiOsDeleteLock ( ACPI_SPINLOCK  Handle)

Definition at line 677 of file osl.c.

679{
680 if (!Handle)
681 {
682 DPRINT1("Bad parameter\n");
683 return;
684 }
685
686 ExFreePoolWithTag(Handle, 'LpcA');
687}

Referenced by AcpiEvRemoveGlobalLockHandler(), and AcpiUtMutexTerminate().

◆ AcpiOsDeleteMutex()

void AcpiOsDeleteMutex ( ACPI_MUTEX  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}

◆ AcpiOsDeleteSemaphore()

ACPI_STATUS AcpiOsDeleteSemaphore ( ACPI_SEMAPHORE  Handle)

Definition at line 570 of file osl.c.

572{
573 if (!Handle)
574 {
575 DPRINT1("Bad parameter\n");
576 return AE_BAD_PARAMETER;
577 }
578
579 ExFreePoolWithTag(Handle, 'LpcA');
580
581 return AE_OK;
582}

Referenced by AcpiExSystemResetEvent(), and AcpiUtDeleteInternalObj().

◆ AcpiOsEnterSleep()

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

Definition at line 1124 of file osl.c.

1128{
1129 DPRINT1("Entering sleep state S%u.\n", SleepState);
1130 return AE_OK;
1131}

Referenced by AcpiHwExtendedSleep(), and AcpiHwLegacySleep().

◆ AcpiOsExecute()

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

Definition at line 416 of file osl.c.

420{
421 HANDLE ThreadHandle;
424
425 DPRINT("AcpiOsExecute\n");
426
428 NULL,
430 NULL,
431 NULL);
432
433 Status = PsCreateSystemThread(&ThreadHandle,
436 NULL,
437 NULL,
439 Context);
440 if (!NT_SUCCESS(Status))
441 return AE_ERROR;
442
443 ZwClose(ThreadHandle);
444
445 return AE_OK;
446}
#define AE_ERROR
Definition: acexcep.h:109
LONG NTSTATUS
Definition: precomp.h:26
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1342
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 OBJ_KERNEL_HANDLE
Definition: winternl.h:231
_In_ PVOID Context
Definition: storport.h:2269
KSTART_ROUTINE * PKSTART_ROUTINE
Definition: ketypes.h:567

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

◆ AcpiOsFree()

void AcpiOsFree ( void ptr)

Definition at line 359 of file osl.c.

360{
361 if (!ptr)
362 DPRINT1("Attempt to free null pointer!!!\n");
363 ExFreePoolWithTag(ptr, 'ipcA');
364}
static PVOID ptr
Definition: dispmode.c:27

◆ AcpiOsGetLine()

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

Definition at line 1134 of file osl.c.

1138{
1139 DPRINT1("File reading not supported\n");
1140 return AE_ERROR;
1141}

◆ AcpiOsGetPhysicalAddress()

ACPI_STATUS AcpiOsGetPhysicalAddress ( void LogicalAddress,
ACPI_PHYSICAL_ADDRESS *  PhysicalAddress 
)

Definition at line 332 of file osl.c.

335{
336 PHYSICAL_ADDRESS PhysAddr;
337
338 if (!LogicalAddress || !PhysicalAddress)
339 {
340 DPRINT1("Bad parameter\n");
341 return AE_BAD_PARAMETER;
342 }
343
344 PhysAddr = MmGetPhysicalAddress(LogicalAddress);
345
346 *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)PhysAddr.QuadPart;
347
348 return AE_OK;
349}

◆ AcpiOsGetRootPointer()

ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer ( void  )

Definition at line 228 of file osl.c.

230{
231 ACPI_PHYSICAL_ADDRESS pa = 0;
233
234 DPRINT("AcpiOsGetRootPointer\n");
235
236 if (AcpiLoaderRsdp != NULL)
237 {
239 return (ACPI_PHYSICAL_ADDRESS)PhysicalAddress.QuadPart;
240 }
241
243 return pa;
244}
static int ** pa
Definition: server.c:145
ACPI_STATUS ACPI_INIT_FUNCTION AcpiFindRootPointer(ACPI_PHYSICAL_ADDRESS *TableAddress)
Definition: tbxfroot.c:160

Referenced by acpi_create_volatile_registry_tables(), and AcpiInitializeTables().

◆ AcpiOsGetThreadId()

ACPI_THREAD_ID AcpiOsGetThreadId ( void  )

Definition at line 409 of file osl.c.

410{
411 /* Thread ID must be non-zero */
412 return (ULONG_PTR)PsGetCurrentThreadId() + 1;
413}
PsGetCurrentThreadId
Definition: CrNtStubs.h:8
uint32_t ULONG_PTR
Definition: typedefs.h:65

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

◆ AcpiOsGetTimer()

UINT64 AcpiOsGetTimer ( void  )

Definition at line 1076 of file osl.c.

1078{
1079 LARGE_INTEGER CurrentTime;
1080
1081 KeQuerySystemTime(&CurrentTime);
1082 return CurrentTime.QuadPart;
1083}
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570

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

◆ AcpiOsInitialize()

ACPI_STATUS AcpiOsInitialize ( void  )

Definition at line 195 of file osl.c.

196{
197 DPRINT("AcpiOsInitialize called\n");
198
199#ifndef NDEBUG
200 /* Verboseness level of the acpica core */
201 AcpiDbgLevel = 0x00FFFFFF;
202 AcpiDbgLayer = 0xFFFFFFFF;
203#endif
204
206
207 return AE_OK;
208}
#define VOID
Definition: acefi.h:82
static ACPI_PHYSICAL_ADDRESS AcpiBuildLoaderRootPointer(VOID)
Definition: osl.c:107

Referenced by AcpiInitializeSubsystem().

◆ AcpiOsInstallInterruptHandler()

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

Definition at line 740 of file osl.c.

744{
746 KIRQL DIrql;
749
751 {
752 DPRINT1("Reregister interrupt attempt failed\n");
753 return AE_ALREADY_EXISTS;
754 }
755
756 if (!ServiceRoutine)
757 {
758 DPRINT1("Bad parameter\n");
759 return AE_BAD_PARAMETER;
760 }
761
762 DPRINT("AcpiOsInstallInterruptHandler()\n");
764 Internal,
765 0,
766 InterruptNumber,
767 InterruptNumber,
768 &DIrql,
769 &Affinity);
770
771 AcpiIrqNumber = InterruptNumber;
775
779 NULL,
780 NULL,
781 Vector,
782 DIrql,
783 DIrql,
785 TRUE,
786 Affinity,
787 FALSE);
788
789 if (!NT_SUCCESS(Status))
790 {
791 DPRINT("Could not connect to interrupt %d\n", Vector);
792 return AE_ERROR;
793 }
794 return AE_OK;
795}
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG_PTR KAFFINITY
Definition: compat.h:85
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
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:23
static ACPI_OSD_HANDLER AcpiIrqHandler
Definition: osl.c:20
static PVOID AcpiIrqContext
Definition: osl.c:21
static BOOLEAN AcpiInterruptHandlerRegistered
Definition: osl.c:19
BOOLEAN NTAPI OslIsrStub(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: osl.c:725
static ULONG AcpiIrqNumber
Definition: osl.c:22
static PKINTERRUPT AcpiInterrupt
Definition: osl.c:18
@ Internal
Definition: restypes.h:121
@ LevelSensitive
Definition: miniport.h:80
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_In_ PKSERVICE_ROUTINE ServiceRoutine
Definition: iofuncs.h:800

Referenced by AcpiEvGetGpeXruptBlock(), and AcpiEvInstallSciHandler().

◆ AcpiOsMapMemory()

void * AcpiOsMapMemory ( ACPI_PHYSICAL_ADDRESS  phys,
ACPI_SIZE  length 
)

Definition at line 300 of file osl.c.

303{
305 PVOID Ptr;
306
307 DPRINT("AcpiOsMapMemory(phys 0x%p size 0x%X)\n", phys, length);
308
309 Address.QuadPart = (ULONGLONG)phys;
311 if (!Ptr)
312 {
313 DPRINT1("Mapping failed\n");
314 }
315
316 return Ptr;
317}
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
static WCHAR Address[46]
Definition: ping.c:68
uint64_t ULONGLONG
Definition: typedefs.h:67

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 281 of file osl.c.

285{
286 if (!ExistingTable || !NewAddress || !NewTableLength)
287 {
288 DPRINT1("Invalid parameter\n");
289 return AE_BAD_PARAMETER;
290 }
291
292 /* No override */
293 *NewAddress = 0;
294 *NewTableLength = 0;
295
296 return AE_OK;
297}

Referenced by AcpiTbOverrideTable().

◆ AcpiOsPredefinedOverride()

ACPI_STATUS AcpiOsPredefinedOverride ( const ACPI_PREDEFINED_NAMES PredefinedObject,
ACPI_STRING NewValue 
)

Definition at line 247 of file osl.c.

250{
251 if (!PredefinedObject || !NewValue)
252 {
253 DPRINT1("Invalid parameter\n");
254 return AE_BAD_PARAMETER;
255 }
256
257 /* No override */
258 *NewValue = NULL;
259
260 return AE_OK;
261}

Referenced by AcpiNsRootInitialize().

◆ AcpiOsPrintf()

◆ AcpiOsReadable()

BOOLEAN AcpiOsReadable ( void Memory,
ACPI_SIZE  Length 
)

Definition at line 367 of file osl.c.

370{
371 BOOLEAN Ret = FALSE;
372
374 {
375 ProbeForRead(Memory, Length, sizeof(UCHAR));
376 Ret = TRUE;
377 }
379 {
380 Ret = FALSE;
381 }
382 _SEH2_END;
383
384 return Ret;
385}
unsigned char BOOLEAN
Definition: actypes.h:127
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169

◆ AcpiOsReadMemory()

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

Definition at line 826 of file osl.c.

830{
831 DPRINT("AcpiOsReadMemory %p\n", Address);
832 switch (Width)
833 {
834 case 8:
836 break;
837
838 case 16:
840 break;
841
842 case 32:
844 break;
845
846 case 64:
848 break;
849
850 default:
851 DPRINT1("AcpiOsReadMemory got bad width: %d\n",Width);
852 return (AE_BAD_PARAMETER);
853 break;
854 }
855 return (AE_OK);
856}
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:395
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by AcpiHwRead().

◆ AcpiOsReadPciConfiguration()

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

Definition at line 985 of file osl.c.

990{
992
993 slot.u.AsULONG = 0;
994 slot.u.bits.DeviceNumber = PciId->Device;
995 slot.u.bits.FunctionNumber = PciId->Function;
996
997 DPRINT("AcpiOsReadPciConfiguration, slot=0x%X, func=0x%X\n", slot.u.AsULONG, Reg);
998
999 if (!OslIsPciDevicePresent(PciId->Bus, slot.u.AsULONG))
1000 return AE_NOT_FOUND;
1001
1002 /* Width is in BITS */
1004 PciId->Bus,
1005 slot.u.AsULONG,
1006 Value,
1007 Reg,
1008 (Width >> 3));
1009
1010 return AE_OK;
1011}
#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
BOOLEAN OslIsPciDevicePresent(ULONG BusNumber, ULONG SlotNumber)
Definition: osl.c:952
@ PCIConfiguration
Definition: miniport.h:93
Definition: vfat.h:185
UINT16 Device
Definition: actypes.h:1353
UINT16 Function
Definition: actypes.h:1354
UINT16 Bus
Definition: actypes.h:1352
struct _slot slot
Definition: vfat.h:196

Referenced by AcpiExPciConfigSpaceHandler(), and AcpiHwGetPciDeviceInfo().

◆ AcpiOsReadPort()

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

Definition at line 893 of file osl.c.

897{
898 DPRINT("AcpiOsReadPort %p, width %d\n",Address,Width);
899
900 switch (Width)
901 {
902 case 8:
904 break;
905
906 case 16:
908 break;
909
910 case 32:
912 break;
913
914 default:
915 DPRINT1("AcpiOsReadPort got bad width: %d\n",Width);
916 return (AE_BAD_PARAMETER);
917 break;
918 }
919 return (AE_OK);
920}
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
Definition: portio.c:70
USHORT NTAPI READ_PORT_USHORT(IN PUSHORT Port)
Definition: portio.c:63
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22

Referenced by AcpiHwReadPort().

◆ AcpiOsRedirectOutput()

void AcpiOsRedirectOutput ( void Destination)

Definition at line 1068 of file osl.c.

1070{
1071 /* No-op */
1072 DPRINT1("Output redirection not supported\n");
1073}

◆ AcpiOsReleaseLock()

◆ AcpiOsReleaseMutex()

void AcpiOsReleaseMutex ( ACPI_MUTEX  Handle)

Definition at line 525 of file osl.c.

527{
528 if (!Handle)
529 {
530 DPRINT1("Bad parameter\n");
531 return;
532 }
533
535}
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31

◆ AcpiOsRemoveInterruptHandler()

ACPI_STATUS AcpiOsRemoveInterruptHandler ( UINT32  InterruptNumber,
ACPI_OSD_HANDLER  ServiceRoutine 
)

Definition at line 798 of file osl.c.

801{
802 DPRINT("AcpiOsRemoveInterruptHandler()\n");
803
804 if (!ServiceRoutine)
805 {
806 DPRINT1("Bad parameter\n");
807 return AE_BAD_PARAMETER;
808 }
809
811 {
815 }
816 else
817 {
818 DPRINT1("Trying to remove non-existing interrupt handler\n");
819 return AE_NOT_EXIST;
820 }
821
822 return AE_OK;
823}
#define AE_NOT_EXIST
Definition: acexcep.h:114
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:142

Referenced by AcpiEvDeleteGpeXrupt(), and AcpiEvRemoveAllSciHandlers().

◆ AcpiOsSignal()

ACPI_STATUS AcpiOsSignal ( UINT32  Function,
void Info 
)

Definition at line 1096 of file osl.c.

1099{
1100 ACPI_SIGNAL_FATAL_INFO *FatalInfo = Info;
1101
1102 switch (Function)
1103 {
1104 case ACPI_SIGNAL_FATAL:
1105 if (Info)
1106 DPRINT1 ("AcpiOsBreakpoint: %d %d %d ****\n", FatalInfo->Type, FatalInfo->Code, FatalInfo->Argument);
1107 else
1108 DPRINT1 ("AcpiOsBreakpoint ****\n");
1109 break;
1111 if (Info)
1112 DPRINT1 ("AcpiOsBreakpoint: %s ****\n", Info);
1113 else
1114 DPRINT1 ("AcpiOsBreakpoint ****\n");
1115 break;
1116 }
1117
1118 ASSERT(FALSE);
1119
1120 return (AE_OK);
1121}
#define ACPI_SIGNAL_BREAKPOINT
Definition: acpiosxf.h:74
#define ACPI_SIGNAL_FATAL
Definition: acpiosxf.h:73
#define ASSERT(a)
Definition: mode.c:44
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by AcpiDsExecEndControlOp(), and AcpiExOpcode_3A_0T_0R().

◆ AcpiOsSignalSemaphore()

ACPI_STATUS AcpiOsSignalSemaphore ( ACPI_SEMAPHORE  Handle,
UINT32  Units 
)

Definition at line 631 of file osl.c.

634{
635 PACPI_SEM Sem = Handle;
637
638 if (!Handle)
639 {
640 DPRINT1("Bad parameter\n");
641 return AE_BAD_PARAMETER;
642 }
643
645
646 Sem->CurrentUnits += Units;
648
650
651 return AE_OK;
652}
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by AcpiEvGlobalLockHandler(), and AcpiExSystemSignalEvent().

◆ AcpiOsSleep()

void AcpiOsSleep ( UINT64  milliseconds)

Definition at line 449 of file osl.c.

450{
451 DPRINT("AcpiOsSleep %d\n", milliseconds);
452 KeStallExecutionProcessor(milliseconds*1000);
453}
#define KeStallExecutionProcessor(MicroSeconds)
Definition: precomp.h:27

Referenced by AcpiExSystemDoSleep().

◆ AcpiOsStall()

void AcpiOsStall ( UINT32  microseconds)

Definition at line 456 of file osl.c.

457{
458 DPRINT("AcpiOsStall %d\n",microseconds);
459 KeStallExecutionProcessor(microseconds);
460}

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

◆ AcpiOsTableOverride()

ACPI_STATUS AcpiOsTableOverride ( ACPI_TABLE_HEADER ExistingTable,
ACPI_TABLE_HEADER **  NewTable 
)

Definition at line 264 of file osl.c.

267{
268 if (!ExistingTable || !NewTable)
269 {
270 DPRINT1("Invalid parameter\n");
271 return AE_BAD_PARAMETER;
272 }
273
274 /* No override */
275 *NewTable = NULL;
276
277 return AE_OK;
278}

Referenced by AcpiTbOverrideTable().

◆ AcpiOsTerminate()

ACPI_STATUS AcpiOsTerminate ( void  )

Definition at line 211 of file osl.c.

212{
213 DPRINT("AcpiOsTerminate() called\n");
214
215 /* Release the synthetic RSDP built from the loader-provided ACPI tables.
216 * ACPICA has already torn down its table mappings (AcpiUtSubsystemShutdown)
217 * by the time it calls us, so nothing references this buffer anymore. */
218 if (AcpiLoaderRsdp != NULL)
219 {
222 }
223
224 return AE_OK;
225}

Referenced by AcpiTerminate().

◆ AcpiOsUnmapMemory()

void AcpiOsUnmapMemory ( void virt,
ACPI_SIZE  length 
)

Definition at line 320 of file osl.c.

323{
324 DPRINT("AcpiOsMapMemory(phys 0x%p size 0x%X)\n", virt, length);
325
326 ASSERT(virt);
327
328 MmUnmapIoSpace(virt, length);
329}

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

◆ AcpiOsVprintf()

void AcpiOsVprintf ( const char Fmt,
va_list  Args 
)

Definition at line 1057 of file osl.c.

1060{
1061#ifndef NDEBUG
1063#endif
1064 return;
1065}
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 1086 of file osl.c.

1087{
1088 /*
1089 * Wait for all asynchronous events to complete.
1090 * This implementation does nothing.
1091 */
1092 return;
1093}

Referenced by AcpiRemoveGpeHandler(), and AcpiRemoveNotifyHandler().

◆ AcpiOsWaitSemaphore()

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

Definition at line 585 of file osl.c.

589{
590 PACPI_SEM Sem = Handle;
592
593 if (!Handle)
594 {
595 DPRINT1("Bad parameter\n");
596 return AE_BAD_PARAMETER;
597 }
598
600
601 /* Make sure we can wait if we have fewer units than we need */
602 if ((Timeout == ACPI_DO_NOT_WAIT) && (Sem->CurrentUnits < Units))
603 {
604 /* We can't so we must bail now */
606 return AE_TIME;
607 }
608
609 /* Time to block until we get enough units */
610 while (Sem->CurrentUnits < Units)
611 {
614 Executive,
616 FALSE,
617 NULL);
619 }
620
621 Sem->CurrentUnits -= Units;
622
623 if (Sem->CurrentUnits != 0) KeSetEvent(&Sem->Event, IO_NO_INCREMENT, FALSE);
624
626
627 return AE_OK;
628}
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KernelMode
Definition: asm.h:38
@ Executive
Definition: ketypes.h:467

Referenced by AcpiExSystemWaitSemaphore().

◆ AcpiOsWritable()

BOOLEAN AcpiOsWritable ( void Memory,
ACPI_SIZE  Length 
)

Definition at line 388 of file osl.c.

391{
392 BOOLEAN Ret = FALSE;
393
395 {
396 ProbeForWrite(Memory, Length, sizeof(UCHAR));
397 Ret = TRUE;
398 }
400 {
401 Ret = FALSE;
402 }
403 _SEH2_END;
404
405 return Ret;
406}
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143

◆ AcpiOsWriteMemory()

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

Definition at line 859 of file osl.c.

863{
864 DPRINT("AcpiOsWriteMemory %p\n", Address);
865 switch (Width)
866 {
867 case 8:
869 break;
870
871 case 16:
873 break;
874
875 case 32:
877 break;
878
879 case 64:
881 break;
882
883 default:
884 DPRINT1("AcpiOsWriteMemory got bad width: %d\n",Width);
885 return (AE_BAD_PARAMETER);
886 break;
887 }
888
889 return (AE_OK);
890}

Referenced by AcpiHwWrite().

◆ AcpiOsWritePciConfiguration()

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

Definition at line 1014 of file osl.c.

1019{
1020 ULONG buf = Value;
1022
1023 slot.u.AsULONG = 0;
1024 slot.u.bits.DeviceNumber = PciId->Device;
1025 slot.u.bits.FunctionNumber = PciId->Function;
1026
1027 DPRINT("AcpiOsWritePciConfiguration, slot=0x%x\n", slot.u.AsULONG);
1028 if (!OslIsPciDevicePresent(PciId->Bus, slot.u.AsULONG))
1029 return AE_NOT_FOUND;
1030
1031 /* Width is in BITS */
1033 PciId->Bus,
1034 slot.u.AsULONG,
1035 &buf,
1036 Reg,
1037 (Width >> 3));
1038
1039 return AE_OK;
1040}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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

Referenced by AcpiExPciConfigSpaceHandler().

◆ AcpiOsWritePort()

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

Definition at line 923 of file osl.c.

927{
928 DPRINT("AcpiOsWritePort %p, width %d\n",Address,Width);
929 switch (Width)
930 {
931 case 8:
933 break;
934
935 case 16:
937 break;
938
939 case 32:
941 break;
942
943 default:
944 DPRINT1("AcpiOsWritePort got bad width: %d\n",Width);
945 return (AE_BAD_PARAMETER);
946 break;
947 }
948 return (AE_OK);
949}
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21

Referenced by AcpiHwWritePort(), and AcpiReset().

◆ KeFindConfigurationNextEntry()

Definition at line 21 of file config.c.

27{
28 ULONG Key = 0;
29 ULONG Mask = 0;
32
33 /* If we did get a key, then use it instead */
34 if (ComponentKey)
35 {
36 Key = *ComponentKey;
37 Mask = -1;
38 }
39
40 /* Loop the components until we find a a match */
41 for (; Child; Child = Child->Child)
42 {
43 /* Check if we are starting somewhere already */
44 if (*NextLink)
45 {
46 /* If we've found the place where we started, clear and continue */
47 if (Child == *NextLink)
48 *NextLink = NULL;
49 }
50 else
51 {
52 /* Try to get a match */
53 if ((Child->ComponentEntry.Class) == Class &&
54 (Child->ComponentEntry.Type) == Type &&
55 (Child->ComponentEntry.Key & Mask) == Key)
56 {
57 /* Match found */
58 return Child;
59 }
60 }
61
62 /* Now we've also got to lookup the siblings */
63 for (Sibling = Child->Sibling; Sibling; Sibling = Sibling->Sibling)
64 {
65 /* Check if we are starting somewhere already */
66 if (*NextLink)
67 {
68 /* If we've found the place where we started, clear and continue */
69 if (Sibling == *NextLink)
70 *NextLink = NULL;
71 }
72 else
73 {
74 /* Try to get a match */
75 if ((Sibling->ComponentEntry.Class == Class) &&
76 (Sibling->ComponentEntry.Type == Type) &&
77 (Sibling->ComponentEntry.Key & Mask) == Key)
78 {
79 /* Match found */
80 return Sibling;
81 }
82 }
83
84 /* We've got to check if the sibling has a child as well */
85 if (Sibling->Child)
86 {
87 /* We're just going to call ourselves again */
88 ReturnEntry = KeFindConfigurationNextEntry(Sibling->Child,
89 Class,
90 Type,
91 ComponentKey,
92 NextLink);
93 if (ReturnEntry)
94 return ReturnEntry;
95 }
96 }
97 }
98
99 /* If we got here, nothing was found */
100 return NULL;
101}
Type
Definition: Type.h:7
unsigned int Mask
Definition: fpcontrol.c:82
PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry(_In_ PCONFIGURATION_COMPONENT_DATA Child, _In_ CONFIGURATION_CLASS Class, _In_ CONFIGURATION_TYPE Type, _In_opt_ PULONG ComponentKey, _Inout_ PCONFIGURATION_COMPONENT_DATA *NextLink)
Definition: config.c:21
struct _CONFIGURATION_COMPONENT_DATA * Sibling
Definition: arc.h:286
struct _CONFIGURATION_COMPONENT_DATA * Child
Definition: arc.h:285
CONFIGURATION_TYPE Type
Definition: arc.h:161
CONFIGURATION_CLASS Class
Definition: arc.h:160
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

Referenced by AcpiGetLoaderAcpiBiosNode(), FindBootDisplayFromLoaderARCTree(), HalpAcpiFindRsdtPhase0(), KeFindConfigurationEntry(), and KeFindConfigurationNextEntry().

◆ OslIsPciDevicePresent()

BOOLEAN OslIsPciDevicePresent ( ULONG  BusNumber,
ULONG  SlotNumber 
)

Definition at line 952 of file osl.c.

953{
956
957 /* Detect device presence by reading the PCI configuration space */
958
960 BusNumber,
962 &PciConfig,
963 0,
964 sizeof(PciConfig));
965 if (ReadLength == 0)
966 {
967 DPRINT("PCI device is not present\n");
968 return FALSE;
969 }
970
971 ASSERT(ReadLength >= 2);
972
973 if (PciConfig.VendorID == PCI_INVALID_VENDORID)
974 {
975 DPRINT("Invalid vendor ID in PCI configuration space\n");
976 return FALSE;
977 }
978
979 DPRINT("PCI device is present\n");
980
981 return TRUE;
982}
ULONG ReadLength
_In_ ULONG BusNumber
Definition: pciidex.h:65
_In_ ULONG _In_ PCI_SLOT_NUMBER _In_ PPCI_COMMON_HEADER PciConfig
Definition: pciidex.h:67
uint32_t UINT32
Definition: typedefs.h:59
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3603

Referenced by AcpiOsReadPciConfiguration(), and AcpiOsWritePciConfiguration().

◆ OslIsrStub()

BOOLEAN NTAPI OslIsrStub ( PKINTERRUPT  Interrupt,
PVOID  ServiceContext 
)

Definition at line 725 of file osl.c.

728{
730
731 Status = (*AcpiIrqHandler)(AcpiIrqContext);
732
734 return TRUE;
735 else
736 return FALSE;
737}
#define ACPI_INTERRUPT_HANDLED
Definition: actypes.h:1264
int32_t INT32
Definition: typedefs.h:58

Referenced by AcpiOsInstallInterruptHandler().

Variable Documentation

◆ AcpiInterrupt

PKINTERRUPT AcpiInterrupt
static

Definition at line 18 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler(), and AcpiOsRemoveInterruptHandler().

◆ AcpiInterruptHandlerRegistered

BOOLEAN AcpiInterruptHandlerRegistered = FALSE
static

Definition at line 19 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler(), and AcpiOsRemoveInterruptHandler().

◆ AcpiIrqContext

PVOID AcpiIrqContext = NULL
static

Definition at line 21 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler(), and OslIsrStub().

◆ AcpiIrqHandler

ACPI_OSD_HANDLER AcpiIrqHandler = NULL
static

Definition at line 20 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler().

◆ AcpiIrqNumber

ULONG AcpiIrqNumber = 0
static

Definition at line 22 of file osl.c.

Referenced by AcpiOsInstallInterruptHandler().

◆ AcpiLoaderRsdp

ACPI_TABLE_RSDP* AcpiLoaderRsdp = NULL
static

Definition at line 37 of file osl.c.

Referenced by AcpiBuildLoaderRootPointer(), AcpiOsGetRootPointer(), and AcpiOsTerminate().

◆ KeLoaderBlock