asl code 看不懂,原因就是ACPI SPEC 第19章没看

来源:互联网 发布:linux 切换用户sudo 编辑:程序博客网 时间:2024/06/11 09:45

ACPI Source Language (ASL) Reference

This section formally defines the ACPI Language(ASL). ASL is a source language for defining ACPI objects including writing

ACPI control methods. OEMs and BIOS developers define objects and write control methods in ASL and then use a

translator tool (compiler) to generate ACPI Mechine Language(AML) versions of the control methods. For a formal

definition of AML. see the ACPI Mechine Language (AML) Specification, section 20. "ACPI Mechine Language Specification."

 

这一节正式(精确)定义了ASL. ASL 是一种用来定义ACPI object 包括ACPI 控制方法的语言。OEM 和bios 开发者使用ASL定义object

以及编写控制方法,然后用一个转换工具(编译器)生成ACPI 机器语言。至于AML的形式定义,参考第20章。

 

AML and ASL are different languages though they are closely related.

AML 和ASL 是两种完全不同的语言,虽然它们关系特别紧密。

 

Every ACPI-compatible OS must support AML. A given user can define some arbitrary source language( to replace ASL) and

write a tool to translate it to AML.

 

每一个兼容ACPI的OS都必须支持AML.用户可以定义任意的源语言去代替asl, 然后使用某个工具去转换为AML.

 

An OEM or BIOS vendor needs to write ASL and be able to single-step AML for debugging.(Debuggers and similar tools are expected to be AML-level tools, not source-level

tools.) An ASL translator implementer must understand how to read ASL and generate AML. An AML interpreter author must understand how to execute AML.


OEM和BIOS厂商需要去写ASL 以及为了debug 可以单步执行的aml.  一个asl   转换器的实现者必能能理解怎么去阅读asl 以及生成aml.aml  解释器的作者必须理解怎么执行

AML.


This section has two parts:

The ASL grammar, which is the formal ASL specification and also serves as a quick reference.

A full ASL reference, which includes for each ASL operator: the operator invocation syntax, the type of each argument, and a description of the action and use of the operator.


这一节有两部分:

ASL 语法, 这个就是正式(形式化)的ASL 规范 ,还有可以拿来作为快速参考。

一个完整的ASL 参考, 包含了每一个ASL 操作符, 操作符调用语法,参数的类型,操作符动作的描述以及使用。


19.1 ASL Language Grammar

The purpose of this section is to state unambiguously the grammar rules used by the syntax checker of an ASL compiler.

ASL statements declare objects. Each object has three parts, two of which might not be present.


这里涉及到了编译器(compiler), 它的职责就是把asl code 转换为aml. 作为编译器一个很重要的部分就是语法分析器,这里说的是syntax checker 应该是语法分析器的前半部分,功能就是看输入的源语言是否符合语法规则。语法规则就是我们这一节要说的。ASL 语句声明了object. 每一个object 有三部分,其中有两部分,是可选的,简单来说,就是可有可无的。


FixedList refers to a list , of known length, that supplies data that all instances of a given ObjectType must have. A fixed list is written as(a, b, c, ...) where the number of arguments depends on the specific ObjectType, and some elements can be nested objects, that is (a, b, (q, r, s, t), d), Arguments to a FiexedList can have default values, in which case they can be skipped. Thus(,a ,c) will cause the default value for the second argument to be used. Some ObjectTypes can have a null FixedList, which is simply omitted. Trailing arguments of some object types can be left out of a fixed list , in which case the default value is used.




0 0
原创粉丝点击