ReactOS 0.4.17-dev-508-gc3d141b
sysinfo.c File Reference
#include <hal.h>
#include <x86x64/Cpuid.h>
#include <debug.h>
Include dependency graph for sysinfo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define REPORT_THIS_CASE(X)   case X: DPRINT1("Unhandled case: %s\n", #X); break
 

Typedefs

typedef unsigned int UINT = NULL
 

Functions

NTSTATUS NTAPI HaliHandlePCIConfigSpaceAccess (_In_ BOOLEAN IsRead, _In_ ULONG Port, _In_ ULONG Length, _Inout_ PULONG Buffer)
 
static NTSTATUS HaliQueryProcessorBrandString (_Out_writes_(BrandStringLength) PCHAR BrandString, _In_ ULONG BrandStringLength, _Out_ PULONG ReturnedLength)
 
NTSTATUS NTAPI HaliQuerySystemInformation (IN HAL_QUERY_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer, OUT PULONG ReturnedLength)
 
NTSTATUS NTAPI HaliSetSystemInformation (IN HAL_SET_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer)
 

Variables

HAL_AMLI_BAD_IO_ADDRESS_LIST HalAMLIBadIOAddressList []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 16 of file sysinfo.c.

◆ REPORT_THIS_CASE

#define REPORT_THIS_CASE (   X)    case X: DPRINT1("Unhandled case: %s\n", #X); break

Typedef Documentation

◆ UINT

Definition at line 13 of file sysinfo.c.

Function Documentation

◆ HaliHandlePCIConfigSpaceAccess()

NTSTATUS NTAPI HaliHandlePCIConfigSpaceAccess ( _In_ BOOLEAN  IsRead,
_In_ ULONG  Port,
_In_ ULONG  Length,
_Inout_ PULONG  Buffer 
)

Definition at line 46 of file sysinfo.c.

50{
51 DPRINT1("HaliHandlePCIConfigSpaceAccess: IsRead %X, Port 0x%X, Length %u, Buffer %p\n", IsRead, Port, Length, Buffer);
52 //ASSERT(FALSE);
54}
#define DPRINT1
Definition: precomp.h:8
Definition: bufpool.h:45
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
CPPORT Port[4]
Definition: headless.c:38
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

◆ HaliQueryProcessorBrandString()

static NTSTATUS HaliQueryProcessorBrandString ( _Out_writes_(BrandStringLength) PCHAR  BrandString,
_In_ ULONG  BrandStringLength,
_Out_ PULONG  ReturnedLength 
)
static

Definition at line 58 of file sysinfo.c.

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}
#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
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:188
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
char CHAR
Definition: pedump.c:57
#define STATUS_SUCCESS
Definition: shellext.h:65
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133

Referenced by HaliQuerySystemInformation().

◆ HaliQuerySystemInformation()

NTSTATUS NTAPI HaliQuerySystemInformation ( IN HAL_QUERY_INFORMATION_CLASS  InformationClass,
IN ULONG  BufferSize,
IN OUT PVOID  Buffer,
OUT PULONG  ReturnedLength 
)

Definition at line 99 of file sysinfo.c.

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}
LONG NTSTATUS
Definition: precomp.h:26
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1713
Status
Definition: gdiplustypes.h:24
VOID NTAPI KeFlushWriteBuffer(VOID)
Definition: misc.c:39
static NTSTATUS HaliQueryProcessorBrandString(_Out_writes_(BrandStringLength) PCHAR BrandString, _In_ ULONG BrandStringLength, _Out_ PULONG ReturnedLength)
Definition: sysinfo.c:58
#define REPORT_THIS_CASE(X)
HAL_AMLI_BAD_IO_ADDRESS_LIST HalAMLIBadIOAddressList[]
Definition: sysinfo.c:19
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
_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
@ 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

◆ HaliSetSystemInformation()

NTSTATUS NTAPI HaliSetSystemInformation ( IN HAL_SET_INFORMATION_CLASS  InformationClass,
IN ULONG  BufferSize,
IN OUT PVOID  Buffer 
)

Definition at line 165 of file sysinfo.c.

168{
171}

Variable Documentation

◆ HalAMLIBadIOAddressList

HAL_AMLI_BAD_IO_ADDRESS_LIST HalAMLIBadIOAddressList[]
Initial value:
=
{
{ 0x0000, 0x10, 1, NULL },
{ 0x0020, 0x02, 0, NULL },
{ 0x0040, 0x04, 1, NULL },
{ 0x0048, 0x04, 1, NULL },
{ 0x0070, 0x02, 1, NULL },
{ 0x0074, 0x03, 1, NULL },
{ 0x0081, 0x03, 1, NULL },
{ 0x0087, 0x01, 1, NULL },
{ 0x0089, 0x01, 1, NULL },
{ 0x008A, 0x02, 1, NULL },
{ 0x008F, 0x01, 1, NULL },
{ 0x0090, 0x02, 1, NULL },
{ 0x0093, 0x02, 1, NULL },
{ 0x0096, 0x02, 1, NULL },
{ 0x00A0, 0x02, 0, NULL },
{ 0x00C0, 0x20, 1, NULL },
{ 0x04D0, 0x02, 0, NULL },
{ 0x0CF8, 0x08, 1, &HaliHandlePCIConfigSpaceAccess },
{ 0x0000, 0x00, 0, NULL }
}
#define NULL
Definition: types.h:112
NTSTATUS NTAPI HaliHandlePCIConfigSpaceAccess(_In_ BOOLEAN IsRead, _In_ ULONG Port, _In_ ULONG Length, _Inout_ PULONG Buffer)
Definition: sysinfo.c:46

Definition at line 19 of file sysinfo.c.

Referenced by HaliQuerySystemInformation().