xref: /reactos/hal/halx86/generic/sysinfo.c (revision 299e4305)
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>
13 #define NDEBUG
14 #include <debug.h>
15 
16 HAL_AMLI_BAD_IO_ADDRESS_LIST HalAMLIBadIOAddressList[] =
17 {
18     { 0x0000, 0x10, 1, NULL }, // DMA controller
19     { 0x0020, 0x02, 0, NULL }, // Programmable Interrupt Controller (8259A)
20     { 0x0040, 0x04, 1, NULL }, // System Timer 1
21     { 0x0048, 0x04, 1, NULL }, // System Timer 2 failsafe
22     { 0x0070, 0x02, 1, NULL }, // Real-time clock
23     { 0x0074, 0x03, 1, NULL }, // Extended CMOS
24     { 0x0081, 0x03, 1, NULL }, // DMA 1 page registers
25     { 0x0087, 0x01, 1, NULL }, // DMA 1 Ch 0 low page
26     { 0x0089, 0x01, 1, NULL }, // DMA 2 page registers
27     { 0x008A, 0x02, 1, NULL }, // DMA 2 page registers
28     { 0x008F, 0x01, 1, NULL }, // DMA 2 low page refresh
29     { 0x0090, 0x02, 1, NULL }, // Arbitration control
30     { 0x0093, 0x02, 1, NULL }, // Reserved system board setup
31     { 0x0096, 0x02, 1, NULL }, // POS channel select
32     { 0x00A0, 0x02, 0, NULL }, // Cascaded PIC
33     { 0x00C0, 0x20, 1, NULL }, // ISA DMA
34     { 0x04D0, 0x02, 0, NULL }, // PIC edge/level registers
35     { 0x0CF8, 0x08, 1, &HaliHandlePCIConfigSpaceAccess }, // PCI configuration space
36     { 0x0000, 0x00, 0, NULL } // Reserved
37 };
38 
39 /* FUNCTIONS ******************************************************************/
40 
41 NTSTATUS
42 NTAPI
43 HaliHandlePCIConfigSpaceAccess(_In_ BOOLEAN IsRead,
44                                _In_ ULONG Port,
45                                _In_ ULONG Length,
46                                _Inout_ PULONG Buffer)
47 {
48     DPRINT1("HaliHandlePCIConfigSpaceAccess: IsRead %X, Port 0x%X, Length %u, Buffer %p\n", IsRead, Port, Length, Buffer);
49     //ASSERT(FALSE);
50     return STATUS_NOT_IMPLEMENTED;
51 }
52 
53 NTSTATUS
54 NTAPI
55 HaliQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass,
56                            IN ULONG BufferSize,
57                            IN OUT PVOID Buffer,
58                            OUT PULONG ReturnedLength)
59 {
60 #define REPORT_THIS_CASE(X) case X: DPRINT1("Unhandled case: %s\n", #X); break
61     switch (InformationClass)
62     {
63         REPORT_THIS_CASE(HalInstalledBusInformation);
64         REPORT_THIS_CASE(HalProfileSourceInformation);
65         REPORT_THIS_CASE(HalInformationClassUnused1);
66         REPORT_THIS_CASE(HalPowerInformation);
67         REPORT_THIS_CASE(HalProcessorSpeedInformation);
68         REPORT_THIS_CASE(HalCallbackInformation);
69         REPORT_THIS_CASE(HalMapRegisterInformation);
70         REPORT_THIS_CASE(HalMcaLogInformation);
71         case HalFrameBufferCachingInformation:
72         {
73             /* FIXME: TODO */
74             return STATUS_NOT_IMPLEMENTED;
75         }
76         REPORT_THIS_CASE(HalDisplayBiosInformation);
77         REPORT_THIS_CASE(HalProcessorFeatureInformation);
78         REPORT_THIS_CASE(HalNumaTopologyInterface);
79         REPORT_THIS_CASE(HalErrorInformation);
80         REPORT_THIS_CASE(HalCmcLogInformation);
81         REPORT_THIS_CASE(HalCpeLogInformation);
82         REPORT_THIS_CASE(HalQueryMcaInterface);
83         case HalQueryAMLIIllegalIOPortAddresses:
84         {
85             ULONG Size = sizeof(HalAMLIBadIOAddressList);
86             NTSTATUS Status = STATUS_INFO_LENGTH_MISMATCH;
87 
88             if (BufferSize >= Size)
89             {
90                 RtlCopyMemory(Buffer, HalAMLIBadIOAddressList, Size);
91                 Status = STATUS_SUCCESS;
92             }
93 
94             *ReturnedLength = Size;
95             KeFlushWriteBuffer();
96             return Status;
97         }
98 
99         REPORT_THIS_CASE(HalQueryMaxHotPlugMemoryAddress);
100         REPORT_THIS_CASE(HalPartitionIpiInterface);
101         REPORT_THIS_CASE(HalPlatformInformation);
102         REPORT_THIS_CASE(HalQueryProfileSourceList);
103         REPORT_THIS_CASE(HalInitLogInformation);
104         REPORT_THIS_CASE(HalFrequencyInformation);
105         REPORT_THIS_CASE(HalProcessorBrandString);
106         REPORT_THIS_CASE(HalHypervisorInformation);
107         REPORT_THIS_CASE(HalPlatformTimerInformation);
108         REPORT_THIS_CASE(HalAcpiAuditInformation);
109     }
110 #undef REPORT_THIS_CASE
111 
112     UNIMPLEMENTED;
113     return STATUS_NOT_IMPLEMENTED;
114 }
115 
116 NTSTATUS
117 NTAPI
118 HaliSetSystemInformation(IN HAL_SET_INFORMATION_CLASS InformationClass,
119                          IN ULONG BufferSize,
120                          IN OUT PVOID Buffer)
121 {
122     UNIMPLEMENTED;
123     return STATUS_NOT_IMPLEMENTED;
124 }
125