Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2215 → Rev 2216

/drivers/devman/acpica/os_specific/service_layers/osunixxf.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
115,9 → 115,16
 
 
/*
* These interfaces are required in order to compile the ASL compiler under
* Linux or other Unix-like system.
* These interfaces are required in order to compile the ASL compiler and the
* various ACPICA tools under Linux or other Unix-like system.
*
* Note: Use #define __APPLE__ for OS X generation.
*/
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdebug.h"
 
#include <stdio.h>
#include <stdlib.h>
126,13 → 133,8
#include <sys/time.h>
#include <semaphore.h>
#include <pthread.h>
#include <errno.h>
 
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdebug.h"
 
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("osunixxf")
 
154,7 → 156,13
 
typedef void* (*PTHREAD_CALLBACK) (void *);
 
/* Apple-specific */
 
#ifdef __APPLE__
#define sem_destroy sem_close
#endif
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsInitialize, AcpiOsTerminate
192,7 → 200,7
*
* RETURN: RSDP physical address
*
* DESCRIPTION: Gets the root pointer (RSDP)
* DESCRIPTION: Gets the ACPI root pointer (RSDP)
*
*****************************************************************************/
 
239,7 → 247,8
*
* FUNCTION: AcpiOsTableOverride
*
* PARAMETERS: ExistingTable - Header of current table (probably firmware)
* PARAMETERS: ExistingTable - Header of current table (probably
* firmware)
* NewTable - Where an entire new table is returned.
*
* RETURN: Status, pointer to new table. Null pointer returned if no
298,7 → 307,7
*
* FUNCTION: AcpiOsPrintf
*
* PARAMETERS: fmt, ... Standard printf format
* PARAMETERS: fmt, ... - Standard printf format
*
* RETURN: None
*
324,8 → 333,8
*
* FUNCTION: AcpiOsVprintf
*
* PARAMETERS: fmt Standard printf format
* args Argument list
* PARAMETERS: fmt - Standard printf format
* args - Argument list
*
* RETURN: None
*
372,18 → 381,21
*
* FUNCTION: AcpiOsGetLine
*
* PARAMETERS: fmt Standard printf format
* args Argument list
* PARAMETERS: Buffer - Where to return the command line
* BufferLength - Maximum length of Buffer
* BytesRead - Where the actual byte count is returned
*
* RETURN: Actual bytes read
* RETURN: Status and actual bytes read
*
* DESCRIPTION: Formatted input with argument list pointer
*
*****************************************************************************/
 
