f9d0ab37d406556d41e08ab41d5edba3722b6bd4
[15.05/openwrt.git] / target / linux / generic / files / crypto / ocf / kirkwood / mvHal / kw_family / ctrlEnv / sys / mvSysXor.c
1 /*******************************************************************************
2 Copyright (C) Marvell International Ltd. and its affiliates
3
4 This software file (the "File") is owned and distributed by Marvell 
5 International Ltd. and/or its affiliates ("Marvell") under the following
6 alternative licensing terms.  Once you have made an election to distribute the
7 File under one of the following license alternatives, please (i) delete this
8 introductory statement regarding license alternatives, (ii) delete the two
9 license alternatives that you have not elected to use and (iii) preserve the
10 Marvell copyright notice above.
11
12 ********************************************************************************
13 Marvell Commercial License Option
14
15 If you received this File from Marvell and you have entered into a commercial
16 license agreement (a "Commercial License") with Marvell, the File is licensed
17 to you under the terms of the applicable Commercial License.
18
19 ********************************************************************************
20 Marvell GPL License Option
21
22 If you received this File from Marvell, you may opt to use, redistribute and/or 
23 modify this File in accordance with the terms and conditions of the General 
24 Public License Version 2, June 1991 (the "GPL License"), a copy of which is 
25 available along with the File in the license.txt file or by writing to the Free 
26 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or 
27 on the worldwide web at http://www.gnu.org/licenses/gpl.txt. 
28
29 THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED 
30 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY 
31 DISCLAIMED.  The GPL License provides additional details about this warranty 
32 disclaimer.
33 ********************************************************************************
34 Marvell BSD License Option
35
36 If you received this File from Marvell, you may opt to use, redistribute and/or 
37 modify this File under the following licensing terms. 
38 Redistribution and use in source and binary forms, with or without modification, 
39 are permitted provided that the following conditions are met:
40
41     *   Redistributions of source code must retain the above copyright notice,
42             this list of conditions and the following disclaimer. 
43
44     *   Redistributions in binary form must reproduce the above copyright
45         notice, this list of conditions and the following disclaimer in the
46         documentation and/or other materials provided with the distribution. 
47
48     *   Neither the name of Marvell nor the names of its contributors may be 
49         used to endorse or promote products derived from this software without 
50         specific prior written permission. 
51     
52 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
53 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
54 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
55 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
56 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
57 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
58 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
59 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
60 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
61 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62
63 *******************************************************************************/
64
65 #include "xor/mvXor.h"
66 #include "mvSysXor.h"
67
68 /* defines  */
69 #ifdef MV_DEBUG
70         #define DB(x)   x
71 #else
72         #define DB(x)
73 #endif  
74
75
76 static MV_STATUS xorWinOverlapDetect(MV_U32 unit,MV_U32 winNum, MV_ADDR_WIN *pAddrWin);
77
78 MV_TARGET xorAddrDecPrioTap[] = 
79 {
80 #if defined(MV_INCLUDE_DEVICE_CS0)
81     DEVICE_CS0,
82 #endif
83 #if defined(MV_INCLUDE_PEX)
84         PEX0_MEM,
85 #endif
86 #if defined(MV_INCLUDE_SDRAM_CS0)
87     SDRAM_CS0,
88 #endif
89 #if defined(MV_INCLUDE_SDRAM_CS1)
90     SDRAM_CS1,
91 #endif
92 #if defined(MV_INCLUDE_SDRAM_CS2)
93     SDRAM_CS2,
94 #endif
95 #if defined(MV_INCLUDE_SDRAM_CS3)
96     SDRAM_CS3,
97 #endif
98 #if defined(MV_INCLUDE_DEVICE_CS1)
99     DEVICE_CS1,
100 #endif
101 #if defined(MV_INCLUDE_CESA)
102    CRYPT_ENG,
103 #endif 
104         TBL_TERM
105 };
106 static MV_STATUS mvXorInitWinsUnit (MV_U32 unit)
107 {
108         MV_U32         winNum;
109         MV_XOR_DEC_WIN addrDecWin;
110         MV_CPU_DEC_WIN cpuAddrDecWin;
111         MV_U32          status;
112         MV_U32                  winPrioIndex=0;
113
114         /* Initiate XOR address decode */
115
116         /* First disable all address decode windows */
117         for(winNum = 0; winNum < XOR_MAX_ADDR_DEC_WIN; winNum++)
118         {
119             mvXorTargetWinEnable(unit,winNum, MV_FALSE);
120         }
121         
122         /* Go through all windows in user table until table terminator                  */
123         for (winNum = 0; ((xorAddrDecPrioTap[winPrioIndex] != TBL_TERM) &&
124                                         (winNum < XOR_MAX_ADDR_DEC_WIN));)
125         {
126                 /* first get attributes from CPU If */
127                 status = mvCpuIfTargetWinGet(xorAddrDecPrioTap[winPrioIndex], 
128                                                                          &cpuAddrDecWin);
129
130         if(MV_NO_SUCH == status)
131         {
132             winPrioIndex++;
133             continue;
134         }
135                 if (MV_OK != status)
136                 {
137             mvOsPrintf("%s: ERR. mvCpuIfTargetWinGet failed\n", __FUNCTION__);
138                         return MV_ERROR;
139                 }
140
141         
142         if (cpuAddrDecWin.enable == MV_TRUE)
143                 {
144
145                         addrDecWin.target           = xorAddrDecPrioTap[winPrioIndex];
146                         addrDecWin.addrWin.baseLow  = cpuAddrDecWin.addrWin.baseLow; 
147                         addrDecWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; 
148                         addrDecWin.addrWin.size     = cpuAddrDecWin.addrWin.size;    
149                         addrDecWin.enable           = MV_TRUE;
150         
151                         if (MV_OK != mvXorTargetWinSet(unit,winNum, &addrDecWin))
152                         {
153                                 DB(mvOsPrintf("mvXorInit: ERR. mvDmaTargetWinSet failed\n"));
154                                 return MV_ERROR;
155                         }
156                         winNum++;
157                 }
158                 winPrioIndex++; 
159         
160         }
161     
162         return MV_OK;
163 }
164
165
166 /*******************************************************************************
167 * mvXorInit - Initialize XOR engine
168 *
169 * DESCRIPTION:
170 *               This function initialize XOR unit. It set the default address decode
171 *               windows of the unit.
172 *               Note that if the address window is disabled in xorAddrDecMap, the
173 *               window parameters will be set but the window will remain disabled.
174 *
175 * INPUT:
176 *       None.
177 *
178 * OUTPUT:
179 *       None.
180 *
181 * RETURN:
182 *       MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise.
183 *******************************************************************************/
184 MV_STATUS mvXorInit (MV_VOID)
185 {
186         MV_U32         i;
187
188         /* Initiate XOR address decode */
189         for(i = 0; i < MV_XOR_MAX_UNIT; i++)
190             mvXorInitWinsUnit(i);
191
192         mvXorHalInit(MV_XOR_MAX_CHAN);  
193     
194         return MV_OK;
195 }
196
197 /*******************************************************************************
198 * mvXorTargetWinSet - Set XOR target address window
199 *
200 * DESCRIPTION:
201 *       This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) 
202 *       address window. After setting this target window, the XOR will be 
203 *       able to access the target within the address window. 
204 *
205 * INPUT:
206 *           winNum - One of the possible XOR memory decode windows.
207 *       target - Peripheral target enumerator.
208 *       base   - Window base address.
209 *       size   - Window size.
210 *       enable - Window enable/disable.
211 *
212 * OUTPUT:
213 *       None.
214 *
215 * RETURN:
216 *       MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise.
217 *
218 *******************************************************************************/
219 MV_STATUS mvXorTargetWinSet(MV_U32 unit, MV_U32 winNum, MV_XOR_DEC_WIN *pAddrDecWin)
220 {
221     MV_DEC_REGS xorDecRegs;
222         MV_TARGET_ATTRIB targetAttribs;
223     MV_U32      chan;
224     
225     /* Parameter checking */
226     if (winNum >= XOR_MAX_ADDR_DEC_WIN)
227     {
228                 DB(mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__, winNum));
229         return MV_BAD_PARAM;
230     }
231     if (pAddrDecWin == NULL)
232     {
233         DB(mvOsPrintf("%s: ERR. pAddrDecWin is NULL pointer\n", __FUNCTION__ ));
234         return MV_BAD_PTR;
235     }                                         
236     /* Check if the requested window overlaps with current windows */
237     if (MV_TRUE == xorWinOverlapDetect(unit, winNum, &pAddrDecWin->addrWin))
238     {
239         DB(mvOsPrintf("%s: ERR. Window %d overlap\n",__FUNCTION__,winNum));
240         return MV_ERROR;
241     }                              
242
243     xorDecRegs.baseReg = MV_REG_READ(XOR_BASE_ADDR_REG(unit,winNum));
244     xorDecRegs.sizeReg = MV_REG_READ(XOR_SIZE_MASK_REG(unit,winNum));
245
246     /* Get Base Address and size registers values */
247     if(MV_OK != mvCtrlAddrDecToReg(&pAddrDecWin->addrWin, &xorDecRegs))
248     {
249                 DB(mvOsPrintf("%s: ERR. Invalid addr dec window\n",__FUNCTION__));
250         return MV_BAD_PARAM;
251         }
252     
253
254         mvCtrlAttribGet(pAddrDecWin->target,&targetAttribs);
255
256         /* set attributes */
257         xorDecRegs.baseReg &= ~XEBARX_ATTR_MASK;
258         xorDecRegs.baseReg |= targetAttribs.attrib << XEBARX_ATTR_OFFS;
259         /* set target ID */
260         xorDecRegs.baseReg &= ~XEBARX_TARGET_MASK;
261         xorDecRegs.baseReg |= targetAttribs.targetId << XEBARX_TARGET_OFFS;
262
263
264     /* Write to address decode Base Address Register */
265         MV_REG_WRITE(XOR_BASE_ADDR_REG(unit,winNum), xorDecRegs.baseReg);
266     
267     /* Write to Size Register */
268         MV_REG_WRITE(XOR_SIZE_MASK_REG(unit,winNum), xorDecRegs.sizeReg);
269     
270     for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++)
271     {
272         if (pAddrDecWin->enable)
273         {
274             MV_REG_BIT_SET(XOR_WINDOW_CTRL_REG(unit,chan),
275                            XEXWCR_WIN_EN_MASK(winNum));
276         }
277         else
278         {
279             MV_REG_BIT_RESET(XOR_WINDOW_CTRL_REG(unit,chan),
280                              XEXWCR_WIN_EN_MASK(winNum));
281         }
282     }
283     return MV_OK;
284 }
285
286 /*******************************************************************************
287 * mvXorTargetWinGet - Get xor peripheral target address window.
288 *
289 * DESCRIPTION:
290 *               Get xor peripheral target address window.
291 *
292 * INPUT:
293 *         winNum - One of the possible XOR memory decode windows.
294 *
295 * OUTPUT:
296 *       base   - Window base address.
297 *       size   - Window size.
298 *       enable - window enable/disable.
299 *
300 * RETURN:
301 *       MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise.
302 *
303 *******************************************************************************/
304 MV_STATUS mvXorTargetWinGet(MV_U32 unit,MV_U32 winNum, MV_XOR_DEC_WIN *pAddrDecWin)
305 {
306     MV_DEC_REGS xorDecRegs;
307         MV_TARGET_ATTRIB targetAttrib;
308     MV_U32      chan=0,chanWinEn;
309     
310     /* Parameter checking */
311     if (winNum >= XOR_MAX_ADDR_DEC_WIN)
312     {
313                 DB(mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__ , winNum));
314         return MV_ERROR;
315     }
316
317     if (NULL == pAddrDecWin)
318     {
319         DB(mvOsPrintf("%s: ERR. pAddrDecWin is NULL pointer\n", __FUNCTION__ ));
320         return MV_BAD_PTR;
321     }
322
323     chanWinEn = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,0)) & XEXWCR_WIN_EN_MASK(winNum);
324     
325     for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) /* we should scan here all channels per unit */
326     {
327         /* Check if enable bit is equal for all channels */
328         if ((MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan)) & 
329              XEXWCR_WIN_EN_MASK(winNum)) != chanWinEn)
330         {
331             mvOsPrintf("%s: ERR. Window enable field must be equal in "
332                               "all channels(chan=%d)\n",__FUNCTION__, chan);
333             return MV_ERROR;
334         }
335     }
336
337
338
339         xorDecRegs.baseReg  = MV_REG_READ(XOR_BASE_ADDR_REG(unit,winNum));
340         xorDecRegs.sizeReg  = MV_REG_READ(XOR_SIZE_MASK_REG(unit,winNum));
341
342         if (MV_OK != mvCtrlRegToAddrDec(&xorDecRegs, &pAddrDecWin->addrWin))
343         {
344                 mvOsPrintf("%s: ERR. mvCtrlRegToAddrDec failed\n", __FUNCTION__);
345                 return MV_ERROR;
346         }
347
348         /* attrib and targetId */
349         targetAttrib.attrib = 
350                 (xorDecRegs.baseReg & XEBARX_ATTR_MASK) >> XEBARX_ATTR_OFFS;
351         targetAttrib.targetId = 
352                 (xorDecRegs.baseReg & XEBARX_TARGET_MASK) >> XEBARX_TARGET_OFFS;
353
354
355         pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib);
356
357         if(chanWinEn)
358         {
359                 pAddrDecWin->enable = MV_TRUE;
360         }
361         else pAddrDecWin->enable = MV_FALSE;
362         
363     return MV_OK;
364 }
365
366 /*******************************************************************************
367 * mvXorTargetWinEnable - Enable/disable a Xor address decode window
368 *
369 * DESCRIPTION:
370 *       This function enable/disable a XOR address decode window.
371 *       if parameter 'enable' == MV_TRUE the routine will enable the 
372 *       window, thus enabling XOR accesses (before enabling the window it is 
373 *       tested for overlapping). Otherwise, the window will be disabled.
374 *
375 * INPUT:
376 *       winNum - Decode window number.
377 *       enable - Enable/disable parameter.
378 *
379 * OUTPUT:
380 *       None.
381 *
382 * RETURN:
383 *       MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise.
384 *
385 *******************************************************************************/
386 MV_STATUS mvXorTargetWinEnable(MV_U32 unit,MV_U32 winNum, MV_BOOL enable)
387 {
388         MV_XOR_DEC_WIN  addrDecWin;
389     MV_U32          chan;
390     
391         /* Parameter checking   */               
392     if (winNum >= XOR_MAX_ADDR_DEC_WIN)
393     {
394         DB(mvOsPrintf("%s: ERR. Invalid winNum%d\n", __FUNCTION__, winNum));
395         return MV_ERROR;
396     }
397
398         if (enable == MV_TRUE) 
399         {
400                 /* Get current window */
401             if (MV_OK != mvXorTargetWinGet(unit,winNum, &addrDecWin))
402                 {
403                         DB(mvOsPrintf("%s: ERR. targetWinGet fail\n", __FUNCTION__));
404                         return MV_ERROR;
405                 }
406
407                 /* Check for overlapping */
408             if (MV_TRUE == xorWinOverlapDetect(unit,winNum, &(addrDecWin.addrWin)))
409                 {
410                         /* Overlap detected     */
411                         DB(mvOsPrintf("%s: ERR. Overlap detected\n", __FUNCTION__));
412                         return MV_ERROR;
413                 }
414
415                 /* No Overlap. Enable address decode target window */
416                 for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++)
417                 {
418                     MV_REG_BIT_SET(XOR_WINDOW_CTRL_REG(unit,chan),
419                                                    XEXWCR_WIN_EN_MASK(winNum));
420                 }
421
422         }
423         else
424         {
425                 /* Disable address decode target window */
426
427                 for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++)
428                 {
429                     MV_REG_BIT_RESET(XOR_WINDOW_CTRL_REG(unit,chan),
430                                                          XEXWCR_WIN_EN_MASK(winNum));
431                 }
432
433         }
434
435         return MV_OK;                  
436 }
437
438 /*******************************************************************************
439 * mvXorSetProtWinSet - Configure access attributes of a XOR engine
440 *                               to one of the XOR memory windows.
441 *
442 * DESCRIPTION:
443 *       Each engine can be configured with access attributes for each of the
444 *       memory spaces. This function sets access attributes 
445 *       to a given window for the given engine
446 *
447 * INPUTS:
448 *       chan    - One of the possible engines.
449 *       winNum  - One of the possible XOR memory spaces.
450 *       access  - Protection access rights.
451 *       write   - Write rights.
452 *
453 * OUTPUT:
454 *       None.
455 *
456 * RETURN:
457 *       MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise.
458 *
459 *******************************************************************************/
460 MV_STATUS mvXorProtWinSet (MV_U32 unit,MV_U32 chan, MV_U32 winNum, MV_BOOL access, 
461                            MV_BOOL write)
462 {
463     MV_U32 temp;
464     
465     /* Parameter checking   */
466     if (chan >= MV_XOR_MAX_CHAN_PER_UNIT)
467     {
468                 DB(mvOsPrintf("%s: ERR. Invalid chan num %d\n", __FUNCTION__ , chan));
469         return MV_BAD_PARAM;
470     }
471     if (winNum >= XOR_MAX_ADDR_DEC_WIN)
472     {
473                 DB(mvOsPrintf("%s: ERR. Invalid win num %d\n", __FUNCTION__, winNum));
474         return MV_BAD_PARAM;
475     }
476
477     temp = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan)) & 
478         (~XEXWCR_WIN_ACC_MASK(winNum));
479
480     /* if access is disable */
481     if (!access)
482     {
483         /* disable access */
484         temp |= XEXWCR_WIN_ACC_NO_ACC(winNum);
485     }
486     /* if access is enable */
487     else
488     {
489         /* if write is enable */
490         if (write)
491         {
492             /* enable write */
493             temp |= XEXWCR_WIN_ACC_RW(winNum);
494         }
495         /* if write is disable */
496         else
497         {
498             /* disable write */
499             temp |= XEXWCR_WIN_ACC_RO(winNum);
500         }
501     }
502     MV_REG_WRITE(XOR_WINDOW_CTRL_REG(unit,chan),temp);
503     return MV_OK;
504 }
505
506 /*******************************************************************************
507 * mvXorPciRemap - Set XOR remap register for PCI address windows.
508 *
509 * DESCRIPTION:
510 *       only Windows 0-3 can be remapped.
511 *
512 * INPUT:
513 *       winNum      - window number
514 *       pAddrDecWin  - pointer to address space window structure
515 * OUTPUT:
516 *       None.
517 *
518 * RETURN:
519 *       MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise.
520 *
521 *******************************************************************************/
522 MV_STATUS mvXorPciRemap(MV_U32 unit,MV_U32 winNum, MV_U32 addrHigh)
523 {
524     /* Parameter checking   */
525     if (winNum >= XOR_MAX_REMAP_WIN)
526     {
527                 DB(mvOsPrintf("%s: ERR. Invalid win num %d\n", __FUNCTION__, winNum));
528         return MV_BAD_PARAM;
529     }
530
531     MV_REG_WRITE(XOR_HIGH_ADDR_REMAP_REG(unit,winNum), addrHigh);
532     
533         return MV_OK;
534 }
535
536 /*******************************************************************************
537 * xorWinOverlapDetect - Detect XOR address windows overlaping
538 *
539 * DESCRIPTION:
540 *       An unpredicted behaviour is expected in case XOR address decode 
541 *       windows overlaps.
542 *       This function detects XOR address decode windows overlaping of a 
543 *       specified window. The function does not check the window itself for 
544 *       overlaping. The function also skipps disabled address decode windows.
545 *
546 * INPUT:
547 *       winNum      - address decode window number.
548 *       pAddrDecWin - An address decode window struct.
549 *
550 * OUTPUT:
551 *       None.
552 *
553 * RETURN:
554 *       MV_TRUE if the given address window overlap current address
555 *       decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data 
556 *       from registers.
557 *
558 *******************************************************************************/
559 static MV_STATUS xorWinOverlapDetect(MV_U32 unit,MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
560 {
561         MV_U32          baseAddrEnableReg;
562         MV_U32          winNumIndex,chan;
563         MV_XOR_DEC_WIN  addrDecWin;
564
565         if (pAddrWin == NULL)
566         {
567                 DB(mvOsPrintf("%s: ERR. pAddrWin is NULL pointer\n", __FUNCTION__ ));
568                 return MV_BAD_PTR;
569         }
570     
571         for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++)
572         {
573                 /* Read base address enable register. Do not check disabled windows     */
574             baseAddrEnableReg = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan));
575
576                 for (winNumIndex = 0; winNumIndex < XOR_MAX_ADDR_DEC_WIN; winNumIndex++)
577                 {
578                         /* Do not check window itself */
579                         if (winNumIndex == winNum)
580                         {
581                                 continue;
582                         }
583     
584                         /* Do not check disabled windows */
585                         if ((baseAddrEnableReg & XEXWCR_WIN_EN_MASK(winNumIndex)) == 0)
586                         {
587                                 continue;
588                         }
589     
590                         /* Get window parameters */
591                         if (MV_OK != mvXorTargetWinGet(unit,winNumIndex, &addrDecWin))
592                         {
593                                 DB(mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__ ));
594                                 return MV_ERROR;
595                         }
596             
597                         if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
598                         {
599                                 return MV_TRUE;
600                         }
601                 }
602         }
603         
604         return MV_FALSE;
605 }
606
607 static MV_VOID mvXorAddrDecShowUnit(MV_U32 unit)
608 {
609         MV_XOR_DEC_WIN win;
610         int            i;
611
612         mvOsOutput( "\n" );
613         mvOsOutput( "XOR %d:\n", unit );
614         mvOsOutput( "----\n" );
615
616         for( i = 0; i < XOR_MAX_ADDR_DEC_WIN; i++ )
617         {
618                 memset( &win, 0, sizeof(MV_XOR_DEC_WIN) );
619
620                 mvOsOutput( "win%d - ", i );
621
622                 if( mvXorTargetWinGet(unit, i, &win ) == MV_OK )
623                 {
624                         if( win.enable )
625                         {
626                                 mvOsOutput( "%s base %x, ",
627                                 mvCtrlTargetNameGet(win.target), win.addrWin.baseLow );
628
629                                 mvSizePrint( win.addrWin.size );
630                                 
631                 mvOsOutput( "\n" );
632                         }
633                         else
634                                 mvOsOutput( "disable\n" );
635                 }
636         }
637 }
638
639 /*******************************************************************************
640 * mvXorAddrDecShow - Print the XOR address decode map.
641 *
642 * DESCRIPTION:
643 *               This function print the XOR address decode map.
644 *
645 * INPUT:
646 *       None.
647 *
648 * OUTPUT:
649 *       None.
650 *
651 * RETURN:
652 *       None.
653 *
654 *******************************************************************************/
655 MV_VOID mvXorAddrDecShow(MV_VOID)
656 {
657         int            i;
658
659         for( i = 0; i < MV_XOR_MAX_UNIT; i++ )
660             mvXorAddrDecShowUnit(i);
661         
662 }