uefiandiot:bestpracticesin developingiotfirmware% solutions · 2017-03-29 · presented(by...

23
presented by UEFI and IoT: Best Practices in Developing IoT Firmware Solutions Spring 2017 UEFI Seminar and Plugfest March 27 31, 2017 Presented by Hawk Chen (Byosoft) UEFI Plugfest – March 2017 www.uefi.org 1 Updated 20110601

Upload: others

Post on 06-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

presented  by

UEFI  and  IoT:  Best  Practices  in  Developing  IoT  Firmware  

SolutionsSpring  2017  UEFI  Seminar  and  Plugfest

March  27  -­ 31,  2017Presented  by  Hawk  Chen (Byosoft)

UEFI  Plugfest  – March  2017 www.uefi.org 1

Updated  2011-­‐06-­‐01

Page 2: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Agenda

• Introduction• Background• Boot  Performance  Tuning• Easy  Customization  with  Intel  FSP• Summary  /  Questions

UEFI  Plugfest  – March  2017 www.uefi.org 2

Page 3: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Introduction

UEFI  Plugfest  – March  2017 www.uefi.org 3

Page 4: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Introduction

UEFI  Plugfest  – March  2017 www.uefi.org 4

Why we  are  talking  about  this?• IoT  devices for  vertical  segment  bring  many  different  requirements  and  challenges  to  the  UEFI  Firmware  solution

• Easy  customization  is  important  for  scaling  out  of  IoT devices

• To  share our  best  practices  in  an  effort  to  simplify  the  implementation  of  the  UEFI  Firmware  solution  on  IoT devices

Page 5: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Background

UEFI  Plugfest  – March  2017 www.uefi.org 5

Page 6: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Background

UEFI  Plugfest – March  2017 www.uefi.org 6

Industrial  &  Energy

Transportation

Retail

User  experience  (Fast  boot  /  Touch  Screen)

Security  (Protected  boot  &  storage    /    Device  Identification  /  Trusted  Execution  Environment)    

Easy  Customization  and  Differentiation  

Power/Performance  Optimization

IoT  vertical  segments  have different  focuses  and  needs  tailored  firmware  solutions  

Page 7: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Boot  Performance  Tuning

UEFI  Plugfest  – March  2017 www.uefi.org 7

Page 8: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Boot  Performance  Tuning

UEFI  Plugfest  – March  2017 www.uefi.org 8

Performance  Measurement Performance  Optimization

Page 9: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Measurement

UEFI  Plugfest  – March  2017 www.uefi.org 9

Intel  UDK  core  provides  one  infrastructure  to  measure  performance  in  pre-­OS  phase• Uses  PERF_START  &  PERF_END  macro  to  measure  the  time  and  cost  during  the  traced  execution  range,  and  then  creates  a  named  tracing  record

• Uses  DP  under  UEFI  shell  to  view  all  of  the  tracking  records

Page 10: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Measurement

UEFI  Plugfest  – March  2017 www.uefi.org 10

Tracing  Macro  Sample

DP  Output  Sample

Page 11: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Optimization

UEFI  Plugfest  – March  2017 www.uefi.org 11

l Applicable  to  different  boot  phases

l Applicable  to  different  kinds  of  platform  hardware    and  UEFI  Firmware  implementation,  without    impacting  UEFI  compatibility

l Consider  boot  performance  as  early  as  platform  design  phase

Page 12: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Optimization  -­SEC

UEFI  Plugfest  – March  2017 www.uefi.org 12

Phase Optimization

SEC Configure BFV  Flash  area  as  WP  (Write  Protect),  after  enabling  CAR  as  temporary  memory

Enable  SPI  prefetching  and  configure  with  maximum  clock

Initialize  the  BSP  with  maximum  speed

Page 13: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Optimization  -­PEI

UEFI  Plugfest  – March  2017 www.uefi.org 13

Phase OptimizationPEI Initialize  SATA  to  spin  up  HDD  as  early  as  possible

Light up  display  panel  as  early  as  possibleConfigure  Firmware  flash  area  as  WP  (Write  Protect)  after complete  memory  sizingOrganize  the  FLASH  layout  effectively:n Only  report  FvMainCompact  FV  through  EFI_PEI_FIRMWARE_VOLUME_INFO_PPI  to  have  Pei  Core  process  this  single  onen Only  build  FV  HOBs  with  FVs  that  contain  DXE  driverssuch  as  FvMain

Page 14: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Optimization  -­DXE

UEFI  Plugfest  – March  2017 www.uefi.org 14

Phase OptimizationDXE Only  report  variable  FLASH  area  when  initialize  FVB  services

Page 15: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Performance  Optimization  -­BDS

UEFI  Plugfest  – March  2017 www.uefi.org 15

Phase OptimizationBDS Use  GOP  driver instead  of  VBIOS  for  UEFI  boot  only

Utilize non-­‐blocking  storage  IO  for  SATA  deviceAvoid  clearing  the  1st  640KB  memory  for  UEFI  only  boot,  or  use  hardware  based  memory clearing  if  applicableEnhance  boot  path  to  only  initialize  and  configure  the  associate  device  for  selected  boot  optionMinimize USB  timing  for  USB  related  drivers  if  Intel  USB  controller  is  availableMinimize device  hardware  reset  timing  by  staged  initialization    Use cached  data  to  reduce  device  training  time,  such  as  memory,  CPU  BIST  and  so  on

Page 16: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Example:  IoT  IVI  After  tuned

UEFI  Plugfest  – March  2017 www.uefi.org 16

Component Configuration

Processor Intel®  Atom™  Processor  E3827  2C/2T

Memory 2G/1  Channel (DDR3-­‐1066/1333),  Memory  down

Flash 8MB 50MHZ  SPI  Flash

Storage eMMC 8G  /  16G  for  primary  OS  and  applications  

Graphics Intel  ®  Integrated  Graphics  (HDMI  to  RGB,HDMI  to    CVBS,  HDMI  to  YPbPr,  HDMI  to AV)

Operation  System

Android  4.2 (UEFI  Boot)

Boot  time:  6s  -­‐>  2s  after  tuned

Page 17: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Easy  Customization  with  Intel  FSP

UEFI  Plugfest  – March  2017 www.uefi.org 17

Page 18: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

What’s  Intel  FSP  ?

UEFI  Plugfest  – March  2017 www.uefi.org 18

• FSP  =  Firmware Support  Package

• FSP’s  small subset  of  UEFI  Firmware  solution

• Not  a  boot  loader,  but  simply  CPU,  Chipset,  and  memory  initialization  code  

• Released  as  binary  with  API  wrapper

• Only  abstracts  the  firmware  IP• Customers  require  some  

system  firmware  infrastructure  used  with  FSP

Intel  FSP  Usage  Model

FSP  is  NOT  a  boot  loader,  and  requires  integration  with  a  custom  system  firmware  infrastructure

Reference  BIOS

Silicon  Initialization

CustomSystem  FirmwareOr  Boot  Loader

API

Intel  FSP

API

Intel  FSP

Wrapper  APIOther  Glue  

Logic

Extracted

Combined

Page 19: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

UEFI  Plugfest  – March  2017 www.uefi.org 19

A  Sample  Boot  Flow  Involving  FSP  v1.0

After PCI Enumeration

Reset Vector

Switch to 32-bit Mode

Load Microcode

Temp Ram Init

Mem Init

Remove Temp RAM

CPU & Companion

Chip init

Find FSP Header &

Entry Point

Parse Return Data

Platform Init

Bus and Device Init

Boot Device Init

Load OS or other payload

Intel®  Firmware  Support  Package    (Intel®  FSP)

App

Param1  =  AfterPciEnumerationParam2  =  ReadyToBoot

Jump to FSPinit

Entry PointNotifyPhase

Ready to Boot

Param1

Param2

Functionality in FSP

Customer or Ecosystem Provided Functionality

Page 20: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Technique  Highlights  for  UEFI  +  FSP

UEFI  Plugfest  – March  2017 www.uefi.org 20

• Easy  integration  of  FSP  into  UEFI  firmware  solution

• Small  footprint  with  fast  execution• Easy  platform  customization  via  a  stand-­alone  configuration  tool  

• Meets  diverse  requirement  of  IoT  devices  with  non-­PC  design,  such  as  DSS,  IVI,  network  gateway,  storage,  etc.,

• Keep  UEFI  compatibility  as  traditional  UEFI  firmware  solution  

Page 21: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Summary  and  QA’s

UEFI  Plugfest  – March  2017 www.uefi.org 21

• Boot  Performance  tuning  is  conducted  on  platform  level  and  can  leverage  many  common  practices  in  different  boot  phases.

• Platform  customization  with  Intel  FSP  can  help  to  improve  efficiency  and  flexibility  for  IoT  device  firmware  enablement

• Questions?

Page 22: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Reference  Information

UEFI  Plugfest  – March  2017 www.uefi.org 22

Document Location

Reducing  Platform  Boot  TimeUDK  2010  Based  Performance  Optimization

http://www.intel.cn/content/dam/www/public/us/en/documents/white-­‐papers/reducing-­‐platform-­‐boot-­‐time-­‐paper.pdf

PI  (Platform  Initialization)Specification

http://www.uefi.org/specs/This  is  where  the  terms  SEC,  PEI,  DXE,  and  BDS  are  defined  and  referenced.

UEFI  Specifications   http://www.uefi.org/specs/This  is  the  OS  interface  and  runtime  EFI  stuff.

UEFI  Firmware https://technet.microsoft.com/en-­‐us/library/hh824898.aspx

Intel FSP http://www.intel.com/content/www/us/en/intelligent-­‐systems/intel-­‐firmware-­‐support-­‐package/intel-­‐fsp-­‐overview.html

Page 23: UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions · 2017-03-29 · presented(by UEFIandIoT:BestPracticesin DevelopingIoTFirmware% Solutions Spring’2017’UEFI’Seminar’and’Plugfest

Thanks  for  attending  the  Spring  2017  UEFI  Seminar  and  Plugfest

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

presented  by

UEFI  Plugfest  – March  2017 www.uefi.org 23