2007-10-07 16:21:26 +02:00
|
|
|
/*
|
|
|
|
* QEMU PowerPC 4xx embedded processors shared devices emulation
|
|
|
|
*
|
|
|
|
* Copyright (c) 2007 Jocelyn Mayer
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2019-08-12 07:23:38 +02:00
|
|
|
|
2016-01-26 19:16:58 +01:00
|
|
|
#include "qemu/osdep.h"
|
2018-06-25 14:42:24 +02:00
|
|
|
#include "qemu/units.h"
|
2019-08-12 07:23:38 +02:00
|
|
|
#include "sysemu/reset.h"
|
2016-03-15 16:58:45 +01:00
|
|
|
#include "cpu.h"
|
2019-08-12 07:23:42 +02:00
|
|
|
#include "hw/irq.h"
|
2013-02-05 17:06:20 +01:00
|
|
|
#include "hw/ppc/ppc.h"
|
|
|
|
#include "hw/ppc/ppc4xx.h"
|
2020-12-12 01:15:31 +01:00
|
|
|
#include "hw/intc/ppc-uic.h"
|
|
|
|
#include "hw/qdev-properties.h"
|
2012-12-17 18:20:00 +01:00
|
|
|
#include "qemu/log.h"
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "exec/address-spaces.h"
|
2018-06-25 14:42:24 +02:00
|
|
|
#include "qemu/error-report.h"
|
2020-12-12 01:15:31 +01:00
|
|
|
#include "qapi/error.h"
|
2007-10-07 16:21:26 +02:00
|
|
|
|
2019-01-02 03:06:38 +01:00
|
|
|
/*#define DEBUG_UIC*/
|
2009-01-15 22:48:06 +01:00
|
|
|
|
|
|
|
#ifdef DEBUG_UIC
|
2009-01-15 23:34:14 +01:00
|
|
|
# define LOG_UIC(...) qemu_log_mask(CPU_LOG_INT, ## __VA_ARGS__)
|
2009-01-15 22:48:06 +01:00
|
|
|
#else
|
|
|
|
# define LOG_UIC(...) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2012-02-08 03:03:33 +01:00
|
|
|
static void ppc4xx_reset(void *opaque)
|
|
|
|
{
|
2012-05-04 17:22:20 +02:00
|
|
|
PowerPCCPU *cpu = opaque;
|
2012-02-08 03:03:33 +01:00
|
|
|
|
2012-05-04 17:22:20 +02:00
|
|
|
cpu_reset(CPU(cpu));
|
2012-02-08 03:03:33 +01:00
|
|
|
}
|
|
|
|
|
2007-10-07 16:21:26 +02:00
|
|
|
/*****************************************************************************/
|
2011-04-28 17:20:36 +02:00
|
|
|
/* Generic PowerPC 4xx processor instantiation */
|
2017-10-09 21:50:55 +02:00
|
|
|
PowerPCCPU *ppc4xx_init(const char *cpu_type,
|
2012-12-01 04:47:33 +01:00
|
|
|
clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
|
|
|
|
uint32_t sysclk)
|
2007-10-07 16:21:26 +02:00
|
|
|
{
|
2012-05-04 17:20:11 +02:00
|
|
|
PowerPCCPU *cpu;
|
2012-03-14 01:38:23 +01:00
|
|
|
CPUPPCState *env;
|
2007-10-07 16:21:26 +02:00
|
|
|
|
|
|
|
/* init CPUs */
|
2017-10-09 21:50:55 +02:00
|
|
|
cpu = POWERPC_CPU(cpu_create(cpu_type));
|
2012-05-04 17:20:11 +02:00
|
|
|
env = &cpu->env;
|
|
|
|
|
2007-10-07 16:21:26 +02:00
|
|
|
cpu_clk->cb = NULL; /* We don't care about CPU clock frequency changes */
|
|
|
|
cpu_clk->opaque = env;
|
|
|
|
/* Set time-base frequency to sysclk */
|
2011-09-13 06:00:32 +02:00
|
|
|
tb_clk->cb = ppc_40x_timers_init(env, sysclk, PPC_INTERRUPT_PIT);
|
2007-10-07 16:21:26 +02:00
|
|
|
tb_clk->opaque = env;
|
|
|
|
ppc_dcr_init(env, NULL, NULL);
|
|
|
|
/* Register qemu callbacks */
|
2012-05-04 17:22:20 +02:00
|
|
|
qemu_register_reset(ppc4xx_reset, cpu);
|
2007-10-07 16:21:26 +02:00
|
|
|
|
2012-12-01 04:47:33 +01:00
|
|
|
return cpu;
|
2007-10-07 16:21:26 +02:00
|
|
|
}
|
|
|
|
|
2008-12-15 23:59:34 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* SDRAM controller */
|
2009-10-01 23:12:16 +02:00
|
|
|
typedef struct ppc4xx_sdram_t ppc4xx_sdram_t;
|
|
|
|
struct ppc4xx_sdram_t {
|
2008-12-15 23:59:34 +01:00
|
|
|
uint32_t addr;
|
|
|
|
int nbanks;
|
2011-08-15 16:17:27 +02:00
|
|
|
MemoryRegion containers[4]; /* used for clipping */
|
|
|
|
MemoryRegion *ram_memories;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr ram_bases[4];
|
|
|
|
hwaddr ram_sizes[4];
|
2008-12-15 23:59:34 +01:00
|
|
|
uint32_t besr0;
|
|
|
|
uint32_t besr1;
|
|
|
|
uint32_t bear;
|
|
|
|
uint32_t cfg;
|
|
|
|
uint32_t status;
|
|
|
|
uint32_t rtr;
|
|
|
|
uint32_t pmit;
|
|
|
|
uint32_t bcr[4];
|
|
|
|
uint32_t tr;
|
|
|
|
uint32_t ecccfg;
|
|
|
|
uint32_t eccesr;
|
|
|
|
qemu_irq irq;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SDRAM0_CFGADDR = 0x010,
|
|
|
|
SDRAM0_CFGDATA = 0x011,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* XXX: TOFIX: some patches have made this code become inconsistent:
|
2012-10-23 12:30:10 +02:00
|
|
|
* there are type inconsistencies, mixing hwaddr, target_ulong
|
2008-12-15 23:59:34 +01:00
|
|
|
* and uint32_t
|
|
|
|
*/
|
2012-10-23 12:30:10 +02:00
|
|
|
static uint32_t sdram_bcr (hwaddr ram_base,
|
|
|
|
hwaddr ram_size)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
|
|
|
uint32_t bcr;
|
|
|
|
|
|
|
|
switch (ram_size) {
|
2018-06-25 14:42:24 +02:00
|
|
|
case 4 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x00000000;
|
|
|
|
break;
|
2018-06-25 14:42:24 +02:00
|
|
|
case 8 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x00020000;
|
|
|
|
break;
|
2018-06-25 14:42:24 +02:00
|
|
|
case 16 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x00040000;
|
|
|
|
break;
|
2018-06-25 14:42:24 +02:00
|
|
|
case 32 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x00060000;
|
|
|
|
break;
|
2018-06-25 14:42:24 +02:00
|
|
|
case 64 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x00080000;
|
|
|
|
break;
|
2018-06-25 14:42:24 +02:00
|
|
|
case 128 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x000A0000;
|
|
|
|
break;
|
2018-06-25 14:42:24 +02:00
|
|
|
case 256 * MiB:
|
2008-12-15 23:59:34 +01:00
|
|
|
bcr = 0x000C0000;
|
|
|
|
break;
|
|
|
|
default:
|
2009-08-16 13:13:18 +02:00
|
|
|
printf("%s: invalid RAM size " TARGET_FMT_plx "\n", __func__,
|
|
|
|
ram_size);
|
2008-12-15 23:59:34 +01:00
|
|
|
return 0x00000000;
|
|
|
|
}
|
|
|
|
bcr |= ram_base & 0xFF800000;
|
|
|
|
bcr |= 1;
|
|
|
|
|
|
|
|
return bcr;
|
|
|
|
}
|
|
|
|
|
2012-10-23 12:30:10 +02:00
|
|
|
static inline hwaddr sdram_base(uint32_t bcr)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
|
|
|
return bcr & 0xFF800000;
|
|
|
|
}
|
|
|
|
|
|
|
|
static target_ulong sdram_size (uint32_t bcr)
|
|
|
|
{
|
|
|
|
target_ulong size;
|
|
|
|
int sh;
|
|
|
|
|
|
|
|
sh = (bcr >> 17) & 0x7;
|
|
|
|
if (sh == 7)
|
|
|
|
size = -1;
|
|
|
|
else
|
2018-06-25 14:42:24 +02:00
|
|
|
size = (4 * MiB) << sh;
|
2008-12-15 23:59:34 +01:00
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2019-01-03 17:27:24 +01:00
|
|
|
static void sdram_set_bcr(ppc4xx_sdram_t *sdram, int i,
|
|
|
|
uint32_t bcr, int enabled)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
2019-01-03 17:27:24 +01:00
|
|
|
if (sdram->bcr[i] & 0x00000001) {
|
2008-12-15 23:59:34 +01:00
|
|
|
/* Unmap RAM */
|
|
|
|
#ifdef DEBUG_SDRAM
|
2009-08-16 13:13:18 +02:00
|
|
|
printf("%s: unmap RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n",
|
2019-01-03 17:27:24 +01:00
|
|
|
__func__, sdram_base(sdram->bcr[i]), sdram_size(sdram->bcr[i]));
|
2008-12-15 23:59:34 +01:00
|
|
|
#endif
|
2011-08-15 16:17:27 +02:00
|
|
|
memory_region_del_subregion(get_system_memory(),
|
2019-01-03 17:27:24 +01:00
|
|
|
&sdram->containers[i]);
|
|
|
|
memory_region_del_subregion(&sdram->containers[i],
|
|
|
|
&sdram->ram_memories[i]);
|
|
|
|
object_unparent(OBJECT(&sdram->containers[i]));
|
2008-12-15 23:59:34 +01:00
|
|
|
}
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram->bcr[i] = bcr & 0xFFDEE001;
|
2008-12-15 23:59:34 +01:00
|
|
|
if (enabled && (bcr & 0x00000001)) {
|
|
|
|
#ifdef DEBUG_SDRAM
|
2009-08-16 13:13:18 +02:00
|
|
|
printf("%s: Map RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n",
|
2008-12-15 23:59:34 +01:00
|
|
|
__func__, sdram_base(bcr), sdram_size(bcr));
|
|
|
|
#endif
|
2019-01-03 17:27:24 +01:00
|
|
|
memory_region_init(&sdram->containers[i], NULL, "sdram-containers",
|
2011-08-15 16:17:27 +02:00
|
|
|
sdram_size(bcr));
|
2019-01-03 17:27:24 +01:00
|
|
|
memory_region_add_subregion(&sdram->containers[i], 0,
|
|
|
|
&sdram->ram_memories[i]);
|
2011-08-15 16:17:27 +02:00
|
|
|
memory_region_add_subregion(get_system_memory(),
|
|
|
|
sdram_base(bcr),
|
2019-01-03 17:27:24 +01:00
|
|
|
&sdram->containers[i]);
|
2008-12-15 23:59:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
static void sdram_map_bcr (ppc4xx_sdram_t *sdram)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < sdram->nbanks; i++) {
|
|
|
|
if (sdram->ram_sizes[i] != 0) {
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram_set_bcr(sdram, i, sdram_bcr(sdram->ram_bases[i],
|
|
|
|
sdram->ram_sizes[i]), 1);
|
2008-12-15 23:59:34 +01:00
|
|
|
} else {
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram_set_bcr(sdram, i, 0x00000000, 0);
|
2008-12-15 23:59:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < sdram->nbanks; i++) {
|
|
|
|
#ifdef DEBUG_SDRAM
|
2009-08-16 13:13:18 +02:00
|
|
|
printf("%s: Unmap RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n",
|
2008-12-15 23:59:34 +01:00
|
|
|
__func__, sdram_base(sdram->bcr[i]), sdram_size(sdram->bcr[i]));
|
|
|
|
#endif
|
2011-08-15 16:17:27 +02:00
|
|
|
memory_region_del_subregion(get_system_memory(),
|
|
|
|
&sdram->ram_memories[i]);
|
2008-12-15 23:59:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-21 14:02:39 +01:00
|
|
|
static uint32_t dcr_read_sdram (void *opaque, int dcrn)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ppc4xx_sdram_t *sdram;
|
2009-12-21 14:02:39 +01:00
|
|
|
uint32_t ret;
|
2008-12-15 23:59:34 +01:00
|
|
|
|
|
|
|
sdram = opaque;
|
|
|
|
switch (dcrn) {
|
|
|
|
case SDRAM0_CFGADDR:
|
|
|
|
ret = sdram->addr;
|
|
|
|
break;
|
|
|
|
case SDRAM0_CFGDATA:
|
|
|
|
switch (sdram->addr) {
|
|
|
|
case 0x00: /* SDRAM_BESR0 */
|
|
|
|
ret = sdram->besr0;
|
|
|
|
break;
|
|
|
|
case 0x08: /* SDRAM_BESR1 */
|
|
|
|
ret = sdram->besr1;
|
|
|
|
break;
|
|
|
|
case 0x10: /* SDRAM_BEAR */
|
|
|
|
ret = sdram->bear;
|
|
|
|
break;
|
|
|
|
case 0x20: /* SDRAM_CFG */
|
|
|
|
ret = sdram->cfg;
|
|
|
|
break;
|
|
|
|
case 0x24: /* SDRAM_STATUS */
|
|
|
|
ret = sdram->status;
|
|
|
|
break;
|
|
|
|
case 0x30: /* SDRAM_RTR */
|
|
|
|
ret = sdram->rtr;
|
|
|
|
break;
|
|
|
|
case 0x34: /* SDRAM_PMIT */
|
|
|
|
ret = sdram->pmit;
|
|
|
|
break;
|
|
|
|
case 0x40: /* SDRAM_B0CR */
|
|
|
|
ret = sdram->bcr[0];
|
|
|
|
break;
|
|
|
|
case 0x44: /* SDRAM_B1CR */
|
|
|
|
ret = sdram->bcr[1];
|
|
|
|
break;
|
|
|
|
case 0x48: /* SDRAM_B2CR */
|
|
|
|
ret = sdram->bcr[2];
|
|
|
|
break;
|
|
|
|
case 0x4C: /* SDRAM_B3CR */
|
|
|
|
ret = sdram->bcr[3];
|
|
|
|
break;
|
|
|
|
case 0x80: /* SDRAM_TR */
|
|
|
|
ret = -1; /* ? */
|
|
|
|
break;
|
|
|
|
case 0x94: /* SDRAM_ECCCFG */
|
|
|
|
ret = sdram->ecccfg;
|
|
|
|
break;
|
|
|
|
case 0x98: /* SDRAM_ECCESR */
|
|
|
|
ret = sdram->eccesr;
|
|
|
|
break;
|
|
|
|
default: /* Error */
|
|
|
|
ret = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Avoid gcc warning */
|
|
|
|
ret = 0x00000000;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-12-21 14:02:39 +01:00
|
|
|
static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val)
|
2008-12-15 23:59:34 +01:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ppc4xx_sdram_t *sdram;
|
2008-12-15 23:59:34 +01:00
|
|
|
|
|
|
|
sdram = opaque;
|
|
|
|
switch (dcrn) {
|
|
|
|
case SDRAM0_CFGADDR:
|
|
|
|
sdram->addr = val;
|
|
|
|
break;
|
|
|
|
case SDRAM0_CFGDATA:
|
|
|
|
switch (sdram->addr) {
|
|
|
|
case 0x00: /* SDRAM_BESR0 */
|
|
|
|
sdram->besr0 &= ~val;
|
|
|
|
break;
|
|
|
|
case 0x08: /* SDRAM_BESR1 */
|
|
|
|
sdram->besr1 &= ~val;
|
|
|
|
break;
|
|
|
|
case 0x10: /* SDRAM_BEAR */
|
|
|
|
sdram->bear = val;
|
|
|
|
break;
|
|
|
|
case 0x20: /* SDRAM_CFG */
|
|
|
|
val &= 0xFFE00000;
|
|
|
|
if (!(sdram->cfg & 0x80000000) && (val & 0x80000000)) {
|
|
|
|
#ifdef DEBUG_SDRAM
|
|
|
|
printf("%s: enable SDRAM controller\n", __func__);
|
|
|
|
#endif
|
|
|
|
/* validate all RAM mappings */
|
|
|
|
sdram_map_bcr(sdram);
|
|
|
|
sdram->status &= ~0x80000000;
|
|
|
|
} else if ((sdram->cfg & 0x80000000) && !(val & 0x80000000)) {
|
|
|
|
#ifdef DEBUG_SDRAM
|
|
|
|
printf("%s: disable SDRAM controller\n", __func__);
|
|
|
|
#endif
|
|
|
|
/* invalidate all RAM mappings */
|
|
|
|
sdram_unmap_bcr(sdram);
|
|
|
|
sdram->status |= 0x80000000;
|
|
|
|
}
|
|
|
|
if (!(sdram->cfg & 0x40000000) && (val & 0x40000000))
|
|
|
|
sdram->status |= 0x40000000;
|
|
|
|
else if ((sdram->cfg & 0x40000000) && !(val & 0x40000000))
|
|
|
|
sdram->status &= ~0x40000000;
|
|
|
|
sdram->cfg = val;
|
|
|
|
break;
|
|
|
|
case 0x24: /* SDRAM_STATUS */
|
|
|
|
/* Read-only register */
|
|
|
|
break;
|
|
|
|
case 0x30: /* SDRAM_RTR */
|
|
|
|
sdram->rtr = val & 0x3FF80000;
|
|
|
|
break;
|
|
|
|
case 0x34: /* SDRAM_PMIT */
|
|
|
|
sdram->pmit = (val & 0xF8000000) | 0x07C00000;
|
|
|
|
break;
|
|
|
|
case 0x40: /* SDRAM_B0CR */
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram_set_bcr(sdram, 0, val, sdram->cfg & 0x80000000);
|
2008-12-15 23:59:34 +01:00
|
|
|
break;
|
|
|
|
case 0x44: /* SDRAM_B1CR */
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram_set_bcr(sdram, 1, val, sdram->cfg & 0x80000000);
|
2008-12-15 23:59:34 +01:00
|
|
|
break;
|
|
|
|
case 0x48: /* SDRAM_B2CR */
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram_set_bcr(sdram, 2, val, sdram->cfg & 0x80000000);
|
2008-12-15 23:59:34 +01:00
|
|
|
break;
|
|
|
|
case 0x4C: /* SDRAM_B3CR */
|
2019-01-03 17:27:24 +01:00
|
|
|
sdram_set_bcr(sdram, 3, val, sdram->cfg & 0x80000000);
|
2008-12-15 23:59:34 +01:00
|
|
|
break;
|
|
|
|
case 0x80: /* SDRAM_TR */
|
|
|
|
sdram->tr = val & 0x018FC01F;
|
|
|
|
break;
|
|
|
|
case 0x94: /* SDRAM_ECCCFG */
|
|
|
|
sdram->ecccfg = val & 0x00F00000;
|
|
|
|
break;
|
|
|
|
case 0x98: /* SDRAM_ECCESR */
|
|
|
|
val &= 0xFFF0F000;
|
|
|
|
if (sdram->eccesr == 0 && val != 0)
|
|
|
|
qemu_irq_raise(sdram->irq);
|
|
|
|
else if (sdram->eccesr != 0 && val == 0)
|
|
|
|
qemu_irq_lower(sdram->irq);
|
|
|
|
sdram->eccesr = val;
|
|
|
|
break;
|
|
|
|
default: /* Error */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sdram_reset (void *opaque)
|
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ppc4xx_sdram_t *sdram;
|
2008-12-15 23:59:34 +01:00
|
|
|
|
|
|
|
sdram = opaque;
|
|
|
|
sdram->addr = 0x00000000;
|
|
|
|
sdram->bear = 0x00000000;
|
|
|
|
sdram->besr0 = 0x00000000; /* No error */
|
|
|
|
sdram->besr1 = 0x00000000; /* No error */
|
|
|
|
sdram->cfg = 0x00000000;
|
|
|
|
sdram->ecccfg = 0x00000000; /* No ECC */
|
|
|
|
sdram->eccesr = 0x00000000; /* No error */
|
|
|
|
sdram->pmit = 0x07C00000;
|
|
|
|
sdram->rtr = 0x05F00000;
|
|
|
|
sdram->tr = 0x00854009;
|
|
|
|
/* We pre-initialize RAM banks */
|
|
|
|
sdram->status = 0x00000000;
|
|
|
|
sdram->cfg = 0x00800000;
|
|
|
|
}
|
|
|
|
|
2012-03-14 01:38:23 +01:00
|
|
|
void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,
|
2011-08-15 16:17:27 +02:00
|
|
|
MemoryRegion *ram_memories,
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr *ram_bases,
|
|
|
|
hwaddr *ram_sizes,
|
2008-12-15 23:59:34 +01:00
|
|
|
int do_init)
|
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
ppc4xx_sdram_t *sdram;
|
2008-12-15 23:59:34 +01:00
|
|
|
|
2011-08-21 05:09:37 +02:00
|
|
|
sdram = g_malloc0(sizeof(ppc4xx_sdram_t));
|
2009-02-05 23:06:05 +01:00
|
|
|
sdram->irq = irq;
|
|
|
|
sdram->nbanks = nbanks;
|
2011-08-15 16:17:27 +02:00
|
|
|
sdram->ram_memories = ram_memories;
|
2012-10-23 12:30:10 +02:00
|
|
|
memset(sdram->ram_bases, 0, 4 * sizeof(hwaddr));
|
2009-02-05 23:06:05 +01:00
|
|
|
memcpy(sdram->ram_bases, ram_bases,
|
2012-10-23 12:30:10 +02:00
|
|
|
nbanks * sizeof(hwaddr));
|
|
|
|
memset(sdram->ram_sizes, 0, 4 * sizeof(hwaddr));
|
2009-02-05 23:06:05 +01:00
|
|
|
memcpy(sdram->ram_sizes, ram_sizes,
|
2012-10-23 12:30:10 +02:00
|
|
|
nbanks * sizeof(hwaddr));
|
2009-06-27 09:25:07 +02:00
|
|
|
qemu_register_reset(&sdram_reset, sdram);
|
2009-02-05 23:06:05 +01:00
|
|
|
ppc_dcr_register(env, SDRAM0_CFGADDR,
|
|
|
|
sdram, &dcr_read_sdram, &dcr_write_sdram);
|
|
|
|
ppc_dcr_register(env, SDRAM0_CFGDATA,
|
|
|
|
sdram, &dcr_read_sdram, &dcr_write_sdram);
|
|
|
|
if (do_init)
|
|
|
|
sdram_map_bcr(sdram);
|
2008-12-15 23:59:34 +01:00
|
|
|
}
|
2008-12-16 00:15:56 +01:00
|
|
|
|
2020-02-19 17:09:40 +01:00
|
|
|
/*
|
|
|
|
* Split RAM between SDRAM banks.
|
2008-12-16 00:15:56 +01:00
|
|
|
*
|
2020-02-19 17:09:39 +01:00
|
|
|
* sdram_bank_sizes[] must be in descending order, that is sizes[i] > sizes[i+1]
|
|
|
|
* and must be 0-terminated.
|
2008-12-16 00:15:56 +01:00
|
|
|
*
|
|
|
|
* The 4xx SDRAM controller supports a small number of banks, and each bank
|
|
|
|
* must be one of a small set of sizes. The number of banks and the supported
|
2020-02-19 17:09:40 +01:00
|
|
|
* sizes varies by SoC.
|
|
|
|
*/
|
|
|
|
void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks,
|
2020-02-19 17:09:39 +01:00
|
|
|
MemoryRegion ram_memories[],
|
|
|
|
hwaddr ram_bases[], hwaddr ram_sizes[],
|
|
|
|
const ram_addr_t sdram_bank_sizes[])
|
2008-12-16 00:15:56 +01:00
|
|
|
{
|
2020-02-19 17:09:40 +01:00
|
|
|
ram_addr_t size_left = memory_region_size(ram);
|
2011-08-15 16:17:27 +02:00
|
|
|
ram_addr_t base = 0;
|
2019-01-03 17:27:24 +01:00
|
|
|
ram_addr_t bank_size;
|
2008-12-16 00:15:56 +01:00
|
|
|
int i;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (i = 0; i < nr_banks; i++) {
|
|
|
|
for (j = 0; sdram_bank_sizes[j] != 0; j++) {
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
bank_size = sdram_bank_sizes[j];
|
2009-04-10 16:29:45 +02:00
|
|
|
if (bank_size <= size_left) {
|
2020-02-19 17:09:40 +01:00
|
|
|
char name[32];
|
|
|
|
|
2020-02-19 17:09:39 +01:00
|
|
|
ram_bases[i] = base;
|
|
|
|
ram_sizes[i] = bank_size;
|
|
|
|
base += bank_size;
|
2009-04-10 16:29:45 +02:00
|
|
|
size_left -= bank_size;
|
2020-02-19 17:09:40 +01:00
|
|
|
snprintf(name, sizeof(name), "ppc4xx.sdram%d", i);
|
|
|
|
memory_region_init_alias(&ram_memories[i], NULL, name, ram,
|
|
|
|
ram_bases[i], ram_sizes[i]);
|
2020-02-19 17:09:39 +01:00
|
|
|
break;
|
2008-12-16 00:15:56 +01:00
|
|
|
}
|
|
|
|
}
|
2009-04-10 16:29:45 +02:00
|
|
|
if (!size_left) {
|
2008-12-16 00:15:56 +01:00
|
|
|
/* No need to use the remaining banks. */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
if (size_left) {
|
2020-02-19 17:09:40 +01:00
|
|
|
ram_addr_t used_size = memory_region_size(ram) - size_left;
|
2020-02-19 17:09:39 +01:00
|
|
|
GString *s = g_string_new(NULL);
|
|
|
|
|
|
|
|
for (i = 0; sdram_bank_sizes[i]; i++) {
|
|
|
|
g_string_append_printf(s, "%" PRIi64 "%s",
|
|
|
|
sdram_bank_sizes[i] / MiB,
|
bamboo, sam460ex: Tidy up error message for unsupported RAM size
Improve
$ ppc-softmmu/qemu-system-ppc -M sam460ex -m 4096
qemu-system-ppc: Max 1 banks of 2048 ,1024 ,512 ,256 ,128 ,64 ,32 MB DIMM/bank supported
qemu-system-ppc: Possible valid RAM size: 2048
to
qemu-system-ppc: at most 1 bank of 2048, 1024, 512, 256, 128, 64, 32 MiB each supported
Possible valid RAM size: 1024 MiB
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200422134815.1584-4-armbru@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-04-22 15:48:14 +02:00
|
|
|
sdram_bank_sizes[i + 1] ? ", " : "");
|
2020-02-19 17:09:39 +01:00
|
|
|
}
|
bamboo, sam460ex: Tidy up error message for unsupported RAM size
Improve
$ ppc-softmmu/qemu-system-ppc -M sam460ex -m 4096
qemu-system-ppc: Max 1 banks of 2048 ,1024 ,512 ,256 ,128 ,64 ,32 MB DIMM/bank supported
qemu-system-ppc: Possible valid RAM size: 2048
to
qemu-system-ppc: at most 1 bank of 2048, 1024, 512, 256, 128, 64, 32 MiB each supported
Possible valid RAM size: 1024 MiB
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200422134815.1584-4-armbru@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-04-22 15:48:14 +02:00
|
|
|
error_report("at most %d bank%s of %s MiB each supported",
|
|
|
|
nr_banks, nr_banks == 1 ? "" : "s", s->str);
|
|
|
|
error_printf("Possible valid RAM size: %" PRIi64 " MiB \n",
|
2020-02-19 17:09:39 +01:00
|
|
|
used_size ? used_size / MiB : sdram_bank_sizes[i - 1] / MiB);
|
|
|
|
|
|
|
|
g_string_free(s, true);
|
|
|
|
exit(EXIT_FAILURE);
|
ppc: fix -mem-path failure
commit e938ba0c tried to enable -mem-path for ppc but breaked some ppc
boards.
The problems are:
1. it fails when allocating memory for rom, sram whose sizes are less
than huge page size:
./ppc-softmmu/qemu-system-ppc -m 512 -mem-path /hugepages/ \
-kernel /home/hutao/Downloads/vmlinux-ppc -initrd \
/home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: /mnt/data/projects/qemu/exec.c:1184: qemu_ram_set_idstr: Assertion `new_block' failed.
2. if there is a numa node backed by memory backend object, qemu fails
with message:
./ppc-softmmu/qemu-system-ppc -m 512 \
-object memory-backend-file,size=512M,mem-path=/hugepages,id=f0 \
-numa node,nodeid=0,memdev=f0 \
-kernel /home/hutao/Downloads/vmlinux-ppc \
-initrd /home/hutao/Downloads/initrd-ppc.gz
qemu-system-ppc: memory backend f0 is used multiple times. Each -numa option must use a different memdev value.
This patch does following:
1. replaces memory_region_allocate_system_memory() with
memory_region_init_ram() for rom, sram. Then only system memory
is backed by hugepages when specifying mem-path.
2. for memory banks, allocates all ram with
one memory_region_allocate_system_memory(), and use
memory_region_init_alias() to initialize memory banks.
Tested machines: default(g3beige), mac99, taihu, bamboo, ref405ep.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-07-21 11:30:17 +02:00
|
|
|
}
|
2008-12-16 00:15:56 +01:00
|
|
|
}
|
2017-08-20 19:23:05 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* MAL */
|
2017-08-20 19:23:05 +02:00
|
|
|
|
2017-08-20 19:23:05 +02:00
|
|
|
enum {
|
|
|
|
MAL0_CFG = 0x180,
|
|
|
|
MAL0_ESR = 0x181,
|
|
|
|
MAL0_IER = 0x182,
|
|
|
|
MAL0_TXCASR = 0x184,
|
|
|
|
MAL0_TXCARR = 0x185,
|
|
|
|
MAL0_TXEOBISR = 0x186,
|
|
|
|
MAL0_TXDEIR = 0x187,
|
|
|
|
MAL0_RXCASR = 0x190,
|
|
|
|
MAL0_RXCARR = 0x191,
|
|
|
|
MAL0_RXEOBISR = 0x192,
|
|
|
|
MAL0_RXDEIR = 0x193,
|
|
|
|
MAL0_TXCTP0R = 0x1A0,
|
|
|
|
MAL0_RXCTP0R = 0x1C0,
|
|
|
|
MAL0_RCBS0 = 0x1E0,
|
|
|
|
MAL0_RCBS1 = 0x1E1,
|
|
|
|
};
|
|
|
|
|
2017-08-20 19:23:05 +02:00
|
|
|
typedef struct ppc4xx_mal_t ppc4xx_mal_t;
|
|
|
|
struct ppc4xx_mal_t {
|
2017-08-20 19:23:05 +02:00
|
|
|
qemu_irq irqs[4];
|
|
|
|
uint32_t cfg;
|
|
|
|
uint32_t esr;
|
|
|
|
uint32_t ier;
|
|
|
|
uint32_t txcasr;
|
|
|
|
uint32_t txcarr;
|
|
|
|
uint32_t txeobisr;
|
|
|
|
uint32_t txdeir;
|
|
|
|
uint32_t rxcasr;
|
|
|
|
uint32_t rxcarr;
|
|
|
|
uint32_t rxeobisr;
|
|
|
|
uint32_t rxdeir;
|
2017-08-20 19:23:05 +02:00
|
|
|
uint32_t *txctpr;
|
|
|
|
uint32_t *rxctpr;
|
|
|
|
uint32_t *rcbs;
|
|
|
|
uint8_t txcnum;
|
|
|
|
uint8_t rxcnum;
|
2017-08-20 19:23:05 +02:00
|
|
|
};
|
|
|
|
|
2017-08-20 19:23:05 +02:00
|
|
|
static void ppc4xx_mal_reset(void *opaque)
|
|
|
|
{
|
|
|
|
ppc4xx_mal_t *mal;
|
|
|
|
|
|
|
|
mal = opaque;
|
|
|
|
mal->cfg = 0x0007C000;
|
|
|
|
mal->esr = 0x00000000;
|
|
|
|
mal->ier = 0x00000000;
|
|
|
|
mal->rxcasr = 0x00000000;
|
|
|
|
mal->rxdeir = 0x00000000;
|
|
|
|
mal->rxeobisr = 0x00000000;
|
|
|
|
mal->txcasr = 0x00000000;
|
|
|
|
mal->txdeir = 0x00000000;
|
|
|
|
mal->txeobisr = 0x00000000;
|
|
|
|
}
|
2017-08-20 19:23:05 +02:00
|
|
|
|
|
|
|
static uint32_t dcr_read_mal(void *opaque, int dcrn)
|
|
|
|
{
|
2017-08-20 19:23:05 +02:00
|
|
|
ppc4xx_mal_t *mal;
|
2017-08-20 19:23:05 +02:00
|
|
|
uint32_t ret;
|
|
|
|
|
|
|
|
mal = opaque;
|
|
|
|
switch (dcrn) {
|
|
|
|
case MAL0_CFG:
|
|
|
|
ret = mal->cfg;
|
|
|
|
break;
|
|
|
|
case MAL0_ESR:
|
|
|
|
ret = mal->esr;
|
|
|
|
break;
|
|
|
|
case MAL0_IER:
|
|
|
|
ret = mal->ier;
|
|
|
|
break;
|
|
|
|
case MAL0_TXCASR:
|
|
|
|
ret = mal->txcasr;
|
|
|
|
break;
|
|
|
|
case MAL0_TXCARR:
|
|
|
|
ret = mal->txcarr;
|
|
|
|
break;
|
|
|
|
case MAL0_TXEOBISR:
|
|
|
|
ret = mal->txeobisr;
|
|
|
|
break;
|
|
|
|
case MAL0_TXDEIR:
|
|
|
|
ret = mal->txdeir;
|
|
|
|
break;
|
|
|
|
case MAL0_RXCASR:
|
|
|
|
ret = mal->rxcasr;
|
|
|
|
break;
|
|
|
|
case MAL0_RXCARR:
|
|
|
|
ret = mal->rxcarr;
|
|
|
|
break;
|
|
|
|
case MAL0_RXEOBISR:
|
|
|
|
ret = mal->rxeobisr;
|
|
|
|
break;
|
|
|
|
case MAL0_RXDEIR:
|
|
|
|
ret = mal->rxdeir;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
}
|
2017-08-20 19:23:05 +02:00
|
|
|
if (dcrn >= MAL0_TXCTP0R && dcrn < MAL0_TXCTP0R + mal->txcnum) {
|
|
|
|
ret = mal->txctpr[dcrn - MAL0_TXCTP0R];
|
|
|
|
}
|
|
|
|
if (dcrn >= MAL0_RXCTP0R && dcrn < MAL0_RXCTP0R + mal->rxcnum) {
|
|
|
|
ret = mal->rxctpr[dcrn - MAL0_RXCTP0R];
|
|
|
|
}
|
|
|
|
if (dcrn >= MAL0_RCBS0 && dcrn < MAL0_RCBS0 + mal->rxcnum) {
|
|
|
|
ret = mal->rcbs[dcrn - MAL0_RCBS0];
|
|
|
|
}
|
2017-08-20 19:23:05 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dcr_write_mal(void *opaque, int dcrn, uint32_t val)
|
|
|
|
{
|
2017-08-20 19:23:05 +02:00
|
|
|
ppc4xx_mal_t *mal;
|
2017-08-20 19:23:05 +02:00
|
|
|
|
|
|
|
mal = opaque;
|
|
|
|
switch (dcrn) {
|
|
|
|
case MAL0_CFG:
|
|
|
|
if (val & 0x80000000) {
|
2017-08-20 19:23:05 +02:00
|
|
|
ppc4xx_mal_reset(mal);
|
2017-08-20 19:23:05 +02:00
|
|
|
}
|
|
|
|
mal->cfg = val & 0x00FFC087;
|
|
|
|
break;
|
|
|
|
case MAL0_ESR:
|
|
|
|
/* Read/clear */
|
|
|
|
mal->esr &= ~val;
|
|
|
|
break;
|
|
|
|
case MAL0_IER:
|
|
|
|
mal->ier = val & 0x0000001F;
|
|
|
|
break;
|
|
|
|
case MAL0_TXCASR:
|
|
|
|
mal->txcasr = val & 0xF0000000;
|
|
|
|
break;
|
|
|
|
case MAL0_TXCARR:
|
|
|
|
mal->txcarr = val & 0xF0000000;
|
|
|
|
break;
|
|
|
|
case MAL0_TXEOBISR:
|
|
|
|
/* Read/clear */
|
|
|
|
mal->txeobisr &= ~val;
|
|
|
|
break;
|
|
|
|
case MAL0_TXDEIR:
|
|
|
|
/* Read/clear */
|
|
|
|
mal->txdeir &= ~val;
|
|
|
|
break;
|
|
|
|
case MAL0_RXCASR:
|
|
|
|
mal->rxcasr = val & 0xC0000000;
|
|
|
|
break;
|
|
|
|
case MAL0_RXCARR:
|
|
|
|
mal->rxcarr = val & 0xC0000000;
|
|
|
|
break;
|
|
|
|
case MAL0_RXEOBISR:
|
|
|
|
/* Read/clear */
|
|
|
|
mal->rxeobisr &= ~val;
|
|
|
|
break;
|
|
|
|
case MAL0_RXDEIR:
|
|
|
|
/* Read/clear */
|
|
|
|
mal->rxdeir &= ~val;
|
|
|
|
break;
|
2017-08-20 19:23:05 +02:00
|
|
|
}
|
|
|
|
if (dcrn >= MAL0_TXCTP0R && dcrn < MAL0_TXCTP0R + mal->txcnum) {
|
|
|
|
mal->txctpr[dcrn - MAL0_TXCTP0R] = val;
|
|
|
|
}
|
|
|
|
if (dcrn >= MAL0_RXCTP0R && dcrn < MAL0_RXCTP0R + mal->rxcnum) {
|
|
|
|
mal->rxctpr[dcrn - MAL0_RXCTP0R] = val;
|
|
|
|
}
|
|
|
|
if (dcrn >= MAL0_RCBS0 && dcrn < MAL0_RCBS0 + mal->rxcnum) {
|
|
|
|
mal->rcbs[dcrn - MAL0_RCBS0] = val & 0x000000FF;
|
2017-08-20 19:23:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-20 19:23:05 +02:00
|
|
|
void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum,
|
|
|
|
qemu_irq irqs[4])
|
2017-08-20 19:23:05 +02:00
|
|
|
{
|
2017-08-20 19:23:05 +02:00
|
|
|
ppc4xx_mal_t *mal;
|
2017-08-20 19:23:05 +02:00
|
|
|
int i;
|
|
|
|
|
2017-08-20 19:23:05 +02:00
|
|
|
assert(txcnum <= 32 && rxcnum <= 32);
|
|
|
|
mal = g_malloc0(sizeof(*mal));
|
|
|
|
mal->txcnum = txcnum;
|
|
|
|
mal->rxcnum = rxcnum;
|
|
|
|
mal->txctpr = g_new0(uint32_t, txcnum);
|
|
|
|
mal->rxctpr = g_new0(uint32_t, rxcnum);
|
|
|
|
mal->rcbs = g_new0(uint32_t, rxcnum);
|
2017-08-20 19:23:05 +02:00
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
mal->irqs[i] = irqs[i];
|
|
|
|
}
|
2017-08-20 19:23:05 +02:00
|
|
|
qemu_register_reset(&ppc4xx_mal_reset, mal);
|
2017-08-20 19:23:05 +02:00
|
|
|
ppc_dcr_register(env, MAL0_CFG,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_ESR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_IER,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_TXCASR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_TXCARR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_TXEOBISR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_TXDEIR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_RXCASR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_RXCARR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_RXEOBISR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
ppc_dcr_register(env, MAL0_RXDEIR,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
2017-08-20 19:23:05 +02:00
|
|
|
for (i = 0; i < txcnum; i++) {
|
|
|
|
ppc_dcr_register(env, MAL0_TXCTP0R + i,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
}
|
|
|
|
for (i = 0; i < rxcnum; i++) {
|
|
|
|
ppc_dcr_register(env, MAL0_RXCTP0R + i,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
}
|
|
|
|
for (i = 0; i < rxcnum; i++) {
|
|
|
|
ppc_dcr_register(env, MAL0_RCBS0 + i,
|
|
|
|
mal, &dcr_read_mal, &dcr_write_mal);
|
|
|
|
}
|
2017-08-20 19:23:05 +02:00
|
|
|
}
|