Power onPlatform initialization Operating system (OS) boot Shutdown Run Time (RT) OS-Present...

24

Transcript of Power onPlatform initialization Operating system (OS) boot Shutdown Run Time (RT) OS-Present...

Enhancing Your UEFI BIOS for Windows 7

Mark SvancarekPrincipal Program ManagerMicrosoft Corporation

Agenda

Why create fast power-on self test (POST) for Windows® 7?What is UEFI?Overview of Unified Extensible Firmware Interface (UEFI) boot timeAchieving performance improvementsSample resultsOther considerations for Windows 7Call to actionResources

Why Create Fast POST for Windows 7?

Windows 7 is generally faster than Windows Vista® on the same hardware; long POST times are more noticeable

Fast POST now becoming mainstreamMedian POST 3 seconds faster than last year (11 seconds 8 seconds)

But some very slow POSTs remain

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 220

2

4

6

8

10

12

14

16

18

20

2010 POST TIMES 2009 POST times

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 230

2

4

6

8

10

12

14

16

18

20

2009 POST times

% o

f lap

tops

mea

sure

d

Time in seconds(smaller is better)

What Is UEFI?

Power on Platform initialization Operating system (OS) boot Shutdown

Run Time

(RT)

OS-PresentApplication

Final OS Environment

Final OS Boot Loader

Driver Execution Environment (DXE)

Boot Dev

Select(BDS)

Transient System Load

(TSL)

OS-AbsentApp

UEFI Shell

Transient OS Boot Loader

Boot Manager

Device, Bus, or Service Driver

UEFI

Interfaces

EFI Driver Dispatcher

Architectural Protocols

Pre-EFI Initialization

(PEI)

CPUInit

Chipset Init

Board Init

verify

Security (SEC)

PEICore

Pre Verifier

Source: Intel Corporation

Typical UEFI Initialization Time

Phase Time

SEC 1.638 sec

PEI 2.647 sec

DXE 1.296 sec

BDS 3.139 sec

Total Duration: 8.720 sec

Source: Insyde Software CorporationPlatform: Intel® Mobile Reference Platform w/ Intel® Core i7-920XM Processor Extreme Edition

Improving SEC Speed

Aggregate all SEC and PEI drivers to a single 64-KB block of flash memory

All code must be in the processor cache before enabling No-Eviction Mode (NEM)Code outside the NEM area will run very slowly

Set CPU throttling to minimum (allow maximum power)Store only a single CPU microcode set to avoid searching

Improving PEI Speed

Limit memory initializationDo not test the RAM by default Do not clear the memory to zero with code unless error-correcting code (ECC) is required and you have no hardware support

Limit memory detectionDo not read serial presence detect (SPD) on closed systems

Improving DXE Speed

DXE dispatcher will load and run DXE drivers in a round-robin loop

Order drivers to reduce dependencies to a minimumDo not hardcode the driver ordering

Remove legacy PS/2 devicesUse high-speed USB devices

Do not initialize extra SATA channels or any other redundant devices

Improving DXE Speed (cont.)

Eliminate legacy option ROMsReplace legacy option code with UEFI drivers and UEFI option ROMsDo not initialize option ROMs unless you need the device

Eliminate legacy videoUse faster UEFI device driversUse console redirect

Analyze DXE driver timings

Using DXE Driver Analysis

Measure driver load times using tools provided by the BIOS vendorLook for outliers

Name Duration

Hiidatabase 10 mS

crc32sectionextract 9 mS

Fwblockservice 2 mS

Ftwlite 2 mS

Variable 11 mS

Setuputility 2 mS

Miscsubclass 8 mS

Mpcpu 94 mS

Smbiosmemory 61 mS

Satacontroller 146 mS

Name Duration

Acpiplatform 38 mS

Legacybios 38 mS

Ahci 66 mS

Smmruntime 1 mS

Smmfwblockservice 1 mS

Smmftw 49 mS

Powermanagement2 2 mS

Smmplatform 2 mS

smmbase 30 mS

Biosvideo 273 mS

etc.

Source: Insyde Software CorporationPlatform: Intel Mobile w/ Core i7-920XM EE

Using DXE Driver Analysis (cont.)

Analyze the list of modules for customers

Decide whether the features should be kept, removed, or hidden

Hidden items do not run unless one of the following:

First boot after configuration changedPrevious boot failedPre-POST hotkeys were pressed

By hiding and removing drivers, POST can be extremely fast

Module Customer Decision

Module 1 Must have

Module 2 Removed

Module 3 Must have

Module 4 Removed

Module 5 Hidden

Module 6 Hidden

Module 7 Hidden

Module 8 Removed

Module 9 Must have

Improving BDS Speed

Preselect the boot deviceSearching is too slowSystems boot from the same device most of the time

Default to solid-state drive (SSD) or hard disk drive (HDD)

Do not default to DVD

Use SSD if density and price point can support it

Making Miscellaneous Improvements

