original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,100 @@
/* _G_config.h - autogenerated on Tue Feb 3 10:11:41 PST 1998*/
/* There may be a few (VxWorks related) differences between this file and the
* corresponding one in host/$WIND_HOST_TYPE/arm-wrs-vxworks/include
*/
/* AUTOMATICALLY GENERATED; DO NOT EDIT! */
#ifndef _G_config_h
#define _G_config_h
#define _G_LIB_VERSION "2.8.0"
#define _G_NAMES_HAVE_UNDERSCORE 1
#define _G_VTABLE_LABEL_HAS_LENGTH 1
#define _G_VTABLE_LABEL_PREFIX "__vt$"
#define _G_HAVE_ST_BLKSIZE 1
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
typedef int _G_int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int _G_uint8_t __attribute__((__mode__(__QI__)));
typedef int _G_int16_t __attribute__((__mode__(__HI__)));
typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__)));
typedef int _G_int32_t __attribute__((__mode__(__SI__)));
typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__)));
typedef int _G_int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__)));
#if defined (__cplusplus)
__extension__ typedef long long _G_llong;
__extension__ typedef unsigned long long _G_ullong;
#else
typedef long long _G_llong;
typedef unsigned long long _G_ullong;
#endif
#else
typedef short /* deduced */ _G_int16_t;
typedef unsigned short /* deduced */ _G_uint16_t;
typedef long /* deduced */ _G_int32_t;
typedef unsigned long /* deduced */ _G_uint32_t;
#endif
typedef unsigned long _G_clock_t;
typedef short _G_dev_t;
typedef long _G_fpos_t;
typedef unsigned short _G_gid_t;
typedef unsigned short _G_ino_t;
typedef int _G_mode_t;
typedef unsigned short _G_nlink_t;
typedef long _G_off_t;
typedef int _G_pid_t;
#ifndef __PTRDIFF_TYPE__
#define __PTRDIFF_TYPE__ long int
#endif
typedef __PTRDIFF_TYPE__ _G_ptrdiff_t;
typedef unsigned long _G_sigset_t;
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ long unsigned int
#endif
typedef __SIZE_TYPE__ _G_size_t;
typedef long _G_time_t;
typedef unsigned short _G_uid_t;
typedef int _G_wchar_t;
#define _G_BUFSIZ 1024
#define _G_FOPEN_MAX 20
#define _G_FILENAME_MAX 1024
#if defined (__cplusplus) || defined (__STDC__)
#define _G_ARGS(ARGLIST) ARGLIST
#else
#define _G_ARGS(ARGLIST) ()
#endif
#if !defined (__GNUG__) || defined (__STRICT_ANSI__)
#define _G_NO_NRV
#endif
#if !defined (__GNUG__)
#define _G_NO_EXTERN_TEMPLATES
#endif
typedef int /* default */ _G_ssize_t;
typedef int /* default */ _G_wint_t;
typedef void * _G_va_list;
#define _G_signal_return_type void
#define _G_sprintf_return_type int
#define _G_HAVE_ATEXIT 0
#define _G_HAVE_SYS_RESOURCE 0
#define _G_HAVE_SYS_TIMES 1
#define _G_HAVE_SYS_SOCKET 0
#define _G_HAVE_SYS_CDEFS 0
#define _G_HAVE_SYS_WAIT 1
#define _G_HAVE_UNISTD 1
#define _G_HAVE_DIRENT 0
#define _G_HAVE_CURSES 0
#define _G_MATH_H_INLINES 0
#define _G_HAVE_BOOL 1
#define _G_HAVE_PRINTF_FP 0
#define _G_HAVE_LONG_DOUBLE_IO 0
#undef NULL
#ifdef __cplusplus
#define NULL __null
#else
#define NULL 0
#endif
#include <stddef.h>
#endif /* !_G_config_h */
+397
View File
@@ -0,0 +1,397 @@
/* archArm.h - ARM specific header */
/*
* Copyright (c) 1996, 1998, 1999, 2001, 2003-2011, 2013
* Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
02t,01jun13,yjw update for ARMARCH7M
02s,12aug11,jb WIND00238999 Limit Device Power Mgmt to ARMARCH7
02r,17nov10,dbr define _WRS_ARCH_HAS_DEV_PWR_MGMT for device power management
02q,16sep10,gls added VX_OBJ_ALIGN_SIZE
02p,29jul10,pad Moved extern C statement after include statements.
02o,27aug10,rlp Added _WRS_ARCH_HAS_VXDBG_BP_ADDR_CHECK macro.
02n,24aug10,jdw Fix _WRS_REV_INSN_SET_CHANGE for Thumb2
02m,09jun10,m_h Thumb-2 Support
02l,10mar10,j_b define _WRS_PHYS_ADDR_IS_64_BITS for XScale, ARMv6+
(WIND00129408)
02k,20oct09,z_l add SMP support for ARMARCH7
02j,25feb09,j_b merge ARM SMP support, incl adding VSB header file:
22feb08,j_b replace intUnlock with intCpuUnlock
12nov07,jmp Define _WRS_ARCH_HAS_VXDBG_CPU_CTRL_SUPPORT
02nov07,jb Add coherency flag for SMP and build exclusions
10oct07,j_b define _WRS_ARCH_HAS_DBG_IPI
02i,27feb09,m_h ARMARCH7 Support
02h,31jul08,tcr change macro for compatibility
02g,19may08,tcr update SV instrumentation
02f,16aug07,j_b added _WRS_MMU_HAS_MAP_STATE_API
02e,08jun07,j_b Add definition for _WRS_VX_NO_GLOBAL_ERRNO
02d,21may07,j_b define _WRS_ARCH_HAS_IDLE_TASK, VX_MAX_SMP_CPUS
02c,04may07,zl updated portable library build configuration,
added _WRS_CPU_HAS_CLZ_INSTR.
02b,21feb07,jmg Added include vxPortableP.h
02a,11dec06,kk removed references to _WRS_BASE6_SCHEDULER, no longer needed
01z,21jun06,jb Re-enable fast ffs for arch5, make ARMARCH6 64 bit PHYS_ADDR
01y,02mar06,jb Fix for SPR 118321 - vfp references in 920t
01x,01feb06,jb Adding VFP Support
01w,12jan06,jb Enabling 920t variant support
01v,10jan06,hya Add ARM CPU variant code for FFS(x) (WRN)
01u,19dec05,jb Changing XSCALE to 64 bit PHYS_ADDR
01t,24aug05,h_k Added _WRS_SUPPORT_CACHE_XLATE.
01s,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486)
01r,28mar05,scm add _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK
01q,18feb05,dbt Moved some loader specific macros to elfArm.h.
01p,17feb05,scm add _WRS_OSM_INIT definition, and clarify
PORTABLE/NON-PORTABLE inclussion
01o,17jan05,jb Adding architecture specific objVerify support
01n,08sep04,scm move INSTR to archArmCommon.h
01m,10aug04,scm undef "OPTIMIZE", define "PORTABLE"...
01l,27apr04,cjj Defined workQLib_PORTABLE
01k,01dec03,scm clean up, SPR #90358... remove obnoxious warning...
01j,25nov03,pes Move setting of _BYTE_ORDER macro into archArmCommon.h
01i,14nov03,job Moved some blib stuff to archArmCommon.h
01h,13nov03,pes Add include of archArmCommon.h
01h,29oct03,sn gcc 3.3.2 does not currently support arm or sh
01g,27aug03,to added defines for semLib.
01f,07may03,pes PAL conditional compilation cleanup. Phase 2.
01e,29apr03,pes PAL conditional compilation cleanup.
01d,13mar01,sn SPR 73723 - define supported toolchains
01c,20jan99,cdp removed support for old ARM libraries.
01b,17aug98,cdp added big-endian and multiple cachelib support.
01a,08may96,cdp written based on archI86.h
*/
#ifndef __INCarchArmh
#define __INCarchArmh
#include <vsbConfig.h>
/* In the cases where vxWorks.h is not defined first... */
#if !defined (TRUE)
#define TRUE 1
#endif
#if !defined (FALSE)
#define FALSE 0
#endif
#undef _ARCH_SUPPORTS_GCC
#define _ARCH_SUPPORTS_DCC
/* define to indicate ARM supports device power management */
#if (CPU==ARMARCH7) || (CPU==ARMARCH7_T2)
#define _WRS_ARCH_HAS_DEV_PWR_MGMT
#endif /* (CPU==ARMARCH7) || (CPU==ARMARCH7_T2) */
/* temporary macro to indicate ARM uses the idle task stack */
#define _WRS_ARCH_HAS_IDLE_TASK
/* temporary define to indicate ARM uses task-specific errnos */
#define _WRS_VX_NO_GLOBAL_ERRNO
/* temporary define to indicate ARM supports MMU state info with map request */
#define _WRS_MMU_HAS_MAP_STATE_API
/* temporary macro to indicate ARM has Debug IPI */
#define _WRS_ARCH_HAS_DBG_IPI
/* indicates that ARM has VxDBG CPU control support */
#define _WRS_ARCH_HAS_VXDBG_CPU_CTRL_SUPPORT
/*
* Indicate that the ARM architecture has the VxDBG support to check the
* alignment of the breakpoint address.
*/
#define _WRS_ARCH_HAS_VXDBG_BP_ADDR_CHECK
#undef VX_MAX_SMP_CPUS
#define VX_MAX_SMP_CPUS 4 /* maximum processors in SMP configuration */
/*
* For SMP, any shared data region that is created from the RAM need
* to be memory coherent.
* So we need to set the page attribute to MMU_ATTR_CACHE_COHERENCY.
* The arches, need to specify this via the macro
* VM_DEFAULT_CACHE_COHERENCY_ATTR
*/
#ifdef _WRS_CONFIG_SMP
/* Limit SMP build to ARMARCH6 and ARMARCH7 little endian */
#if ((CPU == ARMARCH6) || (CPU == ARMARCH7)) && !defined(ARMEB) && !defined(__ARMEB__)
#define VM_DEFAULT_CACHE_COHERENCY_ATTR MMU_ATTR_CACHE_COHERENCY
#else
#error SMP build is NOT supported by this architecture/tool combination
#endif /* (CPU == ARMARCH6) && !defined(ARMEB) && !defined(__ARMEB__) */
#endif /* _WRS_CONFIG_SMP */
#define _DYNAMIC_BUS_SIZING FALSE /* require alignment for swap */
#define _ARCH_MULTIPLE_CACHELIB TRUE /* multiple cache libraries */
/* macros for AIM Cache */
#define _WRS_SUPPORT_CACHE_XLATE /* cache virt-phys translate */
#if !defined(ARMCPU920T)
/* Say VFP is Supported */
#define _WRS_HW_VFP_SUPPORT
#endif /* !defined(ARMCPU920T) */
#ifdef __cplusplus
extern "C" {
#endif
#if ((CPU == XSCALE) || (CPU == ARMARCH6) || (CPU == ARMARCH7) \
|| (CPU == ARMARCH7_T2))
/* physical addresses are represented with 64 bits for these CPUs */
#define _TYPE_PHYS_ADDR typedef UINT64 PHYS_ADDR
#define _WRS_PHYS_ADDR_IS_64_BITS
#endif /* ((CPU == XSCALE, ARMARCH6, ARMARCH7, ARMARCH7_T2)) */
#ifdef __cplusplus
}
#endif
#include "arm.h"
#ifdef __cplusplus
extern "C" {
#endif
/* PAL additions */
/*
* VX_OBJ_ALIGN_SIZE is the default allocation boundary for kernel objects.
* This is used for both statically and dynamically allocated objects.
*/
#define VX_OBJ_ALIGN_SIZE 8 /* 8-byte alignment */
/* moved here from h/private/eventP.h */
/*
* (Borrowed from PPC.)
*
* Macro for event logging of intEnt events for ARM architectures.
* The ARM architecture is different in that there is only one external
* interrupt line coming into the CPU. At the time of the intEnt, the
* external interrupt number is unknown, meaning that logging cannot
* take place at this time. In this architecture, the logging of an
* intEnt event is deferred until the interrupt controller driver
* is executed.
* Since the logging has to take place in drivers and/or BSP world files,
* the details of how the logging to be done has been deferred to a macro
* which is defined here.
*
* Note: This replaces the previous technique of saving the timestamp
* during the intEnt code to be used later, when the logging was done.
* SPR 21868 refers to a problem in which this can give rise to out-of-order
* timestamps in the event log.
*/
#define WV_EVT_INT_ENT(intNum) EVT_CTX_1(EVENT_INT_ENTER, intNum);
/* moved here from h/private/classLibP.h */
#define OBJ_CLASS_initRtn 0x24 /* Offsets into OBJ_CLASS */
/* status codes */
#define S_vmLib_NO_FREE_REGIONS (M_vmLib | 6)
#define S_vmLib_ADDRS_NOT_EQUAL (M_vmLib | 7)
/* from dbgLib.c */
#define _WRS_FRAME_PRINT_STRING " : "
/* from loadElfLib.c */
#define _WRS_USE_ELF_LOAD_FORMAT
/* from periodHost.c, repeatHost.c, shell.c, and taskLib.c */
#if (ARM_THUMB) || (ARM_THUMB2)
#define _WRS_CHANGE_INSN_SET_ENABLE
#define _WRS_CHANGE_INSN_SET(p) (p) = ((FUNCPTR)(((UINT32)(p))|1))
#define _WRS_CHANGE_INSN_SET_PTR(p) ((FUNCPTR)(((UINT32)(p))|1))
#define _WRS_REV_INSN_SET_CHANGE(p) ((FUNCPTR)(((UINT32)(p)) & ~1))
#endif /* ARM_THUMB || (ARM_THUMB2) */
/* OSM support for stack protection, used in sysOsmLib.c */
#define _WRS_OSM_INIT
/* Interrupt stack protection, used in usrDepend.c and usrKernelStack.c */
#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK
/*
* if OSM support not available for stack protection,
* then support can not be available for interrupt
* stack protection.
*/
#if !defined(_WRS_OSM_INIT)
#undef _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK
#endif
#if defined(_ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK)
#undef _WRS_SVC_INT_STACK
#undef _WRS_IRQ_INT_STACK
#undef _WRS_DUAL_INT_STACK
#undef _WRS_SPLIT_STACKS
#else
/*
* Old split interrupt stack method...,
* not used when OSM stack protection is
* enabled...
*/
/* from usrLib.c */
#define _WRS_SVC_INT_STACK
#define _WRS_IRQ_INT_STACK
#define _WRS_DUAL_INT_STACK
/* from kernelLib.c */
/*
* The ARM family uses 3 interrupt stacks. The ratio of the sizes of
* these stacks is dependent on the interrupt structure of the board
* and so is handled in the BSP code. Note that FIQ is now external to
* VxWorks.
*/
#define _WRS_SPLIT_STACKS {if (_func_armIntStackSplit != NULL) \
(_func_armIntStackSplit)(vxIntStackBase, intStackSize);}
#endif /* _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK */
/* from xdr_float.c */
#define FLOAT_NORM
/* Set to force the use of the big-endian call to XDR_GETLONG() */
#define _WRS_XDR_FORCE_BE
#define _WRS_ENABLE_IDLE_INTS {intCpuUnlock(0);}
/* macros for getting frame and return PC from a jmp_buf */
#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_sp)
#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc)
#ifdef __cplusplus
}
#endif
#include <arch/arm/archArmCommon.h>
#ifdef __cplusplus
extern "C" {
#endif
/* variants that support the clz instruction, "count leading zeroes" */
#if ((CPU == XSCALE) || (CPU == ARMARCH6) || (CPU == ARMARCH5) \
|| (CPU == ARMARCH7) || (CPU == ARMARCH7_T2) || (CPU == ARMARCH7M))
#define _WRS_CPU_HAS_CLZ_INSTR
#endif /* CPU = XSCALE ... ARMARCH7_T2 */
#ifndef _ASMLANGUAGE
#ifdef _WRS_CPU_HAS_CLZ_INSTR
/* optimize FFS(x) in network code for CPUs supporting clz instruction */
#undef FFS
#define FFS(x) (31 - _countLeadingZeroes(x))
#if defined (__GNUC__)
/*
* Return the number of zero bits in bit positions more significant
* than the first set bit.
* We don't have to handle the x=0 case, this is only called
* when x != 0. Returns a value y in the range 31 >= y >= 0.
* 0 indicates the most significant bit.
*/
static __inline__ unsigned int _countLeadingZeroes
(
unsigned int x
)
{
unsigned int y;
__asm__ ("clz %0, %1"
: "=r" (y)
: "r" (x)
);
return y;
}
#elif defined (_DIAB_TOOL)
#pragma pure_function _countLeadingZeroes
__asm unsigned int _countLeadingZeroes
(
unsigned int x
)
{
% reg x
! "r0"
clz r0, x
}
#else /* !_DIAB_TOOL */
/* Unknown compiler, use default */
#undef FFS
#define FFS(x) (ffsMsb(x) - 1)
#endif /* _DIAB_TOOL */
#else /* _WRS_CPU_HAS_CLZ_INSTR */
/* use default */
#undef FFS
#define FFS(x) (ffsMsb(x) - 1)
#endif /* _WRS_CPU_HAS_CLZ_INSTR */
#endif /* ! _ASMLANGUAGE */
/* End PAL */
#ifdef __cplusplus
}
#endif
#endif /* __INCarchArmh */
@@ -0,0 +1,82 @@
/* archArmCommon.h - common Arm architecture specific header */
/*
* Copyright (c) 2003-2004, 2006-2007, 2010, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01l,21mar12,jpb Updated for POSIX namespace isolation conformance (part of
defect Defect WIND000307800).
01k,22jul10,jdw Update size of INSTR for Thumb2
01j,09jun10,fao add SWAP32_BE8 and SWAP16_BE8 macro.
01i,04may07,zl updated portable library build configuration.
01h,02feb06,mil Updated for POSIX namespace conformance.
01g,08sep04,scm move INSTR from archArm.h
01e,25aug04,scm move to portable trcLib...
01d,03aug04,scm Enable Coprocessor Abstraction, disable Portable trcLib.
01c,25nov03,pes Move setting of _BYTE_ORDER macro into archArmCommon.h
01b,12nov03,job Moved some blib stuff from archArm.h
01a,11nov03,pes written.
*/
#ifndef __INCarchArmCommonh
#define __INCarchArmCommonh
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ARMEB) || defined(__ARMEB__)
#define _BYTE_ORDER _BIG_ENDIAN
#else
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#ifndef _ASMLANGUAGE
#if ((ARM_THUMB) || (ARM_THUMB2))
typedef unsigned short _Vx_INSTR; /* 16 bit instructions */
#else /* ((ARM_THUMB) || (ARM_THUMB2)) */
typedef unsigned long _Vx_INSTR; /* 32 bit word-aligned instructions */
#endif /* ((ARM_THUMB) || (ARM_THUMB2)) */
#endif /* !_ASMLANGUAGE */
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && \
!defined(_POSIX_AEP_RT_CONTROLLER_C_SOURCE)
#ifdef ARMBE8
#define SWAP32_BE8(x) ((((x) & 0x000000ff) << 24) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x00ff0000) >> 8) | \
(((x)) >> 24))
#define SWAP16_BE8(x) ((((x) & 0x00ff0000) >> 8) | \
(((x)) >> 24))
#else
#define SWAP32_BE8(x) x
#define SWAP16_BE8(x) x
#endif /* ARMBE8 */
/* from bLib.c */
#define _WRS_BLIB_ALIGNMENT 3 /* quad byte alignment mask */
#define _WRS_IMPROVED_PORTABLE_SWAB
/* Enable Coprocessor Abstraction. Must do all or none. */
#define _WRS_PAL_COPROC_LIB
#ifndef _ASMLANGUAGE
typedef _Vx_INSTR INSTR;
#endif /* !_ASMLANGUAGE */
#endif /* !_POSIX_xxx_SOURCE */
#ifdef __cplusplus
}
#endif
#endif /* __INCarchArmCommonh */
+284
View File
@@ -0,0 +1,284 @@
/* arm-m.h - ARM CPU registers and flags for ARM-M architecture */
/*
* Copyright (c) 2012-2013 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01f,01aug13,yjw add cache support
01e,03aug12,jdw Add boot macro _WRS_ARM_BOOT_THUMB2
01d,06jun12,j_b add core control registers and initialization values
01c,29may12,j_b add control and configuration registers
01b,24may12,m_h Add CPUID address
01a,03feb12,jdw Created
*/
#ifndef __INCarm_mh
#define __INCarm_mh
#ifndef _ASMLANGUAGE
extern int cacheArchAlignSize;
#endif /* _ASMLANGUAGE */
#undef _CACHE_ALIGN_SIZE
#define _CACHE_ALIGN_SIZE cacheArchAlignSize
/* Define Arch features which are supported by ARM-M */
/* ARM-M only operates in Thumb2 mode */
#define ARM_THUMB2 TRUE
#define PORTABLE
/* multiple cache libraries */
#define _ARCH_MULTIPLE_CACHELIB TRUE
/* ARMv7-M support exclusive load/store */
#define ARM_HAS_LDREX_STREX TRUE
#define ARM_HAS_HALFWORD_INSTRUCTIONS TRUE
/* MPU is optional on some ARM-M cores */
#define ARM_HAS_NO_MMU TRUE
/* ARM-M always boots in Thumb2 mode */
#define _WRS_ARM_BOOT_THUMB2 TRUE
#define _WRS_ARCH_HAS_CPU_PWR_MGMT
/* bits in the PSR */
#define Q_BIT (1<<27)
#define V_BIT (1<<28)
#define C_BIT (1<<29)
#define Z_BIT (1<<30)
#define N_BIT (1<<31)
#define T_BIT (1<<24)
/*
* On entry to an exception the processor will use xPSR bit 9
* to indicate if the SP has been aligned to an 8-byte boundary
*/
#define PSR_STK_ALIGN (1<<9)
/* masks for getting bits from PSR */
#define MASK_EXC_NUM 0x000001FF
#define MASK_ICIIT 0x0600FC00
#define MASK_GE 0x000F0000
#define MASK_T 0x01000000
#define MASK_CC 0xF8000000
/* PRIMASK, FAULTMASK, & BASEMASK fields */
#define PRIMASK_PM 0x00000001
#define FAULTMASK_FM 0x00000001
#define MASK_BASEPRI 0x000000FF
/* Bits in EXC_RETURN */
#define EXC_RTN_BASE 0xFFFFFFF1
#define EXC_RTN_MODE_THREAD 0x00000008
#define EXC_RTN_MODE_HANDLER 0x00000000
#define EXC_RTN_STACK_PROCESS 0x00000004
#define EXC_RTN_STACK_MAIN 0x00000000
#define MASK_EXC_RTN_MODE 0x00000008
#define MASK_EXC_RTN_STACK 0x00000004
/*
* System Control Block Registers
*/
/* CPU ID Base Register */
#define CORTEXM_CPUID_BASE_REGISTER (0xE000ED00)
/* Interrupt Controller Type Register */
#define CORTEXM_ICTR (0xE000E004)
#define CORTEXM_ICTR_INTNUM_MASK (0xF) /* # of interrupt lines field */
#define CORTEXM_ICTR_INTNUM_MAX (0xF) /* # of interrupt lines field max */
/* Auxiliary Control Register - usage is implementation-defined/core-specific */
#define CORTEXM_ACTLR (0xE000E008)
/* Interrupt Controller State Register */
#define CORTEXM_ICSR (0xE000ED04)
/* Vector Table Offset Register */
#define CORTEXM_VTOR (0xE000ED08)
#define CORTEXM_VTOR_MASK (0xFFFFFF80) /* reserved bits 6:0 */
/*
* Application Interrupt and Reset Control Register
*
* Note that the proper access key must be included in a write to this
* regsiter or the write is ignored.
*/
#define CORTEXM_AIRCR (0xE000ED0C)
#define CORTEXM_AIRCR_VECTKEY 0x05FA0000 /* Access Key for writes */
#define CORTEXM_AIRCR_VECTKEY_MASK 0xFFFF0000 /* (0xFA05 is the read value) */
#define CORTEXM_AIRCR_PRIGROUP_SHIFT 8 /* Priority Group */
#define CORTEXM_AIRCR_PRIGROUP_MASK (0x7 << CORTEXM_AIRCR_PRIGROUP_SHIFT)
/* System Control and Register */
#define CORTEXM_SCR (0xE000ED10)
/* Configuration and Control Register */
#define CORTEXM_CCR (0xE000ED14)
#define CORTEXM_CCR_DIV0TRP (0x00000010) /* divide by zero trap enable */
#define CORTEXM_CCR_STKALIGN (0x00000200) /* 8-byte stacking align enable */
/*
* System Handler Priority Level Registers
* (aka System Exception Priority Level Registers)
*/
#define CORTEXM_SHPR1 (0xE000ED18) /* Pri lvl for Exceptions 4-7 */
#define CORTEXM_SHPR2 (0xE000ED1C) /* Pri lvl for Exceptions 8-11 */
#define CORTEXM_SHPR3 (0xE000ED20) /* Pri lvl for Exceptions 12-15 */
/*
* Note: SHPR actually starts with PRI_4. There is no such thing as PRI_0 but
* this makes the address calculation easier.
*/
#define CORTEXM_SHPR_PRI_0 (0xE000ED14)
#define CORTEXM_SHPR_PRI_15 (0xE000ED23)
#define CORTEXM_SHPR_PENDSV (CORTEXM_SHPR_PRI_14)
#define CORTEXM_SHPR_SYSTICK (CORTEXM_SHPR_PRI_15)
/* system priority register address, calculated by exception # (= offset) */
#define CORTEXM_SHPR_PRI_BYTE(n) (CORTEXM_SHPR_PRI_0 + (n))
/* System Handler Control and State Register */
#define CORTEXM_SHCSR (0xE000ED24)
#define CORTEXM_SHCSR_USGFLT_EN (0x00040000) /* Usage Fault Enable bit */
#define CORTEXM_SHCSR_BUSFLT_EN (0x00020000) /* Bus Fault Enable bit */
#define CORTEXM_SHCSR_MEMFLT_EN (0x00010000) /* Memory Mgt Fault Enable bit */
#define CORTEXM_SHCSR_SVC_PEND (0x00008000) /* SVCall Pending bit */
#define CORTEXM_SHCSR_BUSFLT_PEND (0x00004000) /* Bus Fault Pend bit */
#define CORTEXM_SHCSR_MEMFLT_PEND (0x00002000) /* Memory Mgt Pend bit */
#define CORTEXM_SHCSR_USGFLT_PEND (0x00001000) /* Usage Fault Pend bit */
#define CORTEXM_SHCSR_SYSTCK_ACT (0x00000800) /* SysTick Active bit */
#define CORTEXM_SHCSR_PENDSV_ACT (0x00000400) /* PendSV Active bit */
#define CORTEXM_SHCSR_DBGMON_ACT (0x00000100) /* Debug Monitor Active */
#define CORTEXM_SHCSR_SVC_ACT (0x00000080) /* SVCall Active */
#define CORTEXM_SHCSR_USGFLT_ACT (0x00000008) /* Usage Fault Active */
#define CORTEXM_SHCSR_BUSFLT_ACT (0x00000002) /* Usage Fault Active */
#define CORTEXM_SHCSR_MEMFLT_ACT (0x00000001) /* Usage Fault Active */
/* Debug Exception and Monitor Control Register */
#define CORTEXM_DEMCR (0xE000EDFC)
#define CORTEXM_DEMCR_MON_STEP (0x00040000)
#define CORTEXM_DEMCR_MON_PEND (0x00020000)
#define CORTEXM_DEMCR_MON_EN (0x00010000)
/* ROM table for debug */
#define CORTEXM_ROM_TABLE (0xE00FF000)
#define CORTEXM_ROM_TABLE_FPB_OFFSET (0x00000008)
#define CORTEXM_FPB_VALID (0xFFF03003)
/* FlashPatch Control Register */
#define CORTEXM_FP_CTRL (0xE0002000)
#define CORTEXM_FP_CTRL_ENABLE (3)
/* FlashPatch Comparatorregister */
#define CORTEXM_FP_COMP0 (0xE0002008)
/*
* Configurable Fault Status Register
* This register includes the:
* - 8-bit Memory Management Fault Status Register
* - 8-bit Bus Fault Status Register; and
* - 16-bit Usage Fault Status Register;
*/
#define CORTEXM_CFSR (0xE000ED28)
#define CORTEXM_BFSR_SHIFT (8) /* Bus Fault Status bit shift */
#define CORTEXM_UFSR_SHIFT (16) /* Usage Fault Status bit shift */
#define CORTEXM_DFSR (0xE000ED30)
#define CORTEXM_HALTED (0x1) /* trace */
#define CORTEXM_BKPT (0x2) /* FPB break point */
#define CORTEXM_MMFSR CORTEXM_CFSR /* Mem Manage Fault Status byte */
#define CORTEXM_MMFSR_FARVALID (0x80) /* fault address valid mask */
#define CORTEXM_BFSR (0xE000ED29) /* Bus Fault Status byte */
#define CORTEXM_BFSR_FARVALID (0x80) /* fault address valid mask */
#define CORTEXM_UFSR (0xE000ED2A) /* Usage Fault Status halfword */
/* Usage Fault Status fields */
#define CORTEXM_UFSR_DIV0 (0x00000200) /* Divide by Zero */
#define CORTEXM_UFSR_UNALIGN (0x00000100) /* Unaligned Access */
#define CORTEXM_UFSR_NOCP (0x00000008) /* Coprocessor Access */
#define CORTEXM_UFSR_INVPC (0x00000004) /* Invalid EXC_RETURN */
#define CORTEXM_UFSR_INVSTATE (0x00000002) /* Invalid State */
#define CORTEXM_UFSR_UNDEF (0x00000001) /* Undefined Instruction */
/* Hard Fault Status Register */
#define CORTEXM_HFSR (0xE000ED2C)
#define CORTEXM_HFSR_FORCED (0x40000000) /* escalated configurable fault */
/* (bus/mem mgt/usage fault) */
#define CORTEXM_HFSR_CLRALL (0xC0000002) /* clear all Hard faults */
/* Memory Manage Fault Address Register */
#define CORTEXM_MMFAR (0xE000ED34)
/* Bus Fault Address Register */
#define CORTEXM_BFAR (0xE000ED38)
/* MPU Control Register */
#define CORTEXM_MPU_CTRL (0xE000ED94)
/* Software Trigger Interrupt Register */
#define CORTEXM_STIR (0xE000EF00)
#define INVALID_INST (0xFF00FF00) /* invalid opcode */
#endif /* __INCarm_mh */
@@ -0,0 +1,57 @@
/* esfArm-m.h - ARM exception stack frames */
/*
* Copyright (c) 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,10may12,j_b fix tabs/spacing
01b,03may12,j_b replace "-" in filename include macro
01a,03apr12,j_b created from target/h/arch/arm/esfArm.f version 01b
*/
#ifndef __INCesfArm_mh
#define __INCesfArm_mh
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/*
* The Exception Stack Frame
* On ARMv7-M, this is faked by a stub and the pointer
* passed back points to the PC and PSR at the end of the
* register structure. If that changes, so must this.
*
* I.E., REG_SET struct & ESF struct 'overlap' on last 4
* elements of REG_SET (pc, psr, primask and basepri).
*/
typedef struct
{
INSTR *pc; /* program counter */
ULONG psr; /* combined A/I/E PSR */
ULONG basepri; /* BASEPRI */
ULONG demcr; /* MON_STEP in DEMCR */
ULONG primask; /* PRIMASK */
ULONG faultmask; /* FAULTMASK */
ULONG control; /* CONTROL */
UINT32 vecNum; /* exception number */
} ESF;
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCesfArm_mh */
@@ -0,0 +1,160 @@
/* excArmLib-m.h - ARMv7-M exception library header file */
/*
* Copyright (c) 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01d,05sep12,rec add excClearFault prototype
01c,24may12,j_b add fault status to EXC_INFO
01b,22may12,jdw Add exception vector offset mapping for scopetools
01a,14may12,m_h create from target/h/arch/arm/excArmLib.h version 01f
*/
#ifndef __INCexcArmLib_mh
#define __INCexcArmLib_mh
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/*
* NOTE: if this structure changes, the TCB offsets in h/private/taskLibP.h
* must be updated. See also taskLib.h.
*/
typedef struct
{
UINT32 valid; /* flags indicate following fields are valid */
UINT32 vecNum; /* exception number */
INSTR * pc; /* PC */
UINT32 psr; /* combined A/I/E PSR */
UINT32 primask; /* PRIMASK */
UINT32 faultmask; /* FAULTMASK */
UINT32 basepri; /* BASEPRI */
UINT32 control; /* Control Register */
UINT32 sysHandlrStat; /* System Handler Control and State Register */
UINT32 hardFltStat; /* Hard Fault Status Register */
UINT32 configFltStat; /* Configurable Fault Status Register */
UINT32 memFltAddr; /* Memory Manage Fault Address Register */
UINT32 busFltAddr; /* Bus Fault Address Register */
} EXC_INFO;
extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */
extern VOIDFUNCPTR _func_excBreakpoint; /* called to handle breakpoints */
extern void excVecBaseSet (UINT32 base); /* non-zero exception base address */
extern STATUS excIntConnect (VOIDFUNCPTR * vector, VOIDFUNCPTR routine);
extern void excVecSet (FUNCPTR * vector, FUNCPTR function);
extern FUNCPTR excVecGet (FUNCPTR * vector);
extern STATUS excVecPrioSet (VOIDFUNCPTR * vector, UINT8 priority);
extern STATUS excVecPrioGet (VOIDFUNCPTR * vector, UINT8 * pPriority);
extern void excClearFault (void);
#endif /* ASMLANGUAGE */
/* exception information valid bits */
#define EXC_INFO_VECNUM 0x01 /* vector is valid */
#define EXC_INFO_PC 0x02 /* PC is valid */
#define EXC_INFO_XPSR 0x04 /* xPSR is valid */
#define EXC_INFO_PRIMASK 0x08 /* PRIMASK is valid */
#define EXC_INFO_FAULTMASK 0x10 /* FAULTMASK is valid */
#define EXC_INFO_BASEPRI 0x20 /* BASEPRI is valid */
#define EXC_INFO_CONTROL 0x40 /* Control Register is valid */
#define EXC_INFO_SYSHDLRSTAT 0x80 /* System Handler Ctrl/State is valid */
#define EXC_INFO_HRDFLTSTAT 0x100 /* Hard Fault Status is valid */
#define EXC_INFO_CFGFLTSTAT 0x200 /* Configurable Fault Status is valid */
#define EXC_INFO_MEMFLTADDR 0x400 /* Mem Manage Fault Address is valid */
#define EXC_INFO_BUSFLTADDR 0x800 /* Bus Fault Address is valid */
#define EXC_INFO_ALL_VALID 0xFFF /* all EXC_INFO fields are valid */
/*
* Exception Numbers
*
* Note there is no Exception number 0. If the IPSR contains zero then we are
* in thread mode and therefore not servicing an exception or interrupt.
*/
#define EXC_NUM_THREAD_MODE 0 /* IPSR is 0 when in thread mode */
#define EXC_NUM_RESET 1 /* Reset */
#define EXC_NUM_NMI 2 /* Nonmaskable Interrupt */
#define EXC_NUM_HARD_FAULT 3 /* unimplemented fault handler */
#define EXC_NUM_MEM_MANAGE 4 /* MPU Violation */
#define EXC_NUM_BUS_FAULT 5 /* Bus Error */
#define EXC_NUM_USAGE_FAULT 6 /* Program error or coprocessor */
#define EXC_NUM_SVCALL 11 /* Supervisor Call */
#define EXC_NUM_DEBUG_MONITOR 12 /* Debug Monitor */
#define EXC_NUM_PENDSV 14 /* PendSV */
#define EXC_NUM_SYSTICK 15 /* System Tick Timer */
#define EXC_NUM_IRQ_BASE 16 /* First External Interrupt */
#define EXC_NUM_IRQ(num) (EXC_NUM_IRQ_BASE + (num))
#define EXC_NUM_LAST_IRQ 511
/* Exception Vectors
*
* The values at these offsets are 32-bit addresses of exception handlers.
* This is different from traditional arm architectures (such as ARMv7) which
* expect branch instructions or some other executable instructions.
*
* Note: the first entry (entry 0) in the exception vector table is the
* initial value of the stack pointer after reset, and not an exception vector
* address. Although not actually an exception vector, it is included here
* for completeness.
*/
#define EXC_OFF_INITIAL_SP 0x00
#define EXC_OFF_RESET (EXC_NUM_RESET * 4)
#define EXC_OFF_NMI (EXC_NUM_NMI * 4)
#define EXC_OFF_HARD_FAULT (EXC_NUM_HARD_FAULT * 4)
#define EXC_OFF_MEM_MANAGE (EXC_NUM_MEM_MANAGE * 4)
#define EXC_OFF_BUS_FAULT (EXC_NUM_BUS_FAULT * 4)
#define EXC_OFF_USAGE_FAULT (EXC_NUM_USAGE_FAULT * 4)
#define EXC_OFF_SVCALL (EXC_NUM_SVCALL * 4)
#define EXC_OFF_DEBUG_MONITOR (EXC_NUM_DEBUG_MONITOR * 4)
#define EXC_OFF_PENDSV (EXC_NUM_PENDSV * 4)
#define EXC_OFF_SYSTICK (EXC_NUM_SYSTICK * 4)
#define EXC_OFF_IRQ_BASE (EXC_NUM_IRQ_BASE * 4)
#define EXC_OFF_IRQ(num) (EXC_OFF_IRQ_BASE + ((num)*4))
#define EXC_OFF_LAST_IRQ EXC_OFF_IRQ(EXC_NUM_LAST_IRQ)
/* Exception Vector Base */
#define ARM_EXC_VEC_BASE 0x00
/*
* Map the traditional ARM definition to the ARM-M exception offset.
*/
/* Scope tools needs to know which vector handles undefined instructions. */
#define EXC_OFF_UNDEF (EXC_NUM_USAGE_FAULT)
/* ObjVerify needs to know which vector handles Page Faults */
#define EXC_OFF_DATA (EXC_NUM_MEM_MANAGE)
#ifdef __cplusplus
}
#endif
#endif /* __INCexcArmLib_mh */
@@ -0,0 +1,116 @@
/* intArmLib.h - ARM-specific interrupt library header file */
/*
* Copyright (c) 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01a,12apr12,jdw created.
*/
#ifndef __INCintArmLibh
#define __INCintArmLibh
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WRS_ENABLE_IRQ_TRACING
/*
* For tracing we can define some "no-op" instructions which can be
* inserted and identified in the ICE trace buffer.
*/
#define WRS_ICE_TRACE_IRQ_LOCK orr r5,r5,r5
#define WRS_ICE_TRACE_IRQ_UNLOCK orr r6,r6,r6
#else /* _WRS_ENABLE_IRQ_TRACING */
#define WRS_ICE_TRACE_IRQ_LOCK
#define WRS_ICE_TRACE_IRQ_UNLOCK
#endif /* _WRS_ENABLE_IRQ_TRACING */
#ifndef _ASMLANGUAGE
/* inline intCpuLock()/intCpuUnlock() and intCpuMicroLock/Unlock() */
#if defined (__DCC__)
__asm volatile int _inline_intCpuLock ()
{
! "r0"
mrs r0, BASEPRI /* get current status */
mov r1, #0x10
mrs BASEPRI, r1
WRS_ICE_TRACE_IRQ_LOCK
}
__asm volatile void _inline_intCpuUnlock (int key)
{
% reg key; lab label ! "r0" /* input: key in r0 */
mrs BASEPRI, r0
WRS_ICE_TRACE_IRQ_UNLOCK
}
#elif defined (__GNUC__)
static __inline__ int _inline_intCpuLock (void)
{
int key;
__asm__ volatile
(
"mrs r0, BASEPRI; " /* get current status */
"mov r1, #0x10 " /* set new status */
"mrs BASEPRI, r1 "
: "=&r" (key) /* output: key is %0 */
: /* no input */
: "r0", "r1"
);
return key;
}
static __inline__ void _inline_intCpuUnlock (int key)
{
__asm__ volatile
(
"mrs BASEPRI, r0 " /* set new status */
: "r" (key) /* input: key is %0 */
: "r0" /* r0, r1 clobbered; memory */
/* clobber for code barrier */
);
}
#endif /* __DCC__ */
/*
* For ARM-M these functions are identical
*/
#define _inline_intCpuMicroLock() _inline_intCpuLock()
#define _inline_intCpuMicroUnlock(key) _inline_intCpuUnlock(key)
/* functions in intArchLib.c and intALib.s */
extern STATUS intArchConnect (VOIDFUNCPTR * vector,
VOIDFUNCPTR routine, int argument);
extern STATUS intArchDisconnect (VOIDFUNCPTR * vector,
VOIDFUNCPTR routine, int argument);
extern int intLevelSet (int level);
extern STATUS intEnable (int level);
extern STATUS intDisable (int level);
extern unsigned int getBasePri( void );
extern unsigned int setBasePri( unsigned int level );
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCintArmLibh */
@@ -0,0 +1,106 @@
/* regsArm-m.h - ARMv7-M registers */
/*
* Copyright (c) 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01e,19jul12,jdw Add missing TCB offset register definitions
01d,23may12,jdw Add PRIMASK and BASEPRI offsets
01c,10may12,j_b fix tabs/spacing
01b,03may12,j_b replace "-" in filename include macro
01a,03apr12,j_b created from target/h/arch/arm/regsArm.f version 01f
*/
#ifndef __INCregsArm_mh
#define __INCregsArm_mh
#ifdef __cplusplus
extern "C" {
#endif
#define GREG_NUM 15 /* has 15 32-bit general registers */
#ifndef _ASMLANGUAGE
/*
* REG_SET - ARMv7-M Register set
* Note that the exception stack frame relies on the order of items
* in this so don't change this without changing the ESF and the stub
* in excALib which creates it.
*/
typedef struct /* REG_SET - ARMv7-M register set */
{
ULONG r[GREG_NUM]; /* general purpose registers 0-14 */
INSTR *pc; /* program counter */
ULONG psr; /* combined A/I/E PSR */
ULONG basepri; /* BASEPRI */
ULONG demcr; /* MON_STEP in DEMCR */
} REG_SET;
typedef struct wind_cpu_state
{
REG_SET regs;
} WIND_CPU_STATE;
#define fpReg r[11] /* frame pointer */
#define spReg r[13] /* stack pointer */
#define lrReg r[14] /* link reg pointer */
#define reg_pc pc /* program counter */
#define reg_lr lrReg /* link reg pointer */
#define reg_sp spReg /* stack pointer */
#define reg_fp fpReg /* frame pointer */
#endif /* _ASMLANGUAGE */
#define ARM_REG_SIZE 4
#define REG_SET_G_REG_BASE 0x00 /* data reg's base offset to REG_SET */
#define REG_SET_G_REG_OFFSET(n) (REG_SET_G_REG_BASE + (n)*ARM_REG_SIZE)
#define REG_SET_PC_OFFSET (REG_SET_G_REG_OFFSET(GREG_NUM))
#define REG_SET_CPSR_OFFSET (REG_SET_PC_OFFSET + ARM_REG_SIZE)
#define REG_SET_BASEPRI_OFFSET (REG_SET_CPSR_OFFSET + ARM_REG_SIZE)
#define REG_SET_DEMCR_OFFSET (REG_SET_BASEPRI_OFFSET + ARM_REG_SIZE)
#define PC_OFFSET REG_SET_PC_OFFSET
/* PAL additions */
/* moved here from h/private/taskLibP.h */
#define WIND_TCB_R0 WIND_TCB_REGS
#define WIND_TCB_R1 (WIND_TCB_R0+4*1)
#define WIND_TCB_R2 (WIND_TCB_R0+4*2)
#define WIND_TCB_R3 (WIND_TCB_R0+4*3)
#define WIND_TCB_R4 (WIND_TCB_R0+4*4)
#define WIND_TCB_R5 (WIND_TCB_R0+4*5)
#define WIND_TCB_R6 (WIND_TCB_R0+4*6)
#define WIND_TCB_R7 (WIND_TCB_R0+4*7)
#define WIND_TCB_R8 (WIND_TCB_R0+4*8)
#define WIND_TCB_R9 (WIND_TCB_R0+4*9)
#define WIND_TCB_R10 (WIND_TCB_R0+4*10)
#define WIND_TCB_R11 (WIND_TCB_R0+4*11)
#define WIND_TCB_R12 (WIND_TCB_R0+4*12)
#define WIND_TCB_SP (WIND_TCB_R0+4*13)
#define WIND_TCB_LR (WIND_TCB_R0+4*14)
#define WIND_TCB_PC (WIND_TCB_R0+4*15)
#define WIND_TCB_CPSR (WIND_TCB_PC+4)
#define WIND_TCB_BASEPRI (WIND_TCB_PC+8)
#define WIND_TCB_DEMCR (WIND_TCB_PC+12)
/* End PAL */
#ifdef __cplusplus
}
#endif
#endif /* __INCregsArm_mh */
@@ -0,0 +1,196 @@
/* vfpArmLib.h - Arm Version of Vector Floating-Point Include File */
/*
* Copyright (c) 2013 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01a,07may13,c_t VFPv4 SP written based on standard version
*/
#ifndef __INCvfpArmLibSph
#define __INCvfpArmLibSph
#ifdef __cplusplus
extern "C" {
#endif
/*
* for cortex M the following register are memory mapped and the addresses
* are architectural defined.
*/
/* Coprocessor Access Control Register, CPACR, enable CP10 & CP11 for VFP */
#define CPACR (0xE000ED88)
#define CPACR_CP_FULL(x) (3<<(2*(x))) /* 0b11 : Full access for this cp */
/* Floating-Point Context Control Register, FPCCR */
#define FPCCR (0xE000EF34)
#define FPCCR_ASPEN (1<<31) /* enable auto FP context stacking */
#define FPCCR_LSPEN (1<<30) /* enable lazy FP context stacking */
#define FPCCR_MONRDY (1<<8)
#define FPCCR_BFRDY (1<<6)
#define FPCCR_MMRDY (1<<5)
#define FPCCR_HFRDY (1<<4)
#define FPCCR_THREAD (1<<3) /* allocated FP stack in thread */
#define FPCCR_USER (1<<1) /* allocated FP stack in priviledged */
#define FPCCR_LSPACT (1<<0) /* lazy stacking is active */
/* Floating-Point Context Address Register, FPCAR */
/* this register contains the FP context address in the exception stack */
#define FPCAR (0xE000EF38)
/* Floating-Point Default Status Control Register, FPDSCR */
/*
* set the initial value of FPSCR, however we can set it manually to FPSCR
* when creating the VFP task, so let it as is at this time.
*/
#define FPDSCR (0xE000EF3C)
#define FPDSCR_AHP (1<<26)
#define FPDSCR_DN (1<<25)
#define FPDSCR_FZ (1<<24)
#define FPDSCR_RMODE 0x00C00000
#define FPDSCR_RN 0x00000000 /* round to nearest */
#define FPDSCR_RP 0x00400000 /* round toward plus infinity */
#define FPDSCR_RM 0x00800000 /* round toward minus infinity */
#define FPDSCR_RZ 0x00C00000 /* round toward zero */
/* Media and FP Feature Register 0, MVFR0 & Register 1, MVFR1*/
/* these read only registers are using to detect feature that supported */
#define MVFR0 (0xE000EF40)
#define MVFR0_SP_MSK (0x000000F0) /* bit 4~7 = 0x2, support sp */
#define MVFR0_SP_EN (0x20) /* bit 4~7 = 0x2, support sp */
#define MVFR1 (0xE000EF44)
/* FPSCR (Floating Status and Control Register) bit definitions for VFPv4SP */
/*
* At the time of implementation bits 27, 21-8, and 6-5,
* are described as reserved, one must employ
* read/modify/write techniques when handling the FPSCR in order
* to ensure that these bits are not modified...
*/
#define FPSCR_N_BIT (1<<31) /* less than result */
#define FPSCR_Z_BIT (1<<30) /* equal result */
#define FPSCR_C_BIT (1<<29) /* equal, greater than, or unordered result */
#define FPSCR_V_BIT (1<<28) /* unordered result */
#define FPSCR_AHP (1<<26)
#define FPSCR_DN_BIT (1<<25) /* Default NaN mode control */
#define FPSCR_DN_MSK FPSCR_DN_BIT
#define FPSCR_DN_ENABLE FPSCR_DN_BIT
#define FPSCR_DN_DISABLE 0x00000000
#define FPSCR_FZ_BIT (1<<24) /* flush to zero mode control */
#define FPSCR_FZ_MSK FPSCR_FZ_BIT
#define FPSCR_FZ_ENABLE FPSCR_FZ_BIT
#define FPSCR_FZ_DISABLE 0x00000000
/* Cumulative Exception Bits */
#define FPSCR_IDC_BIT (1<<7) /* Input Subnormal */
#define FPSCR_IXC_BIT (1<<4) /* Inexact */
#define FPSCR_UFC_BIT (1<<3) /* Underflow */
#define FPSCR_OFC_BIT (1<<2) /* Overflow */
#define FPSCR_DZC_BIT (1<<1) /* Division By Zero */
#define FPSCR_IOC_BIT (1<<0) /* Invalid Operation */
/* Round Mode Control Bits */
#define FPSCR_RMODES_MSK 0x00C00000 /* round mode */
#define FPSCR_RN 0x00000000 /* round to nearest */
#define FPSCR_RP 0x00400000 /* round toward plus infinity */
#define FPSCR_RM 0x00800000 /* round toward minus infinity */
#define FPSCR_RZ 0x00C00000 /* round toward zero */
#ifdef _WRS_CONFIG_DISABLE_VFP_ROUND_TO_ZERO
#define FPSCR_INIT FPSCR_DN_MSK
#else /* _WRS_CONFIG_DISABLE_VFP_ROUND_TO_ZERO */
#define FPSCR_INIT (FPSCR_DN_MSK | FPSCR_FZ_BIT)
#endif /* _WRS_CONFIG_DISABLE_VFP_ROUND_TO_ZERO */
#define VFPREG_SET VFP_CONTEXT
#define _VFP_ALIGN_SIZE 8 /* Not sure if this is needed */
/* vfpv4 sp only support D16/S32. */
#define VFP_DGPR_NUM 16 /* 16-double precision general purpose */
#define VFP_SGPR_NUM 32 /* 32-single precision general purpose */
/* FP_CONTEXT structure offsets */
#define VFP_FPSCR 0x00
#define VFP_PAD -
#define VFP_GPR 0x08 /* OFFSET(FP_CONTEXT, vfp_gpr[0]) */
#define VFP_GPR_OFFSET(n) (VFP_GPR + (n)*4) /* vfp_gpr[n]) */
#ifndef _ASMLANGUAGE
/* standard interface to fp lib. */
/* vfpv4 sp context is different with standard vfp. */
typedef struct vfpContext /* VFP Context */
{
UINT32 fpscr; /* status and control register */
UINT32 pad; /* pad to match 8 byte alignment */
UINT32 vfp_gpr[VFP_SGPR_NUM]; /* general purpose registers */
/* TOTAL */
} WRS_PACK_ALIGN(_VFP_ALIGN_SIZE) VFP_CONTEXT;
/* function declarations */
IMPORT void vfpArchInit (void);
IMPORT void vfpArchTaskCreateInit (VFP_CONTEXT *pDspContext);
IMPORT void vfpSave (VFP_CONTEXT *);
IMPORT void vfpRestore (VFP_CONTEXT *);
IMPORT STATUS vfpProbe (void);
IMPORT STATUS vfpEnable (void);
IMPORT STATUS vfpDisable (void);
IMPORT VFP_CONTEXT * vfpCtxCreate (int);
IMPORT STATUS vfpCtxDelete (VFP_CONTEXT *);
IMPORT void vfpCtxShow (VFP_CONTEXT *);
void vfpRegsToCtx (VFPREG_SET *, VFP_CONTEXT *);
void vfpCtxToRegs (VFP_CONTEXT *, VFPREG_SET *);
#ifdef _WRS_HW_VFP_SUPPORT
IMPORT int vfpIsEnabled (void);
IMPORT int vfpHasException (void);
IMPORT STATUS vfpProbeSup (void);
IMPORT UINT32 vfpFpSidGet (void);
IMPORT UINT32 vfpFpScrGet (void);
IMPORT void vfpFpScrSet (UINT32);
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCvfpArmLibSph */
+505
View File
@@ -0,0 +1,505 @@
/* arm.h - ARM CPU flags etc */
/*
* Copyright (c) 1996-2006, 2008-2014 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
17apr14,c_l add the write protection of L2 page table. (VXW6-73478)
02l,16mar13,yjw Update for ARMv7M
02k,08oct12,jdw Update FAST MATH for ARMARCH7
02j,14sep12,j_b fix whitespace issues
02i,28jun12,j_b add Cortex-A15 cache support
02h,09feb12,jdw Update definitions for __ieee_status(), WIND00332894
02g,01feb12,rec WIND00329076 - cleanup assembly macros to be consistent
02f,11aug11,jdw Add support for ARMv7 core optimizations
02e,23aug11,rec WIND00292261 - transition to common power management API
02d,15apr11,jdw Enable cached page tables
02c,13jan11,m_h Define _CACHE_ALIGN_SIZE as cacheArchAlignSize for ARMARCH7
02b,09jul10,fao add endianness state bit define
02a,21may10,m_h Thumb-2 Support
01z,02feb10,j_b add _WRS_ARM_HAS_ASID macro, defined for ARMv6+
01y,23sep09,j_b add LDREX/STREX support for ARMARCH7
01x,06jun09,mdo Don't check IEEE status for FAST_MATH
01w,25feb09,j_b merge ARM SMP:
11jul07,j_b add ARMMMU_11MPCORE support
11jul07,to added ARM_HAS_LDREX_STREX feature macro
02jul07,m_h Adding types for MPCore varient
01v,27feb09,m_h ARMARCH7 Support
01u,12jun08,j_b add Cortex-A MMU and Cortex-A/-R cache support
01t,28apr08,m_h Create macro for NOP after LDM^ and STM^
01s,13jul06,m_h MPU support
01r,25jan06,m_h Manzano support
01o,10oct05,scm correct SPR 111664
01n,04apr05,jb Adding ARMARCH6 and 1136 support
01m,21mar05,mdo Add define for ansiMath testing
01l,02mar05,mdo Add prototype for __ieee_status() and definitions for
exception flags
01k,10aug04,scm remove MPU support...
01j,25nov03,sn Avoid gcc 3.3.2 preprocessor token pasting error
01i,26aug03,rec remove SYS_PWR_MGMT conditional
01h,07jul03,rec revert to non-portable kernel
01g,01jul03,rec code review comments
01f,28may03,rec Power Management
01f,17dec02,jb Adding ARM10 and 926E support
01e,15jan02,m_h ARMARCH5 thumb problem
01d,05nov01,t_m remove leading underscores via FUNC/VAR macros
01c,05nov01,t_m Undo underscores
01b,19jul01,ed Fixing to be compatible with Diab compiler.
01d,17oct01,t_m Merge in DIAB
01c,10oct01,jb Enabling removal of pre-pended underscores for new compilers
(Diab/Gnu elf)
01b,23jul01,scm change XScale name to conform to coding standards...
01a,11dec00,scm replace references to ARMSA2 with XScale
01g,16oct00,scm reverse back I & F bits for SA2
01f,01sep00,scm add sa2 support...
01e,08feb99,jpd added further MMU/CACHE types.
01d,20jan99,cdp removed support for old ARM libraries.
01c,24aug98,cdp added MMU/cache types, ARM_HAS_MPU/ARM_THUMB, ARMST16/ARMST32.
01b,21aug97,cdp added _?_FUNCTION macros and HAS_HALFWORD_
01a,08may96,cdp written
*/
#ifndef __INCarmh
#define __INCarmh
#ifdef __cplusplus
extern "C" {
#endif
#if (CPU == ARMARCH7M)
#include "arch/arm/arm-m/arm-m.h"
#else /* (CPU == ARMARCH7M) */
/* Make sure excArmLib.h also has same settings */
/* bits in the PSR */
#define V_BIT (1<<28)
#define C_BIT (1<<29)
#define Z_BIT (1<<30)
#define N_BIT (1<<31)
#define E_BIT (1<<9)
#define I_BIT (1<<7)
#define F_BIT (1<<6)
#define T_BIT (1<<5)
/* mode bits */
#define MODE_SYSTEM32 0x1F
#define MODE_UNDEF32 0x1B
#define MODE_ABORT32 0x17
#define MODE_SVC32 0x13
#define MODE_IRQ32 0x12
#define MODE_FIQ32 0x11
#define MODE_USER32 0x10
#define MODE_MONITOR 0x16
/* masks for getting bits from PSR */
#ifdef ARM_INTERWORKINGSUPPORT
#define MASK_MODE 0x0000003F
#else /*ARM_INTERWORKINGSUPPORT*/
#define MASK_MODE 0x0000001F
#endif /*ARM_INTERWORKINGSUPPORT*/
#define MASK_32MODE 0x0000001F
#define MASK_SUBMODE 0x0000000F
#define MASK_INT 0x000000C0
#define MASK_CC 0xF0000000
/* shifts to access bits in the PSR */
#define INT_MASK_SHIFT 6
/* The coprocessor number of the MMU System Control Processor */
#define CP_MMU 15
/* ARM MMU types */
#define ARMMMU_NONE 0
#define ARMMMU_710A 1
#define ARMMMU_810 2
#define ARMMMU_SA110 3
#define ARMMMU_940T 4
#define ARMMMU_740T 5
#define ARMMMU_SA1100 6
#define ARMMMU_SA1500 7
#define ARMMMU_720T 8
#define ARMMMU_920T 9
#define ARMMMU_946E 10
#define ARMMMU_XSCALE 11
#define ARMMMU_926E 12
#define ARMMMU_1020E 13
#define ARMMMU_1022E 14
#define ARMMMU_1136JF 15
#define ARMMMU_MANZANO 16
#define ARMMMU_CORTEXA8 17
#define ARMMMU_11MPCORE 18
#define ARMMPU_940T ARMMMU_940T
#define ARMMPU_740T ARMMMU_740T
#define ARMMPU_946E ARMMMU_946E
/* ARM cache types */
#define ARMCACHE_NONE 0
#define ARMCACHE_710A 1
#define ARMCACHE_810 2
#define ARMCACHE_SA110 3
#define ARMCACHE_940T 4
#define ARMCACHE_740T 5
#define ARMCACHE_SA1100 6
#define ARMCACHE_SA1500 7
#define ARMCACHE_720T 8
#define ARMCACHE_920T 9
#define ARMCACHE_946E 10
#define ARMCACHE_XSCALE 11
#define ARMCACHE_926E 12
#define ARMCACHE_1020E 13
#define ARMCACHE_1022E 14
#define ARMCACHE_1136JF 15
#define ARMCACHE_MANZANO 16
#define ARMCACHE_CORTEXA8 17
#define ARMCACHE_11MPCORE 18
#define ARMCACHE_CORTEXA15 19
/* check CPU/cache/MMU features */
/* Cache Line sizes */
#if defined (_WRS_CONFIG_ARMV7_CORE_CTX_A8) || \
defined (_WRS_CONFIG_ARMV7_CORE_CTX_A15)
#define _CPU_CACHE_ALIGN_SIZE 64 /* Cortex-A8 and Cortex-A15 use 64 bytes */
#else /* _WRS_CONFIG_ARMV7_CORE_CTX_A8 || _WRS_CONFIG_ARMV7_CORE_CTX_A15 */
/*
* Most ARM cores have a cache line size of 32 bytes.
*
* This can be overridden through use of the global variable
* cacheArchAlignSize. See below.
*/
#define _CPU_CACHE_ALIGN_SIZE 32
#endif /* _WRS_CONFIG_ARMV7_CORE_CTX_A8 || _WRS_CONFIG_ARMV7_CORE_CTX_A15 */
/*
* The way in which _CACHE_ALIGN_SIZE is defined has been changed
* somewhat and is no longer strictly related to the CPU type defined,
* but is instead related to the cache type selected. Therefore, it would
* be better if drivers that need to know the cache line size, use this
* variable, rather than the constant. The variable will be initialized
* to the appropriate cache-type-dependent value by the variant of the
* cache library initialisation code.
*/
#ifndef _ASMLANGUAGE
extern int cacheArchAlignSize;
#endif /* _ASMLANGUAGE */
/*
* Cached page tables are supported by ARM v6 and ARM v7 processors by
* default. Turn them on here for default builds (e.g. builds not
* configured by vxprj / VSBs).
*/
#if (!defined(_WRS_CONFIG_ARM_PRJ_BUILD) && \
((CPU == ARMARCH6) || (CPU == ARMARCH7) || (CPU == ARMARCH7_T2)))
#define _WRS_CONFIG_ENABLE_CACHED_PAGE_TBL
#endif
/*
* Cached page tables are not supported for ARMv6 MPCore BSPs, so
* disable this feature here for default & VSB builds
*/
#if ((defined (_WRS_CONFIG_SMP) && (CPU == ARMARCH6)) && \
defined (_WRS_CONFIG_ENABLE_CACHED_PAGE_TBL))
#undef _WRS_CONFIG_ENABLE_CACHED_PAGE_TBL
#endif
/*
* Cached page tables are not supported for ARM v4 and ARM v5 processors, so
* disable this feature here for default & VSB builds
*/
#if (((CPU == ARMARCH4) || (CPU == ARMARCH5) || (CPU == XSCALE)) && \
defined (_WRS_CONFIG_ENABLE_CACHED_PAGE_TBL))
#undef _WRS_CONFIG_ENABLE_CACHED_PAGE_TBL
#endif
#if ((CPU == ARMARCH7) || (CPU == ARMARCH7_T2))
/*
* By default cache alignment for ARMv7 is 32 bytes. This is accomplished by
* assigning cacheArchAlignSize as _CPU_CACHE_ALIGN_SIZE where it is declared
* in cacheArchVars.c. But some cores can have a cache alignment that is not
* 32 bytes. These cores will adjust the global variable cacheAlignSize
* during runtime initialization. See cacheAimCortexA8LibInit for an example
* of this.
*/
#undef _CACHE_ALIGN_SIZE
#define _CACHE_ALIGN_SIZE cacheArchAlignSize
/* this cpu family supports power management framework */
#define _WRS_ARCH_HAS_CPU_PWR_MGMT
#else /* ((CPU == ARMARCH7) || (CPU == ARMARCH7_T2)) */
/* Cache alignment is 32 bytes */
#undef _CACHE_ALIGN_SIZE
#define _CACHE_ALIGN_SIZE _CPU_CACHE_ALIGN_SIZE
#endif /* ((CPU == ARMARCH7) || (CPU == ARMARCH7_T2)) */
#if (CPU == ARMARCH3)
#define ARM_HAS_HALFWORD_INSTRUCTIONS FALSE
#else
#define ARM_HAS_HALFWORD_INSTRUCTIONS TRUE
#endif
#define ARM_HAS_MPU FALSE
#if defined(ARMMMU) && (ARMMMU == ARMMMU_NONE)
#define ARM_HAS_NO_MMU TRUE
#else
#define ARM_HAS_NO_MMU FALSE
#endif
#if (CPU == ARMARCH4_T) || (CPU == ARMARCH5_T)
#define ARM_THUMB TRUE
#else
#define ARM_THUMB FALSE
#endif
#if (CPU == ARMARCH7_T2)
#define ARM_THUMB2 TRUE
#else /* (CPU == ARMARCH7_T2) */
#define ARM_THUMB2 FALSE
#endif /* (CPU == ARMARCH7_T2) */
#if (ARM_THUMB2)
#define PORTABLE
#endif /* ARM_THUMB2 */
/*
* For ARMv5 and earlier, STM(2) and LDM(2) instructions
* must not be immediately followed by an
* instruction that accesses a banked register.
* Banked registers are: R8-R14. STM(2) and LDM(2) are
* the variations of the OP codes that end with "^"
* (load or store registers from a different mode -- user mode)
* and do not load the PC (do not branch).
*
* One possible solution to this (suggested by the
* ARM Architecture Reference Manual) is to insert
* a NOP between the STM or LDM call and the access
* to a banked register.
*
* Here is an example of where a NOP would be required
* because sp is one of the banked registers:
*
* LDMIA r1, {sp, lr}^
* NOP
* LDR r1, [sp, #SC_SAVE_USERSR]
*
* The asm macro ARM_NOP_AFTER_USER_LDM_STM is used for
* inserting the NOP only if the version of the architecture
* requires it.
*/
#if (CPU == ARMARCH4) || (CPU == ARMARCH5) || (CPU == XSCALE)
#define ARM_NOP_AFTER_USER_LDM_STM NOP
#else
#define ARM_NOP_AFTER_USER_LDM_STM
#endif
#if (CPU == ARMARCH6) || (CPU==ARMARCH7) || (CPU==ARMARCH7_T2)
#define ARM_HAS_LDREX_STREX TRUE
#define _WRS_ARM_HAS_ASID TRUE
#else /* (CPU == ARMARCH6) || (CPU==ARMARCH7) || (CPU==ARMARCH7_T2) */
#define ARM_HAS_LDREX_STREX FALSE
#define _WRS_ARM_HAS_ASID FALSE
#endif /* (CPU == ARMARCH6) || (CPU==ARMARCH7) || (CPU==ARMARCH7_T2) */
/** Power management for XSCALE **/
#if (CPU==XSCALE)
/* The coprocessor number of the Power Mode Register */
#define CP_CCLKCFG 14
/* OPCODE for idle */
#define PWRMODE_IDLE 1
#endif /* Power management for XSCALE */
/** Power management for ARM **/
#if (CPU==ARMARCH5) || (CPU==ARMARCH5_T) || (CPU==ARMARCH6) \
|| (CPU==ARMARCH7) || (CPU==ARMARCH7_T2)
/* The coprocessor number of the Power Mode Register */
#define CP_CORECTL 15
/* OPCODE for idle */
#define PWRMODE_IDLE 1
#endif /* CPU==ARMARCH5 ... ARMARCH7_T2 */
#if !defined(_WRS_CONFG_FAST_MATH) || (VFPVARIANT != VFPV3)
/* Define __ieee_status exception flags */
#define FE_IEEE_FLUSHZERO (0x01000000)
#define FE_IEEE_ROUND_TONEAREST (0x00000000)
#define FE_IEEE_ROUND_UPWARD (0x00400000)
#define FE_IEEE_ROUND_DOWNWARD (0x00800000)
#define FE_IEEE_ROUND_TOWARDZERO (0x00C00000)
#define FE_IEEE_ROUND_MASK (0x00C00000)
#define FE_IEEE_MASK_INVALID (0x00000100)
#define FE_IEEE_MASK_DIVBYZERO (0x00000200)
#define FE_IEEE_MASK_OVERFLOW (0x00000400)
#define FE_IEEE_MASK_UNDERFLOW (0x00000800)
#define FE_IEEE_MASK_INEXACT (0x00001000)
#define FE_IEEE_MASK_ALL_EXCEPT (0x00001F00)
#define FE_IEEE_INVALID (0x00000001)
#define FE_IEEE_DIVBYZERO (0x00000002)
#define FE_IEEE_OVERFLOW (0x00000004)
#define FE_IEEE_UNDERFLOW (0x00000008)
#define FE_IEEE_INEXACT (0x00000010)
#define FE_IEEE_ALL_EXCEPT (0x0000001F)
/* Define which of the IEEE status bits are reserved */
#define IEEE_RESERVED_MASK (0xF63FE0E0)
#ifndef _ASMLANGUAGE
extern unsigned int __ieee_status (unsigned int mask, unsigned int flags);
#endif
/* Define for ansiMath Testing */
#define _WRS_ARM_IEEE_STATUS
#endif
/*
* The default for ARMARCH7 and ARMARCH7_T2 is to use _WRS_CONFIG_FAST_MATH to
* optimize builds created with VFP enabled. The flag to enable this behavior
* is from the make fragments for a CPU/TOOL pair.
*
* Builds that use a SW FP tool chain should not use FAST MATH to get best
* performance.
*
* Override VSB options here because VSB configuration does not detect the
* tool chain / floating point configuration properly.
*/
#if defined(ARM_USE_VFP)
/* Vector floating point builds use FAST MATH */
#undef _WRS_CONFIG_FAST_MATH
#define _WRS_CONFIG_FAST_MATH 1
#else
/* Software floating point build does NOT use FAST MATH */
#undef _WRS_CONFIG_FAST_MATH
#endif /* defined(USE_ARM_FP) ... */
/*
* The default for ARMARCH7 and ARMARCH7_T2 is to use _WRS_CONFIG_FAST_MATH to
* optimize builds created with VFP enabled. The flag to enable this behavior
* is from the make fragments for a CPU/TOOL pair.
*
* Builds that use a SW FP tool chain should not use FAST MATH to get best
* performance.
*
* Override VSB options here because VSB configuration does not detect the
* tool chain / floating point configuration properly.
*/
#if defined(ARM_USE_VFP)
/* Vector floating point builds use FAST MATH */
#undef _WRS_CONFIG_FAST_MATH
#define _WRS_CONFIG_FAST_MATH 1
#else
/* Software floating point build does NOT use FAST MATH */
#undef _WRS_CONFIG_FAST_MATH
#endif /* defined(USE_ARM_FP) ... */
#ifdef _ASMLANGUAGE
/*
* File below inclusion must be after ARCH specific defines such as ARM_THUMB2.
*/
#include <asm.h>
/** I80310 (coyanosa) specific helper macros **/
#if ((CPU==XSCALE) || (CPU==ARMSA110))
/*
* The following macro should be used when software needs to be assured that a
* CP15 update has taken effect. It may only used while in a privileged mode,
* because it accesses CP15. Ref. Coyanosa EAS 2.3.4 Additions to CP15
* functionality
*/
#define CPWAIT(a) \
mrc p15, 0, a, c2, c0, 0 /* arbitrary read of CP15 */ ;\
mov a, a /* wait for it */ ;\
sub pc, pc, IMMED4 /* branch to next instruction */ ;
#define IMMED4 #4
/*
* at this point, any previous CP15 writes are guaranteed
* to have taken effect
*/
/*
* The following macro should be used when software needs to be assure that
* BCU has finish all outstanding operations.
*/
/*
* CAUTION: This macro should be used only from the cacheable region, or it may
* keep the BCU eternally busy fetching the code.
*/
#define BCUWAIT(a) \
mrc p13, 0, a, c0, c1, 0; /* Read BCUCTL,updates conditon code */ \
submi pc, pc, IMMED12 ; /* If BCU busy (bit 31 set) try again */
#define IMMED12 #12
#endif /* if CPU=XSCALE */
#endif /* _ASMLANGUAGE */
#endif /* (CPU == ARMARCH7M) */
#ifdef __cplusplus
}
#endif
#endif /* __INCarmh */
+201
View File
@@ -0,0 +1,201 @@
/* asmArm.h - ARM assembler definitions header file */
/*
* Copyright (c) 1996, 2004, 2010, 2012, 2013 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01g,20feb13,yjw add macros to support Thumb-2
01f,16oct12,jdw Add SPSR set macro (WIND00259770)
01e,18jan12,rec WIND00329076 - add FUNC_END, cleanup macros to be consistent
with other arch defines. Remove THUMB support.
01d,09jan12,jdw Add macro definitions for pld instructions
01c,21may10,m_h Thumb-2 Support
01b,06jul04,md added function definition macros
01a,09may96,cdp created
*/
#ifndef __INCasmArmh
#define __INCasmArmh
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _ASMLANGUAGE
#ifdef __GNUC__
.syntax unified
#endif
/* Build for Gnu elf or Diab compiler */
/* useful, assembly-language macros */
#define FUNC(a) a
#define VAR(name) name
/*
* These macros are used to declare assembly language symbols that need
* to be typed properly(func or data) to be visible to the OMF tool.
* So that the build tool could mark them as an entry point to be linked
* correctly.
*/
#ifdef __DCC__
#if ARM_THUMB2
#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@tfunc
#else /* ARM_THUMB2 */
#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function
#endif /* ARM_THUMB2 */
#define GDATA(sym) VAR(sym) ; .type VAR(sym),@object
#elif (defined __GNUC__) /* GNU macros */
#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),STT_FUNC
#define GDATA(sym) VAR(sym) ; .type VAR(sym),STT_OBJECT
#else /* neither __DCC__ nor __GNUC__ */
#error "error!!! unsupported compiler!!!"
#endif /* __DCC__ */
/* abstract assembler idiosyncrasies */
#define FUNC_LABEL(func) func:
#define VAR_LABEL(name) name:
#define FUNC_EXPORT(func) .globl GTEXT(func)
#define DATA_EXPORT(var) .globl GDATA(var)
#define FUNC_IMPORT(func) .extern FUNC(func)
#define DATA_IMPORT(var) .extern VAR(var)
#define FUNC_END(func) .size FUNC(func), . - FUNC(func)
#if ((!defined __GNUC__) && (!defined __DCC__))
#error "error!!! unsupported assembler!!!"
#endif /* (defined __GNUC__) && (!defined __DCC__) */
/*
* The DCC assembler has problems with spaces before the function label.
* To avoid assembler parse problems, the FUNC_LABEL macros below are
* not indented.
*/
#if ARM_THUMB2
#if (defined __GNUC__)
#define FUNC_BEGIN(func) \
.thumb;\
.thumb_func;\
.balign 4;\
FUNC_LABEL(func)
#else /* !__GNUC__ */
#define FUNC_BEGIN(func) \
.thumb;\
.balign 4;\
FUNC_LABEL(func)
#endif /* __GNUC__ */
#else /* !ARM_THUMB2 */
#define FUNC_BEGIN(func) \
.code 32;\
.balign 4;\
FUNC_LABEL(func)
#endif /* ARM_THUMB2 */
/*
* The following two macros are deprecated. Definitions are provided for
* backward compatibility.
*/
#define _ARM_FUNCTION_CALLED_FROM_C FUNC_BEGIN
#define _ARM_FUNCTION FUNC_BEGIN
/* Define macros to use the PLD instruction on ARM v7 processors */
#if (CPU == ARMARCH7 || CPU == ARMARCH7_T2)
#define PLD(...) pld __VA_ARGS__
#else
/* if not ARM v7, do nothing */
#define PLD(...)
#endif
#if (CPU == ARMARCH7M)
/*
* Macro to perform a 32-bit MOV operation, using the ARMv7-M encoding of the
* MOV and MOVT instructions to copy the lower and upper 16-bits of a 32-bit
* constant to a register.
*/
#define _ARM_M_MOV32(reg, val) \
LDR reg, =val
/* External interrupt toggle */
#define INT_LOCK \
PUSH {r0}; \
MOV r0, #0x10; \
MSR basepri, r0; \
POP {r0}
#define INT_UNLOCK \
PUSH {r0}; \
MOV r0, #0x00; \
MSR basepri, r0; \
POP {r0}
#endif /* CPU == ARMARCH7M */
#define TEMP_STACK_ADR 0x20000800
/*
* The SPSR has changed and additional bits have been added as newer ARM
* architecture versions have been released. The new bit definitions are
* marked as RAZ/SBZP in older architecture revisions and shouldn't be
* modified. Newer versions of the Diab compiler have changed the behavior of
* the 'MSR spsr, <reg>' operation and no longer assumes modification of only
* spsr_cf fields when specific mask fields are not specified. GCC translates
* 'MSR spsr, <reg>' to only modify spsr_cf fields by default, if specific
* fields are not specified. See the ARM Architecture Reference Manual for
* definitions of the SPSR fields and MSR instruction behavior.
*
* The _ARM_SPSR_SET() macro abstracts arch and compiler issues from common
* code.
*/
#if (CPU != ARMARCH7M)
#if ((_VX_CPU == _VX_ARMARCH7) || (_VX_CPU == _VX_ARMARCH7_T2))
/*
* For ARMv7 (ARM & Thumb2) SPSR <23:20> are RAZ/SBZP, all others are
* defined... Write all bits.
*/
#define _ARM_SPSR_SET(reg) \
MSR spsr_cxsf, reg
#else /* ((_VX_CPU == _VX_ARMARCH7) || (_VX_CPU == _VX_ARMARCH7_T2)) */
/*
* For ARMv4, ARMv5, & ARMv6 architectures only the 'c' (bits <7:0>) and 'f'
* (bits <31:24>) fields are restored in order to remain consistent with
* earlier versions of VxWorks and older Diab compiler revisions.
*
* NOTES:
* 1) The IMX31 may crash if reserved SPSR bits are modified,
* see WIND00253307 for details
* 2) For ARMARCH6 the GE[3:0] bits (SPSR <19:16>) are not preserved
* because VxWorks does not support SIMD instructions
*/
#define _ARM_SPSR_SET(reg) \
MSR spsr_cf, reg
#endif /* ((_VX_CPU == _VX_ARMARCH7) || (_VX_CPU == _VX_ARMARCH7_T2)) */
#endif /* CPU != ARMARCH7M */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCasmArmh */
@@ -0,0 +1,71 @@
/* cacheArm1136jfLib.h - ARM 1136JF cache library header file */
/* Copyright 2005, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01c,29apr10,pad Moved extern C statement after include statements.
01b,18apr05,jb Fix for SPR 108034
01a,07dec04,jb created
*/
#ifndef __INCcacheArm1136jfLibh
#define __INCcacheArm1136jfLibh
/*
* Include ARCH6 common defines.
*/
#include "arch/arm/cacheArmArch6.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB TRUE
/*
* Most of the cache designs are virtually addressed, but some newer
* ones have physically addressed caches. Note that this is the method of
* addressing, not whether the cache has physical address tags within
* it.
*/
#define ARMCACHE_IS_PHYSICALLY_ADDRESSED TRUE
#ifndef _ASMLANGUAGE
IMPORT void cacheArm1136jfLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArm1136jfLibh */
@@ -0,0 +1,89 @@
/* cacheArm11MPCoreLib.h - ARM 11 MPCore cache library header file */
/*
* Copyright (c) 2007, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01b,29apr10,pad Moved extern C statement after include statements.
01a,10jul07,m_h created
*/
#ifndef __INCcacheArm11MPCoreLibh
#define __INCcacheArm11MPCoreLibh
/*
* Include ARCH6 common defines.
*/
#include "arch/arm/cacheArmArch6.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB TRUE
/*
* Most of the cache designs are virtually addressed, but some newer
* ones have physically addressed caches. Note that this is the method of
* addressing, not whether the cache has physical address tags within
* it.
*/
#define ARMCACHE_IS_PHYSICALLY_ADDRESSED TRUE
/* Offsets from PERIPHBASE into MPCore Private Memory Region */
#define MPCORE_PMR_SNU_CTRL_OFFSET (0x00)
#define MPCORE_PMR_SNU_CONFIG_OFFSET (0x04)
#define MPCORE_PMR_CPU_STATUS_OFFSET (0x08)
#define MPCORE_PMR_INVALIDATE_ALL_OFFSET (0x0C)
/* Snoop Control Unit -- control register masks */
#define MPCORE_PMR_SNU_CTRL_EN (0x00000001)
#ifndef _ASMLANGUAGE
IMPORT UINT32 arm11MPCorePeriphBaseAddr;
IMPORT void cacheArm11MPCoreLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArm11MPCoreLibh */
@@ -0,0 +1,67 @@
/* cacheArm920tLib.h - ARM 920T cache library header file */
/* Copyright 1998-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01d,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01c,09dec04,jb Further Palify ARM Aim cache
01b,11dec03,scm flushing out aim...
01a,04feb99,jpd created
*/
#ifndef __INCcacheArm920tLibh
#define __INCcacheArm920tLibh
#ifdef __cplusplus
extern "C" {
#endif
#define D_CACHE_SIZE (16*1024) /* 16 kbytes DCache */
#define I_CACHE_SIZE (16*1024) /* 16 kbytes ICache */
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB FALSE
#ifndef _ASMLANGUAGE
IMPORT void cacheArm920tLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
/* definitions to allow for non-cacheAiIM direct calls */
#define cacheArm920tDClearDisable cacheAim920tDClearDisable
#define cacheArm920tIClearDisable cacheAim920tIClearDisable
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArm920tLibh */
@@ -0,0 +1,58 @@
/* cacheArm926eLib.h - ARM 926E cache library header file */
/* Copyright 2002-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01d,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01c,07dec04,jb Further Palify ARM Aim cache
01b,11dec03,scm flushing out aim...
01a,09dec02,jpd created, based on cacheArm946eLib.h
*/
#ifndef __INCcacheArm926eLibh
#define __INCcacheArm926eLibh
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB FALSE
#ifndef _ASMLANGUAGE
IMPORT void cacheArm926eLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArm926eLibh */
@@ -0,0 +1,89 @@
/* cacheArm940tLib.h - ARM 940T cache library header file */
/* Copyright 1998-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01d,27jul06,m_h vxWorks 6.x Support
01c,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01b,11dec03,scm flushing out aim...
01a,24nov98,jpd created
*/
#ifndef __INCcacheArm940tLibh
#define __INCcacheArm940tLibh
#ifdef __cplusplus
extern "C" {
#endif
#define D_CACHE_SIZE (4*1024) /* 4 kbytes DCache */
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB FALSE
#ifndef _ASMLANGUAGE
IMPORT void cacheArm940tLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
#if 0
/* if true, not building with cacheAIM support... */
/* The following prototypes are pre-cacheAIM support */
IMPORT void cacheArm940tDClearDisable (void);
IMPORT void cacheArm940tDFlush (void * addr);
IMPORT void cacheArm940tDFlushAll (void);
IMPORT void cacheArm940tDInvalidateAll (void);
IMPORT void cacheArm940tIInvalidateAll (void);
IMPORT void cacheArm940tIInvalidate (void * addr);
IMPORT void cacheArm940tDClearAll (void);
IMPORT void cacheArm940tDClear (void * addr);
IMPORT void cacheArm940tIClearDisable (void);
IMPORT void cacheArm940tArchPipeFlush (void);
#else
/* else, cacheAIM support... */
/* definitions to allow for non-cacheAiIM direct calls */
#define cacheArm940tDClearDisable cacheAim940tDClearDisable
#define cacheArm940tIClearDisable cacheAim940tIClearDisable
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArm940tLibh */
@@ -0,0 +1,71 @@
/* cacheArm946eLib.h - ARM 946E cache library header file */
/*
* Copyright (c) 2000-2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01e,16jun06,m_h non-cacheAIM direct calls
01d,22may06,m_h Palify
01c,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01b,11dec03,scm flushing out aim...
01a,20jul00,jpd created, based on cacheArm940tLib.h
*/
#ifndef __INCcacheArm946eLibh
#define __INCcacheArm946eLibh
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB FALSE
#ifndef _ASMLANGUAGE
IMPORT void cacheArm946eLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
/* definitions to allow for non-cacheAIM direct calls */
#define cacheArm946eDClearDisable cacheAim946eDClearDisable
IMPORT void cacheArm946eDClearDisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArm946eLibh */
@@ -0,0 +1,109 @@
/* cacheArmArch6.h - ARM ARCH6 cache library header file */
/* Copyright 2004-2005, 2009, 2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01e,30sep11,cwl define functions for cache enable/disable. (WIND00284079)
01d,18feb11,my_ Declare new functions which support L2 cache.
01c,18sep09,j_b add core-specific function ptr for DClearDisable operation
01b,20apr05,jb Fix for SPR 108034
01a,07dec04,jb created
*/
#ifndef __INCcacheArmArch6h
#define __INCcacheArmArch6h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/*
* Common definitions for Arm Arch6 Cache support
*/
extern STATUS cacheAimArch6IEnable (void);
extern STATUS cacheAimArch6DEnable (void);
extern STATUS cacheAimArch6IDisable (void);
extern STATUS cacheAimArch6DDisable (void);
extern STATUS cacheAimArch6IProbe (void);
extern STATUS cacheAimArch6DProbe (void);
extern BOOL cacheAimArch6IIsOn (void);
extern BOOL cacheAimArch6DIsOn (void);
extern STATUS cacheAimArch6TextUpdate (void * start, UINT32 count, UINT32 IcacheLineSize, UINT32 DcacheLineSize);
extern void * cacheAimArch6DmaMalloc (size_t bytes);
extern STATUS cacheAimArch6DmaFree (void * pBuf);
extern BOOL cacheAimArch6MmuIsOn (void);
extern STATUS cacheAimArch6DInvalidate (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch6DInvalidateAll (void);
extern STATUS cacheAimArch6IInvalidate (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch6IInvalidateAll (void);
extern STATUS cacheAimArch6DFlush (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch6DFlushAll (void);
extern STATUS cacheAimArch6DClear (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch6PipeFlush (void);
extern void cacheAimArch6IMB (void);
extern void cacheAimArch6IClearDisable (void);
extern void cacheAimArch6DClearDisableWithVerify (void);
extern void cacheAimArch6DClearDisableNoVerify (void);
extern UINT32 cacheAimArch6Identify (void);
extern FUNCPTR sysCacheLibInit;
extern UINT32 cacheArchState;
extern STATUS cacheArchIInvalidate(void * start, void * end, UINT32 step);
extern STATUS cacheArchIInvalidateAll(void);
extern STATUS cacheArchDFlush(void * start, void * end, UINT32 step);
extern STATUS cacheArchDFlushAll(void);
extern STATUS cacheArchDInvalidate(void * start, void * end, UINT32 step);
extern STATUS cacheArchDInvalidateAll(void);
extern STATUS cacheArchDClear(void * start, void * end, UINT32 step);
extern STATUS cacheArchDClearAll (void);
/*
* Core-specific function pointer for D-cache ClearDisable operation.
* These must be initialized by the cacheAim<core>LibInit() routine.
*/
extern VOIDFUNCPTR _func_cacheAimArch6DClearDisable;
extern void (*_pSysL2CacheEnable)(CACHE_TYPE cacheType);
extern void (*_pSysL2CacheDisable)(CACHE_TYPE cacheType);
extern void (*_pSysL2CacheInvFunc)(CACHE_TYPE cacheType, void * start, void * end);
extern void (*_pSysL2CacheFlush)(CACHE_TYPE cacheType, void * start, void * end);
extern void (*_pSysL2CacheClear)(CACHE_TYPE cacheType, void * start, void * end);
extern void cacheArchL2CacheEnable(void);
extern void cacheArchL2CacheDisable(void);
extern BOOL cacheArchL2CacheIsOn(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArmArch6h */
@@ -0,0 +1,298 @@
/* cacheArmArch7.h - ARM ARCH7 cache library header file */
/*
* Copyright (c) 2008, 2010, 2012, 2014 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
06jan14,c_l Improve cache operation. (VXW6-27040)
01h,09nov12,j_b remove unnecessary L1 data cache operation macro
01g,04oct12,j_b add macro to operate only on entire L1 D-cache
01f,21sep12,j_b Add DSB to end of _CORTEX_AR_ENTIRE_DATA_CACHE_OP
01e,10sep12,m_h L2 cachePipeFlush (WIND00240234)
01d,02jun10,m_h Thumb-2 Support
01c,19may10,z_l Declare new functions which support L2 cache.
01b,01aug08,j_b fix _CORTEX_AR_ENTIRE_DATA_CACHE_OP labels
01a,11jun08,j_b Created from cacheArmArch6.h, rev 01b
*/
#ifndef __INCcacheArmArch7h
#define __INCcacheArmArch7h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/*
* Common definitions for Arm Arch7 Cache support
*/
/* cache levels: 7 possible, indexed starting from 0 */
#define ARMV7_CACHE_LVL1 0
#define ARMV7_CACHE_LVL2 1
#define ARMV7_CACHE_LVL3 2
#define ARMV7_CACHE_LVL4 3
#define ARMV7_CACHE_LVL5 4
#define ARMV7_CACHE_LVL6 5
#define ARMV7_CACHE_LVL7 6
/* cache types from Cache Level ID register (CLIDR) */
#define ARMV7_CLID_ICACHE_TYPE 0x1 /* instruction cache */
#define ARMV7_CLID_DCACHE_TYPE 0x2 /* data cache */
#define ARMV7_CLID_UCACHE_TYPE 0x4 /* unified cache */
/* cache types for Cache Size Selection register (CSSEL) */
#define ARMV7_CSSEL_ICACHE_TYPE 0x1 /* select instruction cache */
#define ARMV7_CSSEL_DCACHE_TYPE 0x0 /* select data or unified cache */
/* cache size info from Cache Size ID register (CCSIDR) */
#define ARMV7_CCSID_LINESIZE_MSK 0x7 /* line size bit mask */
#define ARMV7_CCSID_WAYNUM_MSK 0x1FF8 /* associativity bit mask */
#define ARMV7_CCSID_SETNUM_MSK 0xFFFE000 /* set number bit mask */
#define ARMV7_CCSID_MODE_MSK 0xF0000000 /* mode bit mask */
#define ARMV7_CCSID_WAYNUM_SHFT 3 /* associativity field shift */
#define ARMV7_CCSID_SETNUM_SHFT 13 /* set number field shift */
#define ARMV7_CCSID_MODE_WT 0x80000000 /* write-through mode */
#define ARMV7_CCSID_MODE_WB 0x40000000 /* write-back mode */
#define ARMV7_CCSID_MODE_RA 0x20000000 /* read-allocate mode */
#define ARMV7_CCSID_MODE_WA 0x10000000 /* write-allocate mode */
/*
* Common routines for Arm Arch7 Cache support
*
* Note that many of the Arch 6 routines are still valid for Arch 7 and
* have been brought forward.
*/
extern STATUS cacheAimArch7IEnable (void);
extern STATUS cacheAimArch7DEnable (void);
extern STATUS cacheAimArch7IDisable (void);
extern STATUS cacheAimArch7DDisable (void);
extern STATUS cacheAimArch7IProbe (void);
extern STATUS cacheAimArch7DProbe (void);
extern BOOL cacheAimArch7IIsOn (void);
extern BOOL cacheAimArch7DIsOn (void);
extern STATUS cacheAimArch7TextUpdate (void * start,
UINT32 count,
UINT32 IcacheLineSize,
UINT32 DcacheLineSize);
extern void * cacheAimArch7DmaMalloc (size_t bytes);
extern STATUS cacheAimArch7DmaFree (void * pBuf);
extern BOOL cacheAimArch7MmuIsOn (void);
extern STATUS cacheAimArch6DInvalidate (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch7DInvalidateAll (void);
extern STATUS cacheAimArch6IInvalidate (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch6IInvalidateAll (void);
extern STATUS cacheAimArch6DFlush (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch7DFlushAll (void);
extern STATUS cacheAimArch7DFlushPoU (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch6DClear (void * start, void * end, UINT32 step);
extern STATUS cacheAimArch7DClearAll (void);
extern STATUS cacheAimArch6PipeFlush (void);
extern void cacheAimArch7IMB (void);
extern void cacheAimArch6IClearDisable (void);
extern UINT32 cacheAimArch7Identify (UINT32 level);
extern UINT32 cacheAimArch7SizeInfoGet (UINT32 level, UINT32 type);
extern STATUS cacheArchIInvalidate(void * start, void * end, UINT32 step);
extern STATUS cacheArchIInvalidateAll(void);
extern STATUS cacheArchDFlush(void * start, void * end, UINT32 step);
extern STATUS cacheArchDFlushAll(void);
extern STATUS cacheArchDInvalidate(void * start, void * end, UINT32 step);
extern STATUS cacheArchDInvalidateAll(void);
extern STATUS cacheArchDClear(void * start, void * end, UINT32 step);
extern STATUS cacheArchDClearAll (void);
extern STATUS cacheArchPipeFlush (void);
extern size_t cacheArchLocSizeGet (void);
extern size_t cacheArchLouSizeGet (void);
extern FUNCPTR sysCacheLibInit;
extern UINT32 cacheArchState;
/*
* Core-specific function pointers for ARMv7 multilevel cache handling.
* These must be initialized by the cacheAim<core>LibInit() routine.
*/
extern VOIDFUNCPTR _func_cacheAimArch7IClearDisable;
extern VOIDFUNCPTR _func_cacheAimArch7DClearDisable;
extern void (*_pSysL2CacheEnable)(CACHE_TYPE cacheType);
extern void (*_pSysL2CacheDisable)(CACHE_TYPE cacheType);
extern void (*_pSysL2CacheInvFunc)(CACHE_TYPE cacheType, void * start, void * end);
extern void (*_pSysL2CacheFlush)(CACHE_TYPE cacheType, void * start, void * end);
extern void (*_pSysL2CacheClear)(CACHE_TYPE cacheType, void * start, void * end);
extern void cacheArchL2CacheEnable(void);
extern void cacheArchL2CacheDisable(void);
extern BOOL cacheArchL2CacheIsOn(void);
#else /* _ASMLANGUAGE */
/*
* Using "#" in the middle of a complex #define generates garbage
* passed to the assembler which results in a syntax error. ARM_IMM is
* used by this file in order to tell the assembler to use an immediate
* value.
*/
#define ARM_IMM #
#define ARM_LOC_MASK #0x7000000 /* level of coherency mask of CLIDR */
/*
* Common code for cache operations on entire data/unified caches,
* performed by set/way to the point of coherency (PoC).
* This code is based on 'Example code for cache maintenance operations'
* provided in "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition
* (ARM DDI 0406)" .
*
* Registers used: For ARM ISA, r0-r8, though r4-r8 are saved/restored.
* For THUMB-2, r0-r9, though r4-r9 are saved/restored.
* Also, note that r0 is 0 when this code completes.
*/
#if ARM_THUMB2 /* LSL is less capable in Thumb-2 */
#define _CORTEX_AR_ENTIRE_DATA_CACHE_OP(crm) \
STMFD sp!, {r4-r9} /* save registers */;\
\
MRC p15, 1, r0, c0, c0, 1 /* r0 = Cache Lvl ID register info */;\
ANDS r3, r0, ARM_LOC_MASK /* get level of coherency (LoC) */;\
MOV r3, r3, LSR ARM_IMM 23 /* r3 = LoC << 1 */;\
BEQ 5f ;\
\
MOV r7, ARM_IMM 0 /* r7 = cache level << 1; start at 0 */;\
\
1: ;\
AND r1, r0, ARM_IMM 0x7 /* r1 = cache type(s) for this level */;\
CMP r1, ARM_IMM 2 ;\
BLT 4f /* no data cache at this level */;\
\
MCR p15, 2, r7, c0, c0, 0 /* select the Cache Size ID register */;\
ISB /* ISB: sync change to Cache Size ID */;\
MRC p15, 1, r1, c0, c0, 0 /* r1 = current Cache Size ID info */;\
AND r2, r1, ARM_IMM 0x7 /* r2 = line length */;\
ADD r2, r2, ARM_IMM 4 /* add line length offset = log2(16 bytes) */;\
LDR r4, =0x3FF ;\
ANDS r4, r4, r1, LSR ARM_IMM 3 /* r4 = (# of ways - 1); way index */;\
CLZ r5, r4 /* r5 = bit position of way size increment */;\
LDR r6, =0x00007FFF ;\
ANDS r6, r6, r1, LSR ARM_IMM 13/* r6 = (# of sets - 1); set index */;\
\
2: ;\
MOV r1, r4 /* r1 = working copy of way number */;\
3: ;\
LSL r9, r1, r5 /* r8 = set/way operation data word: */;\
ORR r8, r7, r9 ;\
LSL r9, r6, r2 /* cache level, way and set info */;\
ORR r8, r8, r9 ;\
\
MCR p15, 0, r8, c7, crm, 2 /* dcache operation by set/way */;\
\
SUBS r1, r1, ARM_IMM 1 /* decrement the way index */;\
BGE 3b ;\
SUBS r6, r6, ARM_IMM 1 /* decrement the set index */;\
BGE 2b ;\
\
4: ;\
ADD r7, r7, ARM_IMM 2 /* increment cache index = level << 1 */;\
CMP r3, r7 /* done when LoC is reached */;\
MOVGT r0, r0, LSR ARM_IMM 3 /* rt-align type of next cache level */;\
BGT 1b ;\
\
5: ;\
DSB ;\
LDMIA sp!, {r4-r9} /* restore registers */;
#else /* !ARM_THUMB2 */
#define _CORTEX_AR_ENTIRE_DATA_CACHE_OP(crm) \
STMFD sp!, {r4-r8} /* save registers */;\
\
MRC p15, 1, r0, c0, c0, 1 /* r0 = Cache Lvl ID register info */;\
ANDS r3, r0, ARM_LOC_MASK /* get level of coherency (LoC) */;\
MOV r3, r3, LSR ARM_IMM 23 /* r3 = LoC << 1 */;\
BEQ 5f ;\
\
MOV r7, ARM_IMM 0 /* r7 = cache level << 1; start at 0 */;\
\
1: ;\
AND r1, r0, ARM_IMM 0x7 /* r1 = cache type(s) for this level */;\
CMP r1, ARM_IMM 2 ;\
BLT 4f /* no data cache at this level */;\
\
MCR p15, 2, r7, c0, c0, 0 /* select the Cache Size ID register */;\
ISB /* ISB: sync change to Cache Size ID */;\
MRC p15, 1, r1, c0, c0, 0 /* r1 = current Cache Size ID info */;\
AND r2, r1, ARM_IMM 0x7 /* r2 = line length */;\
ADD r2, r2, ARM_IMM 4 /* add line length offset = log2(16 bytes) */;\
LDR r4, =0x3FF ;\
ANDS r4, r4, r1, LSR ARM_IMM 3 /* r4 = (# of ways - 1); way index */;\
CLZ r5, r4 /* r5 = bit position of way size increment */;\
LDR r6, =0x00007FFF ;\
ANDS r6, r6, r1, LSR ARM_IMM 13/* r6 = (# of sets - 1); set index */;\
\
2: ;\
MOV r1, r4 /* r1 = working copy of way number */;\
3: ;\
ORR r8, r7, r1, LSL r5 /* r8 = set/way operation data word: */;\
ORR r8, r8, r6, LSL r2 /* cache level, way and set info */;\
\
MCR p15, 0, r8, c7, crm, 2 /* dcache operation by set/way */;\
\
SUBS r1, r1, ARM_IMM 1 /* decrement the way index */;\
BGE 3b ;\
SUBS r6, r6, ARM_IMM 1 /* decrement the set index */;\
BGE 2b ;\
\
4: ;\
ADD r7, r7, ARM_IMM 2 /* increment cache index = level << 1 */;\
CMP r3, r7 /* done when LoC is reached */;\
MOVGT r0, r0, LSR ARM_IMM 3 /* rt-align type of next cache level */;\
BGT 1b ;\
\
5: ;\
DSB ;\
LDMIA sp!, {r4-r8} /* restore registers */;
#endif /*ARM_THUMB2*/
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArmArch7h */
+151
View File
@@ -0,0 +1,151 @@
/* cacheArmLib.h - ARM cache library header file */
/*
* Copyright (c) 1996-2008, 2010-2012, 2014 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
06jan14,c_l Improve cache operation. (VXW6-27040)
01w,17jul12,j_b Add Cortex-A15 cache support
01v,07feb12,c_l Fix compiling error. (WIND00294062)
01u,13jan11,m_h moving cacheArchAlignSize to arm.h
01t,29apr10,pad Moved extern C statement after include statements.
01s,02jul07,m_h Adding support for MPCore
01r,12jun08,j_b add Cortex-A/-R cache support
01q,22may06,m_h 946 Support
01p,22feb06,m_h Manzano Support
01o,28mar05,jb Adding 1136jfs Support
01n,25jan05,jb Removing in-advertant addition of 1136
01m,07dec04,jb Restructure for Base6
01l,01dec03,scm modify for AIM support...
01k,17dec02,jb Adding ARM10 and 926E support
01k,24jan03,jb Resolve SPR 81285 and 82533
01j,02oct01,jpd added definitions to support simplifications in source.
01i,12nov01,to added cacheArchIntMask (merged from AE)
01h,23jul01,scm change XScale name to conform to coding standards...
01g,11dec00,scm replace references to ARMSA2 with XScale
01f,01sep00,scm add sa2 support...
01e,07sep99,jpd added ARM920T support.
01d,24nov98,jpd added ARM940T, ARMSA1100, ARMSA1500 support;
cdp restructured for multiple cache/MMU libraries.
01c,09mar98,jpd tidied.
01b,16sep97,jpd added cacheIMBRange(), 810 definitions for cacheDClear() and
cacheArchIntLock().
01a,09may96,cdp created
*/
/*
* N.B. although this library contains code written for the ARM810
* CPU, at the time of writing, this code has not been fully tested on
* that CPU. YOU HAVE BEEN WARNED.
*/
#ifndef __INCcacheArmLibh
#define __INCcacheArmLibh
#ifndef _ASMLANGUAGE
/*
* Variable used to hold the interrupt mask used when disabling
* interrupts for lengthy cache operations such as cache flushing. This
* is preinitialised to a mask that disables IRQs and FIQs. The BSP may
* change this. Do not do so unless you are sure that you understand the
* consequences. In particular, if interrupts are allowed to occur
* during these operations, the state of the cache afterwards may be
* indeterminate.
*/
IMPORT UINT32 cacheArchIntMask;
/* routine that locks interrupts according to the mask above */
IMPORT UINT32 cacheArchIntLock (void);
#endif /* _ASMLANGUAGE */
/*
* Arm Arch HW specific bits used by cache routines...
*/
#define CACHE_MM_ENABLE (1<<0) /* MMU enable */
#define CACHE_DC_ENABLE (1<<2) /* (data) cache enable */
#define CACHE_WB_ENABLE (1<<3) /* write buffer enable */
#define CACHE_IC_ENABLE (1<<12) /* Instruction cache enable */
#define LoC_MASK 0x07000000 /* level of coherency mask of CLIDR */
#define LoC_SHIFT 23 /* level of coherency shift of CLIDR */
#define LoUU_MASK 0x38000000 /* level of coherency mask of CLIDR */
#define LoUU_SHIFT 26 /* level of coherency shift of CLIDR */
/*
* Reset Architecture specific cache behavior.
* It is set with the cpu include file.
*/
#undef ARMCACHE_NOT_COHERENT
#undef ARMCACHE_HAS_WRITETHROUGH
#undef ARMCACHE_HAS_MINICACHE
#undef ARMCACHE_NEEDS_IMB
#if (ARMCACHE == ARMCACHE_926E)
#include "cacheArm926eLib.h"
#elif (ARMCACHE == ARMCACHE_946E)
#include "cacheArm946eLib.h"
#elif (ARMCACHE == ARMCACHE_920T)
#include "cacheArm920tLib.h"
#elif (ARMCACHE == ARMCACHE_940T)
#include "cacheArm940tLib.h"
#elif (ARMCACHE == ARMCACHE_1022E)
#include "cacheArm1022eLib.h"
#elif (ARMCACHE == ARMCACHE_1136JF)
#include "cacheArm1136jfLib.h"
#elif (ARMCACHE == ARMCACHE_XSCALE)
#include "cacheArmXSCALELib.h"
#elif (ARMCACHE == ARMCACHE_MANZANO)
#include "cacheArmManzanoLib.h"
#elif (ARMCACHE == ARMCACHE_CORTEXA8)
#include "cacheCortexA8Lib.h"
#elif (ARMCACHE == ARMCACHE_11MPCORE)
#include "cacheArm11MPCoreLib.h"
#elif (ARMCACHE == ARMCACHE_CORTEXA15)
#include "cacheCortexA15Lib.h"
#endif /* ARMCACHE == ARMCACHE_926E */
#ifdef __cplusplus
extern "C" {
#endif
#if (ARMCACHE != ARMCACHE_NONE)
/*
* Verify the cpu has established some special attributes
*/
#ifndef ARMCACHE_NOT_COHERENT
#error ARMCACHE value not supported in definition of ARMCACHE_NOT_COHERENT
#endif
#ifndef ARMCACHE_HAS_WRITETHROUGH
#error ARMCACHE value not supported in definition of ARMCACHE_HAS_WRITETHROUGH
#endif
#ifndef ARMCACHE_HAS_MINICACHE
#define ARMCACHE_HAS_MINICACHE FALSE
#endif
#ifndef ARMCACHE_NEEDS_IMB
#error ARMCACHE value not supported in definition of ARMCACHE_NEEDS_IMB
#endif
#endif /* ARMCACHE_NONE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArmLibh */
@@ -0,0 +1,78 @@
/* cacheArmManzanoLib.h - ARM XScale cache library header file */
/* Copyright 199-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01i,22feb06,m_h Manzano Support
01h,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01g,07dec04,jb Further Palify ARM Aim cache
01f,01dec03,scm flushing out aim...
01e,25jul01,scm add btbInvalidate...
01d,23jul01,scm change XScale name to conform to coding standards...
01c,09feb01,scm add support for cache & TLB locking...
01b,19dec00,scm correct cache sizes...
01a,31aug00,scm created
*/
#ifndef __INCcacheArmManzanoLibh
#define __INCcacheArmManzanoLibh
#ifdef __cplusplus
extern "C" {
#endif
#define D_CACHE_SIZE (32*1024) /* 32 kbytes DCache */
#define I_CACHE_SIZE (32*1024) /* 32 kbytes ICache */
#define MINI_CACHE_SIZE (2*1024) /* 2 kbytes minicache */
#define MINI_CACHE_LINE_SIZE 32 /* 32 bytes per line*/
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Has a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE TRUE
/*
* Does not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB FALSE
#ifndef _ASMLANGUAGE
IMPORT void cacheArmManzanoLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
/* definitions to allow for non-cacheAim direct calls */
#define cacheArmManzanoDClearDisable cacheAimManzanoDClearDisable
#define cacheArmManzanoIClearDisable cacheAimManzanoIClearDisable
IMPORT void cacheAimManzanoDClearDisable (void);
IMPORT void cacheAimManzanoIClearDisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArmManzanoLibh */
@@ -0,0 +1,77 @@
/* cacheArmXSCALELib.h - ARM XScale cache library header file */
/* Copyright 199-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01h,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01g,07dec04,jb Further Palify ARM Aim cache
01f,01dec03,scm flushing out aim...
01e,25jul01,scm add btbInvalidate...
01d,23jul01,scm change XScale name to conform to coding standards...
01c,09feb01,scm add support for cache & TLB locking...
01b,19dec00,scm correct cache sizes...
01a,31aug00,scm created
*/
#ifndef __INCcacheArmXSCALELibh
#define __INCcacheArmXSCALELibh
#ifdef __cplusplus
extern "C" {
#endif
#define D_CACHE_SIZE (32*1024) /* 32 kbytes DCache */
#define I_CACHE_SIZE (32*1024) /* 32 kbytes ICache */
#define MINI_CACHE_SIZE (2*1024) /* 2 kbytes minicache */
#define MINI_CACHE_LINE_SIZE 32 /* 32 bytes per line*/
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Has a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE TRUE
/*
* Does not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB FALSE
#ifndef _ASMLANGUAGE
IMPORT void cacheArmXSCALELibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
/* definitions to allow for non-cacheAim direct calls */
#define cacheArmXSCALEDClearDisable cacheAimXSCALEDClearDisable
#define cacheArmXSCALEIClearDisable cacheAimXSCALEIClearDisable
IMPORT void cacheAimXSCALEDClearDisable (void);
IMPORT void cacheAimXSCALEIClearDisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheArmXSCALELibh */
@@ -0,0 +1,110 @@
/* cacheCortexA15Lib.h - Cortex-A15 cache library header file */
/*
* Copyright 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01b,31aug12,ggm Added SMP support.
01a,14jul12,j_b Created from cacheCortexA8Lib.h, rev 01c
*/
#ifndef __INCcacheCortexA15Libh
#define __INCcacheCortexA15Libh
/*
* Include ARCH7 common defines.
*/
#include "arch/arm/cacheArmArch7.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Does need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB TRUE
/*
* Most of the cache designs are virtually addressed, but some newer
* ones have physically addressed caches. Note that this is the method of
* addressing, not whether the cache has physical address tags within
* it.
*/
#define ARMCACHE_IS_PHYSICALLY_ADDRESSED TRUE
#ifndef _ASMLANGUAGE
IMPORT void cacheCortexA15LibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void cacheCortexA15DClearDisable (void); /* includes L2 cache */
/* L2 Cache support functions */
IMPORT UINT32 cacheCortexA15L2CacrGet (void);
IMPORT void cacheCortexA15L2CacrSet (UINT32 cacr);
IMPORT UINT32 cacheCortexA15L2EcrGet (void);
IMPORT void cacheCortexA15L2EcrSet (UINT32 ecr);
IMPORT void cacheCortexA8L2ClearAll (void);
/* CPU ID access function and definitions */
IMPORT UINT32 mmuReadId (void);
/* SMP support functions */
#ifdef _WRS_CONFIG_SMP
IMPORT void cacheCortexA15MPCoreSMPInit(void);
#endif
#define MAIN_ID_PART_MASK 0xFFF0
#define MAIN_ID_PART_SHIFT 0x4
#define MAIN_ID_PART_CORTEXA15 0xC0F
/* Auxiliary Control Register access functions and definitions */
IMPORT UINT32 mmuCortexA8AcrGet (void);
IMPORT void mmuCortexA8AcrSet (UINT32 acrVal);
/* enable invalidation of branch tgt buffer with I-cache invalidate */
#define ACTLR_BTB_INVAL_EN 0x1
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheCortexA15Libh */
@@ -0,0 +1,87 @@
/* cacheCortexA8Lib.h - Cortex-A8 cache library header file */
/*
* Copyright 2008, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,23sep10,j_b add cacheCortexL2ClearAll() prototype
01b,29apr10,pad Moved extern C statement after include statements.
01a,03jun08,j_b Created from cacheArm1136jfLib.h, rev 01b
*/
#ifndef __INCcacheCortexA8Libh
#define __INCcacheCortexA8Libh
/*
* Include ARCH7 common defines.
*/
#include "arch/arm/cacheArmArch7.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/*
* This is a writethrough cache
*/
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/*
* Does not have a mini-cache
*/
#define ARMCACHE_HAS_MINICACHE FALSE
/*
* Do not need an Instruction Memory Barrier
*/
#define ARMCACHE_NEEDS_IMB TRUE
/*
* Most of the cache designs are virtually addressed, but some newer
* ones have physically addressed caches. Note that this is the method of
* addressing, not whether the cache has physical address tags within
* it.
*/
#define ARMCACHE_IS_PHYSICALLY_ADDRESSED TRUE
#ifndef _ASMLANGUAGE
IMPORT void cacheCortexA8LibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void cacheCortexA8DClearDisable (void); /* includes L2 cache */
/* L2 Cache support functions */
IMPORT UINT32 cacheCortexA8L2CacrGet (void);
IMPORT void cacheCortexA8L2CacrSet (UINT32 cacr);
IMPORT void cacheCortexA8L2Enable (void);
IMPORT void cacheCortexA8L2Disable (void);
IMPORT void cacheCortexA8L2ClearAll (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheCortexA8Libh */
@@ -0,0 +1,75 @@
/* cacheCortexA9Lib.h - Cortex-A9 cache library header file */
/*
* Copyright (c) 2009, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,29apr10,pad Moved extern C statement after include statements.
01b,20oct09,z_l Created from cacheCortexA8Lib.h, rev 01a
*/
#ifndef __INCcacheCortexA9Libh
#define __INCcacheCortexA9Libh
/* Include ARCH7 common defines. */
#include "arch/arm/cacheArmArch7.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some cache designs (e.g. Harvard) have D-cache either fully or
* partially not coherent with I-cache
*/
#define ARMCACHE_NOT_COHERENT TRUE
/* This is a writethrough cache */
#define ARMCACHE_HAS_WRITETHROUGH TRUE
/* Does not have a mini-cache */
#define ARMCACHE_HAS_MINICACHE FALSE
/* Do not need an Instruction Memory Barrier */
#define ARMCACHE_NEEDS_IMB TRUE
/*
* Most of the cache designs are virtually addressed, but some newer
* ones have physically addressed caches. Note that this is the method of
* addressing, not whether the cache has physical address tags within
* it.
*/
#define ARMCACHE_IS_PHYSICALLY_ADDRESSED TRUE
#ifndef _ASMLANGUAGE
IMPORT void cacheCortexA9LibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void cacheCortexA9DClearDisable (void);
/* SMP support functions */
#ifdef _WRS_CONFIG_SMP
IMPORT void cacheCortexA9MPCoreSMPInit(void);
#endif /* _WRS_CONFIG_SMP */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheCortexA9Libh */
+45
View File
@@ -0,0 +1,45 @@
/* coprocArm.h - coprocessor management library header */
/*
* Copyright (c) 2004-2007, 2010, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01f,15may12,jmp CQID: Fix WIND00309977 : Added VX_COPROCS_ALL_TASK
definition.
01e,28apr10,pad Moved extern C statement after include statements.
01d,02oct07,jb Move VFP to FP equivilent, part of fix for WIND00093069
01c,30jun05,scm add support for ARM VFP...
01b,04aug04,scm fix permissions...
01a,03aug04,scm written based on coprocI86.h 01a.
*/
#ifndef __INCcoprocArmh
#define __INCcoprocArmh
/* includes */
#include <taskLib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#define VX_FP_TASK VX_COPROC1_TASK
#define VX_VFP_TASK VX_FP_TASK
#define VX_COPROCS_ALL_TASK VX_FP_TASK
#ifdef __cplusplus
}
#endif
#endif /* __INCcoprocArmh */
+110
View File
@@ -0,0 +1,110 @@
/* dbgArmLib.h - header file for ARM-dependent part of debugger */
/*
* Copyright 1996-2004, 2005, 2010, 2013 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use of this
* software may be licensed only pursuant to the terms of an applicable Wind
* River license agreement.
*/
/*
modification history
--------------------
01j,26may13,pma Update for ARMARCH7M
01i,26jul10,jdw Update with support for THUMB2
01h,29apr10,pad Moved extern C statement after include statements.
01g,24feb05,jb Correct definition of SYSCALL_INST
01f,09dec04,scm resolve DBG_SYSCALL_SIZE warning, define DBG_SYSCALL_INST
01e,11feb04,elg Add syscall instruction size macro.
01d,12nov98,cdp added support for ARM generic Thumb library.
01c,20apr98,dbt modified for new breakpoint scheme
01b,24apr97,cdp added Thumb (ARM7TDMI_T) support;
changed DBG_BREAK_INST for non-Thumb processors.
01a,09may96,cdp created
*/
#ifndef __INCdbgArmLibh
#define __INCdbgArmLibh
#include "esf.h"
#ifdef __cplusplus
extern "C" {
#endif
#define BREAK_ESF ESF
#define TRACE_ESF ESF
#define DBG_SYSCALL_SIZE (sizeof (INSTR) / sizeof (INSTR))
#if (ARM_THUMB2)
#define DBG_SYSCALL_INST 0xDF00 /* SVC */
#define DBG_SYSCALL_MASK 0xFF00
#else /* (ARM_THUMB2) */
#define DBG_SYSCALL_INST 0xEF0000FA /* SVC (formerly SWI) */
#endif /* (ARM_THUMB2) */
#if (ARM_THUMB2)
/*
* For Thumb2 we can not support cret() without a valid frame pointer so
* support is disabled here.
*/
#define DBG_CRET FALSE
#endif /* (ARM_THUMB2) */
#if (ARM_THUMB) || (ARM_THUMB2)
/*
* TODO -- The WDB code which inserts breakpoints needs to be smarter
* than it is. We need to use a 16- or 32-bit value depending on the
* instruction we are going to break on.
*/
#define DBG_BREAK_INST 0xDEFE /* The undefined instruction used as a
* breakpoint for Thumb-state */
#define DBG_INST_ALIGN 2
#else /* (ARM_THUMB) || (ARM_THUMB2) */
#define DBG_BREAK_INST 0xE7FDDEFE /* The undefined instruction used as a
* breakpoint for ARM-state */
#define DBG_INST_ALIGN 4
#endif /* (ARM_THUMB) || (ARM_THUMB2) */
#define DBG_NO_SINGLE_STEP 1 /* no hardware trace support */
#if (CPU == ARMARCH7M)
#define BRK_INST 0x0 /* hardware instruction breakpoint */
#define DEFAULT_HW_BP (BRK_INST) /* default hardware breakpoint */
#define BRK_HARDWARE (0x10) /* hardware breakpoint bit */
#define BRK_HARDMASK (0x0f) /* hardware breakpoint mask */
#define DBG_HARDWARE_BP 1
#ifdef DBG_NO_SINGLE_STEP
#undef DBG_NO_SINGLE_STEP
#endif
#define DBG_NO_SINGLE_STEP 0 /* no trace support */
#define MAX_HW_BP_NUM 6
#ifndef _ASMLANGUAGE
/* hardware breakpoint registers */
typedef struct /* DBG_REGS */
{
unsigned int fp_compx[MAX_HW_BP_NUM]; /* debug register: flash patch */
} DBG_REGS;
#endif /* _ASMLANGUAGE */
#endif /* ARMARCH7M */
#ifdef __cplusplus
}
#endif
#endif /* __INCdbgArmLibh */
+127
View File
@@ -0,0 +1,127 @@
/* dsmArmLib.h - ARM disassembler header file */
/*
* Copyright (c) 1996-2005, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01c,19oct10,jmp Updated INSTR_IS() macro to use VXDBG_INSTR_CMP()
(CQ:WIND00185617).
01b,29apr10,pad Moved extern C statement after include statements.
01a,14jan05,rec add print function to dsmInst
01c,09oct97.jpd added more Thumb instructions.
01b,09sep97,cdp added more instructions.
01a,09may96,cdp created.
*/
#ifndef __INCdsmArmLibh
#define __INCdsmArmLibh
#include <vwModNum.h>
#ifdef __cplusplus
extern "C" {
#endif
/* dsmLib status codes */
#define S_dsmLib_UNKNOWN_INSTRUCTION (M_dsmLib | 1)
/*
* Macro and definitions for simple decoding of instuctions.
* To check an instruction, it is ANDed with the IMASK_ and
* the result is compared with the IOP_. The macro INSTR_IS
* does this and returns !0 to indicate a match.
*/
#define INSTR_IS(pInstr,o) VXDBG_INSTR_CMP(pInstr,(IOP_##o),(IMASK_##o))
#define IMASK_BL 0x0F000000 /* BL xxx */
#define IOP_BL 0x0B000000
#define IMASK_STMDB_SPP_FP_IP_LR_PC 0xFFFFF800 /* STMDB sp!,{..fp,ip,lr,pc} */
#define IOP_STMDB_SPP_FP_IP_LR_PC 0xE92DD800
#define IMASK_SUB_FP_IP_4 0xFFFFFFFF /* SUB fp,ip,#4 */
#define IOP_SUB_FP_IP_4 0xE24CB004
#define IMASK_SUB_FP_IP_4PLUS 0xFFFFF000 /* SUB fp,ip,#4+ */
#define IOP_SUB_FP_IP_4PLUS 0xE24CB000
#define IMASK_MOV_IP_SP 0xFFFFFFFF /* MOV ip,sp */
#define IOP_MOV_IP_SP 0xE1A0C00D
#define IMASK_MOVXX_LR_PC 0x0FFFFFFF /* MOVxx lr,pc */
#define IOP_MOVXX_LR_PC 0x01A0E00F
#define IMASK_STMDB_SPP_AREGS 0xFFFFFFF0 /* STMDB sp!,{a1-a4} */
#define IOP_STMDB_SPP_AREGS 0xE92D0000
#define IMASK_SUB_SP_SP 0xFFFFF000 /* SUB sp,sp,#n */
#define IOP_SUB_SP_SP 0xE24DD000
#define IMASK_MOVS_PC_LR 0xFFFFFFFF /* MOVS pc,lr */
#define IOP_MOVS_PC_LR 0xE1B0F00E
/* Thumb instructions */
#define IMASK_T_BL0 0xF800 /* BL prefix */
#define IOP_T_BL0 0xF000
#define IMASK_T_BL1 0xF800 /* BL */
#define IOP_T_BL1 0xF800
#define IMASK_T_MOV_LR_PC 0xFFFF /* MOV lr,pc */
#define IOP_T_MOV_LR_PC 0x46FE
#define IMASK_T_SUB_SP_16 0xFFFF /* SUB sp,#16 */
#define IOP_T_SUB_SP_16 0xB084
#define IMASK_T_MOV_FP_LO 0xFFC7 /* MOV fp,loreg */
#define IOP_T_MOV_FP_LO 0x4683
#define IMASK_T_MOV_SP_LO 0xFFC7 /* MOV sp,loreg */
#define IOP_T_MOV_SP_LO 0x4685
#define IMASK_T_ADD_LO_SP 0xF800 /* ADD loreg, sp, #Imm */
#define IOP_T_ADD_LO_SP 0xA800
#define IMASK_T_POP_LO 0xFF00 /* POP {reglist} (not PC) */
#define IOP_T_POP_LO 0xBC00
#define IMASK_T_PUSH_LO 0xFF00 /* PUSH {reglist} (not LR) */
#define IOP_T_PUSH_LO 0xB400
#define IMASK_T_PUSH 0xFF00 /* PUSH {reglist} (inc LR) */
#define IOP_T_PUSH 0xB500
#define IMASK_T_BX_LO 0xFFC0 /* BX loreg */
#define IOP_T_BX_LO 0x4700
#define IMASK_T_MOV_LO_PC 0xFFF8 /* MOV loreg,pc */
#define IOP_T_MOV_LO_PC 0x4678
#define IMASK_T_MOV_LO_FP 0xFFF8 /* MOV loreg,fp */
#define IOP_T_MOV_LO_FP 0x4658
IMPORT int dsmNbytes(FAST INSTR *binInst);
IMPORT int dsmInst(FAST INSTR *binInst, int address, VOIDFUNCPTR prtAddress,
FUNCPTR oFn, int oArg);
#ifndef _ASMLANGUAGE
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCdsmArmLibh */
+100
View File
@@ -0,0 +1,100 @@
/* elfArm.h - ARM-specific elf loader header */
/*
* Copyright (c) 2001,2004-2005,2009-2010 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software may be
* licensed only pursuant to the terms of an applicable Wind River license
* agreement.
*/
/*
modification history
--------------------
01g,11oct10,v_r Added support for the R_ARM_CALL and R_ARM_THM_JUMP24
relocation types (CQ:WIND00234720).
Removed unused types (by both the kernel loader and the
userspace shared lib loader).
01f,14dec09,pgh Add EM_ARCH_MACHINE_x macro definition.
01e,25jul05,v_r Updated copyright.
01d,18feb05,dbt Cleanup.
01c,18sep04,jn Move towards shared code for host and target loaders
01b,17feb04,jn Merged version from AE.
01b,30nov01,pad Moved definitions of CHECK_FITS and SIGN_EXTEND into
loadElfLibP.h
01a,24aug01,jn created, based on vxWorksAE 1.1
share/src/loader/elfArm.h@@/main/tor3_x/5
*/
#ifndef __INCelfArmh
#define __INCelfArmh
#ifdef __cplusplus
extern "C" {
#endif
/*
* macro to check that a signed <val> fits in <nBits> without overflow
* i.e. that the "sign-bit" is correctly propagated into the excess high bits
*/
#define CHECK_FITS(val,nBits) \
((((val) & ~((1 << ((nBits)-1))-1)) == 0) || \
(((val) & ~((1 << ((nBits)-1))-1)) == ~(UINT32)((1 << ((nBits)-1))-1)))
/* macros to insert the low n bits of a value into a buffer. */
#define LOW24_INSERT(buf,value) INSERT ((buf), (value), 0x00ffffff)
#define LOW16_INSERT(buf,value) INSERT ((buf), (value), 0x0000ffff)
#define LOW12_INSERT(buf,value) INSERT ((buf), (value), 0x00000fff)
#define LOW11_INSERT(buf,value) INSERT ((buf), (value), 0x000007ff)
#define LOW8_INSERT(buf,value) INSERT ((buf), (value), 0x000000ff)
#define BITS6_10_INSERT(buf,value) INSERT ((buf), (value) << 6, 0x000007c0)
#define UBIT_INSERT(buf,value) INSERT ((buf), (value) << 23 , 0x0080000)
/*
* The following macro defines the ELF machine type value that can be loaded
* into an ARM CPU.
*/
#define EM_ARCH_MACHINE_1 EM_ARM
#define EM_ARCH_MACHINE EM_ARM
#define EM_ARCH_MACH_ALT EM_ARM /* not used */
/* Relocation Type Definitions */
#define R_ARM_NONE 0 /* No reloc */
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
#define R_ARM_REL32 3
#define R_ARM_PC13 4
#define R_ARM_ABS16 5
#define R_ARM_ABS12 6
#define R_ARM_THM_ABS5 7
#define R_ARM_ABS8 8
#define R_ARM_THM_PC22 10
#define R_ARM_THM_PC8 11
#define R_ARM_COPY 20 /* copy symbol at runtime */
#define R_ARM_GLOB_DAT 21 /* create GOT entry */
#define R_ARM_JUMP_SLOT 22 /* create PLT entry */
#define R_ARM_RELATIVE 23 /* adjust by program base */
#define R_ARM_CALL 28
#define R_ARM_THM_JUMP24 30
#define R_ARM_THM_PC11 102 /* cygnus extension to abi: */
/* thumb unconditional branch */
#define R_ARM_THM_PC9 103 /* cygnus extension to abi: */
/* thumb conditional branch */
#ifdef __cplusplus
}
#endif
#endif /* __INCelfArmh */
+64
View File
@@ -0,0 +1,64 @@
/* esfArm.h - ARM exception stack frames */
/*
* Copyright (c) 1996, 2004, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01e,09may12,j_b enable ARMARCH7M-specific header usage
01d,03may12,j_b revert to remove ARMARCH7M-specific header usage
01c,01may12,j_b Update for ARMv7M
01b,09sep04,scm add ttbase to ESF, so structs REG_SET & ESF overlap correctly
01a,09may96,cdp created
*/
#ifndef __INCesfArmh
#define __INCesfArmh
#if (CPU == ARMARCH7M)
#include "arch/arm/arm-m/esfArm-m.h"
#else /* (CPU == ARMARCH7M) */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/* The Exception Stack Frame
* On the ARM, this is faked by a stub and the pointer
* passed back points to the PC and CPSR at the end of the
* register structure. If that changes, so must this.
*
* I.E. REG_SET struct & ESf struct 'overlap' on last 3
* elements of REG_SET (pc,cpsr,ttbase)...
*/
typedef struct
{
INSTR *pc; /* program counter */
ULONG cpsr; /* current PSR */
ULONG ttbase; /* Trans Table Base */
UINT32 vecAddr; /* address of exception vector => type */
} ESF;
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* (CPU == ARMARCH7M) */
#endif /* __INCesfArmh */
+119
View File
@@ -0,0 +1,119 @@
/* excArmLib.h - ARM exception library header file */
/*
* Copyright (c) 1996-2003,2006,2009,2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01g,14may12,m_h enable ARMARCH7M-specific header usage
01f,23mar09,m_h Support for non-zero exception vector base
01e,01feb06,jb Adding VFP Support
01d,26nov03,pes Correct _WRS_IS_SUPV_EXC macro.
01c,18nov03,pes Add _WRS_IS_SUPV_EXC macro.
01b,23jul01,scm change XScale name to conform to coding standards...
01a,11dec00,scm replace references to ARMSA2 with XScale
01c,16oct00,scm reverse back I & F bits for SA2
01b,15sep00,scm update for SA2 support...
01a,09may96,cdp created
*/
#ifndef __INCexcArmLibh
#define __INCexcArmLibh
#if (CPU == ARMARCH7M)
#include "arch/arm/arm-m/excArmLib-m.h"
#else /* (CPU == ARMARCH7M) */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/*
* NOTE: if this structure changes, the TCB offsets in h/private/taskLibP.h
* must be updated. See also taskLib.h.
*/
typedef struct
{
UINT32 valid; /* indicators that following fields are valid */
UINT32 vecAddr; /* exception vector address */
INSTR * pc; /* PC */
UINT32 cpsr; /* CPSR */
} EXC_INFO;
#define _WRS_IS_SUPV_EXC() (((excInfo.cpsr & MASK_MODE) == MODE_USER32) ? FALSE : TRUE)
extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */
extern VOIDFUNCPTR _func_excBreakpoint; /* called to handle breakpoints */
extern void excVecBaseSet (UINT32 base); /* non-zero exception base address */
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS excIntConnect (VOIDFUNCPTR *, VOIDFUNCPTR);
extern void excVecSet (FUNCPTR *, FUNCPTR);
extern FUNCPTR excVecGet (FUNCPTR *);
#else /* __STDC__ */
extern STATUS excIntConnect ();
extern void excVecSet ();
extern FUNCPTR excVecGet ();
#endif /* __STDC__ */
#endif /* ASMLANGUAGE */
/* exception information valid bits */
#define EXC_INFO_VECADDR 0x01 /* vector is valid */
#define EXC_INFO_PC 0x02 /* PC is valid */
#define EXC_INFO_CPSR 0x04 /* CPSR is valid */
#define EXC_INFO_VFPCSR 0x08 /* VFP CSR is valid */
/* exception vector addresses */
#define EXC_OFF_RESET 0x00 /* reset */
#define EXC_OFF_UNDEF 0x04 /* undefined instruction */
#define EXC_OFF_SWI 0x08 /* software interrupt */
#define EXC_OFF_PREFETCH 0x0c /* prefetch abort */
#define EXC_OFF_DATA 0x10 /* data abort */
#define EXC_OFF_IRQ 0x18 /* interrupt */
#define EXC_OFF_FIQ 0x1C /* fast interrupt */
/* Exception Vector Base */
#define ARM_EXC_VEC_BASE 0x00
/*
* In coyanosa I80310 the default vector base is 0x00,
* can be relocated into 0xFFFF0000
*
*/
#if ((CPU==XSCALE) || (CPU==ARMSA110))
#define ARM_EXC_VEC_BASE_RELOCATED 0xffff0000
#endif
#ifdef __cplusplus
}
#endif
#endif /* (CPU == ARMARCH7M) */
#endif /* __INCexcArmLibh */
+64
View File
@@ -0,0 +1,64 @@
/* fppArmLib.h - ARM floating-point coprocessor support header file */
/*
* Copyright 1996, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01b,11jan12,jdw Update to call the VFP routines, WIND00327855
01a,09may96,cdp created
*/
#ifndef __INCfppArmLibh
#define __INCfppArmLibh
#include <arch/arm/vfpArmLib.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#define FP_CONTEXT VFP_CONTEXT
#define FPREG_SET FP_CONTEXT
/* variable declarations */
extern REG_INDEX fpRegName[]; /* f-point data register table */
extern REG_INDEX fpCtlRegName[]; /* f-point control register table */
extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */
extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */
extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
IMPORT void fppArchInit (void);
IMPORT void fppArchTaskCreateInit (FP_CONTEXT *pFpContext);
#else /* __STDC__ */
IMPORT void fppArchInit ();
IMPORT void fppArchTaskCreateInit ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCfppArmLibh */
+179
View File
@@ -0,0 +1,179 @@
/* in_cksum.h - x86 version in_cksum header file */
/* Copyright 2001-2002 Wind River Systems, Inc. */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from tahoe: in_cksum.c 1.2 86/01/05
* from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
* from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
* $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $
*/
/*
modification history
--------------------
01g,25aug05,dlk Add section tags.
01f,24mar04,m_h Internet Checksum
01e,18mar04,m_h move to arch/arm
01d,20nov03,niq Remove copyright_wrs.h file inclusion
01c,05nov03,rlm Ran batch header update for header re-org.
01b,25jul02,rvr removed DCC specific code
01a,13sep01,hsh Created from BSD 4.3
*/
#ifndef _MACHINE_IN_CKSUM_H_
#define _MACHINE_IN_CKSUM_H_ 1
#include <sys/cdefs.h>
/*
* in_cksum_hdr - checksum on header only
*
* It is useful to have an Internet checksum routine which is inlineable
* and optimized specifically for the task of computing IP header checksums
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
static __inline
u_int in_cksum_hdr
(
const struct ip *ip
)
{
register u_int sum = 0;
int hlen = sizeof (struct ip);
register u_short *w = (u_short *) ip;
u_short remaining = 0;
while (hlen > 1)
{
sum += *w++;
hlen -= 2;
}
if (hlen == 1)
{
*(u_char *) (&remaining) = *(u_char *) w;
sum += remaining;
}
sum = (sum & 0xffff) + (sum >> 16);
if (sum > 0xffff)
sum -= 0xffff;
return ~sum & 0xffff;
}
/*
* in_cksum_update
*/
static __inline
void in_cksum_update
(
struct ip *ip
)
{
int __tmpsum;
__tmpsum = (int)ntohs(ip->ip_sum) + 256;
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
}
/*
* in_pseudo - pre-checksum parts of pseudo-header
*
* Compute significant parts of the IPv4 checksum pseudo-header * for use in a
* delayed TCP/UDP checksum calculation.
*
* Args:
*
* src Source IP address
* dst Destination IP address
* lenproto htons(proto-hdr-len + proto-number)
*/
static __inline
u_int16_t in_pseudo
(
u_int32_t src,
u_int32_t dst,
u_int32_t lenproto
)
{
u_int32_t sum;
sum = lenproto +
(u_int16_t)(src >> 16) +
(u_int16_t)(src /*& 0xffff*/) +
(u_int16_t)(dst >> 16) +
(u_int16_t)(dst /*& 0xffff*/);
sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/);
if (sum > 0xffff)
sum -= 0xffff;
return (sum);
}
/*
* in_addword - Add two 16-bit workd
*
* Add the two 16-bit network-order values, carry, and return.
*/
static __inline
u_int16_t in_addword
(
u_int16_t a,
u_int16_t b
)
{
u_int32_t sum = a + b;
if (sum > 0xffff)
sum -= 0xffff;
return (sum);
}
_WRS_FASTTEXT
u_short in_cksum_skip(struct mbuf *m, int len, int skip);
#endif /* _MACHINE_IN_CKSUM_H_ */
+236
View File
@@ -0,0 +1,236 @@
/* intArmLib.h - ARM-specific interrupt library header file */
/*
* Copyright (c) 1997-1998, 2003, 2007-2010, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01l,07may12,jdw Add ARMARCH7M header include
01j,03dec10,j_b add unified FIQ/IRQ handling support
01i,23oct09,j_b fix _inline_intCpuMicroUnlock for gnu
01h,18may09,j_b add _inline_intCpuMicroLock/Unlock support
01h,25feb09,j_b merge ARM SMP support:
21jun07,jb3 Convert to vxBus
01g,16jun08,zl added memory clobber for GNUC version of inline routines.
01f,20may08,j_b fix memory accesses outside lock in
_inline_intCpuLock/Unlock for gnu (WIND00121559)
01e,07aug07,jb3 Defect00095620 wrong gnu assembler instruction.
01d,21jun07,zl updated inline build configuration.
01c,22aug03,to added inline intLock()/intUnlock().
01b,20aug98,cdp added intIFLock(), intIFUnlock().
01a,25nov97,cdp created.
*/
#ifndef __INCintArmLibh
#define __INCintArmLibh
#if (CPU == ARMARCH7M)
#include <arch/arm/arm-m/intArmLib.h>
#else /* (CPU == ARMARCH7M) */
#ifdef __cplusplus
extern "C" {
#endif
/* interrupt model feature selection bits (OR'd together) */
#define INT_NON_PREEMPT_MODEL 0
#define INT_PREEMPT_MODEL 1
#define INT_HDWE_LOCK_LVL 2
#ifndef _ASMLANGUAGE
/* inline intCpuLock()/intCpuUnlock() and intCpuMicroLock/Unlock() */
#if !(ARM_THUMB)
#if defined (__DCC__)
__asm volatile int _inline_intCpuLock ()
{
! "r1" /* r1 clobbered */
mrs r1, cpsr /* get current status */
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
and r0, r1, #0xC0 /* return current I & F in r0 */
orr r1, r1, #0xC0 /* set I & F (1<<7 | 1<<6) */
#else
and r0, r1, #0x80 /* return current I_BIT in r0 */
orr r1, r1, #0x80 /* set I_BIT (1<<7) */
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
msr cpsr, r1 /* set new status */
}
__asm volatile void _inline_intCpuUnlock (int key)
{
% reg key; /* input: key in r0 */
! "r0", "r1" /* r0, r1 clobbered */
mrs r1, cpsr /* get current status */
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
bic r1, r1, #0xC0 /* clear I & F (1<<7 | 1<<6) */
and r0, key, #0xC0 /* get passed I & F values */
#else
bic r1, r1, #0x80 /* clear I_BIT (1<<7) */
and r0, key, #0x80 /* get passed I_BIT value */
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
orr r1, r1, r0 /* or in passed value */
msr cpsr,r1 /* set new status */
}
__asm volatile int _inline_intCpuMicroLock ()
{
! "r1" /* r1 clobbered */
mrs r0, cpsr /* get, return current status */
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
orr r1, r0, #0xC0 /* set I & F (1<<7 | 1<<6) */
#else
orr r1, r0, #0x80 /* set I_BIT (1<<7) */
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
msr cpsr_c, r1 /* set new status */
}
__asm volatile void _inline_intCpuMicroUnlock (int key)
{
% reg key; /* input: key in r0 */
msr cpsr_c, key /* restore previous status */
}
#elif defined (__GNUC__)
static __inline__ int _inline_intCpuLock (void)
{
int key;
__asm__ volatile
(
"mrs r1, cpsr; " /* get current status */
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
"and %0, r1, #0xC0; " /* return current I & F */
"orr r1, r1, #0xC0; " /* set I & F (1<<7 | 1<<6) */
#else
"and %0, r1, #0x80; " /* return current I_BIT */
"orr r1, r1, #0x80; " /* set I_BIT (1<<7) */
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
"msr cpsr, r1 " /* set new status */
: "=&r" (key) /* output: key is %0 */
: /* no input */
: "r1", "memory" /* r1 clobbered; memory */
/* clobber for code barrier */
);
return key;
}
static __inline__ void _inline_intCpuUnlock (int key)
{
__asm__ volatile
(
"mrs r1, cpsr; " /* get current status */
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
"bic r1, r1, #0xC0; " /* clear I & F (1<<7 | 1<<6) */
"and r0, %0, #0xC0; " /* get passed I & F values */
#else
"bic r1, r1, #0x80; " /* clear I_BIT (1<<7) */
"and r0, %0, #0x80; " /* get passed I_BIT value */
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
"orr r1, r1, r0; " /* or in passed I_BIT value */
"msr cpsr, r1" /* set new status */
: /* no output */
: "r" (key) /* input: key is %0 */
: "r0", "r1", "memory" /* r0, r1 clobbered; memory */
/* clobber for code barrier */
);
}
static __inline__ int _inline_intCpuMicroLock (void)
{
int key;
__asm__ volatile
(
"mrs %0, cpsr; " /* get, return current status */
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
"orr r1, %0, #0xC0; " /* set I & F (1<<7 | 1<<6) */
#else
"orr r1, %0, #0x80; " /* set I_BIT (1<<7) */
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
"msr cpsr_c, r1 " /* set new status */
: "=&r" (key) /* output: key is %0 */
: /* no input */
: "r1", "memory" /* r1 clobbered; memory */
/* clobber for code barrier */
);
return key;
}
static __inline__ void _inline_intCpuMicroUnlock (int key)
{
__asm__ volatile
(
"msr cpsr_c, %0" /* restore previous status */
: /* no output */
: "r" (key) /* input: key is %0 */
/* no regs, memory clobbered */
);
}
#else
#define _inline_intCpuLock() intCpuLock()
#define _inline_intCpuUnlock(key) intCpuUnlock(key)
#define _inline_intCpuMicroLock() intCpuMicroLock()
#define _inline_intCpuMicroUnlock(key) intCpuMicroUnlock(key)
#endif /* __DCC__ */
#endif /* !ARM_THUMB */
/* functions in intArchLib.c and intALib.s */
extern STATUS intDisable (int);
extern STATUS intEnable (int);
extern STATUS intLibInit (int, int, int);
extern int intIFLock (void);
extern void intIFUnlock (int);
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
extern int intILock (void);
extern void intIUnlock (int);
extern int intFLock (void);
extern void intFUnlock (int);
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
/*
* Function pointers used in intArchLib.c and interrupt driver
*/
IMPORT FUNCPTR sysIntLvlVecChkRtn;
IMPORT FUNCPTR sysIntLvlVecAckRtn;
IMPORT FUNCPTR sysIntLvlChgRtn;
IMPORT FUNCPTR sysIntLvlEnableRtn;
IMPORT FUNCPTR sysIntLvlDisableRtn;
/*
* vxBus function pointers used in intArchLib.c and interrupt driver
*/
IMPORT FUNCPTR _func_IntLvlVecChkRtn;
IMPORT FUNCPTR _func_IntLvlVecAckRtn;
IMPORT FUNCPTR _func_IntLvlChgRtn;
IMPORT FUNCPTR _func_IntLvlEnableRtn;
IMPORT void * intCtlrDevID;
IMPORT FUNCPTR _func_IntLvlDisableRtn;
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* (CPU == ARMARCH7M) */
#endif /* __INCintArmLibh */
+32
View File
@@ -0,0 +1,32 @@
/* ivArm.h - ARM interrupt vectors */
/* Copyright 1996-1997 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,09may96,cdp created
*/
#ifndef __INCivArmh
#define __INCivArmh
#ifdef __cplusplus
extern "C" {
#endif
/* macros to convert interrupt vectors <-> interrupt numbers */
#define IVEC_TO_INUM(intVec) ((int) (intVec))
#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) (intNum))
/* interrupt vector definitions are in the BSP header files */
#ifdef __cplusplus
}
#endif
#endif /* __INCivArmh */
@@ -0,0 +1,117 @@
/* mmuArm1136jfLib.h - ARM 1136JF MMU library header file */
/*
* Copyright (c) 2004, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01d,20dec11,jdw Add missing APIs to clear up warnings related to ttbr APIs
01c,29apr10,pad Moved extern C statement after include statements.
01b,09feb10,j_b update mmuArm1136jfTtbrSet for ASID support
01a,07dec04,jb created
*/
#ifndef __INCmmuArm1136jfLibh
#define __INCmmuArm1136jfLibh
#include "memLib.h"
#define MMU_ID_ARM1136JF 0x07B360
#include "mmuArmArch6PalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* 1136JF Specific definitions follow */
/*
* Values to be used when mmuEnable() is called. This will be after the MMU has
* been initialised by sysInit()/romInit() and after cacheLib has set whatever
* cache enable settings have been chosen.
*
* M 1 Enable MMU
* A 0 Disable address alignment fault
* C X ((D-)Cache Enable) Controlled by cacheLib
* W X (Write Buffer) Controlled by cacheLib
* P 1 (PROG32) should be set before this
* D 1 (DATA32) should be set before this
* L 1 (Late abort on earlier CPUs) ignore
* B X (Big/Little-endian) should be set before this
* S 1 (System)
* R 0 (ROM)
* F 0 Should be Zero
* Z X (Branch prediction enable on 810) Controlled by cacheLib
* I X (I-cache enable) Controlled by cacheLib
*
* For time being, do not enable the address alignment fault, as GCC
* currently generates unaligned accesses in its code, and switching this
* on will cause immediate faults. So, do not put it into the enable
* mask.
*
* We used to clear all the Reserved/Should Be Zero bits when the
* MMU/MPU was enabled, by including one bits for them in the definition
* of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend
* the definitions of the bits within the MMU Control Register. The MMU
* Control register is initialised within romInit()/sysInit(), as the BSP
* is the only place where the particular details of the CPU/MMU are
* actually known. In general, it will be appropriate for the BSP to
* initialise the MMUCR Reserved/Should Be Zero bits to zero. When the
* MMU is enabled, we will only change the bits we are particularly
* concerned about, by using a Read-Modify-Write strategy.
*/
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE 0 /* This is specific to ARMARCH6 */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_EXTENDED_PAGE)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE | MMUCR_EXTENDED_PAGE)
#define MMU_MUST_SET_VALUE ( MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_W_ENABLE )
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
#define MMU_INIT_VALUE ( MMU_MUST_SET_VALUE | MMUCR_MODE)
#else
#define MMU_INIT_VALUE ( MMU_MUST_SET_VALUE | MMUCR_BIGEND | MMUCR_MODE)
#endif
#ifndef _ASMLANGUAGE
IMPORT void mmuArm1136jfLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void mmuArm1136jfTtbrSet (MMU_LEVEL_1_DESC *pTable, UINT32 asid);
IMPORT MMU_LEVEL_1_DESC * mmuArm1136jfTtbrGet (void);
IMPORT void mmuArm1136jfTtbrSetAll (UINT32 ttbr, UINT32 asid);
IMPORT UINT32 mmuArm1136jfTtbrGetAll (void);
IMPORT void mmuArm1136jfDacrSet (UINT32 dacrVal);
IMPORT void mmuArm1136jfTLBIDFlushEntry (VIRT_ADDR *addr);
IMPORT void mmuArm1136jfTLBIDFlushAll (void);
IMPORT void mmuArm1136jfAEnable (UINT32 cacheState);
IMPORT void mmuArm1136jfADisable (void);
IMPORT STATUS mmuArm1136jfPBitSet (VIRT_ADDR virtAddr, UINT32 size);
IMPORT STATUS mmuArm1136jfPBitClear (VIRT_ADDR virtAddr, UINT32 size);
IMPORT STATUS mmuArm1136jfPBitGet (VIRT_ADDR virtAddr );
IMPORT STATUS mmuArm1136jfAcrGet (void );
IMPORT void mmuArm1136jfAcrSet (UINT32 acrVal);
IMPORT STATUS mmuArm1136jfITcmrGet (void );
IMPORT void mmuArm1136jfITcmrSet (UINT32 acrVal);
IMPORT STATUS mmuArm1136jfDTcmrGet (void );
IMPORT void mmuArm1136jfDTcmrSet (UINT32 acrVal);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArm1136jfLibh */
@@ -0,0 +1,139 @@
/* mmuArm11MPCoreLib.h - ARM 11MPCORE MMU library header file */
/*
* Copyright (c) 2007, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01d,20dec11,jdw Add missing APIs to clear up warnings related to ttbr APIs
01c,29apr10,pad Moved extern C statement after include statements.
01b,09feb10,j_b update mmuArm11MPCoreTtbrSet for ASID support
01a,09jul07,j_b Written
*/
#ifndef __INCmmuArm11MPCoreLibh
#define __INCmmuArm11MPCoreLibh
#include "memLib.h"
#define MMU_ID_ARM11MPCORE 0x0FB024 /* from CP15 ID Code Register c0 */
#include "mmuArmArch6PalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* 11MPCORE Specific definitions follow */
/*
* Values to be used when mmuEnable() is called. This will be after the MMU has
* been initialised by sysInit()/romInit() and after cacheLib has set whatever
* cache enable settings have been chosen.
*
* M 1 Enable MMU
* A 0 Disable address alignment fault
* C X ((D-)Cache Enable) Controlled by cacheLib
* W 1 (Write Buffer - obsolete) Should be One
* P 1 (PROG32 - obsolete) Should be One
* D 1 (DATA32 - obsolete) Should be One
* L 1 (Late abort - obsolete) Should be One
* B 0 (Big/Little-endian - unsupported) Should be Zero
* S 0 (System protection - deprecated)
* R 0 (ROM protection - deprecated)
* F 0 Should be Zero
* Z X (Branch prediction) Controlled by cacheLib
* I X (I-cache enable) Controlled by cacheLib
* V 0 (Vector table location: Normal/High Address)
* RR 1 (Random/Round-Robin cache replacement - unsupported) Should be One
* L4 0 Load instructions to PC set T bit
* DT 1 (Data TCM enable - obsolete) Write has no effect; Read as One
* - 0 Should be Zero
* IT 1 (Instruction TCM enable - unsupported) Write has no effect; Read as One
* - 0 Should be Zero
* - 0 Should be Zero
* FI 0 (Fast Interrupt enable - obsolete) Should be Zero
* U 0 Disable Unaligned data access enable
* XP 1 Enable eXtended Page table configuration (disable subpage AP bits)
* VE 0 (VEctored Interrupt- unsupported) Should be Zero
* EE 0 E bit of CPSR upon Exception
* - 0 Should be Zero
* NM 0 Disable NMFI behavior for FIQs
* TR 0 Disable TEX Remapping
* FA 0 Disable Force AP[0] as access bit
* - 0 Should be Zero
* - 0 Should be Zero
*
* NOTE: All defined control register bits are set to 0 on Reset, except
* V, U and EE which are dependent on system configuration pin signal levels.
*
* For time being, do not enable the address alignment fault, as GCC
* currently generates unaligned accesses in its code, and switching this
* on will cause immediate faults. So, do not put it into the enable
* mask.
*
* We used to clear all the Reserved/Should Be Zero bits when the
* MMU/MPU was enabled, by including one bits for them in the definition
* of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend
* the definitions of the bits within the MMU Control Register. The MMU
* Control register is initialised within romInit()/sysInit(), as the BSP
* is the only place where the particular details of the CPU/MMU are
* actually known. In general, it will be appropriate for the BSP to
* initialise the MMUCR Reserved/Should Be Zero bits to zero. When the
* MMU is enabled, we will only change the bits we are particularly
* concerned about, by using a Read-Modify-Write strategy.
*/
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE 0 /* This is specific to ARMARCH6 */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_EXTENDED_PAGE)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE | MMUCR_EXTENDED_PAGE)
#define MMU_MUST_SET_VALUE ( MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_W_ENABLE )
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
#define MMU_INIT_VALUE ( MMU_MUST_SET_VALUE | MMUCR_MODE)
#else
#define MMU_INIT_VALUE ( MMU_MUST_SET_VALUE | MMUCR_BIGEND | MMUCR_MODE)
#endif
#ifndef _ASMLANGUAGE
IMPORT void mmuArm11MPCoreLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void mmuArm11MPCoreTtbrSet (MMU_LEVEL_1_DESC *pTable, UINT32 asid);
IMPORT MMU_LEVEL_1_DESC * mmuArm11MPCoreTtbrGet (void);
IMPORT void mmuArm11MPCoreTtbrSetAll (UINT32 ttbr, UINT32 asid);
IMPORT UINT32 mmuArm11MPCoreTtbrGetAll (void);
IMPORT void mmuArm11MPCoreDacrSet (UINT32 dacrVal);
IMPORT void mmuArm11MPCoreTLBIDFlushEntry (VIRT_ADDR *addr);
IMPORT void mmuArm11MPCoreTLBIDFlushAll (void);
IMPORT void mmuArm11MPCoreAEnable (UINT32 cacheState);
IMPORT void mmuArm11MPCoreADisable (void);
IMPORT STATUS mmuArm11MPCorePBitSet (VIRT_ADDR virtAddr, UINT32 size);
IMPORT STATUS mmuArm11MPCorePBitClear (VIRT_ADDR virtAddr, UINT32 size);
IMPORT STATUS mmuArm11MPCorePBitGet (VIRT_ADDR virtAddr);
IMPORT STATUS mmuArm11MPCoreAcrGet (void);
IMPORT void mmuArm11MPCoreAcrSet (UINT32 acrVal);
IMPORT STATUS mmuArm11MPCoreITcmrGet (void);
IMPORT void mmuArm11MPCoreITcmrSet (UINT32 acrVal);
IMPORT STATUS mmuArm11MPCoreDTcmrGet (void);
IMPORT void mmuArm11MPCoreDTcmrSet (UINT32 acrVal);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArm11MPCoreLibh */
@@ -0,0 +1,38 @@
/* mmuArm710aLib.h - ARM 710a MMU library header file */
/* Copyright 1998-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01c,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01b,20jan99,cdp removed support for old ARM libraries.
01a,24nov98,cdp created.
*/
#ifndef __INCmmuArm710aLibh
#define __INCmmuArm710aLibh
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
IMPORT void mmuArm710aLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void mmuArm710aTtbrSet (LEVEL_1_DESC *);
IMPORT void mmuArm710aDacrSet (UINT32 dacrVal);
IMPORT void mmuArm710aTLBIDFlushEntry (void *addr);
IMPORT void mmuArm710aTLBIDFlushAll (void);
IMPORT void mmuArm710aAEnable (UINT32 cacheState);
IMPORT void mmuArm710aADisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArm710aLibh */
@@ -0,0 +1,130 @@
/* mmuArm920tLib.h - ARM 920T MMU library header file */
/*
* Copyright (c) 1999, 2004, 2005, 2007, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01g,21dec11,jdw Update APIs to clear up warnings related to ttbr APIs
01f,29apr10,pad Moved extern C statement after include statements.
01e,25jan07,j_b add mmuArm920tTtbrGet prototype
01d,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01c,10feb05,jb Reverting to ROM mode for shared data/libraries
01b,09dec04,jb Palify Arm MMU
01a,04feb99,jpd created.
*/
#ifndef __INCmmuArm920tLibh
#define __INCmmuArm920tLibh
#define MMU_ID_ARM920T 0x029200
#include "mmuArmPalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Values to be used when mmuEnable() is called. This will be after the MMU has
* been initialised by sysInit()/romInit() and after cacheLib has set whatever
* cache enable settings have been chosen.
*
* M 1 Enable MMU
* A 0 Disable address alignment fault
* C X ((D-)Cache Enable) Controlled by cacheLib
* W X (Write Buffer) Controlled by cacheLib
* P 1 (PROG32) should be set before this
* D 1 (DATA32) should be set before this
* L 1 (Late abort on earlier CPUs) ignore
* B X (Big/Little-endian) should be set before this
* S 1 (System)
* R 0 (ROM)
* F 0 Should be Zero
* Z X (Branch prediction enable on 810) Controlled by cacheLib
* I X (I-cache enable) Controlled by cacheLib
*
* For time being, do not enable the address alignment fault, as GCC
* currently generates unaligned accesses in its code, and switching this
* on will cause immediate faults. So, do not put it into the enable
* mask.
*
* We used to clear all the Reserved/Should Be Zero bits when the
* MMU/MPU was enabled, by including one bits for them in the definition
* of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend
* the definitions of the bits within the MMU Control Register. The MMU
* Control register is initialised within romInit()/sysInit(), as the BSP
* is the only place where the particular details of the CPU/MMU are
* actually known. In general, it will be appropriate for the BSP to
* initialise the MMUCR Reserved/Should Be Zero bits to zero. When the
* MMU is enabled, we will only change the bits we are particularly
* concerned about, by using a Read-Modify-Write strategy.
*/
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE MMUCR_ROM /* This MUST remain ROM for shared libraries */
#define MMUCR_FB_DISABLE (1<<30) /* nFastBus bit */
#define MMUCR_ASYNC_BIT (1<<31) /* Async bit*/
#define MMUCR_SYNC (1<<30) /* Synchronous mode */
#define MMUCR_ASYNC (3<<30) /* Asynchronous mode */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE)
/*
* Values to be used when the MMU Control Register is initialised from
* within romInit.s or sysALib.s (before the MMU is enabled). Note that
* on 710A, this is also used to initialise the soft-copy of the MMU CR
* that we need to keep (in order to emulate Read-Modify-Write
* operations). So, the BSP *MUST* initialise the MMU CR with the value
* contained here, or else trouble will ensue. This restriction does
* not apply to non-710A BSPs, but caution must be exercised in choosing a
* value different to that defined here.
*/
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* W bit is Should Be One */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_MODE | MMUCR_W_ENABLE)
#else /* _BYTE_ORDER == _LITTLE_ENDIAN now _BIG_ENDIAN */
/* big endian */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_W_ENABLE | MMUCR_BIGEND | MMUCR_MODE)
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
#ifndef _ASMLANGUAGE
IMPORT void mmuArm920tLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT MMU_LEVEL_1_DESC * mmuArm920tTtbrGet (void);
IMPORT void mmuArm920tTtbrSet (MMU_LEVEL_1_DESC *);
IMPORT UINT32 mmuArm920tTtbrGetAll (void);
IMPORT void mmuArm920tTtbrSetAll (UINT32);
IMPORT void mmuArm920tDacrSet (UINT32 dacrVal);
IMPORT void mmuArm920tTLBIDFlushEntry (void *addr);
IMPORT void mmuArm920tTLBIDFlushAll (void);
IMPORT void mmuArm920tAEnable (UINT32 cacheState);
IMPORT void mmuArm920tADisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArm920tLibh */
@@ -0,0 +1,129 @@
/* mmuArm926eLib.h - ARM 926E MMU library header file */
/*
* Copyright (c) 2002, 2004, 2005, 2007, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01h,21dec11,jdw Update APIs to clear up warnings related to ttbr APIs
01g,29apr10,pad Moved extern C statement after include statements.
01f,15oct07,j_b fix MMU_INIT_VALUE (WIND00060071)
01e,18apr05,jb Fix for SPR 108034
01d,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01c,10feb05,jb Reverting to ROM mode for shared data/libraries
01b,09dec04,jb Palify Arm MMU
01a,09dec02,jpd created, based on mmuArm920tLib.h, version 01a.
*/
#ifndef __INCmmuArm926eLibh
#define __INCmmuArm926eLibh
#define MMU_ID_ARM926E 0x069260
#include "mmuArmPalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Values to be used when mmuEnable() is called. This will be after the MMU has
* been initialised by sysInit()/romInit() and after cacheLib has set whatever
* cache enable settings have been chosen.
*
* M 1 Enable MMU
* A 0 Disable address alignment fault
* C X ((D-)Cache Enable) Controlled by cacheLib
* W X (Write Buffer) Controlled by cacheLib
* P 1 (PROG32) should be set before this
* D 1 (DATA32) should be set before this
* L 1 (Late abort on earlier CPUs) ignore
* B X (Big/Little-endian) should be set before this
* S 1 (System)
* R 0 (ROM)
* F 0 Should be Zero
* Z X (Branch prediction enable on 810) Controlled by cacheLib
* I X (I-cache enable) Controlled by cacheLib
*
* For time being, do not enable the address alignment fault, as GCC
* currently generates unaligned accesses in its code, and switching this
* on will cause immediate faults. So, do not put it into the enable
* mask.
*
* We used to clear all the Reserved/Should Be Zero bits when the
* MMU/MPU was enabled, by including one bits for them in the definition
* of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend
* the definitions of the bits within the MMU Control Register. The MMU
* Control register is initialised within romInit()/sysInit(), as the BSP
* is the only place where the particular details of the CPU/MMU are
* actually known. In general, it will be appropriate for the BSP to
* initialise the MMUCR Reserved/Should Be Zero bits to zero. When the
* MMU is enabled, we will only change the bits we are particularly
* concerned about, by using a Read-Modify-Write strategy.
*/
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE MMUCR_ROM /* This MUST remain ROM for shared libraries */
#define MMUCR_L4_ENABLE (1<<15) /* L4 enable, ARMv4 behavior */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE)
#define MMUCR_926E_SBO ((1<<18) | (1<<16)) /* Should Be One bits */
/*
* Values to be used when the MMU Control Register is initialised from
* within romInit.s or sysALib.s (before the MMU is enabled). Note that
* on 710A, this is also used to initialise the soft-copy of the MMU CR
* that we need to keep (in order to emulate Read-Modify-Write
* operations). So, the BSP *MUST* initialise the MMU CR with the value
* contained here, or else trouble will ensue. This restriction does
* not apply to non-710A BSPs, but caution must be exercised in choosing a
* value different to that defined here.
*/
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* W bit is Should Be One */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_MODE | MMUCR_926E_SBO)
#else /* _BYTE_ORDER == _LITTLE_ENDIAN now _BIG_ENDIAN */
/* big endian */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_BIGEND | MMUCR_MODE | MMUCR_926E_SBO)
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
#ifndef _ASMLANGUAGE
IMPORT void mmuArm926eLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT MMU_LEVEL_1_DESC * mmuArm926eTtbrGet ( void);
IMPORT void mmuArm926eTtbrSet (MMU_LEVEL_1_DESC *);
IMPORT UINT32 mmuArm926eTtbrGetAll (void);
IMPORT void mmuArm926eTtbrSetAll (UINT32);
IMPORT void mmuArm926eDacrSet (UINT32 dacrVal);
IMPORT void mmuArm926eTLBIDFlushEntry (void *addr);
IMPORT void mmuArm926eTLBIDFlushAll (void);
IMPORT void mmuArm926eAEnable (UINT32 cacheState);
IMPORT void mmuArm926eADisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArm926eLibh */
@@ -0,0 +1,900 @@
/* mmuArmArch6PalLib.h - ARM MMU library header file */
/*
* Copyright (c) 2005-2014, 2016 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
20jan16,jnl Clean warning.
17apr14,c_l Fix TTBR & PTE attribute macros for enabled
ENABLE_CACHED_PAGE_TBL. (VXW6-73478)
02p,18sep13,zgl Add TTBR & PTE attribute macros for ARM A15 (WIND00434990)
02o,11jun12,jdw Fix TTBR & PTE attribute macros for ARM A9,
WIND00342202, WIND00342756
02n,02mar12,rec WIND00318272 - POSIX signals conformance
02m,09jan12,rec WIND00196578 - remove unused reference _func_armPageSource
02l,28sep11,jdw Add shared attribute to cached page tables (WIND00298486)
02k,13may11,jdw Clear TTBR0 bits during MMU init (WIND00258897)
02j,20apr11,jdw Add support for cached page tables
02i,25aug10,my_ add MMUCR_EE bit definition (WIND00229795)
02h,17jun10,m_h Thumb-2 Support
02g,29apr10,pad Moved extern C statement after include statements.
02f,02feb10,j_b add not-global PTE bit (nG), ASID support
02e,03nov09,j_b add INCLUDE_MMU_TEX_SUPPORT, undef INCLUDE_MMU_SUBPAGE_SUPPORT
02d,02nov09,j_b fix translation bug due to XN bit support (WIND00189001)
02c,07feb08,j_b Change MMU_DEF_L1_PAGE so bit 4 is 0 per VMSAv6
02b,23oct07,to added lockCnt and lockOwner to MMU_TRANS_TBL
02a,21sep07,to define MMU_PAGE_SIZE_SHIFT
01z,21sep07,j_b add _func_mmuFaultAddrGet prototype
01y,08aug07,j_b modify MMU_STATE_MASK_CACHEABLE for ARMv6 extended types;
add INCLUDE_MMU_EXTD_TYPE_SUPPORT
01x,30jul07,j_b fix special purpose attributes' masks
01w,03jul07,j_b add special purpose attributes for added ARMv6 extended types
(w/ TEX)
01v,20sep06,j_b add page optimization support
01u,11sep06,m_h fix vert-to-phys translation problem in upper bits
WIND00059266
01t,01mar06,m_h Manzano supersection support
01s,30mar05,jb Extracted from mmuArmArch6PalLib.h, 01u
*/
#ifndef __INCmmuArmArch6PalLibh
#define __INCmmuArmArch6PalLibh
#ifndef _ASMLANGUAGE
#include <memLib.h>
#include <semLib.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* _ASMLANGUAGE */
/*
* The page size we will use. Ignore the sub-page, Large Page and Tiny
* Page features.
*/
#define MMU_PAGE_SIZE 4096
#define MMU_PAGE_SIZE_SHIFT 12
/*
* See the Virtual Memory System Architecture for ARMv6 (VMSAv6) section
* in the ARM Architecture Reference Manual (ARM DDI 0100) for MMU details.
*/
#define PAGE_SIZE MMU_PAGE_SIZE
#undef INCLUDE_MMU_APXBIT_SUPPORT
#define INCLUDE_MMU_APXBIT_SUPPORT
#undef INCLUDE_MMU_XNBIT_SUPPORT
#define INCLUDE_MMU_XNBIT_SUPPORT
#undef INCLUDE_MMU_EXTD_TYPE_SUPPORT
#define INCLUDE_MMU_EXTD_TYPE_SUPPORT
#undef INCLUDE_MMU_SBIT_SUPPORT
#define INCLUDE_MMU_SBIT_SUPPORT
#undef INCLUDE_MMU_TEX_SUPPORT
#define INCLUDE_MMU_TEX_SUPPORT
#undef INCLUDE_MMU_SUBPAGE_SUPPORT
/*
* The amount described by a Level 1 Descriptor, which equals the smallest
* amount of VM allocatable in VxWorks.
*/
#define MMU_PAGE_BLOCK_SIZE 0x100000 /* 1 MByte */
#define MMU_ADRS_TO_L1D_INDEX_SHIFT 20
#define MMU_PTE_INDEX_MASK 0x000FF000 /* extract PTE index from Virt Addr */
#define MMU_PTE_INDEX_SHIFT 12 /* shift to make that into PTE index */
#define MMU_L1D_TO_BASE_SHIFT 10 /* to turn L1D to PT base addr */
#define MMU_L1DSECTION_TO_BASE_SHIFT 20 /* L1D section to PT base addr */
#define MMU_L1DSECTION_BA_MASK 0xFFF00000 /* phys bits 20-31 */
#define MMU_L1DSSECTIONLO_TO_BASE_SHIFT 24 /* bits 24-31 of supersection */
#define MMU_L1DSSECTIONHI_TO_BASE_SHIFT 32 /* bits 32-35 of supersection */
#define MMU_L1DSSECTIONHI2_TO_BASE_SHIFT 5 /* bits 36-39 of supersection */
#define MMU_L1DSSECTIONLO_BA_MASK 0xFF000000 /* phys bits 24-31 */
#define MMU_L1DSSECTIONHI_BA_MASK 0x00F00000 /* phys bits 32-35 */
#define MMU_L1DSSECTIONHI2_BA_MASK 0x000001E0 /* phys bits 36-39 */
/* optional extended physical address bit fields */
#define MMU_L1DSSECTION_EXTD_BA_MASK \
(MMU_L1DSSECTIONHI_BA_MASK | MMU_L1DSSECTIONHI2_BA_MASK)
/* supersection base address packing */
#define MMU_L1DSSECTION_BA_SET(physAddr, L1desc) \
(L1desc = (unsigned int)((L1desc & ~MMU_L1DSSECTION_EXTD_BA_MASK) | \
( (((unsigned long long)(physAddr)) & MMU_L1DSSECTIONLO_BA_MASK) | \
((((unsigned long long)(physAddr)) >> 12) & \
MMU_L1DSSECTIONHI_BA_MASK) | \
((((unsigned long long)(physAddr)) >> 31) & \
MMU_L1DSSECTIONHI2_BA_MASK) )))
/* supersection base address unpacking */
#define MMU_L1DSSECTION_BA_GET(ssectDesc) \
((unsigned long long) \
( (unsigned long long)(ssectDesc & MMU_L1DSSECTIONLO_BA_MASK) | \
((unsigned long long)(ssectDesc & MMU_L1DSSECTIONHI_BA_MASK) \
<< 12) | \
((unsigned long long)(ssectDesc & MMU_L1DSSECTIONHI2_BA_MASK) \
<< 31) ))
/* Address translation masks */
#define MMU_ADDR_PI_MASK 0x00000FFF /* extract page index from Virt Addr */
#define MMU_PTE_BA_MASK 0xFFFFF000 /* extract phys base address from PTE */
#define MMU_ADDR_SI_MASK 0x000FFFFF /* extr section index from Virt Addr */
#define MMU_PTE_SECA_MASK 0xFFF00000 /* extract section base from L1 desc */
#define MMU_ADDR_SSI_MASK 0x00FFFFFF /* supersection index from virt */
#define MMU_PTE_SSECA_MASK 0xFF000000 /* supersection base from L1 desc */
#define MMU_PTE_SSECAX_MASK 0x00F00000 /* supersection extended bits L1 */
#define MMU_PTE_SSECAX_SHIFT 12 /* supersection extended bits shift */
/* Level 1 descriptor bit fields */
#define MMU_L1PD_TYPE_MASK 0x00000003 /* type bits [0:1] */
#define MMU_L1PD_CB_MASK 0x0000000C /* CB bits [3:2] */
#define MMU_L1PD_XN_MASK 0x00000010 /* eXecute Never bit [4] */
#define MMU_L1PD_DOMAIN_MASK 0x000001E0 /* domain bits [8:5] */
#define MMU_L1PD_P_MASK 0x00000200 /* P bit [9] */
#define MMU_L1PD_AP_MASK 0x00000C00 /* AP bits [10:11] */
#define MMU_L1PD_TEX_MASK 0x00007000 /* TEX bits [14:12] */
#define MMU_L1PD_APX_MASK 0x00008000 /* APX bit [15] */
#define MMU_L1PD_S_MASK 0x00010000 /* Shared bit [16] */
#define MMU_L1PD_NG_MASK 0x00020000 /* not-Global bit [17] */
#define MMU_L1PD_PTE_MASK 0xFFFFFC00 /* extract phys L2 PTE addr from L1PD */
/* # of shifts (right) to get fields in Level 1 descriptor */
#define MMU_L1PD_CB_SHIFT 2
#define MMU_L1PD_XN_SHIFT 4
#define MMU_L1PD_DOMAIN_SHIFT 5
#define MMU_L1PD_P_SHIFT 9
#define MMU_L1PD_AP_SHIFT 10
#define MMU_L1PD_TEX_SHIFT 12
#define MMU_L1PD_APX_SHIFT 15
#define MMU_L1PD_S_SHIFT 16
#define MMU_L1PD_NG_SHIFT 17
/* Level 2 descriptor bit fields */
#define MMU_PTE_TYPE_MASK 0x00000003 /* PTE type bits [0:1] */
#define MMU_PTE_SECT_XN_MASK 0x00000001 /* eXecute Never bit [0] */
#define MMU_PTE_SECT_CB_MASK 0x0000000C /* CB bits [3:2] */
#define MMU_PTE_SECT_AP_MASK 0x00000030 /* AP bits [5:4] */
#define MMU_PTE_SECT_TEX_MASK 0x000001C0 /* TEX bits [8:6] */
#define MMU_PTE_SECT_APX_MASK 0x00000200 /* APX bit [9] */
#define MMU_PTE_SECT_S_MASK 0x00000400 /* Shared bit [10] */
#define MMU_PTE_SECT_NG_MASK 0x00000800 /* not-Global bit [11] */
/* adjustment to translate fields: Level 1 <-> Level 2 descriptors */
#define MMU_L1L2_SECT_NG_SHIFT 6 /* nG-bit shift convert L1 to L2 */
#define MMU_L1L2_SECT_S_SHIFT 6 /* S-bit shift convert L1 to L2 */
#define MMU_L1L2_SECT_TEX_SHIFT 6 /* TEX shift convert L1 to L2 */
#define MMU_L1L2_SECT_AP_SHIFT 6 /* AP, APX shift convert L1 to L2 */
#define MMU_L1L2_SECT_XN_SHIFT 4 /* XN-bit shift convert L1 to L2 */
#define MMU_L1L2_SECT_CB_SHIFT 0 /* CB shift convert L1 to L2 */
/* Section and Supersection type and size macros */
#define MMU_PTE_SSECT_TYPE 0x00040000 /* supersection bit [18] */
#define MMU_PTE_SECT_TYPE_MASK 0x00040000 /* which type of section? */
#define MMU_SECT_SIZE 0x100000 /* section = 1MB */
#define MMU_SSECT_SIZE 0x1000000 /* supersection = 16MB */
#define MMU_NUM_VM_PAGES_IN_A_SECT 0x100 /* 1MB = 256 * 4KB pages */
#define MMU_NUM_VM_PAGES_IN_A_SSECT 0x1000 /* 16MB = 4096 * 4KB pages */
#define MMU_NUM_SECTS_IN_A_SSECT 0x10 /* 16 sections/supersection */
/*
* The Domain Access Control Register specifies the way in which access
* rights are treated for each of sixteen domains. For each domain the
* current state can be:
*
* 00 no access: all accesses generate aborts
* 01 client: access rights specified in page tables are checked.
* 10 reserved
* 11 manager: accesses not checked against page tables: all access allowed.
*/
#define MMU_DACR_VAL_NORMAL 1 /* client of 0 */
#define MMU_DACR_VAL_UNPROTECT 0x03 /* manager of 0 */
/* Level 1 Descriptor types */
#define MMU_DESC_TYPE_FAULT 0 /* any access will cause a fault */
#define MMU_DESC_TYPE_PAGE 1
#define MMU_DESC_TYPE_SECTION 2
#define MMU_DEF_L1_PAGE 0x00000001 /* domain zero, Page descriptor */
/*
* Section descriptors, such as might be used to set up an intermediate
* set of page tables on processors such as SA-1100/SA-1500 where this
* needs to be done from BSP initialization, before vm(Base)Lib sets up
* a proper set of page tables.
*/
#define MMU_RAM_SECT_DESC 0xC1E /* R/W cacheable bufferable domain 0 */
#define MMU_MINICACHE_SECT_DESC 0xC1A /* R/W C+ B- domain 0 */
#define MMU_OTHER_SECT_DESC 0xC12 /* R/W C- B- domain 0 */
/* Level 2 Descriptor or Page Table Entry (PTE) types */
#define MMU_PTE_TYPE_FAULT 0 /* any access will cause a fault */
#define MMU_PTE_TYPE_LG_PAGE 1 /* Large page descriptor */
#define MMU_PTE_TYPE_SM_PAGE 2 /* Small page descriptor */
#define MMU_PTE_TYPE_EX_PAGE 3 /* Extended page descriptor */
/*
* The Translation Table Base register (TTBR) points to a table of Level 1
* Descriptors. these are either Invalid Section descriptors, Section
* Descriptors, or Page Table Descriptors. If Page Table Descriptors, they
* each point to a table of Level 2 Page Descriptors, or Page Table Entries
* (PTEs).
* The 32-bit (virtual) address space allows for 4096 M. Each Level 1
* Descriptor describes a 1 M area of memory. There are therefore 4096 Level
* 1 Descriptors, and each table of 256 Level 2 Page Descriptors (PTEs)
* describes 256 4 kbyte pages.
*/
#define MMU_NUM_L1_DESCS 4096
#define MMU_NUM_L2_DESCS 256
#define MMU_L1_TABLE_SIZE (MMU_NUM_L1_DESCS * sizeof(MMU_LEVEL_1_DESC))
/* No. of pages a Level 1 Descriptor table takes up */
#define MMU_L1_DESC_PAGES (MMU_L1_TABLE_SIZE / MMU_PAGE_SIZE)
/* Size of a Page Table */
#define MMU_PAGE_TABLE_SIZE (MMU_NUM_L2_DESCS * sizeof(PTE))
/* Number of possible ASIDs */
#define MMU_NUM_ASIDS 256
#define VXWORKS_KERNEL_ASID 0 /* reserved ASID for VxWorks kernel */
/* Section and supersection L1 definitions follow */
#undef INCLUDE_MMU_SUPERSECTION_SUPPORT /* support supersection descriptors */
#define INCLUDE_MMU_SUPERSECTION_SUPPORT
#undef MMU_DEF_L1_SECTION_PAGE
#define MMU_DEF_L1_SECTION_PAGE 0x00000002 /* Section page descriptor */
#undef MMU_DEF_L1_SUPERSECTION_PAGE
#define MMU_DEF_L1_SUPERSECTION_PAGE 0x00040002 /* supersection */
#undef MMU_DEF_L1_SECTION_PAGE_MASK
#define MMU_DEF_L1_SECTION_PAGE_MASK 0x00040003 /* mask */
#undef MMU_STATE_SECTION_MASK_WRITABLE
#define MMU_STATE_SECTION_MASK_WRITABLE 0x00000030 /* All APn bits */
/*
* Architecture-dependent MMU states. These are states settable for pages and
* here they correspond to settings in the Page Table Entries (PTEs).
*
* We set Valid/Invalid by setting a Fault second-level descriptor rather
* than by using the Access Permissions within a small page second-level
* descriptor. This is because we will want to use the Access Permissions to
* control supervisor mode access and we cannot then use the AP bits
* to disallow access as the SR bits in the MMU Control register must be set
* to 10 in order to control read/write access from Supervisor mode.
*/
#define MMU_STATE_INVALID_STATE 0xFFFFFFFF
#define MMU_STATE_MASK_VALID 0x00000002 /* 2nd lvl desc bit 1 only */
#define MMU_STATE_MASK_WRITABLE 0x00000230 /* All APn bits */
#define MMU_STATE_MASK_CACHEABLE 0x000005CC /* S, TEX[0:2] + CB bits */
#define MMU_STATE_VALID MMU_PTE_TYPE_SM_PAGE /* set to page type */
#define MMU_STATE_VALID_NOT MMU_PTE_TYPE_FAULT /* set to type fault */
#define MMU_STATE_MASK_PROTECTION 0x00000231 /* APX + APn + XN bits */
#define MMU_STATE_SUP_RO 0x00000210 /* APX: 1 AP: 01 */
#define MMU_STATE_SUP_RW 0x00000010 /* APX: 0 AP: 01 */
#define MMU_STATE_SUP_RO_USR_RO 0x00000220 /* APX: 1 AP: 10 */
#define MMU_STATE_SUP_RW_USR_RO 0x00000020 /* APX: 0 AP: 10 */
#define MMU_STATE_SUP_RW_USR_RW 0x00000030 /* APX: 0 AP: 11 */
#define MMU_STATE_WRITABLE MMU_STATE_SUP_RW
#define MMU_STATE_WRITABLE_NOT MMU_STATE_SUP_RO
#define MMU_STATE_AP_SUP_RO 0x1 /* AP field: 01 */
#define MMU_STATE_AP_SUP_RW 0x1 /* AP field: 01 */
#define MMU_STATE_AP_SUP_RO_USR_RO 0x2 /* AP field: 10 */
#define MMU_STATE_AP_SUP_RW_USR_RO 0x2 /* AP field: 10 */
#define MMU_STATE_AP_SUP_RW_USR_RW 0x3 /* AP field: 11 */
#define MMU_STATE_AP_USR_RO_SUP_RO MMU_STATE_AP_SUP_RO_USR_RO
#define MMU_STATE_AP_USR_RO_SUP_RW MMU_STATE_AP_SUP_RW_USR_RO
#define MMU_STATE_AP_USR_RW_SUP_RW MMU_STATE_AP_SUP_RW_USR_RW
/* The Execute-Never bit is an extra permission check on readable addresses */
#define MMU_STATE_EXE_NOT 0x00000001 /* Execute-Never, XN bit */
#define MMU_STATE_SUP_RO_XN (MMU_STATE_SUP_RO | MMU_STATE_EXE_NOT)
#define MMU_STATE_SUP_RW_XN (MMU_STATE_SUP_RW | MMU_STATE_EXE_NOT)
#define MMU_STATE_SUP_RO_USR_RO_XN (MMU_STATE_SUP_RO_USR_RO | MMU_STATE_EXE_NOT)
#define MMU_STATE_SUP_RW_USR_RO_XN (MMU_STATE_SUP_RW_USR_RO | MMU_STATE_EXE_NOT)
#define MMU_STATE_SUP_RW_USR_RW_XN (MMU_STATE_SUP_RW_USR_RW | MMU_STATE_EXE_NOT)
/*
* Memory Region Attributes -
* cache access, write buffer access, coherency control
*/
#define MMU_STATE_STRONGLY_ORDERED 0x0 /* strongly ordered, shared */
#define MMU_STATE_CACHEABLE_NOT 0x0 /* backward compatible */
#define MMU_STATE_DEVICE_SHARED 0x00000004 /* device type, shared */
/* (bufferable, not cacheable) */
/* outer & inner write-thru cachable, no write alloc */
#define MMU_STATE_NORMAL_WRITETHROUGH 0x00000008
#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x00000008 /* backward compatible */
#define MMU_STATE_NORMAL_WRITEBACK 0x0000000C /* write-back, no alloc */
#define MMU_STATE_CACHEABLE_COPYBACK 0x0000000C /* backward compatible */
#define MMU_STATE_NORMAL_NONCACHEABLE 0x00000040 /* non-cached, sharable */
#define MMU_STATE_DEVICE_NONSHARED 0x00000080 /* device, non-shared */
#define MMU_STATE_COPYBACK_ALLOC 0x0000004C /* write-back, sharable */
/* Define the flags used by Cached Page Tables for the PTEs */
/*
* - For MPCore(Cortex-A9 and ARM11), inner and outer write-back
* write-allocate cacheable.
* - For UPCore(Cortex-A9 and ARM11), inner and outer write-back
* no write-allocate cacheable.
*/
#ifdef _WRS_CONFIG_SMP
/* s=1,tex=001,c,b=11 */
#define MMU_STATE_CACHE_PTE_A9_FLAGS (MMU_STATE_COPYBACK_ALLOC | \
MMU_STATE_SHARED)
#else
/* s=0,tex=000,c,b=11 */
#define MMU_STATE_CACHE_PTE_A9_FLAGS (MMU_STATE_NORMAL_WRITEBACK)
#endif /* _WRS_CONFIG_SMP */
/* - For Cortex-A15 MPCore, inner and outer write-back, no write-allocate. */
#define MMU_STATE_WRITEBACK_PTE_A15_MPCORE (MMU_STATE_NORMAL_WRITEBACK)
/* - For others use the standard settings. */
#define MMU_STATE_WRITETHROUGH_PTE_GENERIC (MMU_STATE_NORMAL_WRITETHROUGH)
/*
* The following outer/inner noncacheable policy is also used as
* the basis for the rest of the outer/inner cache policies.
* (See the MMU_ATTR_OUT_x_IN_x macros for SPL_4 below.)
*/
#define MMU_STATE_OUT_OFF_IN_OFF 0x00000100 /* out/inner non-cached */
/* outer cache policy (TEX[1:0]) >> shift, relative to MMU_ATTR_OUT_x_IN_x */
#define MMU_STATE_OUTER_CACHE_POLICY_SHIFT 24
/* inner cache policy (CB) >> shift, relative to MMU_ATTR_OUT_x_IN_x */
#define MMU_STATE_INNER_CACHE_POLICY_SHIFT 26
/*
* Set the default state to be copyback. CACHEABLE_WRITETHROUGH can also be
* selected on those cache designs that permit it.
*/
#define MMU_STATE_CACHEABLE MMU_STATE_CACHEABLE_COPYBACK
/*
* Shared memory attribute -
* accessible by multiple processors or bus masters and must be kept coherent
*/
#define MMU_STATE_SHARED 0x00000400 /* Shared bit */
#define MMU_STATE_WRITETHROUGH_SHARED \
(MMU_STATE_CACHEABLE_WRITETHROUGH | MMU_STATE_SHARED)
#define MMU_STATE_COPYBACK_SHARED \
(MMU_STATE_CACHEABLE_COPYBACK | MMU_STATE_SHARED)
#define MMU_STATE_NONCACHEABLE_SHARED \
(MMU_STATE_NORMAL_NONCACHEABLE | MMU_STATE_SHARED)
/*
* Global memory attribute -
* not-Global causes ASID to be associated with address translation
*/
#define MMU_STATE_NOT_GLOBAL 0x00000800 /* not-Global bit */
/*
* Architecture-specific attributes
*
* The following ARMv6-specific aliases are provided for ease of use.
*
* NOTE: MMU_ATTR_CACHE_GUARDED is used as MMU_ATTR_CACHE_IO (its former name).
*/
/* Strongly Ordered - same as MMU_ATTR_CACHE_OFF for backward compatibility */
#define MMU_ATTR_STRONGLY_ORDERED (MMU_ATTR_CACHE_OFF)
/* Shared Device */
#define MMU_ATTR_DEVICE_SHARED_MSK (MMU_ATTR_CACHE_MSK)
#define MMU_ATTR_DEVICE_SHARED (MMU_ATTR_CACHE_GUARDED | MMU_ATTR_CACHE_OFF | \
MMU_ATTR_CACHE_COHERENCY)
#define MMU_ATTR_BUFFERABLE MMU_ATTR_DEVICE_SHARED /* backward compatible */
/* Non-Shared Device */
#define MMU_ATTR_DEVICE_NONSHARED_MSK MMU_ATTR_DEVICE_SHARED_MSK
#define MMU_ATTR_DEVICE_NONSHARED (MMU_ATTR_CACHE_GUARDED | \
MMU_ATTR_CACHE_OFF)
/*
* Special Purpose Attributes:
* When setting any of these attributes, it is necessary to:
*
* 1. specify MMU_ATTR_SPL_MSK ORred with MMU_ATTR_CACHE_MSK in the mask
* argument to the routine, and:
* 2. specify the appropriate cache state ORed in to the state argument
* to the routine, unless the cache state is implied.
*
* So, to set a page as normal, noncacheable memory, it is necessary to
* specify both MMU_ATTR_SPL_0 and specify MMU_ATTR_CACHE_OFF in the
* state argument.
*
* To "unset" the special attributes, specify MMU_ATTR_CACHE_MSK in
* the mask parameter (without MMU_ATTR_SPL_MSK) and specify the
* cacheability required in the state argument.
*/
/* Normal, Noncacheable memory */
#define MMU_ATTR_NORMAL_NONCACHEABLE_MSK (MMU_ATTR_SPL_MSK | MMU_ATTR_CACHE_MSK)
#define MMU_ATTR_NORMAL_NONCACHEABLE (MMU_ATTR_SPL_0 | MMU_ATTR_CACHE_OFF)
#define MMU_ATTR_NORMAL_NONCACHEABLE_SHARED (MMU_ATTR_NORMAL_NONCACHEABLE | \
MMU_ATTR_CACHE_COHERENCY)
/*
* Outer and Inner Cache Write-Back, Write Allocate (same as XScale)
* -- this can also be ORed with MMU_ATTR_CACHE_COHERENCY to set as Shared
*/
#define MMU_ATTR_WRITEALLOCATE_MSK (MMU_ATTR_SPL_MSK | MMU_ATTR_CACHE_MSK)
#define MMU_ATTR_WRITEALLOCATE (MMU_ATTR_SPL_3 | MMU_ATTR_CACHE_COPYBACK)
#define MMU_ATTR_WRITEALLOCATE_SHARED (MMU_ATTR_WRITEALLOCATE | \
MMU_ATTR_CACHE_COHERENCY)
/*
* Individually Specified Outer and Inner Cache Policies
* -- ORed with TEX[1:0] and CB encodings for each, shifted to prevent
* conflicts with common MMU_ATTR_ protection, cache, valid and SPL bits:
* OFF - Noncacheable, Unbuffered
* WBWA - Write-Back cached, Write Allocate, Buffered
* WTNA - Write-Through cached, No Allocate on Write, Buffered
* WBNA - Write-Back cached, No Allocate on Write, Buffered
*
* -- these can also be ORed with MMU_ATTR_CACHE_COHERENCY to set as Shared,
* but since MMU_ATTR_CACHE_COHERENCY is invalid by itself
* MMU_ATTR_CACHE_OFF is added to all of them (and will be disregarded)
*/
#define MMU_ATTR_CACHE_POLICY_SHIFT 28 /* cache policy encoding << shift */
#define MMU_ATTR_CACHE_OUTER_POLICY_MSK 0xC0000000 /* outer policy code bits */
#define MMU_ATTR_CACHE_INNER_POLICY_MSK 0x30000000 /* inner policy code bits */
#define MMU_ATTR_OUT_X_IN_Y_MSK (MMU_ATTR_SPL_MSK | MMU_ATTR_CACHE_MSK)
#define MMU_ATTR_OUT_OFF_IN_OFF (MMU_ATTR_SPL_4 | MMU_ATTR_CACHE_OFF)
#define MMU_ATTR_OUT_OFF_IN_WBWA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x1 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_OFF_IN_WTNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x2 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_OFF_IN_WBNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x3 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBWA_IN_OFF (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x4 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBWA_IN_WBWA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x5 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBWA_IN_WTNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x6 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBWA_IN_WBNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x7 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WTNA_IN_OFF (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x8 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WTNA_IN_WBWA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0x9 << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WTNA_IN_WTNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0xA << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WTNA_IN_WBNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0xB << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBNA_IN_OFF (MMU_ATTR_OUT_OFF_IN_OFF | \
(0xC << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBNA_IN_WBWA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0xD << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBNA_IN_WTNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0xE << MMU_ATTR_CACHE_POLICY_SHIFT))
#define MMU_ATTR_OUT_WBNA_IN_WBNA (MMU_ATTR_OUT_OFF_IN_OFF | \
(0xF << MMU_ATTR_CACHE_POLICY_SHIFT))
/* MMU Control Register bit allocations */
#define MMUCR_M_ENABLE (1<<0) /* MMU enable */
#define MMUCR_A_ENABLE (1<<1) /* Address alignment fault enable */
#define MMUCR_C_ENABLE (1<<2) /* (data) cache enable */
#define MMUCR_W_ENABLE (1<<3) /* write buffer enable */
#define MMUCR_PROG32 (1<<4) /* PROG32 */
#define MMUCR_DATA32 (1<<5) /* DATA32 */
#define MMUCR_L_ENABLE (1<<6) /* Late abort on earlier CPUs */
#define MMUCR_BIGEND (1<<7) /* Big-endian (=1), little-endian (=0) */
#define MMUCR_SYSTEM (1<<8) /* System bit, modifies MMU protections */
#define MMUCR_ROM (1<<9) /* ROM bit, modifies MMU protections */
#define MMUCR_F (1<<10) /* Should Be Zero */
#define MMUCR_Z_ENABLE (1<<11) /* Branch prediction enable on 810 */
#define MMUCR_I_ENABLE (1<<12) /* Instruction cache enable */
#define MMUCR_V_ENABLE (1<<13) /* Exception vectors remap to 0xFFFF0000 */
#define MMUCR_ALTVECT MMUCR_V_ENABLE /* alternate vector select */
#define MMUCR_RR_ENABLE (1<<14) /* Round robin cache replacement enable */
#define MMUCR_ROUND_ROBIN MMUCR_RR_ENABLE /* round-robin placement */
#define MMUCR_DISABLE_TBIT (1<<15) /* disable TBIT */
#define MMUCR_ENABLE_DTCM (1<<16) /* Enable Data TCM */
#define MMUCR_ENABLE_ITCM (1<<18) /* Enable Instruction TCM */
#define MMUCR_UNALIGNED_ENABLE (1<<22) /* Enable unaligned access */
#define MMUCR_EXTENDED_PAGE (1<<23) /* Use extended PTE format */
#define MMUCR_VECTORED_INTERRUPT (1<<24) /* Enable VIC Interface */
#define MMUCR_EE (1<<25) /* Exception Endianness bit */
#define MMUCR_THUMB_EXCEPTIONS (1<<30) /* Exceptions are Thumb */
#define ADDR_TO_PAGE 12 /* shift phys address to PTE page base address*/
/* MMU TTBR register fields for v6 and v7a */
#define MMU_TTBR_BASE_ADDR_MASK 0xFFFFC000
#define MMU_TTBR_C_MASK 0x00000001
#define MMU_TTBR_RGN_MASK 0x00000018
#define MMU_TTBR_IRGN_MASK 0x00000041
#define MMU_TTBR_NOS_MASK 0x00000020
#define MMU_TTBR_S_MASK 0x00000002
#define MMU_TTBR_IMP_MASK 0x00000004
/* RGN field bits */
#define MMU_TTBR_RGN_NML_NC 0x00000000 /* Normal, outer not cached */
#define MMU_TTBR_RGN_NML_WB_WA 0x00000008 /* Normal, outer write-back,
write-allocate cached */
#define MMU_TTBR_RGN_NML_WT 0x00000010 /* Normal, outer write-thru cached */
#define MMU_TTBR_RGN_NML_WB 0x00000018 /* Normal, outer write-back, */
/* no write-allocate cached */
/* IRGN field bits */
#define MMU_TTBR_IRGN_NML_NC 0x00000000 /* Normal, inner not cached */
#define MMU_TTBR_IRGN_NML_WT 0x00000001 /* Normal, inner write-thru cached */
#define MMU_TTBR_IRGN_NML_WB_WA 0x00000040 /* Normal, inner write-back,
write-allocate cached */
#define MMU_TTBR_IRGN_NML_WB 0x00000041 /* Normal, inner write-back, */
/* no write-allocate cached */
/* C Bit fields */
#define MMU_TTBR_C_NML_NC 0x00000000 /* Normal, not cached */
#define MMU_TTBR_C_NML_C 0x00000001 /* Normal, cached */
/* S & NOS fields */
#define MMU_TTBR_S 0x00000002 /* Inner Shared */
#define MMU_TTBR_NOS 0x00000020 /* Not Outer Shared */
#ifdef _WRS_CONFIG_SMP
/*
* ARM Cortex-A9 MPCore and ARM11 MPCore do not support inner write-through
* cached page tables. Cortex-A9 MPCore L2 can support write-through cached page
* tables. Setup TTBR for normal memory, inner and outer write-back
* write-allocate cacheable.
*/
/* IRGN[0]=1,NOS=1,RGN=0b01,S=1 */
#define MMU_TTBR_CACHE_PTE_A9_FLAGS (MMU_TTBR_RGN_NML_WB_WA | \
MMU_TTBR_IRGN_NML_WB_WA | \
MMU_TTBR_S | \
MMU_TTBR_NOS)
#else
/*
* ARM Cortex-A9 UPCore and ARM11 UPCore.
* Setup TTBR for normal memory, inner and outer write-back
* no write-allocate cacheable.
*/
/* IRGN[0]=1,NOS=0,RGN=0b11,S=0,C=1 */
#define MMU_TTBR_CACHE_PTE_A9_FLAGS (MMU_TTBR_RGN_NML_WB | \
MMU_TTBR_IRGN_NML_WB)
#endif /* _WRS_CONFIG_SMP */
/*
* ARM Cortex-A15 MPCore does not support write-through for L1 and L2 cache.
* Here, setup TTBR for inner and outer write-back, no write-allocate cached.
*/
#define MMU_TTBR_CACHE_PTE_A15_MPCORE ( MMU_TTBR_IRGN_NML_WB | \
MMU_TTBR_RGN_NML_WB )
/*
* For ARM Cortex-A8, or generic ARMv7 & ARMv6 cores:
*
* Select the mask for the single core or MPCore format for the TTBR. By
* default we support the MPCore format because it is compatible with the UP
* format and it is safer to zero out all the bits which are unused. Select
* inner and outer write-through cached page tables.
*/
#ifdef _WRS_CONFIG_USE_MC_TTBR_FMT
#define MMU_TTBR_CACHE_PTE_GENERIC \
( MMU_TTBR_IRGN_NML_WT | MMU_TTBR_RGN_NML_WT )
#else /* _WRS_CONFIG_USE_MC_TTBR_FMT */
#define MMU_TTBR_CACHE_PTE_GENERIC \
( MMU_TTBR_C_NML_C | MMU_TTBR_RGN_NML_WT )
#endif /* _WRS_CONFIG_USE_MC_TTBR_FMT */
#ifndef _ASMLANGUAGE
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* little-endian */
/* First level page descriptors */
typedef struct
{
UINT type : 2; /* descriptor type, 1 => page */
UINT pad1 : 2; /* SBZ */
UINT pad2 : 1; /* SBO */
UINT domain : 4; /* domain number */
UINT pbit : 1; /* 'P' bit */
UINT addr : 22; /* base address of page table */
} PAGE_DESC_FIELD;
/* First level "section" descriptor */
typedef struct
{
UINT type : 2; /* descriptor type, 2 => section */
UINT bbit : 1; /* bufferable-bit */
UINT cbit : 1; /* cacheable-bit */
UINT xnbit : 1; /* XN-bit */
UINT domain : 4; /* domain number */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT ap : 2; /* AP */
UINT tex : 3; /* TEX */
UINT apx : 1; /* APX */
UINT sbit : 1; /* S-bit */
UINT nG : 1; /* nG-bit */
UINT super : 1; /* 1 => supersection */
UINT pad1 : 1; /* SBZ */
UINT addr : 12; /* base address of page table */
} SECTION_DESC_FIELD;
/* First level "supersection" descriptor */
typedef struct
{
UINT type : 2; /* descriptor type, 2 => section */
UINT bbit : 1; /* bufferable-bit */
UINT cbit : 1; /* cacheable-bit */
UINT xnbit : 1; /* XN-bit */
UINT addrHi2: 4; /* phys address 39:36 */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT ap : 2; /* AP */
UINT tex : 3; /* TEX */
UINT apx : 1; /* APX */
UINT sbit : 1; /* S-bit */
UINT nG : 1; /* nG-bit */
UINT super : 1; /* 1 => supersection */
UINT pad1 : 1; /* SBZ */
UINT addrHi : 4; /* phys address 35:32 */
UINT addrLo : 8; /* phys address 31:24 */
} SUPERSECTION_DESC_FIELD;
/* Layout of Page Table Entries (PTEs), actually small page descriptors */
typedef struct
{
UINT type : 2; /* page type, 3 => extended small page */
UINT cb : 2; /* cacheable/bufferable bits */
UINT ap : 2; /* access permission */
UINT tex : 3; /* type extension field */
UINT apx : 1; /* access permission extension field */
UINT sbz : 2; /* should be zero */
UINT addr : 20; /* page base address */
} PTE_FIELD;
#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* big-endian */
/* First level page descriptors */
typedef struct
{
UINT addr : 22; /* base address of page table */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT domain : 4; /* domain number */
UINT pad2 : 1; /* SBO */
UINT pad1 : 2; /* SBZ */
UINT type : 2; /* descriptor type, 1 => page */
} PAGE_DESC_FIELD;
/* First level "section" descriptor */
typedef struct
{
UINT addr : 12; /* base address of page table */
UINT pad1 : 1; /* SBZ */
UINT super : 1; /* 1 => supersection */
UINT nG : 1; /* nG-bit */
UINT sbit : 1; /* S-bit */
UINT apx : 1; /* APX */
UINT tex : 3; /* AP */
UINT ap : 2; /* AP */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT domain : 4; /* domain number */
UINT xnbit : 1; /* XN-bit */
UINT cbit : 1; /* C-bit */
UINT bbit : 1; /* B-bit */
UINT type : 2; /* descriptor type, 2 => section */
} SECTION_DESC_FIELD;
/* First level "supersection" descriptor */
typedef struct
{
UINT addrLo : 8; /* phys address 31:24 */
UINT addrHi : 4; /* phys address 35:32 */
UINT pad1 : 1; /* SBZ */
UINT super : 1; /* 1 => supersection */
UINT nG : 1; /* nG-bit */
UINT sbit : 1; /* S-bit */
UINT apx : 1; /* APX */
UINT tex : 3; /* AP */
UINT ap : 2; /* AP */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT addrHi2: 4; /* phys address 39:36 */
UINT xnbit : 1; /* XN-bit */
UINT cbit : 1; /* C-bit */
UINT bbit : 1; /* B-bit */
UINT type : 2; /* descriptor type, 2 => section */
} SUPERSECTION_DESC_FIELD;
/* Layout of Page Table Entries (PTEs), actually small page descriptors */
typedef struct
{
UINT addr : 20; /* page base address */
UINT sbz : 2; /* should be zero */
UINT apx : 1; /* access permission extension field */
UINT tex : 3; /* type extension field */
UINT ap : 2; /* access permission */
UINT cb : 2; /* cacheable/bufferable bits */
UINT type : 2; /* page type, 3 => extended small page */
} PTE_FIELD;
#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* First level descriptor access */
typedef union
{
PAGE_DESC_FIELD fields;
SECTION_DESC_FIELD sectionFields;
SUPERSECTION_DESC_FIELD supersectionFields;
UINT32 bits;
} MMU_LEVEL_1_DESC;
/* Second level descriptor access */
typedef union
{
PTE_FIELD fields;
UINT32 bits;
} PTE;
/*
* Structure for MMU translation table access - normally used to get a pointer
* to the first-level translation table.
* To support page table optimization, a second first-level table and a
* semaphore are needed.
* The initial, unoptimized set of page tables will be set as the active
* translation tables (via pLevel1Table) while optimization or deoptimization
* is in progress using the inactive second translation table (pAltLevel1Table).
* After each page table optimization or deoptimization operation has
* completed, the second translation table will be set as the active
* translation table. The initial set of page tables retain their
* links to level 2 pages, which may otherwise be lost after optimization.
* Any non-optimization changes to the active first-level table will also be
* made to the inactive first-level table.
* The semaphore is used to prevent corruption of the tables.
*/
typedef struct mmuTransTblStruct
{
MMU_LEVEL_1_DESC *pLevel1Table; /* active MMU table */
MMU_LEVEL_1_DESC *pAltLevel1Table; /* inactive MMU table */
VX_MUTEX_SEMAPHORE(mmuTransTblSem); /* MMU tables' semaphore */
UINT32 lockCnt; /* lock count */
atomic_t lockOwner; /* lock owner */
UINT8 asid; /* ASID/context id */
} MMU_TRANS_TBL;
/* Externally visible mmuLib, mmuMapLib and mmuALib2 routines */
IMPORT UINT32 mmuReadId (void);
IMPORT PHYS_ADDR mmuVirtToPhys (VIRT_ADDR addr);
IMPORT VIRT_ADDR mmuPhysToVirt (PHYS_ADDR addr);
IMPORT UINT32 (* mmuCrGet) (void);
IMPORT void (* mmuModifyCr) (UINT32 value, UINT32 mask);
IMPORT UINT32 mmuHardCrGet (void);
IMPORT UINT32 mmuSoftCrGet (void);
IMPORT void mmuModifyHardCr (UINT32 value, UINT32 mask);
IMPORT void mmuModifySoftCr (UINT32 value, UINT32 mask);
IMPORT UINT32 (* _func_mmuFaultAddrGet) (void);
IMPORT UINT32 (* _func_mmuFaultStatusGet) (void);
IMPORT UINT32 (* _func_mmuIFaultStatusGet) (void);
IMPORT UINT32 mmuIFsrGet (void); /* CP15_IFSR only available with MMUs */
IMPORT UINT32 mmuFarGet (void); /* CP15_FAR only available with MMUs */
IMPORT UINT32 mmuFsrGet (void); /* CP15_FSR only available with MMUs */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArmArch6PalLibh */
+107
View File
@@ -0,0 +1,107 @@
/* mmuArmLib.h - ARM MMU library header file */
/*
* Copyright (c) 1996-2001, 2003-2008, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
02a,29jul10,pad Moved extern C statement after include statements.
01z,04jun10,wqi corrected spelling mistake. (WIND00203804)
01y,11jul07,j_b add ARMMMU_11MPCORE support
01x,12jun08,j_b add Cortex-A MMU support
01w,13jul06,m_h MPU Support
01v,25jan06,m_h Manzano Support
01u,29mar05,jb Adding ARMARCH6 and 1136 support
01t,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01s,09dec04,jb Palifying mmu
See mmuArmPalLib.h for previous contents
01r,10aug04,scm adjust for removal of MPU support, add 926E...
01q,18sep03,scm BASE 6 port...
01p,04oct01,scm add extended small page table support for XScale...
01o,23jul01,scm change XScale name to conform to coding standards...
01n,11jul01,scm add support for XScale...
01m,29mar01,jpd removed externs for mmyPhysToVirt & mmuVirtToPhys (SPR #63512).
01l,19mar01,jpd redefine MMU_ATTR_BUFFERABLE and MMU_ATTR_CACHE_MINICACHE
(SPR #64788).
01k,16aug00,jpd no longer clear MMUCR Reserved/Should Be Zero bits (SPR #33608)
01j,14jun00,jpd reworked MMU_STATE_WRITETHROUGH definition.
01i,17feb00,jpd T3: prefixed defs with MMU_; added new defs; changed SR to 10.
01h,07sep99,jpd added ARM740T, ARM920T support.
01g,20jan99,cdp removed support for old ARM libraries;
add prefix to MMU_IDs.
01f,24nov98,jpd added ARM940T support, added other CPU ids; removed
mmuIntLock/Unlock as intIFLock/Unlock to be used instead;
cdp restructured for multiple cache/MMU libraries; big-endian.
01e,09mar98,jpd added MMUCTR_ definitions for ARM810 and extra cache states.
01d,20jan98,jpd added _func_armPhysToVirt() etc. function pointers.
01c,17sep97,jpd added MMU_INIT_VALUE and mmuIntLock/Unlock definitions.
01b,24jan97,jpd modified mmuAEnable definition.
01a,09may96,cdp created.
*/
#ifndef __INCmmuArmLibh
#define __INCmmuArmLibh
#if (ARMMMU != ARMMMU_NONE)
#if (ARMMMU == ARMMMU_710A)
#include "mmuArm710aLib.h"
#elif (ARMMMU == ARMMMU_720T)
#include "mmuArm720tLib.h"
#elif (ARMMMU == ARMMMU_810)
#include "mmuArm810Lib.h"
#elif (ARMMMU == ARMMMU_SA110)
#include "mmuArmSA110Lib.h"
#elif (ARMMMU == ARMMMU_SA1100)
#include "mmuArmSA1100Lib.h"
#elif (ARMMMU == ARMMMU_SA1500)
#include "mmuArmSA1500Lib.h"
#elif (ARMMMU == ARMMMU_920T)
#include "mmuArm920tLib.h"
#elif (ARMMMU == ARMMMU_926E)
#include "mmuArm926eLib.h"
#elif (ARMMMU == ARMMMU_XSCALE)
#include "mmuArmXSCALELib.h"
#elif (ARMMMU == ARMMMU_MANZANO)
#include "mmuArmManzanoLib.h"
#elif (ARMMMU == ARMMMU_1020E)
#include "mmuArm1020eLib.h"
#elif (ARMMMU == ARMMMU_1022E)
#include "mmuArm1022eLib.h"
#elif (ARMMMU == ARMMMU_1136JF)
#include "mmuArm1136jfLib.h"
#elif (ARMMMU == ARMMMU_CORTEXA8)
#include "mmuCortexA8Lib.h"
#elif (ARMMMU == ARMMMU_11MPCORE)
#include "mmuArm11MPCoreLib.h"
#elif (ARMMMU == ARMMPU_740T)
#include "mpuArm740tLib.h"
#elif (ARMMMU == ARMMPU_940T)
#include "mpuArm940tLib.h"
#elif (ARMMMU == ARMMPU_946E)
#include "mpuArm946eLib.h"
#else
#error "Unknown MMU specified"
#endif /* ARMMMU == ARMMMU_710A */
#endif /* (ARMMMU != ARMMMU_NONE) */
#ifdef __cplusplus
extern "C" {
#endif
/* Any expression using C statements must be defined here */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArmLibh */
@@ -0,0 +1,479 @@
/* mmuArmLpaeLib.h - ARM LPAE MMU library header file */
/*
* Copyright (c) 2013-2014 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
17apr14,c_l add the write protection of L2 page table. (VXW6-73478)
01a,01jun13,zgl written
*/
#ifndef __INCmmuArmLpaeLibh
#define __INCmmuArmLpaeLibh
#ifndef _ASMLANGUAGE
/* includes */
#include <memLib.h>
#include <semLib.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* _ASMLANGUAGE */
/* defines */
/* make mask, h = end bit, l = start bit */
#define MAKE_MASK_64(h,l) (((1ULL << (h + 1)) - 1) & ~((1ULL << l) - 1))
#define MAKE_MASK_32(h,l) (((1UL << (h + 1)) - 1) & ~((1UL << l) - 1))
/*
* The page size we will use. Ignore the sub-page, Large Page and Tiny
* Page features.
*/
#define MMU_PAGE_SIZE 4096
#define PAGE_SIZE MMU_PAGE_SIZE
#define MMU_ADRS_TO_L1D_INDEX_SHIFT 30
#define MMU_ADRS_TO_L2D_INDEX_SHIFT 21
#define MMU_PAGE_SIZE_SHIFT 12
#define MMU_LPAE_NO_BITS_PHYS_ADDR 40
/* get Level 2 index */
#define MMU_L2PD_INDEX_GET(vaddr) \
((vaddr >> MMU_ADRS_TO_L2D_INDEX_SHIFT) & (MMU_NUM_L2_DESCS - 1))
#define MMU_PTE_INDEX_MASK MAKE_MASK_32(20,12) /* extract PTE index from */
/* Virt Addr */
#define MMU_PTE_BA_MASK MAKE_MASK_64(39,12) /* extract phys base address */
#define MMU_PTE_INDEX_SHIFT 12 /* shift to make that into PTE index */
#define MMU_ADDR_PI_MASK 0x00000FFF /* extract page offset from Virt Addr */
/* extract phys L2 page table base addr from L1PD */
#define MMU_L1PD_L2TBL_MASK MAKE_MASK_64(39,12)
/* extract phys L3 page table base addr from L2PD */
#define MMU_L2PD_L3TBL_MASK MMU_L1PD_L2TBL_MASK
/* Level 1/2 Descriptor types */
#define MMU_DESC_TYPE_FAULT 0x0 /* any access will cause a fault */
#define MMU_DESC_TYPE_BLOCK 0x1 /* block descriptor */
#define MMU_DESC_TYPE_TABLE 0x3 /* page table descriptor */
/* defalt Descriptor types for Level 1/2 */
#define MMU_DEF_L1_PAGE MMU_DESC_TYPE_TABLE
#define MMU_DEF_L2_PAGE MMU_DEF_L1_PAGE
/* Level 3 Descriptor or Page Table Entry (PTE) types */
#define MMU_PTE_TYPE_FAULT 0x0 /* any access will cause a fault */
#define MMU_PTE_TYPE_PAGE 0x3 /* page descriptor */
#define MMU_PTE_AF (1 << 10) /* access flag bit */
/* No. of Descriptor for each page table level */
#define MMU_NUM_L1_DESCS 4
#define MMU_NUM_L2_DESCS 512
#define MMU_NUM_L3_DESCS 512
#define MMU_L1_TABLE_SIZE MMU_PAGE_SIZE
/* No. of pages a Level 1 Descriptor table takes up */
#define MMU_L1_DESC_PAGES (MMU_L1_TABLE_SIZE / MMU_PAGE_SIZE)
/* The amount described by a L1 Descriptor */
#define MMU_L1_DESC_RANGE (MMU_NUM_L2_DESCS * MMU_NUM_L3_DESCS * MMU_PAGE_SIZE)
/* Size of a Page Table */
#define MMU_PAGE_TABLE_SIZE MMU_PAGE_SIZE
/*
* The amount described by a L2 Descriptor, which equals the smallest
* amount of VM allocatable in VxWorks.
*/
#define MMU_L2_DESC_RANGE (MMU_NUM_L3_DESCS * MMU_PAGE_SIZE) /* 2 MBytes */
#define MMU_PAGE_BLOCK_SIZE MMU_L2_DESC_RANGE
/* Number of possible ASIDs */
#define MMU_NUM_ASIDS 256
#define VXWORKS_KERNEL_ASID 0 /* reserved ASID for VxWorks kernel */
/*
* Architecture-dependent MMU states. These are states settable for pages and
* here they correspond to settings in the Page Table Entries (PTEs).
*/
#define MMU_STATE_INVALID_STATE 0xFFFFFFFF
#define MMU_STATE_MASK_VALID 0x00000003 /* bits[1:0] for PTE state */
#define MMU_STATE_MASK_WRITABLE 0x000000C0 /* AP[2:1], bits[7:6] */
#define MMU_STATE_MASK_CACHEABLE 0x0000031C /* SH[1:0], AttrIndex[2:0], */
/* bits[9:8] and bits[4:2] */
#define MMU_STATE_VALID 0x3 /* 0b11 means valid */
#define MMU_STATE_VALID_NOT 0x0 /* 0b00 means NOT valid */
#define MMU_STATE_MASK_PROTECTION 0x000000C0 /* AP[2:1], bits[7:6] */
#define MMU_STATE_SUP_RO 0x00000080 /* AP: 10 */
#define MMU_STATE_SUP_RW 0x00000000 /* AP: 00 */
#define MMU_STATE_SUP_RO_USR_RO 0x000000C0 /* AP: 11 */
#define MMU_STATE_SUP_RW_USR_RO 0x00000040 /* AP: 01, not support, */
/* here we set same as RW */
#define MMU_STATE_SUP_RW_USR_RW 0x00000040 /* AP: 01 */
/* XN not support */
#define MMU_STATE_SUP_RO_XN MMU_STATE_SUP_RO
#define MMU_STATE_SUP_RW_XN MMU_STATE_SUP_RW
#define MMU_STATE_SUP_RO_USR_RO_XN MMU_STATE_SUP_RO_USR_RO
#define MMU_STATE_SUP_RW_USR_RO_XN MMU_STATE_SUP_RW_USR_RO
#define MMU_STATE_SUP_RW_USR_RW_XN MMU_STATE_SUP_RW_USR_RW
#define MMU_STATE_WRITABLE MMU_STATE_SUP_RW
#define MMU_STATE_WRITABLE_NOT MMU_STATE_SUP_RO
#define MMU_STATE_AP_SUP_RO 0x2 /* AP field: 10 */
#define MMU_STATE_AP_SUP_RW 0x0 /* AP field: 00 */
#define MMU_STATE_AP_SUP_RO_USR_RO 0x3 /* AP field: 11 */
#define MMU_STATE_AP_SUP_RW_USR_RO 0x1 /* AP field: 01, arm not support */
#define MMU_STATE_AP_SUP_RW_USR_RW 0x1 /* AP field: 01 */
#define MMU_STATE_AP_USR_RO_SUP_RO MMU_STATE_AP_SUP_RO_USR_RO
#define MMU_STATE_AP_USR_RO_SUP_RW MMU_STATE_AP_SUP_RW_USR_RO
#define MMU_STATE_AP_USR_RW_SUP_RW MMU_STATE_AP_SUP_RW_USR_RW
/*
* Memory Region Attributes -
* cache access, write buffer access, coherency control
*/
/*
* Memory Region Attributes - for LPAE
*
* n = AttrIndex[2:0]
*
* n MAIR
* 000 00000000 Strongly-ordered
* 001 01000100 Normal memory, Inner & Outer Non-cacheable
* 010 10101010 Normal memory, Write-Through, Read-Allocate
* 011 11101110 Normal memory, Write-Back, Read-Allocate
* 100 00000100 Device memory
*/
#define MMU_MAIR0_VALUE 0xEEAA4400
#define MMU_MAIR1_VALUE 0x00000004
#define MMU_STATE_AI_STRONGLY_ORDERED 0x0 /* n = 0b000, strongly ordered */
#define MMU_STATE_STRONGLY_ORDERED ((MMU_STATE_AI_STRONGLY_ORDERED << 2) | \
MMU_STATE_SHARED_OUTER)
#define MMU_STATE_CACHEABLE_NOT MMU_STATE_STRONGLY_ORDERED
#define MMU_STATE_AI_DEVICE 0x4 /* n = 0b100 */
#define MMU_STATE_DEVICE_SHARED ((MMU_STATE_AI_DEVICE << 2) | \
MMU_STATE_SHARED_OUTER)
/* device always shared in LPAE */
#define MMU_STATE_DEVICE_NONSHARED MMU_STATE_DEVICE_SHARED
/* outer & inner write-thru cachable, write alloc */
#define MMU_STATE_AI_NORMAL_WRITETHROUGH 0x2 /* n = 0b010, Write-Through */
#define MMU_STATE_NORMAL_WRITETHROUGH (MMU_STATE_AI_NORMAL_WRITETHROUGH << 2)
#define MMU_STATE_CACHEABLE_WRITETHROUGH MMU_STATE_NORMAL_WRITETHROUGH
/* outer & inner write-back cachable, write alloc */
#define MMU_STATE_AI_NORMAL_WRITEBACK 0x3 /* n = 0b011, Write-Back */
#define MMU_STATE_NORMAL_WRITEBACK (MMU_STATE_AI_NORMAL_WRITEBACK << 2)
#define MMU_STATE_CACHEABLE_COPYBACK MMU_STATE_NORMAL_WRITEBACK
#define MMU_STATE_COPYBACK_ALLOC MMU_STATE_NORMAL_WRITEBACK
/* outer & inner Non-cachable */
#define MMU_STATE_AI_NORMAL_NONCACHEABLE 0x1 /* n = 0b001, Non-cacheable */
#define MMU_STATE_NORMAL_NONCACHEABLE (MMU_STATE_AI_NORMAL_NONCACHEABLE << 2)
/*
* Set the default state to be copyback.
*/
#define MMU_STATE_CACHEABLE MMU_STATE_CACHEABLE_COPYBACK
/*
* Shared memory attribute -
* accessible by multiple processors or bus masters and must be kept coherent
*/
#define MMU_STATE_SHARED_OUTER (0x2 << 8) /* Outer Shareable */
#define MMU_STATE_SHARED_INNER (0x3 << 8) /* Inner Shareable */
#define MMU_STATE_SHARED MMU_STATE_SHARED_INNER
#define MMU_STATE_WRITETHROUGH_SHARED \
(MMU_STATE_CACHEABLE_WRITETHROUGH | MMU_STATE_SHARED)
#define MMU_STATE_COPYBACK_SHARED \
(MMU_STATE_CACHEABLE_COPYBACK | MMU_STATE_SHARED)
/*
* A memory region with a resultant memory type attribute of Normal, and a
* resultant cacheability attribute of Inner Non-cacheable, Outer Non-cacheable,
* must have a resultant shareability attribute of Outer Shareable, otherwise
* shareability is UNPREDICTABLE.
*/
#define MMU_STATE_NONCACHEABLE_SHARED \
(MMU_STATE_NORMAL_NONCACHEABLE | \
MMU_STATE_SHARED_OUTER)
/*
* Global memory attribute -
* not-Global causes ASID to be associated with address translation
*/
#define MMU_STATE_NOT_GLOBAL 0x00000800 /* not-Global, bit[11] */
/*
* Architecture-specific attributes
*
* The following ARMv7-specific aliases are provided for ease of use.
*
* NOTE: MMU_ATTR_CACHE_GUARDED is used as MMU_ATTR_CACHE_IO (its former name).
*/
/* Strongly Ordered - same as MMU_ATTR_CACHE_OFF for backward compatibility */
#define MMU_ATTR_STRONGLY_ORDERED (MMU_ATTR_CACHE_OFF)
/* Shared Device */
#define MMU_ATTR_DEVICE_SHARED_MSK (MMU_ATTR_CACHE_MSK)
#define MMU_ATTR_DEVICE_SHARED (MMU_ATTR_CACHE_GUARDED | MMU_ATTR_CACHE_OFF | \
MMU_ATTR_CACHE_COHERENCY)
#define MMU_ATTR_BUFFERABLE MMU_ATTR_DEVICE_SHARED /* backward compatible */
/* Normal, Noncacheable memory */
#define MMU_ATTR_NORMAL_NONCACHEABLE_MSK (MMU_ATTR_CACHE_MSK)
#define MMU_ATTR_NORMAL_NONCACHEABLE (MMU_ATTR_CACHE_OFF)
#define MMU_ATTR_NORMAL_NONCACHEABLE_SHARED (MMU_ATTR_NORMAL_NONCACHEABLE | \
MMU_ATTR_CACHE_COHERENCY)
/* Normal, Inner Cache Write-Back, Write Allocate */
#define MMU_ATTR_WRITEALLOCATE_MSK MMU_ATTR_CACHE_MSK
#define MMU_ATTR_WRITEALLOCATE MMU_ATTR_CACHE_COPYBACK
#define MMU_ATTR_WRITEALLOCATE_SHARED (MMU_ATTR_WRITEALLOCATE | \
MMU_ATTR_CACHE_COHERENCY)
/* MMU Control Register bit allocations */
#define MMUCR_M_ENABLE (1<<0) /* MMU enable */
#define MMUCR_A_ENABLE (1<<1) /* Address alignment fault enable */
#define MMUCR_C_ENABLE (1<<2) /* (data) cache enable */
#define MMUCR_W_ENABLE (1<<3) /* write buffer enable */
#define MMUCR_PROG32 (1<<4) /* PROG32 */
#define MMUCR_DATA32 (1<<5) /* DATA32 */
#define MMUCR_L_ENABLE (1<<6) /* Late abort on earlier CPUs */
#define MMUCR_BIGEND (1<<7) /* Big-endian (=1), little-endian (=0) */
#define MMUCR_SYSTEM (1<<8) /* System bit, modifies MMU protections */
#define MMUCR_ROM (1<<9) /* ROM bit, modifies MMU protections */
#define MMUCR_F (1<<10) /* Should Be Zero */
#define MMUCR_Z_ENABLE (1<<11) /* Branch prediction enable on 810 */
#define MMUCR_I_ENABLE (1<<12) /* Instruction cache enable */
#define MMUCR_V_ENABLE (1<<13) /* Exception vectors remap to 0xFFFF0000 */
#define MMUCR_ALTVECT MMUCR_V_ENABLE /* alternate vector select */
#define MMUCR_RR_ENABLE (1<<14) /* Round robin cache replacement enable */
#define MMUCR_ROUND_ROBIN MMUCR_RR_ENABLE /* round-robin placement */
#define MMUCR_DISABLE_TBIT (1<<15) /* disable TBIT */
#define MMUCR_ENABLE_DTCM (1<<16) /* Enable Data TCM */
#define MMUCR_HA_ENABLE (1<<17) /* Hardware Access flag enable */
#define MMUCR_ENABLE_ITCM (1<<18) /* Enable Instruction TCM */
#define MMUCR_UNALIGNED_ENABLE (1<<22) /* Enable unaligned access */
#define MMUCR_EXTENDED_PAGE (1<<23) /* Use extended PTE format */
#define MMUCR_VECTORED_INTERRUPT (1<<24) /* Enable VIC Interface */
#define MMUCR_EE (1<<25) /* Exception Endianness bit */
#define MMUCR_THUMB_EXCEPTIONS (1<<30) /* Exceptions are Thumb */
/* MMU TTBR 64 bit register fields for LPAE */
#define MMU_TTBR64_BA_MASK MAKE_MASK_64(39, 12)
#define MMU_TTBR64_ASID_SHIFT 48
/* MMU TTBCR register fields for LPAE */
#define MMU_TTBCR_IRGN_NC (0 << 8)
#define MMU_TTBCR_IRGN_WBWA (1 << 8)
#define MMU_TTBCR_IRGN_WT (2 << 8)
#define MMU_TTBCR_IRGN_WB (3 << 8)
#define MMU_TTBCR_ORGN_NC (0 << 10)
#define MMU_TTBCR_ORGN_OC_WBWA (1 << 10)
#define MMU_TTBCR_ORGN_OC_WT (2 << 10)
#define MMU_TTBCR_ORGN_OC_WB (3 << 10)
#define MMU_TTBCR_S (3 << 12)
#define MMU_TTBCR_S_OUTER (2 << 12)
#define MMU_TTBCR_EAE (1 << 31)
#ifdef _WRS_CONFIG_ENABLE_CACHED_PAGE_TBL
/* PTWs cacheable, inner WBWA not shareable, outer WBWA not shareable */
#define MMU_TTBCR_FLAGS_UP (MMU_TTBCR_IRGN_WBWA | MMU_TTBCR_ORGN_OC_WBWA)
/* PTWs cacheable, inner WBWA shareable, outer WBWA not shareable */
#define MMU_TTBCR_FLAGS_SMP (MMU_TTBCR_IRGN_WBWA | MMU_TTBCR_S | \
MMU_TTBCR_ORGN_OC_WBWA)
#else /* !_WRS_CONFIG_ENABLE_CACHED_PAGE_TBL */
/* PTWs not cacheable, inner not shareable, outer not shareable */
#define MMU_TTBCR_FLAGS_UP (MMU_TTBCR_IRGN_NC | MMU_TTBCR_ORGN_NC)
/* PTWs not cacheable, inner shareable, outer not shareable */
#define MMU_TTBCR_FLAGS_SMP (MMU_TTBCR_ORGN_NC | MMU_TTBCR_S | \
MMU_TTBCR_ORGN_NC)
#endif /* _WRS_CONFIG_ENABLE_CACHED_PAGE_TBL */
/* typedefs */
#ifndef _ASMLANGUAGE
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* little-endian */
/* Level 1/2 page descriptors */
typedef struct
{
UINT type : 2; /* descriptor type, 0b11 => page table */
UINT pad1 : 10; /* Ignored */
UINT addr : 20; /* base address of page table */
UINT addr40 : 8; /* base address of page table */
UINT pad2 : 12; /* UNK/SBZP */
UINT pad3 : 7; /* Ignored */
UINT pxn : 1; /* PXNTable */
UINT xn : 1; /* XNTable */
UINT ap : 2; /* APTable */
UINT ns : 1; /* NSTable */
} PAGE_DESC_FIELD;
/* Layout of Page Table Entries (PTEs) */
typedef struct
{
UINT type : 2; /* page type, 0b11 => page */
UINT ai : 3; /* AttrIndx[2:0] */
UINT ns : 1; /* non-secure bit */
UINT ap : 2; /* AP[2:1], access permission */
UINT sh : 2; /* SH[1:0], shareability field */
UINT af : 1; /* access flag */
UINT ng : 1; /* not global bit */
UINT addr : 20; /* phys address */
UINT addr40 : 8; /* phys address */
UINT pad1 : 12; /* UNK/SBZP */
UINT ch : 1; /* contiguous hint */
UINT pxn : 1; /* privileged execute-never bit */
UINT xn : 1; /* execute-never bit */
UINT pad2 : 9; /* ignored */
} PTE_FIELD;
#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* big-endian */
#error "LPAE for big-endian not support yet."
#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* First/second level descriptor access */
typedef union
{
PAGE_DESC_FIELD fields;
UINT bits[2];
UINT64 bits64;
} MMU_LEVEL_1_DESC, MMU_LEVEL_2_DESC;
/* Third level descriptor access */
typedef union
{
PTE_FIELD fields;
UINT bits[2];
UINT64 bits64;
} PTE;
/*
* Structure for MMU translation table access - normally used to get a pointer
* to the first-level translation table.
*/
typedef struct mmuTransTblStruct
{
MMU_LEVEL_1_DESC *pLevel1Table; /* active MMU table */
VX_MUTEX_SEMAPHORE(mmuTransTblSem); /* MMU tables' semaphore */
UINT32 lockCnt; /* lock count */
atomic_t lockOwner; /* lock owner */
UINT8 asid; /* ASID/context id */
} MMU_TRANS_TBL;
/* function declarations */
/* Externally visible mmuLib, mmuMapLib and mmuALib2 routines */
IMPORT UINT32 mmuReadId (void);
IMPORT PHYS_ADDR mmuVirtToPhys (VIRT_ADDR addr);
IMPORT VIRT_ADDR mmuPhysToVirt (PHYS_ADDR addr);
IMPORT UINT32 (* mmuCrGet) (void);
IMPORT void (* mmuModifyCr) (UINT32 value, UINT32 mask);
IMPORT UINT32 mmuHardCrGet (void);
IMPORT void mmuModifyHardCr (UINT32 value, UINT32 mask);
IMPORT UINT32 (* _func_mmuFaultAddrGet) (void);
IMPORT UINT32 (* _func_mmuFaultStatusGet) (void);
IMPORT UINT32 (* _func_mmuIFaultStatusGet) (void);
IMPORT UINT32 mmuIFsrGet (void);
IMPORT UINT32 mmuFarGet (void);
IMPORT UINT32 mmuFsrGet (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArmLpaeLibh */
@@ -0,0 +1,78 @@
/* mmuArmManzano.h - Manzano (XScale varient) MMU library header file */
/* Copyright (c) 1998-2006 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
012,22feb06,m_h Manzano Support
011,25jan06,m_h created.
*/
#ifndef __INCmmuArmManzanoLibh
#define __INCmmuArmManzanoLibh
/* Enable support for supersection descriptors */
#undef INCLUDE_MMU_SUPERSECTION_SUPPORT
#define INCLUDE_MMU_SUPERSECTION_SUPPORT
#ifdef INCLUDE_MMU_SUPERSECTION_SUPPORT
/* Supersections require "section" functionality */
#undef INCLUDE_MMU_SECTION_SUPPORT
#define INCLUDE_MMU_SECTION_SUPPORT
#endif /* INCLUDE_MMU_SUPERSECTION_SUPPORT */
#undef INCLUDE_MMU_SBIT_SUPPORT
#define INCLUDE_MMU_SBIT_SUPPORT
#include "arch/arm/mmuArmXSCALELib.h"
#ifndef _ASMLANGUAGE
#if defined(__STDC__) || defined(__cplusplus)
IMPORT void mmuMANZANOLibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void mmuMANZANOTtbrSet (MMU_LEVEL_1_DESC *);
IMPORT MMU_LEVEL_1_DESC * mmuMANZANOTtbrGet ( void);
IMPORT void mmuMANZANODacrSet (UINT32 dacrVal);
IMPORT void mmuMANZANOTLBIDFlushEntry (void *addr);
IMPORT void mmuMANZANOTLBIDFlushAll (void);
IMPORT void mmuMANZANOAEnable (UINT32 cacheState);
IMPORT void mmuMANZANOADisable (void);
IMPORT STATUS mmuMANZANOPBitSet ( void * virtAddr, UINT32 size);
IMPORT STATUS mmuMANZANOPBitClear ( void * virtAddr, UINT32 size);
IMPORT STATUS mmuMANZANOPBitGet ( void * virtAddr );
IMPORT STATUS mmuMANZANOAcrGet (void );
IMPORT void mmuMANZANOAcrSet (UINT32 acrVal);
#else /* __STDC__ */
IMPORT void mmuMANZANOLibInstall ();
IMPORT void mmuMANZANOTtbrSet ();
IMPORT MMU_LEVEL_1_DESC * mmuMANZANOTtbrGet ();
IMPORT void mmuMANZANODacrSet ();
IMPORT void mmuMANZANOTLBIDFlushEntry ();
IMPORT void mmuMANZANOTLBIDFlushAll ();
IMPORT void mmuMANZANOAEnable ();
IMPORT void mmuMANZANOADisable ();
IMPORT STATUS mmuMANZANOPBitSet ();
IMPORT STATUS mmuMANZANOPBitClear ();
IMPORT STATUS mmuMANZANOPBitGet ();
IMPORT STATUS mmuMANZANOAcrGet ();
IMPORT void mmuMANZANOAcrSet ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#endif /* __INCmmuArmManzanoLibh */
@@ -0,0 +1,611 @@
/* mmuArmPalLib.h - ARM MMU library header file */
/*
* Copyright (c) 1996-2007, 2009-2010, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
02i,02mar12,rec WIND00318272 - POSIX signals conformance
02h,09jan12,rec WIND00196578 - remove unused reference _func_armPageSource
02g,29apr10,pad Moved extern C statement after include statements.
02f,03nov09,j_b add INCLUDE_MMU_SUBPAGE_SUPPORT, undef INCLUDE_MMU_TEX_SUPPORT
02e,23oct07,to added lockCnt and lockOwner to MMU_TRANS_TBL
02d,21sep07,to define MMU_PAGE_SIZE_SHIFT
02c,21sep07,j_b add _func_mmuFaultAddrGet prototype
02b,09feb07,j_b add mmuFarGet prototype
02a,20sep06,j_b add page optimization support
01z,12sep06,m_h fix vert-to-phys translation problem in upper bits
WIND00059266
01y,28mar06,m_h Coherancy Support (s-bit)
01x,01mar06,m_h Section Support in non-XScale ARM
01w,03jan06,m_h Manzano Support
01v,24jun05,scm correct PAGE_DESC_FIELD for missing BE pad3 field, (SPR 110348)
01u,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01t,31jan05,jb Adding OTHER_SECT_DESC to resolve bsp reference
01s,09dec04,jb Palifying mmu, extracted from mmuArmLib.h, 01r
*/
/*
History from mmuArmLib.h
01r,10aug04,scm adjust for removal of MPU support, add 926E...
01q,18sep03,scm BASE 6 port...
01p,04oct01,scm add extended small page table support for XScale...
01o,23jul01,scm change XScale name to conform to coding standards...
01n,11jul01,scm add support for XScale...
01m,29mar01,jpd removed externs for mmyPhysToVirt & mmuVirtToPhys (SPR #63512).
01l,19mar01,jpd redefine MMU_ATTR_BUFFERABLE and MMU_ATTR_CACHE_MINICACHE
(SPR #64788).
01k,16aug00,jpd no longer clear MMUCR Reserved/Should Be Zero bits (SPR #33608)
01j,14jun00,jpd reworked MMU_STATE_WRITETHROUGH definition.
01i,17feb00,jpd T3: prefixed defs with MMU_; added new defs; changed SR to 10.
01h,07sep99,jpd added ARM740T, ARM920T support.
01g,20jan99,cdp removed support for old ARM libraries;
add prefix to MMU_IDs.
01f,24nov98,jpd added ARM940T support, added other CPU ids; removed
mmuIntLock/Unlock as intIFLock/Unlock to be used instead;
cdp restructured for multiple cache/MMU libraries; big-endian.
01e,09mar98,jpd added MMUCTR_ definitions for ARM810 and extra cache states.
01d,20jan98,jpd added _func_armPhysToVirt() etc. function pointers.
01c,17sep97,jpd added MMU_INIT_VALUE and mmuIntLock/Unlock definitions.
01b,24jan97,jpd modified mmuAEnable definition.
01a,09may96,cdp created.
*/
#ifndef __INCmmuArmPalLibh
#define __INCmmuArmPalLibh
#ifndef _ASMLANGUAGE
#include <memLib.h>
#include <semLib.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* _ASMLANGUAGE */
/*
* MMUs are not fitted to all processors, and so the definitions below
* should not need to be included for processors without MMUs.
*/
#if (ARMMMU != ARMMMU_NONE)
/*
* The page size we will use. Ignore the sub-page, Large Page and Tiny
* Page features.
*/
#define MMU_PAGE_SIZE 4096
#define MMU_PAGE_SIZE_SHIFT 12
#undef INCLUDE_MMU_SUBPAGE_SUPPORT
#define INCLUDE_MMU_SUBPAGE_SUPPORT
#undef INCLUDE_MMU_TEX_SUPPORT
/*
* The amount described by a Level 1 Descriptor, which equals the smallest
* amount of VM allocatable in VxWorks.
*/
#define MMU_PAGE_BLOCK_SIZE 0x100000 /* 1 MByte */
#define MMU_ADRS_TO_L1D_INDEX_SHIFT 20
#define MMU_PTE_INDEX_MASK 0x000FF000 /* extract PTE index from Virt Addr */
#define MMU_PTE_INDEX_SHIFT 12 /* shift to make that into PTE index */
#define MMU_L1D_TO_BASE_SHIFT 10 /* to turn L1D to PT base addr */
#define MMU_L1DSECTION_TO_BASE_SHIFT 20 /* L1D section to PT base addr */
#define MMU_L1DSECTION_BA_MASK 0xFFF00000 /* phys bits 20-31 */
#define MMU_L1DSSECTIONLO_TO_BASE_SHIFT 24 /* bits 24-31 of supersection */
#define MMU_L1DSSECTIONHI_TO_BASE_SHIFT 32 /* bits 32-35 of supersection */
#define MMU_L1DSSECTIONLO_BA_MASK 0xFF000000 /* phys bits 24-31 */
#define MMU_L1DSSECTIONHI_BA_MASK 0x00F00000 /* phys bits 32-35 */
#define MMU_ADDR_PI_MASK 0x00000FFF /* extract page index from Virt Addr */
#define MMU_PTE_BA_MASK 0xFFFFF000 /* extract phys base address from PTE */
#define MMU_ADDR_SI_MASK 0x000FFFFF /* extr section index from Virt Addr */
#define MMU_PTE_SECA_MASK 0xFFF00000 /* extract section base from L1 desc */
#define MMU_ADDR_SSI_MASK 0x00FFFFFF /* supersection index from virt */
#define MMU_PTE_SSECA_MASK 0xFF000000 /* supersection base from L1 desc */
#define MMU_PTE_SSECAX_MASK 0x00F00000 /* supersection extended bits L1 */
#define MMU_PTE_SSECAX_SHIFT 12 /* supersection extended bits L1 */
#define MMU_PTE_TYPE_MASK 0x00000003 /* bits [0:1] */
#define MMU_L1PD_PTE_MASK 0xFFFFFC00 /* extract phys PTE addr from L1PD */
#define MMU_L1PD_TYPE_MASK 0x00000003 /* type bits [0:1] */
#define MMU_L1PD_CB_MASK 0x0000000C /* CB bits [3:2] */
#define MMU_L1PD_AP_MASK 0x00000C00 /* AP bits [10:11] */
#define MMU_L1PD_P_MASK 0x00000200 /* P bit [9] */
#define MMU_L1PD_TEX_MASK 0x00007000 /* TEX bits [14:12] */
#define MMU_L1PD_S_MASK 0x00010000 /* S bit (coherancy) [16] */
#define MMU_PTE_SECT_CB_MASK 0x0000000C /* CB bits [3:2] */
#define MMU_PTE_SECT_AP_MASK 0x00000030 /* AP bits [5:4] */
#define MMU_PTE_SECT_TEX_MASK 0x000001C0 /* TEX bits [8:6] */
#define MMU_PTE_SECT_S_MASK 0x00000200 /* S-bit (coherancy) [9] */
#define MMU_L1L2_SECT_CB_SHIFT 0 /* CB shift convert L1 to L2 */
#define MMU_L1L2_SECT_AP_SHIFT 6 /* AP shift convert L1 to L2 */
#define MMU_L1L2_SECT_TEX_SHIFT 6 /* TEX shift convert L1 to L2 */
#define MMU_L1L2_SECT_S_SHIFT 7 /* S-bit shift convert L1 to L2 */
#define MMU_PTE_SSECT_TYPE 0x00040000 /* supersection bit [18] */
#define MMU_PTE_SECT_TYPE_MASK 0x00040000 /* which type of section? */
#define MMU_NUM_VM_PAGES_IN_A_SECT 0x100
#define MMU_NUM_VM_PAGES_IN_A_SSECT 0x1000
#define MMU_NUM_SECTS_IN_A_SSECT 0x10 /* 16 sections/supersection */
#define MMU_SECT_SIZE 0x100000 /* section = 1MB */
#define MMU_SSECT_SIZE 0x1000000 /* supersection = 16MB */
#define MMU_L1PD_AP_SHIFT 10
#define MMU_L1PD_CB_SHIFT 2
#define MMU_L1PD_P_SHIFT 9
#define MMU_L1PD_S_SHIFT 16
#define MMU_L1PD_DOMAIN_MASK 0x000001E0 /* domain bits 5-8 */
#define MMU_L1PD_DOMAIN_SHIFT 5 /* shift to make domain field in L1PD */
/*
* The Domain Access Control Register specifies the way in which access
* rights are treated for each of sixteen domains. For each domain the
* current state can be:
*
* 00 no access: all accesses generate aborts
* 01 client: access rights specified in page tables are checked.
* 10 reserved
* 11 manager: accesses not checked against page tables: all access allowed.
*/
#define MMU_DACR_VAL_NORMAL 1 /* client of 0 */
#define MMU_DACR_VAL_UNPROTECT 0x03 /* manager of 0 */
/* Level 1 Descriptor types */
#define MMU_DESC_TYPE_FAULT 0 /* any access will cause a fault */
#define MMU_DESC_TYPE_PAGE 1
#define MMU_DESC_TYPE_SECTION 2
#define MMU_DEF_L1_PAGE 0x00000011 /* domain zero, Page descriptor */
/*
* Section descriptors, such as might be used to set up an intermediate
* set of page tables on processors such as SA-1100/SA-1500 where this
* needs to be done from BSP initialization, before vm(Base)Lib sets up
* a proper set of page tables.
*/
#define MMU_RAM_SECT_DESC 0xC1E /* R/W cacheable bufferable domain 0 */
#define MMU_MINICACHE_SECT_DESC 0xC1A /* R/W C+ B- domain 0 */
#define MMU_OTHER_SECT_DESC 0xC12 /* R/W C- B- domain 0 */
/* Level 2 Descriptor or Page Table Entry (PTE) types */
#define MMU_PTE_TYPE_FAULT 0 /* any access will cause a fault */
#define MMU_PTE_TYPE_LG_PAGE 1 /* Large page descriptor */
#define MMU_PTE_TYPE_SM_PAGE 2 /* Small page descriptor */
#define MMU_PTE_TYPE_EX_PAGE 3 /* Extended page descriptor */
/*
* The Translation Table Base register (TTBR) points to a table of Level 1
* Descriptors. these are either Invalid Section descriptors, Section
* Descriptors, or Page Table Descriptors. If Page Table Descriptors, they
* each point to a table of Level 2 Page Descriptors, or Page Table Entries
* (PTEs).
* The 32-bit (virtual) address space allows for 4096 M. Each Level 1
* Descriptor describes a 1 M area of memory. There are therefore 4096 Level
* 1 Descriptors, and each table of 256 Level 2 Page Descriptors (PTEs)
* describes 256 4 kbyte pages.
*/
#define MMU_NUM_L1_DESCS 4096
#define MMU_NUM_L2_DESCS 256
#define MMU_L1_TABLE_SIZE (MMU_NUM_L1_DESCS * sizeof(MMU_LEVEL_1_DESC))
/* No. of pages a Level 1 Descriptor table takes up */
#define MMU_L1_DESC_PAGES (MMU_L1_TABLE_SIZE / MMU_PAGE_SIZE)
/* Size of a Page Table */
#define MMU_PAGE_TABLE_SIZE (MMU_NUM_L2_DESCS * sizeof(PTE))
/* Section and supersection L1 definitions follow */
#undef MMU_DEF_L1_SECTION_PAGE
#define MMU_DEF_L1_SECTION_PAGE 0x00000002 /* Section page descriptor */
#undef MMU_DEF_L1_SUPERSECTION_PAGE
#define MMU_DEF_L1_SUPERSECTION_PAGE 0x00040002 /* supersection */
#undef MMU_DEF_L1_SECTION_PAGE_MASK
#define MMU_DEF_L1_SECTION_PAGE_MASK 0x00040003 /* mask */
#undef MMU_STATE_SECTION_MASK_WRITABLE
#define MMU_STATE_SECTION_MASK_WRITABLE 0x00000030 /* All APn bits */
/*
* Architecture-dependent MMU states. These are states settable for pages and
* here they correspond to settings in the Page Table Entries (PTEs).
*
* We set Valid/Invalid by setting a Fault second-level descriptor rather
* than by using the Access Permissions within a small page second-level
* descriptor. This is because we will want to use the Access Permissions to
* control supervisor mode access and we cannot then use the AP bits
* to disallow access as the SR bits in the MMU Control register must be set
* to 10 in order to control read/write access from Supervisor mode.
*/
#define MMU_STATE_INVALID_STATE 0xFFFFFFFF
#define MMU_STATE_MASK_VALID 0x03 /* 2nd level desc type */
#define MMU_STATE_MASK_WRITABLE 0x00000FF0 /* All APn bits */
#define MMU_STATE_MASK_CACHEABLE 0x0000000C /* CB bits */
#define MMU_STATE_MASK_BUFFERABLE 0x00000004
#define MMU_STATE_MASK_MEM_COHERENCY 0x00000200 /* Manzano S-bit */
#define MMU_STATE_MEM_COHERENCY 0x00000200 /* Manzano S-bit */
#ifdef INCLUDE_MMU_SBIT_SUPPORT
#define MMU_STATE_MASK_CACHEABLE_S 0x0000020C /* CB&S bits */
#else /*INCLUDE_MMU_SBIT_SUPPORT*/
#define MMU_STATE_MASK_CACHEABLE_S 0x0000000C /* CB bits */
#endif /*INCLUDE_MMU_SBIT_SUPPORT*/
#define MMU_STATE_VALID MMU_PTE_TYPE_SM_PAGE /* set to page type */
#define MMU_STATE_VALID_NOT MMU_PTE_TYPE_FAULT /* set to type fault */
#define MMU_STATE_WRITABLE 0x00000FF0 /* APn bits to 11 */
#define MMU_STATE_WRITABLE_NOT 0x0 /* APn bits to 00 */
#define MMU_STATE_MASK_PROTECTION 0x00000FF0 /* APn bits */
#define MMU_STATE_SUP_RO 0x00000000 /* AP: 00 */
#define MMU_STATE_SUP_RW 0x00000550 /* AP: 01 */
#define MMU_STATE_USR_RO_SUP_RW 0x00000AA0 /* AP: 10 */
#define MMU_STATE_USR_RW_SUP_RW 0x00000FF0 /* AP: 11 */
#define MMU_STATE_AP_SUP_RO 0x0 /* AP field: 00 */
#define MMU_STATE_AP_SUP_RW 0x1 /* AP field: 01 */
#define MMU_STATE_AP_USR_RO_SUP_RW 0x2 /* AP field: 10 */
#define MMU_STATE_AP_USR_RW_SUP_RW 0x3 /* AP field: 11 */
/* Write-through mode is only available on some CPUs */
#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x8
#define MMU_STATE_CACHEABLE_COPYBACK 0xC /* write back */
/*
* Set the default state to be copyback. CACHEABLE_WRITETHROUGH can also be
* selected on those cache designs that permit it.
*/
#define MMU_STATE_CACHEABLE MMU_STATE_CACHEABLE_COPYBACK
#define MMU_STATE_CACHEABLE_NOT 0x0
#define MMU_STATE_BUFFERABLE 0x4 /* bufferable, not cacheable */
#define MMU_STATE_BUFFERABLE_NOT 0x0 /* will also set not cacheable*/
/*
* Under VxWorks AE 1.1, when setting either of the attributes SPL_0 or SPL_1,
* using vmPgAttrSet(), it is necessary to:
*
* 1. specify MMU_ATTR_SPL_MSK ORred with MMU_ATTR_CACHE_MSK in the mask
* argument to the routine, and:
* 2. specify the appropriate cache state ORred in to the state argument
* to the routine.
*
* So, to set a page as bufferable not cacheable, it is necessary to
* specify both MMU_ATTR_SPL_0 and specify MMU_ATTR_CACHE_OFF in the
* state argument. To mark a page as cacheable in the minicache,
* MMU_ATTR_SPL_1 and MMU_ATTR_CACHE_COPYBACK must be specified in the
* state argument. In both cases, specify MMU_ATTR_SPL_MSK ORred with
* MMU_ATTR_CACHE_MSK in the mask argument.
*
* These restrictions were not present in VxWorks AE 1.0.
*
* To "unset" the special attibutes SPL_0 or SPL_1, specify
* MMU_ATTR_CACHE_MSK in the mask parameter (without MMU_ATTR_SPL_MSK),
* and specify the cacheability required in the state argument.
*
* We provide the following aliases on ARM, to make life easier.
*/
#define MMU_ATTR_BUFFERABLE (MMU_ATTR_SPL_0)
/* MMU Control Register bit allocations */
#define MMUCR_M_ENABLE (1<<0) /* MMU enable */
#define MMUCR_A_ENABLE (1<<1) /* Address alignment fault enable */
#define MMUCR_C_ENABLE (1<<2) /* (data) cache enable */
#define MMUCR_W_ENABLE (1<<3) /* write buffer enable */
#define MMUCR_PROG32 (1<<4) /* PROG32 */
#define MMUCR_DATA32 (1<<5) /* DATA32 */
#define MMUCR_L_ENABLE (1<<6) /* Late abort on earlier CPUs */
#define MMUCR_BIGEND (1<<7) /* Big-endian (=1), little-endian (=0) */
#define MMUCR_SYSTEM (1<<8) /* System bit, modifies MMU protections */
#define MMUCR_ROM (1<<9) /* ROM bit, modifies MMU protections */
#define MMUCR_F (1<<10) /* Should Be Zero */
#define MMUCR_Z_ENABLE (1<<11) /* Branch prediction enable on 810 */
#define MMUCR_I_ENABLE (1<<12) /* Instruction cache enable */
#define MMUCR_V_ENABLE (1<<13) /* Exception vectors remap to 0xFFFF0000 */
#define MMUCR_ALTVECT MMUCR_V_ENABLE /* alternate vector select */
#define MMUCR_RR_ENABLE (1<<14) /* Round robin cache replacement enable */
#define MMUCR_ROUND_ROBIN MMUCR_RR_ENABLE /* round-robin placement */
#define MMUCR_DISABLE_TBIT (1<<15) /* disable TBIT */
/* The following definitions are now deprecated and may be withdrawn */
#ifdef MMU_ARM_ALLOW_DEPRECATED
#define LEVEL_1_DESC MMU_LEVEL_1_DESC
#define PAGE_SIZE MMU_PAGE_SIZE
#define PAGE_BLOCK_SIZE MMU_PAGE_BLOCK_SIZE
#define PTE_INDEX_MASK MMU_PTE_INDEX_MASK
#define PTE_INDEX_SHIFT MMU_PTE_INDEX_SHIFT
#define L1D_TO_BASE_SHIFT MMU_L1D_TO_BASE_SHIFT
#define ADDR_PI_MASK MMU_ADDR_PI_MASK
#define NUM_L1_DESCS MMU_NUM_L1_DESCS
#define NUM_L2_DESCS MMU_NUM_L2_DESCS
#define L1_TABLE_SIZE MMU_L1_TABLE_SIZE
#define L1_DESC_PAGES MMU_L1_DESC_PAGES
#define PAGE_TABLE_SIZE MMU_PAGE_TABLE_SIZE
#define DESC_TYPE_PAGE MMU_DESC_TYPE_PAGE
#define DEF_L1_PAGE MMU_DEF_L1_PAGE
#define PTE_TYPE_FAULT MMU_PTE_TYPE_FAULT
#define PTE_TYPE_SM_PAGE MMU_PTE_TYPE_SM_PAGE
#define RAM_SECT_DESC MMU_RAM_SECT_DESC
#define MINICACHE_SECT_DESC MMU_MINICACHE_SECT_DESC
#define OTHER_SECT_DESC MMU_OTHER_SECT_DESC
#else /* MMU_ARM_ALLOW_DEPRECATED */
/* Some BSPs still reference PAGE_SIZE */
#define PAGE_SIZE MMU_PAGE_SIZE
/* Some BSPs still reference OTHER_SECT_DESC */
#define OTHER_SECT_DESC MMU_OTHER_SECT_DESC
#endif /* MMU_ARM_ALLOW_DEPRECATED */
#define ADDR_TO_PAGE 12 /* shift phys address to PTE page base address */
#ifndef _ASMLANGUAGE
/* If using standard ARM MMU structures */
#ifndef MMU_ARCHITECTURE_DEFINES_STRUCTURES
/* Default ARMARCH4/5 ARM MMU Structures */
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* little-endian */
/* First level page descriptors */
typedef struct
{
UINT type : 2; /* descriptor type, 1 => page */
UINT pad1 : 2; /* SBZ */
UINT pad2 : 1; /* SBO */
UINT domain : 4; /* domain number */
UINT pad3 : 1; /* SBZ */
UINT addr : 22; /* base address of page table */
} PAGE_DESC_FIELD;
/* First level "section" descriptor */
typedef struct
{
UINT type : 2; /* descriptor type, 2 => section */
UINT bbit : 1; /* bufferable-bit */
UINT cbit : 1; /* cacheable-bit */
UINT pad1 : 1; /* SBO */
UINT domain : 4; /* domain number */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT ap : 2; /* AP */
UINT tex : 3; /* AP */
UINT pad2 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad3 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad4 : 1; /* SBO */
UINT addr : 12; /* base address of page table */
} SECTION_DESC_FIELD;
/* First level "supersection" descriptor */
typedef struct
{
UINT type : 2; /* descriptor type, 2 => section */
UINT bbit : 1; /* bufferable-bit */
UINT cbit : 1; /* cacheable-bit */
UINT pad1 : 1; /* SBO */
UINT addrHi2: 4; /* phys address 39:36 */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT ap : 2; /* AP */
UINT tex : 3; /* TEX */
UINT pad2 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad3 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad4 : 1; /* SBO */
UINT addrHi : 4; /* phys address 35:32 */
UINT addrLo : 8; /* phys address 31:24 */
} SUPERSECTION_DESC_FIELD;
/* Layout of Page Table Entries (PTEs), actually small page descriptors */
typedef struct
{
UINT type : 2; /* page type, 2 => small page */
UINT cb : 2; /* cacheable/bufferable bits */
UINT ap0 : 2; /* access permission, sub-page 0 */
UINT ap1 : 2; /* access permission, sub-page 1 */
UINT ap2 : 2; /* access permission, sub-page 2 */
UINT ap3 : 2; /* access permission, sub-page 3 */
UINT addr : 20; /* page base address */
} PTE_FIELD;
#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* big-endian */
/* First level descriptors */
typedef struct
{
UINT addr : 22; /* descriptor type, 1 => page */
UINT pad3 : 1; /* SBZ */
UINT domain : 4; /* domain number */
UINT pad2 : 1; /* SBO */
UINT pad1 : 2; /* SBZ */
UINT type : 2; /* base address of page table */
} PAGE_DESC_FIELD;
/* First level "section" descriptor */
typedef struct
{
UINT addr : 12; /* base address of page table */
UINT pad4 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad3 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad2 : 1; /* SBO */
UINT tex : 3; /* AP */
UINT ap : 2; /* AP */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT domain : 4; /* domain number */
UINT pad1 : 1; /* SBO */
UINT c : 1; /* c-bit */
UINT b : 1; /* b-bit */
UINT type : 2; /* descriptor type, 2 => section */
} SECTION_DESC_FIELD;
/* First level "supersection" descriptor */
typedef struct
{
UINT addrLo : 8; /* phys address 31:24 */
UINT addrHi : 4; /* phys address 35:32 */
UINT pad4 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad3 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad2 : 1; /* SBO */
UINT tex : 3; /* AP */
UINT ap : 2; /* AP */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT addrHi2: 4; /* phys address 39:36 */
UINT pad1 : 1; /* SBO */
UINT c : 1; /* c-bit */
UINT b : 1; /* b-bit */
UINT type : 2; /* descriptor type, 2 => section */
} SUPERSECTION_DESC_FIELD;
/* Layout of Page Table Entries (PTEs), actually small page descriptors */
typedef struct
{
UINT addr : 20; /* page base address */
UINT ap3 : 2; /* access permission, sub-page 3 */
UINT ap2 : 2; /* access permission, sub-page 2 */
UINT ap1 : 2; /* access permission, sub-page 1 */
UINT ap0 : 2; /* access permission, sub-page 0 */
UINT cb : 2; /* cacheable/bufferable bits */
UINT type : 2; /* page type, 2 => small page */
} PTE_FIELD;
#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* First level descriptor access */
typedef union
{
PAGE_DESC_FIELD fields;
SECTION_DESC_FIELD sectionFields;
SUPERSECTION_DESC_FIELD supersectionFields;
UINT32 bits;
} MMU_LEVEL_1_DESC;
/* Second level descriptor access */
typedef union
{
PTE_FIELD fields;
UINT32 bits;
} PTE;
/*
* Structure for MMU translation table access - normally used to get a pointer
* to the first-level translation table.
* To support page table optimization, a second first-level table and a
* semaphore are needed.
* The initial, unoptimized set of page tables will be set as the active
* translation tables (via pLevel1Table) while optimization or deoptimization
* is in progress using the inactive second translation table (pAltLevel1Table).
* After each page table optimization or deoptimization operation has
* completed, the second translation table will be set as the active
* translation table. The initial set of page tables retain their
* links to level 2 pages, which may otherwise be lost after optimization.
* Any non-optimization changes to the active first-level table will also be
* made to the inactive first-level table.
* The semaphore is used to prevent corruption of the tables.
*/
typedef struct mmuTransTblStruct
{
MMU_LEVEL_1_DESC *pLevel1Table; /* active MMU table */
MMU_LEVEL_1_DESC *pAltLevel1Table; /* inactive MMU table */
VX_MUTEX_SEMAPHORE(mmuTransTblSem); /* MMU tables' semaphore */
UINT32 lockCnt; /* lock count */
atomic_t lockOwner; /* lock owner */
} MMU_TRANS_TBL;
#endif /* MMU_ARCHITECTURE_DEFINES_STRUCTURES */
/* Externally visible mmuLib, mmuMapLib and mmuALib2 routines */
IMPORT UINT32 mmuReadId (void);
IMPORT PHYS_ADDR mmuVirtToPhys (VIRT_ADDR addr);
IMPORT VIRT_ADDR mmuPhysToVirt (PHYS_ADDR addr);
IMPORT UINT32 (* mmuCrGet) (void);
IMPORT void (* mmuModifyCr) (UINT32 value, UINT32 mask);
IMPORT UINT32 mmuHardCrGet (void);
IMPORT UINT32 mmuSoftCrGet (void);
IMPORT void mmuModifyHardCr (UINT32 value, UINT32 mask);
IMPORT void mmuModifySoftCr (UINT32 value, UINT32 mask);
IMPORT UINT32 (* _func_mmuFaultAddrGet) (void);
IMPORT UINT32 (* _func_mmuFaultStatusGet) (void);
IMPORT UINT32 mmuFarGet (void); /* CP15_FAR only available with MMUs */
IMPORT UINT32 mmuFsrGet (void); /* CP15_FSR only available with MMUs */
#endif /* _ASMLANGUAGE */
#endif /* (ARMMMU != ARMMMU_NONE) */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArmPalLibh */
@@ -0,0 +1,459 @@
/* mmuArmXSCALELib.h - XScale MMU library header file */
/*
* Copyright (c) 2000, 2001, 2003-2007, 2009-2010 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01l,29jul10,pad Moved extern C statement after include statements.
01k,03nov09,j_b add INCLUDE_MMU_TEX_SUPPORT, undef INCLUDE_MMU_SUBPAGE_SUPPORT
01j,23oct07,to added lockCnt and lockOwner to MMU_TRANS_TBL
01i,13sep06,j_b add page optimization support
01h,29mar06,m_h Coherancy (S-bit) support
01g,03jan06,m_h Manzano Support
01f,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01e,10feb05,jb Reverting to ROM mode for shared data/libraries
01d,09dec04,jb Palify Arm MMU
01c,08sep03,scm add P-bit support...
01b,23jul01,scm change XScale name to conform to coding standards...
01a,31aug00,scm created.
*/
#ifndef __INCmmuArmXSCALELibh
#define __INCmmuArmXSCALELibh
#include <memLib.h>
#include <semLib.h>
#define MMU_ID_XSCALE 0x052000
/* Enable support for section descriptors */
#undef INCLUDE_MMU_SECTION_SUPPORT
#define INCLUDE_MMU_SECTION_SUPPORT
/* Let the Pal code know Xscale has unique structures */
#define MMU_ARCHITECTURE_DEFINES_STRUCTURES
#include "mmuArmPalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Xscale specific definitions follow */
#undef INCLUDE_MMU_SUBPAGE_SUPPORT
#undef INCLUDE_MMU_TEX_SUPPORT
#define INCLUDE_MMU_TEX_SUPPORT
#undef MMU_DEF_L1_PAGE
#define MMU_DEF_L1_PAGE 0x00000001 /* domain zero, Page descriptor */
#undef MMU_STATE_MASK_WRITABLE
#define MMU_STATE_MASK_WRITABLE 0x00000030 /* All APn bits */
#define MMU_STATE_X_BIT 0x00000040
#define MMU_STATE_S_BIT 0x00000200 /* S-bit coherancy */
#define MMU_STATE_MASK_EX_BUFFERABLE (MMU_STATE_X_BIT | MMU_STATE_MASK_BUFFERABLE)
#define MMU_STATE_MASK_EX_CACHEABLE (MMU_STATE_X_BIT | MMU_STATE_MASK_CACHEABLE)
#undef MMU_STATE_VALID
#define MMU_STATE_VALID MMU_PTE_TYPE_EX_PAGE /* set to page type */
#undef MMU_STATE_WRITABLE
#define MMU_STATE_WRITABLE 0x00000030 /* APn bits to 11 */
#undef MMU_STATE_MASK_PROTECTION
#define MMU_STATE_MASK_PROTECTION 0x00000030 /* APn bits */
#undef MMU_STATE_SUP_RO
#define MMU_STATE_SUP_RO 0x00000000 /* AP: 00 */
#undef MMU_STATE_SUP_RW
#define MMU_STATE_SUP_RW 0x00000010 /* AP: 01 */
#undef MMU_STATE_USR_RO_SUP_RW
#define MMU_STATE_USR_RO_SUP_RW 0x00000020 /* AP: 10 */
#undef MMU_STATE_USR_RW_SUP_RW
#define MMU_STATE_USR_RW_SUP_RW 0x00000030 /* AP: 11 */
/* only AP bits valid on extended small page tables are AP0 */
#ifdef INCLUDE_MMU_SBIT_SUPPORT
#define MMU_MSK_UNUSED_AP 0xfffff23f
#else /*INCLUDE_MMU_SBIT_SUPPORT*/
#define MMU_MSK_UNUSED_AP 0xfffff03f
#endif /*INCLUDE_MMU_SBIT_SUPPORT*/
#define MMU_MSK_CHK_APS 0x00000fc0
#define MMU_MSK_X_BIT 0x00000040
/* Section and supersection L1 definitions follow */
#undef MMU_DEF_L1_SECTION_PAGE
#define MMU_DEF_L1_SECTION_PAGE 0x00000002 /* Section page descriptor */
#undef MMU_DEF_L1_SUPERSECTION_PAGE
#define MMU_DEF_L1_SUPERSECTION_PAGE 0x00040002 /* supersection */
#undef MMU_DEF_L1_SECTION_PAGE_MASK
#define MMU_DEF_L1_SECTION_PAGE_MASK 0x00040003 /* mask */
#undef MMU_STATE_SECTION_MASK_WRITABLE
#define MMU_STATE_SECTION_MASK_WRITABLE 0x00000030 /* All APn bits */
/* optional extended physical address bit fields */
#define MMU_L1DSSECTION_EXTD_BA_MASK MMU_L1DSSECTIONHI_BA_MASK
/* Supersection base address packing */
#define MMU_L1DSSECTION_BA_SET(physAddr, ssectDesc) \
(ssectDesc = (ssectDesc & ~MMU_L1DSSECTION_EXTD_BA_MASK) | \
( (((unsigned long long)(physAddr)) & MMU_L1DSSECTIONLO_BA_MASK) | \
((((unsigned long long)(physAddr)) >> 12) & \
MMU_L1DSSECTIONHI_BA_MASK) ))
/* Supersection base address unpacking */
#define MMU_L1DSSECTION_BA_GET(ssectDesc) \
((unsigned long long) \
( (unsigned long long)(ssectDesc & MMU_L1DSSECTIONLO_BA_MASK) | \
((unsigned long long)(ssectDesc & MMU_L1DSSECTIONHI_BA_MASK) \
<< 12) ))
/* The X-bit is the LSB of TEX: bit-12 of the section or supersection L1 */
#define MMU_STATE_SECTION_X_BIT 0x00001000
#define MMU_STATE_MASK_SECTION_EX_BUFFERABLE \
(MMU_STATE_SECTION_X_BIT | MMU_STATE_MASK_BUFFERABLE)
#define MMU_STATE_MASK_SECTION_EX_CACHEABLE \
(MMU_STATE_SECTION_X_BIT | MMU_STATE_MASK_CACHEABLE)
#define MMU_SECTION_MSK_X_BIT 0x00001000
#define MMU_STATE_CACHEABLE_MINICACHE 0x48 /* allocate in minicache, X=1, CB=10 */
/* the mini data cache attributes to the Auxiliary Control Reg */
/* used by mmuSetMDBits... */
#define MD_COPYBACK 0x00000000
#define MD_WRITEALLOCATE 0x00000010
#define MD_WRITETHRU 0x00000020
#define MMU_STATE_CACHEABLE_EX_COPYBACK (MMU_STATE_X_BIT | MMU_STATE_CACHEABLE_COPYBACK)
#define MMU_STATE_EX_CACHEABLE MMU_STATE_CACHEABLE_EX_COPYBACK
#define MMU_STATE_EX_CACHEABLE_NOT 0x0
/* bufferable, not cacheable, no coalesce */
#define MMU_STATE_EX_BUFFERABLE (MMU_STATE_X_BIT | MMU_STATE_BUFFERABLE)
#define MMU_STATE_EX_BUFFERABLE_NOT 0x0 /* will also set not cacheable, no coalesce */
#define MMU_ATTR_CACHE_MINICACHE (MMU_ATTR_SPL_1 | MMU_ATTR_CACHE_COPYBACK)
/*
* two new states with extended small page tables, bufferable no coalesce, and
* write back with read/write allocate...
*/
#define MMU_ATTR_NO_COALESCE (MMU_ATTR_SPL_2 | MMU_ATTR_CACHE_OFF) /* Cache -- no coalesce into buffers */
#define MMU_ATTR_WRITEALLOCATE (MMU_ATTR_SPL_3 | MMU_ATTR_CACHE_COPYBACK) /* Cache -- write allocate */
/* cache states determined by MD-bits of Auxilliary Control Register */
#define MMU_ATTR_CACHE_MINICACHE_CB (MMU_ATTR_SPL_1 | MMU_ATTR_CACHE_COPYBACK)
#define MMU_ATTR_CACHE_MINICACHE_WA (MMU_ATTR_SPL_1 | MMU_ATTR_WRITEALLOCATE)
#define MMU_ATTR_CACHE_MINICACHE_WT (MMU_ATTR_SPL_1 | MMU_ATTR_CACHE_WRITETHRU)
/* Write-through mode is only available on some CPUs */
#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x8
/*
* Values to be used when mmuEnable() is called. This will be after the MMU has
* been initialised by sysInit()/romInit() and after cacheLib has set whatever
* cache enable settings have been chosen.
*
* M 1 Enable MMU
* A 0 Disable address alignment fault
* C X ((D-)Cache Enable) Controlled by cacheLib
* W X (Write Buffer) Controlled by cacheLib
* P 1 (PROG32) should be set before this
* D 1 (DATA32) should be set before this
* L 1 (Late abort on earlier CPUs) ignore
* B X (Big/Little-endian) should be set before this
* S 1 (System)
* R 0 (ROM)
* F 0 Should be Zero
* Z X (Branch prediction enable on 810) Controlled by cacheLib
* I X (I-cache enable) Controlled by cacheLib
*
* For time being, do not enable the address alignment fault, as GCC
* currently generates unaligned accesses in its code, and switching this
* on will cause immediate faults. So, do not put it into the enable
* mask.
*
* We used to clear all the Reserved/Should Be Zero bits when the
* MMU/MPU was enabled, by including one bits for them in the definition
* of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend
* the definitions of the bits within the MMU Control Register. The MMU
* Control register is initialised within romInit()/sysInit(), as the BSP
* is the only place where the particular details of the CPU/MMU are
* actually known. In general, it will be appropriate for the BSP to
* initialise the MMUCR Reserved/Should Be Zero bits to zero. When the
* MMU is enabled, we will only change the bits we are particularly
* concerned about, by using a Read-Modify-Write strategy.
*/
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE MMUCR_ROM /* This MUST remain as ROM for shared libraries */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE)
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_MODE)
#else
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_BIGEND | MMUCR_MODE)
#endif
#ifndef _ASMLANGUAGE
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* little-endian */
/* First level page descriptors */
typedef struct
{
UINT type : 2; /* descriptor type, 1 => page */
UINT pad1 : 2; /* SBZ */
UINT pad2 : 1; /* SBO */
UINT domain : 4; /* domain number */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT addr : 22; /* base address of page table */
} PAGE_DESC_FIELD;
/* First level "section" descriptor */
typedef struct
{
UINT type : 2; /* descriptor type, 2 => section */
UINT bbit : 1; /* bufferable-bit */
UINT cbit : 1; /* cacheable-bit */
UINT pad1 : 1; /* SBO */
UINT domain : 4; /* domain number */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT ap : 2; /* AP */
UINT tex : 3; /* TEX */
UINT pad2 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad3 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad4 : 1; /* SBO */
UINT addr : 12; /* base address of page table */
} SECTION_DESC_FIELD;
/* First level "supersection" descriptor */
typedef struct
{
UINT type : 2; /* descriptor type, 2 => section */
UINT bbit : 1; /* bufferable-bit */
UINT cbit : 1; /* cacheable-bit */
UINT pad1 : 1; /* SBO */
UINT addrHi2: 4; /* SBZ [phys address 39:36] */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT ap : 2; /* AP */
UINT tex : 3; /* TEX */
UINT pad2 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad3 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad4 : 1; /* SBO */
UINT addrHi : 4; /* phys address 35:32 */
UINT addrLo : 8; /* phys address 31:24 */
} SUPERSECTION_DESC_FIELD;
/* Layout of Page Table Entries (PTEs), actually small page descriptors */
typedef struct
{
UINT type : 2; /* page type, 3 => extended small page */
UINT cb : 2; /* cacheable/bufferable bits */
UINT ap : 2; /* access permission */
UINT tex : 4; /* type extension field */
UINT sbz : 2; /* should be zero */
UINT addr : 20; /* page base address */
} PTE_FIELD;
#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* big-endian */
/* First level page descriptors */
typedef struct
{
UINT addr : 22; /* base address of page table */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT domain : 4; /* domain number */
UINT pad2 : 1; /* SBO */
UINT pad1 : 2; /* SBZ */
UINT type : 2; /* descriptor type, 1 => page */
} PAGE_DESC_FIELD;
/* First level "section" descriptor */
typedef struct
{
UINT addr : 12; /* base address of page table */
UINT pad4 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad3 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad2 : 1; /* SBO */
UINT tex : 3; /* AP */
UINT ap : 2; /* AP */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT domain : 4; /* domain number */
UINT pad1 : 1; /* SBO */
UINT c : 1; /* c-bit */
UINT b : 1; /* b-bit */
UINT type : 2; /* descriptor type, 2 => section */
} SECTION_DESC_FIELD;
/* First level "supersection" descriptor */
typedef struct
{
UINT addrLo : 8; /* phys address 31:24 */
UINT addrHi : 4; /* phys address 35:32 */
UINT pad4 : 1; /* SBO */
UINT super : 1; /* 1 => supersection */
UINT pad3 : 1; /* SBO */
UINT sbit : 1; /* S-bit */
UINT pad2 : 1; /* SBO */
UINT tex : 3; /* AP */
UINT ap : 2; /* AP */
UINT pbit : 1; /* XSCALE 'P' bit */
UINT addrHi2: 4; /* SBZ [phys address 39:36] */
UINT pad1 : 1; /* SBO */
UINT c : 1; /* c-bit */
UINT b : 1; /* b-bit */
UINT type : 2; /* descriptor type, 2 => section */
} SUPERSECTION_DESC_FIELD;
/* Layout of Page Table Entries (PTEs), actually small page descriptors */
typedef struct
{
UINT addr : 20; /* page base address */
UINT sbz : 2; /* should be zero */
UINT tex : 4; /* type extension field */
UINT ap : 2; /* access permission */
UINT cb : 2; /* cacheable/bufferable bits */
UINT type : 2; /* page type, 3 => extended small page */
} PTE_FIELD;
#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* First level descriptor access */
typedef union
{
PAGE_DESC_FIELD fields;
SECTION_DESC_FIELD sectionFields;
SUPERSECTION_DESC_FIELD supersectionFields;
UINT32 bits;
} MMU_LEVEL_1_DESC;
/* Second level descriptor access */
typedef union
{
PTE_FIELD fields;
UINT32 bits;
} PTE;
/*
* Structure for MMU translation table access - normally used to get a pointer
* to the first-level translation table.
* To support page table optimization, a second first-level table and a
* semaphore are needed.
* The initial, unoptimized set of page tables will be set as the active
* translation tables (via pLevel1Table) while optimization or deoptimization
* is in progress using the inactive second translation table (pAltLevel1Table).
* After each page table optimization or deoptimization operation has
* completed, the second translation table will be set as the active
* translation table. The initial set of page tables retain their
* links to level 2 pages, which may otherwise be lost after optimization.
* Any non-optimization changes to the active first-level table will also be
* made to the inactive first-level table.
* The semaphore is used to prevent corruption of the tables.
*/
typedef struct mmuTransTblStruct
{
MMU_LEVEL_1_DESC *pLevel1Table; /* active MMU table */
MMU_LEVEL_1_DESC *pAltLevel1Table; /* inactive MMU table */
VX_MUTEX_SEMAPHORE(mmuTransTblSem); /* MMU tables' semaphore */
UINT32 lockCnt; /* lock count */
atomic_t lockOwner; /* lock owner */
} MMU_TRANS_TBL;
#if defined(__STDC__) || defined(__cplusplus)
IMPORT void mmuArmXSCALELibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
IMPORT void mmuArmXSCALETtbrSet (MMU_LEVEL_1_DESC *);
IMPORT MMU_LEVEL_1_DESC * mmuArmXSCALETtbrGet ( void);
IMPORT void mmuArmXSCALEDacrSet (UINT32 dacrVal);
IMPORT void mmuArmXSCALETLBIDFlushEntry (void *addr);
IMPORT void mmuArmXSCALETLBIDFlushAll (void);
IMPORT void mmuArmXSCALEAEnable (UINT32 cacheState);
IMPORT void mmuArmXSCALEADisable (void);
IMPORT STATUS mmuArmXSCALEPBitSet ( void * virtAddr, UINT32 size);
IMPORT STATUS mmuArmXSCALEPBitClear ( void * virtAddr, UINT32 size);
IMPORT STATUS mmuArmXSCALEPBitGet ( void * virtAddr );
IMPORT STATUS mmuArmXSCALEAcrGet (void );
IMPORT void mmuArmXSCALEAcrSet (UINT32 acrVal);
#else /* __STDC__ */
IMPORT void mmuArmXSCALELibInstall ();
IMPORT void mmuArmXSCALETtbrSet ();
IMPORT MMU_LEVEL_1_DESC * mmuArmXSCALETtbrGet ();
IMPORT void mmuArmXSCALEDacrSet ();
IMPORT void mmuArmXSCALETLBIDFlushEntry ();
IMPORT void mmuArmXSCALETLBIDFlushAll ();
IMPORT void mmuArmXSCALEAEnable ();
IMPORT void mmuArmXSCALEADisable ();
IMPORT STATUS mmuArmXSCALEPBitSet ();
IMPORT STATUS mmuArmXSCALEPBitClear ();
IMPORT STATUS mmuArmXSCALEPBitGet ();
IMPORT STATUS mmuArmXSCALEAcrGet ();
IMPORT void mmuArmXSCALEAcrSet ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuArmXSCALELibh */
@@ -0,0 +1,163 @@
/* mmuCortexA8Lib.h - Cortex-A8 MMU library header file */
/*
* Copyright (c) 2008, 2010-2012, 2013 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01j,19aug13,zgl LPAE support (WIND00357632)
01i,17jul12,j_b fix mmuCortexA8AcrGet API
01h,20dec11,jdw Add missing APIs to clear up warnings related to ttbr APIs
01g,25aug10,my_ Remove MMUCR_BIGEND in MMU_INIT_VALUE and add
MMUCR_EE in MMU_INIT_VALUE (WIND00229795)
01f,29apr10,pad Moved extern C statement after include statements.
01e,09feb10,j_b update mmuCortexA8TtbrSet for ASID support
01d,25aug10,my_ make EE bit default in BE8 mode (WIND00228157)
01c,05aug10,j_b enable branch prediction by default (CQID: 222896)
01b,05aug10,m_h Thumb-mode exception handling for Thumb-2
01a,11jun08,j_b Created from mmuArm1136jfLib.h, rev 01a
*/
#ifndef __INCmmuCortexALibh
#define __INCmmuCortexALibh
#include "memLib.h"
#ifndef _WRS_CONFIG_ARM_LPAE
#include <arch/arm/mmuArmArch6PalLib.h>
#else /* _WRS_CONFIG_ARM_LPAE */
#include <arch/arm/mmuArmLpaeLib.h>
#endif /* !_WRS_CONFIG_ARM_LPAE */
#ifdef __cplusplus
extern "C" {
#endif
/* Cortex-A Specific definitions follow */
/*
* Values to be used when mmuEnable() is called. This will be after the MMU has
* been initialised by sysInit()/romInit() and after cacheLib has set whatever
* cache enable settings have been chosen.
* See "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition"
* (ARM DDI 0406) and "Cortex-A8 Processor Technical Reference Manual"
* (ARM DDI 0344) for details.
*
* M 1 Enable MMU
* A 0 Disable address alignment fault
* C X ((D-)Cache Enable) Controlled by cacheLib
* - 1 (Write Buffer - obsolete) Reserved; SBO
* - 1 (PROG32 - obsolete) Reserved; SBO
* - 1 (DATA32 - obsolete) Reserved; SBO
* - 1 (Late abort - obsolete) Reserved; SBO
* B 0 (Big/Little-endian - obsolete) Reserved; SBZ
* - 0 (System - obsolete) Reserved; SBZ
* - 0 (ROM - obsolete) Reserved; SBZ
* SW 0 (SWP/SWPB Enable - unsupported) SBZ; Reserved for Multiprocessing
* Z 1 (Branch prediction enable)
* I X (I-cache enable) Controlled by cacheLib
* V 0 (Vector table location: Normal/High Address)
* RR 0 (Random/Round-Robin cache replacement - unsupported) SBZ
* - 0 (Load instructions to PC set T bit - obsolete) SBZ
* - 1 (Data TCM enable - obsolete) SBO
* HA 0 (Hardware Access flag enable - unsupported) SBZ
* - 1 (Instruction TCM enable - obsolete) SBO
* - 0 Reserved; SBZ
* - 0 Reserved; SBZ
* FI 0 (Fast Interrupt enable - unsupported) SBZ
* U 1 (Unaligned access enable); SBO
* - 1 (extended PTE format enable - obsolete) SBO
* VE 0 (VEctored Interrupt - unsupported) SBZ
* EE 0 Exception Endian set to Little-Endian
* - 0 Reserved; SBZ
* NMFI 0 Disable NMFI behavior for FIQs
* TRE 0 Disable TEX Remap
* AFE 0 Disable Access Flag
* TE X if Thumb-2 enable Thumb Exceptions
* - 0 Reserved; SBZ
*
* For time being, do not enable the address alignment fault, as GCC
* currently generates unaligned accesses in its code, and switching this
* on will cause immediate faults. So, do not put it into the enable
* mask.
*
* We used to clear all the Reserved/Should Be Zero bits when the
* MMU/MPU was enabled, by including one bits for them in the definition
* of MMU_ENABLE_MASK. We no longer do this, as CPU designers may extend
* the definitions of the bits within the MMU Control Register. The MMU
* Control register is initialised within romInit()/sysInit(), as the BSP
* is the only place where the particular details of the CPU/MMU are
* actually known. In general, it will be appropriate for the BSP to
* initialise the MMUCR Reserved/Should Be Zero bits to zero. When the
* MMU is enabled, we will only change the bits we are particularly
* concerned about, by using a Read-Modify-Write strategy.
*/
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE)
#if (ARM_THUMB2)
#define MMU_EXCEPTION_MODE MMUCR_THUMB_EXCEPTIONS
#else /* (ARM_THUMB2) */
#define MMU_EXCEPTION_MODE 0x0
#endif /* (ARM_THUMB2) */
/* Control Register SBO bits */
#define MMU_MUST_SET_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_W_ENABLE | MMUCR_ENABLE_DTCM | \
MMUCR_ENABLE_ITCM | MMUCR_UNALIGNED_ENABLE | \
MMUCR_EXTENDED_PAGE | MMU_EXCEPTION_MODE)
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
#define MMU_INIT_VALUE (MMU_MUST_SET_VALUE | MMUCR_Z_ENABLE)
#else
#define MMU_INIT_VALUE (MMU_MUST_SET_VALUE | MMUCR_Z_ENABLE | MMUCR_EE)
#endif
#ifndef _ASMLANGUAGE
IMPORT void mmuCortexA8LibInstall (VIRT_ADDR(physToVirt) (PHYS_ADDR),
PHYS_ADDR(virtToPhys) (VIRT_ADDR));
#ifndef _WRS_CONFIG_ARM_LPAE
IMPORT void mmuCortexA8TtbrSet (MMU_LEVEL_1_DESC *pTable, UINT32 asid);
IMPORT MMU_LEVEL_1_DESC * mmuCortexA8TtbrGet (void);
IMPORT void mmuCortexA8TtbrSetAll (UINT32 ttbr, UINT32 asid);
IMPORT UINT32 mmuCortexA8TtbrGetAll (void);
IMPORT void mmuCortexA8DacrSet (UINT32 dacrVal);
#else /* _WRS_CONFIG_ARM_LPAE */
IMPORT void mmuCortexA8TtbrSet64 (UINT64 ttbr);
IMPORT UINT64 mmuCortexA8TtbrGet64 (void);
IMPORT void mmuCortexA8MairSet(UINT32 mair0Val, UINT32 mair1Val);
IMPORT void mmuCortexA8TtbcrSet (UINT32 ttbcr);
IMPORT UINT32 mmuCortexA8TtbcrGet (void);
#endif /* !_WRS_CONFIG_ARM_LPAE */
IMPORT void mmuCortexA8TLBIDFlushEntry (VIRT_ADDR *addr);
IMPORT void mmuCortexA8TLBIDFlushAll (void);
IMPORT void mmuCortexA8AEnable (UINT32 cacheState);
IMPORT void mmuCortexA8ADisable (void);
IMPORT STATUS mmuCortexA8PBitSet (VIRT_ADDR virtAddr, UINT32 size);
IMPORT STATUS mmuCortexA8PBitClear (VIRT_ADDR virtAddr, UINT32 size);
IMPORT STATUS mmuCortexA8PBitGet (VIRT_ADDR virtAddr);
IMPORT UINT32 mmuCortexA8AcrGet (void);
IMPORT void mmuCortexA8AcrSet (UINT32 acrVal);
IMPORT STATUS mmuCortexA8ITcmrGet (void);
IMPORT void mmuCortexA8ITcmrSet (UINT32 acrVal);
IMPORT STATUS mmuCortexA8DTcmrGet (void);
IMPORT void mmuCortexA8DTcmrSet (UINT32 acrVal);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuCortexALibh */
@@ -0,0 +1,92 @@
/* mpuArm940tLib.h - ARM 940T MPU library header file */
/* Copyright (c) 1998-2006, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01e,29apr10,pad Moved extern C statement after include statements.
01d,27jul06,m_h vxWorks 6.x palification
01c,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01b,10aug04,scm adjust for MPU removal...
01a,24nov98,cdp created.
*/
#ifndef __INCmpuArm940tLibh
#define __INCmpuArm940tLibh
#define MMU_ID_ARM940T 0x059400
#include "mpuArmPalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE MMUCR_ROM /* This MUST remain ROM for shared libraries */
#define MMUCR_L4_ENABLE (1<<15) /* L4 enable, ARMv4 behavior */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE)
/*
* Values to be used when the MPU Control Register is initialised from
* within romInit.s or sysALib.s (before the MPU is enabled). Note that
* on 710A, this is also used to initialise the soft-copy of the MPU CR
* that we need to keep (in order to emulate Read-Modify-Write
* operations). So, the BSP *MUST* initialise the MPU CR with the value
* contained here, or else trouble will ensue. This restriction does
* not apply to non-710A BSPs, but caution must be exercised in choosing a
* value different to that defined here.
*/
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* W bit should Be One */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_MODE)
#else /* _BYTE_ORDER == _LITTLE_ENDIAN now _BIG_ENDIAN */
/* big endian */
/* W bit should Be One */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_BIGEND | MMUCR_MODE)
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
#ifndef _ASMLANGUAGE
IMPORT void mpuArm940tLibInstall (void);
IMPORT STATUS mpuArm940tShowInstall (void);
IMPORT void mpuArm940tPrrSet (const MPU_REGION_REG *pRegs);
IMPORT void mpuArm940tPrrGet (MPU_REGION_REG *pRegs);
IMPORT void mpuArm940tCcrSet (UINT32 val);
IMPORT UINT32 mpuArm940tCcrGet (void);
IMPORT void mpuArm940tWbcrSet (UINT32 val);
IMPORT UINT32 mpuArm940tWbcrGet (void);
IMPORT void mpuArm940tPrSet (UINT32 val);
IMPORT UINT32 mpuArm940tPrGet (void);
IMPORT void mpuArm940tAEnable (UINT32 cacheState);
IMPORT void mpuArm940tADisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmpuArm940tLibh */
@@ -0,0 +1,93 @@
/* mpuArm946eLib.h - ARM 946E MPU library header file */
/* Copyright (c) 1998-2006, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01f,29apr10,pad Moved extern C statement after include statements.
01e,13jul06,m_h MPU not MMU
01d,22may06,m_h Palify
01c,08feb05,rec use VIRT_ADDR and PHYS_ADDR instead of void
01b,10aug04,scm adjust for MPU removal...
01a,19jul00,jpd created, based on mmuArm940tLib.h.
*/
#ifndef __INCmpuArm946eLibh
#define __INCmpuArm946eLibh
#define MMU_ID_ARM946E 0x059460
#include "mpuArmPalLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* This defines the operating mode MMUCR_ROM, MMUCR_SYSTEM, or neither */
#define MMUCR_MODE MMUCR_ROM /* This MUST remain ROM for shared libraries */
#define MMUCR_L4_ENABLE (1<<15) /* L4 enable, ARMv4 behavior */
#define MMU_ENABLE_MASK (MMUCR_M_ENABLE | MMUCR_SYSTEM | MMUCR_ROM)
#define MMU_ENABLE_VALUE (MMUCR_M_ENABLE | MMUCR_MODE)
/*
* Values to be used when the MMU Control Register is initialised from
* within romInit.s or sysALib.s (before the MMU is enabled). Note that
* on 710A, this is also used to initialise the soft-copy of the MMU CR
* that we need to keep (in order to emulate Read-Modify-Write
* operations). So, the BSP *MUST* initialise the MMU CR with the value
* contained here, or else trouble will ensue. This restriction does
* not apply to non-710A BSPs, but caution must be exercised in choosing a
* value different to that defined here.
*/
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
/* W bit should Be One */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_MODE)
#else /* _BYTE_ORDER == _LITTLE_ENDIAN now _BIG_ENDIAN */
/* big endian */
/* W bit should Be One */
#define MMU_INIT_VALUE (MMUCR_PROG32 | MMUCR_DATA32 | MMUCR_L_ENABLE | \
MMUCR_BIGEND | MMUCR_MODE)
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
#ifndef _ASMLANGUAGE
IMPORT void mpuArm946eLibInstall (void);
IMPORT STATUS mpuArm946eShowInstall (void);
IMPORT void mpuArm946ePrrSet (const MPU_REGION_REG *pRegs);
IMPORT void mpuArm946ePrrGet (MPU_REGION_REG *pRegs);
IMPORT void mpuArm946eCcrSet (UINT32 val);
IMPORT UINT32 mpuArm946eCcrGet (void);
IMPORT void mpuArm946eWbcrSet (UINT32 val);
IMPORT UINT32 mpuArm946eWbcrGet (void);
IMPORT void mpuArm946ePrSet (UINT32 val);
IMPORT UINT32 mpuArm946ePrGet (void);
IMPORT void mpuArm946eAEnable (UINT32 cacheState);
IMPORT void mpuArm946eADisable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmpuArm946eLibh */
@@ -0,0 +1,229 @@
/* mmuArmPalLib.h - ARM MPU library header file */
/* Copyright (c) 2006, 2007, 2010, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01e,16mar12,rec WIND00318272 - POSIX signals conformance
01d,29apr10,pad Moved extern C statement after include statements.
01c,21sep07,j_b add _func_mmuFaultAddrGet prototype
01b,13jul06,m_h Generic MPU definitions
01a,13jul06,m_h Created from mmuArmPalLib.h and vxWorks 5.5 mmuArmLib.h
*/
#ifndef __INCmpuArmPalLibh
#define __INCmpuArmPalLibh
#ifndef _ASMLANGUAGE
#include <memLib.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* _ASMLANGUAGE */
#define MPU_NUM_REGIONS 8
#ifndef _ASMLANGUAGE
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
typedef struct
{
UINT enable : 1; /* 1 => region enabled */
UINT size : 5; /* size */
UINT pad : 6; /* padding */
UINT base : 20; /* region base address */
} MPU_REGION_FIELDS;
#else /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
/* Big-Endian */
typedef struct
{
UINT base : 20; /* region base address */
UINT pad : 6; /* padding */
UINT size : 5; /* size */
UINT enable : 1; /* 1 => region enabled */
} MPU_REGION_FIELDS;
#endif /* (_BYTE_ORDER == _LITTLE_ENDIAN) */
typedef union
{
MPU_REGION_FIELDS fields;
UINT32 bits;
} MPU_REGION_REG;
typedef struct mpuTransTblStruct
{
MPU_REGION_REG regs[MPU_NUM_REGIONS];
} MPU_TRANS_TBL;
#endif /* _ASMLANGUAGE */
/*
* Architecture-dependent MPU states. These are states settable for regions.
*/
/* The size must be larger than 0x0A so zero in these fields
* is an invalid MPU state is it is enabled (bit-0 = 1)
*/
#define MMU_STATE_INVALID_STATE 0xFFFFFFFF
#define MPU_REGION_BASE_MASK 0xFFFFF000
#define MPU_REGION_SIZE_MASK 0x0000003E
#define MPU_REGION_SIZE_MAX 0x0000003E
#define MMU_STATE_MASK_CACHEABLE 0xC0 /* CB bits */
#define MMU_STATE_MASK_BUFFERABLE 0x40
#define MMU_STATE_MASK_VALID 0x100 /* allows 4 AP bits */
#define MMU_STATE_VALID 0x100 /* Full Access */
#define MMU_STATE_VALID_NOT 0x000 /* No access */
#ifdef MPU_USE_EXTENDED_PERMISSIONS
#define MMU_STATE_NUM_AP_BITS 4
#define MMU_STATE_MASK_PROTECTION 0xF
#else /*MPU_USE_EXTENDED_PERMISSIONS*/
#define MMU_STATE_NUM_AP_BITS 2
#define MMU_STATE_MASK_PROTECTION 0x3
#endif /*MPU_USE_EXTENDED_PERMISSIONS*/
/* cacheable and bufferable states are not real physical bit definitions */
#ifdef ARMCACHE_HAS_WRITETHROUGH
/* Write-through mode is not available on all CPUs */
#define MMU_STATE_CACHEABLE_WRITETHROUGH 0x80
#endif /*ARMCACHE_HAS_WRITETHROUGH*/
#define MMU_STATE_CACHE_BIT 0x80
#define MMU_STATE_CACHEABLE_COPYBACK 0xC0
/*
* Set the default state to be copyback. CACHEABLE_WRITETHROUGH can also be
* selected on 740T/946E.
*/
#define MMU_STATE_CACHEABLE MMU_STATE_CACHEABLE_COPYBACK
#define MMU_STATE_CACHEABLE_NOT 0x0
#define MMU_STATE_BUFFERABLE 0x40 /* bufferable, not cacheable */
#define MMU_STATE_BUFFERABLE_NOT 0x0 /* will also set not cacheable*/
/*
* We need a size for a region that means the entire address
* space. It is perfectly reasonable to wish to define such a region
* and it is of course, not expressible within a UINT. So, define a
* special size.
*/
#define MMU_ENTIRE_SPACE 0
#define MMU_STATE_SUP_RW 0x01
#define MMU_STATE_USR_RO_SUP_RW 0x02
#define MMU_STATE_USR_RW_SUP_RW 0x03
#define MMU_STATE_SUP_RO 0x05
#define MMU_STATE_USR_RO_SUP_RO 0x06
/*
* When setting either of the attributes SPL_0 or SPL_1 it is necessary to:
*
* 1. specify MMU_ATTR_SPL_MSK ORred with MMU_ATTR_CACHE_MSK in the mask
* argument to the routine, and:
* 2. specify the appropriate cache state ORred in to the state argument
* to the routine.
*
* So, to set a page as bufferable not cacheable, it is necessary to
* specify both MMU_ATTR_SPL_0 and specify MMU_ATTR_CACHE_OFF in the
* state argument. To mark a page as cacheable in the minicache,
* MMU_ATTR_SPL_1 and MMU_ATTR_CACHE_COPYBACK must be specified in the
* state argument. In both cases, specify MMU_ATTR_SPL_MSK ORred with
* MMU_ATTR_CACHE_MSK in the mask argument.
*
* To "unset" the special attibutes SPL_0 or SPL_1, specify
* MMU_ATTR_CACHE_MSK in the mask parameter (without MMU_ATTR_SPL_MSK),
* and specify the cacheability required in the state argument.
*
* We provide the following alias on ARM, to make life easier.
*/
#define MMU_ATTR_BUFFERABLE (MMU_ATTR_SPL_0)
/* MMU Control Register bit allocations */
#define MMUCR_M_ENABLE (1<<0) /* MMU enable */
#define MMUCR_A_ENABLE (1<<1) /* Address alignment fault enable */
#define MMUCR_C_ENABLE (1<<2) /* (data) cache enable */
#define MMUCR_W_ENABLE (1<<3) /* write buffer enable */
#define MMUCR_PROG32 (1<<4) /* PROG32 */
#define MMUCR_DATA32 (1<<5) /* DATA32 */
#define MMUCR_L_ENABLE (1<<6) /* Late abort on earlier CPUs */
#define MMUCR_BIGEND (1<<7) /* Big-endian (=1), little-endian (=0) */
#define MMUCR_SYSTEM (1<<8) /* System bit, modifies MMU protections */
#define MMUCR_ROM (1<<9) /* ROM bit, modifies MMU protections */
#define MMUCR_F (1<<10) /* Should Be Zero */
#define MMUCR_Z_ENABLE (1<<11) /* Branch prediction enable on 810 */
#define MMUCR_I_ENABLE (1<<12) /* Instruction cache enable */
#define MMUCR_V_ENABLE (1<<13) /* Exception vectors remap to 0xFFFF0000 */
#define MMUCR_ALTVECT MMUCR_V_ENABLE /* alternate vector select */
#define MMUCR_RR_ENABLE (1<<14) /* Round robin cache replacement enable */
#define MMUCR_ROUND_ROBIN MMUCR_RR_ENABLE /* round-robin placement */
#define MMUCR_DISABLE_TBIT (1<<15) /* disable TBIT */
#define MMUCR_DSRAM_EN (1<<16) /* D-SRAM enable */
#define MMUCR_DSRAM_LOADMODE (1<<17) /* D-SRAM load mode select */
#define MMUCR_ISRAM_EN (1<<18) /* I-SRAM enable */
#define MMUCR_ISRAM_LOADMODE (1<<19) /* I-SRAM load mode select */
#ifndef _ASMLANGUAGE
/* Externally visible mpuLib routines */
IMPORT UINT32 mmuReadId (void);
IMPORT UINT32 (* mmuCrGet) (void);
IMPORT void (* mmuModifyCr) (UINT32 value, UINT32 mask);
IMPORT UINT32 mmuHardCrGet (void);
IMPORT UINT32 mmuSoftCrGet (void);
IMPORT void mmuModifyHardCr (UINT32 value, UINT32 mask);
IMPORT void mmuModifySoftCr (UINT32 value, UINT32 mask);
IMPORT UINT32 (* _func_mmuFaultAddrGet) (void);
IMPORT UINT32 (* _func_mmuFaultStatusGet) (void);
#if (CPU == ARMARCH6) || (CPU==ARMARCH7) || (CPU==ARMARCH7_T2)
IMPORT UINT32 (* _func_mmuIFaultStatusGet) (void);
#endif /* ARMARCH6 || ARMARCH7 || ARMARCH7_T2 */
IMPORT void mpuPrrSet (const MPU_REGION_REG *pRegs);
IMPORT void mpuPrrGet (MPU_REGION_REG *pRegs);
IMPORT void mpuCcrSet (UINT32 val);
IMPORT UINT32 mpuCcrGet (void);
IMPORT void mpuWbcrSet (UINT32 val);
IMPORT UINT32 mpuWbcrGet (void);
IMPORT void mpuPrSet (UINT32 val);
IMPORT UINT32 mpuPrGet (void);
IMPORT void mpuAEnable (UINT32 cacheState);
IMPORT void mpuADisable (void);
IMPORT UINT32 mpuGetEnable (void);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmpuArmPalLibh */
@@ -0,0 +1,91 @@
/* mpuGlobalMap.h - arch "independent" header MPU functionality */
/*
* Copyright (c) 2006 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01b,13jul06,m_h Arch "independent" MPU definitions normally found in vmLib.h
(actually vmLibP.h)
01a,13jul06,m_h written.
*/
#ifndef __INCmpuGlobalMaph
#define __INCmpuGlobalMaph
#include <private/vmLibP.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
typedef struct mpuTransTblStruct * MPU_TRANS_TBL_ID;
typedef STATUS (*MPUGLOBALPAGEMAPFUNCPTR)(VIRT_ADDR, PHYS_ADDR, UINT, BOOL);
typedef STATUS (*MPUTRANSLATEFUNCPTR)(struct mpuTransTblStruct *,
VIRT_ADDR, PHYS_ADDR *);
typedef STATUS (*MPUPHYSTRANSLATEFUNCPTR)(struct mpuTransTblStruct *,
PHYS_ADDR, VIRT_ADDR *);
typedef struct
{
FUNCPTR mpuLibInit;
MPU_TRANS_TBL_ID (*mpuTransTblCreate) ();
FUNCPTR mpuTransTblDelete;
FUNCPTR mpuEnable;
FUNCPTR mpuStateSetRegion;
FUNCPTR mpuStateGet;
MPUGLOBALPAGEMAPFUNCPTR mpuGlobalPageMap;
MPUTRANSLATEFUNCPTR mpuTranslate;
VOIDFUNCPTR mpuCurrentSet;
FUNCPTR mpuAttrTranslate;
FUNCPTR mpuShow;
} MPU_LIB_FUNCS;
#define MPU_ENABLE (*(mpuLibFuncs.mpuEnable))
#define MPU_TRANS_TBL_CREATE (*(mpuLibFuncs.mpuTransTblCreate))
#define MPU_STATE_SET_REGION (*(mpuLibFuncs.mpuStateSetRegion))
#define MPU_CURRENT_SET (*(mpuLibFuncs.mpuCurrentSet))
#define MPU_GLOBAL_PAGE_MAP (*(mpuLibFuncs.mpuGlobalPageMap))
#define MPU_ATTR_TRANSLATE (*(mpuLibFuncs.mpuAttrTranslate))
#define MPU_TRANSLATE (*(mpuLibFuncs.mpuTranslate))
#define MPU_TRANS_TBL_DELETE (*(mpuLibFuncs.mpuTransTblDelete))
#define MPU_SHOW (*(mpuLibFuncs.mpuShow))
IMPORT MPU_LIB_FUNCS mpuLibFuncs;
IMPORT void mpuLibInstall (void);
IMPORT STATUS
mpuGlobalMapInit (PHYS_MEM_DESC * pMemDescArray,
int numDescArrayElements,
BOOL enable,
int cacheDefault);
IMPORT STATUS
mpuStateSet (void *addr, int len, UINT stateMask, UINT state);
IMPORT STATUS mpuShow (void);
#endif /*_ASMLANGUAGE*/
#ifdef __cplusplus
}
#endif
#endif /* __INCmpuGlobalMaph */
@@ -0,0 +1,410 @@
/* private/smpArmP.h - ARM/XScale-specific definitions for SMP support */
/*
* Copyright (c) 2007-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Any compilation using definitions from this file will not *
* be binary-compatible between the UP and SMP environments. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
/*
modification history
--------------------
01r,10sep12,ggm updated for tes.
01q,02dec11,jdw Add _fpStatus per WIND00129622
01p,30nov10,j_b add unified FIQ/IRQ handling support
01o,29jul10,pad Moved extern C statement after include statements.
01n,07jul10,jdw Add _WRS_ARCH_HAS_OBJ_SAFE
01m,21may10,m_h Thumb-2 Support
01l,15may09,gls moved VX_INSTR_BARRIER() to vxAtomicArchLibCommon.h
01k,25feb09,j_b merge ARM SMP support:
03feb09,j_b define _WRS_SNOOP_NEEDS_DMA_MALLOC_SUPPORT so
cacheAimArch6DmaMalloc/Free are used with CACHE_SNOOP_ENABLE
04oct07,j_b define _WRS_ARCH_REQUIRES_CACHE_TEXT_UPDATE_CPC
31aug07,m_h Fix _ARM_PER_CPU_* macros for CPU != 0
18jun07,m_h syntax error non-SMP _ARM_CPU_INDEX_GET
01j,18sep08,gls added _WRS_KERNEL_LOCK_VAR_ALIGN
01i,27aug08,jpb Renamed VSB header file
01h,24jun08,jpb Added include path for kernel configurations options set in
vsb. Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP.
01g,20jun08,zl replaced _WRS_ASM() with _WRS_BARRIER()
01f,10jan08,gls added VX_INSTR_BARRIER()
01e,09may07,lei renamed reschedNeeded to reschedMode.
01d,09may07,m_h Fix per-CPU SMP macros, cleanup kernel global offsets
01c,03may07,m_h SMP definitions
01b,20apr07,m_h SMP Private definitions
01a,04apr07,m_h written.
*/
#ifndef __INCsmpArmPh
#define __INCsmpArmPh
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WRS_CONFIG_SMP
/*
* ARM has been adapted to use the new object safe count feature for SMP.
* When all architectures have been adapted this can be removed from
* the code.
*/
#define _WRS_ARCH_HAS_OBJ_SAFE
/*
* Much like the _WRS_WIND_VARS_ALIGN the _WRS_KERNEL_LOCK_VAR_ALIGN macro
* must be defined for the common CPU build variants (e.g. PPC32, MIPS32,
* XSCALE, etc), representing the maximum cache line size of the variants of
* the respective arch.
*
* For ARM this is 128 bytes.
*/
#define _WRS_KERNEL_LOCK_VAR_ALIGN 128
/*
* ARM11 MPCore does not support cache coherency with DMA agents or
* shared memory, so uncached memory must be returned by cacheDmaMalloc()
* (via cacheAimArch6DmaMalloc) when CACHE_SNOOP_ENABLE is defined
* (ex., in SMP mode).
* See usage in target\src\os\mm\cacheLib.c:cacheFuncsSet().
*/
#define _WRS_SNOOP_NEEDS_DMA_MALLOC_SUPPORT
/* Trigger software cacheTextUpdate CPC */
#define _WRS_ARCH_REQUIRES_CACHE_TEXT_UPDATE_CPC
/* ARM specific extension fields to the WIND_VARS struct */
#ifndef _ASMLANGUAGE
typedef struct wind_vars_arch
{
long cpu_intNestingLevel;
long cpu_maxIntNestingLevel;
UINT32 cpu_cacheArchState;
char * cpu_undefSaveArea;
char * cpu_abortSaveArea;
char * cpu_swiSaveArea;
char * cpu_irqStack;
UINT32 cpu_fpStatus;
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
long cpu_fiqNestingLevel;
long cpu_maxFiqNestingLevel;
char * cpu_fiqStack;
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
} WIND_VARS_ARCH;
#define _WRS_WIND_VARS_ARCH WIND_VARS_ARCH cpu_archVars
/* macro to access the arch-specific fields of the vxKernelVars struct */
#define _WRS_WIND_VARS_ARCH_ACCESS(glob) \
_WRS_KERNEL_GLOBAL_ACCESS (archVars.cpu_##glob)
#define _WRS_WIND_VARS_ARCH_SET(cpuid,glob,var) \
_WRS_KERNEL_CPU_GLOBAL_SET(cpuid,archVars.cpu_##glob,var)
#define _WRS_WIND_VARS_ARCH_GET(cpuid,glob) \
_WRS_KERNEL_CPU_GLOBAL_GET(cpuid,archVars.cpu_##glob)
#define _WRS_ARCH_LOCKED_GLOBAL_SET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_SET(archVars.cpu_##glob,var)
#define _WRS_ARCH_LOCKED_GLOBAL_GET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_GET(archVars.cpu_##glob,var)
/* TODO optimization work needed in regsArm.h (etc) */
#undef _WRS_ARCH_SUPPORTS_VX_CPU_STATE_INIT
#else /* !_ASMLANGUAGE */
/* offsets required for assembly macros */
#define WIND_VARS_ARCH_BASE (_WRS_WIND_VARS_OFFSET_archVars)
#endif /* _ASMLANGUAGE */
/*
* _WRS_WIND_VARS_ALIGN sets the alignment constraint for vxKernelVars. The
* value must be: a power of two no smaller than sizeof(vxKernelVars), and a
* multiple of the cache line size (which is 32) on every ARM variant that
* supports SMP.
*/
#define _WRS_WIND_VARS_ALIGN 128
#define _WRS_WIND_VARS_ALIGN_SHIFT 7
/*
* _ARM_ATOMIC_OPS_SEPARATION defines the minimum desirable separation between
* words on which SMP-atomic operations (including spinlock) will be
* performed. This is the cache line size on ARM MP.
*/
#define _ARM_ATOMIC_OPS_SEPARATION _CPU_CACHE_ALIGN_SIZE
# ifdef _CPU_CACHE_ALIGN_SIZE
/*
* Validate _WRS_WIND_VARS_ALIGN vs current build's _CPU_CACHE_ALIGN_SIZE
*
* If any SMP-enabled variant fails this test, _WRS_WIND_VARS_ALIGN must be
* increased. Since this limit also applies to any subsequent arch-only
* release against the same generic binary release, it may be desirable to
* allow for growth.
*/
# if (_CPU_CACHE_ALIGN_SIZE > _WRS_WIND_VARS_ALIGN)
#error Must increase "_WRS_WIND_VARS_ALIGN" to at least _CPU_CACHE_ALIGN_SIZE
# endif /* _CPU_CACHE_ALIGN_SIZE > _WRS_WIND_VARS_ALIGN */
/*
* Sanity check on _ARM_ATOMIC_OPS_SEPARATION
*
* A miss here generates a warning instead of an error, since it is merely
* likely (not inevitable) that the lwarx/stwcx. granularity matches the
* cache line size; also the performance penalty is less. (Two instances of
* vxKernelVars within the same cache line will cause continual interference,
* but two atoms within the same reservation granule will only occasionally
* cause additional trips around the lwarx/stwcx. loop due to loss of the
* reservation to an unrelated store.)
*/
# if (_CPU_CACHE_ALIGN_SIZE > _ARM_ATOMIC_OPS_SEPARATION)
#warning Check "_ARM_ATOMIC_OPS_SEPARATION" setting; it likely should be at least _CPU_CACHE_ALIGN_SIZE
# endif /* _CPU_CACHE_ALIGN_SIZE > _ARM_ATOMIC_OPS_SEPARATION */
# endif /* _CPU_CACHE_ALIGN_SIZE */
/*
* Just call the (assembly) function for now, but to optimize
* performance this should eventually become a C-callable
* _WRS_ASM construct (whose syntax varies depending on TOOL).
*/
#define _WRS_CPU_INDEX_GET() vxCpuIndexGet()
#else /* _WRS_CONFIG_SMP */
/* macro to access the arch-specific fields */
#define _WRS_WIND_VARS_ARCH_ACCESS(glob) \
_WRS_KERNEL_GLOBAL_ACCESS (glob)
#define _WRS_WIND_VARS_ARCH_SET(ignored,glob,var) \
_WRS_KERNEL_CPU_GLOBAL_SET(ignored,glob,var)
#define _WRS_WIND_VARS_ARCH_GET(ignored,glob) \
_WRS_KERNEL_CPU_GLOBAL_GET(ignored,archVars.cpu_##glob)
#define _WRS_ARCH_LOCKED_GLOBAL_SET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_SET(glob,var)
#define _WRS_ARCH_LOCKED_GLOBAL_GET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_GET(glob,var)
#define _WRS_CPU_INDEX_GET() 0
#endif /* _WRS_CONFIG_SMP */
#ifdef _ASMLANGUAGE
#include <private/windLibP.h>
# ifdef _WRS_CONFIG_SMP
#include <private/kernelLockLibP.h>
/*
* Sticking a "#" in the middle of a complex #define generates garbage
* passed to the assembler which results in a syntax error. ARM_HASH is
* used by this file in order to tell the assembler to use an immediate
* value.
*/
#define ARM_HASH #
#define _ARM_WIND_VARS_OFFSET(label) _WRS_WIND_VARS_OFFSET_##label
#define _ARM_WIND_VARS_OFFSET_reschedMode \
#_WRS_WIND_VARS_OFFSET_reschedMode
/* ARM specific per-CPU globals */
#define _WRS_WIND_VARS_OFFSET_intNestingLevel \
(_WRS_WIND_VARS_OFFSET_archVars+0x0)
#define _WRS_WIND_VARS_OFFSET_maxIntNestingLevel \
(_WRS_WIND_VARS_OFFSET_archVars+0x4)
#define _WRS_WIND_VARS_OFFSET_cacheArchState \
(_WRS_WIND_VARS_OFFSET_archVars+0x8)
#define _WRS_WIND_VARS_OFFSET_undefSaveArea \
(_WRS_WIND_VARS_OFFSET_archVars+0xC)
#define _WRS_WIND_VARS_OFFSET_abortSaveArea \
(_WRS_WIND_VARS_OFFSET_archVars+0x10)
#define _WRS_WIND_VARS_OFFSET_swiSaveArea \
(_WRS_WIND_VARS_OFFSET_archVars+0x14)
#define _WRS_WIND_VARS_OFFSET_irqStack \
(_WRS_WIND_VARS_OFFSET_archVars+0x18)
#define _WRS_WIND_VARS_OFFSET_fpStatus \
(_WRS_WIND_VARS_OFFSET_archVars+0x1C)
#ifdef _WRS_CONFIG_UNIFIED_FIQ_IRQ
#define _WRS_WIND_VARS_OFFSET_fiqNestingLevel \
(_WRS_WIND_VARS_OFFSET_archVars+0x20)
#define _WRS_WIND_VARS_OFFSET_maxFiqNestingLevel \
(_WRS_WIND_VARS_OFFSET_archVars+0x24)
#define _WRS_WIND_VARS_OFFSET_fiqStack \
(_WRS_WIND_VARS_OFFSET_archVars+0x28)
#endif /* _WRS_CONFIG_UNIFIED_FIQ_IRQ */
#define _ARM_CPU_ID_MASK #0xF
#define ARM_WIND_VARS_ALIGN_SHIFT #(_WRS_WIND_VARS_ALIGN_SHIFT)
/* Using CPU ID, get the index into the CPU's vxKernelVars */
/* Note: reading CPU ID requires CPU privileged mode */
#define _ARM_CPU_INDEX_GET(r) \
MRC p15, 0, r, c0, c0, 5 ; \
AND r, r, _ARM_CPU_ID_MASK
/* place the address of label into register r */
#define _ARM_PER_CPU_ADRS_GET(r, scratch, label) \
_ARM_CPU_INDEX_GET(r) ; \
LDR scratch, L$_vxKernelVars ; \
ADD scratch, scratch, r, LSL ARM_WIND_VARS_ALIGN_SHIFT ; \
ADD r, scratch, ARM_HASH _ARM_WIND_VARS_OFFSET(label) ; \
/*
* In some configurations (e.g. Thumb-2) there are special restrictions on
* usage of the sp register. Also there appears to be a defect in some
* versions of the Wind River assembler related to similar use of the lr
* register. So use these macros for setting up sp or lr.
*/
#define _ARM_PER_CPU_ADRS_GET_SPLR(r_sp, scratch, label) \
_ARM_PER_CPU_ADRS_GET(r_sp, scratch, label)
/* place the value at label into register r */
#define _ARM_PER_CPU_VALUE_GET_SPLR(r_sp, scratch, label) \
_ARM_PER_CPU_VALUE_GET(r_sp, scratch, label)
/* place the value at label into register r */
#define _ARM_PER_CPU_VALUE_GET(r,scratch,label) \
_ARM_CPU_INDEX_GET(r) ; \
LDR scratch, L$_vxKernelVars ; \
ADD scratch, scratch, r, LSL ARM_WIND_VARS_ALIGN_SHIFT ; \
ADD scratch, scratch, ARM_HASH _ARM_WIND_VARS_OFFSET(label) ; \
LDR r, [scratch]
/* place value at label in rv, also place address at label in ra */
#define _ARM_PER_CPU_VALUE_AND_ADRS_GET(rv,ra,label) \
_ARM_CPU_INDEX_GET(rv) ; \
LDR ra, L$_vxKernelVars ; \
ADD ra, ra, rv, LSL ARM_WIND_VARS_ALIGN_SHIFT ; \
ADD ra, ra, ARM_HASH _ARM_WIND_VARS_OFFSET(label) ; \
LDR rv, [ra]
/*
* ro = register to store kernel lock owner
* ri = register to store cpu index
*
* typedef struct smpLock
* {
* volatile int state; /@ state of lock (free/taken) @/
* volatile int owner; /@ CPU which owns the lock @/
* int count; /@ recursive ownership nesting count @/
* int options; /@ options applicable to this lock @/
*/
#define _ARM_KERNEL_LOCK_OWNER_AND_INDEX_GET(ro, ri) \
_ARM_CPU_INDEX_GET(ri) ; \
LDR ro, L$_kernelStateLock ; \
ADD ro, ro, ARM_HASH _WRS_KERNEL_LOCK_OFFSET_cpuIndex ; \
LDR ro, [ro] /* kernel spin lock owner */ ; \
# else /* _WRS_CONFIG_SMP */
#define IMM0 #0
/* Macro unconditionally returns 0 when built for UP */
#define _ARM_CPU_INDEX_GET(r) MOV r, IMM0
/*
* WARNING: UP build assumes that scratch register is not used.
* There is only one scratch register available in
* excEnterCommon
*/
/* place the address of label into register r */
#define _ARM_PER_CPU_ADRS_GET(r, scratch, label) \
LDR r, L$_##label
/* place the value at label into register r */
#define _ARM_PER_CPU_VALUE_GET(r, scratch, label) \
LDR r, L$_##label ; \
LDR r, [r]
/* place value at label in ra, also place address at label in rv */
#define _ARM_PER_CPU_VALUE_AND_ADRS_GET(rv,ra,label) \
LDR ra, L$_##label ; \
LDR rv, [ra]
/*
* In some configurations (e.g. Thumb-2) there are special restrictions on
* usage of the sp register. Also there appears to be a defect in some
* versions of the Wind River assembler related to similar use of the lr
* register. So use these macros for setting up sp or lr.
*/
# if (ARM_THUMB2)
/* place the address of label into register r */
#define _ARM_PER_CPU_ADRS_GET_SPLR(r_sp, scratch, label) \
LDR scratch, L$_##label ; \
MOV r_sp, scratch
/* place the value at label into register r */
#define _ARM_PER_CPU_VALUE_GET_SPLR(r_sp, scratch, label) \
LDR scratch, L$_##label ; \
LDR r_sp, [scratch]
# else /* (ARM_THUMB2) */
/* place the address of label into register r */
#define _ARM_PER_CPU_ADRS_GET_SPLR(r_sp, scratch, label) \
_ARM_PER_CPU_ADRS_GET(r_sp, scratch, label)
/* place the value at label into register r */
#define _ARM_PER_CPU_VALUE_GET_SPLR(r_sp, scratch, label) \
_ARM_PER_CPU_VALUE_GET(r_sp, scratch, label)
# endif /* (ARM_THUMB2) */
# endif /* _WRS_CONFIG_SMP */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCsmpArmPh */
@@ -0,0 +1,75 @@
/* vxPortableArchP.h - ARM portable library configuration */
/*
* Copyright (c) 2007, 2009-2010, 2013, 2017 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01g,28jul17,swu undef _WRS_PORTABLE_vxCpuPhysIndexGet for armv7-a (VXW6-86373)
01f,24apr13,yjw undef _WRS_PORTABLE_schedLib for armv7-m
01e,29oct10,j_b undefine _WRS_PORTABLE_vxCpuIdGet
01d,08jun09,j_b undef _WRS_PORTABLE_schedLib for uniprocessor
01c,11jul07,to undef _WRS_PORTABLE_vxAtomicLib if ldrex/strex are supported
01b,06jul07,to undef _WRS_PORTABLE_vxCpuIndexGet
01a,04may07,zl created
*/
#ifndef __INCvxPortableArchPh
#define __INCvxPortableArchPh
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file is included from <private/vxPortableP.h>. It may undefine
* portable library definitions in order to enable architecture specific
* implementation of a library or routine.
*/
/* the following can be overridden with PORTABLE */
#ifndef PORTABLE
#undef _WRS_PORTABLE_bLib
#undef _WRS_PORTABLE_dllLib
#undef _WRS_PORTABLE_ffsLib
#ifdef _WRS_CPU_HAS_CLZ_INSTR
# undef _WRS_PORTABLE_ffsTbl
#endif
#ifndef _WRS_CONFIG_SMP
# undef _WRS_PORTABLE_schedLib
#endif
#endif /* !PORTABLE */
/* the following cannot be overridden with PORTABLE */
#if (CPU == ARMARCH7M)
# undef _WRS_PORTABLE_schedLib
#endif
#if (CPU == ARMARCH7)
# undef _WRS_PORTABLE_vxCpuPhysIndexGet
#endif
#if (ARM_HAS_LDREX_STREX == TRUE)
#undef _WRS_PORTABLE_vxAtomicLib
#endif
#undef _WRS_PORTABLE_vxCpuIdGet
#undef _WRS_PORTABLE_vxCpuIndexGet
#ifdef __cplusplus
}
#endif
#endif /* __INCvxPortableArchPh */
@@ -0,0 +1,98 @@
/* vxdbgArmLibP.h - private ARM VxDBG library header file */
/*
* Copyright (c) 2007-2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use of this
* software may be licensed only pursuant to the terms of an applicable Wind
* River license agreement.
*/
/*
modification history
--------------------
01h,24apr12,jdw Update for ARM-M
01g,09feb11,rlp Defined VXDBG_INT_LOCK_LEVEL_COMPUTE macro for both UP and
SMP (CQ:WIND00253870).
01f,29apr10,pad Moved extern C statement after include statements.
01e,25feb09,j_b merge ARM SMP support:
12nov07,jmp Added support for VxDBG cpu control library.
01d,27aug08,jpb Renamed VSB header file
01c,24jun08,jpb Added include path for kernel configurations options set in
vsb. Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP.
01b,26oct07,rlp Added the VXDBG_INT_LOCK_LEVEL_COMPUTE macro (CQ:WIND00109321).
01a,11oct07,rlp Written
*/
#ifndef __INCvxdbgArmLibPh
#define __INCvxdbgArmLibPh
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This macro returns the <level> parameter modified with the interrupt lock
* level defined into the <value> parameter. The <level> parameter must be
* previously get with either intCpuLock() or intRegsLock() API.
*/
#if (CPU == ARMARCH7M)
#define VXDBG_INT_LOCK_LEVEL_COMPUTE(level, value) \
((level & ~PRIMASK_PM) | (value & PRIMASK_PM))
#else /* CPU == ARMARCH7M */
#define VXDBG_INT_LOCK_LEVEL_COMPUTE(level, value) \
((level & ~I_BIT) | (value & I_BIT))
#endif /* CPU == ARMARCH7M */
#ifdef _WRS_CONFIG_SMP
/* return TRUE if interrupts are locked in specified register set. */
#define VXDBG_INT_REGS_IS_LOCKED(pRegs) (((pRegs->cpsr & I_BIT) == \
I_BIT) ? TRUE : FALSE)
/*
* _WRS_VXDBG_CPU_CTRL_VARS_ALIGN sets the alignment constraint for
* vxdbgCpuCtrlVars array.
* The value must be:
* a power of two no smaller than sizeof(vxdbgCpuCtrlVars), and
* a multiple of the cache line size on every ARM variant that supports SMP.
*/
#define _WRS_VXDBG_CPU_CTRL_VARS_ALIGN 128
#define _WRS_VXDBG_CPU_CTRL_VARS_ALIGN_SHIFT 7
#define ARM_VXDBG_CPU_CTRL_VARS_ALIGN_SHIFT \
#(_WRS_VXDBG_CPU_CTRL_VARS_ALIGN_SHIFT)
#ifdef _CPU_CACHE_ALIGN_SIZE
/*
* Validate _WRS_VXDBG_CPU_CTRL_VARS_ALIGN vs current build's
* _CPU_CACHE_ALIGN_SIZE
*
* If any SMP-enabled variant fails this test, _WRS_VXDBG_CPU_CTRL_VARS_ALIGN
* must be increased. Since this limit also applies to any subsequent arch-only
* release against the same generic binary release, it may be desirable to
* allow for growth.
*/
#if (_CPU_CACHE_ALIGN_SIZE > _WRS_VXDBG_CPU_CTRL_VARS_ALIGN)
#error Must increase "_WRS_VXDBG_CPU_CTRL_VARS_ALIGN" to at least _CPU_CACHE_ALIGN_SIZE
#endif /* _CPU_CACHE_ALIGN_SIZE > _WRS_VXDBG_CPU_CTRL_VARS_ALIGN */
#endif /* _CPU_CACHE_ALIGN_SIZE */
/* externals */
#ifndef _ASMLANGUAGE
extern void intVxdbgCpuRegsGet (void);
#endif /* _ASMLANGUAGE */
#endif /* _WRS_CONFIG_SMP */
#ifdef __cplusplus
}
#endif
#endif /* __INCvxdbgArmLibPh */
+107
View File
@@ -0,0 +1,107 @@
/* regsArm.h - ARM registers */
/*
* Copyright (c) 1996, 1998, 2003, 2004, 2007, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01i,09may12,j_b enable ARMARCH7M-specific header usage
01h,03may12,j_b revert to remove ARMARCH7M-specific header usage
01g,01may12,j_b Update for ARMv7M
01f,18jun07,m_h Adding definition for WIND_CPU_STATE
01e,25aug04,scm add lrReg alternative name
01d,18mar04,scm add usr mode rtp support...
01c,07may03,pes PAL conditional compilation cleanup.
01b,15apr98,kkk added reg_pc, reg_sp, and reg_fp.
01a,08may96,cdp written, based on I86 version
*/
#ifndef __INCregsArmh
#define __INCregsArmh
#if (CPU == ARMARCH7M)
#include "arch/arm/arm-m/regsArm-m.h"
#else /* (CPU == ARMARCH7M) */
#ifdef __cplusplus
extern "C" {
#endif
#define GREG_NUM 15 /* has 15 32-bit general registers */
#ifndef _ASMLANGUAGE
/* REG_SET - ARM Register set
* Note that the exception stack frame relies on the order of items
* in this so don't change this without changing the ESF and the stub
* in excALib which creates it.
*/
typedef struct /* REG_SET - ARM register set */
{
ULONG r[GREG_NUM]; /* general purpose registers 0-14 */
INSTR *pc; /* program counter */
ULONG cpsr; /* current PSR */
ULONG ttbase; /* Trans Table Base */
} REG_SET;
typedef struct wind_cpu_state
{
REG_SET regs;
} WIND_CPU_STATE;
#define fpReg r[11] /* frame pointer */
#define spReg r[13] /* stack pointer */
#define lrReg r[14] /* link reg pointer */
#define reg_pc pc /* program counter */
#define reg_lr lrReg /* link reg pointer */
#define reg_sp spReg /* stack pointer */
#define reg_fp fpReg /* frame pointer */
#endif /* _ASMLANGUAGE */
#define ARM_REG_SIZE 4
#define REG_SET_G_REG_BASE 0x00 /* data reg's base offset to REG_SET */
#define REG_SET_G_REG_OFFSET(n) (REG_SET_G_REG_BASE + (n)*ARM_REG_SIZE)
#define REG_SET_PC_OFFSET (REG_SET_G_REG_OFFSET(GREG_NUM))
#define REG_SET_CPSR_OFFSET (REG_SET_PC_OFFSET + ARM_REG_SIZE)
#define REG_SET_TTBASE_OFFSET (REG_SET_CPSR_OFFSET + ARM_REG_SIZE)
#define PC_OFFSET REG_SET_PC_OFFSET
/* PAL additions */
/* moved here from h/private/taskLibP.h */
#define WIND_TCB_R0 WIND_TCB_REGS
#define WIND_TCB_R1 (WIND_TCB_R0+4*1)
#define WIND_TCB_R4 (WIND_TCB_R0+4*4)
#define WIND_TCB_R5 (WIND_TCB_R0+4*5)
#define WIND_TCB_SP (WIND_TCB_R0+4*13)
#define WIND_TCB_PC (WIND_TCB_R0+4*15)
#define WIND_TCB_CPSR (WIND_TCB_PC+4)
#define WIND_TCB_TTBASE (WIND_TCB_CPSR+4)
/* End PAL */
#ifdef __cplusplus
}
#endif
#endif /* (CPU == ARMARCH7M) */
#endif /* __INCregsArmh */
@@ -0,0 +1,26 @@
/* sigArmCodes.h - ARM signal facility library header file */
/* Copyright 1996-1997 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,09may96,cdp created
*/
#ifndef __INCsigArmCodesh
#define __INCsigArmCodesh
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCsigArmCodesh */
@@ -0,0 +1,870 @@
/* Aligned for arm - no alignment needed */
/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */
#ifndef _ASMLANGUAGE
#include <vxWorks.h>
#include <taskLib.h>
#include <rtpLib.h>
#include <sdLib.h>
#include <shlLib.h>
#include <signal.h>
#include <socket.h>
#include <time.h>
#include <setjmp.h>
#include <ioLib.h>
#include <private/semSysCall.h>
#include <private/objLibP.h>
#include <private/rtpLibP.h>
#include <private/mqPxSysCall.h>
#include <private/pxObjSysCall.h>
#include <private/semPxSysCall.h>
#include <private/taskSysCall.h>
#include <private/timerSysCall.h>
#include <private/eventSysCall.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <base/b_trace_attr_t.h>
#include <base/b_trace_id_t.h>
#include <base/b_trace_event_id_t.h>
#include <base/b_pthread_t.h>
struct _exitScArgs
{
int status;
};
struct _creatScArgs
{
const char * name;
mode_t flag;
};
struct _openScArgs
{
const char * name;
int flags;
int mode;
};
struct _closeScArgs
{
int fd;
};
struct _readScArgs
{
int fd;
void * buffer;
size_t maxbytes;
};
struct _writeScArgs
{
int fd;
const void * buffer;
size_t nbytes;
};
struct _ioctlScArgs
{
int fd;
int function;
_Vx_ioctl_arg_t arg;
};
struct dupScArgs
{
int fd;
};
struct dup2ScArgs
{
int fd;
int fd2;
};
struct pipeScArgs
{
int filedes[2];
};
struct removeScArgs
{
const char * name;
};
struct selectScArgs
{
int width;
fd_set * readFds;
fd_set * writeFds;
fd_set * excFds;
struct timeval * timeout;
};
struct socketScArgs
{
int domain;
int type;
int protocol;
};
struct bindScArgs
{
int s;
struct sockaddr * name;
int namelen;
};
struct listenScArgs
{
int s;
int backlog;
};
struct acceptScArgs
{
int s;
struct sockaddr * addr;
int *addrlen;
};
struct connectScArgs
{
int s;
struct sockaddr * name;
int namelen;
};
struct sendtoScArgs
{
int s;
caddr_t buf;
int bufLen;
int flags;
struct sockaddr * to;
int tolen;
};
struct sendScArgs
{
int s;
const char * buf;
int bufLen;
int flags;
};
struct sendmsgScArgs
{
int s;
struct msghdr * mp;
int flags;
};
struct recvfromScArgs
{
int s;
char * buf;
int bufLen;
int flags;
struct sockaddr *from;
int * pFromLen;
};
struct recvScArgs
{
int s;
char * buf;
int bufLen;
int flags;
};
struct recvmsgScArgs
{
int s;
struct msghdr * mp;
int flags;
};
struct setsockoptScArgs
{
int s;
int level;
int optname;
char * optval;
int optlen;
};
struct getsockoptScArgs
{
int s;
int level;
int optname;
char * optval;
int * optlen;
};
struct getsocknameScArgs
{
int s;
struct sockaddr *name;
int * namelen;
};
struct getpeernameScArgs
{
int s;
struct sockaddr *name;
int *namelen;
};
struct shutdownScArgs
{
int s;
int how;
};
struct mmapScArgs
{
void * addr;
size_t len;
int prot;
int flags;
int fildes;
off64_t off;
};
struct munmapScArgs
{
void * addr;
size_t len;
};
struct mprotectScArgs
{
void * addr;
size_t len;
int prot;
};
struct killScArgs
{
OBJ_HANDLE rtpId;
int signo;
};
struct sigpendingScArgs
{
sigset_t * pSet;
};
struct sigprocmaskScArgs
{
int how;
const sigset_t * pSet;
sigset_t * pOset;
};
struct _sigqueueScArgs
{
OBJ_HANDLE rtpId;
int signo;
const union sigval * pValue;
int sigCode;
};
struct _sigsuspendScArgs
{
const sigset_t * pSet;
};
struct _sigtimedwaitScArgs
{
const sigset_t * pSet;
struct siginfo * pInfo;
const struct timespec * pTime;
};
struct _sigactionScArgs
{
int signo;
const struct sigaction * pAct;
struct sigaction * pOact;
void * retAddr;
};
struct chdirScArgs
{
const char * name;
};
struct _getcwdScArgs
{
char * buffer;
int length;
};
struct _waitpidScArgs
{
OBJ_HANDLE childRtpId;
int * pStatus;
int options;
};
struct sysctlScArgs
{
int * pName;
u_int nameLen;
void * pOld;
size_t * pOldLen;
void * pNew;
size_t newLen;
};
struct _schedPxInfoGetScArgs
{
BOOL * pTimeSlicingOn;
ULONG * pTimeSlicePeriod;
};
struct sigaltstackScArgs
{
stack_t * ss;
stack_t * oss;
};
struct unlinkScArgs
{
const char * name;
};
struct linkScArgs
{
const char * name;
const char * newname;
};
struct _fsyncScArgs
{
int fd;
};
struct _fdatasyncScArgs
{
int fd;
};
struct renameScArgs
{
const char * oldname;
const char * newname;
};
struct fpathconfScArgs
{
int fd;
int name;
};
struct pathconfScArgs
{
const char * path;
int name;
};
struct accessScArgs
{
const char * path;
int amode;
};
struct chmodScArgs
{
const char * path;
mode_t mode;
};
struct pxTraceCreationScArgs
{
int cmd;
pid_t pid;
trace_attr_t * attr;
int fd;
trace_id_t * trid;
};
struct pxTraceCtlScArgs
{
int cmd;
trace_id_t trid;
struct trace_event_set_t * filter;
int how;
pthread_t thread_id;
void * pc;
void * ptr_out;
};
struct pxTraceEventScArgs
{
int cmd;
int id_in;
char * data;
size_t data_len;
pthread_t thread_id;
void * pc;
trace_event_id_t * id_out;
};
struct pxTraceEventNameQueryScArgs
{
int cmd;
trace_id_t trid;
int id_in1;
int id_in2;
char * name;
trace_event_id_t * id_out;
int * unavailable;
};
struct pxTraceLogScArgs
{
int cmd;
trace_id_t trid_in;
int fd;
trace_id_t *trid_out;
};
struct pxTraceEventGetScArgs
{
int cmd;
trace_id_t trid;
size_t num_bytes;
struct timespec * timeout;
struct posix_trace_event_info * event;
void * data;
size_t * data_len;
int * unavailable;
};
struct eventReceiveScArgs
{
UINT32 events;
UINT32 options;
_Vx_ticks_t timeout;
UINT32 * pEvtsReceived;
};
struct eventSendScArgs
{
int taskId;
UINT32 events;
};
struct eventCtlScArgs
{
OBJ_HANDLE handle;
VX_EVT_CTL_CMD command;
void * pArg;
size_t * pArgSize;
};
struct msgQSendScArgs
{
OBJ_HANDLE handle;
char * buffer;
size_t nBytes;
_Vx_ticks_t timeout;
int priority;
};
struct msgQReceiveScArgs
{
OBJ_HANDLE handle;
char * buffer;
size_t maxNBytes;
_Vx_ticks_t timeout;
};
struct _msgQOpenScArgs
{
const char * name;
size_t maxMsgs;
size_t maxMsgLength;
int options;
int mode;
void * context;
};
struct objDeleteScArgs
{
OBJ_HANDLE handle;
int options;
};
struct objInfoGetScArgs
{
OBJ_HANDLE handle;
void * pInfo;
size_t * pInfoSize;
int level;
};
struct _semTakeScArgs
{
OBJ_HANDLE handle;
_Vx_ticks_t timeout;
};
struct _semGiveScArgs
{
OBJ_HANDLE handle;
};
struct _semOpenScArgs
{
const char * name;
SEM_TYPE type;
int initState;
int options;
int mode;
void * context;
};
struct semCtlScArgs
{
OBJ_HANDLE handle;
VX_SEM_CTL_CMD command;
void * pArg;
size_t * pArgSize;
};
struct _taskOpenScArgs
{
struct vx_task_open_sc_args * pArgs;
};
struct taskCtlScArgs
{
int tid;
VX_TASK_CTL_CMD command;
void * pArg;
size_t * pArgSize;
};
struct taskDelayScArgs
{
_Vx_ticks_t ticks;
};
struct rtpSpawnScArgs
{
const char * rtpFileName;
const char ** argv;
const char ** envp;
int priority;
size_t uStackSize;
int options;
int taskOptions;
};
struct rtpInfoGetScArgs
{
OBJ_HANDLE rtpId;
RTP_DESC * rtpStruct;
};
struct taskKillScArgs
{
OBJ_HANDLE taskHandle;
int signo;
};
struct _taskSigqueueScArgs
{
OBJ_HANDLE taskHandle;
int signo;
const union sigval * pValue;
int sigCode;
};
struct _timer_openScArgs
{
const char * name;
int mode;
clockid_t clockId;
struct sigevent * evp;
void * context;
};
struct timerCtlScArgs
{
TIMER_CTL_CMD cmdCode;
OBJ_HANDLE timerHandle;
void * pArgs;
size_t pArgSize;
};
struct pxOpenScArgs
{
PX_OBJ_TYPE type;
const char * name;
int objOpenMode;
void * attr;
};
struct pxCloseScArgs
{
OBJ_HANDLE handle;
};
struct pxUnlinkScArgs
{
PX_OBJ_TYPE type;
const char * name;
};
struct pxCtlScArgs
{
OBJ_HANDLE handle;
PX_CTL_CMD_CODE cmdCode;
void * pArgs;
size_t * pArgSize;
};
struct pxMqReceiveScArgs
{
OBJ_HANDLE handle;
char * pMsg;
size_t msgLen;
unsigned int * pMsgPrio;
PX_WAIT_OPTION waitOption;
const struct timespec * time_out;
};
struct pxMqSendScArgs
{
OBJ_HANDLE handle;
const char * pMsg;
size_t msgLen;
unsigned int msgPrio;
PX_WAIT_OPTION waitOption;
const struct timespec * time_out;
};
struct pxSemWaitScArgs
{
OBJ_HANDLE handle;
PX_WAIT_OPTION waitOption;
const struct timespec * time_out;
};
struct pxSemPostScArgs
{
OBJ_HANDLE handle;
};
struct pipeDevCreateScArgs
{
const char * name;
size_t nMessages;
size_t nBytes;
};
struct pipeDevDeleteScArgs
{
const char * name;
BOOL force;
};
struct _sdCreateScArgs
{
char * name;
int options;
size_t size;
off64_t physAddress;
MMU_ATTR attr;
void ** pVirtAddress;
};
struct _sdOpenScArgs
{
char * name;
int options;
int mode;
size_t size;
off64_t physAddress;
MMU_ATTR attr;
void ** pVirtAddress;
};
struct sdDeleteScArgs
{
OBJ_HANDLE handle;
int options;
};
struct sdMapScArgs
{
OBJ_HANDLE handle;
MMU_ATTR attr;
int options;
};
struct sdUnmapScArgs
{
OBJ_HANDLE handle;
int options;
};
struct sdProtectScArgs
{
OBJ_HANDLE handle;
MMU_ATTR attr;
};
struct _edrErrorInjectScArgs
{
int kind;
const char *fileName;
int lineNumber;
REG_SET *regset;
void *addr;
const char *msg;
};
struct wvEventScArgs
{
int eventId;
const char * pData;
unsigned int dataSize;
};
struct rtpVarAddScArgs
{
void ** pVar;
void * value;
};
struct sdInfoGetScArgs
{
OBJ_HANDLE handle;
SD_DESC * pSdStruct;
};
struct _shlOpenScArgs
{
const char * name;
int options;
};
struct _shlUnlockScArgs
{
SHL_ID shlId;
};
struct _shlCloseScArgs
{
SHL_ID shlId;
};
struct _shlGetScArgs
{
SHL_ID shlId;
SHLINFO *pInfo;
};
struct _shlPutScArgs
{
SHL_ID shlId;
const SHLINFO *pInfo;
};
struct objUnlinkScArgs
{
const char * name;
enum windObjClassType classType;
};
struct getprlimitScArgs
{
int idtype;
OBJ_HANDLE handle;
int resource;
struct rlimit *rlp;
};
struct setprlimitScArgs
{
int idtype;
OBJ_HANDLE handle;
int resource;
struct rlimit *rlp;
};
struct _mctlScArgs
{
void * addr;
size_t len;
int function;
void * arg;
};
struct _taskOpenWithGuardScArgs
{
struct vx_task_open_guard_sc_args * pArgs;
};
struct clockCtlScArgs
{
clockid_t clock_id;
CLOCK_CTL_CMD cmdCode;
void * pArgStruct;
size_t * pArgSize;
};
struct _semRTakeScArgs
{
OBJ_HANDLE handle;
_Vx_ticks_t timeout;
};
struct _semWTakeScArgs
{
OBJ_HANDLE handle;
_Vx_ticks_t timeout;
};
struct _semExchangeScArgs
{
OBJ_HANDLE giveHandle;
OBJ_HANDLE takeHandle;
_Vx_ticks_t timeout;
};
struct wvRtpEventScArgs
{
int eventId;
const char * pData;
unsigned int dataSize;
};
struct _selectScArgs
{
int width;
fd_set * readFds;
fd_set * writeFds;
fd_set * excFds;
struct timeval * timeout;
};
struct _sigtimedwait2ScArgs
{
const sigset_t * pSet;
struct siginfo * pInfo;
const struct timespec * pTime;
};
#endif /* _ASMLANGUAGE */
@@ -0,0 +1,95 @@
/* syscallArm.h - ARM specific System Call Infrastructure header */
/*
* Copyright (c) 2003, 2005, 2007 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01g,03dec09,cww Moved ARM specific macros from syscallLibP.h
01f,04may07,zl updated portable library build configuration.
01e,04mar05,scm _SYSCALL_USER_SP_CHECK break signals alt stack option...
01d,23feb05,scm re-assign "spare" to user link reg...
01c,19nov03,cjj replaced pStackLimit by pStackEnd in _SYSCALL_USER_SP_CHECK
01b,14oct03,scm enhanced, flushed out, and debugging.
01a,03oct03,jb written.
*/
/*
DESCRIPTION
This header contains ARM specific definitions and constants used by
the System Call Infrastructure library.
*/
#ifndef __INCsyscallArmh
#define __INCsyscallArmh
#ifndef _ASMLANGUAGE
#include <taskLib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#define SYSCALL_ENTRY_FRAME_SIZE 52
#define _SYSCALL_USER_SP_CHECK(sp)
/* typedefs */
#ifndef _ASMLANGUAGE
/*
* The SYSCALL_ENTRY_STATE structure defines the saved machine state
* when the system call trap is taken. This information is architecture
* specific, and is used by the system call dispatcher to restart system
* calls that have been interrupted by the occurance of signals.
* System call restart is achieved by restoring the saved state at the
* time of the system call trap, and re-issuing the system call.
* Arguments to the system call are saved on the kernel stack, and
* the address of that array is passed as an argument to the dispatcher.
* The layout of this structure must exactly match the ordering of members
* of the system call entry frame in src/arch/arm/syscallALib.s.
*/
typedef struct syscall_entry_state
{
ULONG args[8]; /* argument list (r0-r3 and sp[0]-sp[3]) */
ULONG scn; /* System Call Number (SCN) in r12 */
ULONG statusReg; /* saved Status Register (spsr) */
INSTR *pc; /* Trap return address (lr) */
ULONG *pUStack; /* user-mode stack pointer */
ULONG usrLnk; /* user-mode link register */
} SYSCALL_ENTRY_STATE;
#define ARM_RTP_STACK_OFFSET 12 /* ARM pushes r2, SCn, and lr onto */
/* stack prior to signal handling */
#define SYSCALL_USER_SP_GET(tid) (char *) \
(((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \
(sizeof(SYSCALL_ENTRY_STATE)+ARM_RTP_STACK_OFFSET)))->pUStack)
#define SYSCALL_USER_PC_GET(tid) (void *) \
(((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \
(sizeof(SYSCALL_ENTRY_STATE)+ARM_RTP_STACK_OFFSET)))->pc)
#define SYSCALL_USER_SCN_GET(tid) (int) \
(((SYSCALL_ENTRY_STATE *) ((((WIND_TCB *)(tid))->pExcStackBase) - \
(sizeof(SYSCALL_ENTRY_STATE)+ARM_RTP_STACK_OFFSET)))->scn)
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCsyscallArmh */
+290
View File
@@ -0,0 +1,290 @@
/* vfpArmLib.h - Arm Version of Vector Floating-Point Include File */
/*
* Copyright (c) 2005, 2009-2013 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01f,22aug13,mpc Add VFP support for ARMARCH7M
01e,09oct12,jdw Add support to configure Round To Zero mode in FPSCR
01d,25jul11,jdw Add support for VFPv3-D32 for ARMARCH7
01c,29apr10,pad Moved extern C statement after include statements.
01b,15may09,mdo Assembler is fixed
01a,29jun05,scm VFP written
*/
#ifndef __INCvfpArmLibh
#define __INCvfpArmLibh
#include <vxWorks.h>
#include <regs.h>
#include <esf.h>
#if (CPU == ARMARCH7M)
#include <arch/arm/arm-m/vfpArmLib.h>
#else
#ifdef __cplusplus
extern "C" {
#endif
/* VFP System Registers */
/* FPSID (Floating Point System ID Register) bit definitions */
/* READ ONLY register, RESET State:0x410120b3, Access Mode:Any */
#define FPSID_IMPLEMENTOR_MSK 0xFF000000
#define FPSID_ARM_LTD 0x41000000 /* ARM Limited */
#define FPSID_SW_MSK (1<<23)
#define FPSID_SW FPSID_SW_MSK
#define FPSID_HW 0x00000000
#define FPSID_FORMATR_MSK 0x00600000
#define FPSID_STNDRD_F1 0x00000000
#define FPSID_STNDRD_F2 (1<<21)
#define FPSID_RSRVD_F (1<<22)
#define FPSID_NONSTDRD_F 0x00600000
#define FPSID_SNG_MSK (1<<20)
#define FPSID_SNG_ONLY FPSID_SNG_MSK
#define FPSID_ARCH_MSK 0x000F0000
#define FPSID_VFP1 0x00000000
#define FPSID_VFP2 0x00010000 /* VFPv2 */
#define FPSID_PRTNUM_MSK 0x0000FF00
#define FPSID_VFP11 0x00002000 /* VFP11 */
#define FPSID_VARIANT_MSK 0x000000F0
#define FPSID_ARM11_VFP 0x000000B0 /* ARM 11 VFP */
#define FPSID_REV_MSK 0x0000000F
/* FPSCR (Floating Status and Control Register) bit definitions */
/* READ/WRITE register, RESET State:0x00000000, Access Mode:Any */
/*
* At the time of implementation bits 27-25,19,15-13, and 7-5,
* are described as DNM (DO NOT MODIFY), one must employ
* read/modify/write techniques when handling the FPSCR in order
* to ensure that these bits are not modified...
*/
#define FPSCR_N_BIT (1<<31) /* less than result */
#define FPSCR_Z_BIT (1<<30) /* equal result */
#define FPSCR_C_BIT (1<<29) /* equal, greater than, or unordered result */
#define FPSCR_V_BIT (1<<28) /* unordered result */
#define FPSCR_DN_BIT (1<<25) /* Default NaN mode control */
#define FPSCR_DN_MSK FPSCR_DN_BIT
#define FPSCR_DN_ENABLE FPSCR_DN_BIT
#define FPSCR_DN_DISABLE 0x00000000
#define FPSCR_FZ_BIT (1<<24) /* flush to zero mode control */
#define FPSCR_FZ_MSK FPSCR_FZ_BIT
#define FPSCR_FZ_ENABLE FPSCR_FZ_BIT
#define FPSCR_FZ_DISABLE 0x00000000
/* Trap Enable Bits */
#define FPSCR_IDE_BIT (1<<15) /* Input Subnormal */
#define FPSCR_IXE_BIT (1<<12) /* Inexact */
#define FPSCR_UFE_BIT (1<<11) /* Underflow */
#define FPSCR_OFE_BIT (1<<10) /* Overflow */
#define FPSCR_DZE_BIT (1<<9) /* Division By Zero */
#define FPSCR_IOE_BIT (1<<8) /* Invalid Operation */
/* Cumulative Exception Bits */
#define FPSCR_IDC_BIT (1<<7) /* Input Subnormal */
#define FPSCR_IXC_BIT (1<<4) /* Inexact */
#define FPSCR_UFC_BIT (1<<3) /* Underflow */
#define FPSCR_OFC_BIT (1<<2) /* Overflow */
#define FPSCR_DZC_BIT (1<<1) /* Division By Zero */
#define FPSCR_IOC_BIT (1<<0) /* Invalid Operation */
#define FPSCR_RMODES_MSK 0x00C00000
#define FPSCR_RN 0x00000000
#define FPSCR_RP 0x00400000
#define FPSCR_RM 0x00800000
#define FPSCR_RZ 0x00C00000
#define FPSCR_STRIDE_MSK 0x00300000
#define FPSCR_LEN_MSK 0x00070000
/* FPEXC (Floating Exception Register) bit definitions */
/* READ/WRITE register, RESET State:0x00000000, Access Mode:Privileged */
#define FPEXC_EX_BIT (1<<31) /* status bit */
#define FPEXC_EN_BIT (1<<30) /* global enable bit */
#define FPEXC_FP2V_BIT (1<<28) /* FPINST2 instruction valid bit */
/* Vector Iteration */
#define FPEXC_VECITR_MSK 0x00000700
#define FPEXC_VECITR_1 0x00000000
#define FPEXC_VECITR_2 0x00000100
#define FPEXC_VECITR_3 0x00000200
#define FPEXC_VECITR_4 0x00000300
#define FPEXC_VECITR_5 0x00000400
#define FPEXC_VECITR_6 0x00000500
#define FPEXC_VECITR_7 0x00000600
#define FPEXC_VECITR_8 0x00000700
#define FPEXC_INV_BIT (1<<7) /* Input Exception bit */
#define FPEXC_UFC_BIT (1<<3) /* Potential Underflow bit */
#define FPEXC_OFC_BIT (1<<2) /* Potential Overflow bit */
#define FPEXC_IOC_BIT (1<<0) /* Potential Invalid Operation bit */
/* VFP11 Specific System Registers */
/* FPINST (Floating Point Instruction Register) bit definitions */
/* READ/WRITE register, RESET State:0xEE000A00, Access Mode:Privileged */
/*
* FPINST register contains the exceptional instruction
*/
/* FPINST2 (Floating Point Instruction Register 2) bit definitions */
/* READ/WRITE register, RESET State:Unpredictable, Access Mode:Privileged */
/*
* FPINST2 register contains the instruction that was issued to the VFP11
* coprocessor before the exception was detected
*/
/* MFVFR0 (Media and VFP Feature Register 0) bit definitions */
/* READ ONLY register, RESET State:0x11111111, Access Mode:Any */
/* MFVFR1 (Media and VFP Feature Register 1) bit definitions */
/* READ ONLY register, RESET State:0x00000000, Access Mode:Any */
/* initialization parameters */
/*
* The VFP coprocessor allows the Round To Zero mode to be used to perform
* faster VFP computations, but is not strictly IEEE-754 compliant. The
* default for ARM is to enable Round To Zero mode. See the ARM Architecture
* Reference Manual for more information.
*/
#ifdef _WRS_CONFIG_DISABLE_VFP_ROUND_TO_ZERO
#define FPSCR_INIT FPSCR_DN_MSK
#else /* _WRS_CONFIG_DISABLE_VFP_ROUND_TO_ZERO */
#define FPSCR_INIT (FPSCR_DN_MSK | FPSCR_FZ_BIT)
#endif /* _WRS_CONFIG_DISABLE_VFP_ROUND_TO_ZERO */
#define _VFP_ALIGN_SIZE 8 /* 64 bit */
#define VFPREG_SET VFP_CONTEXT
/* FP_CONTEXT structure offsets */
#define VFP_FPSID 0x00
#define VFP_FPSCR 0x04
#define VFP_FPEXC 0x08
#define VFP_FPINST 0x0C
#define VFP_FPINST2 0x10
#define VFP_MVVFR0 0x14
#define VFP_MVVFR1 0x18
#define VFP_PAD -
#define VFP_GPR 0x20 /* OFFSET(FP_CONTEXT, vfp_gpr[0]) */
#define VFP_GPR_OFFSET(n) (VFP_GPR + (n)*4) /* vfp_gpr[n]) */
/* VFP_REG_SET - ARM VFP register set */
#ifdef _WRS_CONFIG_ENABLE_VFPV3_D32
/*
* VFPv3-D32 / NEON
* 64 single precision or 32 double precision general purpose
*/
#define VFP_DGPR_NUM 32 /* 32-double precision general purpose */
#define VFP_SGPR_NUM 64 /* 64-single precision general purpose */
#else /* _WRS_CONFIG_ENABLE_VFPV3_D32 */
/*
* VFPv3-D16
* 32 single precision or 16 double precision general purpose
*/
#define VFP_DGPR_NUM 16 /* 16-double precision general purpose */
#define VFP_SGPR_NUM 32 /* 32-single precision general purpose */
#endif /* _WRS_CONFIG_ENABLE_VFPV3_D32 */
#if (_BYTE_ORDER == _LITTLE_ENDIAN)
# define HREG 1
# define LREG 0
#else /* _BYTE_ORDER != _LITTLE_ENDIAN */
# define HREG 0
# define LREG 1
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
#ifndef _ASMLANGUAGE
typedef union
{
double u64;
UINT32 u32[2];
} VFP_UNION64D;
typedef struct vfpContext /* VFP Context */
{
UINT32 fpsid; /* system ID register : 4 */
UINT32 fpscr; /* status and control register : 4 */
UINT32 fpexc; /* exception register : 4 */
UINT32 fpinst; /* instruction register : 4 */
UINT32 fpinst2; /* instruction register 2 : 4 */
UINT32 mfvfr0; /* media and VFP feature Register 0: 4 */
UINT32 mfvfr1; /* media and VFP feature Register 1: 4 */
UINT32 pad;
UINT32 vfp_gpr[VFP_SGPR_NUM]; /* general purpose registers : 128 or 256 */
/* TOTAL : 156 or 284 */
} WRS_PACK_ALIGN(_VFP_ALIGN_SIZE) VFP_CONTEXT;
/* function declarations */
IMPORT void vfpArchInit (void);
IMPORT void vfpArchTaskCreateInit (VFP_CONTEXT *pDspContext);
IMPORT void vfpSave (VFP_CONTEXT *);
IMPORT void vfpRestore (VFP_CONTEXT *);
IMPORT STATUS vfpProbe (void);
IMPORT STATUS vfpProbeTrap (void);
IMPORT STATUS vfpEnable (void);
IMPORT STATUS vfpDisable (void);
IMPORT VFP_CONTEXT * vfpCtxCreate (int);
IMPORT STATUS vfpCtxDelete (VFP_CONTEXT *);
IMPORT void vfpCtxShow (VFP_CONTEXT *);
void vfpRegsToCtx (VFPREG_SET *, VFP_CONTEXT *);
void vfpCtxToRegs (VFP_CONTEXT *, VFPREG_SET *);
#ifdef _WRS_HW_VFP_SUPPORT
IMPORT int vfpIsEnabled (void);
IMPORT int vfpHasException (void);
IMPORT STATUS vfpProbeSup (void);
IMPORT UINT32 vfpFpSidGet (void);
IMPORT UINT32 vfpFpScrGet (void);
IMPORT void vfpFpScrSet (UINT32);
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CPU == ARMARCH7M */
#endif /* __INCvfpArmLibh */
@@ -0,0 +1,38 @@
/* vxAtomicArchLib.h - ARM specific atomic library header */
/*
* Copyright (c) 2007-2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01e,29apr10,pad Moved extern C statement after include statements.
01d,15may09,gls made memory barriers available in user space
01d,25feb09,j_b merge ARM SMP support:
05mar08,j_b fix gnu inline assembly declarations
15feb08,j_b add inline _dsb (Data Synchronization Barrier)
09jul07,to added memory barrier macros for ARMARCH6
01c,16jun08,zl use _WRS_BARRIER() for memory barrier implementations
01b,07may07,m_h Atomic Operator definitions
01a,07may07,m_h Created
*/
#ifndef __INCvxAtomicArchLibh
#define __INCvxAtomicArchLibh
#include <arch/arm/vxAtomicArchLibCommon.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __INCvxAtomicArchLibh */
@@ -0,0 +1,155 @@
/* vxAtomicArchLibCommon.h - ARM specific atomic library header */
/*
* Copyright (c) 2009-2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01g,18may12,j_b add support for ARMARCH7M
01f,04mar11,j_b replace hardcoded DMB, DSB opcodes after compiler fix
01e,12jan11,jdw Fix inline assembly opcodes for T2 (WIND00249791)
01d,21oct10,j_b add memory barrier support for ARMv7
01c,07jun09,kk add VX_INSTR_BARRIER() back
01b,05jun09,kk move inlines from vxAtomicArchLib.h to here
01a,17may09,gls written.
*/
#ifndef __INCvxAtomicArchLibCommonh
#define __INCvxAtomicArchLibCommonh
#ifdef __cplusplus
extern "C" {
#endif
/* Remove this line when all arch implement memory barrier API */
#define _WRS_ARCH_SUPPORTS_MEM_BARRIER
/*
* ARM architecture 6 and later defines two kinds of memory barriers:
* - Data Synchronization Barrier (DSB)
* - Data Memory Barrier (DMB)
*
* DMB is enough for read/write memory barrier.
*/
#if (CPU == ARMARCH6) || (CPU == ARMARCH7) || \
(CPU == ARMARCH7_T2) || (CPU == ARMARCH7M)
# if (CPU == ARMARCH6)
/* ARMARCH6 provides memory barrier operations via system control processor */
# if defined (__DCC__)
__asm volatile void __dmb ()
{
! "r0"
mov r0, #0
mcr p15, 0, r0, c7, c10, 5
}
__asm volatile void __dsb ()
{
! "r0"
mov r0, #0
mcr p15, 0, r0, c7, c10, 4
}
# elif defined (__GNUC__)
static __inline__ void __dmb (void)
{
int sbz = 0;
__asm__ volatile (
"mcr p15, 0, %0, c7, c10, 5"
: /* no output */
: "r" (sbz)
: "memory");
}
static __inline__ void __dsb (void)
{
int sbz = 0;
__asm__ volatile (
"mcr p15, 0, %0, c7, c10, 4"
: /* no output */
: "r" (sbz)
: "memory");
}
# else /* !__DCC_ && !__GNUC__ */
#error "error!!! unsupported compiler!!!"
# endif /* __DCC__ */
# elif (CPU == ARMARCH7) || (CPU == ARMARCH7_T2) || \
(CPU == ARMARCH7M)
/* ARMARCH7 provides memory barrier instructions */
# if defined (__DCC__)
__asm volatile void __dmb ()
{
DMB
}
__asm volatile void __dsb ()
{
DSB
}
# elif defined (__GNUC__)
static __inline__ void __dmb (void)
{
__asm__ volatile (
"dmb"
: /* no output */
: /* no input */
: "memory");
}
static __inline__ void __dsb (void)
{
__asm__ volatile (
"dsb"
: /* no output */
: /* no input */
: "memory");
}
# else /* !__DCC_ && !__GNUC__ */
#error "error!!! unsupported compiler!!!"
# endif /* __DCC__ */
# endif /* (CPU == ARMARCH6) */
#define VX_MEM_BARRIER_R() __dmb()
#define VX_MEM_BARRIER_W() __dmb()
#define VX_MEM_BARRIER_RW() __dmb()
#define VX_INSTR_BARRIER() __dmb()
#define VX_SYNC_BARRIER() __dsb()
#else /* (CPU == ARMARCH6) || (CPU == ARMARCH7) || (CPU == ARMARCH7_T2) */
#define VX_MEM_BARRIER_R() _WRS_ASM("NOP")
#define VX_MEM_BARRIER_W() _WRS_ASM("NOP")
#define VX_MEM_BARRIER_RW() _WRS_ASM("NOP")
#define VX_INSTR_BARRIER() _WRS_ASM("NOP")
#define VX_SYNC_BARRIER() _WRS_ASM("NOP")
#endif /* (CPU == ARMARCH6) || (CPU == ARMARCH7) || (CPU == ARMARCH7_T2) */
#ifdef __cplusplus
}
#endif
#endif /* __INCvxAtomicArchLibCommonh */
@@ -0,0 +1,45 @@
/* vxInlineArch.h - ARM inline macro configuration */
/*
* Copyright (c) 2007, 2009-2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,21may10,m_h Thumb-2 Support
01b,18may09,j_b add _inline_intCpuMicroLock/Unlock support
01a,19jun07,zl created
*/
#ifndef __INCvxInlineArchh
#define __INCvxInlineArchh
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file is included from <vxInline.h>. It may define _WRS_INLINE_xxx
* build configuration macros in order to enable architecture specific
* inlined implementation of a macro definition.
*/
#if !(ARM_THUMB) && !(ARM_THUMB2)
#define _WRS_INLINE_intCpuLock
#define _WRS_INLINE_intCpuUnlock
#define _WRS_INLINE_intCpuMicroLock
#define _WRS_INLINE_intCpuMicroUnlock
#endif /* !ARM_THUMB && !ARM_THUMB2 */
#ifdef __cplusplus
}
#endif
#endif /* __INCvxInlineArchh */
+330
View File
@@ -0,0 +1,330 @@
/* archI86.h - Intel 80X86 specific header */
/*
* Copyright (c) 1993,1999,2001-2008,2010,2011,2013 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
03b,20jun13,scm WIND00420874 - correct workQAdd indexing for more than 8
core...
03a,14aug11,j_l Move _WRS_ARCH_HAS_CPU_PWR_MGMT outside of power management
ifdef.
02z,12aug11,rbc WIND00238999 - Fix conditional for CPU==NEHALEM
02y,11aug11,rbc WIND00238999 - Fix build errors
02x,09aug11,rbc WIND00238999 - Fix build error for windPwrDown()
02w,18may11,jb Requirement WIND00189850 - Increase VX_MAX_SMP_CPUS for HT/SMT support
02v,19jan11,jb Fix for WIND00185635 - mmu deoptimize locks do not work
02u,05nov10,gls modified _ALLOC_ALIGN_SIZE
02t,20oct10,zl defined _WRS_ARCH_DEFERS_KERNEL_UNLOCK and
_WRS_ARCH_HAS_TASK_MMU_CURRENT_SET.
02t,30sep10,sem Add new IA cpus. Remove pentium2/3
02s,16sep10,gls added VX_OBJ_ALIGN_SIZE
02r,29jul10,pad Moved extern C statement after include statements.
02q,10oct08,rbc WIND00132719. Add defines for _STACK_ALIGN_SIZE and
_ALLOC_ALIGN_SIZE.
02p,27aug08,jpb Renamed VSB header file
02o,24jun08,jpb Added include path for kernel configurations options set in
vsb. Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP.
02n,13mar08,rlp Removed obsolete _WRS_ARCH_HAS_DBG_IPI macro.
02m,24sep07,scm WIND00105635, enable _WRS_MMU_HAS_MAP_STATE_API.
02l,15aug07,mmi Added _WRS_ARCh_HAS_CPU_PWR_MGMT
02k,25jul07,scm WIND00099103...
02j,13jul07,rlp Added the _WRS_ARCH_HAS_DBG_IPI support.
02i,09jul07,tor revert 02h
02h,02jul07,tor temp macro for vxIpiLib and cpcLib
02g,04may07,zl updated portable library build configuration.
02f,17apr07,kk move VX_MAX_SMP_CPUS from smpI86P.h to here
02e,21feb07,jmg Added include vxPortablLibP.h
02d,11dec06,kk removed references to _WRS_BASE6_SCHEDULER and
_WRS_ARCH_HAS_RESCHEDULE_STACK, no longer needed
02c,06dec06,scm only Pentium4 is SMP safe...
02b,02nov06,scm define _WRS_ARCH_HAS_IDLE_TASK, undef
_WRS_ARCH_HAS_RESCHEDULE_STACK
02a,25sep06,scm added _WRS_ARCH_HAS_NEW_KERNEL_LOCK
01z,30aug06,scm Add definition _WRS_VX_NO_GLOBAL_ERRNO
01y,15jun06,scm Add definition of _WRS_ARCH_HAS_RESCHEDULE_STACK.
01y,30jun06,agf enable optimized version of bLib (CQ:WIND00044910)
01x,28apr05,scm scm add _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK
01w,12apr05,kk remove _WRS_OBJLIB_SUPPORT_VERIFY_TRAP macro (SPR# 106486)
01v,04nov04,scm add _WRS_OSM_INIT for new OSM API...
01u,01sep04,jb Adding _WRS_OBJLIB_SUPPORT_VERIFY_TRAP for objVerify support
01t,14jul04,jb Enable Portable for all functions
01s,17may04,jb Switch to PORTABLE scheduler.
Fix debug register clear on load and go problem
01r,05may04,zmm Fix diab compiler warnings.
01s,13may04,zl fixed _WRS_FRAMEP_FROM_JMP_BUF().
01r,27apr04,cjj Defined workQLib_PORTABLE
01q,27apr04,jmp moved INSTR definition to archI86Common.h. added macros for
getting frame and return PC from a jmp_buf.
01p,03dec03,md changed to use portable scheduler
01o,25nov03,pes Move setting of _BYTE_ORDER macro into archI86Common.h.
01n,14nov03,job Moved some blib stuff to archI86Common.h
01m,13nov03,pes Add include of archI86Common.h
01l,27aug03,to added defines for semLib.
01k,07may03,pes PAL conditional compilation cleanup. Phase 2.
01j,28apr03,pes PAL conditional compilation cleanup.
01i,12nov02,hdn made CR4 initialization only for P5 or later (spr 83992)
01h,29oct02,hdn assigned reserved1 to (FP_CONTEXT *) (spr 70252)
01g,07oct02,hdn added the architecture extension of the TCB
01f,13mar01,sn SPR 73723 - define supported toolchains
01e,04oct01,hdn enclosed ARCH_REGS_INIT macro with _ASMLANGUAGE
01d,21aug01,hdn added PENTIUM4's _CACHE_ALIGN_SIZE, ARCH_REGS_INIT
01c,10aug01,hdn added PENTIUM2/3/4 support
01b,25feb99,hdn added _CACHE_ALIGN_SIZE for Pentium and PentiumPro
01a,07jun93,hdn written based on arch68k.h
*/
#ifndef __INCarchI86h
#define __INCarchI86h
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
#if (CPU==PENTIUM) && defined(_WRS_CONFIG_SMP)
#error "PENTIUM IS NOT SMP SAFE !!!"
#endif
#define _ARCH_SUPPORTS_GCC
/* temporary macro to indicate i86 uses the idle task stack */
#define _WRS_ARCH_HAS_IDLE_TASK
/* temporary macro to indicate i86 uses the type II kernel lock */
#define _WRS_ARCH_HAS_NEW_KERNEL_LOCK
#define _WRS_VX_NO_GLOBAL_ERRNO
/* arch supports new MMU API... */
#define _WRS_MMU_HAS_MAP_STATE_API
/* this cpu family supports power management framework */
#define _WRS_ARCH_HAS_CPU_PWR_MGMT
#if (CPU==_VX_NEHALEM) || defined(_WRS_CONFIG_WRHV_GUEST)
#define _WRS_ARCH_HAS_WIND_PWR_DOWN
#define WIND_PWR_DOWN() windPwrDown()
/* support for device power management */
#if !defined(_WRS_CONFIG_WRHV_GUEST)
#define _WRS_ARCH_HAS_DEV_PWR_MGMT
#endif /* !defined(_WRS_CONFIG_WRHV_GUEST) */
#endif /* (CPU==_VX_NEHALEM) || defined(_WRS_CONFIG_WRHV_GUEST) */
/* arch needs deferred kernel unlock */
#define _WRS_ARCH_DEFERS_KERNEL_UNLOCK
/* arch provides taskMmuCurrentSet() */
#define _WRS_ARCH_HAS_TASK_MMU_CURRENT_SET
/* arch allows semaphore protection for vmStateSet */
#define _WRS_MMU_DEOPTIMIZE_LOCK_CTX_SEM
#undef VX_MAX_SMP_CPUS
#if CPU!=PENTIUM
#if CPU==_VX_ATOM
#define VX_MAX_SMP_CPUS 8 /* maximum processors in SMP configuration */
#define VX_MAX_SMP_CPU_SHIFT 3 /* allow workQ to calculate with Max CPUs */
#elif CPU==PENTIUM4 || CPU==_VX_CORE
#define VX_MAX_SMP_CPUS 16 /* maximum processors in SMP configuration */
#define VX_MAX_SMP_CPU_SHIFT 4 /* allow workQ to calculate with Max CPUs */
#else
#define VX_MAX_SMP_CPUS 32 /* maximum processors in SMP configuration */
#define VX_MAX_SMP_CPU_SHIFT 5 /* allow workQ to calculate with Max CPUs */
#endif /* CPU==_VX_ATOM */
#endif /* CPU!=PENTIUM */
#define _DYNAMIC_BUS_SIZING FALSE /* required alignment for swap */
/* required stack alignment for sse and sse2 instructions is 16 bytes */
#define _STACK_ALIGN_SIZE 16
/* allocated objects require an 8 byte aligment */
#define _ALLOC_ALIGN_SIZE 8
/*
* VX_OBJ_ALIGN_SIZE is the default allocation boundary for kernel objects.
* This is used for both statically and dynamically allocated objects.
*
* NOTE:
*
* For the INTEL architecture VxWorks objects must be aligned to a 64-bit
* boundary for ILP32 and a 128-bit boundary for LP64. This is to allow
* the objVerifiedSafe() routine to be implemented using an atomic CAS of
* the 'safe' count and 'magic' value in an object handle.
*/
#define VX_OBJ_ALIGN_SIZE 8
#if (CPU==PENTIUM)
#define _CACHE_ALIGN_SIZE 32
#else
#define _CACHE_ALIGN_SIZE 64
#endif /* CPU==PENTIUM */
#ifdef _ASMLANGUAGE
/*
* system startup macros used by sysInit(sysALib.s) and romInit(romInnit.s).
* - no function calls to outside of BSP is allowed.
* - no references to the data segment is allowed.
* the CR4 is introduced in the Pentium processor.
*/
#define ARCH_REGS_INIT \
xorl %eax, %eax; /* zero EAX */ \
movl %cr0, %edx; /* get CR0 */ \
andl $0x7ffafff1, %edx; /* clear PG, AM, WP, TS, EM, MP */ \
movl %edx, %cr0; /* set CR0 */ \
\
pushl %eax; /* initialize EFLAGS */ \
popfl;
#define ARCH_CR4_INIT \
xorl %eax, %eax; /* zero EAX */ \
movl %eax, %cr4; /* initialize CR4 */
#else
/* architecture extension of the TCB (pTcb->reserved2) */
typedef struct x86Ext /* architecture specific TCB extension */
{
unsigned int reserved0; /* (DS_CONFIG *) */
unsigned int reserved1; /* (FP_CONTEXT *) for FPU exception */
unsigned int reserved2;
unsigned int reserved3;
unsigned int reserved4;
unsigned int reserved5;
unsigned int reserved6;
unsigned int reserved7;
} X86_EXT;
/* no function declarations for makeSymTlb/symTbl.c */
/* macros for getting frame and return PC from a jmp_buf */
#define _WRS_FRAMEP_FROM_JMP_BUF(env) ((char *) (env)[0].reg.reg_fp)
#define _WRS_RET_PC_FROM_JMP_BUF(env) ((INSTR *) (env)[0].reg.reg_pc)
#endif /* _ASMLANGUAGE */
/* PAL additions */
/* architecture-specific overrides for fppSave and fppRestore in fppLib.c */
#define FPP_SAVE(p) (*_func_fppSaveRtn)(p)
#define FPP_RESTORE(p) (*_func_fppRestoreRtn)(p)
/* from h/usb/target/usbIsaLib.h */
/* DMA controller selection */
#define _WRS_DMA_I8237
/* trigger signed IO arguments in sysLib.h */
#define _WRS_SIGNED_IO_ARGS
#define _WRS_SYS_IO
/* override _WRS_SR_SIZE in taskArchLib.h */
#define _WRS_SR_SIZE UINT
/*
* trigger definition of portWorkQAdd1 in trgLib.c and
* rBuffLib.c
*/
#define _WRS_PORT_WORK_Q_ADD1
/* used in cacheLib.c:cacheFuncsSet() */
#define _WRS_EXTERN_WRITEBACK
/* used in fppLib.c to align FP_CONTEXT */
/* dummy context must be in data section for now */
#define _WRS_ALIGN_FP_CONTEXT
#define _WRS_FPP_DUMMY_CONTEXT \
_WRS_DATA_ALIGN_BYTES(_CACHE_ALIGN_SIZE) fppDummyContext = {{{0}}}
/* architecture-specific overrides for fppSave and fppRestore in dbgLib.c */
#define _WRS_SHOW_SSE_REGS
#define FPP_DBG_SAVE(p) (*_func_fppSaveRtn)(p)
#define FPP_DBG_RESTORE(p) (*_func_fppRestoreRtn)(p)
/* from loadElfLib.c */
#define _WRS_USE_ELF_LOAD_FORMAT
/* from xdr_float.c */
#define FLOAT_NORM
/* from vmShow.c */
#define _WRS_SHOW_WBACK_STATE
#define _WRS_SHOW_GLOBAL_STATE
/* from taskShow.c */
#define _WRS_SHOW_SSE_REGS
/* from rBuffLib.c */
#define _WRS_PORT_WORK_Q_ADD1
/* from wdbFpLib.c */
#define _WRS_ALIGN_REG_SET
/* from schedLib.c */
#define _WRS_ENABLE_IDLE_INTS {intUnlock (-1);}
/* from sysOsmLib.c */
#define _WRS_OSM_INIT
/* Interrupt stack protection, used in usrDepend.c and usrKernelStack.c */
#define _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK
/* if OSM support not available for stack protection,
* * then support can not be available for interrupt
* * stack protection.
* */
#if !defined(_WRS_OSM_INIT)
#undef _ARCH_SUPPORTS_PROTECT_INTERRUPT_STACK
#endif
#ifdef __cplusplus
}
#endif
#include <arch/i86/archI86Common.h>
/* end of PAL additions */
#endif /* __INCarchI86h */
@@ -0,0 +1,73 @@
/* archI86Common.h - common I86 architecture specific header */
/*
* Copyright (c) 2003-2004, 2006-2007, 2009, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01l,22mar12,jpb Updated for POSIX namespace isolation conformance (part of
defect Defect WIND000307800).
01k,15dec09,scm remove SYSCALL64 var...
01j,10dec09,scm create 64bit syscall constants...
01i,04may07,zl updated portable library build configuration.
01h,02feb06,mil Updated for POSIX namespace conformance.
01g,13may04,zl enabled user trcLib support.
01f,27apr04,jmp added support for portable trcLib. moved INSTR definition
form archI86.h.
01e,13apr04,zmm Add coprocessor support for Pentium.
01d,25nov03,pes Move setting of _BYTE_ORDER macro into archI86Common.h
01c,17nov03,jb Adding defines for syscalls
01b,12nov03,job Moved some blib stuff from archI86.h
01a,11nov03,pes written.
*/
#ifndef __INCarchI86Commonh
#define __INCarchI86Commonh
#ifdef __cplusplus
extern "C" {
#endif
#define _BYTE_ORDER _LITTLE_ENDIAN
#ifndef _ASMLANGUAGE
typedef unsigned char _Vx_INSTR; /* char instructions */
#endif /* !_ASMLANGUAGE */
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && \
!defined(_POSIX_AEP_RT_CONTROLLER_C_SOURCE)
/* Common syscall defines */
#define SYSCALL_SEGMENT 8
#define SYSCALL_GATE_OFFSET 0x43 /* (SYSCALL_SEGMENT * sizeof(GDT) | (DPL3 > 13) ) */
/* from bLib.c */
#define _WRS_BLIB_ALIGNMENT 1 /* 2 byte alignment mask */
#define _WRS_PAL_COPROC_LIB /* enable coprocessor abstraction */
#define _WRS_TRC_ARGS_COUNT 5 /* number of arguments to print in */
/* stack trace */
#ifndef _ASMLANGUAGE
typedef _Vx_INSTR INSTR;
#endif /* !_ASMLANGUAGE */
#endif /* !_POSIX_xxx_SOURCE */
#ifdef __cplusplus
}
#endif
#endif /* __INCarchI86Commonh */
+139
View File
@@ -0,0 +1,139 @@
/* asmI86.h - i80x86 assembler definitions header file */
/*
* Copyright (c) 1992,1993.1998,2001,2003,2006,2008
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01o,26mar08,dbt Added FUNC_BEGIN & FUNC_END macros (Defect WIND00066731)
01n,21jul06,scm Move SMP macros to private header.
01m,13jul06,scm correct for UNI mode RTP/OSM support...
01l,07jul06,scm update macros for smp/uni...
01k,28jun06,scm SMP GDT support macros added.
01j,06jun06,scm Add SMP support.
01i,17nov05,zmm Use .type directive to declare assembly language symbols that
weren't typed properly by GNU assembler. SPR 114490.
01h,04may04,dbt Added ARG8-12 and SP_ARG8-12.
01g,17nov03,jb Adding additional ARG defines
01f,01nov01,hdn added ARG8 and SP_ARG8
01e,01oct01,pad Turn off the underscore prepending to assembly routines.
01d,14aug01,hdn imported FUNC/FUNC_LABEL GTEXT/GDATA macros from T31 ver 01i
01c,28aug98,hdn added INT_CONNECT_CODE29 for intEnt().
01b,07jun93,hdn added support for c++
01a,28feb92,hdn written based on TRON, 68k version.
*/
#ifndef __INCasmI86h
#define __INCasmI86h
/************************************************************/
/*
* The following definitions are used for symbol name compatibility.
*
* When #if 1, sources are assembled assuming the compiler
* you are using does not generate global symbols prefixed by "_".
* (e.g. elf/dwarf)
*
* When #if 0, sources are assembled assuming the compiler
* you are using generates global symbols prefixed by "_".
* (e.g. coff/stabs)
*/
#if TRUE
#define FUNC(sym) sym
#define FUNC_LABEL(sym) sym:
#else
#define FUNC(sym) _##sym
#define FUNC_LABEL(sym) _##sym:
#endif
#define VAR(sym) FUNC(sym)
/*
* These macros are used to declare assembly language symbols that need
* to be typed properly(func or data) to be visible to the OMF tool.
* So that the build tool could mark them as an entry point to be linked
* correctly. This is an elfism. Use #if 0 for a.out.
*/
#if TRUE
#define GTEXT(sym) FUNC(sym) ; .type FUNC(sym),@function
#define GDATA(sym) FUNC(sym) ; .type FUNC(sym),@object
#else
#define GTEXT(sym) FUNC(sym)
#define GDATA(sym) FUNC(sym)
#endif
/* Introduced to abstract assembler idiosyncrasies */
#define FUNC_BEGIN(func) FUNC_LABEL(func)
#define FUNC_END(func) .size FUNC(func), . - FUNC(func)
/************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/* fp offsets to arguments */
#define ARG1 8
#define ARG1W 10
#define ARG2 12
#define ARG2W 14
#define ARG3 16
#define ARG3W 18
#define ARG4 20
#define ARG5 24
#define ARG6 28
#define ARG7 32
#define ARG8 36
#define ARG9 40
#define ARG10 44
#define ARG11 48
#define ARG12 52
#define DARG1 8 /* double arguments */
#define DARG1L 12
#define DARG2 16
#define DARG2L 20
#define DARG3 24
#define DARG3L 28
#define DARG4 32
#define DARG4L 36
/* sp offsets to arguments */
#define SP_ARG0 0
#define SP_ARG1 4
#define SP_ARG1W 6
#define SP_ARG2 8
#define SP_ARG2W 10
#define SP_ARG3 12
#define SP_ARG3W 14
#define SP_ARG4 16
#define SP_ARG5 20
#define SP_ARG6 24
#define SP_ARG7 28
#define SP_ARG8 32
#define SP_ARG9 36
#define SP_ARG10 40
#define SP_ARG11 44
#define SP_ARG12 48
/* offset to the IRQ number in the intConnectCode[] */
#define INT_CONNECT_CODE29 24 /* from the return address of intEnt() */
#ifdef __cplusplus
}
#endif
#endif /* __INCasmI86h */
@@ -0,0 +1,64 @@
/* cacheI86Lib.h - I80486 cache library header file */
/* Copyright 1984-2002, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01g,29apr10,pad Moved extern C statement after include statements.
01f,04jun04,mil Removed cacheArchXXX routines.
01e,07mar02,hdn added CLFLUSH related macros (spr 73360)
01d,04dec01,hdn added CACHE_TYPE parameter to cachePen4Flush/Clear
01c,23aug01,hdn renamed cache486XXX to cacheI86XXX
added PENTIUM4 support
01b,29may94,hdn deleted I80486 macro.
01a,15jun93,hdn created.
*/
#ifndef __INCcacheI86Libh
#define __INCcacheI86Libh
#include "vxWorks.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CLFLUSH_DEF_BYTES 64 /* def bytes flushed by CLFLUSH */
#define CLFLUSH_MAX_BYTES 255 /* max bytes flushed with CLFLUSH */
#ifndef _ASMLANGUAGE
#if defined(__STDC__) || defined(__cplusplus)
extern void cacheI86Reset (void);
extern void cacheI86Enable (void);
extern void cacheI86Disable (void);
extern void cacheI86Lock (void);
extern void cacheI86Unlock (void);
extern void cacheI86Clear (void);
extern void cacheI86Flush (void);
extern void cachePen4Clear (CACHE_TYPE cache, void * address, size_t bytes);
extern void cachePen4Flush (CACHE_TYPE cache, void * address, size_t bytes);
#else
extern void cacheI86Reset ();
extern void cacheI86Enable ();
extern void cacheI86Disable ();
extern void cacheI86Lock ();
extern void cacheI86Unlock ();
extern void cacheI86Clear ();
extern void cacheI86Flush ();
extern void cachePen4Clear ();
extern void cachePen4Flush ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcacheI86Libh */
+40
View File
@@ -0,0 +1,40 @@
/* coprocI86.h - coprocessor management library header */
/*
* Copyright 2003-2004, 2010, 2012 Wind River Systems, Inc.
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01c,15may12,jmp CQID: Fix WIND00309977 : Added VX_COPROCS_ALL_TASK
definition.
01b,28apr10,pad Moved extern C statement after include statements.
01a,13apr04,zmm written based on coprocPpc.h 01c.
*/
#ifndef __INCcoprocI86h
#define __INCcoprocI86h
/* includes */
#include "taskLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#define VX_FP_TASK VX_COPROC1_TASK
#define VX_COPROCS_ALL_TASK VX_FP_TASK
#ifdef __cplusplus
}
#endif
#endif /* __INCcoprocI86h */
@@ -0,0 +1,931 @@
/* cpuPwrArchI86Lib.h - CPU Power Mgmt. H/W library specific header */
/*
* Copyright (c) 2011, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01j,27aug12,c_t WIND00350715 - Add cpuPwrArchTurboUnSet
01i,23aug11,sem WIND00294323, undef P-state and C-State propagation
01h,18aug11,sem WIND00294323, fix default P-state values
01g,02aug11,scm WIND00255355, allow for propagation of CPU C-States...
01f,22jul11,scm WIND00255355, allow for propagation of CPU[0] P-States...
01e,18jul11,jlv WIND00255352, add cpuPwrArchPStateGetByCpu
01d,06jul11,rdl move common APIs to the common header file
01c,05jul11,scm WIND00255355, adjust inclusion wrapper...
01b,28jun11,scm WIND00255255, add pwr mgmt arch abstraction...
01a,31may11,scm WIND00255355, CPU Power State Device Management...
*/
#ifndef __INCcpuPwrArchI86Libh
#define __INCcpuPwrArchI86Libh
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
/* allow for duplication of CPU[0] P-States */
#undef ACPI_PWR_CPU_ARCH_PROPAGATE_CPU_PERF_0
/* allow for duplication of CPU[0] C-States */
#undef ACPI_PWR_CPU_ARCH_PROPAGATE_CPU_C_STATE
/* Power Management support definitions */
#define PM_CPUID_KEY 0x06
#define MSR_IA32_MPERF 0x00E7
#define MSR_IA32_APERF 0x00E8
#define MSR_IA32_PERF_STAT 0x0198
#define MSR_IA32_PERF_CTL 0x0199
#define MSR_IA32_MISC_ENABLE 0x01A0
#define MSR_IA32_ENERGY_PERF_BIAS 0x01B0
#define PM_EAX_MSK 0x00000077
#define PM_EBX_MSK 0x0000000F
#define PM_ECX_MSK 0x00000009
#define PM_DTS 0x00000001
#define PM_TBT 0x00000002
#define PM_ARAT 0x00000004
#define PM_PLN 0x00000010
#define PM_ECMD 0x00000020
#define PM_PTM 0x00000040
#define PM_HCFC 0x00000001
#define PM_OPPO 0x00000040
#define PM_PEB 0x00000004
#define PM_PEBH_MSK1 0x0000000F
#define PM_PEBH_MSK2 0xFFFFFFF0
#define TM_DISENGAGE_BIT 0x00000001
#define TM_DISENGAGE_MSK 0xFFFFFFFE
#define TM_EIST_TRG_MSK 0x0000ffff
#ifdef _WRS_CONFIG_LP64
#define cpuPwrArchPMSup1_Offset 0x70
#define cpuPwrArchPMSup2_Offset 0x74
#define cpuPwrArchPMIntThrsh_Offset 0x78
#else
#define cpuPwrArchPMSup1_Offset 0x50
#define cpuPwrArchPMSup2_Offset 0x54
#define cpuPwrArchPMIntThrsh_Offset 0x58
#endif /* _WRS_CONFIG_LP64 */
/* Thermal Management support definitions */
#define TM_CPUID_KEY 0x01
#define MSR_THERM2_CTL 0x019D
#define MSR_IA32_CLOCK_MODULATION 0x019A
#define MSR_IA32_THERM_INTERRUPT 0x019B
#define MSR_IA32_THERM_STATUS 0x019C
#define MSR_IA32_PACKAGE_THERM_STATUS 0x01B1
#define MSR_IA32_PACKAGE_THERM_INTERRUPT 0x01B2
#define TM_ECX_MSK 0x00000180
#define TM_EDX_MSK 0x20400000
#define TM_TM2_TRANS_TRG_MSK 0x0000FFFF
#define TM_TM2_SELECT 0x00010000
#define TM_ENABLE 0x00000008
#define TM_TM2 0x00000100
#define TM_EST 0x00000080
#define TM_TURBO_EN_BIT 0x00000040
#define TM_TURBO_EN_MSK 0xFFFFFFBF
#define TM_TM1 0x20000000
#define TM_ACPI 0x00400000
/* ODCM - On-Demand Clock Modulation */
#define TM_ODCM_RES 0x0000 /* Duty Cycle Reserved */
#define TM_ODCM_06_25 0x0001 /* Extended Duty Cycle 06.25% */
#define TM_ODCM_12_50 0x0002 /* Duty Cycle 12.50% -default */
#define TM_ODCM_18_75 0x0003 /* Extended Duty Cycle 18.75% */
#define TM_ODCM_25_00 0x0004 /* Duty Cycle 25.00% */
#define TM_ODCM_31_25 0x0005 /* Extended Duty Cycle 31.25% */
#define TM_ODCM_37_50 0x0006 /* Duty Cycle 37.50% */
#define TM_ODCM_43_75 0x0007 /* Extended Duty Cycle 43.75% */
#define TM_ODCM_50_00 0x0008 /* Duty Cycle 50.00% */
#define TM_ODCM_56_25 0x0009 /* Extended Duty Cycle 56.25% */
#define TM_ODCM_63_50 0x000A /* Duty Cycle 63.50% */
#define TM_ODCM_69_75 0x000B /* Extended Duty Cycle 69.75% */
#define TM_ODCM_75_00 0x000C /* Duty Cycle 75.00% */
#define TM_ODCM_81_25 0x000D /* Extended Duty Cycle 81.25% */
#define TM_ODCM_87_50 0x000E /* Duty Cycle 87.50% */
#define TM_ODCM_93_75 0x000F /* Extended Duty Cycle 93.75% */
#define TM_ODCM_ENABLE 0x00000010
#define TM_ODCM_ENABLE_MSK 0xFFFFFFEF
#define TM_ODCM_MSK 0xFFFFFFF1
#define TM_ODCM_EXT_MSK 0xFFFFFFF0
#define TM_ODCM_DC_MSK1 0x0000000E
#define TM_ODCM_DC_MSK2 0xFFFFFFF1
#define TM_ODCM_DC_EXT_MSK1 0x0000000F
#define TM_ODCM_DC_EXT_MSK2 0xFFFFFFF0
/* IA32_THERM_STATUS Register */
#define TM_STATUS_REG_MSK 0xF87F0FFF
#define TM_STAT_READ_VALID 0x80000000
#define TM_STAT_RES_CELS_MSK 0x71000000
#define TM_STAT_RES_CELS_SHFT 0x19
#define TM_STAT_DIG_READ_MSK 0x007F0000
#define TM_STAT_DIG_READ_SHFT 0x10
#define TM_STAT_PLN_LOG 0x00000800
#define TM_STAT_PLN_LOG_MSK 0xFFFFF7FF
#define TM_STAT_PLN_STAT 0x00000400
#define TM_STAT_THRSH2_LOG 0x00000200
#define TM_STAT_THRSH2_LOG_MSK 0xFFFFFDFF
#define TM_STAT_THRSH2_STAT 0x00000100
#define TM_STAT_THRSH1_LOG 0x00000080
#define TM_STAT_THRSH1_LOG_MSK 0xFFFFFF7F
#define TM_STAT_THRSH1_STAT 0x00000040
#define TM_STAT_CTEMP_LOG 0x00000020
#define TM_STAT_CTEMP_LOG_MSK 0xFFFFFFDF
#define TM_STAT_CTEMP_STAT 0x00000010
#define TM_STAT_PF_LOG 0x00000008
#define TM_STAT_PF_LOG_MSK 0xFFFFFFF7
#define TM_STAT_PF_STAT 0x00000004
#define TM_STATUS_LOG 0x00000002
#define TM_STATUS_LOG_MSK 0xFFFFFFFD
#define TM_STATUS 0x00000001
/* IA32_THERM_INTERRUPT Register */
#define TM_INTERRUPT_REG_MSK 0x01FFFF1F
#define TM_INT_PLN_EN 0x01000000
#define TM_INT_PLN_EN_MSK 0xFEFFFFFF
#define TM_INT_THRSH2_EN 0x00800000
#define TM_INT_THRSH2_EN_MSK 0xFF7FFFFF
#define TM_INT_THRSH2_VAL_MSK1 0x007F0000
#define TM_INT_THRSH2_VAL_MSK2 0xFF80FFFF
#define TM_INT_THRSH2_VAL_SHFT 0x10
#define TM_INT_THRSH1_EN 0x00008000
#define TM_INT_THRSH1_EN_MSK 0xFFFF7FFF
#define TM_INT_THRSH1_VAL_MSK1 0x00007F00
#define TM_INT_THRSH1_VAL_MSK2 0xFFFF80FF
#define TM_INT_THRSH1_VAL_SHFT 0x08
#define TM_INT_OH_EN 0x00000010
#define TM_INT_OH_EN_MSK 0xFFFFFFEF
#define TM_INT_FORCEPR_EN 0x00000008
#define TM_INT_FORCEPR_EN_MSK 0xFFFFFFF7
#define TM_INT_PROCHOT_EN 0x00000004
#define TM_INT_PROCHOT_EN_MSK 0xFFFFFFFB
#define TM_INT_LTEMP_EN 0x00000002
#define TM_INT_LTEMP_EN_MSK 0xFFFFFFFD
#define TM_INT_HTEMP_EN 0x00000001
#define TM_INT_HTEMP_EN_MSK 0xFFFFFFFE
#ifdef _WRS_CONFIG_LP64
#define cpuPwrArchTMSup1_Offset 0x7C
#define cpuPwrArchTMSup2_Offset 0x80
#else
#define cpuPwrArchTMSup1_Offset 0x5C
#define cpuPwrArchTMSup2_Offset 0x60
#endif /* _WRS_CONFIG_LP64 */
/* thermal zone cooling policy */
#define CPU_PWR_ARCH_COOLING_NONE 0 /* let things cook until hardware limits */
#define CPU_PWR_ARCH_COOLING_ACTIVE 1 /* use fans etc */
#define CPU_PWR_ARCH_COOLING_PASSIVE 2 /* throttle cpu and device utilization */
#ifndef _ASMLANGUAGE
#include <base/b_cpuset_t.h>
#if defined (ACPI_PWR_CPU_ARCH_PROPAGATE_CPU_PERF_0)
/* default Performance options when table missing (based on Emerson) */
#define CPU_PWR_ARCH_DOMAIN_ID 0x00
#define CPU_PWR_ARCH_COOR_TYPE 0xFC
#define CPU_PWR_ARCH_NUM_CPUS_IN_DOMAIN 0x01
#define CPU_PWR_ARCH_NUM_PERF 13
#define CPU_PWR_ARCH_NUM_PERF_NOT_SUP 0
#define CPU_PWR_ARCH_NUM_P_STATES CPU_PWR_ARCH_NUM_PERF
#define CPU_PWR_ARCH_PERF_CONTROL 0x00000199
#define CPU_PWR_ARCH_PERF_STATUS 0x00000198
#define CPU_PWR_ARCH_PERF_DFLT_1_CORE_FREQ 2667
#define CPU_PWR_ARCH_PERF_DFLT_1_POWER 25000
#define CPU_PWR_ARCH_PERF_DFLT_1_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_1_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_1_CTRL_REG_VAL 0x0015
#define CPU_PWR_ARCH_PERF_DFLT_1_STAT_REG_VAL 0x0015
#define CPU_PWR_ARCH_PERF_DFLT_2_CORE_FREQ 2666
#define CPU_PWR_ARCH_PERF_DFLT_2_POWER 25000
#define CPU_PWR_ARCH_PERF_DFLT_2_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_2_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_2_CTRL_REG_VAL 0x0014
#define CPU_PWR_ARCH_PERF_DFLT_2_STAT_REG_VAL 0x0014
#define CPU_PWR_ARCH_PERF_DFLT_3_CORE_FREQ 2533
#define CPU_PWR_ARCH_PERF_DFLT_3_POWER 23465
#define CPU_PWR_ARCH_PERF_DFLT_3_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_3_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_3_CTRL_REG_VAL 0x0013
#define CPU_PWR_ARCH_PERF_DFLT_3_STAT_REG_VAL 0x0013
#define CPU_PWR_ARCH_PERF_DFLT_4_CORE_FREQ 2399
#define CPU_PWR_ARCH_PERF_DFLT_4_POWER 21982
#define CPU_PWR_ARCH_PERF_DFLT_4_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_4_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_4_CTRL_REG_VAL 0x0012
#define CPU_PWR_ARCH_PERF_DFLT_4_STAT_REG_VAL 0x0012
#define CPU_PWR_ARCH_PERF_DFLT_5_CORE_FREQ 2266
#define CPU_PWR_ARCH_PERF_DFLT_5_POWER 20527
#define CPU_PWR_ARCH_PERF_DFLT_5_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_5_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_5_CTRL_REG_VAL 0x0011
#define CPU_PWR_ARCH_PERF_DFLT_5_STAT_REG_VAL 0x0011
#define CPU_PWR_ARCH_PERF_DFLT_6_CORE_FREQ 2133
#define CPU_PWR_ARCH_PERF_DFLT_6_POWER 19080
#define CPU_PWR_ARCH_PERF_DFLT_6_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_6_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_6_CTRL_REG_VAL 0x0010
#define CPU_PWR_ARCH_PERF_DFLT_6_STAT_REG_VAL 0x0010
#define CPU_PWR_ARCH_PERF_DFLT_7_CORE_FREQ 1999
#define CPU_PWR_ARCH_PERF_DFLT_7_POWER 17681
#define CPU_PWR_ARCH_PERF_DFLT_7_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_7_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_7_CTRL_REG_VAL 0x000F
#define CPU_PWR_ARCH_PERF_DFLT_7_STAT_REG_VAL 0x000F
#define CPU_PWR_ARCH_PERF_DFLT_8_CORE_FREQ 1866
#define CPU_PWR_ARCH_PERF_DFLT_8_POWER 16310
#define CPU_PWR_ARCH_PERF_DFLT_8_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_8_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_8_CTRL_REG_VAL 0x000E
#define CPU_PWR_ARCH_PERF_DFLT_8_STAT_REG_VAL 0x000E
#define CPU_PWR_ARCH_PERF_DFLT_9_CORE_FREQ 1733
#define CPU_PWR_ARCH_PERF_DFLT_9_POWER 14966
#define CPU_PWR_ARCH_PERF_DFLT_9_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_9_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_9_CTRL_REG_VAL 0x000D
#define CPU_PWR_ARCH_PERF_DFLT_9_STAT_REG_VAL 0x000D
#define CPU_PWR_ARCH_PERF_DFLT_10_CORE_FREQ 1599
#define CPU_PWR_ARCH_PERF_DFLT_10_POWER 13665
#define CPU_PWR_ARCH_PERF_DFLT_10_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_10_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_10_CTRL_REG_VAL 0x000C
#define CPU_PWR_ARCH_PERF_DFLT_10_STAT_REG_VAL 0x000C
#define CPU_PWR_ARCH_PERF_DFLT_11_CORE_FREQ 1466
#define CPU_PWR_ARCH_PERF_DFLT_11_POWER 12375
#define CPU_PWR_ARCH_PERF_DFLT_11_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_11_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_11_CTRL_REG_VAL 0x000B
#define CPU_PWR_ARCH_PERF_DFLT_11_STAT_REG_VAL 0x000B
#define CPU_PWR_ARCH_PERF_DFLT_12_CORE_FREQ 1333
#define CPU_PWR_ARCH_PERF_DFLT_12_POWER 11112
#define CPU_PWR_ARCH_PERF_DFLT_12_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_12_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_12_CTRL_REG_VAL 0x000A
#define CPU_PWR_ARCH_PERF_DFLT_12_STAT_REG_VAL 0x000A
#define CPU_PWR_ARCH_PERF_DFLT_13_CORE_FREQ 1199
#define CPU_PWR_ARCH_PERF_DFLT_13_POWER 9877
#define CPU_PWR_ARCH_PERF_DFLT_13_TRANSITION 10
#define CPU_PWR_ARCH_PERF_DFLT_13_BUS_MASTER 10
#define CPU_PWR_ARCH_PERF_DFLT_13_CTRL_REG_VAL 0x0009
#define CPU_PWR_ARCH_PERF_DFLT_13_STAT_REG_VAL 0x0009
#endif /* ACPI_PWR_CPU_ARCH_PROPAGATE_CPU_PERF_0 */
#if defined (ACPI_PWR_CPU_ARCH_PROPAGATE_CPU_C_STATE)
/* default C-State options when table missing (based on Emerson) */
#define CPU_PWR_ARCH_C_STATE_DFLT_COUNT 0x3
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_1_ADDRESS 0x00000000
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_1_TYPE 0x01
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_1_LATENCY 0x03
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_1_POWER 0x3E8
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_2_ADDRESS 0x00000414
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_2_TYPE 0x02
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_2_LATENCY 0xCD
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_2_POWER 0x1F4
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_3_ADDRESS 0x00000415
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_3_TYPE 0x03
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_3_LATENCY 0xF5
#define CPU_PWR_ARCH_C_STATE_SUB_DFLT_3_POWER 0x15E
#endif /* ACPI_PWR_CPU_ARCH_PROPAGATE_CPU_C_STATE */
/*
* This structure defines an HPET descriptor table entries. See section
* 3.2.4 in the IA-PC HPET Specification for detailsi.
*/
typedef struct cpuPwrArchHpetStruct
{
UINT32 Id; /* Hardware Id of Event Timer Block */
UINT64 Address; /* Address of Event Timer Block */
UINT8 AddrSpaceId; /* 0 = System memory, 1 = System I/O */
UINT8 Sequence; /* HPET sequence number */
UINT16 MinimumTick; /* Main counter min tick, periodic mode */
UINT8 Flags; /* attribute specific */
UINT8 pad_1; /* padding for alignment */
UINT16 pad_2;
} CPU_PWR_ARCH_HPET;
/*
* This structure represents a defined thermal zone.
*/
typedef struct cpuPwrArchThermalZoneStruct
{
void *handle; /* HANDLE */
void *context; /* THERMAL_ZONE [0..n-1] */
UINT32 DomainId; /* domain number */
UINT32 activeCoolingThresh; /* active cooling threshold (degK/10) */
UINT32 criticalTrip; /* hardware shutdown trip (degK/10) */
UINT32 hotTemp; /* software shutdown trip (degK/10) */
UINT32 passiveTrip; /* software passive cool trip (degK/10) */
UINT32 currentTemp; /* current zone temperature (degK/10) */
UINT32 currentAccuracy; /* see ACPI spec 11.4.7 (_NTT) */
UINT32 coolingPolicy; /* thermal zone cooling policy */
} CPU_PWR_ARCH_THERMAL_ZONE;
/*
* This structure defines the supported performance states.
*/
typedef struct cpuPwrArchPerfStruct
{
UINT32 coreFreq; /* core frequency (MHZ) */
UINT32 power; /* max power consumption (mw) */
UINT32 transitionLatency; /* us */
UINT32 busMasterLatency; /* us */
UINT32 control; /* performance control register value */
UINT32 status; /* expected control status value */
} CPU_PWR_ARCH_PERFORMANCE;
/*
* This structure defines the supported throttling states.
*/
typedef struct cpuPwrArchThrottleStruct
{
UINT32 percentage; /* percentage of clock rate (1%..100%) */
UINT32 power; /* power consumption (mw) */
UINT32 transitionLatency; /* us */
UINT32 control; /* throttle control register value */
UINT32 status; /* expected control status value */
} CPU_PWR_ARCH_THROTTLE;
/*
* This structure defines declare the supported processor power
* states (C States).
*/
typedef struct cpuPwrArchCStateSubStruct
{
UINT64 address; /* address of reg to read to set C State */
UINT32 type; /* C State type (1=C1, 2=C2 3=C3, etc.) */
UINT32 latency; /* worst case latency, in microseconds */
UINT32 power; /* average power consumption milliwatts */
} CPU_PWR_ARCH_C_STATE_SUB;
typedef struct cpuPwrArchCStateStruct
{
UINT32 count; /* number of C State sub-packages */
CPU_PWR_ARCH_C_STATE_SUB *pCStateSub; /* pointer to C State record */
} CPU_PWR_ARCH_C_STATE;
/*
* This structure holds information reported by Power and Thermal
* Management for one CPU.
*/
typedef struct cpuPwrArchStruct
{
void *handle; /* HANDLE */
void *context; /* CPU [0..n-1] */
UINT32 procId; /* not necessarilly 0..n-1 */
UINT32 coordType; /* see P-state dependency definitions */
UINT32 cpuPState; /* current cpu P-state (0..numPerfSup)*/
UINT32 DomainId; /* dependency domain number (see _PSD) */
UINT32 numCpusInDomain; /* number of CPUs in domain */
UINT32 numThrottle; /* number of throttle states defined */
UINT32 numThrottleNotSup; /* number of T-states not supported */
UINT32 numPerf; /* number of performance states defined */
UINT32 numPerfNotSup; /* number of P-states not supported */
UINT32 numPstates; /* number of supported P-states */
UINT32 *pThControl; /* throttle control register address */
UINT32 *pThStatus; /* throttle status address */
UINT32 *pPerfControl; /* peformance control register address */
UINT32 *pPerfStatus; /* performance status address */
CPU_PWR_ARCH_THROTTLE *pThrottle; /* pointer to throttle record */
CPU_PWR_ARCH_PERFORMANCE *pPerf; /* pointer to performance record */
char nodeName[5]; /* CPU name */
char fill[3];
UINT32 cpuPwrArchPMSup1; /* Power Management capabilities */
UINT32 cpuPwrArchPMSup2; /* Power Management capabilities */
UINT32 cpuPwrArchPMIntThrsh; /* Power Management capabilities */
UINT32 cpuPwrArchTMSup1; /* Thermal Management capabilities */
UINT32 cpuPwrArchTMSup2; /* Thermal Management capabilities */
CPU_PWR_ARCH_C_STATE cpuCState; /* optional variable C State record */
cpuset_t pStates; /* bit map of supported P States for cpu */
cpuset_t tStates; /* bit map of supported T States for cpu */
cpuset_t cStates; /* bit map of supported C States for cpu */
} CPU_PWR_ARCH;
/*
* This structure represents information that describes the target board.
*/
typedef struct cpuPwrArchBoardStruct
{
UINT32 cpuPwrArchNumCpus;
CPU_PWR_ARCH *pCpuPwrArch;
UINT32 cpuPwrArchValHpet;
CPU_PWR_ARCH_HPET *pHpet;
UINT32 cpuPwrArchNumThermZones;
CPU_PWR_ARCH_THERMAL_ZONE *pThermalZone;
} CPU_PWR_ARCH_BOARD_INFO;
IMPORT CPU_PWR_ARCH_BOARD_INFO sysCpuPwrArchBoardInfo, *pSysCpuPwrArchBoardInfo;
/* function declarations */
#if defined (__STDC__) || defined (__cplusplus)
IMPORT CPU_PWR_ARCH * cpuPwrArchGetCpuInfo (int cpuIndex);
IMPORT cpuset_t cpuPwrArchPStates (int cpuIndex);
IMPORT cpuset_t cpuPwrArchTStates (int cpuIndex);
IMPORT cpuset_t cpuPwrArchCStates (int cpuIndex);
IMPORT UINT32 cpuPwrArchPStateGetByCpu (int cpuIndex);
IMPORT void cpuPwrArchCStateSet (UINT8 cStateHint);
#if ((CPU_FAMILY==I80X86) && (CPU != PENTIUM))
IMPORT STATUS cpuPwrArchTurboSet (void);
IMPORT STATUS cpuPwrArchTurboUnSet (void);
#endif /* (CPU_FAMILY==I80X86) && (CPU != PENTIUM) */
IMPORT void cpuPwrArchGetCapabilities (CPU_PWR_ARCH *pCpu);
IMPORT STATUS cpuPwrArchShowCapabilities (void);
IMPORT STATUS cpuPwrArchBoardShow (void);
#ifdef _WRS_CONFIG_LP64
IMPORT void cpuPwrArchMperfGet (long *pData);
IMPORT void cpuPwrArchMperfSet (long *pData);
IMPORT void cpuPwrArchAperfGet (long *pData);
IMPORT void cpuPwrArchAperfSet (long *pData);
IMPORT BOOL cpuPwrArchOPP (void);
IMPORT void cpuPwrArchOPPEnable (void);
IMPORT void cpuPwrArchOPPDisable (void);
IMPORT UINT8 cpuPwrArchPEBHGet (void);
IMPORT void cpuPwrArchPEBHSet (UINT8 pebHint);
#else
IMPORT void cpuPwrArchMperfGet (long long int *pData);
IMPORT void cpuPwrArchMperfSet (long long int *pData);
IMPORT void cpuPwrArchAperfGet (long long int *pData);
IMPORT void cpuPwrArchAperfSet (long long int *pData);
#endif /* _WRS_CONFIG_LP64 */
IMPORT BOOL cpuPwrArchODCM (void);
IMPORT void cpuPwrArchODCM_Enable (void);
IMPORT void cpuPwrArchODCM_Disable (void);
IMPORT UINT8 cpuPwrArchODCM_DCGet (void);
IMPORT void cpuPwrArchODCM_DCSet (UINT8 dutyCycle);
IMPORT UINT8 cpuPwrArchODCM_DCExtGet (void);
IMPORT void cpuPwrArchODCM_DCExtSet (UINT8 dutyCycle);
#ifdef _WRS_CONFIG_LP64
IMPORT void cpuPwrArchTM_StatRegGet (long *pData);
IMPORT void cpuPwrArchTM_StatRegSet (long *pData);
#else
IMPORT void cpuPwrArchTM_StatRegGet (long long int *pData);
IMPORT void cpuPwrArchTM_StatRegSet (long long int *pData);
#endif /* _WRS_CONFIG_LP64 */
IMPORT BOOL cpuPwrArchTM_Status (void);
IMPORT BOOL cpuPwrArchTM_StatLog (void);
IMPORT void cpuPwrArchTM_StatLogClr (void);
IMPORT BOOL cpuPwrArchTM_PFEvent (void);
IMPORT BOOL cpuPwrArchTM_PFEventLog (void);
IMPORT void cpuPwrArchTM_PFEventLogClr (void);
IMPORT BOOL cpuPwrArchTM_CTempStat (void);
IMPORT BOOL cpuPwrArchTM_CTempLog (void);
IMPORT void cpuPwrArchTM_CTempLogClr (void);
IMPORT BOOL cpuPwrArchTM_Thrsh1Stat (void);
IMPORT BOOL cpuPwrArchTM_Thrsh1Log (void);
IMPORT void cpuPwrArchTM_Thrsh1LogClr (void);
IMPORT BOOL cpuPwrArchTM_Thrsh2Stat (void);
IMPORT BOOL cpuPwrArchTM_Thrsh2Log (void);
IMPORT void cpuPwrArchTM_Thrsh2LogClr (void);
IMPORT BOOL cpuPwrArchTM_PLNStat (void);
IMPORT BOOL cpuPwrArchTM_PLNLog (void);
IMPORT void cpuPwrArchTM_PLNLogClr (void);
IMPORT UINT8 cpuPwrArchTM_DigReadOut (void);
IMPORT UINT8 cpuPwrArchTM_ResCelsius (void);
IMPORT BOOL cpuPwrArchTM_DigReadOutValid (void);
#ifdef _WRS_CONFIG_LP64
IMPORT void cpuPwrArchTM_pkgStatRegGet (long *pData);
IMPORT void cpuPwrArchTM_pkgStatRegSet (long *pData);
#else
IMPORT void cpuPwrArchTM_pkgStatRegGet (long long int *pData);
IMPORT void cpuPwrArchTM_pkgStatRegSet (long long int *pData);
#endif /* _WRS_CONFIG_LP64 */
IMPORT BOOL cpuPwrArchTM_pkgStatus (void);
IMPORT BOOL cpuPwrArchTM_pkgStatLog (void);
IMPORT void cpuPwrArchTM_pkgStatLogClr (void);
IMPORT BOOL cpuPwrArchTM_pkgPFEvent (void);
IMPORT BOOL cpuPwrArchTM_pkgPFEventLog (void);
IMPORT void cpuPwrArchTM_pkgPFEventLogClr (void);
IMPORT BOOL cpuPwrArchTM_pkgCTempStat (void);
IMPORT BOOL cpuPwrArchTM_pkgCTempLog (void);
IMPORT void cpuPwrArchTM_pkgCTempLogClr (void);
IMPORT BOOL cpuPwrArchTM_pkgThrsh1Stat (void);
IMPORT BOOL cpuPwrArchTM_pkgThrsh1Log (void);
IMPORT void cpuPwrArchTM_pkgThrsh1LogClr (void);
IMPORT BOOL cpuPwrArchTM_pkgThrsh2Stat (void);
IMPORT BOOL cpuPwrArchTM_pkgThrsh2Log (void);
IMPORT void cpuPwrArchTM_pkgThrsh2LogClr (void);
IMPORT BOOL cpuPwrArchTM_pkgPLNStat (void);
IMPORT BOOL cpuPwrArchTM_pkgPLNLog (void);
IMPORT void cpuPwrArchTM_pkgPLNLogClr (void);
IMPORT UINT8 cpuPwrArchTM_pkgDigReadOut (void);
#ifdef _WRS_CONFIG_LP64
IMPORT void cpuPwrArchTM_intRegGet (long *pData);
IMPORT void cpuPwrArchTM_intRegSet (long *pData);
#else
IMPORT void cpuPwrArchTM_intRegGet (long long int *pData);
IMPORT void cpuPwrArchTM_intRegSet (long long int *pData);
#endif /* _WRS_CONFIG_LP64 */
IMPORT BOOL cpuPwrArchTM_intHT (void);
IMPORT void cpuPwrArchTM_intHTEn (void);
IMPORT void cpuPwrArchTM_intHTDis (void);
IMPORT BOOL cpuPwrArchTM_intLT (void);
IMPORT void cpuPwrArchTM_intLTEn (void);
IMPORT void cpuPwrArchTM_intLTDis (void);
IMPORT BOOL cpuPwrArchTM_intPROCHOT (void);
IMPORT void cpuPwrArchTM_intPROCHOTEn (void);
IMPORT void cpuPwrArchTM_intPROCHOTDis (void);
IMPORT BOOL cpuPwrArchTM_intFORCEPR (void);
IMPORT void cpuPwrArchTM_intFORCEPREn (void);
IMPORT void cpuPwrArchTM_intFORCEPRDis (void);
IMPORT BOOL cpuPwrArchTM_intOHeat (void);
IMPORT void cpuPwrArchTM_intOHeatEn (void);
IMPORT void cpuPwrArchTM_intOHeatDis (void);
IMPORT UINT8 cpuPwrArchTM_intThrsh1Get (void);
IMPORT void cpuPwrArchTM_intThrsh1Set (UINT8 thrsh1Val);
IMPORT BOOL cpuPwrArchTM_intThrsh1 (void);
IMPORT void cpuPwrArchTM_intThrsh1En (void);
IMPORT void cpuPwrArchTM_intThrsh1Dis (void);
IMPORT UINT8 cpuPwrArchTM_intThrsh2Get (void);
IMPORT void cpuPwrArchTM_intThrsh2Set (UINT8 thrsh2Val);
IMPORT BOOL cpuPwrArchTM_intThrsh2 (void);
IMPORT void cpuPwrArchTM_intThrsh2En (void);
IMPORT void cpuPwrArchTM_intThrsh2Dis (void);
IMPORT BOOL cpuPwrArchTM_intPLN (void);
IMPORT void cpuPwrArchTM_intPLNEn (void);
IMPORT void cpuPwrArchTM_intPLNDis (void);
#ifdef _WRS_CONFIG_LP64
IMPORT void cpuPwrArchTM_pkgIntRegGet (long *pData);
IMPORT void cpuPwrArchTM_pkgIntRegSet (long *pData);
#else
IMPORT void cpuPwrArchTM_pkgIntRegGet (long long int *pData);
IMPORT void cpuPwrArchTM_pkgIntRegSet (long long int *pData);
#endif /* _WRS_CONFIG_LP64 */
IMPORT BOOL cpuPwrArchTM_pkgIntHT (void);
IMPORT void cpuPwrArchTM_pkgIntHTEn (void);
IMPORT void cpuPwrArchTM_pkgIntHTDis (void);
IMPORT BOOL cpuPwrArchTM_pkgIntLT (void);
IMPORT void cpuPwrArchTM_pkgIntLTEn (void);
IMPORT void cpuPwrArchTM_pkgIntLTDis (void);
IMPORT BOOL cpuPwrArchTM_pkgIntPROCHOT (void);
IMPORT void cpuPwrArchTM_pkgIntPROCHOTEn (void);
IMPORT void cpuPwrArchTM_pkgIntPROCHOTDis (void);
IMPORT BOOL cpuPwrArchTM_pkgIntFORCEPR (void);
IMPORT void cpuPwrArchTM_pkgIntFORCEPREn (void);
IMPORT void cpuPwrArchTM_pkgIntFORCEPRDis (void);
IMPORT BOOL cpuPwrArchTM_pkgIntOHeat (void);
IMPORT void cpuPwrArchTM_pkgIntOHeatEn (void);
IMPORT void cpuPwrArchTM_pkgIntOHeatDis (void);
IMPORT UINT8 cpuPwrArchTM_pkgIntThrsh1Get (void);
IMPORT void cpuPwrArchTM_pkgIntThrsh1Set (UINT8 thrsh1Val);
IMPORT BOOL cpuPwrArchTM_pkgIntThrsh1 (void);
IMPORT void cpuPwrArchTM_pkgIntThrsh1En (void);
IMPORT void cpuPwrArchTM_pkgIntThrsh1Dis (void);
IMPORT UINT8 cpuPwrArchTM_pkgIntThrsh2Get (void);
IMPORT void cpuPwrArchTM_pkgIntThrsh2Set (UINT8 thrsh2Val);
IMPORT BOOL cpuPwrArchTM_pkgIntThrsh2 (void);
IMPORT void cpuPwrArchTM_pkgIntThrsh2En (void);
IMPORT void cpuPwrArchTM_pkgIntThrsh2Dis (void);
IMPORT BOOL cpuPwrArchTM_pkgIntPLN (void);
IMPORT void cpuPwrArchTM_pkgIntPLNEn (void);
IMPORT void cpuPwrArchTM_pkgIntPLNDis (void);
IMPORT BOOL cpuPwrArchODCM (void);
IMPORT void cpuPwrArchODCM_Enable (void);
IMPORT void cpuPwrArchODCM_Disable (void);
IMPORT UINT8 cpuPwrArchODCM_DCGet (void);
IMPORT void cpuPwrArchODCM_DCSet (UINT8 dutyCycle);
IMPORT UINT8 cpuPwrArchODCM_DCExtGet (void);
IMPORT void cpuPwrArchODCM_DCExtSet (UINT8 dutyCycle);
#else
IMPORT STATUS cpuPwrArchLibInit ();
IMPORT STATUS cpuPwrArchEnable ();
IMPORT STATUS cpuPwrArchDisable ();
IMPORT CPU_PWR_ARCH * cpuPwrArchGetCpuInfo ();
IMPORT UINT32 cpuPwrArchPStateSet ();
IMPORT UINT32 cpuPwrArchPStateGet ();
IMPORT cpuset_t cpuPwrArchPStates ();
IMPORT cpuset_t cpuPwrArchTStates ();
IMPORT cpuset_t cpuPwrArchCStates ();
IMPORT void vxC1StateSet ();
IMPORT void cpuPwrArchCStateSet ();
#if ((CPU_FAMILY==I80X86) && (CPU != PENTIUM))
IMPORT STATUS cpuPwrArchTurboSet ();
IMPORT STATUS cpuPwrArchTurboUnSet ();
#endif /* (CPU_FAMILY==I80X86) && (CPU != PENTIUM) */
IMPORT void cpuPwrArchGetCapabilities ();
IMPORT STATUS cpuPwrArchShowCapabilities ();
IMPORT STATUS cpuPwrArchBoardShow ();
IMPORT void cpuPwrArchMperfGet ();
IMPORT void cpuPwrArchMperfSet ();
IMPORT void cpuPwrArchAperfGet ();
IMPORT void cpuPwrArchAperfSet ();
#ifdef _WRS_CONFIG_LP64
IMPORT BOOL cpuPwrArchOPP ();
IMPORT void cpuPwrArchOPPEnable ();
IMPORT void cpuPwrArchOPPDisable ();
IMPORT UINT8 cpuPwrArchPEBHGet ();
IMPORT void cpuPwrArchPEBHSet ();
#endif /* _WRS_CONFIG_LP64 */
IMPORT BOOL cpuPwrArchODCM ();
IMPORT void cpuPwrArchODCM_Enable ();
IMPORT void cpuPwrArchODCM_Disable ();
IMPORT UINT8 cpuPwrArchODCM_DCGet ();
IMPORT void cpuPwrArchODCM_DCSet ();
IMPORT UINT8 cpuPwrArchODCM_DCExtGet ();
IMPORT void cpuPwrArchODCM_DCExtSet ();
/* IA32 Thermal Status Register */
IMPORT void cpuPwrArchTM_StatRegGet ();
IMPORT void cpuPwrArchTM_StatRegSet ();
IMPORT BOOL cpuPwrArchTM_Status ();
IMPORT BOOL cpuPwrArchTM_StatLog ();
IMPORT void cpuPwrArchTM_StatLogClr ();
IMPORT BOOL cpuPwrArchTM_PFEvent ();
IMPORT BOOL cpuPwrArchTM_PFEventLog ();
IMPORT void cpuPwrArchTM_PFEventLogClr ();
IMPORT BOOL cpuPwrArchTM_CTempStat ();
IMPORT BOOL cpuPwrArchTM_CTempLog ();
IMPORT void cpuPwrArchTM_CTempLogClr ();
IMPORT BOOL cpuPwrArchTM_Thrsh1Stat ();
IMPORT BOOL cpuPwrArchTM_Thrsh1Log ();
IMPORT void cpuPwrArchTM_Thrsh1LogClr ();
IMPORT BOOL cpuPwrArchTM_Thrsh2Stat ();
IMPORT BOOL cpuPwrArchTM_Thrsh2Log ();
IMPORT void cpuPwrArchTM_Thrsh2LogClr ();
IMPORT BOOL cpuPwrArchTM_PLNStat ();
IMPORT BOOL cpuPwrArchTM_PLNLog ();
IMPORT void cpuPwrArchTM_PLNLogClr ();
IMPORT UINT8 cpuPwrArchTM_DigReadOut ();
IMPORT UINT8 cpuPwrArchTM_ResCelsius ();
IMPORT BOOL cpuPwrArchTM_DigReadOutValid ();
/* IA32 Package Thermal Status Register */
IMPORT void cpuPwrArchTM_pkgStatRegGet ();
IMPORT void cpuPwrArchTM_pkgStatRegSet ();
IMPORT BOOL cpuPwrArchTM_pkgStatus ();
IMPORT BOOL cpuPwrArchTM_pkgStatLog ();
IMPORT void cpuPwrArchTM_pkgStatLogClr ();
IMPORT BOOL cpuPwrArchTM_pkgPFEvent ();
IMPORT BOOL cpuPwrArchTM_pkgPFEventLog ();
IMPORT void cpuPwrArchTM_pkgPFEventLogClr ();
IMPORT BOOL cpuPwrArchTM_pkgCTempStat ();
IMPORT BOOL cpuPwrArchTM_pkgCTempLog ();
IMPORT void cpuPwrArchTM_pkgCTempLogClr ();
IMPORT BOOL cpuPwrArchTM_pkgThrsh1Stat ();
IMPORT BOOL cpuPwrArchTM_pkgThrsh1Log ();
IMPORT void cpuPwrArchTM_pkgThrsh1LogClr ();
IMPORT BOOL cpuPwrArchTM_pkgThrsh2Stat ();
IMPORT BOOL cpuPwrArchTM_pkgThrsh2Log ();
IMPORT void cpuPwrArchTM_pkgThrsh2LogClr ();
IMPORT BOOL cpuPwrArchTM_pkgPLNStat ();
IMPORT BOOL cpuPwrArchTM_pkgPLNLog ();
IMPORT void cpuPwrArchTM_pkgPLNLogClr ();
IMPORT UINT8 cpuPwrArchTM_pkgDigReadOut ();
/* IA32 Thermal Interrupt Register */
IMPORT void cpuPwrArchTM_intRegGet ();
IMPORT void cpuPwrArchTM_intRegSet ();
IMPORT BOOL cpuPwrArchTM_intHT ();
IMPORT void cpuPwrArchTM_intHTEn ();
IMPORT void cpuPwrArchTM_intHTDis ();
IMPORT BOOL cpuPwrArchTM_intLT ();
IMPORT void cpuPwrArchTM_intLTEn ();
IMPORT void cpuPwrArchTM_intLTDis ();
IMPORT BOOL cpuPwrArchTM_intPROCHOT ();
IMPORT void cpuPwrArchTM_intPROCHOTEn ();
IMPORT void cpuPwrArchTM_intPROCHOTtDis ();
IMPORT BOOL cpuPwrArchTM_intFORCEPR ();
IMPORT void cpuPwrArchTM_intFORCEPREn ();
IMPORT void cpuPwrArchTM_intFORCEPRDis ();
IMPORT BOOL cpuPwrArchTM_intOHeat ();
IMPORT void cpuPwrArchTM_intOHeatEn ();
IMPORT void cpuPwrArchTM_intOHeatDis ();
IMPORT UINT8 cpuPwrArchTM_intThrsh1Get ();
IMPORT void cpuPwrArchTM_intThrsh1Set ();
IMPORT BOOL cpuPwrArchTM_intThrsh1 ();
IMPORT void cpuPwrArchTM_intThrsh1En ();
IMPORT void cpuPwrArchTM_intThrsh1Dis ();
IMPORT UINT8 cpuPwrArchTM_intThrsh2Get ();
IMPORT void cpuPwrArchTM_intThrsh2Set ();
IMPORT BOOL cpuPwrArchTM_intThrsh2 ();
IMPORT void cpuPwrArchTM_intThrsh2En ();
IMPORT void cpuPwrArchTM_intThrsh2Dis ();
IMPORT BOOL cpuPwrArchTM_intPLN ();
IMPORT void cpuPwrArchTM_intPLNEn ();
IMPORT void cpuPwrArchTM_intPLNDis ();
/* IA32 Package Thermal Interrupt Register */
IMPORT void cpuPwrArchTM_pkgIntRegGet ();
IMPORT void cpuPwrArchTM_pkgIntRegSet ();
IMPORT BOOL cpuPwrArchTM_pkgIntHT ();
IMPORT void cpuPwrArchTM_pkgIntHTEn ();
IMPORT void cpuPwrArchTM_pkgIntHTDis ();
IMPORT BOOL cpuPwrArchTM_pkgIntLT ();
IMPORT void cpuPwrArchTM_pkgIntLTEn ();
IMPORT void cpuPwrArchTM_pkgIntLTDis ();
IMPORT BOOL cpuPwrArchTM_pkgIntPROCHOT ();
IMPORT void cpuPwrArchTM_pkgIntPROCHOTEn ();
IMPORT void cpuPwrArchTM_pkgIntPROCHOTDis ();
IMPORT BOOL cpuPwrArchTM_pkgIntFORCEPR ();
IMPORT void cpuPwrArchTM_pkgIntFORCEPREn ();
IMPORT void cpuPwrArchTM_pkgIntFORCEPRDis ();
IMPORT BOOL cpuPwrArchTM_pkgIntOHeat ();
IMPORT void cpuPwrArchTM_pkgIntOHeatEn ();
IMPORT void cpuPwrArchTM_pkgIntOHeatDis ();
IMPORT UINT8 cpuPwrArchTM_pkgIntThrsh1Get ();
IMPORT void cpuPwrArchTM_pkgIntThrsh1Set ();
IMPORT BOOL cpuPwrArchTM_pkgIntThrsh1 ();
IMPORT void cpuPwrArchTM_pkgIntThrsh1En ();
IMPORT void cpuPwrArchTM_pkgIntThrsh1Dis ();
IMPORT UINT8 cpuPwrArchTM_pkgIntThrsh2Get ();
IMPORT void cpuPwrArchTM_pkgIntThrsh2Set ();
IMPORT BOOL cpuPwrArchTM_pkgIntThrsh2 ();
IMPORT void cpuPwrArchTM_pkgIntThrsh2En ();
IMPORT void cpuPwrArchTM_pkgIntThrsh2Dis ();
IMPORT BOOL cpuPwrArchTM_pkgIntPLN ();
IMPORT void cpuPwrArchTM_pkgIntPLNEn ();
IMPORT void cpuPwrArchTM_pkgIntPLNDis ();
#endif /* __STDC__ || __cplusplus */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCcpuPwrArchI86Libh */
+155
View File
@@ -0,0 +1,155 @@
/* dbgI86Lib.h - header file for arch dependent portion of debugger */
/*
* Copyright (c) 1991,1993,1997-1998,2002-2005,2009-2010,2012,2016
* Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01v,20may16,jmp Imported from vxWorks 7 for WB4 debug support:
Added 8 bytes hardware breakpoint support (US11680).
Added VXDBG_HAS_HW_BP_SUPPORT_CHECK as VxDBG provides support
to dynamically detect if HW BP support is enabled on this
architecture (US39045).
01u,16oct12,scm WIND00376020 - fast system call support...
01t,22oct10,jmp Removed obsolete DSM() macro - Replaced by VXDBG_INSTR_CMP().
01s,29jul10,pad Moved extern C statement after include statements.
01r,19jun09,mze replacing PAD64
01q,20mar09,jmp removed DBG_INST_ALIGN definition (Use the default one).
01p,10feb09,jb Adding 64-bit Support
01p,31mar09,dbt Disable hardware breakpoint support for Hypervisor
Guest OS (CQ:WIND00161733).
01o,16feb05,aeg changed wdbDbgCtxXXX() prototypes (SPR #106381).
01n,14oct04,elg Rename wdbDbgCtxXXX() in wdbCtxXXX().
01m,01sep04,elg Define context load/save for WDB.
01l,19aug04,jb Fix for SPRs 100660, 100729, and 100748
01k,25jun04,elg Undefine WDB_CTX_LOAD() to use standard definition
(SPR #98730).
01j,27apr04,jmp adapted to share trcArchLib between VxSim/i86 and i86 arches.
01i,02mar04,jb Adding StepOverSyscall support
01h,17jul03,c_c Fixed build.
01g,16sep02,pai Updated with commonly used manifest constants.
01f,30may02,hdn added WDB_CTX_LOAD() define (spr 75694)
01e,11mar98,dbt corrected problems introduced by the SENS merge
added Copyright.
01d,13feb98,hdn fixed BRK_DATAxx macros.
01d,30dec97,dbt modified and added some defines for new breakpoint scheme.
01c,29nov93,hdn added a definition EDI - EFLAGS.
01b,27aug93,hdn added support for c++
01a,11sep91,hdn written based on TRON version.
*/
#ifndef __INCI86dbgh
#define __INCI86dbgh
#ifdef _WRS_CONFIG_LP64
#include "arch/i86/x86_64/dbgX86_64Lib.h"
#else
/* includes */
#include "arch/i86/esfI86.h"
#include "arch/i86/regsI86.h"
#include "arch/i86/instrI86.h"
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#define BRK_INST (0x00) /* instruction hardware breakpoint */
#define BRK_DATAW1 (0x01) /* data write 1 byte breakpoint */
#define BRK_DATAW2 (0x05) /* data write 2 byte breakpoint */
#define BRK_DATAW4 (0x0d) /* data write 4 byte breakpoint */
#define BRK_DATAW8 (0x09) /* data write 8 byte breakpoint */
#define BRK_DATARW1 (0x03) /* data read-write 1 byte breakpoint */
#define BRK_DATARW2 (0x07) /* data read-write 2 byte breakpoint */
#define BRK_DATARW4 (0x0f) /* data read-write 4 byte breakpoint */
#define BRK_DATARW8 (0x0b) /* data read-write 8 byte breakpoint */
#define DEFAULT_HW_BP (BRK_DATARW1) /* default hardware breakpoint */
#define BRK_HARDWARE (0x10) /* hardware breakpoint bit */
#define BRK_HARDMASK (0x0f) /* hardware breakpoint mask */
#define SAVED_DBGREGS (0x18) /* 6 debug registers */
#define SAVED_REGS (0x38) /* 8 + 6 registers */
#define TRACE_FLAG (0x0100) /* TF in EFLAGS */
#define INT_FLAG (0x0200) /* IF in EFLAGS */
#define DBG_HARDWARE_BP 1 /* hardware breakpoint support */
#define VXDBG_HAS_HW_BP_SUPPORT_CHECK 1
/* VxDBG provides HW BP support detection */
#ifndef _ASMLANGUAGE
#define DBG_BREAK_INST (0xcc) /* int 3 */
#if (CPU != PENTIUM)
#define DBG_SYSCALL_SIZE 2
#define DBG_SYSCALL_INST 0x5a5d340f
#define DBG_SYSCALL_INST_MASK 0xffffffff
#else
#define DBG_SYSCALL_SIZE 7
#define DBG_SYSCALL_INST 0x0000009A
#endif /* (CPU != PENTIUM) */
/* offsets to register fields in type REG_SET */
#define EDI (0)
#define ESI (1)
#define EBP (2)
#define ESP (3)
#define EBX (4)
#define EDX (5)
#define ECX (6)
#define EAX (7)
#define EFLAGS (8)
/* context save/load for WDB */
#define WDB_CTX_SAVE(pRegs) (_wdbCtxSave (pRegs))
#define WDB_CTX_LOAD(pRegs) (_wdbCtxLoad (pRegs))
/* typedefs */
/* aliases for type <ESF0> */
typedef ESF0 BREAK_ESF;
typedef ESF0 TRACE_ESF;
/* hardware breakpoint registers */
typedef struct /* DBG_REGS */
{
unsigned int db0; /* debug register 0 */
unsigned int db1; /* debug register 1 */
unsigned int db2; /* debug register 2 */
unsigned int db3; /* debug register 3 */
unsigned int db6; /* debug register 6 */
unsigned int db7; /* debug register 7 */
} DBG_REGS;
/* function declarations */
extern void _wdbCtxLoad (const REG_SET *);
extern int _wdbCtxSave (const REG_SET *);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _WRS_CONFIG_LP64 */
#endif /* __INCI86dbgh */
+357
View File
@@ -0,0 +1,357 @@
/* dbgStrLib.h - Debug Store mechanism definitions header file */
/* Copyright 2001-2002, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01b,29apr10,pad Moved extern C statement after include statements.
01a,23jul01,hdn written
*/
#ifndef __INCdbgStrLibh
#define __INCdbgStrLibh
#include "arch/i86/regsP7.h"
#ifdef __cplusplus
extern "C" {
#endif
/* DS buffer : BTS/PEBS minimum/default/threshold size */
#define BTS_NBYTES_MIN 0x1000 /* 4KB minimum BTS buffer */
#define BTS_NBYTES_DEF 0x4000 /* 16KB default BTS buffer */
#define BTS_NBYTES_OFF 0x200 /* .5KB (max - threshold) BTS */
#define PEBS_NBYTES_MIN 0x1000 /* 4KB minimum PEBS buffer */
#define PEBS_NBYTES_DEF 0x4000 /* 16KB default PEBS buffer */
#define PEBS_NBYTES_OFF 0x200 /* .5KB (max - threshold) PEBS */
#define PEBS_DEF_RESET -1LL /* default reset counter value */
/* BTS : record bit */
#define BTS_PREDICTED 0x00000010 /* bit4: Branch Predicted */
/* PEBS : events */
#define PEBS_FRONT_END 0x01
#define PEBS_EXECUTION 0x02
#define PEBS_REPLAY 0x03
/* PEBS : metrics (Front End Event) */
#define PEBS_MEMORY_LOADS 0x01
#define PEBS_MEMORY_STORES 0x02
/* PEBS : metrics (Execution Event) */
#define PEBS_PACKED_SP 0x03
#define PEBS_PACKED_DP 0x04
#define PEBS_SCALAR_SP 0x05
#define PEBS_SCALAR_DP 0x06
#define PEBS_128BIT_MMX 0x07
#define PEBS_64BIT_MMX 0x08
#define PEBS_X87_FP 0x09
#define PEBS_X87_SIMD_MOVES 0x0a
/* PEBS : metrics (Replay Event) */
#define PEBS_1STL_CACHE_LOAD_MISS 0x0b
#define PEBS_2NDL_CACHE_LOAD_MISS 0x0c
#define PEBS_DTLB_LOAD_MISS 0x0d
#define PEBS_DTLB_STORE_MISS 0x0e
#define PEBS_DTLB_ALL_MISS 0x0f
#define PEBS_MOB_LOAD_REPLAY 0x10
#define PEBS_SPLIT_LOAD 0x11
#define PEBS_SPLIT_STORE 0x12
/* PEBS : ESCR, CCCR definitions (Front End Event) */
#define ESCR_FRONT_END \
(((0x08 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
ESCR_TAG_ENABLE)
#define CCCR_FRONT_END \
(((0x05 << DS_SHIFT_13) & CCCR_ESCR_SELECT) | \
CCCR_RSVD)
#define ESCR_MEMORY_LOADS \
(((0x02 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
ESCR_TAG_ENABLE)
#define ESCR_MEMORY_STORES \
(((0x02 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_2 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
ESCR_TAG_ENABLE)
/* PEBS : ESCR, CCCR definitions (Execution Event) */
#define ESCR_EXECUTION \
(((0x0c << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_0 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define CCCR_EXECUTION \
(((0x05 << DS_SHIFT_13) & CCCR_ESCR_SELECT) | \
CCCR_RSVD)
#define ESCR_PACKED_SP \
(((0x08 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_PACKED_DP \
(((0x0c << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_SCALAR_SP \
(((0x0a << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_SCALAR_DP \
(((0x0e << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_64BIT_MMX \
(((0x02 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_128BIT_MMX \
(((0x1a << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_X87_FP \
(((0x04 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_15 << DS_SHIFT_9) & ESCR_EVENT_MASK) |\
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define ESCR_X87_SIMD_MOVES \
(((0x2e << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
(((DS_BIT_3 | DS_BIT_4) << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
/* PEBS : ESCR, CCCR definitions (Replay Event) */
#define ESCR_REPLAY \
(((0x09 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_0 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
((DS_BIT_0 << DS_SHIFT_5) & ESCR_TAG_VALUE) | \
ESCR_TAG_ENABLE)
#define CCCR_REPLAY \
(((0x05 << DS_SHIFT_13) & CCCR_ESCR_SELECT) | \
CCCR_RSVD)
#define ESCR_MOB_LOAD_REPLAY \
(((0x03 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
(((DS_BIT_4 | DS_BIT_5) << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
ESCR_TAG_ENABLE)
#define ESCR_SPLIT_LOAD \
(((0x04 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
ESCR_TAG_ENABLE)
#define ESCR_SPLIT_STORE \
(((0x05 << DS_SHIFT_25) & ESCR_EVENT_SELECT) | \
((DS_BIT_1 << DS_SHIFT_9) & ESCR_EVENT_MASK) | \
ESCR_TAG_ENABLE)
/* DS : MSR(ESCR) bit definition */
#define DS_BIT_0 0x00000001
#define DS_BIT_1 0x00000002
#define DS_BIT_2 0x00000004
#define DS_BIT_3 0x00000008
#define DS_BIT_4 0x00000010
#define DS_BIT_5 0x00000020
#define DS_BIT_6 0x00000040
#define DS_BIT_7 0x00000080
#define DS_BIT_8 0x00000100
#define DS_BIT_9 0x00000200
#define DS_BIT_10 0x00000400
#define DS_BIT_11 0x00000800
#define DS_BIT_12 0x00001000
#define DS_BIT_13 0x00002000
#define DS_BIT_14 0x00004000
#define DS_BIT_15 0x00008000
#define DS_BIT_16 0x00010000
#define DS_BIT_17 0x00020000
#define DS_BIT_18 0x00040000
#define DS_BIT_19 0x00080000
#define DS_BIT_20 0x00100000
#define DS_BIT_21 0x00200000
#define DS_BIT_22 0x00400000
#define DS_BIT_23 0x00800000
#define DS_BIT_24 0x01000000
#define DS_BIT_25 0x02000000
#define DS_BIT_26 0x04000000
#define DS_BIT_27 0x08000000
#define DS_BIT_28 0x10000000
#define DS_BIT_29 0x20000000
#define DS_BIT_30 0x40000000
#define DS_BIT_31 0x80000000
/* DS : MSR(ESCR, CCCR) shift count definition */
#define DS_SHIFT_1 1
#define DS_SHIFT_2 2
#define DS_SHIFT_3 3
#define DS_SHIFT_4 4
#define DS_SHIFT_5 5
#define DS_SHIFT_6 6
#define DS_SHIFT_7 7
#define DS_SHIFT_8 8
#define DS_SHIFT_9 9
#define DS_SHIFT_10 10
#define DS_SHIFT_11 11
#define DS_SHIFT_12 12
#define DS_SHIFT_13 13
#define DS_SHIFT_14 14
#define DS_SHIFT_15 15
#define DS_SHIFT_16 16
#define DS_SHIFT_17 17
#define DS_SHIFT_18 18
#define DS_SHIFT_19 19
#define DS_SHIFT_20 20
#define DS_SHIFT_21 21
#define DS_SHIFT_22 22
#define DS_SHIFT_23 23
#define DS_SHIFT_24 24
#define DS_SHIFT_25 25
#define DS_SHIFT_26 26
#define DS_SHIFT_27 27
#define DS_SHIFT_28 28
#define DS_SHIFT_29 29
#define DS_SHIFT_30 30
#define DS_SHIFT_31 31
#ifndef _ASMLANGUAGE
typedef struct btsRec /* BTS (Branch Trace Store) record */
{
UINT32 pcFm; /* Last Branch From */
UINT32 pcTo; /* Last Branch To */
UINT32 misc; /* bit4: Branch Predicted */
} BTS_REC;
typedef struct pebsRec /* PEBS (Precise Event Based Sampling) rec */
{
UINT32 eflags; /* EFLAGS */
UINT32 eip; /* Linear IP */
UINT32 eax; /* EAX */
UINT32 ebx; /* EBX */
UINT32 ecx; /* ECX */
UINT32 edx; /* EDX */
UINT32 esi; /* ESI */
UINT32 edi; /* EDI */
UINT32 ebp; /* EBP */
UINT32 esp; /* ESP */
} PEBS_REC;
typedef struct dsBufHeader /* DS (Debug Store) buffer management */
{
BTS_REC * btsBase; /* BTS buffer base */
BTS_REC * btsIndex; /* BTS index */
UINT32 btsMax; /* BTS absolute maximum */
UINT32 btsThreshold; /* BTS interrupt threshold */
PEBS_REC * pebsBase; /* PEBS buffer base */
PEBS_REC * pebsIndex; /* PEBS index */
UINT32 pebsMax; /* PEBS absolute maximum */
UINT32 pebsThreshold; /* PEBS interrupt threshold */
LL_INT pebsCtr; /* PEBS counter reset value */
UINT32 reserved[3]; /* reserved */
} DS_BUF_HEADER;
typedef struct dsConfig /* DS (Debug Store) configuration */
{
UINT32 btsNbytes; /* BTS buffer size */
BOOL btsAvailable; /* TRUE if BTS is available */
BOOL btsEnabled; /* TRUE if BTS is enabled */
BOOL btsIntMode; /* TRUE for interrupt mode */
BOOL btsBufMode; /* TRUE to store BTMs */
UINT32 pebsNbytes; /* PEBS buffer size */
BOOL pebsAvailable; /* TRUE if PEBS is available */
BOOL pebsEnabled; /* TRUE if PEBS is enabled */
INT32 pebsEvent; /* PEBS event */
INT32 pebsMetric; /* PEBS metric */
BOOL pebsOs; /* PEBS os */
LL_INT pebsCtr; /* PEBS counter */
DS_BUF_HEADER * pH; /* DS buffer header */
} DS_CONFIG;
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS dbgStrLibInit (UINT32 nBytesBts, UINT32 nBytesPebs,
BOOL sysMode);
extern DS_BUF_HEADER * dbgStrBufInit (DS_BUF_HEADER * pH,
BTS_REC * btsBufAddr,
UINT32 btsMaxOffset,
UINT32 btsIntOffset,
PEBS_REC * pebsBufAddr,
UINT32 pebsMaxOffset,
UINT32 pebsIntOffset);
extern STATUS dbgStrBufAlloc (WIND_TCB * pTcb);
extern STATUS dbgStrBufFree (WIND_TCB * pTcb);
extern STATUS dbgStrConfig (WIND_TCB * pTcb,
BOOL btsEnable, BOOL pebsEnable,
BOOL btsIntMode, BOOL btsBufMode,
INT32 pebsEvent, INT32 pebsMetric,
BOOL pebsOs, LL_INT * pPebsValue);
extern STATUS dbgStrStart (WIND_TCB * pTcb);
extern STATUS dbgStrStop (WIND_TCB * pTcb);
extern STATUS dbgStrBtsModeSet (BOOL intMode, BOOL bufMode);
extern BOOL dbgStrBtsEnable (BOOL enable);
extern STATUS dbgStrPebsModeSet (INT32 event, INT32 metric, BOOL os,
LL_INT * pValue);
extern BOOL dbgStrPebsEnable (BOOL enable);
extern void dbgStrShowInit (void);
extern void dbgStrShow (WIND_TCB * pTcb, int type);
#else /* __STDC__ */
extern STATUS dbgStrLibInit ();
extern DS_BUF_HEADER * dbgStrBufInit ();
extern STATUS dbgStrBufAlloc ();
extern STATUS dbgStrBufFree ();
extern STATUS dbgStrConfig ();
extern STATUS dbgStrStart ();
extern STATUS dbgStrStop ();
extern STATUS dbgStrBtsModeSet ();
extern BOOL dbgStrBtsEnable ();
extern STATUS dbgStrPebsModeSet ();
extern BOOL dbgStrPebsEnable ();
extern void dbgStrShowInit ();
extern void dbgStrShow ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCdbgStrLibh */
File diff suppressed because it is too large Load Diff
+120
View File
@@ -0,0 +1,120 @@
/* elfI86.h - i86-specific ELF loader header */
/*
* Copyright (c) 2001, 2004-2005, 2009 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software may be
* licensed only pursuant to the terms of an applicable Wind River license
* agreement.
*/
/*
modification history
--------------------
01e,14dec09,pgh Add EM_ARCH_MACHINE_x macro definition.
01d,05jun09,v_r Added ELF64 support (from Professional Services EMT64 Data
Access project).
01c,25jul05,v_r Updated copyright.
01b,27feb04,pad Renamed relocation type R_386_JUMP_SLOT as R_386_JMP_SLOT as
per ABI.
01a,12sep01,pad Backported from TAE 3.1 to T2.2 with necessary adaptations
(base version: elfI86.h@@/main/tor3_x/1).
*/
#ifndef __INCelfI86h
#define __INCelfI86h
#ifdef __cplusplus
extern "C" {
#endif
/*
* The following macros define the ELF machine type values that can be loaded
* into an i86 CPU.
*/
#define EM_ARCH_MACHINE_1 EM_386
#define EM_ARCH_MACHINE_2 EM_486
#define EM_ARCH_MACHINE_3 EM_X86_64
#ifdef _WRS_CONFIG_LP64
#define EM_ARCH_MACHINE EM_X86_64
#else /* _WRS_CONFIG_LP64 */
#define EM_ARCH_MACHINE EM_386
#define EM_ARCH_MACH_ALT EM_486 /* not used */
#endif /* !_WRS_CONFIG_LP64 */
/*
* Relocation Type Definitions
* The only ones that appear in vxWorks archives are "1" and "2"
*/
#define R_386_NONE 0 /* No reloc */
#define R_386_32 1 /* Direct 32 bit */
#define R_386_PC32 2 /* PC relative 32 bit */
#define R_386_GOT32 3 /* 32 bit GOT entry */
#define R_386_PLT32 4 /* 32 bit PLT address */
#define R_386_COPY 5 /* Copy symbol at runtime */
#define R_386_GLOB_DAT 6 /* Create GOT entry */
#define R_386_JMP_SLOT 7 /* Create PLT entry */
#define R_386_RELATIVE 8 /* Adjust by program base */
#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
/* These 16-bit and 8-bit relocs should never show up */
#define R_386_16 20
#define R_386_PC16 21
#define R_386_8 22
#define R_386_PC8 23
#define R_386_max 24
/* These are GNU extensions to enable C++ vtable garbage collection. */
#define R_386_GNU_VTINHERIT 250
#define R_386_GNU_VTENTRY 251
/* AMD x86-64 relocations. */
#define R_X86_64_NONE 0 /* No reloc */
#define R_X86_64_64 1 /* Direct 64 bit */
#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
#define R_X86_64_PLT32 4 /* 32 bit PLT address */
#define R_X86_64_COPY 5 /* Copy symbol at runtime */
#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
#define R_X86_64_RELATIVE 8 /* Adjust by program base */
#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
offset to GOT */
#define R_X86_64_32 10 /* Direct 32 bit zero extended */
#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
#define R_X86_64_16 12 /* Direct 16 bit zero extended */
#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
#define R_X86_64_8 14 /* Direct 8 bit sign extended */
#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
to two GOT entries for GD symbol */
#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
to two GOT entries for LD symbol */
#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
to GOT entry for IE symbol */
#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
#define R_X86_64_PC64 24 /* PC-relative 64 bits */
#define R_X86_64_GOTOFF64 25
#define R_X86_64_GOTPC32 26
#define R_X86_64_SIZE32 32
#define R_X86_64_SIZE64 33
#define R_X86_64_GOTPC32_TLSDESC 34
#define R_X86_64_TLSDESC_CALL 35
#define R_X86_64_TLSDESC 36
#ifdef __cplusplus
}
#endif
#endif /* __INCelfI86h */
+110
View File
@@ -0,0 +1,110 @@
/* esfI86.h - I80x86 exception stack frames */
/* Copyright 1984-2001 Wind River Systems, Inc. */
/*
modification history
--------------------
01c,31aug01,hdn added ESF[123] macros and its offset/size.
01b,08jun93,hdn added support for c++. updated to 5.1.
01a,28feb92,hdn written based on TRON, 68k version.
*/
#ifndef __INCesfI86h
#define __INCesfI86h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
/* Exception stack frames. Most of these can happen only for one
CPU or another, but they are all defined for all CPU's */
/* Format-0 - no privilege change, no error code */
typedef struct
{
INSTR * pc; /* 0x00 : PC */
unsigned short cs; /* 0x04 : code segment */
unsigned short pad0; /* 0x06 : padding */
unsigned long eflags; /* 0x08 : EFLAGS */
} ESF0; /* sizeof(ESF0) -> 0x0c */
/* Format-1 - no privilege change, error code */
typedef struct
{
unsigned long errCode; /* 0x00 : error code */
INSTR * pc; /* 0x04 : PC */
unsigned short cs; /* 0x08 : code segment */
unsigned short pad0; /* 0x0a : padding */
unsigned long eflags; /* 0x0c : EFLAGS */
} ESF1; /* sizeof(ESF1) -> 0x10 */
/* Format-2 - privilege change, no error code */
typedef struct
{
INSTR * pc; /* 0x00 : PC */
unsigned short cs; /* 0x04 : code segment */
unsigned short pad0; /* 0x06 : padding */
unsigned long eflags; /* 0x08 : EFLAGS */
unsigned long esp; /* 0x0c : ESP */
unsigned long ss; /* 0x10 : SS */
} ESF2; /* sizeof(ESF2) -> 0x14 */
/* Format-3 - privilege change, error code */
typedef struct
{
unsigned long errCode; /* 0x00 : error code */
INSTR * pc; /* 0x04 : PC */
unsigned short cs; /* 0x08 : code segment */
unsigned short pad0; /* 0x0a : padding */
unsigned long eflags; /* 0x0c : EFLAGS */
unsigned long esp; /* 0x10 : ESP */
unsigned long ss; /* 0x14 : SS */
} ESF3; /* sizeof(ESF3) -> 0x18 */
#endif /* _ASMLANGUAGE */
#define ESF0_EIP 0x00 /* 0x00 : PC */
#define ESF0_CS 0x04 /* 0x04 : CS */
#define ESF0_EFLAGS 0x08 /* 0x08 : EFLAGS */
#define ESF1_ERROR 0x00 /* 0x00 : ERROR */
#define ESF1_EIP 0x04 /* 0x04 : PC */
#define ESF1_CS 0x08 /* 0x08 : CS */
#define ESF1_EFLAGS 0x0c /* 0x0c : EFLAGS */
#define ESF2_EIP 0x00 /* 0x00 : PC */
#define ESF2_CS 0x04 /* 0x04 : CS */
#define ESF2_EFLAGS 0x08 /* 0x08 : EFLAGS */
#define ESF2_ESP 0x0c /* 0x0c : ESP */
#define ESF2_SS 0x10 /* 0x10 : SS */
#define ESF3_ERROR 0x00 /* 0x00 : ERROR */
#define ESF3_EIP 0x04 /* 0x04 : PC */
#define ESF3_CS 0x08 /* 0x08 : CS */
#define ESF3_EFLAGS 0x0c /* 0x0c : EFLAGS */
#define ESF3_ESP 0x10 /* 0x10 : ESP */
#define ESF3_SS 0x14 /* 0x14 : SS */
#define ESF0_NBYTES 0x0c /* sizeof(ESF0) */
#define ESF1_NBYTES 0x10 /* sizeof(ESF1) */
#define ESF2_NBYTES 0x14 /* sizeof(ESF2) */
#define ESF3_NBYTES 0x18 /* sizeof(ESF3) */
#define ESF0_NLONGS 0x03 /* sizeof(ESF0) / sizeof(int) */
#define ESF1_NLONGS 0x04 /* sizeof(ESF1) / sizeof(int) */
#define ESF2_NLONGS 0x05 /* sizeof(ESF2) / sizeof(int) */
#define ESF3_NLONGS 0x06 /* sizeof(ESF3) / sizeof(int) */
#ifdef __cplusplus
}
#endif
#endif /* __INCesfI86h */
+122
View File
@@ -0,0 +1,122 @@
/* excLib.h - exception library header */
/* Copyright 1984-2003,2008, 2011 Wind River Systems, Inc. */
/*
modification history
--------------------
01i,14nov11,yjw Add exception vector definitions.(WIND00310152)
01h,13oct08,rbc WIND00137483. Fix the _WRS_IS_SUPV_EXC macro.
01g,26nov03,pes Correct _WRS_IS_SUPV_EXC macro.
01f,18nov03,pes Add _WRS_IS_SUPV_EXC macro.
01e,22oct02,hdn added EXC_FP_CONTEXT for FPU exception (spr 70252)
01d,29aug01,hdn added _ASMLANGUAGE conditional macro
added esp0, cr2, cr3, esp0[07] to EXC_INFO.
01c,14nov93,hdn added excExcepHook.
01b,08jun93,hdn added support for c++. updated to 5.1.
01a,28feb92,hdn written based on TRON, 68k version.
*/
#ifndef __INCexcI86Libh
#define __INCexcI86Libh
#ifdef __cplusplus
extern "C" {
#endif
/* lowest and highest vector number to initialize */
#define LOW_VEC 0 /* lowest initialized vector */
#define HIGH_VEC 0xff /* highest initialized vector */
#ifndef _ASMLANGUAGE
typedef struct
{
UINT16 valid; /* indicators that following fields are valid */
UINT16 vecNum; /* vector number */
ULONG errCode; /* error code */
INSTR * pc; /* program counter */
ULONG eflags; /* eflags register */
UINT16 cs; /* code segment register */
UINT16 pad; /* pad to four byte boundary */
ULONG esp; /* stack pointer in the ESF */
ULONG ss; /* stack segment in the ESF */
ULONG esp0; /* supervisor (PL0) stack pointer */
ULONG cr2; /* CR2 */
ULONG cr3; /* CR3 */
ULONG esp00; /* content of the stack *(esp0 + 0) */
ULONG esp01; /* content of the stack *(esp0 + 1) */
ULONG esp02; /* content of the stack *(esp0 + 2) */
ULONG esp03; /* content of the stack *(esp0 + 3) */
ULONG esp04; /* content of the stack *(esp0 + 4) */
ULONG esp05; /* content of the stack *(esp0 + 5) */
ULONG esp06; /* content of the stack *(esp0 + 6) */
ULONG esp07; /* content of the stack *(esp0 + 7) */
ULONG reserved0; /* reserved 0 */
ULONG reserved1; /* reserved 1 */
ULONG reserved2; /* reserved 2 */
ULONG reserved3; /* reserved 3 */
} EXC_INFO;
#define _WRS_IS_SUPV_EXC() (((excInfo.cs & 0x3) == 0) ? TRUE : FALSE)
/* exception info valid bits */
#define EXC_VEC_NUM 0x01 /* vector number valid */
#define EXC_ERROR_CODE 0x02 /* error code valid */
#define EXC_ESP_SS 0x04 /* ESP and SS valid */
#define EXC_CR2 0x08 /* CR2 valid */
#define EXC_FP_CONTEXT 0x10 /* FP_CONTEXT valid */
#define EXC_INVALID_TYPE 0x80 /* special indicator: ESF type was bad;
* type is in funcCode field */
/* exception vector number */
#define EXC_DIVIDE_ERROR 0x00 /* divide error */
#define EXC_DEBUG 0x01 /* debug */
#define EXC_NMI 0x02 /* NMI */
#define EXC_INT3 0x03 /* breakpoint */
#define EXC_OVERFLOW 0x04 /* overflow */
#define EXC_BOUNDS_CHECK 0x05 /* bounds check */
#define EXC_INVALID_OPCODE 0x06 /* invalid opcode */
#define EXC_DEVICE_NOT_AVAILABLE 0x07 /* device not available */
#define EXC_DOUBLE_FAULT 0x08 /* double fault */
#define EXC_COPROC_OVERRUN 0x09 /* coprocessor segment overrun */
#define EXC_INVALID_TSS 0x0a /* invalid TSS */
#define EXC_SEGMENT_NOT_PRESENT 0x0b /* segment not present */
#define EXC_STACK_SEGMENT_FAULT 0x0c /* stack segment fault */
#define EXC_GENERAL_PROTECTION 0x0d /* general protection */
#define EXC_PAGE_FAULT 0x0e /* page fault */
#define EXC_RESERVED 0x0f /* Intel-reserved */
#define EXC_FP_ERROR 0x10 /* Floating-point error */
#define EXC_ALIGNMENT_CHECK 0x11 /* alignment check */
#define EXC_MACHINE_CHECK 0x12 /* machine check */
#define EXC_SIMD_ERROR 0x13 /* SIMD Float exception */
/* variable declarations */
extern FUNCPTR excExcepHook; /* add'l rtn to call when exceptions occur */
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern void excStub (void);
extern void excIntStub (void);
#else /* __STDC__ */
extern void excStub ();
extern void excIntStub ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCexcI86Libh */
+307
View File
@@ -0,0 +1,307 @@
/* fppLib.h - floating-point coprocessor support library header */
/* Copyright 1992-1993,2001-2002,2008,2010-2011 Wind River Systems, Inc. */
/*
modification history
--------------------
01m,22dec11,jjk WIND00313302 - Fix display of FP/MMX registers
01l,27jul11,g_x add xmm[] and ymm[] to FPREG_SET (WIND00285122)
01k,22mar11,ggm WIND00262870 - Added fppArchCpuInit.
01j,19jan11,ggm XSave/XRestore implementation for extended state context
switch.
01i,29sep10,scm adjust offset for FPXREG_FPX for DOUBLEX_SSE structs...
01h,05mar08,scm WIND00116608.
01g,25mar02,hdn added two APIs to detect illegal FPU usage (spr 70187)
01f,21nov01,hdn derived xmm[] from the reserved res2[] in FPX_CONTEXT
01e,21aug01,hdn imported SSE support from T31 ver 01g
01d,02sep93,hdn deleted a macro FPX.
01c,08jun93,hdn added support for c++. updated to 5.1.
01b,29sep92,hdn changed UTINY to UCHAR.
01a,07apr92,hdn written based on TRON version.
*/
#ifndef __INCfppI86Libh
#define __INCfppI86Libh
#ifdef __cplusplus
extern "C" {
#endif
/* control register: defines for control word */
#define FPCR_IM 0x0001 /* IM exc-mask invalid operation */
#define FPCR_DM 0x0002 /* DM exc-mask denormalized operand */
#define FPCR_ZM 0x0004 /* ZM exc-mask zero divide */
#define FPCR_OM 0x0008 /* OM exc-mask overflow */
#define FPCR_UM 0x0010 /* UM exc-mask underflow */
#define FPCR_PM 0x0020 /* PM exc-mask precision */
#define FPCR_PC_SINGLE 0x0000 /* PC single precision(24 bits) */
#define FPCR_PC_DOUBLE 0x0200 /* PC double precision(53 bits) */
#define FPCR_PC_EXTENDED 0x0300 /* PC extended precision(64 bits) */
#define FPCR_PC_MASK 0xfcff /* PC extended precision(64 bits) */
#define FPCR_RC_NEAREST 0x0000 /* RC round to nearest */
#define FPCR_RC_DOWN 0x0400 /* RC round down */
#define FPCR_RC_UP 0x0800 /* RC round up */
#define FPCR_RC_ZERO 0x0c00 /* RC round to zero */
#define FPCR_RC_MASK 0xf3ff /* RC round bits mask */
#define FPCR_X 0x1000 /* X infinity control */
/* status register: defines for status word */
#define FPSR_IE 0x0001 /* IE exc-flag invalid operation */
#define FPSR_DE 0x0002 /* DE exc-flag denormalized operand */
#define FPSR_ZE 0x0004 /* ZE exc-flag zero divide */
#define FPSR_OE 0x0008 /* OE exc-flag overflow */
#define FPSR_UE 0x0010 /* UE exc-flag underflow */
#define FPSR_PE 0x0020 /* PE exc-flag precision */
#define FPSR_SF 0x0040 /* SF stack fault */
#define FPSR_ES 0x0080 /* ES error summary status */
#define FPSR_C0 0x0100 /* C0 condition code */
#define FPSR_C1 0x0200 /* C1 condition code */
#define FPSR_C2 0x0400 /* C2 condition code */
#define FPSR_TOP 0x3800 /* TOP top of stack pointer */
#define FPSR_C3 0x4000 /* C3 condition code */
#define FPSR_B 0x8000 /* FPU busy */
/* number of FP/MM and XMM registers on coprocessor */
#define FP_NUM_REGS 8 /* number of FP/MM registers */
#define XMM_NUM_REGS 8 /* number of XMM registers */
#define FP_NUM_RESERVED 14 /* reserved area in FPX_CONTEXT */
#define XSAVE_HEADER 64 /* Number of bytes in the XSAVE header */
/* maximum size of floating-point coprocessor state frame */
#define FPO_STATE_FRAME_SIZE 108 /* nBytes of FPO_CONTEXT */
#define FPX_STATE_FRAME_SIZE 512 /* nBytes of FPX_CONTEXT */
/* FPREG_SET structure offsets */
#define FPREG_FPCR 0x00 /* offset to FPCR in FPREG_SET */
#define FPREG_FPSR 0x04 /* offset to FPSR in FPREG_SET */
#define FPREG_FPTAG 0x08 /* offset to FPTAG in FPREG_SET */
#define FPREG_OP 0x0c /* offset to OP in FPREG_SET */
#define FPREG_IP 0x10 /* offset to IP in FPREG_SET */
#define FPREG_CS 0x14 /* offset to CS in FPREG_SET */
#define FPREG_DP 0x18 /* offset to DP in FPREG_SET */
#define FPREG_DS 0x1c /* offset to DS in FPREG_SET */
#define FPREG_FPX(n) (0x20 + (n)*sizeof(DOUBLEX)) /* offset to FPX(n) */
/* FPX_CONTEXT REG_SET - structure offsets for New FP context */
#define FPXREG_FPCR 0x00 /* offset to FPCR in FPREG_SET */
#define FPXREG_FPSR 0x02 /* offset to FPSR in FPREG_SET */
#define FPXREG_FPTAG 0x04 /* offset to FPTAG in FPREG_SET */
#define FPXREG_OP 0x06 /* offset to OP in FPREG_SET */
#define FPXREG_IP 0x08 /* offset to IP in FPREG_SET */
#define FPXREG_CS 0x0c /* offset to CS in FPREG_SET */
#define FPXREG_DP 0x10 /* offset to DP in FPREG_SET */
#define FPXREG_DS 0x14 /* offset to DS in FPREG_SET */
#define FPXREG_RSVD0 0x18 /* offset to RESERVED0 in FPREG_SET */
#define FPXREG_RSVD1 0x1c /* offset to RESERVED1 in FPREG_SET */
#define FPXREG_FPX(n) (0x20 + (n)*sizeof(DOUBLEX_SSE)) /* offset to FPX(n) */
#ifndef _ASMLANGUAGE
/* DOUBLEX - double extended precision */
typedef struct
{
UCHAR f[10]; /* ST[0-7] or MM[0-7] */
} DOUBLEX;
/* DOUBLEX_SSE - double extended precision used in FPX_CONTEXT for SSE */
typedef struct
{
UCHAR xmm[16]; /* for 128 bits XMM registers */
} DOUBLEX_SSE;
/* FPREGO_SET - FP register set that is different from FP_CONTEXT */
typedef struct fpregOSet
{
int fpcr; /* control word */
int fpsr; /* status word */
int fptag; /* tag word */
int op; /* last FP instruction op code */
int ip; /* instruction pointer */
int cs; /* instruction pointer selector */
int dp; /* data pointer */
int ds; /* data pointer selector */
DOUBLEX fpx[FP_NUM_REGS]; /* FR[0-7] non-TOS rel. order */
} FPREGO_SET;
/* FPREGX_SET - FP register set that is corresponding to FPX_CONTEXT*/
typedef struct fpregXSet
{
int fpcr; /* control word */
int fpsr; /* status word */
int fptag; /* tag word */
int op; /* last FP instruction op code */
int ip; /* instruction pointer */
int cs; /* instruction pointer selector */
int dp; /* data pointer */
int ds; /* data pointer selector */
DOUBLEX fpx[FP_NUM_REGS]; /* FR[0-7] non-TOS rel. order */
DOUBLEX_SSE xmm[XMM_NUM_REGS]; /* 8*16 XMM[0-7] */
} FPREGX_SET;
/* FPREGX_EXT_SET - FP register set that is corresponding to FPX_EXT_CONTEXT */
typedef struct fpregX_ExtSet
{
int fpcr; /* control word */
int fpsr; /* status word */
int fptag; /* tag word */
int op; /* last FP instruction op code */
int ip; /* instruction pointer */
int cs; /* instruction pointer selector */
int dp; /* data pointer */
int ds; /* data pointer selector */
DOUBLEX fpx[FP_NUM_REGS]; /* FR[0-7] non-TOS rel. order */
DOUBLEX_SSE xmm[XMM_NUM_REGS]; /* 8*16 XMM[0-7] */
DOUBLEX_SSE ymm[XMM_NUM_REGS]; /* 8*16 higher 128 bits of YMM[0-7] */
} FPREGX_EXT_SET;
/* FPREG_SET - Common FP register set */
typedef struct fpregSet
{
union n
{
FPREGO_SET o; /* old FPO_CONTEXT for fsave/frstor */
FPREGX_SET x; /* new FPX_CONTEXT for fxsave/fxrstor */
FPREGX_EXT_SET x_ext; /* FPX_EXT_CONTEXT for xsave/xrstor */
} n;
} FPREG_SET;
/* FPO_CONTEXT - Old FP context used by fsave/frstor instruction */
typedef struct fpOcontext
{
int fpcr; /* 4 control word */
int fpsr; /* 4 status word */
int fptag; /* 4 tag word */
int ip; /* 4 instruction pointer */
short cs; /* 2 instruction pointer selector */
short op; /* 2 last FP instruction op code */
int dp; /* 4 data pointer */
int ds; /* 4 data pointer selector */
DOUBLEX fpx[FP_NUM_REGS]; /* 8*10 FR[0-7] non-TOS rel. order */
} FPO_CONTEXT; /* 108 bytes total */
/* FPX_CONTEXT - New FP context used by fxsave/fxrstor instruction */
typedef struct fpXcontext
{
short fpcr; /* 2 control word */
short fpsr; /* 2 status word */
short fptag; /* 2 tag word */
short op; /* 2 last FP instruction op code */
int ip; /* 4 instruction pointer */
int cs; /* 4 instruction pointer selector */
int dp; /* 4 data pointer */
int ds; /* 4 data pointer selector */
int reserved0; /* 4 reserved */
int reserved1; /* 4 reserved */
DOUBLEX_SSE fpx[FP_NUM_REGS]; /* 8*16 FR[0-7] non-TOS rel. order */
DOUBLEX_SSE xmm[XMM_NUM_REGS]; /* 8*16 XMM[0-7] */
DOUBLEX_SSE res2[FP_NUM_RESERVED]; /* 14*16 reserved */
} FPX_CONTEXT; /* 512 bytes total */
/* FPX_EXT_CONTEXT - Extended FP context used by xsave/xrstor instruction */
typedef struct fpX_ExtContext
{
short fpcr; /* 2 control word */
short fpsr; /* 2 status word */
short fptag; /* 2 tag word */
short op; /* 2 last FP instruction op code */
int ip; /* 4 instruction pointer */
int cs; /* 4 instruction pointer selector */
int dp; /* 4 data pointer */
int ds; /* 4 data pointer selector */
int reserved0; /* 4 reserved */
int reserved1; /* 4 reserved */
DOUBLEX_SSE fpx[FP_NUM_REGS]; /* 8*16 FR[0-7] non-TOS rel. order */
DOUBLEX_SSE xmm[XMM_NUM_REGS]; /* 8*16 XMM[0-7] */
DOUBLEX_SSE res2[FP_NUM_RESERVED]; /* 14*16 reserved */
UCHAR xSaveHeader[XSAVE_HEADER]; /* 64 XSave header */
DOUBLEX_SSE ymm[XMM_NUM_REGS]; /* 8*16 higher 128 bits of YMM[0-7] */
} FPX_EXT_CONTEXT; /* 704 bytes total */
/* FP_CONTEXT - Common FP context */
typedef struct fpContext
{
union u
{
FPO_CONTEXT o; /* old FPO_CONTEXT for fsave/frstor */
FPX_CONTEXT x; /* new FPX_CONTEXT for fxsave/fxrstor */
FPX_EXT_CONTEXT x_ext; /* FPX_EXT_CONTEXT for xsave/xrstor */
} u;
} FP_CONTEXT;
/* variable declarations */
extern REG_INDEX fpRegName[]; /* f-point data register table */
extern REG_INDEX fpXregName[]; /* f-point data register table for FPX and FPX_EXT */
extern REG_INDEX fpCtlRegName[]; /* f-point control register table */
extern REG_INDEX fpXctlRegName[]; /* new f-point control register table */
extern WIND_TCB *pFppTaskIdPrevious; /* task id for deferred exceptions */
extern FUNCPTR fppCreateHookRtn; /* arch dependent create hook routine */
extern FUNCPTR fppDisplayHookRtn; /* arch dependent display routine */
extern VOIDFUNCPTR _func_fppSaveRtn; /* fppSave or fppXsave */
extern VOIDFUNCPTR _func_fppRestoreRtn; /* fppRestore or fppXrestore */
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern void fppArchCpuInit(void);
extern void fppArchInit (void);
extern void fppArchTaskCreateInit (FP_CONTEXT *pFpContext);
extern STATUS fppProbeSup (void);
extern void fppProbeTrap (void);
extern void fppDtoDx (DOUBLEX *pDx, double *pDouble);
extern void fppDxtoD (double *pDouble, DOUBLEX *pDx);
extern void fppXrestore (FP_CONTEXT *pFpContext);
extern void fppXsave (FP_CONTEXT *pFpContext);
extern void fppXregsToCtx (FPREG_SET *pFpRegSet, FP_CONTEXT *pFpContext);
extern void fppExtXregsToCtx (FPREG_SET *pFpRegSet, FP_CONTEXT *pFpContext);
extern void fppXctxToRegs (FP_CONTEXT *pFpContext, FPREG_SET *pFpRegSet);
extern void fppExtXctxToRegs (FP_CONTEXT *pFpContext, FPREG_SET *pFpRegSet);
extern void fppArchSwitchHook (WIND_TCB * pOldTcb, WIND_TCB * pNewTcb);
extern STATUS fppArchSwitchHookEnable (BOOL enable);
#else
extern void fppArchCpuInit();
extern void fppArchInit ();
extern void fppArchTaskCreateInit ();
extern STATUS fppProbeSup ();
extern void fppProbeTrap ();
extern void fppDtoDx ();
extern void fppDxtoD ();
extern void fppXrestore ();
extern void fppXsave ();
extern void fppXregsToCtx ();
extern void fppExtXregsToCtx ();
extern void fppXctxToRegs ();
extern void fppExtXctxToRegs ();
extern void fppArchSwitchHook ();
extern STATUS fppArchSwitchHookEnable ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCfppI86Libh */
+176
View File
@@ -0,0 +1,176 @@
/* in_cksum.h - x86 version in_cksum header file */
/* Copyright 2001-2002 Wind River Systems, Inc. */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from tahoe: in_cksum.c 1.2 86/01/05
* from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
* from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
* $FreeBSD: src/sys/i386/include/in_cksum.h,v 1.7.2.1 2000/05/05 13:37:00 jlemon Exp $
*/
/*
modification history
--------------------
01f,25aug05,dlk Add section tags.
01e,24mar04,m_h Internet Checksum
01d,18mar04,m_h moved to arch/i86
01c,20nov03,niq Remove copyright_wrs.h file inclusion
01c,18nov03,rp updated header file path
01b,25jul02,rvr removed DCC specific code
01a,13sep01,hsh Created from BSD 4.3
*/
#ifndef _MACHINE_IN_CKSUM_H_
#define _MACHINE_IN_CKSUM_H_ 1
#include <sys/cdefs.h>
/*
* in_cksum_hdr - checksum on header only
*
* It is useful to have an Internet checksum routine which is inlineable
* and optimized specifically for the task of computing IP header checksums
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
static __inline u_int
in_cksum_hdr
(
const struct ip *ip
)
{
register u_int sum = 0;
int hlen = sizeof (struct ip);
register u_short *w = (u_short *) ip;
u_short remaining = 0;
while (hlen > 1)
{
sum += *w++;
hlen -= 2;
}
if (hlen == 1)
{
*(u_char *) (&remaining) = *(u_char *) w;
sum += remaining;
}
sum = (sum & 0xffff) + (sum >> 16);
if (sum > 0xffff)
sum -= 0xffff;
return ~sum & 0xffff;
}
/*
* in_cksum_update
*/
static __inline void
in_cksum_update
(
struct ip *ip
)
{
int __tmpsum;
__tmpsum = (int)ntohs(ip->ip_sum) + 256;
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
}
/*
* in_pseudo - pre-checksum parts of pseudo-header
*
* Compute significant parts of the IPv4 checksum pseudo-header * for use in a
* delayed TCP/UDP checksum calculation.
*
* Args:
*
* src Source IP address
* dst Destination IP address
* lenproto htons(proto-hdr-len + proto-number)
*/
static __inline u_int16_t in_pseudo
(
u_int32_t src,
u_int32_t dst,
u_int32_t lenproto
)
{
u_int32_t sum;
sum = lenproto +
(u_int16_t)(src >> 16) +
(u_int16_t)(src /*& 0xffff*/) +
(u_int16_t)(dst >> 16) +
(u_int16_t)(dst /*& 0xffff*/);
sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum /*& 0xffff*/);
if (sum > 0xffff)
sum -= 0xffff;
return (sum);
}
/*
* in_addword - Add two 16-bit workd
*
* Add the two 16-bit network-order values, carry, and return.
*/
static __inline u_int16_t in_addword
(
u_int16_t a,
u_int16_t b
)
{
u_int32_t sum = a + b;
if (sum > 0xffff)
sum -= 0xffff;
return (sum);
}
_WRS_FASTTEXT
u_short in_cksum_skip(struct mbuf *m, int len, int skip);
#endif /* _MACHINE_IN_CKSUM_H_ */
+86
View File
@@ -0,0 +1,86 @@
/* instrI86.h - header for I86 instruction fields */
/* Copyright 2004 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,26apr04,jmp created from target/h/dbgI86Lib.h
*/
/*
* WARNING: This file is shared between i86 and VxSim/i86 arches,
* and between Kernel and User sides.
* Please make sure that any modifications to this file
* does not break other arches.
*/
#ifndef __INCinstrI86h
#define __INCinstrI86h
/* defines */
#define ADDI08_0 (0x83)
#define ADDI08_1 (0xc4)
#define ADDI32_0 (0x81)
#define ADDI32_1 (0xc4)
#define LEAD08_0 (0x8d)
#define LEAD08_1 (0x64)
#define LEAD08_2 (0x24)
#define LEAD32_0 (0x8d)
#define LEAD32_1 (0xa4)
#define LEAD32_2 (0x24)
#define JMPD08 (0xeb)
#define JMPD32 (0xe9)
#define ENTER (0xc8)
#define PUSH_EBX (0x53)
#define PUSH_EBP (0x55)
#define PUSH_ESI (0x56)
#define MOV_ESP0 (0x89)
#define MOV_ESP1 (0xe5)
#define MOV_ESP_ESI (0xe689)
#define LEAVE (0xc9)
#define RET (0xc3)
#define RETADD (0xc2)
#define CALL_DIR (0xe8)
#define CALL_INDIR0 (0xff)
#define CALL_INDIR1 (0x10)
#define CALL_INDIR_REG_EAX (0xd0)
#define CALL_INDIR_REG_ECX (0xd1)
#define CALL_INDIR_REG_EDX (0xd2)
#define CALL_INDIR_REG_EBX (0xd3)
#define MOV_ECX (0x0d8b)
#define MOV_EDX (0x158b)
#define MOV_EBP_ESP (0xe589)
#define ADDI08_0_MASK (0xff)
#define ADDI08_1_MASK (0xff)
#define ADDI32_0_MASK (0xff)
#define ADDI32_1_MASK (0xff)
#define LEAD08_0_MASK (0xff)
#define LEAD08_1_MASK (0xff)
#define LEAD08_2_MASK (0xff)
#define LEAD32_0_MASK (0xff)
#define LEAD32_1_MASK (0xff)
#define LEAD32_2_MASK (0xff)
#define JMPD08_MASK (0xff)
#define JMPD32_MASK (0xff)
#define ENTER_MASK (0xff)
#define PUSH_EBX_MASK (0xff)
#define PUSH_EBP_MASK (0xff)
#define PUSH_ESI_MASK (0xff)
#define MOV_ESP0_MASK (0xff)
#define MOV_ESP1_MASK (0xff)
#define MOV_ESP_ESI_MASK (0xffff)
#define LEAVE_MASK (0xff)
#define RET_MASK (0xff)
#define RETADD_MASK (0xff)
#define CALL_DIR_MASK (0xff)
#define CALL_INDIR0_MASK (0xff)
#define CALL_INDIR1_MASK (0x38)
#define CALL_INDIR_REG_MASK (0xdf)
#define MOV_ECX_MASK (0xffff)
#define MOV_EDX_MASK (0xffff)
#define MOV_EBP_ESP_MASK (0xffff)
#endif /* __INCinstrI86h */
+119
View File
@@ -0,0 +1,119 @@
/* intI86Lib.h - I86-specific interrupt library header file */
/*
* Copyright (c) 2001,2003-2004,2007-2009 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01j,10jun09,sem Update intCpuMicroLock inline defines
01i,15apr09,sem Add new intCpuMicroLock API
01h,24mar09,sem Removed andl instruction from inline intCpuLock().
01g,21apr08,scm WIND00121559 - modified gnu versions of inline.
01f,19jun07,zl added _inline_intCpuLock() and _inline_intCpuUnlock()
01e,12oct04,jb Add interrupt lockout for automatic stack switch
01d,04dec03,jb Removing info message
01c,22aug03,to added inline intLock()/intUnlock().
deleted K&R style prototypes.
01b,09nov01,hdn added intConnectCode offset macros
01a,29aug01,hdn taken from T31 ver 01b.
*/
#ifndef __INCintI86Libh
#define __INCintI86Libh
#ifdef __cplusplus
extern "C" {
#endif
/* offset macro for stuff in the intConnect code */
#define ICC_INT_BASE 1
#define ICC_INT_ENT ICC_INT_BASE + 1 /* intConnectCode[1] */
#define ICC_BOI_PUSH ICC_INT_ENT + 7 /* intConnectCode[8] */
#define ICC_BOI_PARAM ICC_BOI_PUSH + 1 /* intConnectCode[9] */
#define ICC_BOI_ROUTN ICC_BOI_PARAM + 5 /* intConnectCode[14] */
#define ICC_INT_PARAM ICC_BOI_ROUTN + 5 /* intConnectCode[19] */
#define ICC_INT_ROUTN ICC_INT_PARAM + 5 /* intConnectCode[24] */
#define ICC_EOI_PARAM ICC_INT_ROUTN + 5 /* intConnectCode[29] */
#define ICC_EOI_CALL ICC_EOI_PARAM + 4 /* intConnectCode[33] */
#define ICC_EOI_ROUTN ICC_EOI_CALL + 1 /* intConnectCode[34] */
#define ICC_ADD_N ICC_EOI_ROUTN + 6 /* intConnectCode[40] */
#define ICC_INT_EXIT ICC_ADD_N + 5 /* intConnectCode[45] */
#ifndef _ASMLANGUAGE
#if defined (__DCC__)
__asm volatile int _inline_intCpuLock (void)
{
! "ax" /* ax is clobbered */
pushf /* push EFLAGS on stack */
cli /* clear interrupts */
popl %eax /* get EFLAGS in EAX */
}
__asm volatile void _inline_intCpuUnlock (int key)
{
!
% mem key; lab skip_sti /* input: key; declare label */
testl $0x200,key /* test EFLAGS_IF */
jz skip_sti /* if not set, skip sti */
sti /* else enable interrupts */
skip_sti:
}
#elif defined (__GNUC__)
static __inline__ int _inline_intCpuLock (void)
{
int key;
__asm__ volatile ("pushf; cli; popl %0; " \
: "=g" (key) : : "memory");
return key;
}
static __inline__ void _inline_intCpuUnlock
(
int key
)
{
__asm__ volatile ("testl $0x200,%0; jz 0f; sti; 0: " \
: : "g" (key) : "cc", "memory");
}
#else
#define _inline_intCpuLock() intCpuLock()
#define _inline_intCpuUnlock(key) intCpuUnlock(key)
#endif /* _VX_TOOL_FAMILY */
#define _inline_intCpuMicroLock() _inline_intCpuLock()
#define _inline_intCpuMicroUnlock(key) _inline_intCpuUnlock(key)
/* function declarations */
extern FUNCPTR intHandlerCreateI86 (FUNCPTR routine, int parameter,
FUNCPTR routineBoi, int parameterBoi,
FUNCPTR routineEoi, int parameterEoi);
extern void intVecSet2 (FUNCPTR * vector, FUNCPTR function,
int idtGate, int idtSelector);
extern void intVecGet2 (FUNCPTR * vector, FUNCPTR * pFunction,
int * pIdtGate, int * pIdtSelector);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __INCintI86Libh */
+130
View File
@@ -0,0 +1,130 @@
/* ipiI86Lib.h - I80X86 IPI library header */
/*
* Copyright (c) 2002,2006-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01m,03feb11,rbc WIND00253734 - Disable _WRS_VX_IA_IPI_INSTRUMENTATION for 32
Bit.
01l,03jun10,scm disable _WRS_VX_IA_IPI_INSTRUMENTATION for 64 bit...
01k,01jun10,jb Adding ipi instrumentation for AMP/SMP M-N debugging
01j,29apr10,pad Moved extern C statement after include statements.
01i,14jan09,scm Clean up old SMP restrictions.
01h,27aug08,jpb Renamed VSB header file
01g,24jun08,jpb Added include path for kernel configurations options set in
vsb. Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP.
01f,01jun07,tor add DEBUG IPI num
01e,06apr07,scm clarify CPC "self" as meaning boot strap processor...
01d,08dec06,scm add additional SMP ipi support routines...
01c,28feb02,hdn took IPI_MAX_XXX macros from ipiArchLib.c
01b,27feb02,hdn renamed ipiStubShutdown() to ipiShutdownSup()
01a,20feb02,hdn written
*/
#ifndef __INCipiI86Libh
#define __INCipiI86Libh
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#define IPI_MAX_HANDLERS 8 /* max number of handlers */
#define IPI_MAX_RETRIES 3 /* max number of retries */
#define CPC_IPI_INUM 0xEF /* Must be highest possible int IPI */
#define DEBUG_IPI_INUM 0xEE /* second-highest possible IPI */
#define BEGIN_IPI_INUM 0xE8 /* First IPI Interrupt Number */
#define CPC_TO_ALL_BUT_SELF 0x0 /* special case for broadcasts */
#define CPC_TO_BSP 0x1
#define CPC_TO_AP_1 0x2
#define CPC_TO_AP_2 0x4
#define CPC_TO_AP_3 0x8
#define CPC_TO_ALL_CPUS 0xF
#ifndef _ASMLANGUAGE
/* variable declarations */
IMPORT char ipiCallTbl []; /* table of IPI stub calls */
#ifdef _WRS_CONFIG_LP64
#undef _WRS_VX_IA_IPI_INSTRUMENTATION
#else
#undef _WRS_VX_IA_IPI_INSTRUMENTATION
#endif /* _WRS_CONFIG_LP64 */
#ifdef _WRS_VX_IA_IPI_INSTRUMENTATION
struct ipiCounters
{
UINT32 ipiEmit[IPI_MAX_HANDLERS];
UINT32 ipiSent[IPI_MAX_HANDLERS];
UINT32 ipiRecv[IPI_MAX_HANDLERS];
};
extern struct ipiCounters *ipiCounters[VX_MAX_SMP_CPUS];
#endif /* _WRS_VX_IA_IPI_INSTRUMENTATION */
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern void ipiVecInit (UINT32 intNum);
extern void ipiHandler (UINT32 index);
extern STATUS ipiConnect (UINT32 intNum, VOIDFUNCPTR routine);
extern STATUS ipiStartup (UINT32 apicId, UINT32 vector, UINT32 nTimes);
extern STATUS ipiShutdown (UINT32 apicId, UINT32 vector);
extern STATUS ipiReset (UINT32 apicId);
extern void ipiStub (void);
extern void ipiShutdownSup (void);
extern void ipiHandlerTlbFlush (void);
extern void ipiHandlerTscReset (void);
extern void ipiHandlerShutdown (void);
/* CPC support routines... */
STATUS cpcIpiEmit (cpuset_t processor);
STATUS cpcIpiIntConnect (VOIDFUNCPTR * vector, VOIDFUNCPTR handler, int param);
STATUS cpcIpiIntEnable (int vector);
STATUS cpcIpiIntDisable (int vector);
#else /* __STDC__ */
extern void ipiVecInit ();
extern void ipiHandler ();
extern STATUS ipiConnect ();
extern STATUS ipiStartup ();
extern STATUS ipiShutdown ();
extern STATUS ipiReset ();
extern void ipiStub ();
extern void ipiShutdownSup ();
extern void ipiHandlerTlbFlush ();
extern void ipiHandlerTscReset ();
extern void ipiHandlerShutdown ();
/* CPC support routines... */
STATUS cpcIpiEmit ();
STATUS cpcIpiIntConnect ();
STATUS cpcIpiIntEnable ();
STATUS cpcIpiIntDisable ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCipiI86Libh */
+88
View File
@@ -0,0 +1,88 @@
/* ivI86.h - I80x86 interrupt vectors */
/* Copyright 1984-2001 Wind River Systems, Inc. */
/*
modification history
--------------------
01e,29aug01,hdn added support for streaming SIMD exception.
01d,29may94,hdn removed I80486 conditional.
01c,08jun93,hdn added support for c++. updated to 5.1.
01b,26mar93,hdn added a new vector for 486.
01a,28feb92,hdn written based on TRON, 68k version.
*/
#ifndef __INCivI86h
#define __INCivI86h
#ifdef __cplusplus
extern "C" {
#endif
/* 0 - 19 exception vector number */
#define IN_DIVIDE_ERROR 0
#define IN_DEBUG 1
#define IN_NON_MASKABLE 2
#define IN_BREAKPOINT 3
#define IN_OVERFLOW 4
#define IN_BOUND 5
#define IN_INVALID_OPCODE 6
#define IN_NO_DEVICE 7
#define IN_DOUBLE_FAULT 8
#define IN_CP_OVERRUN 9
#define IN_INVALID_TSS 10
#define IN_NO_SEGMENT 11
#define IN_STACK_FAULT 12
#define IN_PROTECTION_FAULT 13
#define IN_PAGE_FAULT 14
#define IN_RESERVED 15
#define IN_CP_ERROR 16
#define IN_ALIGNMENT 17
#define IN_MACHINE_CHECK 18
#define IN_SIMD 19
/* 20 - 31 unassigned, Intel reserved exceptions */
/* 32 - 255 user defined interrupt vectors */
#ifndef _ASMLANGUAGE
/* macros to convert interrupt vectors <-> interrupt numbers */
#define IVEC_TO_INUM(intVec) ((int) (intVec) >> 3)
#define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) ((intNum) << 3))
/* exception vector address/offset */
#define IV_DIVIDE_ERROR INUM_TO_IVEC (IN_DIVIDE_ERROR)
#define IV_DEBUG INUM_TO_IVEC (IN_DEBUG)
#define IV_NON_MASKABLE INUM_TO_IVEC (IN_NON_MASKABLE)
#define IV_BREAKPOINT INUM_TO_IVEC (IN_BREAKPOINT)
#define IV_OVERFLOW INUM_TO_IVEC (IN_OVERFLOW)
#define IV_BOUND INUM_TO_IVEC (IN_BOUND)
#define IV_INVALID_OPCODE INUM_TO_IVEC (IN_INVALID_OPCODE)
#define IV_NO_DEVICE INUM_TO_IVEC (IN_NO_DEVICE)
#define IV_DOUBLE_FAULT INUM_TO_IVEC (IN_DOUBLE_FAULT)
#define IV_CP_OVERRUN INUM_TO_IVEC (IN_CP_OVERRUN)
#define IV_INVALID_TSS INUM_TO_IVEC (IN_INVALID_TSS)
#define IV_NO_SEGMENT INUM_TO_IVEC (IN_NO_SEGMENT)
#define IV_STACK_FAULT INUM_TO_IVEC (IN_STACK_FAULT)
#define IV_PROTECTION_FAULT INUM_TO_IVEC (IN_PROTECTION_FAULT)
#define IV_PAGE_FAULT INUM_TO_IVEC (IN_PAGE_FAULT)
#define IV_RESERVED INUM_TO_IVEC (IN_RESERVED)
#define IV_CP_ERROR INUM_TO_IVEC (IN_CP_ERROR)
#define IV_ALIGNMENT INUM_TO_IVEC (IN_ALIGNMENT)
#define IV_MACHINE_CHECK INUM_TO_IVEC (IN_MACHINE_CHECK)
#define IV_SIMD INUM_TO_IVEC (IN_SIMD)
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCivI86h */
+149
View File
@@ -0,0 +1,149 @@
/* mmuI86Lib.h - mmuI86Lib header for i86. */
/* Copyright 1984-2003 Wind River Systems, Inc. */
/*
modification history
--------------------
01g,24jun04,zmm Ported from mmuPro32Lib.h version 01f to P5 MMU.
01f,12jun02,hdn added arch specific VM library APIs' prototype
01e,22aug01,hdn moved GDT and GDT_ENTRIES to regsI86.h
01d,13may98,hdn added PAGE_SIZE_XXX and _ASMLANGUAGE macros.
01c,07jan95,hdn added GDT and GDT_ENTRIES.
01b,01nov94,hdn added MMU_STATE_CACHEABLE_WT for Pentium.
01a,26jul93,hdn written based on mc68k's version.
*/
#ifndef __INCmmuI86Libh
#define __INCmmuI86Libh
#ifdef __cplusplus
extern "C" {
#endif
#define PAGE_SIZE 0x1000
#define PAGE_BLOCK_SIZE 0x400000
#define PAGE_SIZE_4KB 0x1000
#define PAGE_SIZE_4MB 0x400000
#define N_PTES 1024
#define N_PDES 1024
#define DIRECTORY_BITS 0xffc00000
#define TABLE_BITS 0x003ff000
#define OFFSET_BITS_4KB 0x00000fff
#define DIRECTORY_INDEX 22
#define TABLE_INDEX 12
#define PTE_TO_ADDR_4KB 0xfffff000
#define PTE_INVALID PTE_TO_ADDR_4KB
#define PDE_INVALID PTE_INVALID
#define ADDR_TO_PAGE 12
#define ADDR_TO_PAGEBASE 0xffc00000
#ifndef _ASMLANGUAGE
typedef struct
{
unsigned present:1;
unsigned rw:1;
unsigned us:1;
unsigned pwt:1;
unsigned pcd:1;
unsigned access:1;
unsigned dirty:1;
unsigned zero:2;
unsigned avail:3;
unsigned page:20;
} PTE_FIELD;
typedef union pte
{
PTE_FIELD field;
unsigned int bits;
} PTE;
typedef struct mmuTransTblStruct
{
PTE *pDirectoryTable;
INT32 pageSize; /* Fixed size 4K or 4M if !mixed */
BOOL mixed; /* TRUE if mixed size pages */
} MMU_TRANS_TBL;
#define MMU_STATE_MASK_VALID 0x001
#define MMU_STATE_MASK_WRITABLE 0x002
#define MMU_STATE_MASK_USER 0x004
#define MMU_STATE_MASK_PROTECTION 0x006
#define MMU_STATE_MASK_WRITETHROUGH 0x008
#define MMU_STATE_MASK_WBACK 0x008
#define MMU_STATE_MASK_CACHEABLE 0x018 /* 0x018 was 0x10 in AE version */
#define MMU_STATE_MASK_GLOBAL 0x100
#define MMU_STATE_MASK_STATE 0x11f
#define MMU_STATE_VALID 0x001
#define MMU_STATE_VALID_NOT 0x000
#define MMU_STATE_WRITABLE 0x002
#define MMU_STATE_WRITABLE_NOT 0x000
#define MMU_STATE_USER 0x004
#define MMU_STATE_USER_NOT 0x000
#define MMU_STATE_WRITETHROUGH 0x008
#define MMU_STATE_WBACK 0x000
#define MMU_STATE_COPYBACK 0x000
#define MMU_STATE_CACHEABLE_NOT 0x018 /* 0x18 was 0x10 in AE version */
#define MMU_STATE_WBACK_NOT MMU_STATE_CACHEABLE_NOT
#define MMU_STATE_CACHEABLE 0x000
#define MMU_STATE_GLOBAL 0x100
#define MMU_STATE_GLOBAL_NOT 0x000
#define MMU_STATE_SUP_RO (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE_NOT) /* 0x0 */
#define MMU_STATE_USR_RO (MMU_STATE_USER | MMU_STATE_WRITABLE_NOT) /* 0x4 */
#define MMU_STATE_SUP_RW (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE) /* 0x2 */
#define MMU_STATE_USR_RW (MMU_STATE_USER | MMU_STATE_WRITABLE) /* 0x6 */
/* wpOff is used to temporarily override supervisor write-protection.
* When using wpOff, interrupts should
* be locked because this disables write-protection system wide!
* Before unlocking interrupts, be sure to do a wpOn().
*/
#define wpOff() vxCr0Set (vxCr0Get() & 0xfffeffff)
#define wpOn() vxCr0Set (vxCr0Get() | 0x00010000)
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS mmuI86LibInit (int pageSize);
extern STATUS mmuI86Enable (BOOL enable);
extern void mmuI86On ();
extern void mmuI86Off ();
extern void mmuI86TLBFlush ();
extern void mmuI86PdbrSet (MMU_TRANS_TBL *transTbl);
extern void mmuI86Show (MMU_TRANS_TBL *transTbl, void * vaddr);
extern MMU_TRANS_TBL *mmuI86PdbrGet ();
#else /* __STDC__ */
extern STATUS mmuI86LibInit ();
extern STATUS mmuI86Enable ();
extern void mmuI86On ();
extern void mmuI86Off ();
extern void mmuI86TLBFlush ();
extern void mmuI86PdbrSet ();
extern void mmuI86Show ();
extern MMU_TRANS_TBL *mmuI86PdbrGet ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuI86Libh */
+222
View File
@@ -0,0 +1,222 @@
/* mmuPro32Lib.h - mmuPpro32Lib header for i86. */
/*
* Copyright (c) 1984-2003, 2009, 2011, 2014, 2018 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01k,18jul18,hbu kernel page table isolation support (F10571)
01j,02may14,jb VXW6-81787 - add Intel Write Combining Option
01i,19jan11,jb Fix for WIND00185635 - mmu deoptimize locks do not work
01h,08sep09,rbc WIND00177961 - vmStateSet() can no longer been called from an
ISR
01g,21apr09,rbc Page Table Optimization.
01f,09dec03,zmm Ported to Base6 from AE version of mmuPro32Lib.h 01f,30nov99
01e,12jun02,hdn added arch specific VM library APIs' prototype
01d,23may02,hdn replaced PAGE_SIZE with PD_SIZE and PT_SIZE
01c,22aug01,hdn moved GDT and GDT_ENTRIES to regsI86.h
01b,13may98,hdn added _ASMLANGUAGE macro.
01a,11apr97,hdn written.
*/
#ifndef __INCmmuPro32Libh
#define __INCmmuPro32Libh
#ifdef __cplusplus
extern "C" {
#endif
#define PAGE_SIZE 0x1000
#define PAGE_BLOCK_SIZE 0x400000
#define PAGE_SIZE_4KB 0x1000
#define PAGE_SIZE_4MB 0x400000
#ifdef _WRS_CONFIG_KPTI
#define PD_TBL_SIZE (2 * PAGE_SIZE_4KB)
#define MMU_UMTBL_OFFSET (PAGE_SIZE_4KB)
#else
#define PD_TBL_SIZE PAGE_SIZE_4KB
#endif
#define N_PTES 1024
#define N_PDES 1024
#define DIRECTORY_BITS 0xffc00000
#define TABLE_BITS 0x003ff000
#define OFFSET_BITS_4KB 0x00000fff
#define OFFSET_BITS_4MB 0x003fffff
#define DIRECTORY_INDEX 22
#define TABLE_INDEX 12
#define PTE_TO_ADDR_4KB 0xfffff000
#define PTE_TO_ADDR_4MB 0xffc00000
#define PTE_INVALID PTE_TO_ADDR_4KB
#define PDE_INVALID PTE_TO_ADDR_4MB
#define PAGES_PER_BLOCK 0x400
#define ADDR_TO_PAGE 12
#define ADDR_TO_PAGEBASE 22
#ifndef _ASMLANGUAGE
#define PAGE_TABLE_PRESENT 1
#define PAGE_TABLE_RW 1
#define PAGE_TABLE_US 1
#define PAGE_TABLE_PWT 1
#define PAGE_TABLE_PCD 1
#define PAGE_TABLE_ACCESS 1
#define PAGE_TABLE_DIRTY 1
#define PAGE_TABLE_4KB 0
#define PAGE_TABLE_4MB 1
#define PAGE_TABLE_GLOBAL 1
/* Define use of hardware available bits */
#define PAGE_TABLE_AVAIL_MASK 0x7
#define PAGE_TABLE_MASK_NO_BLOCK 0x1
#define PAGE_TABLE_NO_BLOCK 0x1
typedef struct
{
unsigned present:1;
unsigned rw:1;
unsigned us:1;
unsigned pwt:1;
unsigned pcd:1;
unsigned access:1;
unsigned dirty:1;
unsigned pagesize:1;
unsigned global:1;
unsigned avail:3;
unsigned page:20;
} PTE_FIELD;
typedef union pte
{
PTE_FIELD field;
unsigned int bits;
} PTE;
typedef struct mmuTransTblStruct
{
PTE *pDirectoryTable;
PTE *pAltDirectoryTable;
VX_SEMAPHORE(mmuTransTblSem);
} MMU_TRANS_TBL;
#if (_VX_CPU != _VX_PENTIUM)
typedef union mmuPatReg
{
UINT64 mmuFullPat;
UINT32 mmuHalfPat[2];
UCHAR mmuCharPat[8];
} MMU_PAT_REG;
#define IA32_PAT_MSR 0x277
#define IA32_PAT_WC_IDX 0x02
#define IA32_PAT_WC 0x01
#endif /* (_VX_CPU != _VX_PENTIUM) */
#define MMU_STATE_MASK_VALID 0x001
#define MMU_STATE_MASK_WRITABLE 0x002
#define MMU_STATE_MASK_USER 0x004
#define MMU_STATE_MASK_PROTECTION 0x006
#define MMU_STATE_MASK_WRITETHROUGH 0x008
#define MMU_STATE_MASK_WBACK 0x008
#define MMU_STATE_MASK_CACHEABLE 0x018 /* 0x018 was 0x10 in AE version */
#define MMU_STATE_MASK_GLOBAL 0x100
#define MMU_STATE_MASK_NO_BLOCK 0x200
#ifdef _WRS_CONFIG_KPTI
#define MMU_STATE_MASK_UMPT 0x800
#define MMU_STATE_MASK_STATE 0xb1f
#else
#define MMU_STATE_MASK_STATE 0x31f
#endif
#define MMU_STATE_VALID 0x001
#define MMU_STATE_VALID_NOT 0x000
#define MMU_STATE_WRITABLE 0x002
#define MMU_STATE_WRITABLE_NOT 0x000
#define MMU_STATE_USER 0x004
#define MMU_STATE_USER_NOT 0x000
#define MMU_STATE_WRITETHROUGH 0x008
#define MMU_STATE_WBACK 0x000
#define MMU_STATE_COPYBACK 0x000
#define MMU_STATE_CACHEABLE_NOT 0x018 /* 0x18 was 0x10 in AE version */
#define MMU_STATE_WBACK_NOT MMU_STATE_CACHEABLE_NOT
#if (_VX_CPU != _VX_PENTIUM)
#define MMU_STATE_MASK_WCOMBINE MMU_STATE_MASK_CACHEABLE
#define MMU_STATE_WCOMBINE 0x010 /* This requires mod to default PAT Table */
#define MMU_STATE_WCOMBINE_NOT 0x000
#endif /* (_VX_CPU != _VX_PENTIUM) */
#define MMU_STATE_CACHEABLE 0x000
#define MMU_STATE_GLOBAL 0x100
#define MMU_STATE_GLOBAL_NOT 0x000
#define MMU_STATE_NO_BLOCK 0x200
#define MMU_STATE_NO_BLOCK_NOT 0x000
#ifdef _WRS_CONFIG_KPTI
#define MMU_STATE_UMPT 0x800
#define MMU_STATE_UMPT_NOT 0x000
#endif
#define MMU_STATE_SUP_RO (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE_NOT) /* 0x0 */
#define MMU_STATE_USR_RO (MMU_STATE_USER | MMU_STATE_WRITABLE_NOT) /* 0x4 */
#define MMU_STATE_SUP_RW (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE) /* 0x2 */
#define MMU_STATE_USR_RW (MMU_STATE_USER | MMU_STATE_WRITABLE) /* 0x6 */
/* wpOff is used to temporarily override supervisor write-protection.
* When using wpOff, interrupts should
* be locked because this disables write-protection system wide!
* Before unlocking interrupts, be sure to do a wpOn().
*/
#define wpOff() vxCr0Set (vxCr0Get() & 0xfffeffff)
#define wpOn() vxCr0Set (vxCr0Get() | 0x00010000)
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS mmuPro32LibInit (int pageSize);
extern STATUS mmuPro32Enable (BOOL enable);
extern void mmuPro32On ();
extern void mmuPro32Off ();
extern void mmuPro32TLBFlush ();
extern void mmuPro32PdbrSet (MMU_TRANS_TBL *transTbl);
extern void mmuPro32Show (MMU_TRANS_TBL *transTbl, void * vaddr);
extern MMU_TRANS_TBL *mmuPro32PdbrGet ();
#else /* __STDC__ */
extern STATUS mmuPro32LibInit ();
extern STATUS mmuPro32Enable ();
extern void mmuPro32On ();
extern void mmuPro32Off ();
extern void mmuPro32TLBFlush ();
extern void mmuPro32PdbrSet ();
extern void mmuPro32Show ();
extern MMU_TRANS_TBL *mmuPro32PdbrGet ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuPro32Libh */
+170
View File
@@ -0,0 +1,170 @@
/* mmuPro36Lib.h - mmuPro36Lib header for i86. */
/* Copyright 1984-2002, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01g,29apr10,pad Moved extern C statement after include statements.
01f,07apr04,scm Ported to Base6 ...
01e,12jun02,hdn added arch specific VM library APIs' prototype
01d,06jun02,hdn replaced PAGE_SIZE with PD_SIZE and PT_SIZE
01c,22aug01,hdn moved GDT and GDT_ENTRIES to regsI86.h
01b,13may98,hdn added _ASMLANGUAGE macro.
01a,11apr97,hdn written.
*/
#ifndef __INCmmuPro36Libh
#define __INCmmuPro36Libh
#include "arch/i86/pentiumLib.h"
#ifdef __cplusplus
extern "C" {
#endif
#define PAGE_SIZE_4KB 0x1000
#define PAGE_SIZE_2MB 0x200000
#define PAGE_BLOCK_SIZE 0x200000
#define N_PTPTRS 4
#define N_PTES 512
#define N_PDES 512
#define DIR_PTR_BITS 0xc0000000
#define DIR_BITS 0x3fe00000
#define TBL_BITS 0x001ff000
#define OFFSET_BITS_4KB 0x00000fff
#define OFFSET_BITS_2MB 0x001fffff
#define DIR_PTR_BITS 0xc0000000
#define DIR_BITS 0x3fe00000
#define TBL_BITS 0x001ff000
#define DIR_PTR_INDEX 30
#define DIR_INDEX 21
#define TBL_INDEX 12
#define PTE_TO_ADDR_4KB 0xfffff000
#define PTE_TO_ADDR_2MB 0xffe00000
#define PDP_TO_ADDR 0xfffff000
#define PTE_INVALID PTE_TO_ADDR_4KB
#define PDE_INVALID PTE_INVALID
#define ADDR_TO_PAGE 12
#define ADDR_TO_PAGEBASE 0xffe00000
#ifndef _ASMLANGUAGE
typedef struct
{
unsigned present:1;
unsigned rw:1;
unsigned us:1;
unsigned pwt:1;
unsigned pcd:1;
unsigned access:1;
unsigned dirty:1;
unsigned pagesize:1;
unsigned global:1;
unsigned avail:3;
unsigned page:20;
unsigned page36:4;
unsigned reserved:28;
} PTE_FIELD;
typedef union pte
{
PTE_FIELD field;
UINT bits[2];
} PTE;
typedef struct mmuTransTblStruct
{
PTE * pDirectoryPtrTable; /* pointer to dir ptr tbl */
INT32 pageSize; /* 4K, 2M */
} MMU_TRANS_TBL;
#define MMU_STATE_MASK_VALID 0x001
#define MMU_STATE_MASK_WRITABLE 0x002
#define MMU_STATE_MASK_USER 0x004
#define MMU_STATE_MASK_PROTECTION 0x006
#define MMU_STATE_MASK_WRITETHROUGH 0x008
#define MMU_STATE_MASK_WBACK 0x008
#define MMU_STATE_MASK_CACHEABLE 0x018 /* 0x018 was 0x10 in AE version */
#define MMU_STATE_MASK_GLOBAL 0x100
#define MMU_STATE_MASK_STATE 0x11f
#define MMU_STATE_VALID 0x001
#define MMU_STATE_VALID_NOT 0x000
#define MMU_STATE_WRITABLE 0x002
#define MMU_STATE_WRITABLE_NOT 0x000
#define MMU_STATE_USER 0x004
#define MMU_STATE_USER_NOT 0x000
#define MMU_STATE_WRITETHROUGH 0x008
#define MMU_STATE_WBACK 0x000
#define MMU_STATE_COPYBACK 0x000
#define MMU_STATE_CACHEABLE_NOT 0x018 /* 0x18 was 0x10 in AE version */
#define MMU_STATE_WBACK_NOT MMU_STATE_CACHEABLE_NOT
#define MMU_STATE_CACHEABLE 0x000
#define MMU_STATE_GLOBAL 0x100
#define MMU_STATE_GLOBAL_NOT 0x000
#define MMU_STATE_SUP_RO (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE_NOT) /* 0x0 */
#define MMU_STATE_USR_RO (MMU_STATE_USER | MMU_STATE_WRITABLE_NOT) /* 0x4 */
#define MMU_STATE_SUP_RW (MMU_STATE_USER_NOT | MMU_STATE_WRITABLE) /* 0x2 */
#define MMU_STATE_USR_RW (MMU_STATE_USER | MMU_STATE_WRITABLE) /* 0x6 */
/* wpOff is used to temporarily override supervisor write-protection.
* When using wpOff, interrupts should
* be locked because this disables write-protection system wide!
* Before unlocking interrupts, be sure to do a wpOn().
*/
#define wpOff() vxCr0Set (vxCr0Get() & 0xfffeffff)
#define wpOn() vxCr0Set (vxCr0Get() | 0x00010000)
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS mmuPro36LibInit (int pageSize);
extern STATUS mmuPro36Enable (BOOL enable);
extern void mmuPro36On ();
extern void mmuPro36Off ();
extern void mmuPro36TLBFlush ();
extern void mmuPro36PdbrSet (MMU_TRANS_TBL *transTbl);
extern void mmuPro36Show (MMU_TRANS_TBL *transTbl, VIRT_ADDR vaddr);
extern MMU_TRANS_TBL *mmuPro36PdbrGet ();
#else /* __STDC__ */
extern STATUS mmuPro36LibInit ();
extern STATUS mmuPro36Enable ();
extern void mmuPro36On ();
extern void mmuPro36Off ();
extern void mmuPro36TLBFlush ();
extern void mmuPro36PdbrSet ();
extern void mmuPro36Show ();
extern MMU_TRANS_TBL *mmuPro36PdbrGet ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCmmuPro36Libh */
+176
View File
@@ -0,0 +1,176 @@
/* pentiumLib.h - system dependent routines header */
/*
* Copyright 1997, 2001-2002, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01g,21may12,c_t Add pentiumUsDelay.(WIND00338455)
01f,04may11,scm WIND00238999, adjust parameters for 64 bits...
01e,29apr10,pad Moved extern C statement after include statements.
01d,15jun02,hdn added LL_UNION typedef for 36bit MMU support
01c,01nov01,hdn added PENTIUM_MSR, pentiumMsrInit/Show's prototype
01b,21aug01,hdn included regs.h for MTRR_ID.
added P5/P6 PMC routines.
01a,09jul97,hdn written
*/
#ifndef __INCpentiumLibh
#define __INCpentiumLibh
#ifndef _ASMLANGUAGE
#include "regs.h"
#ifdef __cplusplus
extern "C" {
#endif
/* typedefs */
typedef long long int LL_INT;
typedef union llUnion
{
long long int i64; /* 64bit integer */
int i32[2]; /* 32bit integer * 2 */
} LL_UNION;
typedef struct pentiumMsr
{
INT32 addr; /* address of the MSR */
INT8 * name; /* name of the MSR */
} PENTIUM_MSR;
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern int pentiumCr4Get (void);
extern void pentiumCr4Set (size_t cr4);
extern STATUS pentiumPmcStart (int pmcEvtSel0, int pmcEvtSel1);
extern STATUS pentiumPmcStart0 (int pmcEvtSel0);
extern STATUS pentiumPmcStart1 (int pmcEvtSel1);
extern void pentiumPmcStop (void);
extern void pentiumPmcStop0 (void);
extern void pentiumPmcStop1 (void);
extern void pentiumPmcGet (long long int * pPmc0,
long long int * pPmc1);
extern void pentiumPmcGet0 (long long int * pPmc0);
extern void pentiumPmcGet1 (long long int * pPmc1);
extern void pentiumPmcReset (void);
extern void pentiumPmcReset0 (void);
extern void pentiumPmcReset1 (void);
extern STATUS pentiumP6PmcStart (int pmcEvtSel0, int pmcEvtSel1);
extern void pentiumP6PmcStop (void);
extern void pentiumP6PmcStop1 (void);
extern void pentiumP6PmcGet (long long int * pPmc0,
long long int * pPmc1);
extern void pentiumP6PmcGet0 (long long int * pPmc0);
extern void pentiumP6PmcGet1 (long long int * pPmc1);
extern void pentiumP6PmcReset (void);
extern void pentiumP6PmcReset0 (void);
extern void pentiumP6PmcReset1 (void);
extern STATUS pentiumP5PmcStart0 (int cesr);
extern STATUS pentiumP5PmcStart1 (int cesr);
extern void pentiumP5PmcStop0 (void);
extern void pentiumP5PmcStop1 (void);
extern void pentiumP5PmcGet (long long int * pPmc0,
long long int * pPmc1);
extern void pentiumP5PmcGet0 (long long int * pPmc0);
extern void pentiumP5PmcGet1 (long long int * pPmc1);
extern void pentiumP5PmcReset (void);
extern void pentiumP5PmcReset0 (void);
extern void pentiumP5PmcReset1 (void);
extern void pentiumTscGet64 (long long int * pTsc);
extern UINT32 pentiumTscGet32 (void);
extern void pentiumTscReset (void);
extern void pentiumMsrGet (size_t addr, long long int * pData);
extern void pentiumMsrSet (size_t addr, long long int * pData);
extern void pentiumTlbFlush (void);
extern void pentiumSerialize (void);
extern STATUS pentiumBts (char * pFlag);
extern STATUS pentiumBtc (char * pFlag);
extern void pentiumMtrrEnable (void);
extern void pentiumMtrrDisable (void);
extern STATUS pentiumMtrrGet (MTRR_ID pMtrr);
extern STATUS pentiumMtrrSet (MTRR_ID pMtrr);
extern void pentiumPmcShow (BOOL zap);
extern STATUS pentiumMsrInit (void);
extern void pentiumMsrShow (void);
extern void pentiumMcaEnable (BOOL enable);
extern void pentiumMcaShow (void);
extern void pentiumTSCDelay (int uSec);
#else /* __STDC__ */
extern int pentiumCr4Get ();
extern void pentiumCr4Set ();
extern STATUS pentiumPmcStart ();
extern STATUS pentiumPmcStart0 ();
extern STATUS pentiumPmcStart1 ();
extern void pentiumPmcStop ();
extern void pentiumPmcStop0 ();
extern void pentiumPmcStop1 ();
extern void pentiumPmcGet ();
extern void pentiumPmcGet0 ();
extern void pentiumPmcGet1 ();
extern void pentiumPmcReset ();
extern void pentiumPmcReset0 ();
extern void pentiumPmcReset1 ();
extern STATUS pentiumP6PmcStart ();
extern void pentiumP6PmcStop ();
extern void pentiumP6PmcStop1 ();
extern void pentiumP6PmcGet ();
extern void pentiumP6PmcGet0 ();
extern void pentiumP6PmcGet1 ();
extern void pentiumP6PmcReset ();
extern void pentiumP6PmcReset0 ();
extern void pentiumP6PmcReset1 ();
extern STATUS pentiumP5PmcStart0 ();
extern STATUS pentiumP5PmcStart1 ();
extern void pentiumP5PmcStop0 ();
extern void pentiumP5PmcStop1 ();
extern void pentiumP5PmcGet ();
extern void pentiumP5PmcGet0 ();
extern void pentiumP5PmcGet0 ();
extern void pentiumP5PmcGet1 ();
extern void pentiumP5PmcReset ();
extern void pentiumP5PmcReset0 ();
extern void pentiumTscGet64 ();
extern UINT32 pentiumTscGet32 ();
extern void pentiumTscReset ();
extern void pentiumMsrGet ();
extern void pentiumMsrSet ();
extern void pentiumTlbFlush ();
extern void pentiumSerialize ();
extern STATUS pentiumBts ();
extern STATUS pentiumBtc ();
extern void pentiumMtrrEnable ();
extern void pentiumMtrrDisable ();
extern STATUS pentiumMtrrGet ();
extern STATUS pentiumMtrrSet ();
extern void pentiumPmcShow ();
extern STATUS pentiumMsrInit ();
extern void pentiumMsrShow ();
extern void pentiumMcaEnable ();
extern void pentiumMcaShow ();
extern void pentiumTSCDelay ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCpentiumLibh */
+266
View File
@@ -0,0 +1,266 @@
/* perMonLib.h - Performance Monitoring mechanism definitions header file */
/* Copyright 2001 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,30jul01,hdn written
*/
#ifndef __INCperMonLibh
#define __INCperMonLibh
#ifdef __cplusplus
extern "C" {
#endif
/* performance monitoring, number of counters, etc */
#define PM_N_COUNTER 18
#define EVENT_N_ESCR 2
#define EVENT_N_COUNTER 3
#define MSR_N_ESCR 8
/* performance monitoring event name/no */
#define PM_BRANCH_RETIRED 0
#define PM_MISPRED_BRANCH_RETIRED 1
#define PM_TC_DELIVER_MODE 2
#define PM_BPU_FETCH_REQUEST 3
#define PM_ITLB_REFERENCE 4
#define PM_MEMORY_CANCEL 5
#define PM_MEMORY_COMPLETE 6
#define PM_LOAD_PORT_REPLAY 7
#define PM_STORE_PORT_REPLAY 8
#define PM_MOB_LOAD_REPLAY 9
#define PM_PAGE_WALK_TYPE 10
#define PM_BSQ_2NDL_CACHE_REF 11
#define PM_IOQ_ALLOCATION 12
#define PM_FSB_DATA_ACTIVITY 13
#define PM_BSQ_ALLOCATION 14
#define PM_X87_ASSIST 15
#define PM_SSE_INPUT_ASSIST 16
#define PM_PACKED_SP_UOP 17
#define PM_PACKED_DP_UOP 18
#define PM_SCALAR_SP_UOP 19
#define PM_SCALAR_DP_UOP 20
#define PM_64BIT_MMX_UOP 21
#define PM_128BIT_MMX_UOP 22
#define PM_X87_FP_UOP 23
#define PM_X87_SIMD_MOVES_UOP 24
#define PM_MACHINE_CLEAR 25
#define PM_FRONT_END_EVENT 26
#define PM_EXECUTION_EVENT 27
#define PM_REPLAY_EVENT 28
#define PM_INSTR_RETIRED 29
#define PM_UOPS_RETIRED 30
/* metrics available for Front_end Tagging */
#define FRONT_MEMORY_LOADS 0
#define FRONT_MEMORY_STORES 1
/* metrics available for Execution Tagging */
#define EXEC_PACKED_SP_RETIRED 0
#define EXEC_PACKED_DP_RETIRED 1
#define EXEC_SCALAR_SP_RETIRED 2
#define EXEC_SCALAR_DP_RETIRED 3
#define EXEC_128BIT_MMX_RETIRED 4
#define EXEC_64BIT_MMX_RETIRED 5
#define EXEC_X87_FP_RETIRED 6
#define EXEC_X87_SIMD_MM_RETIRED 7
/* metrics available for Replay Tagging */
#define REPLAY_1CACHE_LOAD_MISS_RETIRED 0
#define REPLAY_2CACHE_LOAD_MISS_RETIRED 1
#define REPLAY_DTLB_LOAD_MISS_RETIRED 2
#define REPLAY_DTLB_STORE_MISS_RETIRED 3
#define REPLAY_DTLB_ALL_MISS_RETIRED 4
#define REPLAY_MOB_LOAD_REPLAY_RETIRED 5
#define REPLAY_SPLIT_LOAD_RETIRED 6
#define REPLAY_SPLIT_STORE_RETIRED 7
/* event mask available for Replay Tagging */
#define PARTIAL_DATA 0x10
#define UNALIGN_ADDR 0x20
#define SPLIT_LD 0x02
#define SPLIT_ST 0x02
/* CCCR bit definitions */
#define CCCR_ENABLE 0x00001000
#define CCCR_ENABLE_NOT 0xffffefff
#define CCCR_ESCR_SELECT 0x0000e000
#define CCCR_RSVD 0x00030000
#define CCCR_COMPARE 0x00040000
#define CCCR_COMPLIMENT 0x00080000
#define CCCR_THRESHOLD 0x00f00000
#define CCCR_EDGE 0x01000000
#define CCCR_FORCE_OVF 0x02000000
#define CCCR_OVF_PMI 0x04000000
#define CCCR_CASCADE 0x40000000
#define CCCR_OVF 0x80000000
/* ESCR bit definitions */
#define ESCR_USR 0x00000004
#define ESCR_OS 0x00000008
#define ESCR_TAG_ENABLE 0x00000010
#define ESCR_TAG_VALUE 0x000001e0
#define ESCR_EVENT_MASK 0x01fffe00
#define ESCR_EVENT_SELECT 0x7e000000
/* Replay Event Mask definitions */
#define REPLAY_NBOGUS 0x00000001
#define REPLAY_BOGUS 0x00000002
/* Execution Event Mask definitions */
#define EXEC_NBOGUS0 0x00000001
#define EXEC_NBOGUS1 0x00000002
#define EXEC_NBOGUS2 0x00000004
#define EXEC_NBOGUS3 0x00000008
#define EXEC_BOGUS0 0x00000010
#define EXEC_BOGUS1 0x00000020
#define EXEC_BOGUS2 0x00000040
#define EXEC_BOGUS3 0x00000080
#ifndef _ASMLANGUAGE
typedef struct perMonMsr /* PM CCCR-ESCR table */
{
short counter;
short cccr;
short escr[MSR_N_ESCR];
} PER_MON_MSR;
typedef struct perMonMsrUse /* PM MSRs selected and its value */
{
BOOL used;
int escrMsr;
int counterValue;
int cccrValue;
int escrValue;
int pebsEnable;
int pebsMatrix;
} PER_MON_MSR_USE;
typedef struct perMonEvent /* PM event table */
{
char * name;
short escr[EVENT_N_ESCR];
char counterNo[EVENT_N_ESCR][EVENT_N_COUNTER];
int eventSelect;
int eventMask;
int cccrSelect;
BOOL pebs;
} PER_MON_EVENT;
typedef struct perMonReplayTag /* Replay Tagging Metrics table */
{
char * name;
int pebsEnable;
int pebsMatrix;
int upEvent;
int upEventMask;
int eventMask;
} PER_MON_REPLAY_TAG;
typedef struct perMonExecTag /* Execution Tagging Metrics table */
{
char * name;
int upEvent;
int upEventMask;
int upTagValue;
int eventMask;
} PER_MON_EXEC_TAG;
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern void perMonLibInit (void);
extern STATUS perMonInt (void);
extern int perMonCget32 (int counterNo);
extern long long int perMonCget40 (int counterNo);
extern void perMonCenable (int cccr);
extern void perMonCdisable (int cccr);
extern void perMonIntEnable (void);
extern void perMonIntDisable (void);
extern int perMonCccrGet (int counterNo, PER_MON_MSR_USE * pMsrUse);
extern void perMonCccrSet (int counterNo, int value,
PER_MON_MSR_USE *pMsrUse);
extern int perMonEscrGet (int counterNo, PER_MON_MSR_USE *pMsrUse);
extern void perMonEscrSet (int counterNo, int value,
PER_MON_MSR_USE *pMsrUse);
extern void perMonOsSet (int counterNo, PER_MON_MSR_USE * pMsrUse);
extern void perMonUsrSet (int counterNo, PER_MON_MSR_USE * pMsrUse);
extern void perMonIntSet (int counterNo, PER_MON_MSR_USE * pMsrUse);
extern void perMonIntClear (int counterNo, PER_MON_MSR_USE * pMsrUse);
extern void perMonCset (int counterNo, long long int * pValue);
extern void perMonCstart (int counterNo);
extern void perMonCstop (int counterNo);
extern STATUS perMonEventSelect (int event, int escrMsr, int counterNo,
int eventMask, int * pCounterMsr,
int * pCccrMsr, int * pCccrValue,
int * pEscrValue);
extern STATUS perMonReplaySelect (int metric, int * pUpEvent, int * pUpEventM,
int * pPebsEnable, int * pPebsMatrix,
int * pEventMask);
extern STATUS perMonExecSelect (int metric, int * pUpEvent, int * pUpEventM,
int * pUpTagValue, int * pEventMask);
extern STATUS perMonEventSet (int event, int escrMsr, int counterNo,
int eventMask, int metric, int upEventNo,
int upEscrMsr, int upCounterNo,
PER_MON_MSR_USE * pMsrUse);
extern STATUS perMonMsrSet (PER_MON_MSR_USE * pMsrUse);
#else /* __STDC__ */
extern void perMonLibInit ();
extern STATUS perMonInt ();
extern int perMonCget32 ();
extern long long int perMonCget40 ();
extern void perMonCenable ();
extern void perMonCdisable ();
extern void perMonIntEnable ();
extern void perMonIntDisable ();
extern int perMonCccrGet ();
extern void perMonCccrSet ();
extern int perMonEscrGet ();
extern void perMonEscrSet ();
extern void perMonOsSet ();
extern void perMonUsrSet ();
extern void perMonIntSet ();
extern void perMonIntClear ();
extern void perMonCset ();
extern void perMonCstart ();
extern void perMonCstop ();
extern STATUS perMonEventSelect ();
extern STATUS perMonReplaySelect ();
extern STATUS perMonExecSelect ();
extern STATUS perMonEventSet ();
extern STATUS perMonMsrSet ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCperMonLibh */
@@ -0,0 +1,421 @@
/* smpI86P.h - i80x86 private SMP assembler definitions header file */
/*
* Copyright (c) 2006-2013, 2018 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
02n,18jul18,r_h Add kernel page table isolation support (F10571)
02m,16may13,scm WIND00417700 SMP diab macro correction...
02l,09jan13,scm WIND00229494 - SMP dedicated segment register
02k,20dec12,yjw clear warning when load symbol table.(WIND00380360)
02j,11sep12,cwl Correct the macro _WRS_WIND_VARS_ARCH_GET for UP.
(WIND00375599)
02i,27jan12,scm WIND00326315 - live lock osm & cpc issue...
02h,10aug11,zl added _WRS_CPU_SMTSET_GET()
02g,04jan11,scm WIND00248698 adjust vxIntStackEnabled to type BOOL...
02f,12nov10,pch CQ240922: exclude refs to OSM when small footprint selected
02e,25oct10,rbc WIND00204240 - Add support for objVerifiedSafe.
02d,29jul10,pad Moved extern C statement after include statements.
02c,24may10,jb Mods for SMP M-N support
02b,05may10,jl add support for SMP GuestOS
02a,07may09,pee using generated offsets. Removing hardcoded offsets.
01z,15may09,gls moved VX_INSTR_BARRIER() to vxAtomicArchLibCommon.h
01y,12feb09,sem Added sysCr3 to the WIND_VARS_ARCH struct
Added sysCr3 access macros
01x,18sep08,gls added _WRS_KERNEL_LOCK_VAR_ALIGN
01w,27aug08,jpb Renamed VSB header file
01v,30jul08,rbc Fix undefines for _IA32_LOC_APIC_ID...
01u,24jun08,jpb Added include path for kernel configurations options set in
vsb. Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP.
01t,20jun08,zl replaced _WRS_ASM() with _WRS_BARRIER()
01s,22apr08,zl ensure 32-bit _IA32_LOC_APIC_ID register access.
01r,10jan08,gls added VX_INSTR_BARRIER()
01q,01aug07,scm optimize _WRS_CPU_INDEX_GET()...
01p,31may07,scm add _IA32_CPU_ADRS_BASE_GET macro...
01o,04may07,scm correct _IA32_PER_CPU_VALUE_SET macro...
01m,17apr07,kk move VX_MAX_SMP_CPUS to archI86.h
01l,11dec06,kk removed references to VX_KERNEL_VARS define, no longer needed
01k,06dec06,scm correct macro for GNU compiler support...
01j,28nov06,scm remove def for _WRS_WIND_VARS_OFFSET_archVars...
01i,02nov06,scm rename pSysGdtCurrent for backward comp with P2/3/4...
01h,26oct06,scm add per Cpu OSM Scratch memory space for GDT data manipulation
01g,05oct06,scm add translation to _IA32_CPU_INDEX_GET...
01f,03oct06,scm additional macro work...
01e,15sep06,scm add specific vxKernelVars[] support...
01d,30aug06,scm expand _WRS_WIND_VARS_ARCH...
01c,21aug06,jb Combining smpI86P.h and vxCpuLibP.h
01b,01aug06,scm more SMP work...
01a,21jul06,scm created, added SMP Support Macros...
*/
#ifndef __INCasmI86Ph
#define __INCasmI86Ph
/************************************************************/
#include <vsbConfig.h>
#include <arch/i86/archI86.h>
#include <arch/i86/regsI86.h>
#include <private/kernelLockLibP.h>
#include <hwif/cpu/arch/i86/vxCpuIdLib.h>
#ifdef __cplusplus
extern "C" {
#endif
#define _WRS_ARCH_SUPPORTS_VX_CPU_STATE_INIT
/*
* 0xFEE00020 is the address of the local APIC ID Register.
*/
#define _IA32_LOC_APIC_ID 0xFEE00020
#define _IA32_CPU_INDEX_SHIFT (0x18)
#define _IA32_CPU_INDEX_MASK (0xFF)
#ifdef _WRS_CONFIG_SMP
/*
* IA32 has been adapted to use the new object safe count feature for SMP.
* When all architectures have been adapted this can be removed from
* the code.
*/
#define _WRS_ARCH_HAS_OBJ_SAFE
/*
* This macro defines the alignment requirement for the WIND_VARS structure.
*
* There are 3 factors involved in selection of this value.
*
* 1. It's definition is no LESS than the maximum value of
* _CPU_CACHE_ALIGN_SIZE, and may be larger to provide for future
* cache line length growth.
* 2. It must be at least as large as the WIND_VARS structure.
* 3. It must be a power of 2.
*
* For example:
* If WIND_VARS is 56 bytes, _WRS_WIND_VARS_ALIGN must be no less than 64
* (rule 1).
* If WIND_VARS is 72 bytes, _WRS_WIND_VARS_ALIGN must be no less than 128
* (rules 2 and 3).
*
* For KPTI the alignment has to match WIND_RTP_VARS_ARCH; for that, we need
* _WRS_WIND_RTP_VARS_ALIGN bytes.
*/
#ifdef _WRS_CONFIG_KPTI
#define _WRS_WIND_VARS_ALIGN _WRS_WIND_RTP_VARS_ALIGN
#define _WRS_WIND_VARS_ALIGN_SHIFT _WRS_WIND_RTP_VARS_ALIGN_SHIFT
#else
#define _WRS_WIND_VARS_ALIGN 128
#define _WRS_WIND_VARS_ALIGN_SHIFT 7
#endif
/*
* Much like the _WRS_WIND_VARS_ALIGN the _WRS_KERNEL_LOCK_VAR_ALIGN macro
* must be defined for the common CPU build variants (e.g. PPC32, MIPS32,
* XSCALE, etc), representing the maximum cache line size of the variants of
* the respective arch.
*
* For x86 this is 128 bytes.
*/
#define _WRS_KERNEL_LOCK_VAR_ALIGN 128
#ifndef _ASMLANGUAGE
#ifdef _WRS_CONFIG_WRHV_GUEST
/*
* wrhvVbCpuId is used to store the address of the virtual-core's cpuId.
* This global contains the virtual address for the core configuration
* and avoids making a VBI function call to get the wrhvVbConfig address
* and calculate the offset to the core id..
*/
extern UINT32 *wrhvVbCpuId;
#endif /* WRS_CONFIG_WRHV_GUEST */
/* mpCpuIndexTable is used in vxCpuArchLib.c, this gloabal avoids
* calling through vxbus and reduces overhead, table translations
* are done everywhere, but once up this table should never change...
*/
extern UINT8 mpCpuIndexTable[];
typedef struct wind_vars_arch
{
GDT *cpu_pSysGdt; /* 0x4c: Global Descriptor Table */
TSS *cpu_sysTssCurrent; /* 0x50: Task State Segmnet */
TSS *cpu_excOSMTssCurrent; /* 0x54: OSM TSS */
SEGDESC *cpu_sysOSMLdtCurrent; /* 0x58: Local Descriptor Table */
UINT32 *cpu_excOSMStackCurrent; /* 0x5c: OSM Stack */
UINT32 *cpu_sysOSMGdtScratchCurrent; /* 0x60: OSM Scratch memory */
UINT32 cpu_vxIntStackPtr; /* 0x64: Interrupt Stack Pointer */
BOOL cpu_vxIntStackEnabled; /* 0x68: Interrupt Stack Enabled */
unsigned int cpu_cpuIndex; /* 0x6c: logical cpu used by GS */
UINT32 cpu_cpuGsBaseCurrent; /* 0x70: &vxKernelVars in gsbase */
UINT32 cpu_intNest; /* 0x74: Interrupt Nested Count */
UINT32 cpu_sysCr3; /* 0x78: Local CR3 cache */
UINT32 cpu_sysOSMState; /* 0x7c: OSM State Flag */
} WIND_VARS_ARCH;
#define _WRS_WIND_VARS_ARCH WIND_VARS_ARCH cpu_archVars
/* macro to access the arch-specific fields of the vxKernelVars struct */
#define _WRS_WIND_VARS_ARCH_ACCESS(glob) \
_WRS_KERNEL_GLOBAL_ACCESS (archVars.cpu_##glob)
#define _WRS_WIND_VARS_ARCH_SET(cpuid,glob,var) \
_WRS_KERNEL_CPU_GLOBAL_SET(cpuid,archVars.cpu_##glob,var)
#define _WRS_WIND_VARS_ARCH_GET(cpuid,glob) \
_WRS_KERNEL_CPU_GLOBAL_GET(cpuid,archVars.cpu_##glob)
#define _WRS_ARCH_LOCKED_GLOBAL_SET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_SET(archVars.cpu_##glob,var)
#define _WRS_ARCH_LOCKED_GLOBAL_GET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_GET(archVars.cpu_##glob,var)
/*
* _WRS_CPU_SMTSET_GET() is used by the SMP scheduler for Hyper-Threading
* support.
*/
#define _WRS_CPU_SMTSET_GET(smtSet, cpuIx) \
smtSet = sysCpuIdTopology.__smtSet[cpuIx]
/* Fast retrieve of cpuIndex using GS Base register offset */
#if defined (__DCC__)
__asm volatile unsigned int _vxGsBaseCpuIndexGet_inline (void)
{
! "ax" /* ax is clobbered */
mov %gs:(0x6c), %eax
}
#else /* if defined (__GNUC__) */
static __inline__ unsigned int _vxGsBaseCpuIndexGet_inline (void)
{
unsigned int cpu;
__asm__ volatile ("mov %%gs:(0x6c), %%eax" \
: "=a" (cpu) : /* no input */);
return cpu;
}
#endif /* __DCC__ */
#endif /* !_ASMLANGUAGE */
#ifdef _WRS_CONFIG_WRHV_GUEST
#define _WRS_CPU_INDEX_GET() \
(*(volatile UINT32 *)wrhvVbCpuId)
#else /* _WRS_CONFIG_WRHV_GUEST */
#define _WRS_CPU_INDEX_GET() _vxGsBaseCpuIndexGet_inline ()
#endif /* _WRS_CONFIG_WRHV_GUEST */
#else /* _WRS_CONFIG_SMP */
#define _WRS_CPU_INDEX_GET() 0
/* macro to access the arch-specific fields */
#define _WRS_WIND_VARS_ARCH_ACCESS(glob) \
_WRS_KERNEL_GLOBAL_ACCESS (glob)
#define _WRS_WIND_VARS_ARCH_SET(ignored,glob,var) \
_WRS_KERNEL_CPU_GLOBAL_SET(ignored,glob,var)
#define _WRS_WIND_VARS_ARCH_GET(ignored,glob) \
_WRS_KERNEL_CPU_GLOBAL_GET(ignored,glob)
#define _WRS_ARCH_LOCKED_GLOBAL_SET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_SET(glob,var)
#define _WRS_ARCH_LOCKED_GLOBAL_GET(glob, var) \
_WRS_KERNEL_LOCKED_GLOBAL_GET(glob,var)
#endif /* _WRS_CONFIG_SMP */
#ifdef _ASMLANGUAGE
#include <private/windLibP.h>
#if defined(_WRS_CONFIG_SMP)
/* generated macro values required by assembly macros below */
#include <private/offsetMacrosP.h>
/* SMP support */
#define _WRS_LOAD_REG_WITH_VAR_BASE(label,reg) \
leal FUNC(vxKernelVars),reg; \
addl $_WIND_VARS_cpu_##label##_OFFSET,reg;
#define _WRS_WIND_VARS_OFFSET(reg) \
rol $_WRS_WIND_VARS_ALIGN_SHIFT,reg;
#define _IA32_ASM_EXTERN_KERNEL_GLOBALS
#ifdef _WRS_CONFIG_WRHV_GUEST
#define _IA32_CPU_INDEX_GET(reg,scratch) \
movl wrhvVbCpuId,reg; \
movl 0x0(reg),reg;
#else /* _WRS_CONFIG_WRHV_GUEST */
#define _IA32_CPU_INDEX_GET(reg,scratch) \
movl $_IA32_LOC_APIC_ID,reg; \
movl 0x0(reg),reg; \
ror $_IA32_CPU_INDEX_SHIFT,reg; \
andl $_IA32_CPU_INDEX_MASK,reg; \
leal FUNC(mpCpuIndexTable)(reg),scratch; \
mov 0x0(scratch),reg; \
andl $_IA32_CPU_INDEX_MASK,reg; \
subl FUNC(vxBaseCpuPhysIndex), reg;
#endif /* _WRS_CONFIG_WRHV_GUEST */
/*
* Obtain the address of vxKernelVars[cpuid] for the current
* CPU in register 'reg', using 'scratch' as a scratch
* variable.
*/
#define _IA32_CPU_ADRS_BASE_GET(reg,scratch) \
_IA32_CPU_INDEX_GET(reg,scratch) \
_WRS_WIND_VARS_OFFSET(reg) \
leal FUNC(vxKernelVars)(reg), reg;
#define _IA32_PER_CPU_ADRS_GET(reg,scratch,label) \
_IA32_CPU_INDEX_GET(reg,scratch) \
_WRS_WIND_VARS_OFFSET(reg) \
_WRS_LOAD_REG_WITH_VAR_BASE(label,scratch) \
addl reg,scratch; \
leal 0x0(scratch),reg;
#define _IA32_PER_CPU_VALUE_GET(reg,scratch,label) \
_IA32_CPU_INDEX_GET(reg,scratch) \
_WRS_WIND_VARS_OFFSET(reg) \
_WRS_LOAD_REG_WITH_VAR_BASE(label,scratch) \
addl reg,scratch; \
movl 0x0(scratch),reg;
#define _IA32_PER_CPU_VALUE_SET(regv,scr1,scr2,label) \
_IA32_CPU_INDEX_GET(scr1,scr2) \
_WRS_WIND_VARS_OFFSET(scr1) \
_WRS_LOAD_REG_WITH_VAR_BASE(label,scr2) \
addl scr1,scr2; \
movl regv,0x0(scr2);
#define _IA32_PER_CPU_VALUE_AND_ADRS_GET(regv,rega,scratch,label) \
_IA32_CPU_INDEX_GET(regv,scratch) \
_WRS_WIND_VARS_OFFSET(regv) \
_WRS_LOAD_REG_WITH_VAR_BASE(label,scratch) \
addl regv,scratch; \
leal 0x0(scratch),rega; \
movl 0x0(scratch),regv;
#define _IA32_PER_CPU_VALUE_INC(reg,scratch,label) \
_IA32_CPU_INDEX_GET(reg,scratch) \
_WRS_WIND_VARS_OFFSET(reg) \
_WRS_LOAD_REG_WITH_VAR_BASE(label,scratch) \
addl reg,scratch; \
movl 0x0(scratch),reg; \
incl reg; \
movl reg,0x0(scratch);
#define _IA32_PER_CPU_VALUE_DEC(reg,scratch,label) \
_IA32_CPU_INDEX_GET(reg,scratch) \
_WRS_WIND_VARS_OFFSET(reg) \
_WRS_LOAD_REG_WITH_VAR_BASE(label,scratch) \
addl reg,scratch; \
movl 0x0(scratch),reg; \
decl reg; \
movl reg,0x0(scratch);
/*
* rega = register to store kernel lock owner
* regb = register to store cpu index
*
* typedef struct smpLock
* {
* volatile int state; /@ state of lock (free/taken) @/
* volatile int owner; /@ CPU which owns the lock @/
* int count; /@ recursive ownership nesting count @/
* int options; /@ options applicable to this lock @/
*/
#define _IA32_KERNEL_LOCK_OWNER_AND_INDEX_GET(rega, regb) \
_IA32_CPU_INDEX_GET(regb,rega) \
leal FUNC(kernelStateLock),rega; \
movl VX_KERNEL_LOCK_cpuIndex_OFFSET(rega),rega;
/* kernel spin lock owner */
#else /* _WRS_CONFIG_SMP */
#define _WRS_IA32_VAR_ADRS(label) FUNC(label)
#ifdef _WRS_CONFIG_MEM_ALLOT
/* exclude OSM references, because OSM requires malloc() */
#define _IA32_ASM_EXTERN_KERNEL_GLOBALS \
.globl FUNC(pSysGdt); /* Gdt */ \
.globl FUNC(intNest); /* nested intr cnt */ \
.globl FUNC(vxIntStackPtr); /* intr stk ptr */ \
.globl FUNC(vxIntStackEnabled); /* intr stk enabled flag */ \
.globl FUNC(sysCr3); /* local CR3 cache */
#else /* _WRS_CONFIG_MEM_ALLOT */
#define _IA32_ASM_EXTERN_KERNEL_GLOBALS \
.globl FUNC(sysTssCurrent); /* OSM Tss task info */ \
.globl FUNC(excOSMTssCurrent); /* OSM Tss */ \
.globl FUNC(sysOSMGdtScratchCurrent); /* OSM Scratch memory */ \
.globl FUNC(sysOSMState); /* OSM State Flag */ \
.globl FUNC(pSysGdt); /* Gdt */ \
.globl FUNC(intNest); /* nested intr cnt */ \
.globl FUNC(vxIntStackPtr); /* intr stk ptr */ \
.globl FUNC(vxIntStackEnabled); /* intr stk enabled flag */ \
.globl FUNC(sysCr3); /* local CR3 cache */
#endif /* _WRS_CONFIG_MEM_ALLOT */
#define _IA32_PER_CPU_ADRS_GET(reg,scratch,label) \
leal _WRS_IA32_VAR_ADRS(label),reg; /* get address of label */
#define _IA32_PER_CPU_VALUE_GET(reg,scratch,label) \
movl _WRS_IA32_VAR_ADRS(label),reg; /* get value at label */
#define _IA32_PER_CPU_VALUE_SET(regv,scr1,scr2,label) \
movl regv,_WRS_IA32_VAR_ADRS(label);
#define _IA32_PER_CPU_VALUE_AND_ADRS_GET(regv,rega,label) \
leal _WRS_IA32_VAR_ADRS(label),rega; /* get address of label */ \
leal 0x0(rega),regv; /* get value at label */
#define _IA32_PER_CPU_VALUE_INC(reg,scratch,label) \
incl _WRS_IA32_VAR_ADRS(label);
#define _IA32_PER_CPU_VALUE_DEC(reg,scratch,label) \
decl _WRS_IA32_VAR_ADRS(label);
#endif /* _ASMLANGUAGE */
#endif /* _WRS_CONFIG_SMP */
#ifdef __cplusplus
}
#endif
#endif /* __INCasmI86Ph */
@@ -0,0 +1,102 @@
/* vxPortableArchP.h - x86/x86_64 portable library configuration */
/*
* Copyright (c) 2007-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01w,20jan11,scm WIND00251661 - PORTABLE macro should not be defined by
default.
01v,20oct10,s_s renamed _WRS_PORTABLE_vxCpuIndexGet to _WRS_PORTABLE_vxCpuLib
(CQ:WIND00199670)
01u,26may10,scm enable optimized syscallDispatcher...
01t,23mar10,scm enable _WRS_PORTABLE_vxAtomicLib for 64 bit...
01s,18mar10,scm enable _WRS_PORTABLE_kernelLockLib and
_WRS_PORTABLE_spinLockIsrNdLib
01r,04feb10,scm add ffs 64 bit flag...
01q,20jan10,scm enable qPriBMapLib & qPriBMapNext...
01p,07jan10,scm enable optimized libs for bLib, workQLib, dllLib, sllLib,
and ffsLib.
01o,09dec09,cww 64-bit ffsLib update
01n,27jul09,jb Make vxAtomic portable for LP64
01m,19jun09,mze replacing PAD64
01l,20apr09,cww Temp enabling of portable vxAtomicLib for LP64
01k,16oct08,jb 64bit - Enabling PORTABLE - To be disabled as optimized
routines are ported
01j,10oct08,kk renamed _WRS_PORTABLE_spinlockIsrNdLib to
_WRS_PORTABLE_spinLockIsrNdLib
01i,24mar08,scm enable optimized workQ routines...
01h,16mar08,scm enable optimized qPriBMapNext...
01g,13mar08,scm enabled optimized syscallDispatch...
01f,16jan08,dlk Rename spinLockFastLib --> spinlockIsrNdLib.
01e,10dec07,dlk Enabled i86-optimized fast spin locks.
01d,22sep07,zl enabled optimized kernel lock library.
01c,04jun07,scm update to support optimized implementations...
01b,15may07,scm restore settings
01a,04may07,zl created
*/
#ifndef __INCvxPortableArchPh
#define __INCvxPortableArchPh
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file is included from <private/vxPortableP.h>. It may undefine
* portable library definitions in order to enable architecture specific
* implementation of a library or routine.
*/
/* the following can be overridden with PORTABLE */
#ifdef _WRS_CONFIG_LP64
#ifndef PORTABLE
#undef _WRS_PORTABLE_kernelLockLib
#undef _WRS_PORTABLE_spinLockIsrNdLib
#undef _WRS_PORTABLE_vxAtomicLib
#undef _WRS_PORTABLE_bLib
#undef _WRS_PORTABLE_workQLib
#undef _WRS_PORTABLE_dllLib
#undef _WRS_PORTABLE_sllLib
#undef _WRS_PORTABLE_ffsLib
#undef _WRS_PORTABLE_ffs64Lib
#undef _WRS_PORTABLE_qPriBMapLib
#undef _WRS_PORTABLE_qPriBMapNext
#undef _WRS_PORTABLE_syscallDispatch
#endif
#else /* (LP64) */
#ifndef PORTABLE
#undef _WRS_PORTABLE_bLib
#undef _WRS_PORTABLE_dllLib
#undef _WRS_PORTABLE_ffsLib
#define _WRS_PORTABLE_ffs64Lib
#undef _WRS_PORTABLE_kernelLockLib
#undef _WRS_PORTABLE_sllLib
#undef _WRS_PORTABLE_spinLockIsrNdLib
#undef _WRS_PORTABLE_syscallDispatch
#undef _WRS_PORTABLE_qPriBMapLib
#undef _WRS_PORTABLE_qPriBMapNext
#undef _WRS_PORTABLE_workQLib
#undef _WRS_PORTABLE_vxAtomicLib
#endif
#endif /* (LP64) */
/* the following cannot be overridden with PORTABLE */
#undef _WRS_PORTABLE_vxCpuLib
#ifdef __cplusplus
}
#endif
#endif /* __INCvxPortableArchPh */
@@ -0,0 +1,55 @@
/* vxdbgI86LibP.h - private I86 VxDBG library header file */
/*
* Copyright (c) 2007-2008, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use of this
* software may be licensed only pursuant to the terms of an applicable Wind
* River license agreement.
*/
/*
modification history
--------------------
01f,09feb11,rlp Defined VXDBG_INT_LOCK_LEVEL_COMPUTE macro for both UP and
SMP (CQ:WIND00253870).
01e,29apr10,pad Moved extern C statement after include statements.
01d,27aug08,jpb Renamed VSB header file
01c,24jun08,jpb Added include path for kernel configurations options set in
vsb. Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP.
01b,26oct07,rlp Added the VXDBG_INT_LOCK_LEVEL_COMPUTE macro (CQ:WIND00109321).
01a,11oct07,rlp Written
*/
#ifndef __INCvxdbgI86LibPh
#define __INCvxdbgI86LibPh
#include <vsbConfig.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This macro returns the <level> parameter modified with the interrupt lock
* level defined into the <value> parameter. The <level> parameter must be
* previously get with either intCpuLock() or intRegsLock() API.
*/
#define VXDBG_INT_LOCK_LEVEL_COMPUTE(level, value) \
((level & ~INT_FLAG) | (value & INT_FLAG))
#ifdef _WRS_CONFIG_SMP
/* return TRUE if interrupts are locked in specified register set. */
#define VXDBG_INT_REGS_IS_LOCKED(pRegs) (((pRegs->eflags & INT_FLAG) == \
INT_FLAG) ? FALSE : TRUE)
#endif /* _WRS_CONFIG_SMP */
#ifdef __cplusplus
}
#endif
#endif /* __INCvxdbgI86LibPh */
@@ -0,0 +1,122 @@
/* windArchLibP.h - private WIND header file for i86 */
/*
* Copyright (c) 2018 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01a,18jul18,r_h created for kernel page table isolation support (F10571)
*/
#ifndef __INCwindArchLibPh
#define __INCwindArchLibPh
#include <vsbConfig.h>
#include <private/adrSpaceLibP.h>
#ifdef _ASMLANGUAGE
#include <private/offsetMacrosP.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WRS_CONFIG_KPTI
#ifdef _WRS_CONFIG_LP64
#define _WRS_WIND_RTP_VARS_ALIGN 512
#define _WRS_WIND_RTP_VARS_ALIGN_SHIFT 9
#define RTP_TRAMPOLINE_STACK_SIZE 192
#define TSS_MAX_COUNT 1
#else
#define _WRS_WIND_RTP_VARS_ALIGN 1024
#define _WRS_WIND_RTP_VARS_ALIGN_SHIFT 10
#define RTP_TRAMPOLINE_STACK_SIZE 96
#define TSS_MAX_COUNT 2
#endif
#define GDT_MAX_COUNT 12
/* RTP region for 32-bit supervisor mode access */
#ifndef _WRS_CONFIG_LP64
#ifndef _ASMLANGUAGE
IMPORT char *trampolineBaseAddr;
#endif /* _ASMLANGUAGE */
#define KERNEL_RTP_SUP_RGN_BASE trampolineBaseAddr
#define KERNEL_RTP_SUP_RGN_SIZE 0x00400000
#endif
#define RTP_SUP_RGN_CODE_ADDR (KERNEL_RTP_SUP_RGN_BASE + 0x000000)
#define RTP_SUP_RGN_CODE_SIZE 0x2000
#define RTP_SUP_RGN_DATA_ADDR (KERNEL_RTP_SUP_RGN_BASE + RTP_SUP_RGN_CODE_SIZE)
#define RTP_SUP_RGN_DATA_SIZE (RTP_SUP_RGN_IDT_SIZE + RTP_SUP_RGN_VARS_SIZE)
/* space for 256 IDT entries, each entry is 16 bytes (4k total) */
#define RTP_SUP_RGN_IDT_ADDRESS (RTP_SUP_RGN_DATA_ADDR)
#define RTP_SUP_RGN_IDT_SIZE ((HIGH_VEC + 1) * 16)
/* 256 bytes for each CPU for WIND_RTP_VARS (up to 16k) */
#define RTP_SUP_RGN_VARS_ADDR (RTP_SUP_RGN_DATA_ADDR + RTP_SUP_RGN_IDT_SIZE)
#define RTP_SUP_RGN_VARS_SIZE (_WRS_WIND_RTP_VARS_ALIGN * VX_MAX_SMP_CPUS)
#ifndef _ASMLANGUAGE
/*
* per-CPU arch specific data accessible using the user-mode page table.
* For x86 the total size (including the arch-independent part) is 512
* bytes(64-bit mode) or 1024 bytes(32-bit mode), see
* _WRS_WIND_RTP_VARS_ALIGN / _WRS_WIND_VARS_ALIGN.
*
* Note: unlike the windVarsArch, this is used for UP as well.
*/
typedef struct windRtpVarsArch
{
TSS tss[TSS_MAX_COUNT]; /* 0x010 / 0x020: TSS */
#ifndef _WRS_CONFIG_LP64
ULONG tss_pad; /* ----- / : for future use */
#endif
ULONG cr3Offset; /* 0x22c / 0x088: offset to user mode CR3 */
GDT gdt[GDT_MAX_COUNT]; /* 0x230 / 0x090: GDT */
#ifdef _WRS_CONFIG_LP64
ULONG reserved[2]; /* ----- / 0x0f0: for future use */
#endif
char trampolineStack[RTP_TRAMPOLINE_STACK_SIZE];
/* 0x290 / 0x100: trampoline stack */
} WIND_RTP_VARS_ARCH;
#define _WRS_WIND_RTP_VARS_ARCH WIND_RTP_VARS_ARCH cpu_archVars
#define _WRS_WIND_RTP_VARS_ARCH_ACCESS(ix, var) \
_WRS_WIND_RTP_VARS_ACCESS (ix, archVars.var)
#define RTP_SUP_RGN_GDT_ADDRESS(cpu) \
(&_WRS_WIND_RTP_VARS_ARCH_ACCESS (cpu, gdt[0]))
#define RTP_SUP_RGN_TSS_ADDRESS(cpu) \
(&_WRS_WIND_RTP_VARS_ARCH_ACCESS (cpu, tss[0]))
#ifndef _WRS_CONFIG_LP64
#define RTP_SUP_RGN_OSMTSS_ADDRESS(cpu) \
(&_WRS_WIND_RTP_VARS_ARCH_ACCESS (cpu, tss[1]))
#endif
#endif /* _ASMLANGUAGE */
#endif /* _WRS_CONFIG_KPTI */
#ifdef __cplusplus
}
#endif
#endif /* __INCwindArchLibPh */
+216
View File
@@ -0,0 +1,216 @@
/* regsGv3.h - Thermal Monitor and Geyserville III Technology registers */
/* Copyright 2002 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,26aug02,hdn written
*/
#ifndef __INCregsGv3h
#define __INCregsGv3h
#ifdef __cplusplus
extern "C" {
#endif
/* gv3Lib.c initialization status flags */
#define GV3_INIT_NOT_DONE 0x0001 /* gv3Lib initialization not done */
#define GV3_ERR_NO_TM 0x0002 /* no Thermal Monitor exist */
#define GV3_OK_NO_GV 0x0004 /* no GV1+ or GV3 exist */
#define GV3_OK_GV3 0x0008 /* GV3 exist */
#define GV3_OK_NO_MATCH 0x0010 /* no matching FREQ_VID table */
#define GV3_OK_TM2 0x0020 /* GV3 TM2 exist */
#define GV3_OK_TM1 0x0040 /* TM1 exist */
#define GV3_OK_AC 0x0080 /* power source is AC */
#define GV3_OK_BATT 0x0100 /* power source is Battery */
/* User Thermal Monitor Mode Configuration */
#define GV3_MAX_PERF 0x1 /* max performance */
#define GV3_OPT_BATT 0x2 /* battery optimized performance */
#define GV3_MAX_BATT 0x3 /* max battery */
#define GV3_AUTO 0x4 /* automatic */
#define GV3_DEFAULT 0x5 /* default */
/* GV3 Thermal Monitor Mode Used */
#define GV3_TM_1 0x1 /* Thermal Monitor 1 */
#define GV3_TM_2 0x2 /* Thermal Monitor 2 */
/* GV3 State Transition parameters default value */
#define GV3_UP_UTIL 95 /* def utilization(%) to go 1 up */
#define GV3_DOWN_UTIL 95 /* def utilization(%) to go 1 down */
#define GV3_UP_TIME 300 /* def time(millisec) to go 1 up */
#define GV3_DOWN_TIME 1000 /* def time(millisec) to go 1 down */
/* Thermal Throttle parameters default value */
#define GV3_DUTY_CYCLE 0x8 /* throttle duty cycle : 50.0% */
#define GV3_BUS_RATIO 0x8 /* throttle bus ratio : 800Mhz */
/* Geyserville III specific MSRs */
#define MSR_EBL_CR_POWERON 0x002a /* Power On Configuration */
#define MSR_BBL_CR_CTL 0x0119 /* Control Register */
#define MSR_BBL_CR_CTL3 0x011e /* Control Register 3 */
#define MSR_CLOCK_FLEX_MAX 0x0194 /* Flexible Bus Ratio/VID Control */
#define MSR_PERF_STS 0x0198 /* Performance (Geyserville) Status */
#define MSR_PERF_CTL 0x0199 /* Performance (Geyserville) Control */
#define MSR_GV_THERM 0x019d /* Geyserville Thermal Control */
#define MSR_GV1P_REG_PTR 0x019e /* Geyserville 1+ Pointer */
/* MSR_EBL_CR_POWERON bit difinition */
#define EBL_RATIO 0x07c00000 /* RO Core Clock to System Bus Ratio */
#define EBL_AGENT_ID 0x00300000 /* RO Agent ID */
#define EBL_BUS_FREQ 0x00040000 /* RO System Bus Frequency */
#define EBL_APIC_ID 0x00030000 /* RO APIC Cluster ID */
#define EBL_PO_RESET 0x00004000 /* RO 1M Power On Reset */
#define EBL_IOQ_DEP 0x00002000 /* RO In Order Queue Depth */
#define EBL_BINI_OBS_EN 0x00001000 /* RO BINIT# Observation Enabled */
#define EBL_AERR_OBS_EN 0x00000400 /* RO AERR# Observation Enabled */
#define EBL_BIST 0x00000200 /* RO Execute BIST */
#define EBL_TRI_STATE 0x00000100 /* RO Output Tri-state Enable */
#define EBL_BINI_EN 0x00000080 /* RW BINIT# Enable */
#define EBL_BERR_IE_EN 0x00000040 /* RW BERR# Enable, Internal Err */
#define EBL_QUICK 0x00000020 /* RO Quickstart Mode */
#define EBL_BERR_BR_EN 0x00000010 /* RW BERR# Enable, Bus Request */
#define EBL_AERR_EN 0x00000008 /* RW AERR# Enable */
#define EBL_RESP_CHK_EN 0x00000004 /* RW Response Error Check Enable */
#define EBL_DATA_CHK_EN 0x00000002 /* RW Data Error Check Enable */
/* MSR_BBL_CR_CTL3 bit difinition */
#define BBL_L2_NOT 0x00800000 /* RO L2 Not Present */
#define BBL_L2_RANGE 0x00700000 /* RO L2 Physical Address Range */
#define BBL_L2_EN 0x00000100 /* RW L2 Enabled */
#define BBL_L2_ECC_EN 0x00000020 /* RO L2 ECC Check Enabled */
#define BBL_L2_HARD_EN 0x00000001 /* RO L2 Hardware Enabled */
/* MSR_CLOCK_FLEX_MAX bit difinition */
#define FLEX_EN 0x00010000 /* RW Flex Enable */
#define FLEX_RATIO 0x00001f00 /* RW Flex Ratio */
#define FLEX_VID 0x0000003f /* RW Flex VID */
/* MSR_GV1P_REG_PTR bit difinition */
#define GV1P_REG_PTR 0x0000ffff /* RW GV1P pointer register */
/* MSR_PERF_CTL bit difinition */
#define BUS_RATIO_SEL 0x00001f00 /* RW Bus Ratio Selection */
#define GV_VID_SEL 0x0000003f /* RW VID Selection */
/* MSR_PERF_STS bit difinition (upper 32) */
#define BUS_RATIO_BOOT 0x1f000000 /* RO Boot Bus Ratio */
#define GV_VID_BOOT 0x003f0000 /* RO Boot VID */
#define BUS_RATIO_MAX 0x00001f00 /* RO Max Bus Ratio */
#define GV_VID_MAX 0x0000003f /* RO Max VID */
/* MSR_PERF_STS bit difinition (lower 32) */
#define BUS_RATIO_MIN 0x1f000000 /* RO Min Bus Ratio */
#define GV_TS 0x00200000 /* RO GV3 Transition Started */
#define GV_CMD_SEEK 0x00100000 /* RO GV3 Transition Performing */
#define GV_THERM_THROT 0x00080000 /* RO GV3 Thermal Throttle */
#define GV_TT 0x00040000 /* RO Thermal Trip Active */
#define GV_VIP 0x00020000 /* RO Voltage Transition Pending */
#define GV_FIP 0x00010000 /* RO Frequency Change Pending */
#define BUS_RATIO_STS 0x00001f00 /* RO Current Bus Ratio */
#define GV_VID_STS 0x0000003f /* RO Current VID */
/* MSR_GV_THERM bit difinition */
#define GV_THROT_SEL 0x00010000 /* RW Thermal Management Mode */
#define BUS_RATIO_THROT 0x00001f00 /* RW Throttling Bus Ratio */
#define GV_VID_THROT 0x0000003f /* RW Throttling VID */
#ifndef _ASMLANGUAGE
/* frequency - VID table : state entry */
typedef struct freqVidState {
UINT16 no; /* state no. */
UINT16 vid; /* VID_SEL value in MSR_PERF_CTL */
UINT16 ratio; /* BUS_RATIO_SEL value in MSR_PERF_CTL */
UINT16 power; /* power(mW) consumed by CPU in this state */
} FREQ_VID_STATE;
/* frequency - VID table : header */
typedef struct freqVidHeader {
UINT32 cpuId; /* CPU family-model-stepping value */
UINT8 maxVid; /* VID_MAX value in MSR_PERF_STS */
UINT8 maxRatio; /* BUS_RATIO_MAX value in MSR_PERF_STS */
UINT8 nState; /* no of states supported by this CPU */
FREQ_VID_STATE * pState;
} FREQ_VID_HEADER;
/* Thermal Monitor interrupt routines and arguments */
typedef struct sysTherm {
FUNCPTR hotRoutine; /* rtn to call on TM Hot int */
INT32 hotArg; /* its argument */
BOOL hotConnected;
FUNCPTR coldRoutine; /* rtn to call on TM Cold int */
INT32 coldArg; /* its argument */
BOOL coldConnected;
} SYS_THERM;
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
extern STATUS gv3LibInit (UINT32 mode, UINT32 upUtil, UINT32 downUtil,
UINT32 upTime, UINT32 downTime,
FUNCPTR acCheckRtn);
extern STATUS gv3StateSet (UINT32 state);
extern STATUS gv3DutyCycleSet (UINT32 dutyCycleIx);
extern STATUS gv3DutyCycleEnable (BOOL enable);
extern BOOL gv3DutyCycleCheck (void);
extern BOOL gv3HotCheck (void);
extern BOOL gv3AcCheck (void);
extern STATUS gv3AutoEnable (BOOL enable);
extern STATUS gv3AutoSet (UINT32 upUtil, UINT32 downUtil,
UINT32 upTime, UINT32 downTime);
extern STATUS gv3AutoGet (UINT32 * pUpUtil, UINT32 * pDownUtil,
UINT32 * pUpTime, UINT32 * pDownTime);
extern VOID gv3ShowInit (void);
extern VOID gv3Show (void);
#else /* __STDC__ */
extern STATUS gv3LibInit ();
extern STATUS gv3StateSet ();
extern STATUS gv3DutyCycleSet ();
extern STATUS gv3DutyCycleEnable ();
extern BOOL gv3DutyCycleCheck ();
extern BOOL gv3HotCheck ();
extern BOOL gv3AcCheck ();
extern STATUS gv3AutoEnable ();
extern STATUS gv3AutoSet ();
extern STATUS gv3AutoGet ();
extern VOID gv3ShowInit ();
extern VOID gv3Show ();
#endif /* __STDC__ */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCregsGv3h */
File diff suppressed because it is too large Load Diff
+120
View File
@@ -0,0 +1,120 @@
/* regsP7.h - Pentium4 architecture specific registers */
/* Copyright 2002 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,02sep02,hdn written
*/
#ifndef __INCregsP7h
#define __INCregsP7h
#ifdef __cplusplus
extern "C" {
#endif
/* MSR, Pentium4 specific */
#define MSR_EBC_HARD_POWERON 0x002a
#define MSR_EBC_SOFT_POWERON 0x002b
#define MSR_EBC_FREQUENCY_ID 0x002c
#define MSR_LER_FROM_LIP 0x01d7
#define MSR_LER_TO_LIP 0x01d8
#define MSR_LASTBRANCH_TOS 0x01da
#define MSR_LASTBRANCH_0 0x01db
#define MSR_LASTBRANCH_1 0x01dc
#define MSR_LASTBRANCH_2 0x01dd
#define MSR_LASTBRANCH_3 0x01de
#define MSR_BPU_COUNTER0 0x0300
#define MSR_BPU_COUNTER1 0x0301
#define MSR_BPU_COUNTER2 0x0302
#define MSR_BPU_COUNTER3 0x0303
#define MSR_MS_COUNTER0 0x0304
#define MSR_MS_COUNTER1 0x0305
#define MSR_MS_COUNTER2 0x0306
#define MSR_MS_COUNTER3 0x0307
#define MSR_FLAME_COUNTER0 0x0308
#define MSR_FLAME_COUNTER1 0x0309
#define MSR_FLAME_COUNTER2 0x030a
#define MSR_FLAME_COUNTER3 0x030b
#define MSR_IQ_COUNTER0 0x030c
#define MSR_IQ_COUNTER1 0x030d
#define MSR_IQ_COUNTER2 0x030e
#define MSR_IQ_COUNTER3 0x030f
#define MSR_IQ_COUNTER4 0x0310
#define MSR_IQ_COUNTER5 0x0311
#define MSR_BPU_CCCR0 0x0360
#define MSR_BPU_CCCR1 0x0361
#define MSR_BPU_CCCR2 0x0362
#define MSR_BPU_CCCR3 0x0363
#define MSR_MS_CCCR0 0x0364
#define MSR_MS_CCCR1 0x0365
#define MSR_MS_CCCR2 0x0366
#define MSR_MS_CCCR3 0x0367
#define MSR_FLAME_CCCR0 0x0368
#define MSR_FLAME_CCCR1 0x0369
#define MSR_FLAME_CCCR2 0x036a
#define MSR_FLAME_CCCR3 0x036b
#define MSR_IQ_CCCR0 0x036c
#define MSR_IQ_CCCR1 0x036d
#define MSR_IQ_CCCR2 0x036e
#define MSR_IQ_CCCR3 0x036f
#define MSR_IQ_CCCR4 0x0370
#define MSR_IQ_CCCR5 0x0371
#define MSR_BSU_ESCR0 0x03a0
#define MSR_BSU_ESCR1 0x03a1
#define MSR_FSB_ESCR0 0x03a2
#define MSR_FSB_ESCR1 0x03a3
#define MSR_FIRM_ESCR0 0x03a4
#define MSR_FIRM_ESCR1 0x03a5
#define MSR_FLAME_ESCR0 0x03a6
#define MSR_FLAME_ESCR1 0x03a7
#define MSR_DAC_ESCR0 0x03a8
#define MSR_DAC_ESCR1 0x03a9
#define MSR_MOB_ESCR0 0x03aa
#define MSR_MOB_ESCR1 0x03ab
#define MSR_PMH_ESCR0 0x03ac
#define MSR_PMH_ESCR1 0x03ad
#define MSR_SAAT_ESCR0 0x03ae
#define MSR_SAAT_ESCR1 0x03af
#define MSR_U2L_ESCR0 0x03b0
#define MSR_U2L_ESCR1 0x03b1
#define MSR_BPU_ESCR0 0x03b2
#define MSR_BPU_ESCR1 0x03b3
#define MSR_IS_ESCR0 0x03b4
#define MSR_IS_ESCR1 0x03b5
#define MSR_ITLB_ESCR0 0x03b6
#define MSR_ITLB_ESCR1 0x03b7
#define MSR_CRU_ESCR0 0x03b8
#define MSR_CRU_ESCR1 0x03b9
#define MSR_IQ_ESCR0 0x03ba
#define MSR_IQ_ESCR1 0x03bb
#define MSR_RAT_ESCR0 0x03bc
#define MSR_RAT_ESCR1 0x03bd
#define MSR_SSU_ESCR0 0x03be
#define MSR_MS_ESCR0 0x03c0
#define MSR_MS_ESCR1 0x03c1
#define MSR_TBPU_ESCR0 0x03c2
#define MSR_TBPU_ESCR1 0x03c3
#define MSR_TC_ESCR0 0x03c4
#define MSR_TC_ESCR1 0x03c5
#define MSR_IX_ESCR0 0x03c8
#define MSR_IX_ESCR1 0x03c9
#define MSR_ALF_ESCR0 0x03ca
#define MSR_ALF_ESCR1 0x03cb
#define MSR_CRU_ESCR2 0x03cc
#define MSR_CRU_ESCR3 0x03cd
#define MSR_CRU_ESCR4 0x03e0
#define MSR_CRU_ESCR5 0x03e1
#define MSR_TC_PRECISE_EVENT 0x03f0
#define MSR_PEBS_MATRIX_VERT 0x03f2
#ifdef __cplusplus
}
#endif
#endif /* __INCregsP7h */
@@ -0,0 +1,45 @@
/* sigI86Codes.h - signal facility library header */
/* Copyright 1984-1993, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01c,29apr10,pad Moved extern C statement after include statements.
01b,29may94,hdn removed I80486 conditional.
01a,08jun93,hdn written.
*/
#ifndef __INCsigI86Codesh
#define __INCsigI86Codesh
#include "iv.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ILL_DIVIDE_ERROR IV_DIVIDE_ERROR
#define ILL_NON_MASKABLE IV_NON_MASKABLE
#define ILL_OVERFLOW IV_OVERFLOW
#define ILL_BOUND IV_BOUND
#define ILL_INVALID_OPCODE IV_INVALID_OPCODE
#define ILL_DOUBLE_FAULT IV_DOUBLE_FAULT
#define ILL_INVALID_TSS IV_INVALID_TSS
#define ILL_PROTECTION_FAULT IV_PROTECTION_FAULT
#define ILL_RESERVED IV_RESERVED
#define EMT_DEBUG IV_DEBUG
#define EMT_BREAKPOINT IV_BREAKPOINT
#define FPE_NO_DEVICE IV_NO_DEVICE
#define FPE_CP_OVERRUN IV_CP_OVERRUN
#define FPE_CP_ERROR IV_CP_ERROR
#define BUS_NO_SEGMENT IV_NO_SEGMENT
#define BUS_STACK_FAULT IV_STACK_FAULT
#define BUS_PAGE_FAULT IV_PAGE_FAULT
#define BUS_ALIGNMENT IV_ALIGNMENT
#ifdef __cplusplus
}
#endif
#endif /* __INCsigI86Codesh */
@@ -0,0 +1,870 @@
/* Aligned for x86 - no alignment needed */
/* THIS FILE IS AUTO_GENERATED. PLEASE DO NOT EDIT. */
#ifndef _ASMLANGUAGE
#include <vxWorks.h>
#include <taskLib.h>
#include <rtpLib.h>
#include <sdLib.h>
#include <shlLib.h>
#include <signal.h>
#include <socket.h>
#include <time.h>
#include <setjmp.h>
#include <ioLib.h>
#include <private/semSysCall.h>
#include <private/objLibP.h>
#include <private/rtpLibP.h>
#include <private/mqPxSysCall.h>
#include <private/pxObjSysCall.h>
#include <private/semPxSysCall.h>
#include <private/taskSysCall.h>
#include <private/timerSysCall.h>
#include <private/eventSysCall.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <base/b_trace_attr_t.h>
#include <base/b_trace_id_t.h>
#include <base/b_trace_event_id_t.h>
#include <base/b_pthread_t.h>
struct _exitScArgs
{
int status;
};
struct _creatScArgs
{
const char * name;
mode_t flag;
};
struct _openScArgs
{
const char * name;
int flags;
int mode;
};
struct _closeScArgs
{
int fd;
};
struct _readScArgs
{
int fd;
void * buffer;
size_t maxbytes;
};
struct _writeScArgs
{
int fd;
const void * buffer;
size_t nbytes;
};
struct _ioctlScArgs
{
int fd;
int function;
_Vx_ioctl_arg_t arg;
};
struct dupScArgs
{
int fd;
};
struct dup2ScArgs
{
int fd;
int fd2;
};
struct pipeScArgs
{
int filedes[2];
};
struct removeScArgs
{
const char * name;
};
struct selectScArgs
{
int width;
fd_set * readFds;
fd_set * writeFds;
fd_set * excFds;
struct timeval * timeout;
};
struct socketScArgs
{
int domain;
int type;
int protocol;
};
struct bindScArgs
{
int s;
struct sockaddr * name;
int namelen;
};
struct listenScArgs
{
int s;
int backlog;
};
struct acceptScArgs
{
int s;
struct sockaddr * addr;
int *addrlen;
};
struct connectScArgs
{
int s;
struct sockaddr * name;
int namelen;
};
struct sendtoScArgs
{
int s;
caddr_t buf;
int bufLen;
int flags;
struct sockaddr * to;
int tolen;
};
struct sendScArgs
{
int s;
const char * buf;
int bufLen;
int flags;
};
struct sendmsgScArgs
{
int s;
struct msghdr * mp;
int flags;
};
struct recvfromScArgs
{
int s;
char * buf;
int bufLen;
int flags;
struct sockaddr *from;
int * pFromLen;
};
struct recvScArgs
{
int s;
char * buf;
int bufLen;
int flags;
};
struct recvmsgScArgs
{
int s;
struct msghdr * mp;
int flags;
};
struct setsockoptScArgs
{
int s;
int level;
int optname;
char * optval;
int optlen;
};
struct getsockoptScArgs
{
int s;
int level;
int optname;
char * optval;
int * optlen;
};
struct getsocknameScArgs
{
int s;
struct sockaddr *name;
int * namelen;
};
struct getpeernameScArgs
{
int s;
struct sockaddr *name;
int *namelen;
};
struct shutdownScArgs
{
int s;
int how;
};
struct mmapScArgs
{
void * addr;
size_t len;
int prot;
int flags;
int fildes;
off64_t off;
};
struct munmapScArgs
{
void * addr;
size_t len;
};
struct mprotectScArgs
{
void * addr;
size_t len;
int prot;
};
struct killScArgs
{
OBJ_HANDLE rtpId;
int signo;
};
struct sigpendingScArgs
{
sigset_t * pSet;
};
struct sigprocmaskScArgs
{
int how;
const sigset_t * pSet;
sigset_t * pOset;
};
struct _sigqueueScArgs
{
OBJ_HANDLE rtpId;
int signo;
const union sigval * pValue;
int sigCode;
};
struct _sigsuspendScArgs
{
const sigset_t * pSet;
};
struct _sigtimedwaitScArgs
{
const sigset_t * pSet;
struct siginfo * pInfo;
const struct timespec * pTime;
};
struct _sigactionScArgs
{
int signo;
const struct sigaction * pAct;
struct sigaction * pOact;
void * retAddr;
};
struct chdirScArgs
{
const char * name;
};
struct _getcwdScArgs
{
char * buffer;
int length;
};
struct _waitpidScArgs
{
OBJ_HANDLE childRtpId;
int * pStatus;
int options;
};
struct sysctlScArgs
{
int * pName;
u_int nameLen;
void * pOld;
size_t * pOldLen;
void * pNew;
size_t newLen;
};
struct _schedPxInfoGetScArgs
{
BOOL * pTimeSlicingOn;
ULONG * pTimeSlicePeriod;
};
struct sigaltstackScArgs
{
stack_t * ss;
stack_t * oss;
};
struct unlinkScArgs
{
const char * name;
};
struct linkScArgs
{
const char * name;
const char * newname;
};
struct _fsyncScArgs
{
int fd;
};
struct _fdatasyncScArgs
{
int fd;
};
struct renameScArgs
{
const char * oldname;
const char * newname;
};
struct fpathconfScArgs
{
int fd;
int name;
};
struct pathconfScArgs
{
const char * path;
int name;
};
struct accessScArgs
{
const char * path;
int amode;
};
struct chmodScArgs
{
const char * path;
mode_t mode;
};
struct pxTraceCreationScArgs
{
int cmd;
pid_t pid;
trace_attr_t * attr;
int fd;
trace_id_t * trid;
};
struct pxTraceCtlScArgs
{
int cmd;
trace_id_t trid;
struct trace_event_set_t * filter;
int how;
pthread_t thread_id;
void * pc;
void * ptr_out;
};
struct pxTraceEventScArgs
{
int cmd;
int id_in;
char * data;
size_t data_len;
pthread_t thread_id;
void * pc;
trace_event_id_t * id_out;
};
struct pxTraceEventNameQueryScArgs
{
int cmd;
trace_id_t trid;
int id_in1;
int id_in2;
char * name;
trace_event_id_t * id_out;
int * unavailable;
};
struct pxTraceLogScArgs
{
int cmd;
trace_id_t trid_in;
int fd;
trace_id_t *trid_out;
};
struct pxTraceEventGetScArgs
{
int cmd;
trace_id_t trid;
size_t num_bytes;
struct timespec * timeout;
struct posix_trace_event_info * event;
void * data;
size_t * data_len;
int * unavailable;
};
struct eventReceiveScArgs
{
UINT32 events;
UINT32 options;
_Vx_ticks_t timeout;
UINT32 * pEvtsReceived;
};
struct eventSendScArgs
{
int taskId;
UINT32 events;
};
struct eventCtlScArgs
{
OBJ_HANDLE handle;
VX_EVT_CTL_CMD command;
void * pArg;
size_t * pArgSize;
};
struct msgQSendScArgs
{
OBJ_HANDLE handle;
char * buffer;
size_t nBytes;
_Vx_ticks_t timeout;
int priority;
};
struct msgQReceiveScArgs
{
OBJ_HANDLE handle;
char * buffer;
size_t maxNBytes;
_Vx_ticks_t timeout;
};
struct _msgQOpenScArgs
{
const char * name;
size_t maxMsgs;
size_t maxMsgLength;
int options;
int mode;
void * context;
};
struct objDeleteScArgs
{
OBJ_HANDLE handle;
int options;
};
struct objInfoGetScArgs
{
OBJ_HANDLE handle;
void * pInfo;
size_t * pInfoSize;
int level;
};
struct _semTakeScArgs
{
OBJ_HANDLE handle;
_Vx_ticks_t timeout;
};
struct _semGiveScArgs
{
OBJ_HANDLE handle;
};
struct _semOpenScArgs
{
const char * name;
SEM_TYPE type;
int initState;
int options;
int mode;
void * context;
};
struct semCtlScArgs
{
OBJ_HANDLE handle;
VX_SEM_CTL_CMD command;
void * pArg;
size_t * pArgSize;
};
struct _taskOpenScArgs
{
struct vx_task_open_sc_args * pArgs;
};
struct taskCtlScArgs
{
int tid;
VX_TASK_CTL_CMD command;
void * pArg;
size_t * pArgSize;
};
struct taskDelayScArgs
{
_Vx_ticks_t ticks;
};
struct rtpSpawnScArgs
{
const char * rtpFileName;
const char ** argv;
const char ** envp;
int priority;
size_t uStackSize;
int options;
int taskOptions;
};
struct rtpInfoGetScArgs
{
OBJ_HANDLE rtpId;
RTP_DESC * rtpStruct;
};
struct taskKillScArgs
{
OBJ_HANDLE taskHandle;
int signo;
};
struct _taskSigqueueScArgs
{
OBJ_HANDLE taskHandle;
int signo;
const union sigval * pValue;
int sigCode;
};
struct _timer_openScArgs
{
const char * name;
int mode;
clockid_t clockId;
struct sigevent * evp;
void * context;
};
struct timerCtlScArgs
{
TIMER_CTL_CMD cmdCode;
OBJ_HANDLE timerHandle;
void * pArgs;
size_t pArgSize;
};
struct pxOpenScArgs
{
PX_OBJ_TYPE type;
const char * name;
int objOpenMode;
void * attr;
};
struct pxCloseScArgs
{
OBJ_HANDLE handle;
};
struct pxUnlinkScArgs
{
PX_OBJ_TYPE type;
const char * name;
};
struct pxCtlScArgs
{
OBJ_HANDLE handle;
PX_CTL_CMD_CODE cmdCode;
void * pArgs;
size_t * pArgSize;
};
struct pxMqReceiveScArgs
{
OBJ_HANDLE handle;
char * pMsg;
size_t msgLen;
unsigned int * pMsgPrio;
PX_WAIT_OPTION waitOption;
const struct timespec * time_out;
};
struct pxMqSendScArgs
{
OBJ_HANDLE handle;
const char * pMsg;
size_t msgLen;
unsigned int msgPrio;
PX_WAIT_OPTION waitOption;
const struct timespec * time_out;
};
struct pxSemWaitScArgs
{
OBJ_HANDLE handle;
PX_WAIT_OPTION waitOption;
const struct timespec * time_out;
};
struct pxSemPostScArgs
{
OBJ_HANDLE handle;
};
struct pipeDevCreateScArgs
{
const char * name;
size_t nMessages;
size_t nBytes;
};
struct pipeDevDeleteScArgs
{
const char * name;
BOOL force;
};
struct _sdCreateScArgs
{
char * name;
int options;
size_t size;
off64_t physAddress;
MMU_ATTR attr;
void ** pVirtAddress;
};
struct _sdOpenScArgs
{
char * name;
int options;
int mode;
size_t size;
off64_t physAddress;
MMU_ATTR attr;
void ** pVirtAddress;
};
struct sdDeleteScArgs
{
OBJ_HANDLE handle;
int options;
};
struct sdMapScArgs
{
OBJ_HANDLE handle;
MMU_ATTR attr;
int options;
};
struct sdUnmapScArgs
{
OBJ_HANDLE handle;
int options;
};
struct sdProtectScArgs
{
OBJ_HANDLE handle;
MMU_ATTR attr;
};
struct _edrErrorInjectScArgs
{
int kind;
const char *fileName;
int lineNumber;
REG_SET *regset;
void *addr;
const char *msg;
};
struct wvEventScArgs
{
int eventId;
const char * pData;
unsigned int dataSize;
};
struct rtpVarAddScArgs
{
void ** pVar;
void * value;
};
struct sdInfoGetScArgs
{
OBJ_HANDLE handle;
SD_DESC * pSdStruct;
};
struct _shlOpenScArgs
{
const char * name;
int options;
};
struct _shlUnlockScArgs
{
SHL_ID shlId;
};
struct _shlCloseScArgs
{
SHL_ID shlId;
};
struct _shlGetScArgs
{
SHL_ID shlId;
SHLINFO *pInfo;
};
struct _shlPutScArgs
{
SHL_ID shlId;
const SHLINFO *pInfo;
};
struct objUnlinkScArgs
{
const char * name;
enum windObjClassType classType;
};
struct getprlimitScArgs
{
int idtype;
OBJ_HANDLE handle;
int resource;
struct rlimit *rlp;
};
struct setprlimitScArgs
{
int idtype;
OBJ_HANDLE handle;
int resource;
struct rlimit *rlp;
};
struct _mctlScArgs
{
void * addr;
size_t len;
int function;
void * arg;
};
struct _taskOpenWithGuardScArgs
{
struct vx_task_open_guard_sc_args * pArgs;
};
struct clockCtlScArgs
{
clockid_t clock_id;
CLOCK_CTL_CMD cmdCode;
void * pArgStruct;
size_t * pArgSize;
};
struct _semRTakeScArgs
{
OBJ_HANDLE handle;
_Vx_ticks_t timeout;
};
struct _semWTakeScArgs
{
OBJ_HANDLE handle;
_Vx_ticks_t timeout;
};
struct _semExchangeScArgs
{
OBJ_HANDLE giveHandle;
OBJ_HANDLE takeHandle;
_Vx_ticks_t timeout;
};
struct wvRtpEventScArgs
{
int eventId;
const char * pData;
unsigned int dataSize;
};
struct _selectScArgs
{
int width;
fd_set * readFds;
fd_set * writeFds;
fd_set * excFds;
struct timeval * timeout;
};
struct _sigtimedwait2ScArgs
{
const sigset_t * pSet;
struct siginfo * pInfo;
const struct timespec * pTime;
};
#endif /* _ASMLANGUAGE */
+151
View File
@@ -0,0 +1,151 @@
/* syscallI86.h - I86 specific System Call Infrastructure header */
/*
* Copyright (c) 2003-2005, 2007-2008, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01g,16oct12,scm WIND00376020 - fast system call support...
01f,14mar08,scm modify saved regs to reflect code changes...
01e,04may07,zl updated portable library build configuration.
01d,05may05,zmm Fix SYSCALL_ENTRY_FRAME_SIZE. SPR 108825
01c,02feb04,jb Fix SPR 93500
01b,04jan04,jb Adding context to syscall_entry_state
01a,18sep03,jb written.
*/
/*
DESCRIPTION
This header contains I86-specific definitions and constants used by
the System Call Infrastructure library.
*/
#ifndef __INCsyscallI86h
#define __INCsyscallI86h
#ifndef _ASMLANGUAGE
#include <taskLib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#if (CPU != PENTIUM)
/*
* SYSENTER/SYSEXIT...
*
* When SYSENTER called, made from USR Mode (PL3) :
*
* IA32_SYSENTER_CS - sysCsSuper
* IA32_SYSENTER_EIP - address of syscallHandle routine
* IA32_SYSENTER_ESP - pTcbCurrent->pExcStackBase
*
* CS <--- loaded from IA32_SYSENTER_CS (target code segment)
* RIP <--- loaded from IA32_SYSENTER_EIP (target instruction)
* SS <--- Computed by adding 8 to IA32_SYSENTER_CS (stack segment)
* RSP <--- loaded from IA32_SYSENTER_ESP (stack pointer)
*
* When SYSEXIT called, made from Kernel Mode (PL0):
*
* IA32_SYSENTER_CS - sysCsSuper
* EDX - return address
* ECX - user stack
*
* CS <--- Computed by adding 16 to IA32_SYSENTER_CS (code segment)
* RIP <--- loaded from EDX (target instruction)
* SS <--- Computed by adding 24 to IA32_SYSENTER_CS (stack segment)
* RSP <--- loaded from ECX (stack pointer)
*
* NOTE: When using SYSENTER/SYSEXIT to implement system calls, any
* additional state that needs to be saved to allow a return to the
* calling procedure must be saved explicitly by the calling procedure
* or be predefined through programming conventions.
*
*/
#define SYSCALL_ENTRY_FRAME_SIZE 72 /* size of 'syscall' frame */
#define INSTR_SYSENTER_SIZE 2 /* size of 'sysenter' instruction */
#define SYSCALL_STACK_ARGS 8 /* number of arguments passed */
#else
#define SYSCALL_ENTRY_FRAME_SIZE 68
#define SYSCALL_STACK_ARGS 8
#endif /* (CPU != PENTIUM) */
#ifndef _ASMLANGUAGE
/* The call gate/Tss mechanism does the copy for us, this is not needed */
#define _SYSCALL_USER_SP_CHECK(sp)
/* typedefs */
/*
* The SYSCALL_ENTRY_STATE structure defines the saved machine state
* when the system call trap is taken. This information is architecture
* specific, and is used by the system call dispatcher to restart system
* calls that have been interrupted by the occurance of signals.
* System call restart is achieved by restoring the saved state at the
* time of the system call trap, and re-issuing the system call.
*
* All arguments to the system call are saved on the kernel stack, and
* the address of that array is passed as an argument to the dispatcher.
* The layout of this structure must exactly match the ordering of members
* of the system call entry frame in src/arch/I86/syscallALib.s.
*
*/
typedef struct syscall_entry_state
{
#if (CPU != PENTIUM)
long esi; /* Saved reg on entry to syscallHandle */
long edi; /* Saved reg on entry to syscallHandle */
long ebx; /* Saved reg on entry to syscallHandle */
void * pc; /* return to stub PC (edx) */
long * pUStack; /* usr stack pointer (ecx) */
long cs; /* return address code segment */
long upc; /* return to caller pc */
long args[8]; /* argument list */
long scn; /* System Call Number - Also temp error storage */
long errNo; /* errno status */
long eflags; /* EFLAGS */
#else
int esi; /* Save reg */
int edi; /* Save reg */
int ebx; /* Save reg */
void * pc; /* return address instruction pointer */
int cs; /* return address code segment */
int scn; /* System Call Number - Also temp error storage */
int upc; /* return to caller pc */
int args[8]; /* argument list */
int * pUStack; /* user-mode stack pointer */
int ss; /* user stack segment */
#endif /* (CPU != PENTIUM) */
} SYSCALL_ENTRY_STATE;
/* Prototype */
UINT32 sysModGdt (UINT32 offset, UINT32 limit, UINT32 base, UINT32 priority);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCsyscallI86h */
@@ -0,0 +1,321 @@
/* vxAtomicArchLib.h - IA32 specific atomic library header */
/*
* Copyright (c) 2006-2010, 2018 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
19sep18,m_w make sure the code map of inline ASM under GNU
is correct (VXW6-86665)
13sep10,scm WIND002322578 remove type-punning warnings...
29apr10,pad Moved extern C statement after include statements.
15may09,gls made memory barriers available in user space
28apr09,cww Add fixed size APIs
29aug08,to add inline atomic routines for GCC
16jun08,zl use _WRS_BARRIER() for memory barrier implementations.
17jan08,gls renamed inline routines
03jan08,gls fixed DCC _inline_vxCas()
11dec07,gls Added _inline_vxCas()
29nov06,scm Created
*/
#ifndef __INCvxAtomicArchLibh
#define __INCvxAtomicArchLibh
#include <arch/i86/vxAtomicArchLibCommon.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#if defined (__DCC__)
#define VXCAS_COMMON(address, old_value, new_value) \
movl old_value,%eax; /* get old_value to cmp */ \
lock; /* lock the Bus during the next inst */ \
cmpxchg new_value, (address); /* if (%eax == (address) */ \
/* {ZF = 1; (address) = %ecx;} */ \
/* else */ \
/* {ZF = 0; %eax = (address);} */ \
jz 2f; \
movl $0, %eax; /* set status to FALSE */ \
jmp 1f; \
2: \
movl $1, %eax; /* set status to TRUE */ \
1:
__asm volatile BOOL vxAtomicCas_inline (atomic_t * address, atomicVal_t old_value,
atomicVal_t new_value)
{
% reg address; mem old_value; mem new_value;
! "ax", "cx"
movl new_value,%ecx /* get new_value to set */
VXCAS_COMMON (address, old_value, %ecx)
% reg address; mem old_value; reg new_value;
! "ax"
VXCAS_COMMON (address, old_value, new_value)
% mem address; mem old_value; mem new_value;
! "ax", "cx", "dx"
movl new_value,%ecx /* get new_value to set */
movl address,%edx /* get address */
VXCAS_COMMON (%edx, old_value, %ecx)
% mem address; mem old_value; reg new_value;
! "ax", "dx"
movl address,%edx /* get address */
VXCAS_COMMON (%edx, old_value, new_value)
}
__asm volatile BOOL vxAtomic32Cas_inline (atomic32_t * address, atomic32Val_t old_value,
atomic32Val_t new_value)
{
% reg address; mem old_value; mem new_value;
! "ax", "cx"
movl new_value,%ecx /* get new_value to set */
VXCAS_COMMON (address, old_value, %ecx)
% reg address; mem old_value; reg new_value;
! "ax"
VXCAS_COMMON (address, old_value, new_value)
% mem address; mem old_value; mem new_value;
! "ax", "cx", "dx"
movl new_value,%ecx /* get new_value to set */
movl address,%edx /* get address */
VXCAS_COMMON (%edx, old_value, %ecx)
% mem address; mem old_value; reg new_value;
! "ax", "dx"
movl address,%edx /* get address */
VXCAS_COMMON (%edx, old_value, new_value)
}
#define vxCas_inline vxAtomicCas_inline
#define vxAtomicAdd_inline vxAtomicAdd
#define vxAtomic32Add_inline vxAtomic32Add
#define vxAtomicSub_inline vxAtomicSub
#define vxAtomic32Sub_inline vxAtomic32Sub
#define vxAtomicInc_inline vxAtomicInc
#define vxAtomic32Inc_inline vxAtomic32Inc
#define vxAtomicDec_inline vxAtomicDec
#define vxAtomic32Dec_inline vxAtomic32Dec
#define vxAtomicGet_inline vxAtomicGet
#define vxAtomic32Get_inline vxAtomic32Get
#define vxAtomicSet_inline vxAtomicSet
#define vxAtomic32Set_inline vxAtomic32Set
#define vxAtomicClear_inline vxAtomicClear
#define vxAtomic32Clear_inline vxAtomic32Clear
#elif defined (__GNUC__)
static __inline__ BOOL vxAtomic32Cas_inline
(
atomic32_t * target, /* memory location to compare-and-swap */
atomic32Val_t oldValue, /* compare to this value */
atomic32Val_t newValue /* swap with this value */
)
{
BOOL swapped;
__asm__ volatile
(
"movl %3, %%eax;" /* move oldValue to %eax */
"lock;" /* lock the Bus during the next inst */
"cmpxchg %4, %2;" /* if (%eax == *target) */
/* {ZF = 1; *target = newValue;} */
/* else */
/* {ZF = 0; %eax = *target;} */
"setz %%al;" /* if success, set swapped to TRUE else FALSE */
"movzbl %%al, %0" /* zero extend swapped */
: "=&a" (swapped), /* output: swapped is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)), /* input: *target is %2 */
"g" (oldValue), /* oldValue is %3 */
"r" (newValue) /* newValue is %4 */
: "memory" /* memory clobber for code barrier */
);
return swapped;
}
static __inline__ atomic32Val_t vxAtomic32Add_inline
(
atomic32_t * target,
atomic32Val_t value
)
{
__asm__ volatile
(
"lock;" /* lock the Bus during the next inst */
"xaddl %0, %2" /* TMP = value + *target */
/* value = *target */
/* *target = TMP */
: "+r" (value), /* output: value is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)) /* input: *target is %2 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
static __inline__ atomic32Val_t vxAtomic32Sub_inline
(
atomic32_t * target,
atomic32Val_t value
)
{
__asm__ volatile
(
"negl %0;" /* Negate value... */
"lock;" /* lock the Bus during the next inst */
"xaddl %0, %2" /* TMP = -value + *target */
/* value = *target */
/* *target = TMP */
: "+r" (value), /* output: value is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)) /* input: *target is %2 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
static __inline__ atomic32Val_t vxAtomic32Inc_inline
(
atomic32_t * target
)
{
atomic32Val_t value;
__asm__ volatile
(
"movl $1, %0;" /* inc by 1 */
"lock;" /* lock the Bus during the next inst */
"xaddl %0, %2" /* TMP = *target + 1 */
/* value = *target */
/* *target = TMP */
: "=&r" (value), /* output: value is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)) /* input: *target is %2 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
static __inline__ atomic32Val_t vxAtomic32Dec_inline
(
atomic32_t * target
)
{
atomic32Val_t value;
__asm__ volatile
(
"movl $(-1), %0;" /* dec by 1 */
"lock;" /* lock the Bus during the next inst */
"xaddl %0, %2" /* TMP = *target - 1 */
/* value = *target */
/* *target = TMP */
: "=&r" (value), /* output: value is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)) /* input: *target is %2 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
static __inline__ atomic32Val_t vxAtomic32Get_inline
(
atomic32_t * target
)
{
atomic32Val_t value;
__asm__ volatile
(
"movl %1, %0" /* get value with bus-lock */
: "=r" (value) /* output: value is %0 */
: "m" (*(target)) /* input: *target is %1 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
static __inline__ atomic32Val_t vxAtomic32Set_inline
(
atomic32_t * target,
atomic32Val_t value
)
{
__asm__ volatile
(
"xchgl %0, %2" /* set value with bus-lock */
: "+r" (value), /* output: value is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)) /* input: *target is %2 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
static __inline__ atomic32Val_t vxAtomic32Clear_inline
(
atomic32_t * target
)
{
atomicVal_t value;
__asm__ volatile
(
"movl $0, %0;" /* 'clear' value to set */
"xchgl %0, %2" /* swap 'clear' value with bus-lock */
: "=&r" (value), /* output: value is %0 */
"=m" (target) /* target is %1 */
: "m" (*(target)) /* input: *target is %2 */
: "memory" /* memory clobber for code barrier */
);
return value;
}
#define vxCas_inline vxAtomic32Cas_inline
#define vxAtomicCas_inline vxAtomic32Cas_inline
#define vxAtomicAdd_inline vxAtomic32Add_inline
#define vxAtomicSub_inline vxAtomic32Sub_inline
#define vxAtomicInc_inline vxAtomic32Inc_inline
#define vxAtomicDec_inline vxAtomic32Dec_inline
#define vxAtomicGet_inline vxAtomic32Get_inline
#define vxAtomicSet_inline vxAtomic32Set_inline
#define vxAtomicClear_inline vxAtomic32Clear_inline
#else
#define vxCas_inline vxAtomicCas
#define vxAtomicCas_inline vxAtomicCas
#define vxAtomic32Cas_inline vxAtomic32Cas
#define vxAtomicAdd_inline vxAtomicAdd
#define vxAtomic32Add_inline vxAtomic32Add
#define vxAtomicSub_inline vxAtomicSub
#define vxAtomic32Sub_inline vxAtomic32Sub
#define vxAtomicInc_inline vxAtomicInc
#define vxAtomic32Inc_inline vxAtomic32Inc
#define vxAtomicDec_inline vxAtomicDec
#define vxAtomic32Dec_inline vxAtomic32Dec
#define vxAtomicGet_inline vxAtomicGet
#define vxAtomic32Get_inline vxAtomic32Get
#define vxAtomicSet_inline vxAtomicSet
#define vxAtomic32Set_inline vxAtomic32Set
#define vxAtomicClear_inline vxAtomicClear
#define vxAtomic32Clear_inline vxAtomic32Clear
#endif /* _VX_TOOL_FAMILY */
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCvxAtomicArchLibh */
@@ -0,0 +1,51 @@
/* vxAtomicArchLibCommon.h - IA32 specific atomic library header */
/*
* Copyright (c) 2009, 2011-2012 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01c,27apr12,scm WIND00346365 - VX_MEM_BARRIER_R()/_W()/_RW all using
mfence...
01b,05jan11,kk make VX_MEM_BARRIER_X() macros CPU variant dependent
01a,17may09,gls written.
*/
#ifndef __INCvxAtomicArchLibCommonh
#define __INCvxAtomicArchLibCommonh
#ifdef __cplusplus
extern "C" {
#endif
#define _WRS_ARCH_SUPPORTS_MEM_BARRIER
/*
* Macros to provide memory barrier.
*
* For variants older than PENTIUM4, the mfence instruction
* is not supported.
*/
#if (CPU==PENTIUM)
#define VX_MEM_BARRIER_R() _WRS_ASM("NOP")
#define VX_MEM_BARRIER_W() _WRS_ASM("NOP")
#define VX_MEM_BARRIER_RW() _WRS_ASM("NOP")
#define VX_INSTR_BARRIER() _WRS_ASM("NOP")
#else
#define VX_MEM_BARRIER_R() _WRS_BARRIER("lfence");
#define VX_MEM_BARRIER_W() _WRS_BARRIER("sfence");
#define VX_MEM_BARRIER_RW() _WRS_BARRIER("mfence");
#define VX_INSTR_BARRIER() _WRS_BARRIER("mfence");
#endif
#ifdef __cplusplus
}
#endif
#endif /* __INCvxAtomicArchLibCommonh */
@@ -0,0 +1,66 @@
/*
* vxCpuArchLib.h - header for arch/board dependent CPU Identification
* support routines
*/
/*
* Copyright (c) 2006, 2008-2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01k,28jan10,jb modifying per uHLD 1044
01j,18sep09,scm remove _WRS_CPU_BIOS_CONFIGURED ...
01i,16jan09,scm declare _func_cpuIndexGet...
01h,05jun08,rec add vxRsdpPtr
01g,01nov06,scm remove arch definitions for vxCpuEnabledGet &
vxCpuConfiguredGet
01f,30oct06,scm change references from vxCpuLib to vxCpuArchLib...
01e,14sep06,scm add count to track SMP initialized CPUs
01d,26jul06,scm tie vxCpuCount to MP Configuration Entry CPU counter
(mpApicNcpu).
01c,21jul06,scm _func_cpuIndexGet not required at this time...
01b,21jul06,scm Move SMP macros to private header.
01a,05jul06,scm written.
*/
#ifndef __INCvxCpuArchLibh
#define __INCvxCpuArchLibh
#ifdef __cplusplus
extern "C" {
#endif
/* typedefs */
typedef unsigned int cpuid_t; /* hardware CPU identification */
/* function declarations */
/* Arch or BSP system-dependent implementation routine */
extern unsigned int (*_func_cpuIndexGet) (void);
extern unsigned int vxCpuIndexGet (void);
extern unsigned int vxCpuPhysIndexGet (void);
extern unsigned int vxCpuIdToPhysIndex (cpuid_t cpuID);
extern cpuid_t vxCpuPhysIndexToId (unsigned int cpuPhysIdx);
extern unsigned int vxCpuCount;
extern char * vxRsdpPtr;
#ifdef __cplusplus
}
#endif
#endif /* __INCvxCpuArchLibh */
+91
View File
@@ -0,0 +1,91 @@
/* vxI86Lib.h - header for arch/board dependent routines for the I80X86 */
/*
* Copyright (c) 2001-2003, 2005, 2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01i,09may12,j_l WIND00337546 - Add vxGdtrSet() and vxLdtrSet() prototypes.
Modify vxLdtrGet() prototype.
Adhere to coding standards more closely
01h,16feb05,aeg added various function prototypes (SPR #106381).
01g,24dec03,jb Adding prototype for vxDsGet
01f,04sep02,hdn added vxIdleHookAdd(), vxIdleShow() prototype.
01e,11apr02,pai Added vxCpuShow(), vxDrShow(), and vxSseShow() prototypes.
01d,26mar02,pai Added vxShowInit() prototype (SPR 74103).
01c,13nov01,ahm Added rudimentary support for power management (SPR#32599)
01b,26oct01,hdn added vxDr[SG]et(), vxTss[GS]et() prototype.
01a,22aug01,hdn written.
*/
#ifndef __INCvxI86Libh
#define __INCvxI86Libh
#ifdef __cplusplus
extern "C" {
#endif
/* power management mode definitions - used by vxPowerModeSet/Get */
#define VX_POWER_MODE_DISABLE (0x1) /* power mgt disable: loop when idle*/
#define VX_POWER_MODE_AUTOHALT (0x4) /* AutoHalt power management mode */
/* function declarations */
#ifndef _ASMLANGUAGE
extern void vxMemProbeTrap (void);
extern STATUS vxMemProbeSup (int length, char * adrs, char * pVal);
extern int vxCr0Get (void);
extern void vxCr0Set (int cr0);
extern int vxCr2Get (void);
extern void vxCr2Set (int cr2);
extern int vxCr3Get (void);
extern void vxCr3Set (int cr3);
extern int vxCr4Get (void);
extern void vxCr4Set (int cr4);
extern int vxCsGet (void);
extern int vxDsGet (void);
extern int vxSsGet (void);
extern int vxEflagsGet (void);
extern void vxEflagsSet (int eflags);
extern void vxDrGet (int * pDr0, int * pDr1, int * pDr2,
int * pDr3, int * pDr4, int * pDr5,
int * pDr6, int * pDr7);
extern void vxDrSet (int dr0, int dr1, int dr2, int dr3,
int dr4, int dr5, int dr6, int dr7);
extern int vxTssGet (void);
extern void vxTssSet (int value);
extern void vxGdtrGet (long long int * pGdtr);
extern void vxGdtrSet (long long int * pGdtr);
extern void vxIdtrGet (long long int * pIdtr);
extern void vxLdtrGet (UINT16 * pLdtr);
extern void vxLdtrSet (UINT16 ldtr);
IMPORT STATUS vxPowerModeSet (UINT32 mode);
IMPORT UINT32 vxPowerModeGet (void);
extern STATUS vxIdleHookAdd (FUNCPTR entHook, FUNCPTR exitHook);
extern VOID vxIdleEntHookRtn (void);
extern VOID vxIdleExtHookRtn (void);
extern UINT32 vxIdleUtilGet (void);
extern void vxShowInit (void);
extern void vxCpuShow (void);
extern void vxDrShow (void);
extern void vxSseShow (int);
extern void vxIdleShow (BOOL debug);
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* __INCvxI86Libh */
@@ -0,0 +1,54 @@
/* vxInlineArch.h - i86/x86_64 inline macro configuration */
/*
* Copyright (c) 2007-2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01g,24mar10,scm enable remaining inlines for 64 bit...
01f,24mar10,scm enable vxAtomic inlines...
01e,23mar10,scm adjust for vxAtomics...
01d,15apr09,sem Add new intCpuMicroLock API
01d,18nov08,pad For LP64 do not use inlines until they are adapted.
01c,29aug08,to add more inline atomic routines
01b,11dec07,gls added _WRS_INLINE_vxCas
01a,19jun07,zl created
*/
#ifndef __INCvxInlineArchh
#define __INCvxInlineArchh
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file is included from <vxInline.h>. It may define _WRS_INLINE_xxx
* build configuration macros in order to enable architecture specific
* inlined implementation of a macro definition.
*/
#define _WRS_INLINE_intCpuLock
#define _WRS_INLINE_intCpuUnlock
#define _WRS_INLINE_intCpuMicroLock
#define _WRS_INLINE_intCpuMicroUnlock
#define _WRS_INLINE_vxAtomicAdd
#define _WRS_INLINE_vxAtomicSub
#define _WRS_INLINE_vxAtomicInc
#define _WRS_INLINE_vxAtomicDec
#define _WRS_INLINE_vxAtomicGet
#define _WRS_INLINE_vxAtomicSet
#define _WRS_INLINE_vxAtomicClear
#define _WRS_INLINE_vxCas
#ifdef __cplusplus
}
#endif
#endif /* __INCvxInlineArchh */

Some files were not shown because too many files have changed in this diff Show More