summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halalpha/info.c
blob: 141ceff53ccd5189c6d74aaca17e7a01d191fc31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*++

Copyright (c) 1991  Microsoft Corporation
Copyright (c) 1994  Digital Equipment Corporation

Module Name:

    info.c

Abstract:

Author:

    Ken Reneris (kenr)  08-Aug-1994

Environment:

    Kernel mode only.

Revision History:

--*/


#include "halp.h"

#ifdef _PNP_POWER_
HAL_CALLBACKS   HalCallback;
#endif // _PNP_POWER_

//
//  External references
//

extern WINDOW_CONTROL_REGISTERS HalpIsaWindowControl;
extern WINDOW_CONTROL_REGISTERS HalpMasterWindowControl;



NTSTATUS
HalpQueryInstalledBusInformation (
    OUT PVOID   Buffer,
    IN  ULONG   BufferLength,
    OUT PULONG  ReturnedLength
    );


#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE,HaliQuerySystemInformation)
#pragma alloc_text(PAGE,HaliSetSystemInformation)
#endif


NTSTATUS
HaliQuerySystemInformation(
    IN HAL_QUERY_INFORMATION_CLASS  InformationClass,
    IN ULONG     BufferSize,
    IN OUT PVOID Buffer,
    OUT PULONG   ReturnedLength
    )
/*++

Routine Description:

    The function returns system-wide information controlled by the HAL for a
    variety of classes.

Arguments:

    InformationClass - Information class of the request.

    BufferSize - Size of buffer supplied by the caller.

    Buffer - Supplies the space to store the data and pass additional info.

    ReturnedLength - Supplies a count in bytes of the amount of data returned.

Return Value:

    STATUS_SUCCESS or error.

--*/
{
    NTSTATUS Status;
    PULONG mapRegisters;

    switch (InformationClass) {
        case HalInstalledBusInformation:
            Status = HalpQueryInstalledBusInformation (
                        Buffer,
                        BufferSize,
                        ReturnedLength
                        );
            break;

        case HalProfileSourceInformation:
            Status = HalpProfileSourceInformation (
                        Buffer,
                        BufferSize,
                        ReturnedLength);
            break;

        case HalMapRegisterInformation:
            mapRegisters = (PULONG)Buffer;
            if ( BufferSize < 4 ) {
                Status = STATUS_BUFFER_TOO_SMALL;
            } else {
                switch ( *(PULONG)Buffer ) {
                    case Isa:
                        *mapRegisters = HalpIsaWindowControl.WindowSize / PAGE_SIZE;
                        *ReturnedLength = 4;
                        Status = STATUS_SUCCESS;
                        break;

                    case Eisa:
                    case PCIBus:
                        *mapRegisters = HalpMasterWindowControl.WindowSize / PAGE_SIZE;
                        *ReturnedLength = 4;
                        Status = STATUS_SUCCESS;
                        break;

                    default:
                        Status = STATUS_INVALID_PARAMETER;
                        break;
                } 
            } 
            break;

        default:
            Status = STATUS_INVALID_LEVEL;
            break;
    }

    return(Status);
}

NTSTATUS
HaliSetSystemInformation (
    IN HAL_SET_INFORMATION_CLASS    InformationClass,
    IN ULONG     BufferSize,
    IN PVOID     Buffer
    )
/*++

Routine Description:

    The function allows setting of various fields return by
    HalQuerySystemInformation.

Arguments:

    InformationClass - Information class of the request.

    BufferSize - Size of buffer supplied by the caller.

    Buffer - Supplies the data to be set.

Return Value:

    STATUS_SUCCESS or error.

--*/
{
    NTSTATUS Status;

    switch (InformationClass) {

        case HalProfileSourceInterval:
            Status = HalpProfileSourceInterval (
                        Buffer,
                        BufferSize);
            break;

        default:
            Status = STATUS_INVALID_LEVEL;
            break;
    }

    return Status;
}