]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/emac/firmware/icss_dualmac/src/rtu_psi.h
Merge pull request #19 in PROCESSOR-SDK/pdk from prsdk-7325 to master
[processor-sdk/pdk.git] / packages / ti / drv / emac / firmware / icss_dualmac / src / rtu_psi.h
1 ;
2 ;  TEXAS INSTRUMENTS TEXT FILE LICENSE
3 ;
4 ;   Copyright (c) 2018-2019 Texas Instruments Incorporated
5 ;
6 ;  All rights reserved not granted herein.
7 ;
8 ;  Limited License.
9 ;
10 ;  Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
11 ;  license under copyrights and patents it now or hereafter owns or controls to
12 ;  make, have made, use, import, offer to sell and sell ("Utilize") this software
13 ;  subject to the terms herein.  With respect to the foregoing patent license,
14 ;  such license is granted  solely to the extent that any such patent is necessary
15 ;  to Utilize the software alone.  The patent license shall not apply to any
16 ;  combinations which include this software, other than combinations with devices
17 ;  manufactured by or for TI (“TI Devices”).  No hardware patent is licensed hereunder.
18 ;
19 ;  Redistributions must preserve existing copyright notices and reproduce this license
20 ;  (including the above copyright notice and the disclaimer and (if applicable) source
21 ;  code license limitations below) in the documentation and/or other materials provided
22 ;  with the distribution.
23 ;
24 ;  Redistribution and use in binary form, without modification, are permitted provided
25 ;  that the following conditions are met:
26 ;       No reverse engineering, decompilation, or disassembly of this software is
27 ;   permitted with respect to any software provided in binary form.
28 ;       Any redistribution and use are licensed by TI for use only with TI Devices.
29 ;       Nothing shall obligate TI to provide you with source code for the software
30 ;   licensed and provided to you in object code.
31 ;
32 ;  If software source code is provided to you, modification and redistribution of the
33 ;  source code are permitted provided that the following conditions are met:
34 ;       Any redistribution and use of the source code, including any resulting derivative
35 ;   works, are licensed by TI for use only with TI Devices.
36 ;       Any redistribution and use of any object code compiled from the source code
37 ;   and any resulting derivative works, are licensed by TI for use only with TI Devices.
38 ;
39 ;  Neither the name of Texas Instruments Incorporated nor the names of its suppliers
40 ;  may be used to endorse or promote products derived from this software without
41 ;  specific prior written permission.
42 ;
43 ;  DISCLAIMER.
44 ;
45 ;  THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED
46 ;  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
47 ;  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI’S
48 ;  LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49 ;  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
50 ;  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
51 ;  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 ;  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
53 ;  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 ;-------------------------------------------------
56 ;---file: RTU_PSI.h
57 ;---purpose:  utilities to manage PSI i/f for RTU
58 ;---------------------------------------------------
60 ;----------------------DEFINES------------------------
62 ;global PSI state
63         .asg    b0, ssmask  ; mask of threads that are stalled.
64         .asg    b1, sactive  ; 0=thread0, 1=thread1, 2=thread2, 3=thread3
65         .asg    b2, sreason  ;2bits per thread give reason for stall (valid if smask bit is clear)
66         .asg    b3, qlock  ;bit n set => queue n locked
68 ; 2 bits/thread => 4 reasons why thread is stalled
69 ;  b2
70 SR_RATE .set    0
71 SR_LOCK .set    1
72 SR_BUF  .set    2
73 SR_QUEUE        .set    3
75 ;---------------------------
76 ; Resource Lock Utility
77 ; QUICK Version
78 ; just 8 bits.  no queue
79 ;----------------------------
80 ;init lock
81 QLOCK_INIT      .macro
82         ldi     GRrtu.ResLock, 0
83  .endm
85 ;get a lock or get stalled
86 ; 1 cycle no
87 ; 3 cycles yes
88 QLOCK_GET       .macro  r_res, queued_label,gotit_label
89         qbbs    queued_label, GRrtu.ResLock, r_res
90         set     GRrtu.ResLock, GRrtu.ResLock, r_res
91         jmp     gotit_label
92  .endm
94 ;poll to see if we can have  lock now
95 ; 1 cycles
96 QLOCK_POLL      .macro  r_res, gotit_label
97         qbbc    gotit_label, GRrtu.ResLock, r_res
98  .endm
100 ;clear a lock
101 ; 1 cycles
102 QLOCK_CLR       .macro  r_res
103         clr     GRrtu.ResLock, GRrtu.ResLock, r_res
104  .endm
106 ;-------Context save/restore---------------
107 ;park a thread context, case0
108 PARK_THREAD0    .macro  slot, unstall_exit
109         zero &r2, 32
110         mov     r2, RCtx.pix0
111         mov     r3, RCtx.pix1
112         mov     r4, RCtx.pix2
113         ldi     r9, $code(unstall_exit)
114         PAGE_SAVE2_REG slot
115  .endm
117 ;park a thred context, case1
118 PARK_THREAD1    .macro  slot, unstall_exit
119         mov     r2, RCtx.pix0
120         mov     r3, RCtx.pix1
121         mov     r4, RCtx.pix2
122         mov     r5, RCtx.pix3
123         mov     r6, RCtx.pix4
124         ldi     r9, $code(unstall_exit)
125         PAGE_SAVE2_REG slot
126  .endm
128 STALL_N_PARK    .macro stall_reason, park_proc, unstall_label
129         clr     GRrtu.StallMask, GRrtu.StallMask, GRrtu.ActThrdNum
130         add     r11, GRrtu.ActThrdNum, PSI_CNTX0_SLOT
131         ldi     r12, stall_reason
132         add     r13, GRrtu.ActThrdNum, GRrtu.ActThrdNum
133         lsl     r13, r13, 1
134         lsl     r12, r12, r13
135         or      GRrtu.StallReason, GRrtu.StallReason, r12
136         park_proc       r11, unstall_label
137  .endm
139 ;-------------------------------------------
140 ;------------GLobal PSI SM-------------------
141 ;-------------------------------------------
142 ;macros to poll individual psi slots
143 RTU_POLL_SLOTx  .macro  slot
144         .newblock
145 $1:     xin     XID_PSI_S, &r1, 8
146         qbbs    $2, r1, slot
147         CALL_SUB sstate_00, $1
148         jmp     $1
149 $2:
150  .endm
152 ;State0: read in INFO WORD
153 ; 8 - 13 cycles..
154 ; r2-r5 hold info data
155 ; r1 - holds meta data
156 ; r0 - holds expected metadata
157 ;======================
158 ; INFO WORD KEY DATA
159 ; directed packet: r4.b2 (dst tag low)
160 ; crc provided by host: r2.t23
161 ; portq # provided by host in r4.b3 (dst tag high)
162 ; expected length:
163 ;======================
164 RTU_PSI_IN_S0   .macro  err_exit, stall_exit, mgr_exit
165         .newblock
166         PSI_READ        GRrtu.ActThrdNum, 20 ;read in info word
167         ldi32   r0, MD_INFO0
168         qbne    $5, r1, r0
169         zero    &RCtx.pix0, 20
171 ; check if the packet is management
172         and     r12.b0, r2.b3, 0xf8
173         qbne    $7, r12.b0, 0x80
174         jmp     mgr_exit
176 ;see if host already put crc on pkt
177 ; todo : do we need to verify crc then on pkt
178 $7:     qbbc    $1, r2, 23       ; r2.t23
179         set     Ctx.ippc_flags, Ctx.ippc_flags, f_crcinpkt
181 $1:
182         set     Ctx.ippc_forward, Ctx.ippc_forward, our_port ;to keep it local
183         ;//set portq
184         and     Ctx.ippc_res, r4.b3, 0x07  ;ippc_res set to dst tag hi 
185         mov     Ctx.ippc_totlen, r3.w0 ;check rate
186  .if $isdefed("TX_RATE_LIMITER")
187         mov     r3, GRrtu.ActThrdNum
188         qbbc    $6, Ctx.he_flags, r3
189         TXRATE_CHK_AND_SOPv2 r3, r2, Ctx.ippc_totlen, $4
190  .endif
191         jmp     $6
192 $4:     jmp     stall_exit
193 $5:     jmp     err_exit
194 $6:     ; done
195 ;rate ok
196  .endm
198 ;process in Control Word
199 ; optional. note data already read in
200 ;  assumes r1-r6 contains transfer
201 ;control fields of interest
202 ;word 0: time stam request 'cookie'
203 ;word 1: timestamp request (bit31)
204 ;word 2: udp chksum request
205 ;word 3: ignore
206 PSI_IN_CONTROL_PROC     .macro
207         .newblock
208 ;Control  words already in r1-r5
209 ;r2=  cookie
210 ;r3=  b31-> tx ts
211 ;r4=  udp cs control:  w0=#bytes, b3=loc of result (0rel), b2=start byte (0 rel)
212 ;r5=  spare
213         qbbc    $1, r3, 31       ;no_txts
214         set     Ctx.ippc_flags, Ctx.ippc_flags, f_rts
215         ldi32   r10, FW_CONFIG + TX_TS_BASE
216         mov     r4, r2  ; we need cookie after flags
217         sbbo    &r3, r10, 8, 8  ; save cookie (r4) and flags (r3)
218 $1:
219  .endm
221 ;StateS1: read in 1st 16 data words
222 ; looking for 1st DATA or Control
223 ; Data in r2-r5, meta in r1
224 ; kick of fdb lookup.  Note: we always do lookup, even for
225 ;  directed pkt, to get vlan info
226 ;  todo: optimization for non_vlan case: skip fdb
228 RTU_PSI_IN_S1   .macro  err_exit, control_exit
229         .newblock
230         PSI_READ        GRrtu.ActThrdNum, 20
231         ldi32   r0, MD_CONTROL0
232         qbne    $1, r1, r0
233 ;CONTROL DATA- so Process
234         PSI_IN_CONTROL_PROC
235         jmp     control_exit
237 $1:
238         ;skip  protocol info if present..
239         qbeq control_exit,r1.b2, PSI_DT_PROINFO
240         ;assume data...
241         qbne    err_exit0?, r1.b2, 0x14
243         LEBE2_5_swap_6_9   ;shift r2-r5 to r6-r9
244         add     r10, GRrtu.ActThrdNum, BS_SLOT_PSI0
245         PAGE_SAVEQ   ;save off
246         jmp     done?
247 err_exit0?:  ;trampoline
248         jmp     err_exit
249 done?:
250  .endm
252 branch_if_eop .macro label
253         qbbs    label, r1, 4     ;r1.f_md_lastw
254         qbbs    label, r1, 1     ;r1.f_md_eop
255  .endm
257 ;hard loop to process 64 bytes from PSI
258 ; eop_exitX:   finished w/ data
259 ;    X=1 => r1.b3 bytes of data need servicing
260 ;    X=2 => 16+r1.b3 bytes of data need servicing
261 ;    X=3 => 32+r1.b3 bytes of data need servicing
262 ;    X=4 => 48+r1.b3 bytes of data need servicing
263 ; MACRO puts data in right order, ready to go, even for EOP
264 ;  not going to check for errors...
265 RTU_PSI_READ_SR1_4      .macro  slot, done_exit, eop_exit
266         .newblock
267 $1:     xin     XID_PSI_S, &r1, 8
268         qbbc    $1, r1, GRrtu.ActThrdNum
269         PSI_READS slot, 20              ; Axxx
270         branch_if_eop $5
271         LEBE2_5_swap_6_9                ; xAxx
273 $2:     xin     XID_PSI_S, &r1, 8
274         qbbc    $2, r1, GRrtu.ActThrdNum
275         PSI_READS slot, 20              ; BAxx
276         branch_if_eop $6
277         LEBE2_9_swap_10_17              ; xxAB
279 $3:     xin     XID_PSI_S, &r1, 8
280         qbbc    $3, r1, GRrtu.ActThrdNum
281         PSI_READS slot, 20              ; CxAB
282         LEBE2_5_swap_6_9                ; xCAB
283         branch_if_eop $7
285 $4:     xin     XID_PSI_S, &r1, 8
286         qbbc    $4, r1, GRrtu.ActThrdNum
287         PSI_READS slot, 20              ; DCAB
288         LEBE2_9_swap_10_17              ; BACD
289         LEBE2_5_swap_6_9                ; ABCD
290         branch_if_eop $8
291         jmp     done_exit
293 $6:     LEBE2_5_swap_6_9                ; ABxx
294         add     r1.b3, r1.b3, 16
295         jmp     eop_exit
297 $7:     LEBE2_9_swap_10_17              ; BACx
298         LEBE2_5_swap_6_9                ; ABCx
299         add     r1.b3, r1.b3, 32
300         jmp     eop_exit
301 $8:
302         add     r1.b3, r1.b3, 48
303 $5:     jmp     eop_exit
304  .endm
306 ;hard macro to process  bytes 16-63 from PSI
307 ; (already read 1st 16)
308 ; will pad if EOP seen
309 ; assumption:  if psi gives us N<16 as vaild, and we read in 16, that widget
310 ;   zeros bytes n, n+1,.. 15 (0-rel)
311 RTU_PSI_READ_SR2_4      .macro  slot, bslot, done_exit, eop_exit, eop_exit1
312         .newblock
313         zero &r2, 64
314         TM_DISABLE
315         PAGE_RESTORE2 bslot, 32
316         TM_ENABLE
317         ldi     r10, 0
318 ;r5-r9 = 1st 16
319 $1:     xin     XID_PSI_S, &r1, 8
320         qbbc    $1, r1, GRrtu.ActThrdNum
321         PSI_READS slot, 20
322         LEBE2_9_swap_10_17
323         branch_if_eop   $4
325 $2:     xin     XID_PSI_S, &r1, 8
326         qbbc    $2, r1, GRrtu.ActThrdNum
327         PSI_READS slot, 20
328         LEBE2_5_swap_6_9
329         branch_if_eop   $5
331 $3:     xin     XID_PSI_S, &r1, 8
332         qbbc    $3, r1, GRrtu.ActThrdNum
333         PSI_READS slot, 20
334         LEBE2_9_swap_10_17
335         LEBE2_5_swap_6_9
336         branch_if_eop   $6
337         jmp done_exit
339 $4: ;< 32 byte packet
340         LEBE2_9_swap_10_17
341         LEBE2_5_swap_6_9
342         ldi     r1.b3, 60
343         jmp eop_exit
344 $5: ;only 48 byte packet
345         LEBE2_9_swap_10_17
346         LEBE2_5_swap_6_9
347         ldi     r1.b3, 60
348         jmp eop_exit
349 $6:
350 ;all should be lined up
351         add     r1.b3, r1.b3, 48
352         qble    eop_exit1, r1.b3, 60
353         ldi     r1.b3, 60
354         jmp eop_exit
355  .endm
358 ;Process fdb result to decide how to forward (part2)
359 ;  r2 = xxMASK
360 RTU_PSI_IN_F0_PART2     .macro  stall_exit_lock,stall_exit_buf
361         .newblock
362 ;now allocate buffer(s)
363 ;get a lock on the queue/buffer pools
364         QLOCK_GET       Ctx.ippc_res, $1, $2
365 $1:     jmp     stall_exit_lock  ;can't get lock
366 $2:     ;lock_ok
367         add     r1, Ctx.ippc_res, BP_SLOT0_RTU
368         CEIL64  r11.w2, Ctx.ippc_totlen
369         TM_DISABLE
370         BUFP_POP        r1, r11.w2, Ctx.ippx_ptr0, $3
371         TM_ENABLE
372         jmp     $9
373 $3:     ;no_buffer0
374         TM_ENABLE
375         jmp     stall_exit_buf
376 $9: ; done
377  .endm
379 ;write 64 bytes to one or both portq buffers
380 ;ADDR_LO needs to be set (r18) to r_pix3, rpix_4
381 ; aslo sets r19 to ADDR_HI
382 ; could be 15 cycles if 2x writes
383 DO_WRITE64      .macro  unit, len
384         .newblock
385         LEBE_GO r2, 64  ;NEED_TO_FLIP
386         ldi     r19, ADDR_HI
387         add     r18, Ctx.ippx_ptr0, Ctx.ippc_curlen
388         xout    unit, &r2, 64 + 8
389         add     Ctx.ippc_curlen, Ctx.ippc_curlen, len
390  .endm
392 ;build descriptor
393 ;push descriptor onto port queue(s)
394 DO_EOP  .macro  stall_exit
395 ;build common parts of descriptor
396         mov     r8.w0, Ctx.ippc_curlen        ;len
397         ldi     r8.b2, FROM_US_V
398         qbbs    no_crc?, Ctx.ippc_flags, f_crcinpkt
399         set     r8.t16 ;force tx to get hw to do crc
400 no_crc?:
401         add     r8.b3, Ctx.ippc_res, BP_SLOT0_RTU ;b2 is 0-7.  add RTU_BASE
402         qbbc    no_tx_ts?, Ctx.ippc_flags, f_rts
403         set     r8.t21
404 no_tx_ts?:
405         mov     r7, Ctx.ippx_ptr0  ;ptr
406         add     r2, Ctx.ippc_res, MQ_SLOT0_RTU ;queue
407         TM_DISABLE
408         MQ_PUSH r2, r7, fail?
409         set     GRrtu.pqmap, GRrtu.pqmap, Ctx.ippc_res
410         TM_ENABLE
411         jmp     done?
412 fail?:
413         TM_ENABLE
414         jmp     stall_exit
416 done?:  QLOCK_CLR Ctx.ippc_res ; success - release lock on queue/resources
417  .endm
419 ;wait for EOP on thread, tossing data
420 WAIT_EOP        .macro
421         .newblock
422         qbeq    $0, GRrtu.ActThrdNum, 0
423         qbeq    $1, GRrtu.ActThrdNum, 1
424         qbeq    $2, GRrtu.ActThrdNum, 2
425 $3
426         RTU_POLL_SLOTx  3
427         PSI_READS XID_PSI_R4, 20
428         qbbc    $3, r1, 1        ;r1.f_md_eop
429         jmp     $4
430 $2:
431         RTU_POLL_SLOTx  2
432         PSI_READS XID_PSI_R3, 20
433         qbbc    $2, r1, 1        ;r1.f_md_eop
434         jmp     $4
435 $1:
436         RTU_POLL_SLOTx  1
437         PSI_READS XID_PSI_R2, 20
438         qbbc    $1, r1, 1        ;r1.f_md_eop
439         jmp     $4
440 $0:
441         RTU_POLL_SLOTx  0
442         PSI_READS XID_PSI_R1, 20
443         qbbc    $0, r1, 1        ;r1.f_md_eop
444 $4:
445  .endm
447 ;UNSTALL a thread
448 ; note: if can unstall, r9 from restored context has where to
449 ; r0.b0 clobbered
450 TRY_UNSTALL     .macro  thr, bs_slot, fail_exit
451         .newblock
452 ;restore state for this thread
453         TM_DISABLE
454         PAGE_RESTORE2_REG bs_slot, 32
455         TM_ENABLE
456         lsl     r0.b1, thr, 2
457         lsr     r0.b0, GRrtu.StallReason, r0.b1
458         and     r0.b0, r0.b0, 0x3
459         qbeq    try_us_rate?, r0.b0, SR_RATE
460         qbeq    try_us_res?, r0.b0, SR_LOCK
461         qbeq    try_us_buf?, r0.b0, SR_BUF
462         qbne    fail_exit0?, r0.b0, SR_QUEUE
464 ;Stalled because portQ (or IPC Q) was full
465 ;try to unstall queue block (one or both qpushes failed)
466 ; simply jump to r9 (this will retry DO_EOP macro to close out pkt)
467 try_us_q?:
468         mov     RCtx.pix0, r2
469         mov     RCtx.pix1, r3
470         mov     RCtx.pix2, r4
471         mov     RCtx.pix3, r4
472         mov     RCtx.pix4, r5
473         set     GRrtu.StallMask, GRrtu.StallMask, thr
474         mov     GRrtu.ActThrdNum, thr
475         jmp     r9
477 ;Stalled because of rate limiter
478 ;so see if we have credits now
479 try_us_rate?:
480         mov     r18, thr
481         TXRATE_CHK_AND_SOPV2    r18, r1, r2.w2, fail_exit0?
482 ;can unstall
483         set     GRrtu.StallMask, GRrtu.StallMask, thr
484         mov     GRrtu.ActThrdNum, thr
485         mov     RCtx.pix0, r2
486         mov     RCtx.pix1, r3
487         mov     RCtx.pix2, r4
488         jmp     r9
489 fail_exit0?:  jmp fail_exit ;trampoline
491 ;Stalled because resource locked
492 ;so try and get lock for resource
493 try_us_res?:
494         QLOCK_POLL      r3.b2, isuccess_exit1?
495         jmp fail_exit
496 isuccess_exit1?:
497 ;can unstall thread
498         mov     RCtx.pix0, r2
499         mov     RCtx.pix1, r3
500         mov     RCtx.pix2, r4
501         set     GRrtu.StallMask, GRrtu.StallMask, thr
502         mov     GRrtu.ActThrdNum, thr
503         jmp     r9
505 ;stalled becausec couldn't get buffer(s)
506 ;so try and get buffers
507 try_us_buf?:
508         TM_DISABLE
509         PAGE_RESTORE2_REG bs_slot, 32
510         TM_ENABLE
511         mov     RCtx.pix0, r2
512         mov     RCtx.pix1, r3
513         mov     RCtx.pix2, r4
514         mov     RCtx.pix3, r5
515         mov     RCtx.pix4, r6
516 ;see if we need local pool
517         add     r1, Ctx.ippc_res, BP_SLOT0_RTU
518         CEIL64  r11.w2,Ctx.ippc_totlen
519         TM_DISABLE
520         BUFP_POP        r1, r11.w2, Ctx.ippx_ptr0, no_buffer0?
521         TM_ENABLE
522 ;success
523         set     GRrtu.StallMask, GRrtu.StallMask, thr
524         mov     GRrtu.ActThrdNum, thr
525         jmp     r9
527 no_buffer0?:
528         TM_ENABLE
529         jmp fail_exit
530  .endm
532 MGR_SHUTDOWN    .macro
533         .newblock
534 ; signal PRU we are going to stop
535         ldi32   r0, FW_CONFIG
536         ldi32   r1, RTU_STARTED_SHUTDOWN
537         sbbo    &r1, r0, CFG_RTU_STATUS, 4
538 ; compete all ongoing PSI-L transfers
539 $1:     ldi     r7, 125         ; set 1 usec timeout
540 $2:     xin     XID_PSI_S, &r1, 8
541         mov     r6, r1          ; save status at r6
542         and     r6, r6, 0xf     ;
543         qbne    $3, r6, 0       ; we have active data
544         sub     r7, r7, 1       ;
545         qbne    $2, r7, 0       ;
546         jmp     $7              ; timeout
548 $3      qbbc    $4, r6, 0       ; read chunks from all threads if any
549         PSI_READS XID_PSI_R1, 20
550 $4:     qbbc    $5, r6, 1
551         PSI_READS XID_PSI_R2, 20
552 $5:     qbbc    $6, r6, 2
553         PSI_READS XID_PSI_R3, 20
554 $6:     qbbc    $1, r6, 3
555         PSI_READS XID_PSI_R4, 20
556         jmp     $1
558 ; we don't care if TX queue is not empty. We are going to restart firmware anyways
559 ; and reinitialize all buffers and queues  
561 ; wait for PRU complete
562 $7:     ldi32   r0, FW_CONFIG
563         ldi32   r1, PRU_STOPPED
564 $8:     add     r0, r0, 0
565         lbbo    &r9, r0, CFG_STATUS, 4
566         qbne    $8, r9, r1
567  .endm