18
presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March 26-30, 2018 Presented by Erik Schmauss (Intel)

The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

  • Upload
    others

  • View
    20

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

presented by

The State of ACPI Source Language (ASL) Programming

Spring 2018 UEFI Seminar and PlugfestMarch 26-30, 2018

Presented by Erik Schmauss (Intel)

Page 2: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Agenda

• Intro to ACPI/ASL

• Challenges of ASL

• Addressing Challenges

• Questions

www.uefi.org 2UEFI Plugfest – Spring 2018

Page 3: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

What is Advanced Configuration and Power Interface (ACPI)?

www.uefi.org 3UEFI Plugfest – Spring 2018

• Firmware interface used by OS– Enables device discovery and configuration

– Enables OS power management

• Specifies firmware data tables as well as executable bytecode called AML

• This talk will focus on the executable bytecode written in a language called ASL

Page 4: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

What is ACPI Source Language (ASL)?

www.uefi.org 4UEFI Plugfest – Spring 2018

• A language written by firmware developers to define executable ACPI tables

• Stands for ACPI source language

• ASL gets compiled to AML

• AML gets interpreted in the kernel space of the OS

Page 5: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

ACPI Firmware Development

www.uefi.org 5UEFI Plugfest – Spring 2018

Hardware specification

ASL AML ACPI Tables

Page 6: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

ACPI Firmware Interaction with OS

www.uefi.org 6UEFI Plugfest – Spring 2018

OS KernelACPI

tablesAML

Interpreter

Page 7: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Agenda

• Intro to ACPI/ASL

• Challenges of ASL

• Addressing Challenges

• Questions

www.uefi.org 7UEFI Plugfest – Spring 2018

Page 8: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Challenges of ASL Programming

• We have identified a shortage of skilled ASL programmers

• Firmware code is increasing in complexity

• Firmware code for a new platform is often copy/pasted from older platforms

• This frequently results in poor code quality

UEFI Plugfest – Spring 2018 www.uefi.org 8

Page 9: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Examples of Bad ASL Code

Name (OBJ1, 0) //create object OBJ1

OBJ1 = 1

The store is unnecessary

We can avoid the store operation by initializing OBJ1 to 1

UEFI Plugfest – Spring 2018 www.uefi.org 9

Page 10: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Examples of Bad ASL Code

Method (_PCD, 1, NotSerialized)

{

\_PR.CPU0.M001 = INT1

}

M001 is a method that returns a reference, INT1 is an integer. This results in a runtime error.

UEFI Plugfest – Spring 2018 www.uefi.org 10

Page 11: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Examples of Bad ASL Code

External (DEV1)

Name (PKG1,

Package() {DEV1})

The named object, DEV1, is not defined but is referenced by PKG1

UEFI Plugfest – Spring 2018 www.uefi.org 11

Page 12: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Impact of Challenges

• Some operating systems emit errors from the AML interpreter that users can see– This can frighten end-users (FUD)

• Run time errors during AML evaluation abort the execution– This means that the OS could be missing

functionality that firmware developers think they enabled

UEFI Plugfest – Spring 2018 www.uefi.org 12

Page 13: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Agenda

• Intro to ACPI/ASL

• Challenges of ASL

• Addressing Challenges

• Questions

www.uefi.org 13UEFI Plugfest – Spring 2018

Page 14: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

What Can We Do About this?

• Use the latest ASL compiler– intel ASL compiler (iASL) catch many errors that

could happen during runtime.

• Use a user-space interpreter to execute AML before packaging with firmware– Verify that ACPI tables tables load correctly

• Create an ACPI firmware developer tutorial– Introduces ASL to firmware developers– Outlines how ASL should be used

UEFI Plugfest – Spring 2018 www.uefi.org 14

Page 15: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

What Can We Do About this?

• Communicate with ACPICA developers and give us feedback!

– If you write ANY amount of ASL, we would love to interact with you!

UEFI Plugfest – Spring 2018 www.uefi.org 15

Page 16: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Questions?

www.uefi.org 16UEFI Plugfest – Spring 2018

Page 17: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

Thanks for attending the Spring 2018 UEFI Plugfest

For more information on the UEFI Forum and UEFI Specifications, visit http://www.uefi.org

presented by

www.uefi.org 17UEFI Plugfest – Spring 2018

Page 18: The State of ACPI Source Language (ASL) Programming · 2018-04-03 · presented by The State of ACPI Source Language (ASL) Programming Spring 2018 UEFI Seminar and Plugfest March

References

• ACPICA project website https://acpica.org/

• ACPICA mailing list https://lists.acpica.org/mailman/listinfo

UEFI Plugfest – Spring 2018 www.uefi.org 18