Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: niu_tx_errors.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 "hostErrInjTab.vrh" | |
36 | #include "hostRdCbMgr.vrh" | |
37 | #include "niu_cbclass.vrh" | |
38 | #include "niu_txtoken.vrh" | |
39 | #include "niu_tx_pktconfig.vrh" | |
40 | ||
41 | extern CHostErrInjTab HostErrInj; | |
42 | ||
43 | ||
44 | ||
45 | class CSetTxError { | |
46 | ||
47 | function integer set_up_errors(TxPacketGenConfig PktGenConfig, CTxToken TxToken); | |
48 | task set_host_err_callback(bit [39:0] call_bk_addr, integer host_err_code); | |
49 | task new(){ | |
50 | } | |
51 | ||
52 | } | |
53 | ||
54 | task CSetTxError::set_host_err_callback(bit [39:0] call_bk_addr, integer host_err_code) | |
55 | { | |
56 | ||
57 | integer status; | |
58 | CcbErrDfn HostErrorDfn; | |
59 | HostErrorDfn = new(); | |
60 | HostErrorDfn.address = {24'h0,call_bk_addr}; | |
61 | HostErrorDfn.error_code = host_err_code; | |
62 | status = HostErrInj.SetErrorDfn(HostErrorDfn); | |
63 | printf("CSetTxError::set_host_err_callback: Address - %x code - %d \n",call_bk_addr,host_err_code); | |
64 | } | |
65 | ||
66 | function integer CSetTxError::set_up_errors(TxPacketGenConfig PktGenConfig, CTxToken TxToken){ | |
67 | ||
68 | CNiuErrors error_info; | |
69 | integer host_errors,packet_errors; | |
70 | integer dma_errors; | |
71 | bit[63:0] address; | |
72 | set_up_errors = 0; | |
73 | ||
74 | if(PktGenConfig.error_info.isErrSet() ==0) { | |
75 | // Do Nothing | |
76 | } else { | |
77 | // Parse Through the Error and start setting up things | |
78 | // Create a local copy - easy to work with | |
79 | error_info = PktGenConfig.error_info.object_copy(); | |
80 | host_errors = error_info.hosterrors.isErrSet(); | |
81 | if(host_errors) { | |
82 | packet_errors = error_info.hosterrors.packet_errors; | |
83 | dma_errors = error_info.hosterrors.dma_errors; | |
84 | ||
85 | if(packet_errors == NACK_PKT_RD_SOP) { | |
86 | address = TxToken.xlate_gather_address[0]; | |
87 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
88 | } | |
89 | ||
90 | if(packet_errors == NACK_PKT_RD_EOP) { | |
91 | address = TxToken.xlate_gather_address[TxToken.NoofGathers-1] + TxToken.gather_pkt_length[TxToken.NoofGathers-1]; | |
92 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
93 | } | |
94 | ||
95 | if(packet_errors == NACK_PKT_RD_MID) { | |
96 | // Pick some location randomly | |
97 | address = TxToken.xlate_gather_address[0] + TxToken.gather_pkt_length[0]; | |
98 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
99 | ||
100 | } | |
101 | ||
102 | if(packet_errors == PKT_SPURIOUS_RESP) { | |
103 | address = TxToken.xlate_gather_address[0]; | |
104 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
105 | error_info.hosterrors.packet_errors = 0; | |
106 | printf("Inducing spurious respones on Pkt Responses\n"); | |
107 | } | |
108 | ||
109 | if(dma_errors == NACK_PREF_ERROR) { | |
110 | address = TxToken.xlate_desc_addr; | |
111 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
112 | printf("Inducing nack_pref_err\n"); | |
113 | } | |
114 | ||
115 | if(dma_errors == MBOX_ERROR) { | |
116 | address = TxToken.xlate_mb_addr; | |
117 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
118 | printf("Inducing Mbox_nack_err\n"); | |
119 | } | |
120 | ||
121 | if(dma_errors == PREF_SPURIOUS_RESP) { | |
122 | address = TxToken.xlate_desc_addr; | |
123 | set_host_err_callback(address[39:0],error_info.hosterrors.host_error_code); | |
124 | printf("Inducing spurious respones on Descriptor fetch\n"); | |
125 | error_info.hosterrors.dma_errors = 0; | |
126 | } | |
127 | ||
128 | set_up_errors = 1; | |
129 | if(host_errors&SIU_CtagSingleBitEccErr) { | |
130 | set_up_errors = 0; | |
131 | } else { | |
132 | set_up_errors = 1; | |
133 | } | |
134 | TxToken.error_info = error_info.object_copy(); | |
135 | ||
136 | ||
137 | ||
138 | } | |
139 | // DO SOME MORE HERE | |
140 | ||
141 | } | |
142 | } | |
143 | ||
144 |