al Edition Digital Editions of selected In Press books ar in D ntel re addition to and co omplemen the prin nt nted books s. Click the icon to access informatio on othe essentia o on er al books for Develope and IT Professio b ers T onals Visit our w V website at w www.intel.com/intelp press
Developing with the Unified Extensible Firmware Interface Second Edition Vincent Zimmer Michael Rothman Suresh Marisetty
ISBN 13 978-1-934053-29-4 This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold with the understanding that the publisher is not engaged in professional services. If professional advice or other expert assistance is required, the services of a competent professional person should be sought. Intel Corporation may have patents or pending patent applications, trademarks, copyrights, or other intellectual property rights that relate to the presented subject matter. The furnishing of documents and other materials and information does not provide any license, express or implied, by estoppel or otherwise, to any such patents, trademarks, copyrights, or other intellectual property rights. Intel may make changes to specifications, product descriptions, and plans at any time, without notice. Fictitious names of companies, products, people, characters, and/or data mentioned herein are not intended to represent any real individual, company, product, or event. Intel products are not intended for use in medical, life saving, life sustaining, critical control or safety systems, or in nuclear facility applications. Intel, the Intel logo, Celeron, Intel Centrino, Intel NetBurst, Intel Xeon, Itanium, Pentium, MMX, and VTune are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. † Other names and brands may be claimed as the property of others. This book is printed on acid-free paper. Publisher: Richard Bowles Editor: David J. Clark Program Manager: Stuart Douglas Text Design & Composition: InfoPros Graphic Art: Ted Cyrek (cover) InfoPros (illustrations) Library of Congress Cataloging in Publication Data: 10 9 8 7 6 5 4 3 2 1 First printing, November 2010
book would not have been possible. To my parents Stanley and Joann, and my sister Natalie, who have helped me on my journey through life. —Vincent Zimmer To my wife Sandi for having infinite patience in allowing me to find the “spare” time for this endeavor, and to my sons Ryan and Aaron who keep me grounded in what life is really about. —Mike Rothman To my very supporting spouse Anitha, my son Ketan and daughter Manisha for being the source of inspiration in my life. —Suresh Marisetty
Contents v Foreword to the First Edition xi Foreword to the Second Edition xv Preface xix Chapter 1 Introduction 1 Terminology 5 A Short History of EFI 6 EFI Becomes UEFI—The UEFI Forum 7 PIWG and USWG 10 Platform Trust/Security 14 Embedded Systems: The New Challenge 17 Summary 19 Chapter 2 Basic UEFI Architecture 21 Objects Managed by UEFI-based Firmware 22 UEFI System Table 22 Handle Database 23 Protocols 26 Working with Protocols 30 Tag GUID 31 v
UEFI Images 31 Events and Task Priority Levels 37 Summary 41 Chapter 3 UEFI Driver Model 43 Why a Driver Model Prior to OS Booting? 44 Driver Initialization 44 Host Bus Controllers 46 Device Drivers 48 Bus Drivers 50 Platform Components 52 Hot Plug Events 53 Additional Innovations 63 Summary 67 Chapter 4 Protocols You Should Know 69 EFI OS Loaders 71 Device Path and Image Information of the OS Loader 74 Accessing Files in the Device Path of the OS Loader 75 Finding the OS Partition 76 Getting the Current System Configuration 77 Getting the Current Memory Map 78 Getting Environment Variables 79 Transitioning to an OS Kernel 80 Summary 81 Chapter 5 UEFI Runtime 83 Isn’t There Only One Kind of Memory? 85 How Are Runtime Services Exposed? 88 Time Services 89 Virtual Memory Services 92 Variable Services 94 Miscellaneous Services 98 Summary 101
Chapter 6 UEFI Console Services 103 Simple Text Input Protocol 106 Simple Text Input Ex Protocol 109 Simple Text Output Protocol 110 Remote Console Support 113 Console Splitter 116 Network Consoles 118 Summary 120 Chapter 7 Different Types of Platforms 121 Summary 138 Chapter 8 DXE Basics: Core, Dispatching, and Drivers 139 DXE Core 141 Global Coherency Domain Services 152 DXE Dispatcher 157 DXE Drivers 162 Boot Device Selection (BDS) Phase 163 Summary 166 Chapter 9 Some Common UEFI and PI Functions 167 Architectural Protocol Examples 168 PCI Protocols 177 Block I/O 188 Disk I/O 190 Simple File System 192 Configuration Infrastructure 194 Using the Configuration Infrastructure 196 Driver Model Interactions 197 Provisioning the Platform 201 Summary 203
Chapter 10 Platform Security and Trust 205 Trust Overview 206 Trusted Platform Module (TPM) and Measured Boot 209 UEFI Secure Boot 221 UEFI Executable Verification 222 UEFI Networking 224 UEFI User Identification (UID) 227 Hardware Evolution: SRTM-to-DRTM 228 Platform Manufacturer 229 Vulnerability Classification 231 Roots of Trust/Guards 232 Summary 232 Chapter 11 Boot Device Selection 235 Firmware Boot Manager 238 Globally-Defined Variables 242 Default Behavior for Boot Option Variables 245 Boot Mechanisms 246 Summary 248 Chapter 12 Boot Flows 249 Defined Boot Modes 250 Priority of Boot Paths 251 Reset Boot Paths 253 Normal Boot Paths 254 Recovery Paths 257 Special Boot Path Topics 259 Architectural Boot Mode PPIs 264 Recovery 265 Summary 266 Chapter 13 Pre-EFI Initialization (PEI) 267 Scope 268 Rationale 268
Phase Prerequisites 273 Concepts 274 Operation 279 Summary 289 Chapter 14 Putting It All Together—Firmware Emulation 291 Virtual Platform 292 Hardware Pass-Through 300 Summary 302 Chapter 15 Reducing Platform Boot Times 303 Proof of Concept 308 Marketing Requirements 309 Additional Details 315 Summary 320 Chapter 16 Embedded Boot Solution 323 CE Device Landscape 324 CE Device Boot Challenges 325 In-Vehicle Infotainment 328 Other Embedded Platforms 331 Generic Requirements 332 Boot Strategies 335 Power Management 337 Boot Storage Devices 337 Security 340 Manageability 344 Summary 345 Chapter 17 Manageability 347 Overall Management Framework 348 UEFI Error Format Standardization 351 Windows Hardware Error Architecture and the Role of UEFI 358
Fleepit Digital © 2021