2 * QEMU PowerPC 4xx embedded processors shared devices emulation
4 * Copyright (c) 2007 Jocelyn Mayer
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 #include "qemu/osdep.h"
26 #include "qemu/units.h"
27 #include "sysemu/reset.h"
30 #include "hw/ppc/ppc.h"
31 #include "hw/ppc/ppc4xx.h"
32 #include "hw/boards.h"
34 #include "exec/address-spaces.h"
35 #include "qemu/error-report.h"
40 # define LOG_UIC(...) qemu_log_mask(CPU_LOG_INT, ## __VA_ARGS__)
42 # define LOG_UIC(...) do { } while (0)
45 static void ppc4xx_reset(void *opaque
)
47 PowerPCCPU
*cpu
= opaque
;
52 /*****************************************************************************/
53 /* Generic PowerPC 4xx processor instantiation */
54 PowerPCCPU
*ppc4xx_init(const char *cpu_type
,
55 clk_setup_t
*cpu_clk
, clk_setup_t
*tb_clk
,
62 cpu
= POWERPC_CPU(cpu_create(cpu_type
));
65 cpu_clk
->cb
= NULL
; /* We don't care about CPU clock frequency changes */
66 cpu_clk
->opaque
= env
;
67 /* Set time-base frequency to sysclk */
68 tb_clk
->cb
= ppc_40x_timers_init(env
, sysclk
, PPC_INTERRUPT_PIT
);
70 ppc_dcr_init(env
, NULL
, NULL
);
71 /* Register qemu callbacks */
72 qemu_register_reset(ppc4xx_reset
, cpu
);
77 /*****************************************************************************/
78 /* "Universal" Interrupt controller */
92 #define UIC_MAX_IRQ 32
93 typedef struct ppcuic_t ppcuic_t
;
97 uint32_t level
; /* Remembers the state of level-triggered interrupts. */
98 uint32_t uicsr
; /* Status register */
99 uint32_t uicer
; /* Enable register */
100 uint32_t uiccr
; /* Critical register */
101 uint32_t uicpr
; /* Polarity register */
102 uint32_t uictr
; /* Triggering register */
103 uint32_t uicvcr
; /* Vector configuration register */
108 static void ppcuic_trigger_irq (ppcuic_t
*uic
)
111 int start
, end
, inc
, i
;
113 /* Trigger interrupt if any is pending */
114 ir
= uic
->uicsr
& uic
->uicer
& (~uic
->uiccr
);
115 cr
= uic
->uicsr
& uic
->uicer
& uic
->uiccr
;
116 LOG_UIC("%s: uicsr %08" PRIx32
" uicer %08" PRIx32
117 " uiccr %08" PRIx32
"\n"
118 " %08" PRIx32
" ir %08" PRIx32
" cr %08" PRIx32
"\n",
119 __func__
, uic
->uicsr
, uic
->uicer
, uic
->uiccr
,
120 uic
->uicsr
& uic
->uicer
, ir
, cr
);
121 if (ir
!= 0x0000000) {
122 LOG_UIC("Raise UIC interrupt\n");
123 qemu_irq_raise(uic
->irqs
[PPCUIC_OUTPUT_INT
]);
125 LOG_UIC("Lower UIC interrupt\n");
126 qemu_irq_lower(uic
->irqs
[PPCUIC_OUTPUT_INT
]);
128 /* Trigger critical interrupt if any is pending and update vector */
129 if (cr
!= 0x0000000) {
130 qemu_irq_raise(uic
->irqs
[PPCUIC_OUTPUT_CINT
]);
131 if (uic
->use_vectors
) {
132 /* Compute critical IRQ vector */
133 if (uic
->uicvcr
& 1) {
142 uic
->uicvr
= uic
->uicvcr
& 0xFFFFFFFC;
143 for (i
= start
; i
<= end
; i
+= inc
) {
145 uic
->uicvr
+= (i
- start
) * 512 * inc
;
150 LOG_UIC("Raise UIC critical interrupt - "
151 "vector %08" PRIx32
"\n", uic
->uicvr
);
153 LOG_UIC("Lower UIC critical interrupt\n");
154 qemu_irq_lower(uic
->irqs
[PPCUIC_OUTPUT_CINT
]);
155 uic
->uicvr
= 0x00000000;
159 static void ppcuic_set_irq (void *opaque
, int irq_num
, int level
)
165 mask
= 1U << (31-irq_num
);
166 LOG_UIC("%s: irq %d level %d uicsr %08" PRIx32
167 " mask %08" PRIx32
" => %08" PRIx32
" %08" PRIx32
"\n",
168 __func__
, irq_num
, level
,
169 uic
->uicsr
, mask
, uic
->uicsr
& mask
, level
<< irq_num
);
170 if (irq_num
< 0 || irq_num
> 31)
174 /* Update status register */
175 if (uic
->uictr
& mask
) {
176 /* Edge sensitive interrupt */
180 /* Level sensitive interrupt */
189 LOG_UIC("%s: irq %d level %d sr %" PRIx32
" => "
190 "%08" PRIx32
"\n", __func__
, irq_num
, level
, uic
->uicsr
, sr
);
191 if (sr
!= uic
->uicsr
)
192 ppcuic_trigger_irq(uic
);
195 static uint32_t dcr_read_uic (void *opaque
, int dcrn
)
201 dcrn
-= uic
->dcr_base
;
220 ret
= uic
->uicsr
& uic
->uicer
;
223 if (!uic
->use_vectors
)
228 if (!uic
->use_vectors
)
241 static void dcr_write_uic (void *opaque
, int dcrn
, uint32_t val
)
246 dcrn
-= uic
->dcr_base
;
247 LOG_UIC("%s: dcr %d val 0x%x\n", __func__
, dcrn
, val
);
251 uic
->uicsr
|= uic
->level
;
252 ppcuic_trigger_irq(uic
);
256 ppcuic_trigger_irq(uic
);
260 ppcuic_trigger_irq(uic
);
264 ppcuic_trigger_irq(uic
);
271 ppcuic_trigger_irq(uic
);
278 uic
->uicvcr
= val
& 0xFFFFFFFD;
279 ppcuic_trigger_irq(uic
);
284 static void ppcuic_reset (void *opaque
)
289 uic
->uiccr
= 0x00000000;
290 uic
->uicer
= 0x00000000;
291 uic
->uicpr
= 0x00000000;
292 uic
->uicsr
= 0x00000000;
293 uic
->uictr
= 0x00000000;
294 if (uic
->use_vectors
) {
295 uic
->uicvcr
= 0x00000000;
296 uic
->uicvr
= 0x0000000;
300 qemu_irq
*ppcuic_init (CPUPPCState
*env
, qemu_irq
*irqs
,
301 uint32_t dcr_base
, int has_ssr
, int has_vr
)
306 uic
= g_malloc0(sizeof(ppcuic_t
));
307 uic
->dcr_base
= dcr_base
;
310 uic
->use_vectors
= 1;
311 for (i
= 0; i
< DCR_UICMAX
; i
++) {
312 ppc_dcr_register(env
, dcr_base
+ i
, uic
,
313 &dcr_read_uic
, &dcr_write_uic
);
315 qemu_register_reset(ppcuic_reset
, uic
);
317 return qemu_allocate_irqs(&ppcuic_set_irq
, uic
, UIC_MAX_IRQ
);
320 /*****************************************************************************/
321 /* SDRAM controller */
322 typedef struct ppc4xx_sdram_t ppc4xx_sdram_t
;
323 struct ppc4xx_sdram_t
{
326 MemoryRegion containers
[4]; /* used for clipping */
327 MemoryRegion
*ram_memories
;
345 SDRAM0_CFGADDR
= 0x010,
346 SDRAM0_CFGDATA
= 0x011,
349 /* XXX: TOFIX: some patches have made this code become inconsistent:
350 * there are type inconsistencies, mixing hwaddr, target_ulong
353 static uint32_t sdram_bcr (hwaddr ram_base
,
381 printf("%s: invalid RAM size " TARGET_FMT_plx
"\n", __func__
,
385 bcr
|= ram_base
& 0xFF800000;
391 static inline hwaddr
sdram_base(uint32_t bcr
)
393 return bcr
& 0xFF800000;
396 static target_ulong
sdram_size (uint32_t bcr
)
401 sh
= (bcr
>> 17) & 0x7;
405 size
= (4 * MiB
) << sh
;
410 static void sdram_set_bcr(ppc4xx_sdram_t
*sdram
, int i
,
411 uint32_t bcr
, int enabled
)
413 if (sdram
->bcr
[i
] & 0x00000001) {
416 printf("%s: unmap RAM area " TARGET_FMT_plx
" " TARGET_FMT_lx
"\n",
417 __func__
, sdram_base(sdram
->bcr
[i
]), sdram_size(sdram
->bcr
[i
]));
419 memory_region_del_subregion(get_system_memory(),
420 &sdram
->containers
[i
]);
421 memory_region_del_subregion(&sdram
->containers
[i
],
422 &sdram
->ram_memories
[i
]);
423 object_unparent(OBJECT(&sdram
->containers
[i
]));
425 sdram
->bcr
[i
] = bcr
& 0xFFDEE001;
426 if (enabled
&& (bcr
& 0x00000001)) {
428 printf("%s: Map RAM area " TARGET_FMT_plx
" " TARGET_FMT_lx
"\n",
429 __func__
, sdram_base(bcr
), sdram_size(bcr
));
431 memory_region_init(&sdram
->containers
[i
], NULL
, "sdram-containers",
433 memory_region_add_subregion(&sdram
->containers
[i
], 0,
434 &sdram
->ram_memories
[i
]);
435 memory_region_add_subregion(get_system_memory(),
437 &sdram
->containers
[i
]);
441 static void sdram_map_bcr (ppc4xx_sdram_t
*sdram
)
445 for (i
= 0; i
< sdram
->nbanks
; i
++) {
446 if (sdram
->ram_sizes
[i
] != 0) {
447 sdram_set_bcr(sdram
, i
, sdram_bcr(sdram
->ram_bases
[i
],
448 sdram
->ram_sizes
[i
]), 1);
450 sdram_set_bcr(sdram
, i
, 0x00000000, 0);
455 static void sdram_unmap_bcr (ppc4xx_sdram_t
*sdram
)
459 for (i
= 0; i
< sdram
->nbanks
; i
++) {
461 printf("%s: Unmap RAM area " TARGET_FMT_plx
" " TARGET_FMT_lx
"\n",
462 __func__
, sdram_base(sdram
->bcr
[i
]), sdram_size(sdram
->bcr
[i
]));
464 memory_region_del_subregion(get_system_memory(),
465 &sdram
->ram_memories
[i
]);
469 static uint32_t dcr_read_sdram (void *opaque
, int dcrn
)
471 ppc4xx_sdram_t
*sdram
;
480 switch (sdram
->addr
) {
481 case 0x00: /* SDRAM_BESR0 */
484 case 0x08: /* SDRAM_BESR1 */
487 case 0x10: /* SDRAM_BEAR */
490 case 0x20: /* SDRAM_CFG */
493 case 0x24: /* SDRAM_STATUS */
496 case 0x30: /* SDRAM_RTR */
499 case 0x34: /* SDRAM_PMIT */
502 case 0x40: /* SDRAM_B0CR */
505 case 0x44: /* SDRAM_B1CR */
508 case 0x48: /* SDRAM_B2CR */
511 case 0x4C: /* SDRAM_B3CR */
514 case 0x80: /* SDRAM_TR */
517 case 0x94: /* SDRAM_ECCCFG */
520 case 0x98: /* SDRAM_ECCESR */
529 /* Avoid gcc warning */
537 static void dcr_write_sdram (void *opaque
, int dcrn
, uint32_t val
)
539 ppc4xx_sdram_t
*sdram
;
547 switch (sdram
->addr
) {
548 case 0x00: /* SDRAM_BESR0 */
549 sdram
->besr0
&= ~val
;
551 case 0x08: /* SDRAM_BESR1 */
552 sdram
->besr1
&= ~val
;
554 case 0x10: /* SDRAM_BEAR */
557 case 0x20: /* SDRAM_CFG */
559 if (!(sdram
->cfg
& 0x80000000) && (val
& 0x80000000)) {
561 printf("%s: enable SDRAM controller\n", __func__
);
563 /* validate all RAM mappings */
564 sdram_map_bcr(sdram
);
565 sdram
->status
&= ~0x80000000;
566 } else if ((sdram
->cfg
& 0x80000000) && !(val
& 0x80000000)) {
568 printf("%s: disable SDRAM controller\n", __func__
);
570 /* invalidate all RAM mappings */
571 sdram_unmap_bcr(sdram
);
572 sdram
->status
|= 0x80000000;
574 if (!(sdram
->cfg
& 0x40000000) && (val
& 0x40000000))
575 sdram
->status
|= 0x40000000;
576 else if ((sdram
->cfg
& 0x40000000) && !(val
& 0x40000000))
577 sdram
->status
&= ~0x40000000;
580 case 0x24: /* SDRAM_STATUS */
581 /* Read-only register */
583 case 0x30: /* SDRAM_RTR */
584 sdram
->rtr
= val
& 0x3FF80000;
586 case 0x34: /* SDRAM_PMIT */
587 sdram
->pmit
= (val
& 0xF8000000) | 0x07C00000;
589 case 0x40: /* SDRAM_B0CR */
590 sdram_set_bcr(sdram
, 0, val
, sdram
->cfg
& 0x80000000);
592 case 0x44: /* SDRAM_B1CR */
593 sdram_set_bcr(sdram
, 1, val
, sdram
->cfg
& 0x80000000);
595 case 0x48: /* SDRAM_B2CR */
596 sdram_set_bcr(sdram
, 2, val
, sdram
->cfg
& 0x80000000);
598 case 0x4C: /* SDRAM_B3CR */
599 sdram_set_bcr(sdram
, 3, val
, sdram
->cfg
& 0x80000000);
601 case 0x80: /* SDRAM_TR */
602 sdram
->tr
= val
& 0x018FC01F;
604 case 0x94: /* SDRAM_ECCCFG */
605 sdram
->ecccfg
= val
& 0x00F00000;
607 case 0x98: /* SDRAM_ECCESR */
609 if (sdram
->eccesr
== 0 && val
!= 0)
610 qemu_irq_raise(sdram
->irq
);
611 else if (sdram
->eccesr
!= 0 && val
== 0)
612 qemu_irq_lower(sdram
->irq
);
622 static void sdram_reset (void *opaque
)
624 ppc4xx_sdram_t
*sdram
;
627 sdram
->addr
= 0x00000000;
628 sdram
->bear
= 0x00000000;
629 sdram
->besr0
= 0x00000000; /* No error */
630 sdram
->besr1
= 0x00000000; /* No error */
631 sdram
->cfg
= 0x00000000;
632 sdram
->ecccfg
= 0x00000000; /* No ECC */
633 sdram
->eccesr
= 0x00000000; /* No error */
634 sdram
->pmit
= 0x07C00000;
635 sdram
->rtr
= 0x05F00000;
636 sdram
->tr
= 0x00854009;
637 /* We pre-initialize RAM banks */
638 sdram
->status
= 0x00000000;
639 sdram
->cfg
= 0x00800000;
642 void ppc4xx_sdram_init (CPUPPCState
*env
, qemu_irq irq
, int nbanks
,
643 MemoryRegion
*ram_memories
,
648 ppc4xx_sdram_t
*sdram
;
650 sdram
= g_malloc0(sizeof(ppc4xx_sdram_t
));
652 sdram
->nbanks
= nbanks
;
653 sdram
->ram_memories
= ram_memories
;
654 memset(sdram
->ram_bases
, 0, 4 * sizeof(hwaddr
));
655 memcpy(sdram
->ram_bases
, ram_bases
,
656 nbanks
* sizeof(hwaddr
));
657 memset(sdram
->ram_sizes
, 0, 4 * sizeof(hwaddr
));
658 memcpy(sdram
->ram_sizes
, ram_sizes
,
659 nbanks
* sizeof(hwaddr
));
660 qemu_register_reset(&sdram_reset
, sdram
);
661 ppc_dcr_register(env
, SDRAM0_CFGADDR
,
662 sdram
, &dcr_read_sdram
, &dcr_write_sdram
);
663 ppc_dcr_register(env
, SDRAM0_CFGDATA
,
664 sdram
, &dcr_read_sdram
, &dcr_write_sdram
);
666 sdram_map_bcr(sdram
);
670 * Split RAM between SDRAM banks.
672 * sdram_bank_sizes[] must be in descending order, that is sizes[i] > sizes[i+1]
673 * and must be 0-terminated.
675 * The 4xx SDRAM controller supports a small number of banks, and each bank
676 * must be one of a small set of sizes. The number of banks and the supported
677 * sizes varies by SoC.
679 void ppc4xx_sdram_banks(MemoryRegion
*ram
, int nr_banks
,
680 MemoryRegion ram_memories
[],
681 hwaddr ram_bases
[], hwaddr ram_sizes
[],
682 const ram_addr_t sdram_bank_sizes
[])
684 ram_addr_t size_left
= memory_region_size(ram
);
686 ram_addr_t bank_size
;
690 for (i
= 0; i
< nr_banks
; i
++) {
691 for (j
= 0; sdram_bank_sizes
[j
] != 0; j
++) {
692 bank_size
= sdram_bank_sizes
[j
];
693 if (bank_size
<= size_left
) {
697 ram_sizes
[i
] = bank_size
;
699 size_left
-= bank_size
;
700 snprintf(name
, sizeof(name
), "ppc4xx.sdram%d", i
);
701 memory_region_init_alias(&ram_memories
[i
], NULL
, name
, ram
,
702 ram_bases
[i
], ram_sizes
[i
]);
707 /* No need to use the remaining banks. */
713 ram_addr_t used_size
= memory_region_size(ram
) - size_left
;
714 GString
*s
= g_string_new(NULL
);
716 for (i
= 0; sdram_bank_sizes
[i
]; i
++) {
717 g_string_append_printf(s
, "%" PRIi64
"%s",
718 sdram_bank_sizes
[i
] / MiB
,
719 sdram_bank_sizes
[i
+ 1] ? ", " : "");
721 error_report("at most %d bank%s of %s MiB each supported",
722 nr_banks
, nr_banks
== 1 ? "" : "s", s
->str
);
723 error_printf("Possible valid RAM size: %" PRIi64
" MiB \n",
724 used_size
? used_size
/ MiB
: sdram_bank_sizes
[i
- 1] / MiB
);
726 g_string_free(s
, true);
731 /*****************************************************************************/
740 MAL0_TXEOBISR
= 0x186,
744 MAL0_RXEOBISR
= 0x192,
746 MAL0_TXCTP0R
= 0x1A0,
747 MAL0_RXCTP0R
= 0x1C0,
752 typedef struct ppc4xx_mal_t ppc4xx_mal_t
;
753 struct ppc4xx_mal_t
{
773 static void ppc4xx_mal_reset(void *opaque
)
778 mal
->cfg
= 0x0007C000;
779 mal
->esr
= 0x00000000;
780 mal
->ier
= 0x00000000;
781 mal
->rxcasr
= 0x00000000;
782 mal
->rxdeir
= 0x00000000;
783 mal
->rxeobisr
= 0x00000000;
784 mal
->txcasr
= 0x00000000;
785 mal
->txdeir
= 0x00000000;
786 mal
->txeobisr
= 0x00000000;
789 static uint32_t dcr_read_mal(void *opaque
, int dcrn
)
833 if (dcrn
>= MAL0_TXCTP0R
&& dcrn
< MAL0_TXCTP0R
+ mal
->txcnum
) {
834 ret
= mal
->txctpr
[dcrn
- MAL0_TXCTP0R
];
836 if (dcrn
>= MAL0_RXCTP0R
&& dcrn
< MAL0_RXCTP0R
+ mal
->rxcnum
) {
837 ret
= mal
->rxctpr
[dcrn
- MAL0_RXCTP0R
];
839 if (dcrn
>= MAL0_RCBS0
&& dcrn
< MAL0_RCBS0
+ mal
->rxcnum
) {
840 ret
= mal
->rcbs
[dcrn
- MAL0_RCBS0
];
846 static void dcr_write_mal(void *opaque
, int dcrn
, uint32_t val
)
853 if (val
& 0x80000000) {
854 ppc4xx_mal_reset(mal
);
856 mal
->cfg
= val
& 0x00FFC087;
863 mal
->ier
= val
& 0x0000001F;
866 mal
->txcasr
= val
& 0xF0000000;
869 mal
->txcarr
= val
& 0xF0000000;
873 mal
->txeobisr
&= ~val
;
880 mal
->rxcasr
= val
& 0xC0000000;
883 mal
->rxcarr
= val
& 0xC0000000;
887 mal
->rxeobisr
&= ~val
;
894 if (dcrn
>= MAL0_TXCTP0R
&& dcrn
< MAL0_TXCTP0R
+ mal
->txcnum
) {
895 mal
->txctpr
[dcrn
- MAL0_TXCTP0R
] = val
;
897 if (dcrn
>= MAL0_RXCTP0R
&& dcrn
< MAL0_RXCTP0R
+ mal
->rxcnum
) {
898 mal
->rxctpr
[dcrn
- MAL0_RXCTP0R
] = val
;
900 if (dcrn
>= MAL0_RCBS0
&& dcrn
< MAL0_RCBS0
+ mal
->rxcnum
) {
901 mal
->rcbs
[dcrn
- MAL0_RCBS0
] = val
& 0x000000FF;
905 void ppc4xx_mal_init(CPUPPCState
*env
, uint8_t txcnum
, uint8_t rxcnum
,
911 assert(txcnum
<= 32 && rxcnum
<= 32);
912 mal
= g_malloc0(sizeof(*mal
));
913 mal
->txcnum
= txcnum
;
914 mal
->rxcnum
= rxcnum
;
915 mal
->txctpr
= g_new0(uint32_t, txcnum
);
916 mal
->rxctpr
= g_new0(uint32_t, rxcnum
);
917 mal
->rcbs
= g_new0(uint32_t, rxcnum
);
918 for (i
= 0; i
< 4; i
++) {
919 mal
->irqs
[i
] = irqs
[i
];
921 qemu_register_reset(&ppc4xx_mal_reset
, mal
);
922 ppc_dcr_register(env
, MAL0_CFG
,
923 mal
, &dcr_read_mal
, &dcr_write_mal
);
924 ppc_dcr_register(env
, MAL0_ESR
,
925 mal
, &dcr_read_mal
, &dcr_write_mal
);
926 ppc_dcr_register(env
, MAL0_IER
,
927 mal
, &dcr_read_mal
, &dcr_write_mal
);
928 ppc_dcr_register(env
, MAL0_TXCASR
,
929 mal
, &dcr_read_mal
, &dcr_write_mal
);
930 ppc_dcr_register(env
, MAL0_TXCARR
,
931 mal
, &dcr_read_mal
, &dcr_write_mal
);
932 ppc_dcr_register(env
, MAL0_TXEOBISR
,
933 mal
, &dcr_read_mal
, &dcr_write_mal
);
934 ppc_dcr_register(env
, MAL0_TXDEIR
,
935 mal
, &dcr_read_mal
, &dcr_write_mal
);
936 ppc_dcr_register(env
, MAL0_RXCASR
,
937 mal
, &dcr_read_mal
, &dcr_write_mal
);
938 ppc_dcr_register(env
, MAL0_RXCARR
,
939 mal
, &dcr_read_mal
, &dcr_write_mal
);
940 ppc_dcr_register(env
, MAL0_RXEOBISR
,
941 mal
, &dcr_read_mal
, &dcr_write_mal
);
942 ppc_dcr_register(env
, MAL0_RXDEIR
,
943 mal
, &dcr_read_mal
, &dcr_write_mal
);
944 for (i
= 0; i
< txcnum
; i
++) {
945 ppc_dcr_register(env
, MAL0_TXCTP0R
+ i
,
946 mal
, &dcr_read_mal
, &dcr_write_mal
);
948 for (i
= 0; i
< rxcnum
; i
++) {
949 ppc_dcr_register(env
, MAL0_RXCTP0R
+ i
,
950 mal
, &dcr_read_mal
, &dcr_write_mal
);
952 for (i
= 0; i
< rxcnum
; i
++) {
953 ppc_dcr_register(env
, MAL0_RCBS0
+ i
,
954 mal
, &dcr_read_mal
, &dcr_write_mal
);