📄 oswinxf.c
字号:
if ((AcpiGbl_Semaphores[Index].CurrentUnits + 1) > AcpiGbl_Semaphores[Index].MaxUnits) { ACPI_ERROR ((AE_INFO, "Oversignalled semaphore[%d]! Current %d Max %d", Index, AcpiGbl_Semaphores[Index].CurrentUnits, AcpiGbl_Semaphores[Index].MaxUnits)); return (AE_LIMIT); } AcpiGbl_Semaphores[Index].CurrentUnits++; ReleaseSemaphore (AcpiGbl_Semaphores[Index].OsHandle, Units, NULL);#endif return (AE_OK);}/* Spinlock interfaces, just implement with a semaphore */ACPI_STATUSAcpiOsCreateLock ( ACPI_SPINLOCK *OutHandle){ return (AcpiOsCreateSemaphore (1, 1, OutHandle));}voidAcpiOsDeleteLock ( ACPI_SPINLOCK Handle){ AcpiOsDeleteSemaphore (Handle);}ACPI_CPU_FLAGSAcpiOsAcquireLock ( ACPI_SPINLOCK Handle){ AcpiOsWaitSemaphore (Handle, 1, 0xFFFF); return (0);}voidAcpiOsReleaseLock ( ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags){ AcpiOsSignalSemaphore (Handle, 1);}#if ACPI_FUTURE_IMPLEMENTATION/* Mutex interfaces, just implement with a semaphore */ACPI_STATUSAcpiOsCreateMutex ( ACPI_MUTEX *OutHandle){ return (AcpiOsCreateSemaphore (1, 1, OutHandle));}voidAcpiOsDeleteMutex ( ACPI_MUTEX Handle){ AcpiOsDeleteSemaphore (Handle);}ACPI_STATUSAcpiOsAcquireMutex ( ACPI_MUTEX Handle, UINT16 Timeout){ AcpiOsWaitSemaphore (Handle, 1, Timeout); return (0);}voidAcpiOsReleaseMutex ( ACPI_MUTEX Handle){ AcpiOsSignalSemaphore (Handle, 1);}#endif/****************************************************************************** * * FUNCTION: AcpiOsInstallInterruptHandler * * PARAMETERS: InterruptNumber Level handler should respond to. * Isr Address of the ACPI interrupt handler * ExceptPtr Where status is returned * * RETURN: Handle to the newly installed handler. * * DESCRIPTION: Install an interrupt handler. Used to install the ACPI * OS-independent handler. * *****************************************************************************/UINT32AcpiOsInstallInterruptHandler ( UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine, void *Context){ return AE_OK;}/****************************************************************************** * * FUNCTION: AcpiOsRemoveInterruptHandler * * PARAMETERS: Handle Returned when handler was installed * * RETURN: Status * * DESCRIPTION: Uninstalls an interrupt handler. * *****************************************************************************/ACPI_STATUSAcpiOsRemoveInterruptHandler ( UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine){ return AE_OK;}/****************************************************************************** * * FUNCTION: AcpiOsGetThreadId * * PARAMETERS: None * * RETURN: Id of the running thread * * DESCRIPTION: Get the Id of the current (running) thread * *****************************************************************************/ACPI_THREAD_IDAcpiOsGetThreadId ( void){ DWORD ThreadId; /* Ensure ID is never 0 */ ThreadId = GetCurrentThreadId (); return (ThreadId + 1);}/****************************************************************************** * * FUNCTION: AcpiOsExecute * * PARAMETERS: Type - Type of execution * Function - Address of the function to execute * Context - Passed as a parameter to the function * * RETURN: Status * * DESCRIPTION: Execute a new thread * *****************************************************************************/ACPI_STATUSAcpiOsExecute ( ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context){#ifdef _MULTI_THREADED _beginthread (Function, (unsigned) 0, Context);#endif return 0;}/****************************************************************************** * * FUNCTION: AcpiOsStall * * PARAMETERS: microseconds To sleep * * RETURN: Blocks until sleep is completed. * * DESCRIPTION: Sleep at microsecond granularity * *****************************************************************************/voidAcpiOsStall ( UINT32 microseconds){ Sleep ((microseconds / 1000) + 1); return;}/****************************************************************************** * * FUNCTION: AcpiOsSleep * * PARAMETERS: milliseconds To sleep * * RETURN: Blocks until sleep is completed. * * DESCRIPTION: Sleep at millisecond granularity * *****************************************************************************/voidAcpiOsSleep ( ACPI_INTEGER milliseconds){ /* Add 10ms to account for clock tick granularity */ Sleep (((unsigned long) milliseconds) + 10); return;}/****************************************************************************** * * FUNCTION: AcpiOsValidateInterface * * PARAMETERS: Interface - Requested interface to be validated * * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise * * DESCRIPTION: Match an interface string to the interfaces supported by the * host. Strings originate from an AML call to the _OSI method. * *****************************************************************************/ACPI_STATUSAcpiOsValidateInterface ( char *Interface){ return (AE_SUPPORT);}/****************************************************************************** * * FUNCTION: AcpiOsValidateAddress * * PARAMETERS: SpaceId - ACPI space ID * Address - Physical address * Length - Address length * * RETURN: AE_OK if Address/Length is valid for the SpaceId. Otherwise, * should return AE_AML_ILLEGAL_ADDRESS. * * DESCRIPTION: Validate a system address via the host OS. Used to validate * the addresses accessed by AML operation regions. * *****************************************************************************/ACPI_STATUSAcpiOsValidateAddress ( UINT8 SpaceId, ACPI_PHYSICAL_ADDRESS Address, ACPI_SIZE Length){ return (AE_OK);}/****************************************************************************** * * FUNCTION: AcpiOsReadPciConfiguration * * PARAMETERS: PciId Seg/Bus/Dev * Register Device Register * Value Buffer where value is placed * Width Number of bits * * RETURN: Status * * DESCRIPTION: Read data from PCI configuration space * *****************************************************************************/ACPI_STATUSAcpiOsReadPciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Register, void *Value, UINT32 Width){ return (AE_OK);}/****************************************************************************** * * FUNCTION: AcpiOsWritePciConfiguration * * PARAMETERS: PciId Seg/Bus/Dev * Register Device Register * Value Value to be written * Width Number of bits * * RETURN: Status. * * DESCRIPTION: Write data to PCI configuration space * *****************************************************************************/ACPI_STATUSAcpiOsWritePciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Register, ACPI_INTEGER Value, UINT32 Width){ return (AE_OK);}/* TEMPORARY STUB FUNCTION */voidAcpiOsDerivePciId( ACPI_HANDLE rhandle, ACPI_HANDLE chandle, ACPI_PCI_ID **PciId){ return;}/****************************************************************************** * * FUNCTION: AcpiOsReadPort * * PARAMETERS: Address Address of I/O port/register to read * Value Where value is placed * Width Number of bits * * RETURN: Value read from port * * DESCRIPTION: Read data from an I/O port or register * *****************************************************************************/ACPI_STATUSAcpiOsReadPort ( ACPI_IO_ADDRESS Address, UINT32 *Value, UINT32 Width){ switch (Width) { case 8: *Value = 0xFF; break; case 16: *Value = 0xFFFF; break; case 32: *Value = 0xFFFFFFFF; break; default: return (AE_BAD_PARAMETER); } return (AE_OK);}/****************************************************************************** * * FUNCTION: AcpiOsWritePort * * PARAMETERS: Address Address of I/O port/register to write * Value Value to write * Width Number of bits * * RETURN: None * * DESCRIPTION: Write data to an I/O port or register * *****************************************************************************/ACPI_STATUSAcpiOsWritePort ( ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width){ return (AE_OK);}/****************************************************************************** * * FUNCTION: AcpiOsReadMemory * * PARAMETERS: Address Physical Memory Address to read * Value Where value is placed * Width Number of bits * * RETURN: Value read from physical memory address. Always returned * as a 32-bit integer, regardless of the read width. * * DESCRIPTION: Read data from a physical memory address * *****************************************************************************/ACPI_STATUSAcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width){ switch (Width) { case 8: case 16: case 32: *Value = 0; break; default: return (AE_BAD_PARAMETER); break; } return (AE_OK);}/****************************************************************************** * * FUNCTION: AcpiOsWriteMemory * * PARAMETERS: Address Physical Memory Address to write * Value Value to write * Width Number of bits * * RETURN: None * * DESCRIPTION: Write data to a physical memory address * *****************************************************************************/ACPI_STATUSAcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width){ return (AE_OK);}/****************************************************************************** * * FUNCTION: AcpiOsSignal * * PARAMETERS: Function ACPI CA signal function code * Info Pointer to function-dependent structure * * RETURN: Status * * DESCRIPTION: Miscellaneous functions * *****************************************************************************/ACPI_STATUSAcpiOsSignal ( UINT32 Function, void *Info){ switch (Function) { case ACPI_SIGNAL_FATAL: break; case ACPI_SIGNAL_BREAKPOINT: if (Info) { AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info); } else { AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); } break; } return (AE_OK);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -