diff options
Diffstat (limited to 'hw/ppc/ppc440_uc.c')
-rw-r--r-- | hw/ppc/ppc440_uc.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 97e6d5f5b2..edd0781eb7 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -505,7 +505,7 @@ enum { SDRAM_PLBADDUHB = 0x50, }; -static uint32_t sdram_bcr(hwaddr ram_base, hwaddr ram_size) +static uint32_t sdram_ddr2_bcr(hwaddr ram_base, hwaddr ram_size) { uint32_t bcr; @@ -550,12 +550,12 @@ static uint32_t sdram_bcr(hwaddr ram_base, hwaddr ram_size) return bcr; } -static inline hwaddr sdram_base(uint32_t bcr) +static inline hwaddr sdram_ddr2_base(uint32_t bcr) { return (bcr & 0xffe00000) << 2; } -static uint64_t sdram_size(uint32_t bcr) +static uint64_t sdram_ddr2_size(uint32_t bcr) { uint64_t size; int sh; @@ -581,48 +581,49 @@ static void sdram_bank_unmap(Ppc4xxSdramBank *bank) object_unparent(OBJECT(&bank->container)); } -static void sdram_set_bcr(ppc440_sdram_t *sdram, int i, - uint32_t bcr, int enabled) +static void sdram_ddr2_set_bcr(ppc440_sdram_t *sdram, int i, + uint32_t bcr, int enabled) { if (sdram->bank[i].bcr & 1) { /* First unmap RAM if enabled */ - trace_ppc4xx_sdram_unmap(sdram_base(sdram->bank[i].bcr), - sdram_size(sdram->bank[i].bcr)); + trace_ppc4xx_sdram_unmap(sdram_ddr2_base(sdram->bank[i].bcr), + sdram_ddr2_size(sdram->bank[i].bcr)); sdram_bank_unmap(&sdram->bank[i]); } sdram->bank[i].bcr = bcr & 0xffe0ffc1; if (enabled && (bcr & 1)) { - trace_ppc4xx_sdram_map(sdram_base(bcr), sdram_size(bcr)); + trace_ppc4xx_sdram_map(sdram_ddr2_base(bcr), sdram_ddr2_size(bcr)); sdram_bank_map(&sdram->bank[i]); } } -static void sdram_map_bcr(ppc440_sdram_t *sdram) +static void sdram_ddr2_map_bcr(ppc440_sdram_t *sdram) { int i; for (i = 0; i < sdram->nbanks; i++) { if (sdram->bank[i].size) { - sdram_set_bcr(sdram, i, sdram_bcr(sdram->bank[i].base, + sdram_ddr2_set_bcr(sdram, i, + sdram_ddr2_bcr(sdram->bank[i].base, sdram->bank[i].size), 1); } else { - sdram_set_bcr(sdram, i, 0, 0); + sdram_ddr2_set_bcr(sdram, i, 0, 0); } } } -static void sdram_unmap_bcr(ppc440_sdram_t *sdram) +static void sdram_ddr2_unmap_bcr(ppc440_sdram_t *sdram) { int i; for (i = 0; i < sdram->nbanks; i++) { if (sdram->bank[i].size) { - sdram_set_bcr(sdram, i, sdram->bank[i].bcr & ~1, 0); + sdram_ddr2_set_bcr(sdram, i, sdram->bank[i].bcr & ~1, 0); } } } -static uint32_t dcr_read_sdram(void *opaque, int dcrn) +static uint32_t sdram_ddr2_dcr_read(void *opaque, int dcrn) { ppc440_sdram_t *sdram = opaque; uint32_t ret = 0; @@ -633,8 +634,8 @@ static uint32_t dcr_read_sdram(void *opaque, int dcrn) case SDRAM_R2BAS: case SDRAM_R3BAS: if (sdram->bank[dcrn - SDRAM_R0BAS].size) { - ret = sdram_bcr(sdram->bank[dcrn - SDRAM_R0BAS].base, - sdram->bank[dcrn - SDRAM_R0BAS].size); + ret = sdram_ddr2_bcr(sdram->bank[dcrn - SDRAM_R0BAS].base, + sdram->bank[dcrn - SDRAM_R0BAS].size); } break; case SDRAM_CONF1HB: @@ -677,7 +678,7 @@ static uint32_t dcr_read_sdram(void *opaque, int dcrn) #define SDRAM_DDR2_MCOPT2_DCEN BIT(27) -static void dcr_write_sdram(void *opaque, int dcrn, uint32_t val) +static void sdram_ddr2_dcr_write(void *opaque, int dcrn, uint32_t val) { ppc440_sdram_t *sdram = opaque; @@ -704,13 +705,13 @@ static void dcr_write_sdram(void *opaque, int dcrn, uint32_t val) (val & SDRAM_DDR2_MCOPT2_DCEN)) { trace_ppc4xx_sdram_enable("enable"); /* validate all RAM mappings */ - sdram_map_bcr(sdram); + sdram_ddr2_map_bcr(sdram); sdram->mcopt2 |= SDRAM_DDR2_MCOPT2_DCEN; } else if ((sdram->mcopt2 & SDRAM_DDR2_MCOPT2_DCEN) && !(val & SDRAM_DDR2_MCOPT2_DCEN)) { trace_ppc4xx_sdram_enable("disable"); /* invalidate all RAM mappings */ - sdram_unmap_bcr(sdram); + sdram_ddr2_unmap_bcr(sdram); sdram->mcopt2 &= ~SDRAM_DDR2_MCOPT2_DCEN; } break; @@ -723,7 +724,7 @@ static void dcr_write_sdram(void *opaque, int dcrn, uint32_t val) } } -static void sdram_reset(void *opaque) +static void sdram_ddr2_reset(void *opaque) { ppc440_sdram_t *sdram = opaque; @@ -744,33 +745,33 @@ void ppc440_sdram_init(CPUPPCState *env, int nbanks, s->bank[i].base = ram_banks[i].base; s->bank[i].size = ram_banks[i].size; } - qemu_register_reset(&sdram_reset, s); + qemu_register_reset(&sdram_ddr2_reset, s); ppc_dcr_register(env, SDRAM0_CFGADDR, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM0_CFGDATA, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_R0BAS, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_R1BAS, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_R2BAS, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_R3BAS, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_CONF1HB, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_PLBADDULL, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_CONF1LL, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_CONFPATHB, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); ppc_dcr_register(env, SDRAM_PLBADDUHB, - s, &dcr_read_sdram, &dcr_write_sdram); + s, &sdram_ddr2_dcr_read, &sdram_ddr2_dcr_write); } -void ppc440_sdram_enable(CPUPPCState *env) +void ppc4xx_sdram_ddr2_enable(CPUPPCState *env) { ppc_dcr_write(env->dcr_env, SDRAM0_CFGADDR, 0x21); ppc_dcr_write(env->dcr_env, SDRAM0_CFGDATA, 0x08000000); |