UINT32
ACPI_STATUS
AcpiOsGetLine (
char *Buffer)
char *Buffer,
UINT32 BufferLength,
UINT32 *BytesRead)
{
UINT8 Temp;
UINT32 i;
391,6 → 403,11
 
for (i = 0; ; i++)
{
if (i >= BufferLength)
{
return (AE_BUFFER_OVERFLOW);
}
 
scanf ("%1c", &Temp);
if (!Temp || Temp == '\n')
{
406,15 → 423,20
 
/* Return the number of bytes in the string */
 
return (i);
if (BytesRead)
{
*BytesRead = i;
}
return (AE_OK);
}
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsMapMemory
*
* PARAMETERS: where Physical address of memory to be mapped
* length How much memory to map
* PARAMETERS: where - Physical address of memory to be mapped
* length - How much memory to map
*
* RETURN: Pointer to mapped memory. Null on error.
*
436,8 → 458,8
*
* FUNCTION: AcpiOsUnmapMemory
*
* PARAMETERS: where Logical address of memory to be unmapped
* length How much memory to unmap
* PARAMETERS: where - Logical address of memory to be unmapped
* length - How much memory to unmap
*
* RETURN: None.
*
460,7 → 482,7
*
* FUNCTION: AcpiOsAllocate
*
* PARAMETERS: Size Amount to allocate, in bytes
* PARAMETERS: Size - Amount to allocate, in bytes
*
* RETURN: Pointer to the new allocation. Null on error.
*
484,7 → 506,7
*
* FUNCTION: AcpiOsFree
*
* PARAMETERS: mem Pointer to previously allocated memory
* PARAMETERS: mem - Pointer to previously allocated memory
*
* RETURN: None.
*
529,7 → 551,6
}
 
Sem = AcpiOsAllocate (sizeof (sem_t));
 
if (!Sem)
{
return (AE_NO_MEMORY);
756,9 → 777,9
*
* FUNCTION: AcpiOsInstallInterruptHandler
*
* PARAMETERS: InterruptNumber Level handler should respond to.
* Isr Address of the ACPI interrupt handler
* ExceptPtr Where status is returned
* 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.
*
782,7 → 803,7
*
* FUNCTION: AcpiOsRemoveInterruptHandler
*
* PARAMETERS: Handle Returned when handler was installed
* PARAMETERS: Handle - Returned when handler was installed
*
* RETURN: Status
*
802,42 → 823,9
 
/******************************************************************************
*
* 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_STATUS
AcpiOsExecute (
ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context)
{
pthread_t thread;
int ret;
 
 
ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context);
if (ret)
{
AcpiOsPrintf("Create thread failed");
}
return (0);
}
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsStall
*
* PARAMETERS: microseconds To sleep
* PARAMETERS: microseconds - Time to sleep
*
* RETURN: Blocks until sleep is completed.
*
861,7 → 849,7
*
* FUNCTION: AcpiOsSleep
*
* PARAMETERS: milliseconds To sleep
* PARAMETERS: milliseconds - Time to sleep
*
* RETURN: Blocks until sleep is completed.
*
882,6 → 870,7
usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */
}
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsGetTimer
895,7 → 884,8
*****************************************************************************/
 
UINT64
AcpiOsGetTimer (void)
AcpiOsGetTimer (
void)
{
struct timeval time;
 
910,34 → 900,12
 
/******************************************************************************
*
* 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_STATUS
AcpiOsValidateInterface (
char *Interface)
{
 
return (AE_SUPPORT);
}
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsReadPciConfiguration
*
* PARAMETERS: PciId Seg/Bus/Dev
* Register Device Register
* Value Buffer where value is placed
* Width Number of bits
* PARAMETERS: PciId - Seg/Bus/Dev
* Register - Device Register
* Value - Buffer where value is placed
* Width - Number of bits
*
* RETURN: Status
*
949,7 → 917,7
AcpiOsReadPciConfiguration (
ACPI_PCI_ID *PciId,
UINT32 Register,
void *Value,
UINT64 *Value,
UINT32 Width)
{
 
961,10 → 929,10
*
* FUNCTION: AcpiOsWritePciConfiguration
*
* PARAMETERS: PciId Seg/Bus/Dev
* Register Device Register
* Value Value to be written
* Width Number of bits
* PARAMETERS: PciId - Seg/Bus/Dev
* Register - Device Register
* Value - Value to be written
* Width - Number of bits
*
* RETURN: Status.
*
983,24 → 951,14
return (AE_OK);
}
 
/* TEMPORARY STUB FUNCTION */
void
AcpiOsDerivePciId(
ACPI_HANDLE Device,
ACPI_HANDLE Region,
ACPI_PCI_ID **PciId)
{
 
}
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsReadPort
*
* PARAMETERS: Address Address of I/O port/register to read
* Value Where value is placed
* Width Number of bits
* PARAMETERS: Address - Address of I/O port/register to read
* Value - Where value is placed
* Width - Number of bits
*
* RETURN: Value read from port
*
1041,9 → 999,9
*
* FUNCTION: AcpiOsWritePort
*
* PARAMETERS: Address Address of I/O port/register to write
* Value Value to write
* Width Number of bits
* PARAMETERS: Address - Address of I/O port/register to write
* Value - Value to write
* Width - Number of bits
*
* RETURN: None
*
1066,9 → 1024,9
*
* FUNCTION: AcpiOsReadMemory
*
* PARAMETERS: Address Physical Memory Address to read
* Value Where value is placed
* Width Number of bits
* PARAMETERS: Address - Physical Memory Address to read
* Value - Where value is placed
* Width - Number of bits
*
* RETURN: Value read from physical memory address
*
1102,9 → 1060,9
*
* FUNCTION: AcpiOsWriteMemory
*
* PARAMETERS: Address Physical Memory Address to write
* Value Value to write
* Width Number of bits
* PARAMETERS: Address - Physical Memory Address to write
* Value - Value to write
* Width - Number of bits
*
* RETURN: None
*
1171,33 → 1129,10
 
/******************************************************************************
*
* FUNCTION: AcpiOsGetThreadId
*
* PARAMETERS: None
*
* RETURN: Id of the running thread
*
* DESCRIPTION: Get the Id of the current (running) thread
*
* NOTE: The environment header should contain this line:
* #define ACPI_THREAD_ID pthread_t
*
*****************************************************************************/
 
ACPI_THREAD_ID
AcpiOsGetThreadId (void)
{
 
return (pthread_self ());
}
 
 
/******************************************************************************
*
* FUNCTION: AcpiOsSignal
*
* PARAMETERS: Function ACPI CA signal function code
* Info Pointer to function-dependent structure
* PARAMETERS: Function - ACPI CA signal function code
* Info - Pointer to function-dependent structure
*
* RETURN: Status
*