summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halcaro/ppc/pxsysint.c
blob: bf51c060772311f15bf3e959fa40ebc66c1dfb4d (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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*++

Copyright (c) 1991-1993  Microsoft Corporation

Copyright (c) 1994 MOTOROLA, INC.  All Rights Reserved.  This file
contains copyrighted material.  Use of this file is restricted
by the provisions of a Motorola Software License Agreement.

Module Name:

    pxsysint.c

Abstract:

    This module implements the HAL enable/disable system interrupt, and
    request interprocessor interrupt routines for a Power PC.



Author:

    David N. Cutler (davec) 6-May-1991

Environment:

    Kernel mode

Revision History:

    Jim Wooldridge

         Removed internal interrupt support
         Changed irql mapping
         Removed internal bus support
         Removed EISA, added PCI, PCMCIA, and ISA bus support

    Steve Johns
         Changed to support Timer 1 as profile interrupt
         Added HalAcknowledgeIpi
--*/

#include "halp.h"
#include "pxidesup.h"


VOID
HalDisableSystemInterrupt (
    IN ULONG Vector,
    IN KIRQL Irql
    )

/*++

Routine Description:

    This routine disables the specified system interrupt.

Arguments:

    Vector - Supplies the vector of the system interrupt that is disabled.

    Irql - Supplies the IRQL of the interrupting source.

Return Value:

    None.

--*/

{

    KIRQL OldIrql;

    //
    // Raise IRQL to the highest level and acquire device enable spinlock.
    //

    KeRaiseIrql(HIGH_LEVEL, &OldIrql);
    KiAcquireSpinLock(&HalpSystemInterruptLock);


    //
    // If the vector number is within the range of the EISA interrupts, then
    // disable the EISA interrupt.
    //

    if (Vector == DEVICE_VECTORS + PRIMARY_IDE_VECTOR ||
        Vector == DEVICE_VECTORS + SECONDARY_IDE_VECTOR) {
       HalpDisableSioInterrupt(IDE_DISPATCH_VECTOR + DEVICE_VECTORS);
    }
    else if (Vector >= DEVICE_VECTORS &&
        Vector < DEVICE_VECTORS + MAXIMUM_DEVICE_VECTOR ) {
        HalpDisableSioInterrupt(Vector);
    }

    //
    // Release the device enable spin lock and lower IRQL to the previous level.
    //

    KiReleaseSpinLock(&HalpSystemInterruptLock);
    KeLowerIrql(OldIrql);
    return;
}

BOOLEAN
HalEnableSystemInterrupt (
    IN ULONG Vector,
    IN KIRQL Irql,
    IN KINTERRUPT_MODE InterruptMode
    )

/*++

Routine Description:

    This routine enables the specified system interrupt.

Arguments:

    Vector - Supplies the vector of the system interrupt that is enabled.

    Irql - Supplies the IRQL of the interrupting source.

    InterruptMode - Supplies the mode of the interrupt; LevelSensitive or
        Latched.

Return Value:

    TRUE if the system interrupt was enabled

--*/

{

    KIRQL OldIrql;
    KINTERRUPT_MODE TranslatedInterruptMode;

    //
    // Raise IRQL to the highest level and acquire device enable spinlock.
    //

    KeRaiseIrql(HIGH_LEVEL, &OldIrql);
    KiAcquireSpinLock(&HalpSystemInterruptLock);

    //
    // If the vector number is within the range of the EISA interrupts, then
    // enable the EISA interrupt and set the Level/Edge register.
    //

    if (Vector == DEVICE_VECTORS + PRIMARY_IDE_VECTOR ||
        Vector == DEVICE_VECTORS + SECONDARY_IDE_VECTOR) {
       TranslatedInterruptMode = HalpGetInterruptMode(DEVICE_VECTORS +
                                                      IDE_DISPATCH_VECTOR,
                                                      Irql, InterruptMode);


       HalpEnableSioInterrupt( DEVICE_VECTORS + IDE_DISPATCH_VECTOR,
                               TranslatedInterruptMode);
    }
    else if (Vector >= DEVICE_VECTORS &&
        Vector < DEVICE_VECTORS + MAXIMUM_DEVICE_VECTOR ) {

       //
       // get translated interrupt mode
       //


       TranslatedInterruptMode = HalpGetInterruptMode(Vector, Irql, InterruptMode);


       HalpEnableSioInterrupt( Vector, TranslatedInterruptMode);
       // HalpEnableSioInterrupt( Vector, InterruptMode);
    }

    //
    // Release the device enable spin lock and lower IRQL to the previous level.
    //

    KiReleaseSpinLock(&HalpSystemInterruptLock);
    KeLowerIrql(OldIrql);
    return TRUE;
}

VOID
HalRequestIpi (
    IN ULONG Mask
    )

/*++

Routine Description:

    This routine requests an interprocessor interrupt on a set of processors.

    N.B. This routine must ensure that the interrupt is posted at the target
         processor(s) before returning.

Arguments:

    Mask - Supplies the set of processors that are sent an interprocessor
        interrupt.

Return Value:

    None.

--*/

{

    //
    // Request an interprocessor interrupt on each of the specified target
    // processors.
    //


    return;
}

BOOLEAN
HalAcknowledgeIpi (VOID)

/*++

Routine Description:

    This routine aknowledges an interprocessor interrupt on a set of
     processors.

Arguments:

    None

Return Value:

    TRUE if the IPI is valid; otherwise FALSE is returned.

--*/

{
    return (TRUE);
}