Choose compiler optimizations properlyUEFI is written in CMake sure max speed is enabled

Investigate embedded controller (EC) performanceControls battery, power supply, and so onMinimize usage of slow battery and power supply devices

Do not put UEFI into Serial Peripheral Interface (SPI) Flash behind the ECUse a direct SPI Flash connection to the I/O hub (Southbridge)

Real-World Results

PhaseBefore

OptimizationAfter

Optimization

EC 2.0 sec 0.5 sec

SEC 0.3 sec 0.2 sec

PEI 3.4 sec 2.8 sec

DXE 0.8 sec 0.8 sec

BDS 5.3 sec 2.4 sec

Total 11.8sec 6.6sec

Source: Insyde Software CorporationPlatform: Hewlett Packard DV4-1145go

Before After0

1

2

3

4

5

6

7

8

9

10

11

12

BDSDXEPEISECEC

Reference Board Results

Before After Extreme0

1

2

3

4

5

6

7

8

9

BDSDXEPEISEC

PhaseBefore

OptimizationAfter

Optimization“Extreme”

Optimization

EC n/a n/a n/a

SEC 1.6 sec 0.1 sec 0.04 sec

PEI 2.7 sec 1.0 sec 0.5 sec

DXE 1.3 sec 1.0 sec 0.6 sec

BDS 3.1 sec 3.5 sec 0.8 sec

Total 8.7 sec 5.6 sec 1.9 sec

Source: Insyde Software CorporationPlatform: Intel Mobile w/ Core i7-920XM EE

BIOS Compatibility

Keep BIOS compatibility support module (CSM) small

Windows 7 does not require Int13 support for storageUse the UEFI interface insteadUsually possible to initialize the video BIOS without the CSM

Int10 is still required, but not during POSTThe video BIOS must be in the C0000 segment, and a real-mode IDT must be at physical address 0x0 

19

Supply the correct device paths in Int13 Enhanced Disk Drive extensions

Legacy BIOS provides a mechanism to know the physicalpath to a HDD

Examples: Bus/Device/Function used for PCI Express; IDE controller; and master 

Windows 7 does not depend on EDD device paths

Majority of legacy BIOS implementations populated this information incorrectly

Or use UEFI driver instead of Int13

BIOS Compatibility (cont.)

ACPI Implementation

Check Advanced Configuration and Power Interface (ACPI) for common compatibility issues

Use AcpiReclaimMemory memory region at your own risk

The OS can reclaim it after copying itTypically used by the platform for ACPI tablesWindows 7 does not reclaim this memory nor verify that ACPI firmware does not attempt to access this memory

Avoid battery issuesCheck that the battery state is reported correctlyCheck that the overall battery capacity is reported correctly

Enable product activationIf Software Licensing (SLIC) table is missing or not well-formed, it may block enterprise licensing

Other Windows 7 Considerations

Measure baseline to prevent regressionsUse the Windows Logo Kit to measure power transitionsEspecially important if you did not have aggressive targets for Windows Vista

Verify that you do not have dependencies on undocumented Windows behavior

Example: Restoring Memory Type Range Registers (MTRR) for each CPU after S3 resume

Adds ~400 milliseconds if you let the operation system do itAlso affects time to synchronize the processor time-stamp counters (TSC), which are new in Windows 7

Other Windows 7 Considerations (cont.)

Verify 64-bit operating system and 4 GB compatibility 4-GB RAM machines became common in Windows Vista SP1 timeframe64-bit operating system required in order to support 4 GB RAMCheck 64-bit ISO images from CD-ROM or DVD

Verify solid-state drive (SSD) compatibilitySSDs now becoming popular for both high-end and low-end machines running Windows 7 Verify that there are no race conditions or other compatibility problemsVerify both boot and hibernate use cases

23

Call to Action

Work with your BIOS teams to:Improve POST speed and compatibility Specify POST times to original design manufacturers (ODMs)Specify minimum hardware performance standards to ODMsRequire native UEFI drivers and option ROMs from independent hardware vendors (IHVs)

Use the latest UEFI specification and UEFI Platform Initialization (PI) specification to improve boot timesView these other Windows Summit 2010 presentations:

On/Off Scenarios - Common Issues, Recommendations, and Best Practice (SYST-175)On/Off Scenarios - Performance Analysis and Diagnosis Overview (SYST-176)

Fill out the evaluation form for this presentation

24

Resources

Specifications and implementation siteswww.uefi.org, www.intel.com/technology/efi, www.tianocore.org

Link to Microsoft UEFI support and requirementshttp://www.microsoft.com/whdc/system/platform/firmware/uefireg.mspx

White Paper: Firmware Enhancements for PCs Running Windows 7http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/FirmwareEnhance_Win7.docx

Beyond BIOS: Implementing the Unified Extensible Firmware Interface with Intel’s Frameworkwww.intel.com/intelpress

UEFI Plugfest Event at Intel in Dupont, WashingtonJune 22-25, 2010 www.uefi.org

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation.MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.