summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halncr/i386/ncrhwsup.c
blob: 89e36b2e7db8e2dcba23d86cf431cdc43619e766 (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

/*++

Copyright (c) 1992  NCR - MSBU

Module Name:

    ncrhwsup.c

Abstract:


Author:

    Richard Barton (o-richb) 11-Mar-1992

Environment:

    Kernel mode only.

Revision History:

--*/

#include "halp.h"
#include "ncr.h"
#include "ncrcat.h"
#include "ncrpsi.h"

extern ULONG	NCRActiveProcessorCount;

ULONG	NCRSysIntCount;
ULONG	NCRSingleBitCount;

ULONG	NCRLockedExchangeAndAdd(PULONG, ULONG);


VOID
NCRHandleSysInt (TrapFramePtr, ExceptionRecordPtr)
IN PKTRAP_FRAME		TrapFramePtr;
IN PVOID		ExceptionRecordPtr;
/*++

Routine Description:
    Handles the NCR hardware generated System Interrupt

Arguments:

Return Value:
    none.

--*/
{

    DbgBreakPoint();
    return ;

#if 0
	ULONG	i;

	i = NCRLockedExchangeAndAdd(&NCRSysIntCount, 1);
	if (i != 0) {
		for (i = 100000;
		     ((NCRSysIntCount != NCRActiveProcessorCount) &&
		      (i > 0)); --i)  ;
		KiIpiServiceRoutine(TrapFramePtr, ExceptionRecordPtr);
		return;
	}

	DbgPrint("NCRHandleSysInt");
	DbgBreakPoint();

	NCRSysIntCount = 0;
#endif
}


VOID
NCRHandleSingleBitError (TrapFramePtr, ExceptionRecordPtr)
IN PKTRAP_FRAME		TrapFramePtr;
IN PVOID		ExceptionRecordPtr;
/*++

Routine Description:
    Handles the NCR hardware generated Single Bit Error Interrupt and a 
    Status Change

Arguments:

Return Value:
    none.

--*/
{
    CAT_CONTROL cat_control;
    PSI_INFORMATION psi_information;

    cat_control.Module = PSI;
    cat_control.Asic = CAT_I;

//
// Lets get the CatBus spin lock because the status change interrupt is a broadcast 
// interrupt that goes to all CPU's
//

    HalpAcquireCatBusSpinLock();

// 
// read status registers from PSI.  This will tell us if a status change interrupt occured. 
// 
    cat_control.Command = READ_REGISTER; 
    cat_control.Address = 0; 
    cat_control.NumberOfBytes = sizeof(CAT_REGISTERS); 
    HalpCatBusIo(&cat_control,(PUCHAR)&(psi_information.CatRegisters.CatRegs));

    if (psi_information.INTERRUPT_STATUS) {

    //
    // A status change interrupt has occured.  Lets go read detailed status information so
    // the interrupt will be cleared.
    //

    //
    // read power supply mask registers
    //
        cat_control.Command = READ_SUBADDR;
        cat_control.Address = PSI_Pwr_Supply_Status_L5;
        cat_control.NumberOfBytes = 8;
        HalpCatBusIo(&cat_control,(PUCHAR)&(psi_information.PowerSupplyStatus));
    //
    // read disk power registers
    //
        cat_control.Command = READ_SUBADDR;
        cat_control.Address = PSI_DiskStatus_L5;
        cat_control.NumberOfBytes = 16;
        HalpCatBusIo(&cat_control,(PUCHAR)&(psi_information.DiskPowerStatus[0]));
    //
    // read DVM registers
    //
        cat_control.Command = READ_SUBADDR;
        cat_control.Address = PSI_Dvm_Select_L5;
        cat_control.NumberOfBytes = 1;
        HalpCatBusIo(&cat_control,(PUCHAR)&(psi_information.DvmSelect));

        cat_control.Command = READ_SUBADDR;
        cat_control.Address = DVM_DBASE;
        cat_control.NumberOfBytes = 4;
        HalpCatBusIo(&cat_control,(PUCHAR)&(psi_information.DvmData0));

    } else {

    //
    // This path means another CPU has handled the status change.
    //
    // NOTE: If single bit error reporting were enabled then this path could also
    //       mean a single bit error occured.
    //

    }

    //
    // Release the CatBus spin lock.
    //

    HalpReleaseCatBusSpinLock();

    if (psi_information.INTERRUPT_STATUS) {
	    DBGMSG(("A Status Change Interrupt was received: 0x%x\n",psi_information.INTERRUPT_STATUS));
    }
}