Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: hostErrInjTab.vr | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | #include <vera_defines.vrh> | |
36 | #include <ListMacros.vrh> | |
37 | ||
38 | #include "niu_error_dfn.vri" | |
39 | #include "niu_cbclass.vrh" | |
40 | ||
41 | class CHostErrInjTab { | |
42 | ||
43 | integer no_of_errors_set; | |
44 | local CcbErrArray cberrDfn[]; | |
45 | ||
46 | function integer SetErrorDfn( CcbErrDfn cb); | |
47 | function integer ChkErrorDfn(CcbErrDfn cb, var integer status ); | |
48 | function integer ClrErrorDfn(CcbErrDfn cb); | |
49 | task new() { | |
50 | no_of_errors_set = 0; | |
51 | } | |
52 | ||
53 | } | |
54 | ||
55 | function integer CHostErrInjTab::SetErrorDfn( CcbErrDfn cb){ | |
56 | // N2 - 64 byte aligned address only | |
57 | cb.address = ((cb.address)>>6)<<6; | |
58 | if ( assoc_index(CHECK,this.cberrDfn,cb.address)) { | |
59 | printf(" Error Defination already set for address - %x Adding one more for this address -- \n",cb.address); | |
60 | cberrDfn[cb.address].add(cb); | |
61 | SetErrorDfn = no_of_errors_set; | |
62 | printf("ErrCB DEBUG- Callback Set for address - %x , NoofActiveErrCBS - %d \n",cb.address,no_of_errors_set); | |
63 | } else { | |
64 | cberrDfn[cb.address] = new (); | |
65 | cberrDfn[cb.address].add(cb); | |
66 | no_of_errors_set ++; | |
67 | SetErrorDfn = no_of_errors_set; | |
68 | printf("ErrCB DEBUG- Callback Set for address - %x , NoofActiveErrCBS - %d \n",cb.address,no_of_errors_set); | |
69 | ||
70 | ||
71 | ||
72 | ||
73 | /* how to add this to Denali- | |
74 | 1. Set Call back on Denali for address cb.address | |
75 | 2. Once the call back is successful, call ClrErrorDfn function | |
76 | */ | |
77 | ||
78 | } | |
79 | ||
80 | } | |
81 | function integer CHostErrInjTab::ChkErrorDfn(CcbErrDfn cb, var integer status ){ | |
82 | CcbErrDfn error_dfn; | |
83 | integer s,d; | |
84 | if(assoc_index(CHECK,this.cberrDfn,cb.address)) { | |
85 | s= this.cberrDfn[cb.address].get(error_dfn); | |
86 | if(s==0) { // No More for this address | |
87 | if(error_dfn.error_code & SIU_SpuriousResp) { | |
88 | d = ClrErrorDfn(cb); | |
89 | } else { | |
90 | // add this back into the queue | |
91 | cberrDfn[cb.address].add_front(error_dfn); | |
92 | } | |
93 | } else { | |
94 | // Do Nothing | |
95 | } | |
96 | status = 1; | |
97 | ChkErrorDfn = error_dfn.error_code; | |
98 | printf("CHostErrInjTab::ChkErrorDfn ErrorCode for Address - %x is - %d \n",cb.address,ChkErrorDfn); | |
99 | } else { | |
100 | status = -1; | |
101 | ChkErrorDfn = -1; | |
102 | } | |
103 | printf("CHostErrInjTab::ChkErrorDfn ErrorCode for Address - %x is - %d \n",cb.address,ChkErrorDfn); | |
104 | } | |
105 | ||
106 | function integer CHostErrInjTab::ClrErrorDfn(CcbErrDfn cb) { | |
107 | CcbErrDfn cb_delete; | |
108 | integer status; | |
109 | if(assoc_index(CHECK,this.cberrDfn,cb.address)) { | |
110 | // do the appropriate action and return the status | |
111 | ClrErrorDfn = 1; | |
112 | status = assoc_index(DELETE,this.cberrDfn,cb.address); | |
113 | // printf("CHostErrInjTab::ClrErrorDfn ErrorCode for Address - %x is - %d \n",cb.address,status); | |
114 | no_of_errors_set--; | |
115 | ClrErrorDfn = status; | |
116 | } else ClrErrorDfn = -1; | |
117 | } | |
118 | ||
119 |