ReactOS 0.4.17-dev-475-g46e69e6
sysinfo.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS HAL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: hal/halx86/generic/sysinfo.c
5 * PURPOSE: HAL Information Routines
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Vadim Galyant (vgal@rambler.ru)
8 */
9
10/* INCLUDES *******************************************************************/
11
12#include <hal.h>
13typedef unsigned int UINT;
14#include <x86x64/Cpuid.h>
15
16#define NDEBUG
17#include <debug.h>
18
20{
21 { 0x0000, 0x10, 1, NULL }, // DMA controller
22 { 0x0020, 0x02, 0, NULL }, // Programmable Interrupt Controller (8259A)
23 { 0x0040, 0x04, 1, NULL }, // System Timer 1
24 { 0x0048, 0x04, 1, NULL }, // System Timer 2 failsafe
25 { 0x0070, 0x02, 1, NULL }, // Real-time clock
26 { 0x0074, 0x03, 1, NULL }, // Extended CMOS
27 { 0x0081, 0x03, 1, NULL }, // DMA 1 page registers
28 { 0x0087, 0x01, 1, NULL }, // DMA 1 Ch 0 low page
29 { 0x0089, 0x01, 1, NULL }, // DMA 2 page registers
30 { 0x008A, 0x02, 1, NULL }, // DMA 2 page registers
31 { 0x008F, 0x01, 1, NULL }, // DMA 2 low page refresh
32 { 0x0090, 0x02, 1, NULL }, // Arbitration control
33 { 0x0093, 0x02, 1, NULL }, // Reserved system board setup
34 { 0x0096, 0x02, 1, NULL }, // POS channel select
35 { 0x00A0, 0x02, 0, NULL }, // Cascaded PIC
36 { 0x00C0, 0x20, 1, NULL }, // ISA DMA
37 { 0x04D0, 0x02, 0, NULL }, // PIC edge/level registers
38 { 0x0CF8, 0x08, 1, &HaliHandlePCIConfigSpaceAccess }, // PCI configuration space
39 { 0x0000, 0x00, 0, NULL } // Reserved
40};
41
42/* FUNCTIONS ******************************************************************/
43
50{
51 DPRINT1("HaliHandlePCIConfigSpaceAccess: IsRead %X, Port 0x%X, Length %u, Buffer %p\n", IsRead, Port, Length, Buffer);
52 //ASSERT(FALSE);
54}
55
56static
59 _Out_writes_(BrandStringLength) PCHAR BrandString,
60 _In_ ULONG BrandStringLength,
62{
63 CPUID_EXTENDED_FUNCTION_REGS ExtendedFunction;
64 union
65 {
66 INT AsInt[3 * 4];
67 CHAR Chars[49];
68 } BrandStringUnion;
69
70 *ReturnedLength = sizeof(BrandStringUnion.Chars);
71 if (BrandStringLength < *ReturnedLength)
72 {
73 DPRINT1("HaliQueryProcessorBrandString: Buffer too small (%u < %u)\n", BrandStringLength, *ReturnedLength);
75 }
76
77 /* Check if we can query the brand string */
78 __cpuid(ExtendedFunction.AsInt32, CPUID_EXTENDED_FUNCTION);
79 if (ExtendedFunction.MaxLeaf < CPUID_BRAND_STRING3)
80 {
82 }
83
84 __cpuid(&BrandStringUnion.AsInt[0], CPUID_BRAND_STRING1);
85 __cpuid(&BrandStringUnion.AsInt[4], CPUID_BRAND_STRING2);
86 __cpuid(&BrandStringUnion.AsInt[8], CPUID_BRAND_STRING3);
87 BrandStringUnion.Chars[48] = '\0'; // Ensure null-termination
88
89 /* Copy the brand string to the output buffer */
90 RtlCopyMemory(BrandString,
91 BrandStringUnion.Chars,
92 sizeof(BrandStringUnion.Chars));
93
94 return STATUS_SUCCESS;
95}
96
103{
104#define REPORT_THIS_CASE(X) case X: DPRINT1("Unhandled case: %s\n", #X); break
105 switch (InformationClass)
106 {
116 {
117 /* FIXME: TODO */
119 }
128 {
131
132 if (BufferSize >= Size)
133 {
136 }
137
140 return Status;
141 }
142
150 {
152 }
156 }
157#undef REPORT_THIS_CASE
158
161}
162
164NTAPI
168{
171}
#define CPUID_EXTENDED_FUNCTION
Definition: Cpuid.h:3802
#define CPUID_BRAND_STRING2
Definition: Cpuid.h:3956
#define CPUID_BRAND_STRING1
Definition: Cpuid.h:3919
#define CPUID_BRAND_STRING3
Definition: Cpuid.h:3978
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:188
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
Definition: bufpool.h:45
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define NULL
Definition: types.h:112
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1713
Status
Definition: gdiplustypes.h:24
VOID NTAPI KeFlushWriteBuffer(VOID)
Definition: misc.c:39
NTSTATUS NTAPI HaliSetSystemInformation(IN HAL_SET_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer)
Definition: sysinfo.c:31
NTSTATUS NTAPI HaliQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer, OUT PULONG ReturnedLength)
Definition: sysinfo.c:19
NTSTATUS NTAPI HaliHandlePCIConfigSpaceAccess(_In_ BOOLEAN IsRead, _In_ ULONG Port, _In_ ULONG Length, _Inout_ PULONG Buffer)
Definition: sysinfo.c:46
static NTSTATUS HaliQueryProcessorBrandString(_Out_writes_(BrandStringLength) PCHAR BrandString, _In_ ULONG BrandStringLength, _Out_ PULONG ReturnedLength)
Definition: sysinfo.c:58
#define REPORT_THIS_CASE(X)
unsigned int UINT
Definition: sysinfo.c:13
HAL_AMLI_BAD_IO_ADDRESS_LIST HalAMLIBadIOAddressList[]
Definition: sysinfo.c:19
CPPORT Port[4]
Definition: headless.c:38
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
#define _Inout_
Definition: no_sal2.h:162
#define _Out_writes_(s)
Definition: no_sal2.h:176
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
char CHAR
Definition: pedump.c:57
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
enum _HAL_SET_INFORMATION_CLASS HAL_SET_INFORMATION_CLASS
enum _HAL_QUERY_INFORMATION_CLASS HAL_QUERY_INFORMATION_CLASS
@ HalCallbackInformation
Definition: haltypes.h:34
@ HalProcessorSpeedInformation
Definition: haltypes.h:33
@ HalProfileSourceInformation
Definition: haltypes.h:30
@ HalPlatformInformation
Definition: haltypes.h:48
@ HalProcessorBrandString
Definition: haltypes.h:52
@ HalInitLogInformation
Definition: haltypes.h:50
@ HalMapRegisterInformation
Definition: haltypes.h:35
@ HalMcaLogInformation
Definition: haltypes.h:36
@ HalDisplayBiosInformation
Definition: haltypes.h:38
@ HalFrequencyInformation
Definition: haltypes.h:51
@ HalQueryMcaInterface
Definition: haltypes.h:44
@ HalPartitionIpiInterface
Definition: haltypes.h:47
@ HalInformationClassUnused1
Definition: haltypes.h:31
@ HalHypervisorInformation
Definition: haltypes.h:53
@ HalAcpiAuditInformation
Definition: haltypes.h:55
@ HalNumaTopologyInterface
Definition: haltypes.h:40
@ HalQueryMaxHotPlugMemoryAddress
Definition: haltypes.h:46
@ HalPlatformTimerInformation
Definition: haltypes.h:54
@ HalPowerInformation
Definition: haltypes.h:32
@ HalQueryProfileSourceList
Definition: haltypes.h:49
@ HalErrorInformation
Definition: haltypes.h:41
@ HalQueryAMLIIllegalIOPortAddresses
Definition: haltypes.h:45
@ HalFrameBufferCachingInformation
Definition: haltypes.h:37
@ HalCmcLogInformation
Definition: haltypes.h:42
@ HalProcessorFeatureInformation
Definition: haltypes.h:39
@ HalInstalledBusInformation
Definition: haltypes.h:29
@ HalCpeLogInformation
Definition: haltypes.h:43