Subversion Repositories Kolibri OS

Rev

Rev 2187 | Rev 9492 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2187 Rev 2216
Line 6... Line 6...
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
Line 244... Line 244...
244
 
244
 
245
/******************************************************************************
245
/******************************************************************************
246
 *
246
 *
247
 * FUNCTION:    AcpiOsTableOverride
247
 * FUNCTION:    AcpiOsTableOverride
248
 *
248
 *
-
 
249
 * PARAMETERS:  ExistingTable       - Header of current table (probably
249
 * PARAMETERS:  ExistingTable   - Header of current table (probably firmware)
250
 *                                    firmware)
250
 *              NewTable        - Where an entire new table is returned.
251
 *              NewTable            - Where an entire new table is returned.
251
 *
252
 *
252
 * RETURN:      Status, pointer to new table.  Null pointer returned if no
253
 * RETURN:      Status, pointer to new table. Null pointer returned if no
253
 *              table is available to override
254
 *              table is available to override
Line 303... Line 304...
303
 
304
 
304
/******************************************************************************
305
/******************************************************************************
305
 *
306
 *
306
 * FUNCTION:    AcpiOsPrintf
307
 * FUNCTION:    AcpiOsPrintf
307
 *
308
 *
308
 * PARAMETERS:  fmt, ...            Standard printf format
309
 * PARAMETERS:  fmt, ...            - Standard printf format
309
 *
310
 *
310
 * RETURN:      None
311
 * RETURN:      None
311
 *
312
 *
312
 * DESCRIPTION: Formatted output
313
 * DESCRIPTION: Formatted output
Line 329... Line 330...
329
 
330
 
330
/******************************************************************************
331
/******************************************************************************
331
 *
332
 *
332
 * FUNCTION:    AcpiOsVprintf
333
 * FUNCTION:    AcpiOsVprintf
333
 *
334
 *
334
 * PARAMETERS:  fmt                 Standard printf format
335
 * PARAMETERS:  fmt                 - Standard printf format
335
 *              args                Argument list
336
 *              args                - Argument list
336
 *
337
 *
337
 * RETURN:      None
338
 * RETURN:      None
338
 *
339
 *
339
 * DESCRIPTION: Formatted output with argument list pointer
340
 * DESCRIPTION: Formatted output with argument list pointer
Line 356... Line 357...
356
 
357
 
357
/******************************************************************************
358
/******************************************************************************
358
 *
359
 *
359
 * FUNCTION:    AcpiOsMapMemory
360
 * FUNCTION:    AcpiOsMapMemory
360
 *
361
 *
361
 * PARAMETERS:  where               Physical address of memory to be mapped
362
 * PARAMETERS:  where               - Physical address of memory to be mapped
362
 *              length              How much memory to map
363
 *              length              - How much memory to map
363
 *
364
 *
364
 * RETURN:      Pointer to mapped memory.  Null on error.
365
 * RETURN:      Pointer to mapped memory. Null on error.
365
 *
366
 *
366
 * DESCRIPTION: Map physical memory into caller's address space
367
 * DESCRIPTION: Map physical memory into caller's address space
Line 372... Line 373...
372
    ACPI_PHYSICAL_ADDRESS   where,
373
    ACPI_PHYSICAL_ADDRESS   where,
373
    ACPI_SIZE               length)
374
    ACPI_SIZE               length)
374
{
375
{
Line 375... Line 376...
375
 
376
 
Line -... Line 377...
-
 
377
 
376
 
378
    void* retval=NULL;
-
 
379
 
-
 
380
    if( (UINT64)where+length <= 0x100000000ULL)
-
 
381
        retval = (void*)MapIoMem(where, 4096+(UINT32)length, 0x07);
Line 377... Line 382...
377
    void* retval;
382
 
378
 
383
//    dbgprintf("%s %x-> %x %x\n",__FUNCTION__,
Line 379... Line 384...
379
    retval = (void*)MapIoMem((UINT32)where, (UINT32)length, 0x03);
384
//              where, retval, length);
380
 
385
 
381
    return retval;
386
    return retval;
382
}
387
}
383
 
388
 
384
 
389
 
385
/******************************************************************************
390
/******************************************************************************
386
 *
391
 *
387
 * FUNCTION:    AcpiOsUnmapMemory
392
 * FUNCTION:    AcpiOsUnmapMemory
388
 *
393
 *
389
 * PARAMETERS:  where               Logical address of memory to be unmapped
394
 * PARAMETERS:  where               - Logical address of memory to be unmapped
Line 399... Line 404...
399
void
404
void
400
AcpiOsUnmapMemory (
405
AcpiOsUnmapMemory (
401
    void                    *where,
406
    void                    *where,
402
    ACPI_SIZE               length)
407
    ACPI_SIZE               length)
403
{
408
{
404
 
-
 
-
 
409
    FreeKernelSpace( 0xFFFFF000 & (UINT32)where);
405
    return;
410
    return;
406
}
411
}
Line 407... Line 412...
407
 
412
 
408
 
413
 
409
/******************************************************************************
414
/******************************************************************************
410
 *
415
 *
411
 * FUNCTION:    AcpiOsAllocate
416
 * FUNCTION:    AcpiOsAllocate
412
 *
417
 *
413
 * PARAMETERS:  Size                Amount to allocate, in bytes
418
 * PARAMETERS:  Size                - Amount to allocate, in bytes
414
 *
419
 *
415
 * RETURN:      Pointer to the new allocation.  Null on error.
420
 * RETURN:      Pointer to the new allocation. Null on error.
416
 *
421
 *
Line 432... Line 437...
432
 
437
 
433
/******************************************************************************
438
/******************************************************************************
434
 *
439
 *
435
 * FUNCTION:    AcpiOsFree
440
 * FUNCTION:    AcpiOsFree
436
 *
441
 *
437
 * PARAMETERS:  mem                 Pointer to previously allocated memory
442
 * PARAMETERS:  mem                 - Pointer to previously allocated memory
438
 *
443
 *
439
 * RETURN:      None.
444
 * RETURN:      None.
440
 *
445
 *
441
 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
446
 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
Line 764... Line 769...
764
 
769
 
765
/******************************************************************************
770
/******************************************************************************
766
 *
771
 *
767
 * FUNCTION:    AcpiOsStall
772
 * FUNCTION:    AcpiOsStall
768
 *
773
 *
769
 * PARAMETERS:  microseconds        To sleep
774
 * PARAMETERS:  microseconds        - Time to sleep
770
 *
775
 *
771
 * RETURN:      Blocks until sleep is completed.
776
 * RETURN:      Blocks until sleep is completed.
772
 *
777
 *
773
 * DESCRIPTION: Sleep at microsecond granularity
778
 * DESCRIPTION: Sleep at microsecond granularity
Line 788... Line 793...
788
 
793
 
789
/******************************************************************************
794
/******************************************************************************
790
 *
795
 *
791
 * FUNCTION:    AcpiOsSleep
796
 * FUNCTION:    AcpiOsSleep
792
 *
797
 *
793
 * PARAMETERS:  milliseconds        To sleep
798
 * PARAMETERS:  milliseconds        - Time to sleep
794
 *
799
 *
795
 * RETURN:      Blocks until sleep is completed.
800
 * RETURN:      Blocks until sleep is completed.
796
 *
801
 *
797
 * DESCRIPTION: Sleep at millisecond granularity
802
 * DESCRIPTION: Sleep at millisecond granularity
Line 833... Line 838...
833
}
838
}
Line 834... Line 839...
834
 
839
 
835
 
840
 
836
/******************************************************************************
-
 
837
 *
-
 
838
 * FUNCTION:    AcpiOsValidateInterface
-
 
839
 *
-
 
840
 * PARAMETERS:  Interface           - Requested interface to be validated
-
 
841
 *
-
 
842
 * RETURN:      AE_OK if interface is supported, AE_SUPPORT otherwise
-
 
843
 *
-
 
844
 * DESCRIPTION: Match an interface string to the interfaces supported by the
-
 
845
 *              host. Strings originate from an AML call to the _OSI method.
-
 
846
 *
-
 
847
 *****************************************************************************/
