1 void intr_channel(unsigned int evs
, unsigned int tcs
, unsigned int mcs
);
3 void rdma_interrupt(struct pt_regs
*regs
)
5 register volatile unsigned int evs
, tcs
, mcs
;
7 evs
= RDR_rdma(SHIFT_CS
);
9 WRR_rdma(SHIFT_CS
, evs
| CS_SIE
);
10 event_intr(0, INTR_SIE_EVENT
, 0, 0);
14 event_intr(0, INTR_BUS_EVENT
, 0, 0);
17 while ((evs
= RDR_rdma(SHIFT_ES(0))) & irq_mc
) {
18 WRR_rdma(SHIFT_ES(0), evs
& ~ES_SM_Ev
);
19 tcs
= RDR_rdma(SHIFT_DMA_TCS(0));
20 mcs
= RDR_rdma(SHIFT_MSG_CS(0));
21 intr_channel(evs
, tcs
, mcs
);
24 // ack_APIC_irq(); /* remove in apic.c */
28 void intr_channel(unsigned int evs
, unsigned int tcs
, unsigned int mcs
)
30 struct stat_rdma
*pst
;
33 dev_rdma_sem_t
*dev_sem
;
35 register volatile unsigned int tbc
;
37 rdma_state_inst_t
*xspi
= &rdma_state
->rdma_sti
[0];
39 /// pcibios_read_config_dword(bus_number_rdma, devfn_rdma, 0x40, &int_cnt);
40 /// event_intr(0, INTR_START_EVENT, evs, int_cnt);
44 if (evs
& ES_RGP3M_Ev
) {
45 dev_rdma_sem_t
*dev_sem
;
47 if (RDR_rdma(SHIFT_CAM(0))) {
48 WRR_rdma(SHIFT_CAM(0), 0);
50 pd
= &xspi
->rw_states_d
[READER
];
52 dev_sem
= &pcam
->dev_rdma_sem
;
53 raw_spin_lock(&dev_sem
->lock
);
54 if (pcam
->stat
== 1) {
55 pcam
->clkr
= E2K_GET_DSREG(clkr
);
56 pcam
->int_cnt
= int_cnt
;
57 rdma_cv_broadcast_rdma(&pcam
->dev_rdma_sem
);
59 raw_spin_unlock(&dev_sem
->lock
);
61 if (state_cam
== RDMA_UNSET_CAM
) {
63 dev_sem
= &pcam
->dev_rdma_sem
;
64 raw_spin_lock(&dev_sem
->lock
);
65 if (pcam
->stat
== 1) {
66 pcam
->clkr
= E2K_GET_DSREG(clkr
);
67 pcam
->int_cnt
= int_cnt
;
68 rdma_cv_broadcast_rdma(&pcam
->dev_rdma_sem
);
70 raw_spin_unlock(&dev_sem
->lock
);
72 WRR_rdma(SHIFT_CAM(0), tr_atl
);
74 dev_sem
= &pcam
->dev_rdma_sem
;
75 raw_spin_lock(&dev_sem
->lock
);
77 rdma_cv_broadcast_rdma(&pcam
->dev_rdma_sem
);
78 raw_spin_unlock(&dev_sem
->lock
);
82 cur_clock
= (unsigned long)jiffies
;
83 if (evs
& ES_CMIE_Ev
) {
84 WRR_rdma(SHIFT_MSG_CS(0), MSG_CS_Msg_Rst
);
85 event_intr(0, INTR_CMIE_EVENT
, 0, 0);
89 if (evs
& ES_RDC_Ev
) {
90 pd
= xspi
->rw_states_rd
;
91 xspi
->rw_states_rd
= 0;
93 event_intr(0, INTR_RDC_PD_NULL_EVENT
,
94 intr_rdc_count
[0], tcs
);
98 dev_sem
= &pd
->dev_rdma_sem
;
99 raw_spin_lock(&dev_sem
->lock
);
101 event_intr(0, INTR_RDC_EVENT
, pd
->int_ac
, intr_rdc_count
[0]);
102 pd
->clock_rdc
= cur_clock
;
103 switch (pd
->int_ac
) {
106 event_intr(0, INTR_SIGN2_READ_EVENT
, 0,
108 dev_sem
->time_broadcast
= E2K_GET_DSREG(clkr
);
109 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
115 event_intr(0, INTR_UNEXP2_READ_EVENT
, pd
->int_ac
,
120 raw_spin_unlock(&dev_sem
->lock
);
122 WRR_rdma(SHIFT_DMA_RBC(0), 0x0);
125 rdc_byte
+= allign_dma(pd
->size_trb
);
126 if (rdc_byte
>> 10) {
127 pst
->rdc_kbyte
+= (rdc_byte
>> 10);
131 evs
= evs
& ~ES_RDC_Ev
;
133 if (evs
& (ES_TDC_Ev
| ES_DSF_Ev
)) {
134 pd
= xspi
->rw_states_wr
;
136 event_intr(0, INTR_TDC_DSF_PD_NULL_EVENT
,
137 intr_rdc_count
[0], tcs
);
138 goto ES_TDC_Ev_label
;
140 xspi
->rw_states_wr
= 0;
141 dev_sem
= &pd
->dev_rdma_sem
;
142 raw_spin_lock(&dev_sem
->lock
);
144 pd
->clock_tdc
= cur_clock
;
145 if (evs
& ES_DSF_Ev
) {
146 tbc
= RDR_rdma(SHIFT_DMA_TBC(0));
147 WRR_rdma(SHIFT_DMA_TCS(0), DMA_TCS_Tx_Rst
);
149 event_intr(tbc
, INTR_DSF_EVENT
, pd
->int_ac
, tcs
);
151 event_intr(0, INTR_TDC_EVENT
, pd
->int_ac
,
154 switch (pd
->int_ac
) {
157 event_intr(0, INTR_SIGN1_WRITE_EVENT
, pd
->int_ac
,
159 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
166 event_intr(0, INTR_TDC_UNXP_EVENT
, pd
->int_ac
,
170 raw_spin_unlock(&dev_sem
->lock
);
172 if (evs
& ES_DSF_Ev
) {
174 if (tcs
&DMA_TCS_DPS_Err
)
175 pst
->dma_tcs_dps_err
++;
177 if (tcs
&DMA_TCS_DPCRC_Err
)
178 pst
->dma_tcs_dpcrc_err
++;
180 if (tcs
&DMA_TCS_DPTO_Err
)
181 pst
->dma_tcs_dpto_err
++;
183 if (tcs
&DMA_TCS_DPID_Err
)
184 pst
->dma_tcs_dpid_err
++;
185 if (evs
& ES_TDC_Ev
) {
192 evs
= evs
& (~(ES_TDC_Ev
|ES_DSF_Ev
));
194 if (evs
& ES_RDM_Ev
) {
195 int rdmc
= (evs
& ES_RDMC
)>>27;
202 msg
= RDR_rdma(SHIFT_RDMSG(0));
205 if ((msg
& MSG_OPER
) == MSG_READY
) {
207 switch ((msg
& MSG_ABONENT
) >> SHIFT_ABONENT
) {
212 pd
= &xspi
->rw_states_d
[WRITER
];
215 event_intr(0, INTR_MSG_READY_UNXP_EVENT
,
219 dev_sem
= &pd
->dev_rdma_sem
;
220 raw_spin_lock(&dev_sem
->lock
);
221 event_intr(0, INTR_READY_EVENT
, pd
->int_ac
,
223 switch (pd
->int_ac
) {
227 raw_spin_unlock(&dev_sem
->lock
);
232 raw_spin_unlock(&dev_sem
->lock
);
237 raw_spin_unlock(&dev_sem
->lock
);
242 raw_spin_unlock(&dev_sem
->lock
);
246 pd
->clock_receive_ready
= cur_clock
;
248 event_intr(0, INTR_TDMA_EVENT
, pd
->real_size
,
250 xspi
->rw_states_wr
= pd
;
251 if (RDR_rdma(SHIFT_DMA_TBC(0))) {
253 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
255 raw_spin_unlock(&dev_sem
->lock
);
258 if (RDR_rdma(SHIFT_DMA_TCS(0)) &
261 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
262 raw_spin_unlock(&dev_sem
->lock
);
267 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
268 raw_spin_unlock(&dev_sem
->lock
);
271 WRR_rdma(SHIFT_DMA_TCS(0), DMA_TCS_Tx_Rst
);
272 WRR_rdma(SHIFT_DMA_TSA(0), pd
->dma
);
273 WRR_rdma( SHIFT_DMA_TBC(0), pd
->real_size
);
274 WRR_rdma(SHIFT_DMA_TCS(0),
275 DMA_TCS_TE
| DMA_TCS_TCO
|
276 (pd
->tm
?DMA_TCS_TTM
:0) | DMA_TCS_DRCL
);
277 pd
->tm
?pst
->try_TDMA_tm
++:pst
->try_TDMA
++;
278 raw_spin_unlock(&dev_sem
->lock
);
281 if ((msg
& MSG_OPER
) == MSG_TRWD
) {
285 switch ((msg
& MSG_ABONENT
) >> SHIFT_ABONENT
) {
290 chann
= msg
& MSG_ABONENT
;
291 pd
= &xspi
->rw_states_d
[READER
];
294 event_intr(0, INTR_MSG_TRWD_UNXP_EVENT
,
298 dev_sem
= &pd
->dev_rdma_sem
;
299 pd
->clock_receive_trwd
= cur_clock
;
300 raw_spin_lock(&dev_sem
->lock
);
301 event_intr(0, INTR_TRWD_EVENT
, pd
->int_ac
,
303 switch (pd
->int_ac
) {
307 event_intr(0, INTR_SIGN1_READ_EVENT
,
308 pd
->int_ac
, dev_sem
->num_obmen
);
309 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
310 raw_spin_unlock(&dev_sem
->lock
);
318 event_intr(0, INTR_TRWD_UNXP_EVENT
,
319 pd
->int_ac
, dev_sem
->num_obmen
);
320 raw_spin_unlock(&dev_sem
->lock
);
328 event_intr(0, INTR_TRWD_UNXP_EVENT
,
329 pd
->int_ac
, dev_sem
->num_obmen
);
330 raw_spin_unlock(&dev_sem
->lock
);
338 event_intr(0, INTR_TRWD_UNXP_EVENT
,
339 pd
->int_ac
, dev_sem
->num_obmen
);
340 raw_spin_unlock(&dev_sem
->lock
);
347 event_intr(0, INTR_TRWD_UNXP_EVENT
,
348 pd
->int_ac
, dev_sem
->num_obmen
);
349 raw_spin_unlock(&dev_sem
->lock
);
355 event_intr(0, INTR_TRWD_UNXP_EVENT
,
356 pd
->int_ac
, dev_sem
->num_obmen
);
357 raw_spin_unlock(&dev_sem
->lock
);
360 } else { /* if (msg & MSG_TRWD) { */
361 pm
= &xspi
->rw_states_m
[0];
362 dev_sem
= &pm
->dev_rdma_sem
;
363 raw_spin_lock(&dev_sem
->lock
);
364 if (pm
->stat
== RDMA_IOC_DR
) {
365 event_intr(0, INTR_RMSG_EVENT
,
369 rdma_cv_broadcast_rdma(&pm
->dev_rdma_sem
);
370 raw_spin_unlock(&dev_sem
->lock
);
372 event_intr(0, INTR_RMSG_UNXP_EVENT
,
374 raw_spin_unlock(&dev_sem
->lock
);
379 evs
= evs
& ~ES_RDM_Ev
;
381 if (evs
& ES_MSF_Ev
) {
382 dev_rdma_sem_t
*dev_sem
;
385 WRR_rdma(SHIFT_CAM(0), 0);
386 WRR_rdma(SHIFT_MSG_CS(0), msg_cs_dmrcl
| MSG_CS_Msg_Rst
);
387 event_ioctl(0, INTR_MSF_EVENT
, 1, 0);
388 pcam
= &xspi
->talive
;
389 pd
= &xspi
->rw_states_d
[READER
];
391 dev_sem
= &pcam
->dev_rdma_sem
;
392 raw_spin_lock(&dev_sem
->lock
);
393 if (pcam
->stat
== 1) {
394 pcam
->clkr
= E2K_GET_DSREG(clkr
);
395 pcam
->int_cnt
= int_cnt
;
396 rdma_cv_broadcast_rdma(&pcam
->dev_rdma_sem
);
398 raw_spin_unlock(&dev_sem
->lock
);
400 if (evs
& ES_RGP2M_Ev
) {
404 if (evs
& ES_RGP1M_Ev
) {
408 if (evs
& ES_RGP0M_Ev
) {
410 if (enable_exit_gp0
) {
411 pd
= &xspi
->rw_states_d
[READER
];
415 dev_sem
= &pd
->dev_rdma_sem
;
416 raw_spin_lock(&dev_sem
->lock
);
418 switch (pd
->int_ac
) {
420 rdma_cv_broadcast_rdma(&pd
->dev_rdma_sem
);
428 raw_spin_unlock(&dev_sem
->lock
);
433 if (evs
& ES_RLM_Ev
) {
437 if (evs
& ES_RULM_Ev
) {
441 if (evs
& ES_RIAM_Ev
) {
442 dev_rdma_sem_t
*dev_sem
;
445 WRR_rdma(SHIFT_CAM(0), tr_atl
);
446 time_ID_ANS
= E2K_GET_DSREG(clkr
);
447 pcam
= &xspi
->ralive
;
448 dev_sem
= &pcam
->dev_rdma_sem
;
449 raw_spin_lock(&dev_sem
->lock
);
450 if (pcam
->stat
== 1) {
451 pcam
->clkr
= E2K_GET_DSREG(clkr
);
452 pcam
->int_cnt
= int_cnt
;
453 rdma_cv_broadcast_rdma(&pcam
->dev_rdma_sem
);
455 raw_spin_unlock(&dev_sem
->lock
);
458 event_intr(0, INTR_RIAM_EVENT
, 0, pst
->es_riam
);
460 if (evs
& ES_RIRM_Ev
) {
461 dev_rdma_sem_t
*dev_sem
;
464 WRR_rdma(SHIFT_CAM(0), tr_atl
);
465 time_ID_REQ
= E2K_GET_DSREG(clkr
);
466 pcam
= &xspi
->ralive
;
467 dev_sem
= &pcam
->dev_rdma_sem
;
468 raw_spin_lock(&dev_sem
->lock
);
469 if (pcam
->stat
== 1) {
470 pcam
->clkr
= E2K_GET_DSREG(clkr
);
471 pcam
->int_cnt
= int_cnt
;
472 rdma_cv_broadcast_rdma(&pcam
->dev_rdma_sem
);
474 raw_spin_unlock(&dev_sem
->lock
);
477 event_intr(0, INTR_RIRM_EVENT
, 0, pst
->es_rirm
);
479 event_intr(0, INTR_EXIT_EVENT
, 0, 0);