From 95273a610ff4ed4f4cf78d20a99f6a32acec8841 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 3 Jan 2000 14:06:42 +0000 Subject: Combination of coverhd.h cleanup and MVME23xx/MCP750 patch from Eric Valette and Jay Kulpinski . --- c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c | 4 +- .../powerpc/mpc6xx/exceptions/raw_exception.c | 99 +++++++++++++++++----- .../powerpc/mpc6xx/exceptions/raw_exception.h | 7 ++ c/src/lib/libcpu/powerpc/mpc6xx/mmu/mmuAsm.S | 29 ++++++- 4 files changed, 114 insertions(+), 25 deletions(-) (limited to 'c/src/lib/libcpu/powerpc/mpc6xx') diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c b/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c index b3d93f8f34..035af4d61d 100644 --- a/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c +++ b/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c @@ -143,7 +143,7 @@ rtems_device_driver Clock_initialize( void *pargp ) { - Clock_Decrementer_value = (BSP_bus_frequency/4000)* + Clock_Decrementer_value = (BSP_bus_frequency/BSP_time_base_divisor)* (BSP_Configuration.microseconds_per_tick/1000); if (!BSP_connect_clock_handler ()) { @@ -185,7 +185,7 @@ rtems_device_driver Clock_control( if (args == 0) goto done; - Clock_Decrementer_value = (BSP_bus_frequency/4000)* + Clock_Decrementer_value = (BSP_bus_frequency/BSP_time_base_divisor)* (BSP_Configuration.microseconds_per_tick/1000); if (args->command == rtems_build_name('I', 'S', 'R', ' ')) diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c b/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c index cd8274e2e1..5b4ac21ea4 100644 --- a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c +++ b/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c @@ -11,6 +11,9 @@ * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr) * Canon Centre Recherche France. * + * Enhanced by Jay Kulpinski + * to support 603, 603e, 604, 604e exceptions + * * The license and distribution terms for this file may be * found in found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. @@ -50,12 +53,61 @@ int mpc750_vector_is_valid(rtems_vector vector) } } +int mpc603_vector_is_valid(rtems_vector vector) +{ + switch(vector) { + case ASM_RESET_VECTOR: /* fall through */ + case ASM_MACH_VECTOR: + case ASM_PROT_VECTOR: + case ASM_ISI_VECTOR: + case ASM_EXT_VECTOR: + case ASM_ALIGN_VECTOR: + case ASM_PROG_VECTOR: + case ASM_FLOAT_VECTOR: + case ASM_DEC_VECTOR: + case ASM_SYS_VECTOR: + case ASM_TRACE_VECTOR: + return 1; + case ASM_PERFMON_VECTOR: + return 0; + case ASM_IMISS_VECTOR: /* fall through */ + case ASM_DLMISS_VECTOR: + case ASM_DSMISS_VECTOR: + case ASM_ADDR_VECTOR: + case ASM_SYSMGMT_VECTOR: + return 1; + case ASM_ITM_VECTOR: + return 0; + } + return 0; +} + int mpc604_vector_is_valid(rtems_vector vector) { - /* - * Please fill this for MVME2307 - */ - printk("Please complete libcpu/powerpc/XXX/raw_exception.c\n"); + switch(vector) { + case ASM_RESET_VECTOR: /* fall through */ + case ASM_MACH_VECTOR: + case ASM_PROT_VECTOR: + case ASM_ISI_VECTOR: + case ASM_EXT_VECTOR: + case ASM_ALIGN_VECTOR: + case ASM_PROG_VECTOR: + case ASM_FLOAT_VECTOR: + case ASM_DEC_VECTOR: + case ASM_SYS_VECTOR: + case ASM_TRACE_VECTOR: + case ASM_PERFMON_VECTOR: + return 1; + case ASM_IMISS_VECTOR: /* fall through */ + case ASM_DLMISS_VECTOR: + case ASM_DSMISS_VECTOR: + return 0; + case ASM_ADDR_VECTOR: /* fall through */ + case ASM_SYSMGMT_VECTOR: + return 1; + case ASM_ITM_VECTOR: + return 0; + } return 0; } @@ -63,22 +115,31 @@ int mpc60x_set_exception (const rtems_raw_except_connect_data* except) { unsigned int level; - if (current_ppc_cpu == PPC_750) { - if (!mpc750_vector_is_valid(except->exceptIndex)){ - return 0; - } - goto exception_ok; - } - if (current_ppc_cpu == PPC_604) { - if (!mpc604_vector_is_valid(except->exceptIndex)){ - return 0; - } - goto exception_ok; + switch (current_ppc_cpu) { + case PPC_750: + if (!mpc750_vector_is_valid(except->exceptIndex)) { + return 0; + } + break; + case PPC_604: + case PPC_604e: + case PPC_604r: + if (!mpc604_vector_is_valid(except->exceptIndex)) { + return 0; + } + break; + case PPC_603: + case PPC_603e: + if (!mpc603_vector_is_valid(except->exceptIndex)) { + return 0; + } + break; + default: + printk("Please complete libcpu/powerpc/mpc6xx/raw_exception.c\n"); + printk("current_ppc_cpu = %x\n", current_ppc_cpu); + return 0; } - printk("Please complete libcpu/powerpc/XXX/raw_exception.c\n"); - return 0; - -exception_ok: + /* * Check if default handler is actually connected. If not issue an error. * You must first get the current handler via mpc60x_get_current_exception diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h b/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h index f6542b9dfe..4419fdda8e 100644 --- a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h +++ b/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h @@ -13,6 +13,9 @@ * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr) * Canon Centre Recherche France. * + * Enhanced by Jay Kulpinski + * to support 603, 603e, 604, 604e exceptions + * * The license and distribution terms for this file may be * found in found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. @@ -38,6 +41,10 @@ #define ASM_DEC_VECTOR 0x09 #define ASM_SYS_VECTOR 0x0C #define ASM_TRACE_VECTOR 0x0D +#define ASM_PERFMON_VECTOR 0x0F +#define ASM_IMISS_VECTOR 0x10 +#define ASM_DLMISS_VECTOR 0x11 +#define ASM_DSMISS_VECTOR 0x12 #define ASM_ADDR_VECTOR 0x13 #define ASM_SYSMGMT_VECTOR 0x14 #define ASM_ITM_VECTOR 0x17 diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/mmu/mmuAsm.S b/c/src/lib/libcpu/powerpc/mpc6xx/mmu/mmuAsm.S index a0f298e5c3..b5a76704c2 100644 --- a/c/src/lib/libcpu/powerpc/mpc6xx/mmu/mmuAsm.S +++ b/c/src/lib/libcpu/powerpc/mpc6xx/mmu/mmuAsm.S @@ -19,27 +19,48 @@ #include #include "asm.h" +/* + * Each setdbat routine start by invalidating the DBAT as some + * proc (604e) request the valid bit set to 0 before accepting + * to write in BAT + */ + .globl asm_setdbat1 .type asm_setdbat1,@function -asm_setdbat1: - mtspr DBAT1U, r3 +asm_setdbat1: + li r20,0 + SYNC + mtspr DBAT1U,r20 + mtspr DBAT1L,r20 + SYNC mtspr DBAT1L, r4 + mtspr DBAT1U, r3 SYNC blr .globl asm_setdbat2 .type asm_setdbat2,@function asm_setdbat2: - mtspr DBAT2U, r3 + li r20,0 + SYNC + mtspr DBAT2U,r20 + mtspr DBAT2L,r20 + SYNC mtspr DBAT2L, r4 + mtspr DBAT2U, r3 SYNC blr .globl asm_setdbat3 .type asm_setdbat3,@function asm_setdbat3: - mtspr DBAT3U, r3 + li r20,0 + SYNC + mtspr DBAT3U,r20 + mtspr DBAT3L,r20 + SYNC mtspr DBAT3L, r4 + mtspr DBAT3U, r3 SYNC blr -- cgit v1.2.3