运维开发网

linux内核是如何支持深度睡眠(deep sleep)方式的?

运维开发网 https://www.qedev.com 2020-07-09 12:04 出处:网络
1. 硬件架构   arm64 2. 内核版本   4.19 3. 分析相关函数   get_set_conduit_method()

1. 硬件架构

  arm64

2. 内核版本

  4.19

3. 分析相关函数

  get_set_conduit_method()

    -> of_property_read_string(np, "method", &method))

    -> set_conduit(PSCI_CONDUIT_HVC) 或set_conduit(PSCI_CONDUIT_SMC),根据设备树中的method属性来设定,

      设定invoke_psci_fn回调函数(__invoke_psci_fn_smc或者__invoke_psci_fn_hvc)

 

  __invoke_psci_fn_smc()

    -> arm_smccc_smc(),这是个宏定义,如下;

      #define arm_smccc_smc(...) __arm_smccc_smc(__VA_ARGS__, NULL)

      ->__arm_smccc_smc(),定义在arch/arm64/kernel/smccc-call.S中:

          .macro SMCCC instr

          .cfi_startproc

          \instr #0

          ldr x4, [sp]

          stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]

          stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]

          ldr x4, [sp, #8]

          cbz x4, 1f /* no quirk structure */

          ldr x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]

          cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6

          b.ne 1f

          str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]

          1: ret

          .cfi_endproc

          .endm

 
 

        /*

        * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,

        * unsigned long a3, unsigned long a4, unsigned long a5,

        * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,

        * struct arm_smccc_quirk *quirk)

        */

              ENTRY(__arm_smccc_smc)
              SMCCC   smc
       ENDPROC(__arm_smccc_smc)
0

精彩评论

暂无评论...
验证码 换一张
取 消