-
 
848
 
-
 
849
ACPI_STATUS
-
 
850
AcpiOsValidateInterface (
-
 
851
    char                    *Interface)
-
 
852
{
-
 
853
 
-
 
854
    return (AE_SUPPORT);
-
 
855
}
-
 
856
 
-
 
857
 
-
 
858
/******************************************************************************
841
/******************************************************************************
859
 *
842
 *
860
 * FUNCTION:    AcpiOsReadPciConfiguration
843
 * FUNCTION:    AcpiOsReadPciConfiguration
861
 *
844
 *
862
 * PARAMETERS:  PciId               Seg/Bus/Dev
845
 * PARAMETERS:  PciId               - Seg/Bus/Dev
863
 *              Register            Device Register
846
 *              Register            - Device Register
864
 *              Value               Buffer where value is placed
847
 *              Value               - Buffer where value is placed
865
 *              Width               Number of bits
848
 *              Width               - Number of bits
866
 *
849
 *
867
 * RETURN:      Status
850
 * RETURN:      Status
868
 *
851
 *
Line 872... Line 855...
872
 
855
 
873
ACPI_STATUS
856
ACPI_STATUS
874
AcpiOsReadPciConfiguration (
857
AcpiOsReadPciConfiguration (
875
    ACPI_PCI_ID             *PciId,
858
    ACPI_PCI_ID             *PciId,
876
    UINT32                  Register,
859
    UINT32                  Register,
877
    void                    *Value,
860
    UINT64                  *Value,
878
    UINT32                  Width)
861
    UINT32                  Width)
879
{
862
{
Line 880... Line 863...
880
    UINT32 devfn = ((PciId->Device & 0x1f)<<3)|(PciId->Function & 0x07);
863
    UINT32 devfn = ((PciId->Device & 0x1f)<<3)|(PciId->Function & 0x07);
Line 895... Line 878...
895
                Width);
878
                Width);
896
			return AE_ERROR;
879
			return AE_ERROR;
897
	}
880
	}
Line 898... Line 881...
898
 
881
 
899
    return (AE_OK);
-
 
900
 
882
    return (AE_OK);
Line 901... Line 883...
901
}
883
}
902
 
884
 
903
 
885
 
904
/******************************************************************************
886
/******************************************************************************
905
 *
887
 *
906
 * FUNCTION:    AcpiOsWritePciConfiguration
888
 * FUNCTION:    AcpiOsWritePciConfiguration
907
 *
889
 *
908
 * PARAMETERS:  PciId               Seg/Bus/Dev
890
 * PARAMETERS:  PciId               - Seg/Bus/Dev
909
 *              Register            Device Register
891
 *              Register            - Device Register
910
 *              Value               Value to be written
892
 *              Value               - Value to be written
911
 *              Width               Number of bits
893
 *              Width               - Number of bits
912
 *
894
 *
913
 * RETURN:      Status.
895
 * RETURN:      Status.
Line 958... Line 940...
958
 
940
 
959
/******************************************************************************
941
/******************************************************************************
960
 *
942
 *
961
 * FUNCTION:    AcpiOsReadPort
943
 * FUNCTION:    AcpiOsReadPort
962
 *
944
 *
963
 * PARAMETERS:  Address             Address of I/O port/register to read
945
 * PARAMETERS:  Address             - Address of I/O port/register to read
964
 *              Value               Where value is placed
946
 *              Value               - Where value is placed
965
 *              Width               Number of bits
947
 *              Width               - Number of bits
966
 *
948
 *
967
 * RETURN:      Value read from port
949
 * RETURN:      Value read from port
968
 *
950
 *
969
 * DESCRIPTION: Read data from an I/O port or register
951
 * DESCRIPTION: Read data from an I/O port or register
Line 993... Line 975...
993
 
975
 
994
    default:
976
    default:
995
        return (AE_BAD_PARAMETER);
977
        return (AE_BAD_PARAMETER);
Line 996... Line 978...
996
    }
978
    }
Line 997... Line 979...
997
 
979
 
998
    dbgprintf("%s %x, %x\n",__FUNCTION__, Address, *Value);
980
//    dbgprintf("%s %x, %x\n",__FUNCTION__, Address, *Value);
Line 999... Line 981...
999
 
981
 
1000
    return (AE_OK);
982
    return (AE_OK);
1001
}
983
}
1002
 
984
 
1003
 
985
 
1004
/******************************************************************************
986
/******************************************************************************
1005
 *
987
 *
1006
 * FUNCTION:    AcpiOsWritePort
988
 * FUNCTION:    AcpiOsWritePort
1007
 *
989
 *
1008
 * PARAMETERS:  Address             Address of I/O port/register to write
990
 * PARAMETERS:  Address             - Address of I/O port/register to write
1009
 *              Value               Value to write
991
 *              Value               - Value to write
1010
 *              Width               Number of bits
992
 *              Width               - Number of bits
Line 1037... Line 1019...
1037
 
1019
 
1038
		default:
1020
		default:
1039
			return (AE_ERROR);
1021
			return (AE_ERROR);
Line 1040... Line 1022...
1040
	}
1022
	}
Line 1041... Line 1023...
1041
 
1023
 
1042
    dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
1024
//    dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
Line 1043... Line 1025...
1043
 
1025
 
1044
	return (AE_OK);
1026
	return (AE_OK);
1045
};
1027
};
1046
 
1028
 
1047
/******************************************************************************
1029
/******************************************************************************
1048
 *
1030
 *
1049
 * FUNCTION:    AcpiOsReadMemory
1031
 * FUNCTION:    AcpiOsReadMemory
1050
 *
1032
 *
1051
 * PARAMETERS:  Address             Physical Memory Address to read
1033
 * PARAMETERS:  Address             - Physical Memory Address to read
1052
 *              Value               Where value is placed
1034
 *              Value               - Where value is placed
1053
 *              Width               Number of bits
1035
 *              Width               - Number of bits
1054
 *
1036
 *
Line 1065... Line 1047...
1065
    UINT32                  Width)
1047
    UINT32                  Width)
1066
{
1048
{
1067
    void        *memptr;
1049
    void        *memptr;
1068
    ACPI_STATUS  status = AE_ERROR;
1050
    ACPI_STATUS  status = AE_ERROR;
Line 1069... Line 1051...
1069
 
1051
 
-
 
1052
//    dbgprintf("%s %x\n",__FUNCTION__, Address);
-
 
1053
 
-
 
1054
    if( (UINT64)Address+Width > 0x100000000ULL)
Line 1070... Line 1055...
1070
    dbgprintf("%s %x\n",__FUNCTION__, Address);
1055
        return (AE_BAD_PARAMETER);
1071
 
1056
 
1072
    if( Address >= 0x400000)
1057
    if( Address >= 0x400000)
Line 1124... Line 1109...
1124
 
1109
 
1125
/******************************************************************************
1110
/******************************************************************************
1126
 *
1111
 *
1127
 * FUNCTION:    AcpiOsWriteMemory
1112
 * FUNCTION:    AcpiOsWriteMemory
1128
 *
1113
 *
1129
 * PARAMETERS:  Address             Physical Memory Address to write
1114
 * PARAMETERS:  Address             - Physical Memory Address to write
1130
 *              Value               Value to write
1115
 *              Value               - Value to write
1131
 *              Width               Number of bits
1116
 *              Width               - Number of bits
1132
 *
1117
 *
1133
 * RETURN:      None
1118
 * RETURN:      None
1134
 *
1119
 *
1135
 * DESCRIPTION: Write data to a physical memory address
1120
 * DESCRIPTION: Write data to a physical memory address
Line 1144... Line 1129...
1144
{
1129
{
Line 1145... Line 1130...
1145
 
1130
 
1146
    void        *memptr;
1131
    void        *memptr;
Line 1147... Line 1132...
1147
    ACPI_STATUS  status = AE_ERROR;
1132
    ACPI_STATUS  status = AE_ERROR;
-
 
1133
 
-
 
1134
//    dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
-
 
1135
 
Line 1148... Line 1136...
1148
 
1136
    if( (UINT64)Address+Width > 0x100000000ULL)
1149
    dbgprintf("%s %x, %x\n",__FUNCTION__, Address, Value);
1137
        return (AE_BAD_PARAMETER);
1150
 
1138
 
Line 1274... Line 1262...
1274
 
1262
 
1275
/******************************************************************************
1263
/******************************************************************************
1276
 *
1264
 *
1277
 * FUNCTION:    AcpiOsSignal
1265
 * FUNCTION:    AcpiOsSignal
1278
 *
1266
 *
1279
 * PARAMETERS:  Function            ACPI CA signal function code
1267
 * PARAMETERS:  Function            - ACPI CA signal function code
1280
 *              Info                Pointer to function-dependent structure
1268
 *              Info                - Pointer to function-dependent structure
1281
 *
1269
 *
1282
 * RETURN:      Status
1270
 * RETURN:      Status
1283
 *
1271
 *
1284
 * DESCRIPTION: Miscellaneous functions. Example implementation only.
1272
 * DESCRIPTION: Miscellaneous functions. Example implementation only.