compilable release of virtex/gen83xx/gen5200 powerpc adaptations. Merged many different versions of new exception handling code to shared sources.

This commit is contained in:
Thomas Doerfler
2007-07-10 16:00:28 +00:00
parent 2c0f748a4e
commit f610e83f53
57 changed files with 9401 additions and 324 deletions

View File

@@ -1,3 +1,9 @@
2007-07-09 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* configure.ac, Makefile.am, mpc83xx/include/mpc83xx.h,
* mpc83xx/network/tsec.c, mpc83xx/network/tsec.h :
added support for MPC83xx controllers
2007-07-05 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* configure.ac, Makefile.am:

View File

@@ -324,5 +324,17 @@ mpc8260_timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc8260_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
if mpc83xx
include_mpc83xxdir = $(includedir)/mpc83xx
include_mpc83xx_HEADERS = mpc83xx/include/mpc83xx.h
include_mpc83xx_HEADERS += mpc83xx/network/tsec.h
## mpc83xx/network
noinst_PROGRAMS += mpc83xx/tsec.rel
mpc83xx_tsec_rel_SOURCES = mpc83xx/network/tsec.c
mpc83xx_tsec_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc83xx_tsec_rel_CPPFLAGS += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__ -D__BSD_VISIBLE
mpc83xx_tsec_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -45,12 +45,13 @@ AM_CONDITIONAL(shared, \
|| test "$RTEMS_CPU_MODEL" = "ppc405" \
|| test "$RTEMS_CPU_MODEL" = "mpc604" \
|| test "$RTEMS_CPU_MODEL" = "mpc6xx" \
|| test "$RTEMS_CPU_MODEL" = "mpc8xx" \
|| test "$RTEMS_CPU_MODEL" = "mpc821" \
|| test "$RTEMS_CPU_MODEL" = "mpc860" \
|| test "$RTEMS_CPU_MODEL" = "mpc8240" \
|| test "$RTEMS_CPU_MODEL" = "mpc8245" \
|| test "$RTEMS_CPU_MODEL" = "mpc8260" \
|| test "$RTEMS_CPU_MODEL" = "mpc8xx" )
|| test "$RTEMS_CPU_MODEL" = "mpc83xx" )
## test on CPU type
AM_CONDITIONAL(mpc505, test "$RTEMS_CPU_MODEL" = "mpc505")
@@ -63,11 +64,13 @@ AM_CONDITIONAL(mpc6xx, test "$RTEMS_CPU_MODEL" = "mpc6xx" \
|| test "$RTEMS_CPU_MODEL" = "mpc7457" \
|| test "$RTEMS_CPU_MODEL" = "mpc750" \
|| test "$RTEMS_CPU_MODEL" = "mpc8240" \
|| test "$RTEMS_CPU_MODEL" = "mpc8245" )
|| test "$RTEMS_CPU_MODEL" = "mpc8245" \
|| test "$RTEMS_CPU_MODEL" = "mpc83xx" )
AM_CONDITIONAL(mpc8xx, test "$RTEMS_CPU_MODEL" = "mpc8xx" \
|| test "$RTEMS_CPU_MODEL" = "mpc821" \
|| test "$RTEMS_CPU_MODEL" = "mpc860" )
AM_CONDITIONAL(mpc8260, test "$RTEMS_CPU_MODEL" = "mpc8260")
AM_CONDITIONAL(mpc83xx, test "$RTEMS_CPU_MODEL" = "mpc83xx")
# the ppc405 shares files with the ppc403
AM_CONDITIONAL(ppc403,[test "$RTEMS_CPU_MODEL" = "ppc403" \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
/*===============================================================*\
| Project: RTEMS support for MPC83xx |
+-----------------------------------------------------------------+
| Copyright (c) 2007 |
| Embedded Brains GmbH |
| Obere Lagerstr. 30 |
| D-82178 Puchheim |
| Germany |
| rtems@embedded-brains.de |
+-----------------------------------------------------------------+
| The license and distribution terms for this file may be |
| found in the file LICENSE in this distribution or at |
| |
| http://www.rtems.com/license/LICENSE. |
| |
+-----------------------------------------------------------------+
| this file declares the MPC83xx TSEC networking driver |
\*===============================================================*/
#include <rtems/rtems_bsdnet.h>
/*=========================================================================*\
| Function: |
\*-------------------------------------------------------------------------*/
int mpc83xx_tsec_mdio_read
(
/*-------------------------------------------------------------------------*\
| Purpose: |
| read register of a phy |
+---------------------------------------------------------------------------+
| Input Parameters: |
\*-------------------------------------------------------------------------*/
int phy, /* PHY number to access or -1 */
void *uarg, /* unit argument */
unsigned reg, /* register address */
uint32_t *pval /* ptr to read buffer */
);
/*-------------------------------------------------------------------------*\
| Return Value: |
| 0, if ok, -1 if failed |
\*=========================================================================*/
/*=========================================================================*\
| Function: |
\*-------------------------------------------------------------------------*/
int mpc83xx_tsec_mdio_write
(
/*-------------------------------------------------------------------------*\
| Purpose: |
| write register of a phy |
+---------------------------------------------------------------------------+
| Input Parameters: |
\*-------------------------------------------------------------------------*/
int phy, /* PHY number to access or -1 */
void *uarg, /* unit argument */
unsigned reg, /* register address */
uint32_t val /* write value */
);
/*-------------------------------------------------------------------------*\
| Return Value: |
| 0, if ok, -1 if failed |
\*=========================================================================*/
/*=========================================================================*\
| Function: |
\*-------------------------------------------------------------------------*/
int rtems_mpc83xx_tsec_driver_attach_detach
(
/*-------------------------------------------------------------------------*\
| Purpose: |
| attach or detach the driver |
+---------------------------------------------------------------------------+
| Input Parameters: |
\*-------------------------------------------------------------------------*/
struct rtems_bsdnet_ifconfig *config, /* interface configuration */
int attaching /* 0 = detach, else attach */
);
/*-------------------------------------------------------------------------*\
| Return Value: |
| 1, if success |
\*=========================================================================*/

View File

@@ -192,3 +192,17 @@ $(PROJECT_INCLUDE)/mpc8260/mmu.h: mpc8260/include/mmu.h $(PROJECT_INCLUDE)/mpc82
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc8260/mmu.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc8260/mmu.h
endif
if mpc83xx
$(PROJECT_INCLUDE)/mpc83xx/$(dirstamp):
@$(MKDIR_P) $(PROJECT_INCLUDE)/mpc83xx
@: > $(PROJECT_INCLUDE)/mpc83xx/$(dirstamp)
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/mpc83xx/$(dirstamp)
$(PROJECT_INCLUDE)/mpc83xx/mpc83xx.h: mpc83xx/include/mpc83xx.h $(PROJECT_INCLUDE)/mpc83xx/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc83xx/mpc83xx.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc83xx/mpc83xx.h
$(PROJECT_INCLUDE)/mpc83xx/tsec.h: mpc83xx/network/tsec.h $(PROJECT_INCLUDE)/mpc83xx/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mpc83xx/tsec.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc83xx/tsec.h
endif

View File

@@ -40,6 +40,9 @@ typedef enum
PPC_8240 = PPC_8260,
PPC_8245 = 0x8081,
PPC_603le = 0x8082, /* 603le core, in MGT5100 and MPC5200 */
PPC_e300c1 = 0x8083, /* e300c1 core, in MPC83xx*/
PPC_e300c2 = 0x8084, /* e300c2 core */
PPC_e300c3 = 0x8085, /* e300c3 core */
PPC_PSIM = 0xfffe, /* GDB PowerPC simulator -- fake version */
PPC_UNKNOWN = 0xffff
} ppc_cpu_id_t;

View File

@@ -8,7 +8,7 @@
#include <rtems.h>
#include "cache_.h"
#include <rtems/powerpc/registers.h>
/*
* CACHE MANAGER: The following functions are CPU-specific.
@@ -19,7 +19,7 @@
* FIXME: Some functions simply have not been implemented.
*/
#if defined(ppc603) || defined(mpc8260) /* And possibly others */
#if defined(ppc603) || defined(ppc603e) || defined(mpc8260) /* And possibly others */
/* Helpful macros */
#define PPC_Get_HID0( _value ) \
@@ -49,7 +49,7 @@ void _CPU_cache_enable_data (
{
uint32_t value;
PPC_Get_HID0( value );
value |= 0x00004000; /* set DCE bit */
value |= HID0_DCE; /* set DCE bit */
PPC_Set_HID0( value );
}
@@ -58,10 +58,61 @@ void _CPU_cache_disable_data (
{
uint32_t value;
PPC_Get_HID0( value );
value &= 0xFFFFBFFF; /* clear DCE bit */
value &= ~HID0_DCE; /* clear DCE bit */
PPC_Set_HID0( value );
}
void _CPU_cache_invalidate_1_data_line(
const void * _address )
{
register const void *__address = _address;
asm volatile ( "dcbi 0,%0" :: "r"(__address) : "memory" );
}
void _CPU_cache_invalidate_entire_data (
void )
{
uint32_t value;
PPC_Get_HID0( value );
value |= HID0_DCI; /* set data flash invalidate bit */
PPC_Set_HID0( value );
value &= ~HID0_DCI; /* clear data flash invalidate bit */
PPC_Set_HID0( value );
}
void _CPU_cache_freeze_data (
void )
{
uint32_t value;
PPC_Get_HID0( value );
value |= HID0_DLOCK; /* set data cache lock bit */
PPC_Set_HID0( value );
}
void _CPU_cache_unfreeze_data (
void )
{
uint32_t value;
PPC_Get_HID0( value );
value &= ~HID0_DLOCK; /* set data cache lock bit */
PPC_Set_HID0( value );
}
void _CPU_cache_flush_1_data_line(
const void * _address )
{
register const void *__address = _address;
asm volatile ( "dcbf 0,%0" :: "r" (__address) : "memory" );
}
void _CPU_cache_flush_entire_data (
void )
{
/*
* FIXME: how can we do this?
*/
}
void _CPU_cache_enable_instruction (
void )
{
@@ -80,6 +131,42 @@ void _CPU_cache_disable_instruction (
PPC_Set_HID0( value );
}
void _CPU_cache_invalidate_1_instruction_line(
const void * _address )
{
register const void *__address = _address;
asm volatile ( "icbi 0,%0" :: "r" (__address) : "memory");
}
void _CPU_cache_invalidate_entire_instruction (
void )
{
uint32_t value;
PPC_Get_HID0( value );
value |= HID0_ICFI; /* set data flash invalidate bit */
PPC_Set_HID0( value );
value &= ~HID0_ICFI; /* clear data flash invalidate bit */
PPC_Set_HID0( value );
}
void _CPU_cache_freeze_instruction (
void )
{
uint32_t value;
PPC_Get_HID0( value );
value |= HID0_ILOCK; /* set instruction cache lock bit */
PPC_Set_HID0( value );
}
void _CPU_cache_unfreeze_instruction (
void )
{
uint32_t value;
PPC_Get_HID0( value );
value &= ~HID0_ILOCK; /* set instruction cache lock bit */
PPC_Set_HID0( value );
}
#elif ( defined(mpx8xx) || defined(mpc860) || defined(mpc821) )
#define mtspr(_spr,_reg) \

View File

@@ -4,6 +4,11 @@
#ifndef __POWERPC_CACHE_h
#define __POWERPC_CACHE_h
/*
* get definitions from the score/powerpc header
* about individual cache alignments
*/
#include <rtems/score/powerpc.h>
/*
* CACHE MANAGER: The following functions are CPU-specific.
@@ -14,17 +19,16 @@
* FIXME: Some functions simply have not been implemented.
*/
#if defined(ppc603) /* And possibly others */
#define CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
#define CPU_INSTRUCTION_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
#if defined(ppc603) || defined(ppc603e) || defined(mpc8260)
/* And possibly others */
#elif ( defined(mpc860) || defined(mpc821) )
#if defined(PPC_CACHE_ALIGNMENT)
#define CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
#define CPU_INSTRUCTION_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
#endif
#endif
#include <libcpu/cache.h>
#endif