Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose add CPUECTLR access functions. #1605

Open
ua1arn opened this issue Feb 11, 2023 · 4 comments
Open

Propose add CPUECTLR access functions. #1605

ua1arn opened this issue Feb 11, 2023 · 4 comments

Comments

@ua1arn
Copy link
Contributor

ua1arn commented Feb 11, 2023

How about adding this functions to CMSIS/Core_A/Include/cmsis_cp15.h ?
This register used for support SMP data coherency in conjunction with ACTLR.

#if (__CORTEX_A == 8U)

#define CPUECTLR_SMPEN_Msk (1u << 6)	// SMPEN 1: Enables data coherency with other cores in the cluster.

// 4.5.77 CPU Extended Control Register

/** \brief  Get CPUECTLR
    \return               CPU Extended Control Register
 */
__STATIC_FORCEINLINE uint64_t __get_CPUECTLR(void)
{
	uint64_t result;
  __get_CP64(15, 1, result, 15);
  return(result);
}

/** \brief  Set CPUECTLR
    \param [in]    cpuectlr  CPU Extended Control Register
 */
__STATIC_FORCEINLINE void __set_CPUECTLR(uint64_t cpuectlr)
{
	__set_CP64(15, 1, cpuectlr, 15);
}

#endif /* (__CORTEX_A == 8U)  */
@ghost
Copy link

ghost commented Feb 16, 2023

Hello @ua1arn, are these changes required to support Cortex-A8 devices? You mention a dedicated chapter 4.5.77 CPU Extended Control Register. Could you point me to the document where I can find this information?

@ua1arn
Copy link
Contributor Author

ua1arn commented Feb 17, 2023

You right. CPUECTLR bs a Cortex-A53 specific register (like different-specs ACTLR for Cortex-A7 and Cortex-A9.
Mentioned document is DDI0500J_cortex_a53_r0p4_trm.pdf
All these updates tested on Allwinner A64.
May be right paramerer are:

#define __CORTEX_A                   53U      /*!< Cortex-A# Core                              */
#define __CA_REV                 0x0000U      /*!< Core revision r0p0                          */
#define __FPU_PRESENT                 1U      /*!< Set to 1 if FPU is present                  */
#define __GIC_PRESENT                 1U      /*!< Set to 1 if GIC is present                  */
#define __TIM_PRESENT                 1U      /*!< Set to 1 if TIM is present                  */
#define __L2C_PRESENT                 0U      /*!< Set to 1 if L2C is present                  */

@ua1arn
Copy link
Contributor Author

ua1arn commented Feb 17, 2023

For reference, predefined sybols fo gcc with -mcpu=cortex-a53 in attachments.
defines_aarch64.txt
defines_aarch32.txt

@ghost
Copy link

ghost commented Feb 20, 2023

Hello @ua1arn,
if CPUECTLR is a Cortex-A53 specific register then I would suggest to guard the functions with macro #if (__CORTEX_A == 53U). Macro #define __CORTEX_A 53U needs to be configured in the device specific header file.
Please let me know you opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants