Documentation/arm/firmware.txt

本文介绍了一种针对ARM平台的固件操作接口设计,通过该接口可以注册并调用特定于固件的功能,如进入CPU空闲模式、设置启动地址等。文章详细描述了如何定义这些操作,并提供了具体的代码示例。

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.


Chinese maintainer: 沈芳丽  <fairyshen@163.com>
---------------------------------------------------------------------
Documentation/arm/firmware.txt的中文翻译


如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。


中文版维护者:沈芳丽  <fairyshen@163.com>
中文版翻译者:沈芳丽  <fairyshen@163.com>
中文版校译者:沈芳丽  <fairyshen@163.com>


以下为正文

Interface for registering and calling firmware-specific operations for ARM.
为ARM接口注册和调用固件的具体操作。
----
Tomasz Figa <t.figa@samsung.com>
 
Some boards are running with secure firmware running in TrustZone secure 
world, which changes the way some things have to be initialized. 
有些在TrustZone安全世界的主板在安全运行固件的配置下运行,它改变了有
些程序必须初始化的方法。
 
This makes a need to provide an interface for such platforms to specify 
available firmware operations and call them when needed.
这使得对指定可用固件操作以及需要时候可以回应的平台提供一个接口有所需。
 
Firmware operations can be specified using struct firmware_ops
固件操作可以被指定使用struct firmware_ops 
 
struct firmware_ops {
                   /*
                  * Enters CPU idle mode
                 */
                    int (*do_idle)(void);
                    /*
                    * Sets boot address of specified physical CPU
                    */
                    int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr);
                    /*
                    * Boots specified physical CPU
                    */
                    int (*cpu_boot)(int cpu);
                    /*
                    * Initializes L2 cache
                    */
                    int (*l2x0_init)(void);
            };
and then registered with register_firmware_ops function
然后注册register_firmware_ops功能
void register_firmware_ops(const struct firmware_ops *ops)
 
the ops pointer must be non-NULL.
OPS指针必须非空。
 
There is a default, empty set of operations provided, so there is no need to 
set anything if platform does not require firmware operations.
空集提供操作是默认的,所以如果平台不要求固件操作,也没有必要设置什么。
 
To call a firmware operation, a helper macro is provided
提供一个帮手宏来调用固件操作
 
#define call_firmware_op(op, ...)                               \
                    ((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : (-ENOSYS))
 
the macro checks if the operation is provided and calls it or otherwise returns 
-ENOSYS to signal that given operation is not available (for example, to allow fallback 
to legacy operation).
宏检查操作是否提供或以其他方式回馈ENOSYS给出的操作信号不可用(例如,允许退
回到传统的操作)。
 
Example of registering firmware operations:
登记固件操作的示例:
 
/* board file */
    
            static int platformX_do_idle(void)
            {
                    /* tell platformX firmware to enter idle */
                    return 0;
            }
    
            static int platformX_cpu_boot(int i)
            {
                    /* tell platformX firmware to boot CPU i */
                    return 0;
            }
    
           static const struct firmware_ops platformX_firmware_ops = {
                    .do_idle        = exynos_do_idle,
                   .cpu_boot       = exynos_cpu_boot,
                    /* other operations not available on platformX */
            };
    
            /* init_early callback of machine descriptor */
            static void __init board_init_early(void)
            {
                    register_firmware_ops(&platformX_firmware_ops);
            }
 
Example of using a firmware operation:
使用固件操作的示例:
 
/* some platform code, e.g. SMP initialization */
   
            __raw_writel(virt_to_phys(exynos4_secondary_startup),
                    CPU1_BOOT_REG);
   
            /* Call Exynos specific smc call */
            if (call_firmware_op(cpu_boot, cpu) == -ENOSYS)
                    cpu_boot_legacy(...); /* Try legacy way */
   
           gic_raise_softirq(cpumask_of(cpu), 1);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值