xref: /freebsd/sys/contrib/ncsw/inc/core_ext.h (revision c2c014f24c10f90d85126ac5fbd4d8524de32b1c)
1*852ba100SJustin Hibbits /*
2*852ba100SJustin Hibbits  * Copyright 2008-2012 Freescale Semiconductor Inc.
30aeed3e9SJustin Hibbits  *
40aeed3e9SJustin Hibbits  * Redistribution and use in source and binary forms, with or without
50aeed3e9SJustin Hibbits  * modification, are permitted provided that the following conditions are met:
60aeed3e9SJustin Hibbits  *     * Redistributions of source code must retain the above copyright
70aeed3e9SJustin Hibbits  *       notice, this list of conditions and the following disclaimer.
80aeed3e9SJustin Hibbits  *     * Redistributions in binary form must reproduce the above copyright
90aeed3e9SJustin Hibbits  *       notice, this list of conditions and the following disclaimer in the
100aeed3e9SJustin Hibbits  *       documentation and/or other materials provided with the distribution.
110aeed3e9SJustin Hibbits  *     * Neither the name of Freescale Semiconductor nor the
120aeed3e9SJustin Hibbits  *       names of its contributors may be used to endorse or promote products
130aeed3e9SJustin Hibbits  *       derived from this software without specific prior written permission.
140aeed3e9SJustin Hibbits  *
150aeed3e9SJustin Hibbits  *
160aeed3e9SJustin Hibbits  * ALTERNATIVELY, this software may be distributed under the terms of the
170aeed3e9SJustin Hibbits  * GNU General Public License ("GPL") as published by the Free Software
180aeed3e9SJustin Hibbits  * Foundation, either version 2 of that License or (at your option) any
190aeed3e9SJustin Hibbits  * later version.
200aeed3e9SJustin Hibbits  *
210aeed3e9SJustin Hibbits  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
220aeed3e9SJustin Hibbits  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
230aeed3e9SJustin Hibbits  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
240aeed3e9SJustin Hibbits  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
250aeed3e9SJustin Hibbits  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
260aeed3e9SJustin Hibbits  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
270aeed3e9SJustin Hibbits  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
280aeed3e9SJustin Hibbits  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
290aeed3e9SJustin Hibbits  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
300aeed3e9SJustin Hibbits  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
310aeed3e9SJustin Hibbits  */
320aeed3e9SJustin Hibbits 
33*852ba100SJustin Hibbits 
340aeed3e9SJustin Hibbits /**************************************************************************//**
350aeed3e9SJustin Hibbits  @File          core_ext.h
360aeed3e9SJustin Hibbits 
370aeed3e9SJustin Hibbits  @Description   Generic interface to basic core operations.
380aeed3e9SJustin Hibbits 
390aeed3e9SJustin Hibbits                 The system integrator must ensure that this interface is
400aeed3e9SJustin Hibbits                 mapped to a specific core implementation, by including the
410aeed3e9SJustin Hibbits                 appropriate header file.
420aeed3e9SJustin Hibbits *//***************************************************************************/
430aeed3e9SJustin Hibbits #ifndef __CORE_EXT_H
440aeed3e9SJustin Hibbits #define __CORE_EXT_H
450aeed3e9SJustin Hibbits 
46*852ba100SJustin Hibbits #ifdef CONFIG_FMAN_ARM
47*852ba100SJustin Hibbits #include "arm_ext.h"
48*852ba100SJustin Hibbits #include <linux/smp.h>
49*852ba100SJustin Hibbits #else
500aeed3e9SJustin Hibbits #ifdef NCSW_PPC_CORE
510aeed3e9SJustin Hibbits #include "ppc_ext.h"
520aeed3e9SJustin Hibbits #elif defined(NCSW_VXWORKS)
530aeed3e9SJustin Hibbits #include "core_vxw_ext.h"
540aeed3e9SJustin Hibbits #else
550aeed3e9SJustin Hibbits #error "Core is not defined!"
560aeed3e9SJustin Hibbits #endif /* NCSW_CORE */
570aeed3e9SJustin Hibbits 
580aeed3e9SJustin Hibbits #if (!defined(CORE_IS_LITTLE_ENDIAN) && !defined(CORE_IS_BIG_ENDIAN))
590aeed3e9SJustin Hibbits #error "Must define core as little-endian or big-endian!"
600aeed3e9SJustin Hibbits #endif /* (!defined(CORE_IS_LITTLE_ENDIAN) && ... */
610aeed3e9SJustin Hibbits 
62*852ba100SJustin Hibbits #ifndef CORE_CACHELINE_SIZE
63*852ba100SJustin Hibbits #error "Must define the core cache-line size!"
64*852ba100SJustin Hibbits #endif /* !CORE_CACHELINE_SIZE */
65*852ba100SJustin Hibbits 
66*852ba100SJustin Hibbits #endif /* CONFIG_FMAN_ARM */
67*852ba100SJustin Hibbits 
680aeed3e9SJustin Hibbits 
690aeed3e9SJustin Hibbits /**************************************************************************//**
700aeed3e9SJustin Hibbits  @Function      CORE_GetId
710aeed3e9SJustin Hibbits 
720aeed3e9SJustin Hibbits  @Description   Returns the core ID in the system.
730aeed3e9SJustin Hibbits 
740aeed3e9SJustin Hibbits  @Return        Core ID.
750aeed3e9SJustin Hibbits *//***************************************************************************/
760aeed3e9SJustin Hibbits uint32_t CORE_GetId(void);
770aeed3e9SJustin Hibbits 
780aeed3e9SJustin Hibbits /**************************************************************************//**
790aeed3e9SJustin Hibbits  @Function      CORE_MemoryBarrier
800aeed3e9SJustin Hibbits 
810aeed3e9SJustin Hibbits  @Description   This routine will cause the core to stop executing any commands
820aeed3e9SJustin Hibbits                 until all previous memory read/write commands are completely out
830aeed3e9SJustin Hibbits                 of the core's pipeline.
840aeed3e9SJustin Hibbits 
850aeed3e9SJustin Hibbits  @Return        None.
860aeed3e9SJustin Hibbits *//***************************************************************************/
870aeed3e9SJustin Hibbits void CORE_MemoryBarrier(void);
88*852ba100SJustin Hibbits #define fsl_mem_core_barrier() CORE_MemoryBarrier()
890aeed3e9SJustin Hibbits 
900aeed3e9SJustin Hibbits #endif /* __CORE_EXT_H */
91