summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2007-12-01 00:10:35 +0000
committerTill Straumann <strauman@slac.stanford.edu>2007-12-01 00:10:35 +0000
commitd18d7fe0ddf9e3ce5767eaef172d2b36d942e130 (patch)
tree37973ec56768d9ad60f353d0f5dc2daf6c17c1f3 /c
parent2007-11-29 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-d18d7fe0ddf9e3ce5767eaef172d2b36d942e130.tar.bz2
2007-11-29 Till Straumann <strauman@slac.stanford.edu>
* mpc6xx/exceptions/raw_exception.c, mpc6xx/exceptions/raw_exception.h: removed. mpc6xx uses generic version in new-exceptions.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libcpu/powerpc/ChangeLog6
-rw-r--r--c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c350
-rw-r--r--c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h181
3 files changed, 6 insertions, 531 deletions
diff --git a/c/src/lib/libcpu/powerpc/ChangeLog b/c/src/lib/libcpu/powerpc/ChangeLog
index 4413742366..03dbaf0008 100644
--- a/c/src/lib/libcpu/powerpc/ChangeLog
+++ b/c/src/lib/libcpu/powerpc/ChangeLog
@@ -1,5 +1,11 @@
2007-11-29 Till Straumann <strauman@slac.stanford.edu>
+ * mpc6xx/exceptions/raw_exception.c,
+ mpc6xx/exceptions/raw_exception.h: removed. mpc6xx
+ uses generic version in new-exceptions.
+
+2007-11-29 Till Straumann <strauman@slac.stanford.edu>
+
* shared/include/cpuIdent.h, shared/include/cpuIdent.c:
Added a simple 'feature check' facility. Code should
not check for a particular CPU type if possible but
diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c b/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c
deleted file mode 100644
index c40d2e0408..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * raw_exception.c - This file contains implementation of C function to
- * Instantiate 60x ppc primary exception entries.
- * More detailed information can be found on motorola
- * site and more precisely in the following book :
- *
- * MPC750
- * Risc Microporcessor User's Manual
- * Motorola REF : MPC750UM/AD 8/97
- *
- * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr)
- * Canon Centre Recherche France.
- *
- * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
- * 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.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-#include <rtems/system.h>
-#include <rtems/score/powerpc.h>
-#include <rtems/bspIo.h>
-#include <libcpu/raw_exception.h>
-#include <libcpu/cpuIdent.h>
-
-#include <string.h>
-
-static rtems_raw_except_connect_data* raw_except_table;
-static rtems_raw_except_connect_data default_raw_except_entry;
-static rtems_raw_except_global_settings* local_settings;
-
-void * codemove(void *, const void *, unsigned int, unsigned long);
-
-void* mpc60x_get_vector_addr(rtems_vector vector)
-{
- unsigned vaddr = ((unsigned)vector) << 8;
- extern rtems_cpu_table Cpu_table;
-
- /* Special case; altivec unavailable doesn't fit :-( */
- if ( ASM_VEC_VECTOR == vector )
- vaddr = ASM_VEC_VECTOR_OFFSET;
-
- if ( Cpu_table.exceptions_in_RAM )
- return ((void*) vaddr);
-
- return ((void*) (vaddr + 0xfff00000));
-}
-
-int altivec_vector_is_valid(rtems_vector vector)
-{
- switch(vector) {
- case ASM_VEC_VECTOR:
- case ASM_VEC_ASSIST_VECTOR:
- return 1;
- default:
- break;
- }
- return 0;
-}
-
-int mpc750_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:
- case ASM_ADDR_VECTOR:
- case ASM_SYSMGMT_VECTOR:
- case ASM_ITM_VECTOR:
- return 1;
- default: return 0;
- }
-}
-
-int PSIM_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:
- return 1;
- case ASM_SYS_VECTOR:
- return 0;
- 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 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)
-{
- 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;
-}
-
-int mpc60x_vector_is_valid(rtems_vector vector)
-{
- switch (current_ppc_cpu) {
- case PPC_7400:
- if ( altivec_vector_is_valid(vector) )
- return 1;
- /* else fall thru */
- case PPC_750:
- if (!mpc750_vector_is_valid(vector)) {
- return 0;
- }
- break;
- case PPC_7455: /* Kate Feng */
- case PPC_7457:
- if ( altivec_vector_is_valid(vector) )
- return 1;
- /* else fall thru */
- case PPC_604:
- case PPC_604e:
- case PPC_604r:
- if (!mpc604_vector_is_valid(vector)) {
- return 0;
- }
- break;
- case PPC_603:
- case PPC_603e:
- case PPC_603le:
- case PPC_603ev:
- case PPC_8260:
- /* case PPC_8240: -- same value as 8260 */
- case PPC_8245:
- if (!mpc603_vector_is_valid(vector)) {
- return 0;
- }
- break;
- case PPC_PSIM:
- if (!PSIM_vector_is_valid(vector)) {
- return 0;
- }
- break;
- default:
- printk("Please complete "
- "libcpu/powerpc/mpc6xx/exceptions/raw_exception.c\n"
- "current_ppc_cpu = %x\n", current_ppc_cpu);
- return 0;
- }
- return 1;
-}
-
-int mpc60x_set_exception (const rtems_raw_except_connect_data* except)
-{
- rtems_interrupt_level level;
-
- if (!mpc60x_vector_is_valid(except->exceptIndex)) {
- printk("mpc60x_set_exception: vector %d is not valid\n",
- except->exceptIndex);
- return 0;
- }
- /*
- * Check if default handler is actually connected. If not issue an error.
- * You must first get the current handler via mpc60x_get_current_exception
- * and then disconnect it using mpc60x_delete_exception.
- * RATIONALE : to always have the same transition by forcing the user
- * to get the previous handler before accepting to disconnect.
- */
-
- if (memcmp(mpc60x_get_vector_addr(except->exceptIndex),
- (void*)default_raw_except_entry.hdl.raw_hdl,
- default_raw_except_entry.hdl.raw_hdl_size)) {
- printk("mpc60x_set_exception: raw vector not installed\n");
- return 0;
- }
-
- rtems_interrupt_disable(level);
-
- raw_except_table [except->exceptIndex] = *except;
- codemove((void*)mpc60x_get_vector_addr(except->exceptIndex),
- except->hdl.raw_hdl,
- except->hdl.raw_hdl_size,
- PPC_CACHE_ALIGNMENT);
- except->on(except);
-
- rtems_interrupt_enable(level);
- return 1;
-}
-
-int mpc60x_get_current_exception (rtems_raw_except_connect_data* except)
-{
- if (!mpc60x_vector_is_valid(except->exceptIndex)){
- return 0;
- }
-
- *except = raw_except_table [except->exceptIndex];
-
- return 1;
-}
-
-int mpc60x_delete_exception (const rtems_raw_except_connect_data* except)
-{
- rtems_interrupt_level level;
-
- if (!mpc60x_vector_is_valid(except->exceptIndex)){
- return 0;
- }
- /*
- * Check if handler passed is actually connected. If not issue an error.
- * You must first get the current handler via mpc60x_get_current_exception
- * and then disconnect it using mpc60x_delete_exception.
- * RATIONALE : to always have the same transition by forcing the user
- * to get the previous handler before accepting to disconnect.
- */
- if (memcmp(mpc60x_get_vector_addr(except->exceptIndex),
- (void*)except->hdl.raw_hdl,
- except->hdl.raw_hdl_size)) {
- return 0;
- }
- rtems_interrupt_disable(level);
-
- except->off(except);
- codemove((void*)mpc60x_get_vector_addr(except->exceptIndex),
- default_raw_except_entry.hdl.raw_hdl,
- default_raw_except_entry.hdl.raw_hdl_size,
- PPC_CACHE_ALIGNMENT);
-
-
- raw_except_table[except->exceptIndex] = default_raw_except_entry;
- raw_except_table[except->exceptIndex].exceptIndex = except->exceptIndex;
-
- rtems_interrupt_enable(level);
-
- return 1;
-}
-
-/*
- * Exception global init.
- */
-int mpc60x_init_exceptions (rtems_raw_except_global_settings* config)
-{
- int i;
- rtems_interrupt_level level;
-
- /*
- * store various accelerators
- */
- raw_except_table = config->rawExceptHdlTbl;
- local_settings = config;
- default_raw_except_entry = config->defaultRawEntry;
-
- rtems_interrupt_disable(level);
-
- for (i=0; i <= LAST_VALID_EXC; i++) {
- if (!mpc60x_vector_is_valid(i)){
- continue;
- }
- codemove((void*)mpc60x_get_vector_addr(i),
- raw_except_table[i].hdl.raw_hdl,
- raw_except_table[i].hdl.raw_hdl_size,
- PPC_CACHE_ALIGNMENT);
- if (raw_except_table[i].hdl.raw_hdl != default_raw_except_entry.hdl.raw_hdl) {
- raw_except_table[i].on(&raw_except_table[i]);
- }
- else {
- raw_except_table[i].off(&raw_except_table[i]);
- }
- }
- rtems_interrupt_enable(level);
-
- return 1;
-}
-
-int mpc60x_get_exception_config (rtems_raw_except_global_settings** config)
-{
- *config = local_settings;
- return 1;
-}
diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h b/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h
deleted file mode 100644
index 5d84944101..0000000000
--- a/c/src/lib/libcpu/powerpc/mpc6xx/exceptions/raw_exception.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * raw_execption.h
- *
- * This file contains implementation of C function to
- * Instantiate 60x ppc primary exception entries.
- * More detailed information can be found on motorola
- * site and more precisely in the following book :
- *
- * MPC750
- * Risc Microporcessor User's Manual
- * Mtorola REF : MPC750UM/AD 8/97
- *
- * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr)
- * Canon Centre Recherche France.
- *
- * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
- * 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.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#ifndef _LIBCPU_RAW_EXCEPTION_H
-#define _LIBCPU_RAW_EXCEPTION_H
-
-/*
- * Exception Vectors as defined in the MCP750 manual
- */
-
-#define ASM_RESET_VECTOR 0x01
-#define ASM_MACH_VECTOR 0x02
-#define ASM_PROT_VECTOR 0x03
-#define ASM_ISI_VECTOR 0x04
-#define ASM_EXT_VECTOR 0x05
-#define ASM_ALIGN_VECTOR 0x06
-#define ASM_PROG_VECTOR 0x07
-#define ASM_FLOAT_VECTOR 0x08
-#define ASM_DEC_VECTOR 0x09
-/* Bummer: Altivec unavailable doesn't fit into this scheme... (0xf20).
- * We'd like to avoid reserved vectors but OTOH we don't want to use
- * just an available high number because tables (and copies) are of
- * size LAST_VALID_EXC.
- * So until there is a CPU that uses 0xA we'll just use that :-(
- */
-#define ASM_VEC_VECTOR 0x0A
-#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_VEC_ASSIST_VECTOR 0x16
-#define ASM_ITM_VECTOR 0x17
-#define LAST_VALID_EXC ASM_ITM_VECTOR
-
-/*
- * Vector offsets as defined in the MCP750 manual
- */
-
-#define ASM_RESET_VECTOR_OFFSET (ASM_RESET_VECTOR << 8)
-#define ASM_MACH_VECTOR_OFFSET (ASM_MACH_VECTOR << 8)
-#define ASM_PROT_VECTOR_OFFSET (ASM_PROT_VECTOR << 8)
-#define ASM_ISI_VECTOR_OFFSET (ASM_ISI_VECTOR << 8)
-#define ASM_EXT_VECTOR_OFFSET (ASM_EXT_VECTOR << 8)
-#define ASM_ALIGN_VECTOR_OFFSET (ASM_ALIGN_VECTOR << 8)
-#define ASM_PROG_VECTOR_OFFSET (ASM_PROG_VECTOR << 8)
-#define ASM_FLOAT_VECTOR_OFFSET (ASM_FLOAT_VECTOR << 8)
-#define ASM_DEC_VECTOR_OFFSET (ASM_DEC_VECTOR << 8)
-#define ASM_SYS_VECTOR_OFFSET (ASM_SYS_VECTOR << 8)
-#define ASM_TRACE_VECTOR_OFFSET (ASM_TRACE_VECTOR << 8)
-#define ASM_PERFMON_VECTOR_OFFSET (ASM_PERFMON_VECTOR << 8)
-#define ASM_VEC_VECTOR_OFFSET (0xf20)
-#define ASM_ADDR_VECTOR_OFFSET (ASM_ADDR_VECTOR << 8)
-#define ASM_SYSMGMT_VECTOR_OFFSET (ASM_SYSMGMT_VECTOR << 8)
-#define ASM_VEC_ASSIST_VECTOR_OFFSET (ASM_VEC_ASSIST_VECTOR << 8)
-#define ASM_ITM_VECTOR_OFFSET (ASM_ITM_VECTOR << 8)
-
-
-#ifndef ASM
-
-/*
- * Type definition for raw exceptions.
- */
-
-typedef unsigned char rtems_vector;
-struct __rtems_raw_except_connect_data__;
-typedef void (*rtems_raw_except_func) (void);
-typedef unsigned char rtems_raw_except_hdl_size;
-
-typedef struct {
- rtems_vector vector;
- rtems_raw_except_func raw_hdl;
- rtems_raw_except_hdl_size raw_hdl_size;
-}rtems_raw_except_hdl;
-
-typedef void (*rtems_raw_except_enable) (const struct __rtems_raw_except_connect_data__*);
-typedef void (*rtems_raw_except_disable) (const struct __rtems_raw_except_connect_data__*);
-typedef int (*rtems_raw_except_is_enabled) (const struct __rtems_raw_except_connect_data__*);
-
-typedef struct __rtems_raw_except_connect_data__{
- /*
- * Exception vector (As defined in the manual)
- */
- rtems_vector exceptIndex;
- /*
- * Exception raw handler. See comment on handler properties below in function prototype.
- */
- rtems_raw_except_hdl hdl;
- /*
- * function for enabling raw exceptions. In order to be consistent
- * with the fact that the raw connexion can defined in the
- * libcpu library, this library should have no knowledge of
- * board specific hardware to manage exceptions and thus the
- * "on" routine must enable the except at processor level only.
- *
- */
- rtems_raw_except_enable on;
- /*
- * function for disabling raw exceptions. In order to be consistent
- * with the fact that the raw connexion can defined in the
- * libcpu library, this library should have no knowledge of
- * board specific hardware to manage exceptions and thus the
- * "on" routine must disable the except both at device and PIC level.
- *
- */
- rtems_raw_except_disable off;
- /*
- * function enabling to know what exception may currently occur
- */
- rtems_raw_except_is_enabled isOn;
-}rtems_raw_except_connect_data;
-
-typedef struct {
- /*
- * size of all the table fields (*Tbl) described below.
- */
- unsigned int exceptSize;
- /*
- * Default handler used when disconnecting exceptions.
- */
- rtems_raw_except_connect_data defaultRawEntry;
- /*
- * Table containing initials/current value.
- */
- rtems_raw_except_connect_data* rawExceptHdlTbl;
-}rtems_raw_except_global_settings;
-
-/*
- * C callable function enabling to set up one raw idt entry
- */
-extern int mpc60x_set_exception (const rtems_raw_except_connect_data*);
-
-/*
- * C callable function enabling to get one current raw idt entry
- */
-extern int mpc60x_get_current_exception (rtems_raw_except_connect_data*);
-
-/*
- * C callable function enabling to remove one current raw idt entry
- */
-extern int mpc60x_delete_exception (const rtems_raw_except_connect_data*);
-
-/*
- * C callable function enabling to check if vector is valid
- */
-extern int mpc750_vector_is_valid(rtems_vector vector);
-
-/*
- * Exception global init.
- */
-extern int mpc60x_init_exceptions (rtems_raw_except_global_settings* config);
-extern int mpc60x_get_exception_config (rtems_raw_except_global_settings** config);
-
-# endif /* ASM */
-
-#endif