15.03.2015 Views

SetupDesignGuide.pdf - Firmware Encoding Index

SetupDesignGuide.pdf - Firmware Encoding Index

SetupDesignGuide.pdf - Firmware Encoding Index

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tiano<br />

Setup Design Guide<br />

Draft for Review<br />

September 15, 2002<br />

Version 0.31


THIS SPECIFICATION IS PROVIDED “AS IS” WITH NO<br />

WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF<br />

MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR ANY<br />

PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE<br />

ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE.<br />

A license is hereby granted to copy and reproduce this specification for<br />

internal use only.<br />

No other license, express or implied, by estoppel or otherwise, to any other<br />

intellectual property rights is granted herein.<br />

Intel disclaims all liability, including liability for infringement of any<br />

proprietary rights, relating to use of information in this specification. No<br />

license, express or implied, by estoppel or otherwise, to any intellectual<br />

property rights is granted herein.<br />

This specification is an intermediate draft for comment only and is subject to<br />

change without notice. Readers should not design products based on this<br />

document.<br />

† Third party brands and names are the property of their<br />

respective owners.<br />

Copyright © Intel Corporation, 2000.<br />

Intel order number xxxxxx-001


Setup Design Guide<br />

DRAFT<br />

Revision History<br />

Revision Revision History Date<br />

0.1<br />

Initial Draft<br />

02/11/ 2002<br />

Added bi-directional support<br />

02/14/2002<br />

(RIGHT_TO_LEFT flag) for the<br />

#strlang command.<br />

Lots of grammatical fixes<br />

Updated terms section<br />

02/21/2002<br />

0.11<br />

0. 12<br />

0. 30<br />

Updated 2.6.1 with reference to<br />

Hii.NewString and Hii.UpdateForm<br />

Added keyboard related package<br />

structure definitions as well as<br />

a chapter explaining the<br />

mechanics of describing a<br />

keyboard layout.<br />

Added GLYPH_NON_BREAKING<br />

Added the RemovePack function in<br />

the HII Protocol.<br />

Completed first round of reviews.<br />

Also added a RemovePack function<br />

to provide the ability to<br />

03/01/2002<br />

04/11/2002<br />

04/20/2002<br />

de-register information from HII.<br />

0. 31<br />

Added data to the<br />

EFI_FORM_CONFIGURATION_PROTOCOL<br />

section to enable the sending of<br />

mailbox events to the<br />

configuration browser.<br />

Changed the NV Steering protocol<br />

to a more general-purpose<br />

configuration callback protocol.<br />

05/02/2002<br />

iii


Table of Contents<br />

1 Introduction......................................................................................................... 7<br />

1.1 Scope .................................................................................................................... 7<br />

1.2 Target Audience .................................................................................................... 7<br />

1.3 Related Information ............................................................................................... 7<br />

1.4 Terms .................................................................................................................... 8<br />

1.5 Conventions Used in This Document .................................................................. 10<br />

1.5.1 1.5.2 Data Structure Descriptions..................................................................... 10<br />

Protocol Descriptions............................................................................... 10<br />

1.5.3 Procedure Descriptions ........................................................................... 10<br />

1.5.4 Pseudo-Code Conventions...................................................................... 11<br />

1.5.5 Typographic Conventions........................................................................ 11<br />

2 Setup Infrastructure Overview ........................................................................ 13<br />

2.1 Components of the Setup Infrastructure.............................................................. 13<br />

2.1.1 VFR/IFR................................................................................................... 13<br />

2.1.2 2.1.3<br />

Strings ..................................................................................................... 13<br />

Fonts........................................................................................................ 14<br />

2.1.4 EFI Driver (Containing Setup Data) ......................................................... 15<br />

2.1.5 HII Database............................................................................................ 16<br />

2.1.6 Configuration Driver................................................................................. 16<br />

2.2<br />

2.3<br />

2.4<br />

Composition of VFR and String data................................................................... 16<br />

How multiple language support is handled.......................................................... 17<br />

Storing Configuration Settings............................................................................. 18<br />

2.5 O/S Runtime Utilization ....................................................................................... 19<br />

2.6 How to get hardware information in setup........................................................... 20<br />

2.6.1 2.6.2 Single Iteration Hardware Interaction ...................................................... 20<br />

Multiple Iteration Hardware Interaction.................................................... 21<br />

2.7 Setup Infrastructure Overview Graphic ............................................................... 22<br />

3<br />

Setup Build Infrastructure ............................................................................... 24<br />

3.1 Setup Build Infrastructure Elements.................................................................... 24<br />

3.1.1 VFR Compiler .......................................................................................... 24<br />

3.1.2 NVRAM Mapping File .............................................................................. 24<br />

3.1.3 String Definitions...................................................................................... 25<br />

3.1.4 IFR Header Files...................................................................................... 25<br />

4 VFR Programming Language .......................................................................... 27<br />

4.1 BNF of VFR ......................................................................................................... 27<br />

4.2 VFR Programming Keywords.............................................................................. 29<br />

4.2.1 4.2.2 // (comment marker) ................................................................................ 29<br />

#define..................................................................................................... 29<br />

4.2.3 #include ................................................................................................... 29<br />

4.2.4 #strlang.................................................................................................... 29<br />

4.2.5 #strdef...................................................................................................... 29<br />

4.2.6 formset / endformset................................................................................ 30<br />

4.2.7 nvstorage................................................................................................. 30<br />

Version 0.92 1/19/00 iv


DRAFT<br />

4.3<br />

5 User Interface Design....................................................................................... 40<br />

5.1 Home Page ......................................................................................................... 40<br />

5.2 Subsequent Pages .............................................................................................. 40<br />

5.3 Key-based Navigation ......................................................................................... 40<br />

5.4 Mouse Navigation................................................................................................ 41<br />

5.5 Screen Format..................................................................................................... 41<br />

5.6 Colors .................................................................................................................. 42<br />

5.7 Pop-Ups .............................................................................................................. 43<br />

5.8 Partial Language Availability ............................................................................... 43<br />

6<br />

7<br />

4.2.8 form / endform ......................................................................................... 30<br />

4.2.9 subtitle ..................................................................................................... 31<br />

4.2.10 text........................................................................................................... 31<br />

4.2.11 oneof / endoneof...................................................................................... 31<br />

4.2.12 checkbox / endcheckbox ......................................................................... 32<br />

4.2.13 numeric.................................................................................................... 32<br />

4.2.14 date.......................................................................................................... 33<br />

4.2.15 time.......................................................................................................... 34<br />

4.2.16 string........................................................................................................ 35<br />

4.2.17 password ................................................................................................. 35<br />

4.2.18 goto.......................................................................................................... 36<br />

4.2.19 grayoutif................................................................................................... 36<br />

4.2.20 suppressif ................................................................................................ 36<br />

4.2.21 hidden...................................................................................................... 36<br />

4.2.22 inconsistentif............................................................................................ 36<br />

4.2.23 AND, OR, NOT ........................................................................................ 37<br />

4.2.24 graphics ................................................................................................... 37<br />

Reserved Keywords ............................................................................................ 37<br />

4.3.1 DEFAULT ................................................................................................ 37<br />

4.3.2 MANUFACTURING ................................................................................. 37<br />

4.3.3 DYNAMIC ................................................................................................ 37<br />

4.3.4 INTERACTIVE......................................................................................... 38<br />

Setup Driver Considerations ........................................................................... 44<br />

6.1 Pre-boot Operation versus Runtime Operation ................................................... 44<br />

6.2 How to allocate and steer data to NV storage..................................................... 44<br />

HII Database Interface ...................................................................................... 46<br />

7.1 EFI Human Interface Infrastructure Protocol....................................................... 46<br />

7.1.1 EFI_HII_PROTOCOL.NewPack()............................................................ 52<br />

7.1.2 EFI_HII_PROTOCOL.RemovePack()...................................................... 53<br />

7.1.3 EFI_HII_PROTOCOL.FindHandles()....................................................... 54<br />

7.1.4 EFI_HII_PROTOCOL.TestString()........................................................... 55<br />

7.1.5 EFI_HII_PROTOCOL.GetGlyph()............................................................ 56<br />

7.1.6 EFI_HII_PROTOCOL.NewString() .......................................................... 57<br />

7.1.7 EFI_HII_PROTOCOL.GetPrimaryLanguages() ....................................... 58<br />

7.1.8 EFI_HII_PROTOCOL.GetSecondaryLanguages() .................................. 59<br />

7.1.9 EFI_HII_PROTOCOL.GetString()............................................................ 60<br />

7.1.10 EFI_HII_PROTOCOL.GetLine() .............................................................. 62<br />

7.1.11 EFI_HII_PROTOCOL.GetForms() ........................................................... 64<br />

1.


DRAFT<br />

7.2<br />

7.3<br />

7.1.12 EFI_HII_PROTOCOL.UpdateForm() ....................................................... 65<br />

7.1.13 EFI_HII_PROTOCOL.GetKeyboardLayout() ........................................... 66<br />

EFI Form Configuration Protocol......................................................................... 67<br />

7.2.1 EFI_FORM_CONFIGURATION_PROTOCOL.SendForm() .................... 68<br />

7.2.2 EFI_FORM_CONFIGURATION_PROTOCOL.SendMessage().............. 70<br />

EFI Form Callback Protocol................................................................................. 72<br />

7.3.1 EFI_FORM_CALLBACK_PROTOCOL.NvRead() ................................... 73<br />

7.3.2 EFI_FORM_CALLBACK_PROTOCOL.NvWrite() ................................... 75<br />

7.3.3 EFI_FORM_CALLBACK_PROTOCOL.CallBack() .................................. 76<br />

8 Simple Input Modification................................................................................ 78<br />

8.1 Extending Simple Input ....................................................................................... 78<br />

9 HII Keyboard Support....................................................................................... 80<br />

9.1 Keyboard Mapping .............................................................................................. 80<br />

9.2 Modifier Key Definitions....................................................................................... 81<br />

9.3 Keyboard Layout Switching................................................................................. 83<br />

9.4 Dead Keys........................................................................................................... 83<br />

9.4.1 Bi-directional Input (Reserved for future implementation) ....................... 85<br />

1.


DRAFT<br />

1<br />

Introduction<br />

1.1 Scope<br />

This document describes the general goals and requirements associated with system configuration<br />

in EFI 2.0. It covers basic requirements for being able to present a user interface to a user during<br />

pre-boot, run-time, and remotely. Additionally, this specification describes a standard<br />

programming interface that an OEM can use for the registering of setup user interfaces, strings, and<br />

fonts.<br />

This document provides enough material to create infrastructure files for the user interface as well<br />

as the creation of a driver to export setup related information to the Human Interface Infrastructure<br />

programming interface.<br />

A full understanding of the EFI Specification is assumed throughout this document.<br />

1.2 Target Audience<br />

This document is intended for the following readers:<br />

• OEM’s that design and manufacture computers for an international audience using the EFI<br />

firmware implementation.<br />

• BIOS developers, either those who create general-purpose BIOS and other firmware products<br />

or those who modify these products for use in Intel architecture-based products.<br />

• Software developers who will be adapting their product suites (Manufacturing<br />

tools/Diagnostics/etc.) for an international audience to run on a platform with the Tiano<br />

firmware implementation.<br />

1.3 Related Information<br />

The following publications and sources of information may be useful to you or are referred to by<br />

this specification:<br />

•<br />

•<br />

•<br />

•<br />

•<br />

EFI Specification Version 1.02, Intel Corporation, 2000,<br />

http://developer.intel.com/technology/efi.<br />

ISO Standard 3166, Codes for representation of Country name,<br />

http://www.iso.ch/iso/en/ISOOnline.frontpage<br />

ISO Standard 639-2, Codes for representation of three-letter language abbreviations,<br />

http://www.iso.ch/iso/en/ISOOnline.frontpage<br />

ISO Standard 10646, Universal multiple-octet coded character set,<br />

http://www.iso.ch/iso/en/ISOOnline.frontpage<br />

ISO Standard 9995, Keyboard layouts for text and office systems,<br />

http://www.iso.ch/iso/en/ISOOnline.frontpage<br />

1.


DRAFT<br />

•<br />

•<br />

•<br />

IBM National Language Design Guide, Publication number SE09-8002-03, www.ibm.com<br />

The Unicode Standard 3.0, ISBN 0-201-61633-5, www.unicode.org<br />

Standardizing Out-of-Band Management Console Output and Terminal Emulation,<br />

http://www.microsoft.com/hwdev/headless/download/VT-UTF8andVT100+-v077.ZIP<br />

1.4 Terms<br />

The following terms are used throughout this document to describe varying aspects of input<br />

localization:<br />

Alt-GR Unicode: This represents the Unicode value of a key when the Alt-GR modifier key is<br />

being held down. This key (A2) in some keyboard layouts is defined as the right alternate key and<br />

serves the same function as the left alternate key, however in many other layouts it is a secondary<br />

modifier key similar to shift. For instance, key C1 is equated to an ‘a’ and it’s Unicode value in the<br />

typical U.K. keyboard is a non-shifted value of 0x0061, however when the Alt-GR key is held<br />

down in conjunction with the pressing of key C1 the value on the same keyboard often produces an<br />

‘á‘ which is a Unicode 0x00E1.<br />

BNF: BNF is an acronym for "Backus Naur Form". John Backus and Peter Naur introduced for<br />

the first time a formal notation to describe the syntax of a given language.<br />

Dead Key: This is typically an accent key that does not advance the cursor and is used to create<br />

special characters similar to ÄäĂăÊêŰűŨũ. This function is provided only on certain keyboard<br />

layouts.<br />

FONT: A font is a graphical representation corresponding to a character set, in this case Unicode.<br />

The following (A A A) are the same Latin letter in three fonts using the same size (14):<br />

GLYPH: The individual elements of a font corresponding to single characters. Single Width<br />

characters typically have a matrix of 8 width and 19 height. Wide characters are 16 width and 19<br />

height.<br />

HII: Human Interface Infrastructure. This generally refers to the database which contains string,<br />

font, and IFR information along with other pieces which use one of the database components.<br />

IFR: Internal Forms Representation. This is the binary encoding that is used for the representation<br />

of a user interface page(s).<br />

Keyboard Layout: The physical representation of a user’s keyboard. The usage of this is in<br />

conjunction to a structure that equates the physical key(s) and the associated action it represents.<br />

For instance, key C1 is equated to an ‘a’ and it’s Unicode value in the typical U.K. keyboard is a<br />

non-shifted value of 0x0061.<br />

PUSH MODE: A typing mode that is typically used by bi-directional languages, which toggles the<br />

ability to type in left-to-right and right-to-left.<br />

1.


DRAFT<br />

RTC: Real Time Clock. The piece of hardware often used to store a system’s date and time<br />

settings.<br />

Shifted Unicode: This represents the Unicode value of a key when the shift modifier key is being<br />

held down. For instance, key C1 is equated to an ‘a’ and it’s Unicode value in the typical U.K.<br />

keyboard is a non-shifted value of 0x0061, however when the shift key is held down in conjunction<br />

with the pressing of key C1 the value on the same keyboard often produces an ‘A’ which is a<br />

Unicode 0x0041.STRING: A null-terminated ordered list of 16-bit Unicode characters.<br />

TAG: A term used to refer to a directive.<br />

VFR: Visual Forms Representation. This is the source code format that is used by developers to<br />

create a user interface with varying pieces of data and/or questions. This would later be compiled<br />

into a binary encoding.<br />

1.


DRAFT<br />

1.5 Conventions Used in This Document<br />

This document uses typographic and illustrative conventions described below.<br />

1.5.1 Data Structure Descriptions<br />

The Intel Architecture processors of the IA-32 family are “little endian” machines. This means that<br />

the low-order byte of a multi-byte data item in memory is at the lowest address, while the highorder<br />

byte is at the highest address. Processors of the Itanium Processor Family (IPF) may be<br />

configured for both “little endian” and “big endian” operation. All implementations designed to<br />

conform to this specification will use “little endian” operation.<br />

In some memory layout descriptions, certain fields are marked reserved. Software must initialize<br />

such fields to zero, and ignore them when read. On an update operation, software must preserve<br />

any reserved field.<br />

1.5.2 Protocol Descriptions<br />

A protocol description generally has the following format:<br />

Protocol:<br />

Summary:<br />

GUID:<br />

Revision Number:<br />

Protocol Interface Struct<br />

Parameters:<br />

Related Definitions:<br />

Description:<br />

1.5.3 Procedure Descriptions<br />

The formal name of the protocol interface.<br />

A brief description of the protocol interface.<br />

The 128 bit unique identifier for the protocol interface.<br />

The revision of the protocol interface.<br />

A ‘C-style’ data structure definition containing the<br />

procedures and data fields produced by this protocol<br />

interface.<br />

A brief description of each field in the protocol interface<br />

structure.<br />

The type declarations and constants that are used in the<br />

protocol interface structure or any of its procedures.<br />

A description of the functionality provided by the<br />

protocol interface including any limitations and caveats<br />

the caller should be aware of.<br />

A procedure description generally has the following format:<br />

ProcedureName(): The formal name of the procedure.<br />

Summary:<br />

Prototype:<br />

Parameters:<br />

Related Definitions:<br />

A brief description of the procedure.<br />

A ‘C-style’ procedure header defining the calling<br />

sequence.<br />

The parameters defined in the template are described in<br />

further detail.<br />

The type declarations and constants that are only used by<br />

this procedure.<br />

1.


DRAFT<br />

Description:<br />

Status Codes Returned:<br />

A description of the functionality provided by the<br />

interface including any limitations and caveats the caller<br />

should be aware of.<br />

A description of the codes returned by the interface.<br />

1.5.4 Pseudo-Code Conventions<br />

Pseudo-code is presented to describe algorithms in a more concise form. None of the algorithms in<br />

this document are intended to be compiled directly. The code is presented at a level corresponding<br />

to the surrounding text.<br />

In describing variables, a list is an unordered collection of homogeneous objects. A queue is an<br />

ordered list of homogeneous objects. Unless otherwise noted, the ordering is assumed to be FIFO.<br />

Pseudo-code is presented in a C-like format, using C conventions where appropriate. The coding<br />

style, particularly the indentation style, is used for readability and does not necessarily comply with<br />

an implementation of the EFI Specification.<br />

1.5.5 Typographic Conventions<br />

The following typographic conventions are used in this document to illustrate programming<br />

concepts:<br />

Prototype<br />

This typeface is use to indicate prototype code.<br />

Argument<br />

Name<br />

register<br />

This typeface is used to indicate arguments.<br />

This typeface is used to indicate actual code or a programming construct.<br />

This typeface is used to indicate a processor register.<br />

1.


Setup Design Guide<br />

DRAFT<br />

2<br />

Setup Infrastructure Overview<br />

The intention of this chapter is to give a working overview to what this document will speak to at a<br />

higher level of detail. It is also intended to show how things work together and the advantages this<br />

provides to the user of this architecture.<br />

2.1 Components of the Setup Infrastructure<br />

2.1.1 VFR/IFR<br />

VFR (Visual Forms Representation) is the development language used to create IFR (Internal Forms<br />

Representation). IFR is the compiled version of the control language. This language controls what the<br />

contents of each displayed page consists of, where the changed data gets saved, how pages are linked,<br />

and much more.<br />

VFR<br />

source file<br />

VFR Compiler<br />

IFR<br />

in the form of<br />

a header file<br />

2.1.2 Strings<br />

VFR source files will include a Unicode file(s) which contains the string definitions for the particular<br />

application. The Unicode file will contain both the displayed strings as well as the translations for all<br />

the supported languages for the particular application.<br />

13


Setup Design Guide<br />

DRAFT<br />

VFR<br />

source file<br />

Strings<br />

Unicode file<br />

VFR Compiler<br />

IFR<br />

in the form of<br />

a header file<br />

String Tokens<br />

in the form of<br />

a header file<br />

2.1.3 Fonts<br />

Typically, the system firmware will carry a set of fonts to cover a common character set, however there<br />

might be times when a consumer of the setup infrastructure requires the printing of a character that the<br />

system does not have font data for. In this case, an EFI driver will carry this font data and submit it to<br />

the HII Database to be used later. A font can be submitted if there is not a font definition already for<br />

that particular Unicode character.<br />

14


Setup Design Guide<br />

DRAFT<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver<br />

Fonts in Database<br />

Fonts being submitted<br />

Unicode Value<br />

…<br />

0x0040<br />

0x0041<br />

0x0042<br />

…<br />

Font Defined<br />

TRUE<br />

TRUE<br />

FALSE<br />

Unicode Value<br />

…<br />

0x003F<br />

0x0041<br />

0x0042<br />

…<br />

Fonts in Database<br />

Unicode Value<br />

…<br />

0x003F<br />

0x0040<br />

0x0041<br />

0x0042<br />

…<br />

Font Defined<br />

TRUE<br />

TRUE<br />

TRUE<br />

TRUE<br />

2.1.4 EFI Driver (Containing Setup Data)<br />

The EFI Driver that contains setup information will be compiled with IFR, Strings, and Font data.<br />

IFR<br />

in the form of<br />

a header file<br />

String Tokens<br />

in the form of<br />

a header file<br />

EFI Driver<br />

source code<br />

‘C’ Compiler<br />

EFI Driver<br />

Fonts<br />

in the form of<br />

a header file<br />

15


Setup Design Guide<br />

DRAFT<br />

2.1.5 HII Database<br />

The Human Interface Infrastructure Database is the resource that serves as the repository of all the IFR,<br />

String, and Font data for the system. Drivers that contain information which is appropriate for the<br />

database will export this data to the HII Database.<br />

In a typical system, one might expect a driver which contains all the motherboard specific data<br />

(traditional F1-setup for the system). Additionally, there might be other add-in cards that contain their<br />

own drivers which have their own set of setup related data. All of the drivers that contain setup related<br />

data would export their information to the HII Database.<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver<br />

EFI Driver<br />

EFI Driver<br />

2.1.6 Configuration Driver<br />

The EFI Configuration Driver is the program that reads the contents of the HII Database and interprets<br />

the data to present it to the user. This is also the program that takes the user input and provides for a<br />

mechanism to save the changes into an NVRAM location.<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver<br />

EFI Driver<br />

EFI Driver<br />

EFI Configuration Driver<br />

Provides User Interface Support<br />

Callable by a Protocol Interface<br />

2.2 Composition of VFR and String data<br />

VFR has several keywords which determine the type of functions presented to the user. These<br />

keywords reference strings via tokens, which make them language agnostic.<br />

The strings are broken into language sections which have a one-to-one parallelism between each of the<br />

strings. For instance, if string token #3 is the equivalent of “I love bananas” in the English section,<br />

token #3 in any of the other language sections will contain strings that have the same meaning.<br />

16


Setup Design Guide<br />

DRAFT<br />

VFR Sample<br />

IFR Translation<br />

subtitle text = BANANA_STRING; Subtitle Op-Code, 3<br />

This example shows a sample of the type of encoding that happens between<br />

IFR and the string tokens. When a user chooses to display a particular language<br />

it has no effect on the IFR encoding. The infrastructure simply pulls the same<br />

token from a different string section.<br />

ENG<br />

Token 1 “Hello World”<br />

Token 2 “Goodbye World”<br />

Token 3 “I love bananas”<br />

SPA<br />

Token 1 “Hola Mundo”<br />

Token 2 “Adios Mundo”<br />

Token 3 “Yo amo plátanos”<br />

System is in<br />

Spanish mode.<br />

GER<br />

Token 1 “Hallo Welt”<br />

Token 2 “Auf Wiedersehen Welt”<br />

Token 3 “Ich liebe Bananen”<br />

Yo amo plátanos<br />

2.3 How multiple language support is handled<br />

When providing support for multiple setup programs, the varying language support for each program<br />

must be taken in consideration. For instance, if there are three drivers that have exported data to the HII<br />

database, each of them with different language string support, a “Home Page” will be created when the<br />

Configuration Driver is launched. This Configuration Driver will show as its initial page all the drivers<br />

which have exported configuration data and strings.<br />

The order of what is displayed on the initial page is determined by language priority. If a driver<br />

contains strings for the system’s default language setting (determined by the Lang global variable) the<br />

translated name of that driver will be shown at the top of the list. Immediately after that list will be a<br />

list of the drivers in their translated forms. The intention for this is to provide a simple mechanism for a<br />

user to scroll up and down a list of drivers and pick the appropriate driver for their use. Whichever<br />

language choice is made by the user, the language choice made at the initial page will carry forward to<br />

the rest of the pages and strings displayed under the initial page.<br />

17


Setup Design Guide<br />

DRAFT<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

“Setup One”<br />

“Setup Two”<br />

“Setup Three”<br />

Setup One Supports: Setup Two Supports: Setup Three Supports:<br />

ENG ENG ENG<br />

SPA<br />

SPA<br />

FRA<br />

EFI Configuration Driver<br />

Provides User Interface Support<br />

Callable by a Protocol Interface<br />

Setup One<br />

Setup Two<br />

Setup Three<br />

Setup Uno<br />

Setup Tres<br />

Setup Trois<br />

System is in<br />

English mode.<br />

2.4 Storing Configuration Settings<br />

There is an assumption of having some type of NVRAM available so that settings that are changed by<br />

the user are able to be saved. How one gets to the NVRAM is based on whether it is system NV<br />

storage one is accessing, or NV storage local to a specific card. Both are supported.<br />

With the exception of setting a system password, and system date and time, settings are not posted to<br />

NV storage until the user directs the infrastructure specifically to do so. As a rule of thumb, hardware<br />

configuration changes do not take place until a system reset has occurred.<br />

18


Setup Design Guide<br />

DRAFT<br />

When a system reset occurs, the architectural protocol BDS launches the drivers and loads the<br />

Configuration driver. Drivers that are enabled to take direction from an NV setting will read the<br />

updated settings during their initialization.<br />

System Reset<br />

BDS<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver<br />

EFI Driver<br />

EFI Driver<br />

EFI Configuration Driver<br />

Provides User Interface Support<br />

Callable by a Protocol Interface<br />

User<br />

Changes<br />

NVRAM<br />

2.5 O/S Runtime Utilization<br />

Due to the static nature of the data contained in the HII Database and the capacity to update NVRAM<br />

variables, the pre-boot configuration data can be used during O/S runtime. This allows the same<br />

configuration mechanisms to be used in pre-boot as well as in runtime.<br />

19


Setup Design Guide<br />

DRAFT<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

Runtime<br />

Buffer<br />

EFI Configuration Driver<br />

Provides User Interface Support<br />

Callable by a Protocol Interface<br />

Runtime Configuration<br />

Application<br />

Can act as a server to<br />

an HTML browser<br />

2.6 How to get hardware information in setup<br />

For the most part, the only hardware interaction that the Configuration Driver has is when it accesses<br />

NVRAM or saves information to an RTC. However, there are times when a developer needs to get<br />

hardware information presented to the user.<br />

In this infrastructure there are two classifications of hardware interaction, single and multiple iteration.<br />

Each of these interactions have varying procedures one must follow as well as varying ramifications.<br />

2.6.1 Single Iteration Hardware Interaction<br />

An EFI driver that uses the EFI setup infrastructure will typically carry both IFR and string data. In<br />

some cases, not all the information that is needed is included at build time. For example, a user might<br />

have a text string which shows what the CPU’s frequency is. In this case, the information is obviously<br />

not available at build time, so the information has to be retrieved.<br />

There are several ways one might go about this. One way might be that the driver that is about to<br />

export the setup data to the HII database calls the appropriate hardware services to determine what the<br />

CPU frequency is, fills in the appropriate string data, and then exports the data to the HII database.<br />

Another way might be that the driver that has exported data to the HII database needs to add<br />

information to the database could use the HII protocol calls for NewString or UpdateForm. Both<br />

of these functions are intended for post-export modification of database information.<br />

Another method, which is used for more complex situations, would be to label the op-code which<br />

required additional data with a DYNAMIC flag. When the data is exported to the HII database, it calls<br />

back to the driver to get the additional data. The driver will do the hardware interaction and return a<br />

packet of data to the database to fill in the appropriate string data.<br />

Once this single level of hardware interaction is complete, the presentation data stored in the database is<br />

static and the DYNAMIC flag is turned off. Due to the static nature of this data, it is able to be used<br />

pre-boot and be exported to an O/S runtime application and be used during that phase of operation.<br />

20


Setup Design Guide<br />

DRAFT<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver<br />

VFR Sample<br />

text text = CPU_STRING,<br />

text = DERIVED_CPU_FREQUENCY,<br />

flags = DYNAMIC,<br />

key = CPU_FREQUENCY_KEY;<br />

This sample shows an example of the programming language used in the EFI Setup<br />

infrastructure. In this case, a DYNAMIC flag signifies that when this code is exported to<br />

the database a callback will be done for this operation to fill in the second text entry.<br />

The behavior and operands will vary based on which type of op-code is thus flagged.<br />

String Tokens – Prior to Callback<br />

ENG<br />

CPU_STRING<br />

“CPU Frequency”<br />

DERIVED_CPU_FREQUENCY “”<br />

SPA<br />

CPU_STRING<br />

“Frecuencia del CPU”<br />

DERIVED_CPU_FREQUENCY “”<br />

String Tokens – After Callback<br />

ENG<br />

CPU_STRING<br />

DERIVED_CPU_FREQUENCY<br />

SPA<br />

CPU_STRING<br />

DERIVED_CPU_FREQUENCY<br />

“CPU Frequency”<br />

“2.2 Ghz”<br />

“Frecuencia del CPU”<br />

“2.2 Ghz”<br />

2.6.2 Multiple Iteration Hardware Interaction<br />

An EFI driver that uses the EFI setup infrastructure will typically carry both IFR and string data. In<br />

some cases, not all the information that is needed is included at build time. For example, a user might<br />

need to add a boot option and to do this they need to select the file from a file system. In this case, the<br />

information is obviously not available at build time, so the information has to be retrieved.<br />

Unlike the previous section which had hardware interaction completed prior to the user ever having<br />

seen any data, this example requires hardware interaction at the user level. In the example of searching<br />

for a file, the driver will have the op-code labeled with a DYNAMIC and INTERACTIVE flag. When<br />

the data is exported to the EFI configuration driver, it calls back to the driver to get the additional data.<br />

21


Setup Design Guide<br />

DRAFT<br />

The driver will do the hardware interaction and return a packet of data to the database and it will fill in<br />

the appropriate string data. If the packet is returned successfully, the DYNAMIC flag is turned off.<br />

This string data would likely correlate to the initial list of file systems available on the system. This<br />

completes the first phase of interaction to acquire all the information the system needs to display data to<br />

the user.<br />

Additionally, when the user manually selects the file system they want to start searching, a callback to<br />

the exporting driver would occur and a packet would return the data requested. This would continue<br />

until the desired file was chosen.<br />

In the case where the driver which is exporting data bypasses the HII database and sends the data<br />

directly to the EFI configuration driver, the driver becomes responsible for the saving of the NVRAM<br />

data if any. Additionally, bypassing the HII database along with the multiple iteration callbacks are not<br />

compatible with runtime propagation. This use case would likely be used by pre-boot only utilities like<br />

the EFI Boot Maintenance Manager.<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver/Utility<br />

Requiring Dynamic Hardware Interaction<br />

EFI Configuration Driver<br />

Provides User Interface Support<br />

Callable by a Protocol Interface<br />

EFI Driver/Utility<br />

Requiring Dynamic Hardware Interaction<br />

Pre-boot Only and Responsible<br />

for storing NVRAM changes<br />

Additionally, a driver which required multiple iteration support could use the HII database so that the<br />

data might have a presence in the O/S runtime. The practical situation for this might be a driver which<br />

has a large amount of questions and possibly only a very small set which require multiple iteration<br />

support. In this case, the developer needs to be conscious when designing the page contents of the VFR<br />

script so that if the O/S runtime version of the data is stripped of op-codes with the INTERACTIVE<br />

flag turned on the user experience will not be odd. For instance, if a driver contains a page dedicated to<br />

modem initialization and the op-codes associated with that page are all set to INTERACTIVE, it might<br />

look very odd if the O/S runtime user is presented with a blank page which inferred there should be<br />

more data.<br />

2.7 Setup Infrastructure Overview Graphic<br />

22


Setup Design Guide<br />

DRAFT<br />

BDS<br />

Policy Engine for EFI<br />

Responsible for launching drivers and boot options.<br />

typedef struct {<br />

EFI_HII_PACKET<br />

EFI_HII_PACKET<br />

EFI_HII_PACKET<br />

} EFI_IFR_PACKET;<br />

*IFRData;<br />

*FontData;<br />

*StringData;<br />

Human Interface Infrastructure<br />

Database<br />

Consists of IFR/String/Font Data<br />

Which has been submitted by varying EFI drivers<br />

EFI Driver<br />

EFI Driver<br />

EFI Driver<br />

EFI Driver<br />

Requiring Dynamic Hardware Interaction<br />

If UseDatabase == TRUE, Retrieve all DBHandles, Ignore Packet/DriverPointer<br />

If UseDatabase == FALSE, process the Packet and DriverPointer.<br />

EFI Configuration Driver<br />

Provides User Interface Support<br />

Callable by a Protocol Interface<br />

typedef struct _EFI_CONFIGURATION_PROTOCOL {<br />

BOOLEAN<br />

UseDatabase;<br />

EFI_IFR_PACKET<br />

*Packet; OPTIONAL<br />

VOID<br />

*DriverPointer; OPTIONAL<br />

} EFI_CONFIGURATION_PROTOCOL<br />

23


Setup Design Guide<br />

DRAFT<br />

3<br />

Setup Build Infrastructure<br />

3.1 Setup Build Infrastructure Elements<br />

Many elements are involved in the building of a driver that uses the EFI Setup Infrastructure. No<br />

matter if the driver that is using EFI for configuration of a system board, a network device, or an<br />

embedded controller, they all will follow the same basic steps when assembling the components to<br />

leverage the EFI Setup Infrastructure.<br />

3.1.1 VFR Compiler<br />

Some of the things that the compiler is responsible for are the interpreting of the VFR keywords and<br />

converting them to IFR. The compiler is responsible for detecting situations in the VFR files that<br />

would otherwise cause an invalid binary format output.<br />

The command-line interface for the VFR compiler is:<br />

VFRCOMPILE [drive:][path]VfrSourceFile [drive:][path]StringFile<br />

The input to the compiler is the VFR source file and a Unicode string file. The VFR source file will<br />

contain VFR and likely make #include references to a separate global NVRAM mapping file. All of<br />

these are compiled into an output header file.<br />

The outputs of the compiler are header files that will be used by the driver which will export the data.<br />

3.1.2 NVRAM Mapping File<br />

Many of the op-codes associated with IFR are intended to save the user’s choice to some NV data<br />

location. To enable this feature, a map file must be created so that the EFI setup infrastructure knows<br />

where in an NVRAM variable the data must be stored. This map is also used by hardware specific<br />

drivers that might have configuration data stored in the NVRAM variable. For instance, when a driver<br />

has interest in the state of the SerialPortEnable setting, it will need to include this NVRAM<br />

mapping file to know at what offset this data is located.<br />

struct {<br />

UINT16<br />

SystemPassword[20];<br />

UINT16<br />

ModemInitializationString[60];<br />

UINT8<br />

SerialPortEnable;<br />

UINT16<br />

SamplePieceOfData;<br />

UINT32<br />

MyFavoriteNumber;<br />

} SystemNvRamMap;<br />

Note that the SystemNvRamMap is the name of the structure name that is used to reference data both<br />

for the drivers that are interested in their content and the VFR language itself. For instance, if a<br />

command to display the ModemInitializationString setting was to be written in VFR it might<br />

be done as follows:<br />

text<br />

text = SystemNvRamMap.ModemInitializationString;<br />

24


Setup Design Guide<br />

DRAFT<br />

3.1.3 String Definitions<br />

One of the primary aspects of a user interface is the list of strings associated with it. When an EFI<br />

driver which exports setup information is compiled, the strings are located in a Unicode file. This file<br />

uses the #strdef command to signify the beginning of a string definition. On that same line is an<br />

ISO 639-2 language code, a programmatic name of the string, and lastly the string itself.<br />

#strdef ENG STR_TITLE "My English setup engine"<br />

#strdef ENG STR_PAGE1 "My First Setup Page"<br />

#strdef ENG STR_PAGE2 "My Second Setup Page"<br />

#strdef ENG STR_PAGE3 "My Third Setup Page"<br />

3.1.3.1 Multiple Language Support<br />

The EFI Setup Infrastructure supports multiple languages in the string definitions. The #strlang<br />

command defines what string to associate with the ISO 639-2 language code. Each string is treated as a<br />

token, so it can be noticed that the programmatic name for each string has a corresponding string in<br />

each language. For instance, the STR_TITLE shows up in the English, Spanish, and French set of<br />

strings.<br />

When writing VFR, no concern really needs to be given to which language to use or reference since the<br />

EFI Configuration Driver will determine which language’s string token will be used. For more on this<br />

see section 2.3.<br />

#strlang ENG "English"<br />

#strlang FRA "Français"<br />

#strlang GER "Deutsche"<br />

#strdef ENG STR_TITLE "My English setup engine"<br />

#strdef ENG STR_PAGE1 "My First Setup Page"<br />

#strdef ENG STR_PAGE2 "My Second Setup Page"<br />

#strdef ENG STR_PAGE3 "My Third Setup Page"<br />

#strdef FRA STR_TITLE "Mon moteur de setup Français"<br />

#strdef FRA STR_PAGE1 "Ma Première Page D'Installation"<br />

#strdef FRA STR_PAGE2 "Ma Deuxième Page D'Installation"<br />

#strdef FRA STR_PAGE3 "Ma Troisième Page D'Installation"<br />

#strdef GER STR_TITLE "Meine Deutsche aufstellung maschine"<br />

#strdef GER STR_PAGE1 "Meine Erste InstallationsSeite"<br />

#strdef GER STR_PAGE2 "Meine Zweite InstallationsSeite"<br />

#strdef GER STR_PAGE3 "Meine Dritte InstallationsSeite"<br />

3.1.4 IFR Header Files<br />

The VFR compiler takes all the previously mentioned input files and converts them into a form that is<br />

usable by the EFI setup compatible driver. Since it is highly likely this driver will use a ‘C’ compiler to<br />

be built, the form of the VFR output files are in ‘C’ type header files. The header files should not ever<br />

need to be manipulated, but there are often comments associated with the byte encodings in the header<br />

files. The byte encoding of the header file is generally organized in the order of IFR followed by String<br />

Tokens and then Font data. A portion of a header file might look as follows:<br />

25


Setup Design Guide<br />

DRAFT<br />

#define IFR_BEGINNING_OFFSET<br />

#define STRING_BEGINNING_OFFSET<br />

#define FONT_BEGINNING_OFFSET<br />

0x0000<br />

0x01c3<br />

0x09de<br />

UINT8 Byte<strong>Encoding</strong>[] = {<br />

/*O*/ 0x11,<br />

// offset = 0x0000<br />

/*L*/ 0x14,<br />

/*G*/ 0x00, 0x00, 0x00, 0x00, 0x0C, 0xF3,<br />

0xD3, 0x4E, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,<br />

0x06, 0x07,<br />

/*S*/ 0x01, 0x00,<br />

/*O*/ 0x01,<br />

/*L*/ 0x06, 0x01, 0x00,<br />

/*S*/ 0x02, 0x00,<br />

/*O*/ 0x02,<br />

/*L*/ 0x04,<br />

/*S*/ 0x05, 0x00,<br />

/*O*/ 0x95,<br />

/*L*/ 0x13, 0xA9, 0x00, 0xA9, 0x00, 0x00,<br />

/*S*/ 0x10, 0x00,<br />

/*S*/ 0x13, 0x00, 0x93, 0x07, 0x35, 0x08, 0x01, 0x00, 0xAC, 0x07,<br />

…<br />

// offset = 0x1c3<br />

0xDE, 0x10, 0x00, 0x00, // Length for this language list of strings<br />

0x45, 0x4E, 0x47, 0x00, // Language = ENG<br />

0x94, 0x00, 0x00, 0x00, // printable-name<br />

0x00, 0x00, 0x00, 0x00, // attributes<br />

0x94, 0x00, 0x00, 0x00, // offset to string 0<br />

0xA4, 0x00, 0x00, 0x00, // offset to string 1<br />

0xD4, 0x00, 0x00, 0x00, // offset to string 2<br />

0xFC, 0x00, 0x00, 0x00, // offset to string 3<br />

0x26, 0x01, 0x00, 0x00, // offset to string 4<br />

0x4E, 0x01, 0x00, 0x00, // offset to string 5<br />

0x70, 0x01, 0x00, 0x00, // offset to string 6<br />

…<br />

26


Setup Design Guide<br />

DRAFT<br />

4<br />

VFR Programming Language<br />

4.1 BNF of VFR<br />

Character sequences that are in bold are key words. Keywords are case insensitive. The same<br />

extensions to BNF used to describe VFR are used here. Where elements are on separate lines in the<br />

BNF, those elements are required. VFR comments start with ‘//’ and end at the end of the line.<br />

The following ‘meta’-language elements are allowed on any line.<br />

::=<br />

::=<br />

::=<br />

define | define <br />

redefine | redefine <br />

include file-path<br />

Note: No comments are allowed on a file path line. The entire line from the first non-blank character<br />

following the include is taken as the file name.<br />

::=<br />

*<br />

endformset<br />

formset guid= title= nvstore=<br />

Note: is the current placeholder for the variable path.<br />

::=<br />

*<br />

endform<br />

form formid= title=<br />

::= | | | | | |<br />

| | | | | <br />

::=<br />

::=<br />

subtitle text=<br />

text text=<br />

::= varid= prompt= help=<br />

[location=,]<br />

, ::= <br />

Note: It is expected that the compiler will automatically allocate the location information in most cases.<br />

27


Setup Design Guide<br />

DRAFT<br />

::= oneof <br />

*<br />

endoneof<br />

::= option text= value= [default][]<br />

::= checkbox [default][]<br />

Note: The default flag being activated for a checkbox defines the initial behavior to be active.<br />

::= numeric min= max= [default=]<br />

[step=]<br />

, , , all ::= <br />

Note: The default initial value is the value. The default step value is 1.<br />

::= password minsize= maxsize= encoding=<br />

::= supressif <br />

::= grayoutif <br />

::= inconsistentif text=<br />

::= goto prompt= formid=<br />

::= hidden id= value=<br />

::= image string= graphic=<br />

::= background graphic=<br />

, ::= <br />

::= []*<br />

::= a | b | c | … | z | _<br />

::= | 0 | 1 | … | 9<br />

::= <br />

::= <br />

::= UINT8-constant<br />

::= |<br />

|<br />

|<br />

<br />

, , ::= UINT8-constant<br />

::= | | <br />

::= <br />

::= <br />

::= []n..n<br />

::= <br />

, , ::= UINT8-constant<br />

28


Setup Design Guide<br />

DRAFT<br />

4.2 VFR Programming Keywords<br />

The keywords described in the following section compose the working set of commands for the VFR<br />

language. Each description is followed by an example to better help the programmer understand what a<br />

sample line of VFR code would look like using that particular keyword.<br />

4.2.1 // (comment marker)<br />

Allows a programmer to leave comments in the VFR file and has no effect on the IFR binary that is<br />

generated.<br />

Example: // This is a typical comment marker<br />

4.2.2 #define<br />

Used to assign a meaningful name to a constant. Very similar in function to the ‘C’ style #define<br />

keyword.<br />

Example: #define FORMSET_GUID “CAED85D9-F30C-4ed3-B7A6-83EE32A1C604”<br />

#define GUID FORMSET_GUID<br />

4.2.3 #include<br />

This command tells the VFR compiler to use the contents of a file as part of the source to compile.<br />

Example: #include “C:\Source\SourceFile.ifr”<br />

4.2.4 #strlang<br />

This command is used to assign the ISO-639-2 three letter language abbreviation to its corresponding<br />

printable language name.<br />

This command will be used in an included header file which has a Unicode format. It will be an error<br />

condition which will be detected by the compiler if this is used in a non-Unicode formatted file.<br />

Example: #strlang SPA “Español”;<br />

#strlang FRA “Français”;<br />

#strlang ENG “English”;<br />

#strlang HEB ‏”עברית“‏ RIGHT_TO_LEFT;<br />

Notice how the 4 th example shows a RIGHT_TO_LEFT flag is turned on. This information will be<br />

passed on to the attributes for strings that are defined under the HEB (Hebrew) language. Strings that<br />

normally were left-justified in the default situation would now be right justified with this flag turned on.<br />

Additionally, user input will move from right to left. Instead of the column location of the cursor<br />

incrementing as a user types, it will decrement.<br />

4.2.5 #strdef<br />

This command is used to define a string and which language it belongs to.<br />

This command will be used in a separate Unicode header file. It will be an error condition which will<br />

be detected by the compiler if this is used in a non-Unicode formatted file.<br />

Example: #strdef ENG STR_SUBTITLE_TEXT “My subtitle text”<br />

#strdef FRA STR_SUBTITLE_TEXT “Mon texte de sous-titre”<br />

29


Setup Design Guide<br />

DRAFT<br />

#strdef<br />

SPA STR_SUBTITLE_TEXT “Mi texto del subtítulo”<br />

4.2.6 formset / endformset<br />

This command is used to define the beginning and end of a set of forms.<br />

If any of the keywords used in the VFR file have a DYNAMIC or an INTERACTIVE flag turned on,<br />

then calls to the HII must pass in the pointer to the driver’s callback interface and the<br />

drivercallback should be set to TRUE. The drivercallback field will be filled into the<br />

byte-stream by the compiler, and is an optional field for the user to input. When this data is exported to<br />

the HII database, a FALSE will be replaced with a zero, and a TRUE will be replaced with the value of<br />

the driver’s callback interface pointer.<br />

Example: formset guid = FORMSET_GUID,<br />

title = STR_FORMSET_TITLE,<br />

[drivercallback = TRUE,]<br />

version = 2,<br />

endformset;<br />

4.2.7 nvstorage<br />

This command is used to define the location of the non-volatile storage used for the choices made by<br />

the user. If the NV storage will not be located in the system NV (e.g. Add-in card NV storage) then<br />

access to the add-in card’s NV must be exposed via the EFI_FORM_CALLBACK_PROTOCOL<br />

protocol. For more information on the EFI_FORM_CALLBACK_PROTOCOL protocol see section<br />

7.3.The handle that contains the interface will be communicated via the nvstorage setting. The first<br />

example shows how one might define an NV storage descriptor for the system variables.<br />

Example: nvstorage handle = NULL,<br />

devicepath = NULL,<br />

key = NULL;<br />

In the second example, the handle and devicepath are defined to be non-NULL to signify that<br />

when this data is exported, there will be a callback done to fill in the two variables. The key value will<br />

be retrieved from a VFR_NV_KEY() macro. It is intended to be a uniquely identified value so that the<br />

callback to the driver will correctly identify the purpose of the callback and hand back the correct<br />

information.<br />

Example: nvstorage handle = 1,<br />

devicepath = 1,<br />

For more information about NV steering see section 6.2.<br />

4.2.8 form / endform<br />

key = RaidControllerMapDefine;<br />

This command is used to define the beginning and end of a page of user interface data.<br />

Example: form formid = PAGE_ONE,<br />

title = STR_FORM_TITLE,<br />

endform;<br />

30


Setup Design Guide<br />

DRAFT<br />

4.2.9 subtitle<br />

Subtitle strings are intended to be used by authors to separate sections of questions into semantic<br />

groups.<br />

Example: subtitle text = STR_SUBTITLE_TEXT;<br />

4.2.10 text<br />

Unlike HTML, text is simply another tag. This enables IFR to be more easily localized. The first<br />

example shows a simple usage case where a static string is being printed. The second example shows a<br />

use case which is more complex and allows for a one-time callback to acquire the secondary text data.<br />

The second case is described in more detail in section 4.3.3.<br />

Example: text text = STR_MISCELLANEOUS_TEXT;<br />

Example: text text = STR_MISCELLANEOUS_TEXT;<br />

4.2.11 oneof / endoneof<br />

text = STR_CPU_DERIVED_TEXT,<br />

flags = DYNAMIC,<br />

key = CPU_FREQUENCY_KEY;<br />

This command provides the ability to choose from multiple choices. Each of the choices is defined by<br />

an option statement. To support the ability to reset the user choices to a specific set of defaults, the<br />

flags settings contains a bit-mask which defines which option is defined as a system default and/or a<br />

manufacturing setting.<br />

Note that the flags setting is used to determine which choice is a system default. In the case of<br />

option 3 the flags setting is set for a manufacturing default setting. It is an error condition if more<br />

than one option has the DEFAULT or MANUFACTURING flag turned on.<br />

Also notice that this is the first keyword example that the results of the user’s choice can be reflected<br />

into a NVRAM storage location. See 6.2 to learn more about NVRAM configuration and to better<br />

understand how this works programmatically.<br />

It is also reasonable that a particular option can have both the default and manufacturing bits set. In this<br />

case it would be specified with a flags = DEFAULT | MANUFACTURING.<br />

Example: oneof<br />

varid = NvRamMap.SerialPortQuestion1,<br />

prompt = STR_ONE_OF_PROMPT,<br />

help = STR_ONE_OF_HELP,<br />

option text = STR_SERIAL_PORT1, value=0, flags=NULL;<br />

option text = STR_SERIAL_PORT2, value=1, flags=DEFAULT;<br />

option text = STR_SERIAL_PORT3, value=2, flags=MANUFACTURING;<br />

endoneof;<br />

A second example shows how one would create a oneof command which required dynamic<br />

interaction with a hardware driver. Note from the first example that the key and flags settings are<br />

optional for this command. This example is not compatible with exporting data to runtime, and thus<br />

31


Setup Design Guide<br />

DRAFT<br />

should only be used in cases where the calling application is intended to be a pre-boot only utility. For<br />

further information on the DYNAMIC and INTERACTIVE flags, see sections 4.3.3 and 4.3.4.<br />

Example: oneof<br />

varid = NULL.BootOptionSelection,<br />

prompt = STR_BOOT_OPTION_SELECTION,<br />

help = STR_BOOT_OPTION_HELP,<br />

key = BOOT_OPTION_KEY,<br />

flags = DYNAMIC | INTERACTIVE,<br />

// There are no options defined in this case. The initial set of options are<br />

// not known since they are system specific. For instance – when looking up<br />

// a file, one cannot know how many file systems will be found on available<br />

// media.<br />

endoneof;<br />

More information about interacting with hardware is contained in section 2.6.<br />

4.2.12 checkbox / endcheckbox<br />

The result returned by Checkbox is zero if the box is not checked and one if it is. If the default value<br />

needs to be one, set the flags parameter to turn on the DEFAULT flag bit.<br />

Notice that this is an example that the results of the user’s choice can be reflected into a NVRAM<br />

storage location. See 6.2 to learn more about NVRAM configuration and to better understand how this<br />

works programmatically.<br />

Example: checkbox<br />

4.2.13 numeric<br />

endcheckbox;<br />

varid = NvRamMap.SerialPortQuestion2,<br />

prompt = STR_CHECK_BOX,<br />

help = STR_CHECK_BOX_HELP,<br />

flags = DEFAULT,<br />

This command allows for numeric entry by selecting from numeric choices. The step portion of the<br />

numeric command allows for the defining of at what rate the value increments when selection the next<br />

or previous entry. If the step is set to zero, the user will be prompted for manual input of the numeric<br />

value.<br />

Notice that this is an example that the results of the user’s choice can be reflected into a NVRAM<br />

storage location. See 6.2 to learn more about NVRAM configuration and to better understand how this<br />

works programmatically.<br />

Example: numeric<br />

varid = NvRamMap.SystemTimeoutValue,<br />

prompt = STR_NUMERIC,<br />

help = STR_NUMERIC_HELP,<br />

min = 0,<br />

max = 35,<br />

32


Setup Design Guide<br />

DRAFT<br />

4.2.14 date<br />

endnumeric;<br />

step = 1,<br />

default = 8,<br />

This command allows for the entry of date information.<br />

Notice that this is an example that the results of the user’s choice can be reflected into an NVRAM<br />

storage location. See 6.2 to learn more about NVRAM configuration and to better understand how this<br />

works programmatically.<br />

Also notice that date and time are the two functions that are likely to be included in a system for<br />

user input, yet not stored in a traditional NVRAM storage location. In this case, the destination is likely<br />

an RTC. This example shows the storage location as being NULL. Date and time are special cases<br />

where the storage location being NULL is translated into a call to the RTC (if available). In all other<br />

cases, a NULL parent will force the data the user inputs to be thrown away.<br />

Example: date year varid = NULL.Year,<br />

prompt = STR_DATE,<br />

help = STR_DATE_YEAR_HELP,<br />

min = 1939,<br />

max = 2076,<br />

step = 1,<br />

default = 2002;<br />

month varid = NULL.Month,<br />

prompt = STR_DATE,<br />

help = STR_DATE_MONTH_HELP,<br />

min = 1,<br />

max = 12,<br />

step = 1,<br />

default = 1;<br />

day varid = NULL.Day,<br />

prompt = STR_DATE,<br />

help = STR_DATE_DAY_HELP,<br />

min = 1,<br />

max = 31,<br />

step = 1,<br />

default = 1;<br />

33


Setup Design Guide<br />

DRAFT<br />

4.2.15 time<br />

enddate;<br />

This command allows for the entry of time information.<br />

Notice that this is an example that the results of the user’s choice can be reflected into an NVRAM<br />

storage location. See 6.2 to learn more about NVRAM configuration and to better understand how this<br />

works programmatically.<br />

Also notice that date and time are the two functions that are likely to be included in a system for<br />

user input, yet not stored in a traditional NVRAM storage location. In this case, the destination is likely<br />

an RTC. This example shows the storage location as being NULL. Date and time are special cases<br />

where the storage location being NULL is translated into a call to the RTC (if available). In all other<br />

cases, a NULL parent will force the data the user inputs to be thrown away.<br />

Example: time hour varid = NULL.Hour,<br />

prompt = STR_TIME,<br />

help = STR_TIME_HOUR_HELP,<br />

min = 0,<br />

max = 23,<br />

step = 1,<br />

default = 0;<br />

minute varid = NULL.Minute,<br />

prompt = STR_TIME,<br />

help = STR_TIME_MINUTE_HELP,<br />

min = 0,<br />

max = 59,<br />

step = 1,<br />

default = 0;<br />

second varid = NULL.Second,<br />

prompt = STR_TIME,<br />

help = STR_TIME_SECOND_HELP,<br />

min = 0,<br />

max = 59,<br />

step = 1,<br />

default = 0;<br />

endtime;<br />

34


Setup Design Guide<br />

DRAFT<br />

4.2.16 string<br />

This command allows for the typing of a text string. This could take the form of a modem initialization<br />

string, or any other piece of informational human-readable data.<br />

Example: string<br />

endstring;<br />

varid = NvRamMap.MyStringData,<br />

prompt = STR_MY_STRING_PROMPT,<br />

help = STR_MY_STRING_HELP,<br />

minsize = 6,<br />

maxsize = 60,<br />

A second example shows how one would create a string command which required interaction with a<br />

hardware driver. Note from the first example that the key and flags settings are optional for this<br />

command. This example is not compatible with exporting data to runtime, and thus should only be<br />

used in cases where the calling application is intended to be a pre-boot only utility. For further<br />

information on the DYNAMIC and INTERACTIVE flags, see sections 4.3.3 and 4.3.4.<br />

Example: string<br />

endstring;<br />

varid = NULL.ModemString,<br />

prompt = STR_MODEM_STRING_PROMPT,<br />

help = STR_MODEM_STRING_HELP,<br />

minsize = 1,<br />

maxsize = 60,<br />

flags = INTERACTIVE,<br />

key = MODEM_STRING_KEY,<br />

More information about interacting with hardware is contained in section 2.6.<br />

4.2.17 password<br />

This command allows for the entry of a system password. It does not dictate system policy; the actual<br />

prompting for a power-on password is not done from the setup infrastructure. However, if a password<br />

is already set, the user will be prompted for the original password prior to allowing the user to change<br />

the password.<br />

Additionally, the storage format of the password is defined both by the VFR password encoding<br />

setting and the infrastructure itself. If the encoding is set to a zero value, the password will be stored<br />

in it’s Unicode format without encryption. The reference implementation provides a very rudimentary<br />

sample of an encryption mechanism which would be enabled by setting the encoding flag to one.<br />

Example: password<br />

varid = NvRamMap.Password,<br />

prompt = STR_PASSWORD_PROMPT,<br />

help = STR_PASSWORD_HELP,<br />

35


Setup Design Guide<br />

DRAFT<br />

4.2.18 goto<br />

endpassword;<br />

minsize = 6,<br />

maxsize = 20,<br />

encoding = 1,<br />

This command allows the user to jump to a new page. In terms of HTML operations, this behaves<br />

exactly like a hyper-link. The target for a goto command is going to be a form.<br />

Example: goto formid PAGE_ONE,<br />

4.2.19 grayoutif<br />

prompt = STR_GOTO_PAGE_ONE;<br />

The grayoutif tag causes the following tag to be displayed in a special display form used for<br />

inaccessible options if the Boolean expression evaluates to true. Those writing IFR should realize that<br />

different browsers will support this option to varying degrees. In particular, HTML has no similar<br />

construct so may not support this facility.<br />

Example: grayoutif NvRamMap.MagicNumber == 3;<br />

4.2.20 suppressif<br />

The suppressif tag causes the following tag to be hidden from the user if the Boolean expression<br />

evaluates to true. As with grayoutif, the quality of support may vary from browser to browser.<br />

HTML does not itself have a mechanism to provide this functionality.<br />

Example: suppressif NvRamMap.SerialPortCount == 0;<br />

4.2.21 hidden<br />

Hidden input allows for communication of things like revision data between the creator of the VFR and<br />

the consumer. The user should not generally see hidden tags. Hidden tags can be used inside VFR<br />

along with the grayoutif and suppressif tags to control display of optional data.<br />

Example: hidden<br />

4.2.22 inconsistentif<br />

varid = NULL.CurrentIfrVersion,<br />

value = 2;<br />

This tag uses a Boolean expression to allow the creator of the IFR to check options in a richer manner<br />

than provided by the question tags themselves. This tag may be used to e.g. validate that two options<br />

aren’t using the same address or that numbers entered align to some pattern (like leap years and<br />

February in date input). The tag provides a string to be used in a “pop-up” display to alert the user to<br />

the issue. Inconsistency tags may be evaluated when the user traverses from tag to tag or only upon<br />

submission. The user should not be allowed to submit the results of a form inconsistencies.<br />

Example: inconsistentif<br />

endif;<br />

prompt = STR_ERROR_POPUP,<br />

ideqval NvRamMap.TestValue == 2,<br />

36


Setup Design Guide<br />

DRAFT<br />

inconsistentif<br />

endif;<br />

prompt = STR_ERROR_POPUP,<br />

ideqvallist NvRamMap.TestValue length = 4,<br />

inconsistentif<br />

endif;<br />

ideqid<br />

4.2.23 AND, OR, NOT<br />

values == 1 2 3 4,<br />

prompt = STR_ERROR_POPUP,<br />

NvRamMap.TestValue == NvRamMap.TestOtherValue,<br />

These tags are used in conjunction with inconsistentif expressions. Much like their ‘C’<br />

counterparts, these tags are defined as logical and, or, and not operations.<br />

Example: inconsistentif<br />

endif;<br />

4.2.24 graphics<br />

TBD<br />

prompt = STR_ERROR_CALENDAR,<br />

ideqval NULL.Day == 29,<br />

AND,<br />

ideqval NULL.Month == 2,<br />

AND,<br />

NOT,<br />

4.3 Reserved Keywords<br />

ideqvallist NULL.Year length = 7,<br />

values == 2004 2008 2012 2016 2020 2024 2028<br />

The reserved keywords are generally the equivalent of ‘C’ type #define operations that are reserved<br />

by the compiler and not usable as user-defined variables. It is illegal to attempt to change the values for<br />

these keywords and the compiler will fail to build the VFR if this is attempted.<br />

4.3.1 DEFAULT<br />

This keyword is used primarily when defining flags settings for certain operations. This keyword will<br />

primarily be used when a user wants to revert to default settings.<br />

4.3.2 MANUFACTURING<br />

This keyword is used primarily when defining flags settings for certain operations. This keyword will<br />

primarily be used by a special utility to revert to the system settings to their manufacturing values.<br />

4.3.3 DYNAMIC<br />

**Limit to one-of, text, and string – any reason for other op-codes to be of this class?**<br />

37


Setup Design Guide<br />

DRAFT<br />

This keyword is used primarily when defining flags settings for certain operations. This keyword will<br />

primarily be used if a particular operation requires additional information from a hardware specific<br />

interface. The intention is that once the data is retrieved successfully, the bit will internally be turned<br />

off and a callback will not be done again. When doing a callback, a key will be passed to the driver<br />

who exported this data. The driver interprets the key and returns the appropriate data in an appropriate<br />

form. The compiler will ensure the key value specified is unique across the entire formset.<br />

A common scenario where this might be used is when a text op-code which prints CPU information is<br />

used and needs to print information like the CPU frequency. This obviously could not have been<br />

determined during the building of the VFR file.<br />

Example: text text = STR_CPU_FREQUENCY_TEXT,<br />

text = STR_CPU_DERIVED_TEXT,<br />

flags = DYNAMIC,<br />

key = CPU_FREQUENCY_KEY;<br />

More information about interacting with hardware is contained in section 2.6.<br />

4.3.4 INTERACTIVE<br />

**Limit to one-of, text, and string, and numeric – any reason for other op-codes to be of this<br />

class?**<br />

This keyword is used primarily when defining flags settings for certain operations. This keyword will<br />

primarily be used if a particular operation requires additional information from a hardware specific<br />

interface. The intention is that once the initial data is retrieved successfully, the DYNAMIC bit will<br />

internally be disabled. This assumes that the infrastructure now has sufficient data to display initial<br />

data to the screen.<br />

The INTERACTIVE flag is not compatible with exporting data to runtime since it assumes callbacks to<br />

a driver which may not exist in the O/S runtime space. The use of this flag should be relegated to preboot<br />

only utilities.<br />

Once a user makes a selection on a tag that is interactive, a callback will be made to retrieve the data<br />

from a driver. A common use for this flag might be the entering of a modem configuration string, and<br />

returning data based on the resulting status from the modem.<br />

Example: string<br />

endstring;<br />

varid = NULL.ModemString,<br />

prompt = STR_MODEM_STRING_PROMPT,<br />

help = STR_MODEM_STRING_HELP,<br />

minsize = 1,<br />

maxsize = 60,<br />

flags = INTERACTIVE,<br />

key = MODEM_STRING_KEY,<br />

In the above example, a user would select the modem string prompt. After typing in the modem string<br />

to send to the modem (i.e. ATE1M0), a callback to the driver would send this packet of data to the<br />

modem. The modem will give some return code to the called driver. The driver will return back to the<br />

38


Setup Design Guide<br />

DRAFT<br />

setup infrastructure with a particular return code and return packet. This packet (based on the keyword<br />

it is responding to) will contain some string data to print out. In the case of the above example, one<br />

might get returned a string stating “Modem Configured Without Errors”. The infrastructure will print<br />

that message, and return the user to the menu which contained the modem string prompt.<br />

More information about interacting with hardware is contained in section 2.6.<br />

39


Setup Design Guide<br />

DRAFT<br />

5<br />

User Interface Design<br />

The Setup described here is targeted at the following design goals<br />

1. Walk up and use interface – the user should not have to have training to use the user interface to<br />

successfully navigate the application. The user may or may not understand the actual fields<br />

presented.<br />

2. The driver should work in the firmware, with no reliance on rotating media or an operating system.<br />

It should use the fonts, strings, and forms as defined in the HII specification. Part of this<br />

development is to ensure that this support is sufficient.<br />

5.1 Home Page<br />

The root of the menu hierarchy (“the home page”) is the only page with no associated IFR. The page<br />

must be generated on the fly by the configuration driver. The page is the first presented to the user and<br />

has the following functions.<br />

1. Enables the user to choose an application to run. If three drivers exported data to the HII database,<br />

three different hyperlinks should be presented to choose from. Each of these hyperlinks may have<br />

several language versions to choose from.<br />

2. Allow the user by virtue of their choice of hyperlinks to pick a language to use.<br />

3. Allows the user to exit with or without updating the configuration.<br />

5.2 Subsequent Pages<br />

The format of subsequent pages is derived from the IFR representation of the corresponding form. The<br />

first form appearing in a form set is taken to be the root of the hierarchy represented by that form set.<br />

5.3 Key-based Navigation<br />

Setup is navigated by a series of keys. The bottom line of the screen is devoted to indicating the active<br />

keys at any time. In the UI lingo, this is known as ‘keys help’. The keys are used for navigation around<br />

the menus, and for modification of the configuration. The keys selected below are chosen because they<br />

do not change definition based on language and because they conform to several standards. The US<br />

English names of the keys are used for description.<br />

The keys used in Setup are:<br />

- Up Arrow, Down Arrow – move the highlight between fields on a menu. (Also Tab and<br />

Shift-Tab) The page is scrolled as necessary to display the next / previous prompt and<br />

option text.<br />

- PgUp, PgDn – scroll text. It is possible (although not likely) for string items (text, prompts,<br />

etc.) with no questions to fill the entire screen. PgUp and PgDn enable scrolling of the forms.<br />

If the currently selected option is not displayed on the page due to use of PgUp and PgDn,<br />

40


Setup Design Guide<br />

DRAFT<br />

input of either up or down arrow will cause the currently selected prompt and option to be<br />

displayed. The highlight will not move in this case.<br />

- Left Arrow, Right Arrow – Cycle through selections for one-of items.<br />

- Spacebar – selects or de-selects checkbox items.<br />

- 0, 1, …, 9 – Numeric entry<br />

- F1 – Scroll help.<br />

- F2 – Back (as in an internet browser. Path may be limited to an arbitrary number (e.g. 10) items or may<br />

be limited to reaching the main menu.<br />

- Esc – Return to parent menu discarding changes. If changes were made, a pop-up should require<br />

confirmation. Note that changes are not fully accepted until the user exits Setup or otherwise commits<br />

the changes..<br />

- Visible Keys – Passwords<br />

- Enter – Accept hyperlink or begin entering data on a question<br />

Per the walkup and use requirement, there is no help key because all help is presented to the user<br />

without request.<br />

5.4 Mouse Navigation<br />

A mouse may be used for navigation. Only the left mouse button is defined and only single clicks are<br />

supported.<br />

Where clicked<br />

Upper left corner (over<br />

F2=Back)<br />

Numeric, One-of,<br />

Password fields<br />

← and → to the left and<br />

right of one-of fields<br />

Check box<br />

5.5 Screen Format<br />

Action<br />

Return to previous (parent) menu<br />

Highlight field.<br />

Scroll through options<br />

Toggle check in box (X then space then X then space…)<br />

The screen is character oriented and divided vertically and horizontally into regions. Rows range from<br />

1 (the top line) to C max (the bottom line). Columns range from 1 (left-most) to R max (right most).<br />

Row 1 is the title line. The title is presented as centered on the line. On the first page, the title line is<br />

passed to the driver when it is invoked. On the remaining pages the title is derived from the Title IFR<br />

operand. Left and right arrows are displayed as the left most two character of all but the root title pages<br />

(for use with mouse navigation). They are used equivalently with the browser left and right arrows.<br />

Two options are also on the top line: “F2=Back” is flush left while “F3=Exit” is presented flush right<br />

(in positions similar to those on a browser).<br />

Row R max is used for keys help. The text for the keys help is carried by the Setup driver.<br />

41


Setup Design Guide<br />

DRAFT<br />

The area between the title screen and the keys help is known as the page body.<br />

The page body is divided into thirds. The leftmost block is known as the prompt block, the middle is<br />

the option block, and the rightmost column is the help block. The right two blocks (prompt block and<br />

option block) are collectively known as the question block.<br />

The question block is used to present subtitles and text. If they fit, question prompts reside in the<br />

prompt block. The currently selected option resides in the option block. The option column is<br />

separated from the help column by a scroll bar. If the IFR page is longer vertically than the page body,<br />

the appropriate arrows and block appear on the scroll bar.<br />

The currently selected input field is highlighted.<br />

Example (with fewer than normal rows):<br />

F2=Back<br />

Ersatz© 2003 Mega-SCSI<br />

▲<br />

Help:<br />

Interrupt . . . . . . . . . . . . . . ←PIRQ A→ │ SCAM (SCSI Configured<br />

Mode . . . . . . . . . . . . . . . . . ←Fast and Wide→ │ Automagically) will<br />

SCAM . . . . . . . . . . . . . . . . [X] ▒ automatically assign addresses<br />

← → toggles check box , ↑↓ moves highlight, F1 scrolls help<br />

│<br />

│<br />

▼<br />

to SCSI peripherals. Some<br />

old devices don’t work with<br />

SCAM.<br />

Note that the blank space between the prompt and the options is filled with dot+space pairs to provide<br />

horizontal visual reference. The dots do not necessarily align vertically. At least one space must appear<br />

after the prompt and before the option.<br />

5.6 Colors<br />

Colors are configurable via an optional protocol. If the optional protocol does not exist, a default<br />

palette is selected. The following areas are selectable<br />

Part of Screen<br />

Title background<br />

Default Color<br />

Dark Blue<br />

Title text<br />

Keys help background<br />

Keys help text<br />

Help Text<br />

Field background<br />

Field text (input prompt text, option<br />

White<br />

Black<br />

Light gray<br />

Dark Blue<br />

Light gray<br />

Black<br />

42


Setup Design Guide<br />

DRAFT<br />

text, text)<br />

Subtitle text<br />

Grayed-out text<br />

Suppressed text<br />

Highlight background<br />

Highlight text<br />

Inconsistency background<br />

Inconsistency text<br />

Black<br />

Dark Gray<br />

Not displayed<br />

White<br />

Black<br />

Yellow<br />

Black<br />

5.7 Pop-Ups<br />

Warnings (February cannot have 30 days) are displayed as pop-ups. The pop-ups are surrounded above<br />

and below by a blank field of the inconsistancy color and the message displayed<br />

5.8 Partial Language Availability<br />

It is quite possible that the language selected may only be available for a portion of the forms. If the<br />

currently selected language is not available for a given form, the default language shall be used.<br />

43


Setup Design Guide<br />

DRAFT<br />

6<br />

Setup Driver Considerations<br />

6.1 Pre-boot Operation versus Runtime Operation<br />

Due to the static nature of the data contained in the HII Database and the capacity to update NVRAM<br />

variables, the pre-boot configuration data can be effectively used during O/S runtime. This allows the<br />

same configuration mechanisms to be used in pre-boot as well as in runtime.<br />

Some thought needs to be given when designing the overall requirements associated with a setup<br />

application with regards to the type of data that is needed and it’s hardware interaction requirements.<br />

For additional information about hardware interaction see section 2.6. If some of the questions<br />

associated with a setup environment require a high level of hardware interaction, it might make sense to<br />

design the user interface flow in the VFR such that these types of questions are isolated. The reason for<br />

this is that when this data is exported to a runtime presence, it may not make any sense in that<br />

environment. For instance if there were a page which contained some diagnostic type of interactions<br />

which are not reasonable in a runtime environment the user experience of that page may not be<br />

desirable.<br />

6.2 How to allocate and steer data to NV storage<br />

The file which contains the global data primarily consists of a series of #define values and the definition<br />

of the NV mapping descriptors. This file is intended to be used as an include file both for VFR<br />

purposes as well as a ‘C’ syntax include file for drivers that are built to support the EFI setup<br />

infrastructure.<br />

There NV mapping descriptors take the form of structure declarations in this definition file. Each piece<br />

of data that can be changed in the configuration needs to be saved. For each of these data items, there<br />

will be a structure member.<br />

To support the ability to store data in multiple physical locations, one needs to be able to specify which<br />

data items will reside in which NV storage location. A common scenario would be that a developer<br />

might have the results of many questions reside in the systemboard NVRAM, yet some of the questions<br />

might reside in another NV storage location. To differentiate between which is the system store and<br />

which is the alternate store the VFR_NV_KEY macro is used in the structure definition.<br />

The VFR compiler will read the structure that has the macro with a 0 input as the system store<br />

descriptor. All structures with non-zero macro inputs are going to be considered to be non-system<br />

storage descriptors.<br />

A sample VFR entry which declares a system NV store descriptor might look like the following entry:<br />

nvstorage<br />

handle = NULL,<br />

devicepath = NULL,<br />

key = NvRamMapKey;<br />

A sample VFR entry which declares a non-system NV store descriptor might look like the following<br />

entry:<br />

nvstorage handle = 1,<br />

44


Setup Design Guide<br />

DRAFT<br />

devicepath = 1,<br />

key = RaidControllerNvDataKey;<br />

For additional information on the nvstorage command see section 4.2.7.<br />

The following snapshot is from the definition file containing the #define values as well as the NV<br />

structure definitions. This example shows a structure NvRamMap with the VFR_NV_KEY macro.<br />

The macro uses an NvRamMapKey which has a definition of 0. This then defines a system NV store<br />

structure. Followed immediately after it is a RaidControllerNvData structure definition with the same<br />

macro and the RaidControllerNvDataKey. Since the macro input evaluates to a non-zero value, it by<br />

definition is defining a non-system NV store structure.<br />

#define NvRamMapKey 0<br />

#define RaidControllerNvDataKey 1<br />

struct {<br />

UINT16<br />

SystemPassword[20];<br />

UINT16<br />

ModemInitializationString[60];<br />

UINT8<br />

SerialPortEnable;<br />

UINT16<br />

SamplePieceOfData;<br />

UINT32<br />

MyFavoriteNumber;<br />

} NvRamMap VFR_NV_KEY(NvRamMapKey);<br />

struct {<br />

UINT16<br />

SamplePieceOfData;<br />

UINT32<br />

MyFavoriteNumber;<br />

} RaidControllerNvData VFR_NV_KEY(RaidControllerNvDataKey);<br />

45


Setup Design Guide<br />

DRAFT<br />

7<br />

HII Database Interface<br />

7.1 EFI Human Interface Infrastructure Protocol<br />

Summary<br />

The EFI_HII_PROTOCOL manages the HII database, a repository for data having to do with fonts,<br />

strings, forms, keyboards, and other future human interface items.<br />

GUID<br />

#define EFI_HII_PROTOCOL_GUID \<br />

{ 0xb5f16136, 0x1144, 0x4d6a, 0xbb, 0xbb, 0x41, 0xf2, \<br />

0xff, 0x1e, 0x1d, 0x4 }<br />

Protocol Interface Structure<br />

typedef struct _EFI_HII_PROTOCOL {<br />

EFI_HII_NEW_PACK<br />

NewPack;<br />

EFI_HII_REMOVE_PACK<br />

RemovePack;<br />

EFI_HII_FIND_HANDLES<br />

FindHandles;<br />

EFI_HII_GET_GLYPH<br />

EFI_HII_GET_PRI_LANGUAGES<br />

EFI_HII_GET_SEC_LANGUAGES<br />

EFI_HII_NEW_STRING<br />

EFI_HII_GET_STRING<br />

EFI_HII_TEST_STRING<br />

EFI_HII_GET_LINE<br />

EFI_HII_GET_FORMS<br />

EFI_HII_UPDATE_FORM<br />

EFI_HII_GET_KEYBOARD_LAYOUT<br />

GetGlyph;<br />

GetPrimaryLanguages;<br />

GetSecondaryLanguages;<br />

NewString;<br />

GetString;<br />

TestString;<br />

GetLine;<br />

GetForms;<br />

UpdateForm;<br />

GetKeyboardLayout;<br />

} EFI_HII_PROTOCOL;<br />

Parameters<br />

NewPack<br />

RemovePack<br />

FindHandles<br />

Extracts the various packs from a package list. The descriptions of<br />

how each type of pack is processed are described in subsequent<br />

sections.<br />

Removes the package from the HII Database.<br />

Determines the handles that are currently active in the database.<br />

46


Setup Design Guide<br />

DRAFT<br />

GetGlyph<br />

GetPrimaryLanguages<br />

GetSecondaryLanguages<br />

NewString<br />

GetString<br />

TestString<br />

GetLine<br />

GetForms<br />

UpdateForm<br />

GetKeyboard<br />

Translates a Unicode character into the corresponding font glyph.<br />

This function allows a program to determine which primary<br />

languages are supported on a given handle.<br />

This function allows a program to determine which secondary<br />

languages are supported on a given handle for a given primary<br />

language.<br />

This function allows a new String to be added to an already existing<br />

String Package.<br />

This function extracts a string from a package already registered with<br />

the HII database.<br />

Test if all of the characters in a string have corresponding font<br />

characters.<br />

This function allows a program to extract a part of a string of not<br />

more than a given width.<br />

This function allows a program to extract a form or form package<br />

that has previously been registered with the EFI HII database.<br />

This function allows the caller to update a form or form package that<br />

has previously been registered with the EFI HII database.<br />

This function provides the caller with the current keyboard layout<br />

definitions that is registered with the HII Database.<br />

Description<br />

Extracts the various packs from a package list. The descriptions of how each type of pack is processed<br />

are described in subsequent sections.<br />

47


Setup Design Guide<br />

DRAFT<br />

Related Definitions<br />

typedef UINT16 RELOFST<br />

typedef UINT16 STRING_REF<br />

RELOFST is a 16-bit word offset relative to the start of the encompassing String Pack structure, thus<br />

providing position independence for the entire structure.<br />

STRING_REF is a variable that can contain a STRING_TOKEN. When used in programs, string<br />

tokens are fundamentally constants.<br />

typedef UINTN EFI_HII_HANDLE;<br />

typedef CHAR16 * EFI_STRING;<br />

typedef UINT16 EFI_FORM_ID;<br />

typedef UINT16 EFI_FORM_LABEL;<br />

//<br />

// The following types are currently defined:<br />

//<br />

#define EFI_HII_FONT 1<br />

#define EFI_HII_STRING 2<br />

#define EFI_HII_IFR 3<br />

#define EFI_HII_KEYBOARD 4<br />

typedef struct {<br />

UINT32 Length;<br />

UINT16 Type;<br />

} EFI_HII_PACK_HEADER;<br />

//<br />

// A string package is used to localize strings to a particular<br />

// language. The package is associated with a particular driver<br />

// or set of drivers. Tools are used to associate tokens with<br />

// string references in forms and in programs. These tokens are<br />

// language agnostic. When paired with a language pack (directly<br />

// or indirectly), the string token resolves into an actual<br />

// UNICODE string.<br />

//<br />

//<br />

// LanguageNameString The string containing one or more ISO 639-2<br />

// three character designator of the language or languages whose<br />

// translations are contained in this language pack. The first<br />

// designator indicates the primary language while the others are<br />

// secondary languages.<br />

//<br />

// PrintableLanguageName Contains the offset into this structure<br />

48


Setup Design Guide<br />

DRAFT<br />

// of a printable name of the language for use when prompting the<br />

// user. The language printed is to be the primary language.<br />

//<br />

//<br />

// String attributes<br />

//<br />

#define LANG_RIGHT_TO_LEFT 0x00000001<br />

LANG_RIGHT_TO_LEFT: If on, the language is intended to be printed right to left. The default (off)<br />

is to print left to right.<br />

//<br />

// StringPointers Are relative offsets from the beginning of the<br />

// package to each corresponding string. This<br />

// list of pointers will be null-terminated.<br />

//<br />

typedef struct {<br />

EFI_HII_PACK_HEADER Header;<br />

RELOFST LanguageNameString;<br />

RELOFST PrintableLanguageName;<br />

UINT32 Attributes;<br />

RELOFST StringsPointers[1];<br />

STRING Strings[1];<br />

} EFI_HII_STRING_PACK;<br />

//<br />

// Glyph Attributes<br />

//<br />

#define GLYPH_NON_SPACING 1<br />

#define GLYPH_NON_BREAKING 2<br />

Unicode defines several non-spacing characters which are generally used to implement uncommon<br />

accents, etc (as in Vietnamese). The idea is to ‘or’ the non-spacing character over the succeeding<br />

character.<br />

typedef struct {<br />

CHAR16<br />

UnicodeWeight;<br />

UINT8<br />

Attributes;<br />

UINT8<br />

GlyphCol1[19];<br />

} EFI_NARROW_GLYPH;<br />

typedef struct {<br />

CHAR16 UnicodeWeight;<br />

UINT8<br />

Attributes;<br />

UINT8<br />

GlyphCol1[19], GlyphCol2[19];<br />

UINT8<br />

Pad[3];<br />

} EFI_WIDE_GLYPH;<br />

49


Setup Design Guide<br />

DRAFT<br />

//<br />

// A font list consists of a font header followed by a series<br />

// of glyph structures. Note that fonts are not language specific.<br />

//<br />

typedef struct {<br />

EFI_HII_PACK_HEADER Header;<br />

UINT16<br />

NumberOfNarrowGlyphs;<br />

UINT16<br />

NumberOfWideGlyphs;<br />

EFI_NARROW_GLYPH NarrowGlyphs[1];<br />

EFI_WIDE_GLYPH WideGlyphs[1];<br />

} EFI_HII_FONT_PACK;<br />

//<br />

// A form list consists of a large variety of structure<br />

// possibilities so to represent the binary blob of data<br />

// associated with a package of forms, we will assume a<br />

// pointer to a self-describing data buffer.<br />

//<br />

typedef struct {<br />

EFI_HII_PACK_HEADER Header;<br />

VOID<br />

*IfrData;<br />

} EFI_HII_IFR_PACK;<br />

typedef enum {<br />

EfiKeyLCtrl, EfiKeyA0, EfiKeyLAlt, EfiKeySpaceBar,<br />

EfiKeyA2, EfiKeyA3, EfiKeyA4, EfiKeyRCtrl, EfiKeyLeftArrow,<br />

EfiKeyDownArrow, EfiKeyRightArrow, EfiKeyZero,<br />

EfiKeyPeriod, EfiKeyEnter, EfiKeyLShift, EfiKeyB0,<br />

EfiKeyB1, EfiKeyB2, EfiKeyB3, EfiKeyB4, EfiKeyB5, EfiKeyB6,<br />

EfiKeyB7, EfiKeyB8, EfiKeyB9, EfiKeyB10, EfiKeyRshift,<br />

EfiKeyUpArrow, EfiKeyOne, EfiKeyTwo, EfiKeyThree,<br />

EfiKeyCapsLock, EfiKeyC1, EfiKeyC2, EfiKeyC3, EfiKeyC4,<br />

EfiKeyC5, EfiKeyC6, EfiKeyC7, EfiKeyC8, EfiKeyC9,<br />

EfiKeyC10, EfiKeyC11, EfiKeyC12, EfiKeyFour, EfiKeyFive,<br />

EfiKeySix, EfiKeyPlus, EfiKeyTab, EfiKeyD1, EfiKeyD2,<br />

EfiKeyD3, EfiKeyD4, EfiKeyD5, EfiKeyD6, EfiKeyD7, EfiKeyD8,<br />

EfiKeyD9, EfiKeyD10, EfiKeyD11, EfiKeyD12, EfiKeyD13,<br />

EfiKeyDel, EfiKeyEnd, EfiKeyPgDn, EfiKeySeven, EfiKeyEight,<br />

EfiKeyNine, EfiKeyE0, EfiKeyE1, EfiKeyE2, EfiKeyE3,<br />

EfiKeyE4, EfiKeyE5, EfiKeyE6, EfiKeyE7, EfiKeyE8, EfiKeyE9,<br />

EfiKeyE10, EfiKeyE11, EfiKeyE12, EfiKeyBackSpace,<br />

EfiKeyIns, EfiKeyHome, EfiKeyPgUp, EfiKeyNLck, EfiKeySlash,<br />

EfiKeyAsterisk, EfiKeyMinus, EfiKeyEsc, EfiKeyF1, EfiKeyF2,<br />

EfiKeyF3, EfiKeyF4, EfiKeyF5, EfiKeyF6, EfiKeyF7, EfiKeyF8,<br />

EfiKeyF9, EfiKeyF10, EfiKeyF11, EfiKeyF12, EfiKeyPrint,<br />

EfiKeySLck, EfiKeyPause<br />

50


Setup Design Guide<br />

DRAFT<br />

} EFI_KEY;<br />

Figure 1<br />

typedef struct {<br />

EFI_KEY<br />

CHAR16<br />

CHAR16<br />

CHAR16<br />

CHAR16<br />

UINT16<br />

} EFI_KEY_DESCRIPTOR;<br />

Key;<br />

Unicode;<br />

ShiftedUnicode;<br />

AltGrUnicode;<br />

ShiftedAltGrUnicode;<br />

Modifier;<br />

//<br />

// This structure allows a sparse set of keys to be redefined<br />

// or a complete redefinition of the keyboard layout. Most<br />

// keyboards have a lot of commonality in their layouts, therefore<br />

// only defining those keys that need to change from the default<br />

// minimizes the passed in information.<br />

//<br />

// Additionally, when an update occurs, the active keyboard layout<br />

// will be switched to the newly updated keyboard layout. This<br />

// allows for situations that when a keyboard layout driver is<br />

// loaded as part of system initialization, the system will default<br />

// the keyboard behavior to the new layout.<br />

//<br />

// Each call to update the keyboard mapping should contain the<br />

// complete set of key descriptors to be updated, since every<br />

// call to the HII which contains an EFI_HII_KEYBOARD_PACK will<br />

// wipe the previous set of overrides. A call to<br />

//<br />

typedef struct {<br />

EFI_HII_PACK_HEADER Header;<br />

EFI_KEY_DESCRIPTOR *Descriptor;<br />

UINTN<br />

DescriptorCount;<br />

} EFI_HII_KEYBOARD_PACK;<br />

typedef union {<br />

EFI_HII_IFR_PACK<br />

EFI_HII_FONT_PACK<br />

EFI_HII_STRING_PACK<br />

EFI_HII_KEYBOARD_PACK<br />

} EFI_HII_PACK_LIST;<br />

*IfrPack;<br />

*FontPack;<br />

*StringPack;<br />

*KeyboardPack;<br />

51


Setup Design Guide<br />

DRAFT<br />

7.1.1 EFI_HII_PROTOCOL.NewPack()<br />

Summary<br />

Extracts the various packs from a package list.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_NEW_PACK) (<br />

IN EFI_HII_PROTOCOL<br />

IN EFI_HII_PACK_LIST<br />

OUT EFI_HII_HANDLE<br />

);<br />

*This,<br />

*Package,<br />

*Handle<br />

Parameters<br />

This<br />

PackageList<br />

Handle<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

A pointer to an EFI_HII_PACK_LIST package instance.<br />

A pointer to the EFI_HII_HANDLE instance.<br />

Description<br />

With the exception of font and keyboard data, this function adds the contents of the package list to the<br />

database and returns a handle back to the data. Font and keyboard data is kept in a common pool and<br />

will have a NULL handle associated with them. In the case where a PackageList contains both<br />

pooled data and database data, a valid handle will be returned upon the addition of the appropriate data<br />

into the database.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

Data was extracted from the Package, Database was updated with<br />

the data, and Handle returned successfully.<br />

The content of the Package was invalid.<br />

52


Setup Design Guide<br />

DRAFT<br />

7.1.2 EFI_HII_PROTOCOL.RemovePack()<br />

Summary<br />

Remove a package from the HII Database.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_REMOVE_PACK) (<br />

IN EFI_HII_PROTOCOL<br />

IN EFI_HII_HANDLE<br />

);<br />

*This,<br />

Handle<br />

Parameters<br />

This<br />

Handle<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

The handle that was registered to the data that is being requested to<br />

be removed.<br />

Description<br />

This function removes the string and/or form data associated with a handle from the HII database. This<br />

function has no effect on keyboard or font data that may have been registered with the NewPack<br />

function.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

The data associated with the Handle was removed from the HII<br />

Database.<br />

The Handle was not valid.<br />

53


Setup Design Guide<br />

DRAFT<br />

7.1.3 EFI_HII_PROTOCOL.FindHandles()<br />

Summary<br />

Determines the handles that are currently active in the database.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_FIND_HANDLES) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN OUT UINT16<br />

*HandleBufferLength,<br />

OUT EFI_HII_HANDLE *Handle<br />

);<br />

Parameters<br />

This<br />

HandleBufferLength<br />

Handle<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

A pointer to the length of the handle buffer on input. On output the<br />

actual number of handles.<br />

An array of EFI_HII_HANDLE instances returned.<br />

Description<br />

Determines the handles that are currently active in the database. As an example of use, a program<br />

wishing to create a Setup-like configuration utility would use this call to determine the handles<br />

available. It would then use calls defined in the forms section below to extract forms and then interpret<br />

them.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_BUFFER_TOO_SMALL<br />

Handles[] updated successfully.<br />

The HandleBufferLength parameter indicates that Handle[] is too<br />

small to support the number of handles. HandleBufferLength is<br />

updated with a value that will enable the data to fit.<br />

54


Setup Design Guide<br />

DRAFT<br />

7.1.4 EFI_HII_PROTOCOL.TestString()<br />

Summary<br />

Test if all of the characters in a string have corresponding font characters.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_TEST_STRING) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN CHAR16 *StringToTest,<br />

IN OUT UINT32<br />

*FirstMissing,<br />

OUT UINT32 *GlyphBufferSize<br />

);<br />

Parameters<br />

This<br />

StringToTest<br />

FirstMissing<br />

GlyphBufferSize<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

A pointer to a Unicode string.<br />

A pointer to an index into the string. On input, the index of the first<br />

character in the StringToTest to examine. On exit, the index of<br />

the first character encountered for which a glyph is unavailable. If all<br />

glyphs in the string are available, the index is the index of the<br />

terminator of the string.<br />

A pointer to a value. On output, if the function returns<br />

EFI_SUCCESS, this contains the amount of memory required to<br />

store the string’s glyph equivalent.<br />

Description<br />

This function may be repeatedly called to determine subsequent missing characters. Note that the index<br />

pointed to by FirstMissing must be incremented between calls. Line separator characters are<br />

ignored.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_NOT_FOUND<br />

All glyphs are available. (Note that an empty string always returns<br />

this value.)<br />

A glyph was not found for a character.<br />

55


Setup Design Guide<br />

DRAFT<br />

7.1.5 EFI_HII_PROTOCOL.GetGlyph()<br />

Summary<br />

Translates a Unicode character into the corresponding font glyph.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_GLYPH) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN CHAR16 *Source,<br />

IN OUT UINT16<br />

*<strong>Index</strong>,<br />

OUT UINT8 *GlyphBuffer,<br />

OUT UINT16 *BitWidth,<br />

IN OUT UINT32<br />

*InternalStatus<br />

);<br />

Parameters<br />

This<br />

Source<br />

<strong>Index</strong><br />

GlyphBuffer<br />

BitWidth<br />

InternalStatus<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

A pointer to a Unicode string.<br />

On input, the offset into the string to fetch the character from. On<br />

successful completion, the index is updated to the first character past<br />

the character(s) making up the just extracted glyph.<br />

Pointer to an array where the glyphs corresponding to the characters<br />

in the Source may be stored. GlyphBuffer is assumed to be wide<br />

enough to accept a wide glyph character.<br />

If EFI_SUCCESS was returned, the UINT16 pointed to by this<br />

value is filled with the length of the glyph in pixels. Unchanged if<br />

the call was unsuccessful.<br />

To save the time required to read the string from the beginning on<br />

each glyph extraction (to ensure that e.g. the narrow versus wide<br />

glyph mode is correct), this value is updated each time the function is<br />

called with status local to the call. The cell pointed to by this<br />

parameter must be initialized to 0 prior to invoking the call the first<br />

time for any string.<br />

Description<br />

The data returned is the format required for input to the UGA BLT routines.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

It worked.<br />

EFI_NOT_FOUND<br />

A glyph for a character was not found.<br />

56


Setup Design Guide<br />

DRAFT<br />

7.1.6 EFI_HII_PROTOCOL.NewString()<br />

Summary<br />

This function allows a new String to be added to an already existing String Package.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_NEW_STRING) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN CHAR16<br />

*Language,<br />

IN EFI_HII_HANDLE Handle,<br />

IN STRING_REF<br />

*Reference,<br />

IN CHAR16<br />

*NewString<br />

);<br />

Parameters<br />

This<br />

Language<br />

Handle<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Pointer to a NULL-terminated string containing a single ISO-639-2<br />

language identifier, indicating the language the string is translated<br />

in. A string consisting of all spaces indicates that the string is<br />

applicable to all languages.<br />

The handle of the language pack to which the string is to be added.<br />

Reference The identifier of the string to be added. If the reference value is 0,<br />

then the string will be assigned a new identifier on that handle for<br />

the Language specified. Otherwise, the string will be updated with<br />

the NewString Value.<br />

NewString<br />

Description<br />

The string to be added.<br />

This routine adds a new string to a string package already submitted via NewPack. This string<br />

effectively overwrites existing strings.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

String effectively registered.<br />

Unknown handle.<br />

57


Setup Design Guide<br />

DRAFT<br />

7.1.7 EFI_HII_PROTOCOL.GetPrimaryLanguages()<br />

Summary<br />

This function allows a program to determine what the primary languages that are supported on a given<br />

handle.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_PRI_LANGUAGES) (<br />

IN EFI_HII_PROTOCOL<br />

*This,<br />

IN EFI_HII_HANDLE<br />

Handle,<br />

OUT EFI_STRING<br />

*LanguageString<br />

);<br />

Parameters<br />

This<br />

Handle<br />

LanguageString<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Handle on which the strings reside.<br />

A string allocated by GetPrimaryLanguages containing a list of<br />

all primary languages registered on the handle. The routine will not<br />

return the 3-spaces language identifier used in other functions to<br />

indicate non-language-specific strings.<br />

Description<br />

This routine is intended to be used by drivers to query the interface database for supported languages.<br />

This routine returns a string of concatenated 3 byte language identifiers one per string package<br />

associated with the handle.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

Correctly returned the LanguageString.<br />

Unknown handle.<br />

58


Setup Design Guide<br />

DRAFT<br />

7.1.8 EFI_HII_PROTOCOL.GetSecondaryLanguages()<br />

Summary<br />

This function allows a program to determine which secondary languages are supported on a given<br />

handle for a given primary language.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_SEC_LANGUAGES) (<br />

IN EFI_HII_PROTOCOL<br />

*This,<br />

IN EFI_HII_HANDLE<br />

Handle,<br />

IN CHAR16<br />

*PrimaryLanguage,<br />

OUT EFI_STRING<br />

*LanguageString<br />

);<br />

Parameters<br />

This<br />

Handle<br />

PrimaryLanguage<br />

LanguageString<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Handle on which the strings reside.<br />

Pointer to a NULL-terminated string containing a single ISO-639-2<br />

language identifier, indicating the primary language.<br />

A string allocated by GetSecondaryLanguages containing a<br />

list of all secondary languages registered on the handle. The routine<br />

will not return the 3-spaces language identifier used in other<br />

functions to indicate non-language-specific strings, nor will it return<br />

the primary language. This function succeeds but returns a NULL<br />

LanguageString if there are no secondary languages associated<br />

with the input Handle and PrimaryLanguage pair.<br />

Description<br />

Each string package has associated with it a single primary language and zero or more secondary<br />

languages. This routine returns the secondary languages associated with a string package. The string<br />

package is identified by the package list handle and the (currently three character ISO-639-2 primary<br />

language identifier.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

Correctly returned the LanguageString.<br />

Unknown handle.<br />

59


Setup Design Guide<br />

DRAFT<br />

7.1.9 EFI_HII_PROTOCOL.GetString()<br />

Summary<br />

This function extracts a string from a package already registered with the EFI HII database.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_STRING) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN EFI_HII_HANDLE Handle,<br />

IN STRING_REF Token,<br />

IN BOOLEAN Raw,<br />

IN CHAR16 *LanguageString,<br />

IN OUT UINT16<br />

*BufferLength,<br />

OUT EFI_STRING *StringBuffer<br />

);<br />

Parameters<br />

This<br />

Handle<br />

Token<br />

Raw<br />

LanguageString<br />

BufferLength<br />

StringBuffer<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Handle on which the string resides.<br />

The string token assigned to the string.<br />

If true, the string is returned unedited in the internal storage format<br />

described above. If false, the string returned is edited by replacing<br />

with and by removing special characters such as the<br />

prefix.<br />

Pointer to a NULL-terminated string containing a single ISO-639-2<br />

language identifier, indicating the language to print. If the<br />

LanguageString is empty (starts with a NULL) the default system<br />

language will be used to determine the language.<br />

Length of the StringBuffer. If the status reports that the buffer<br />

width is too small, this parameter is filled with the length of the<br />

buffer needed.<br />

The buffer designed to receive the characters in the string.<br />

Description<br />

This routine extracts a string from the package database. The string may be extracted in internal or<br />

external formats.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

EFI_BUFFER_TOO_SMALL<br />

StringBuffer is filled with a null-terminated string.<br />

Unknown handle or string token.<br />

The buffer provided was not large enough to allow the<br />

60


Setup Design Guide<br />

DRAFT<br />

entire string to be stored.<br />

61


Setup Design Guide<br />

DRAFT<br />

7.1.10 EFI_HII_PROTOCOL.GetLine()<br />

Summary<br />

This function allows a program to extract a part of a string of not more than a given width. With<br />

repeated calls, this allows a calling program to extract “lines” of text that fit inside columns. The effort<br />

of measuring the fit of strings inside columns is localized to this call.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_LINE) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN EFI_HII_HANDLE Handle,<br />

IN STRING_REF Token,<br />

IN OUT UINT16<br />

*<strong>Index</strong>,<br />

IN UINT16 LineWidth,<br />

IN CHAR16 *LanguageString,<br />

IN OUT UINT16<br />

*BufferLength,<br />

OUT EFI_STRING *StringBuffer<br />

);<br />

Parameters<br />

This<br />

Handle<br />

Token<br />

<strong>Index</strong><br />

LineWidth<br />

LanguageString<br />

BufferLength<br />

StringBuffer<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Handle on which the string resides.<br />

The string token assigned to the string.<br />

On input, the offset into the string where the line is to start. On<br />

output, the index is updated to point to beyond the last character<br />

returned in the call. The interface is designed so that repeated calls<br />

will fill the buffer with subsequent parameters.<br />

The maximum width of the line in units of narrow glyphs. Specific<br />

line breaks (as in the case of two carriage returns) are still honored<br />

resulting in separate lines. The buffer is padded to the length in<br />

narrow spaces.<br />

Pointer to a NULL-terminated string containing a single ISO-639-2<br />

language identifier, indicating the language to print. If the<br />

LanguageString is empty (starts with a NULL) the default system<br />

language will be used to determine the language.<br />

Pointer to the Length of the StringBuffer. If the status reports<br />

that the buffer width is too small, this parameter is filled with the<br />

length of the buffer needed.<br />

The buffer designed to receive the characters in the string.<br />

Description<br />

62


Setup Design Guide<br />

DRAFT<br />

This function is used to extract parts of a string so that those parts of strings fit inside a column of a<br />

defined width. This is commonly used in menuing applications.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_NOT_FOUND<br />

EFI_BUFFER_TOO_SMALL<br />

StringBuffer filled with characters that will fit on the<br />

line.<br />

The font glyph for at least one of the characters in the<br />

string is not in the font database.<br />

The buffer provided was not large enough to allow the<br />

entire string to be stored. Note that the BufferWidth<br />

may need to be larger than the LineWidth due to e.g.<br />

non-spacing characters.<br />

63


Setup Design Guide<br />

DRAFT<br />

7.1.11 EFI_HII_PROTOCOL.GetForms()<br />

Summary<br />

This function allows a program to extract a form or form package that has previously been registered<br />

with the EFI HII database.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_FORMS) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN EFI_HII_HANDLE Handle,<br />

IN EFI_FORM_ID FormId,<br />

IN OUT UINT16<br />

*BufferLength,<br />

OUT UINT8 *Buffer<br />

);<br />

Parameters<br />

This<br />

Handle<br />

FormId<br />

BufferLength<br />

Buffer<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Handle on which the form resides.<br />

The id of the form to return. If the id is zero, the entire form package<br />

is returned.<br />

On input, the length of the Buffer. On output, the length of the<br />

returned buffer, if the length was sufficient and, if it was not, the<br />

length that is required to fit the requested form(s).<br />

The buffer designed to receive the form(s).<br />

Description<br />

This function is used to extract a form or forms<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

EFI_NOT_FOUND<br />

EFI_BUFFER_TOO_SMALL<br />

Buffer filled with the requested forms.<br />

BufferLength updated.<br />

Unknown handle.<br />

A form on the requested handle cannot be found with the<br />

requested FormId.<br />

The buffer provided was not large enough to allow the<br />

form to be stored.<br />

64


Setup Design Guide<br />

DRAFT<br />

7.1.12 EFI_HII_PROTOCOL.UpdateForm()<br />

Summary<br />

This function allows the caller to update a form or form package that has previously been registered<br />

with the EFI HII database.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_UPDATE_FORM) {<br />

IN EFI_HII_PROTOCOL *This,<br />

IN EFI_HII_HANDLE Handle,<br />

IN EFI_FORM_LABEL Label,<br />

IN UINT16<br />

BufferLength,<br />

IN UINT8<br />

*Buffer<br />

};<br />

Parameters<br />

This<br />

Handle<br />

Label<br />

BufferLength<br />

Buffer<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

Handle of the package where the form to be updated resides.<br />

The label inside the form package where the update is to take place.<br />

The length of the Buffer.<br />

The buffer containing the new tags to insert before Label.<br />

Description<br />

This function allows a program to update a form at runtime. The form must have been built expecting<br />

the update, as a labÄel tag is required. The tags in Buffer are inserted into the form just prior to the<br />

label tag.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

EFI_NOT_FOUND<br />

The Form was updated with the new tags.<br />

The buffer for the buffer length does not contain an integral<br />

number of tags.<br />

The Handle, Label, or FormId was not found.<br />

65


Setup Design Guide<br />

DRAFT<br />

7.1.13 EFI_HII_PROTOCOL.GetKeyboardLayout()<br />

Summary<br />

This function allows a program to retrieve the keyboard layout data that has previously been registered<br />

with the EFI HII database.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (<br />

IN EFI_HII_PROTOCOL *This,<br />

IN OUT UINT16<br />

DescriptorCount,<br />

OUT EFI_KEY_DESCRIPTOR *Descriptor<br />

);<br />

Parameters<br />

This<br />

DescriptorCount<br />

Descriptor<br />

A pointer to the EFI_HII_PROTOCOL instance.<br />

On input, the number of Descriptor entries the buffer can hold.<br />

On output, the number of entries of the returned buffer, if the length<br />

was sufficient and, if it was not, the number of entries that is required<br />

to fit the requested keyboard layout data.<br />

The pointer to the buffer designed to receive the keyboard layout<br />

data.<br />

Description<br />

This function is used to extract the keyboard layout. The returned buffer will contain the current default<br />

system descriptor data merged with any override keyboard data. For example, if the firmware default<br />

keyboard is the U.S. keyboard and a driver added via NewPack a keyboard descriptor set for a<br />

Germany keyboard, the layout which is retrieved will reflect the U.S. keyboard with the Germany<br />

overrides.<br />

If a program needed to acquire the base keyboard layout, it could do the following: Issue a<br />

GetKeyboardLayout and cache the results. Issue a NewPack with a keyboard descriptor count of<br />

zero to wipe out the keyboard overrides. Issue a GetKeyboardLayout to get the base keyboard<br />

layout, and update via NewPack the original overrides.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_BUFFER_TOO_SMALL<br />

KeyDescriptor filled with the requested keyboard<br />

layout. KeyDescriptorCount updated.<br />

The buffer provided was not large enough to allow the<br />

form to be stored.<br />

66


Setup Design Guide<br />

DRAFT<br />

7.2 EFI Form Configuration Protocol<br />

Summary<br />

The EFI_FORM_CONFIGURATION_PROTOCOL is the interface to the EFI Configuration Driver.<br />

This will allow the caller to direct the configuration driver to use either the HII database or use the<br />

passed in packet of data. This will also allow the caller to post messages into the configuration drivers<br />

internal mailbox.<br />

GUID<br />

#define EFI_FORM_CONFIGURATION_PROTOCOL_GUID \<br />

{ 0xe5a1333e, 0xe1b4, 0x4d55, 0xce, 0xeb, 0x35, 0xc3, \<br />

0xef, 0x13, 0x34, 0x43 }<br />

Protocol Interface Structure<br />

typedef struct _EFI_FORM_CONFIGURATION_PROTOCOL {<br />

EFI_SEND_FORM<br />

SendForm;<br />

EFI_SEND_MESSAGE<br />

SendMessage;<br />

} EFI_FORM_CONFIGURATION_PROTOCOL;<br />

Parameters<br />

SendForm<br />

SendMessage<br />

This function provides direction to the configuration driver whether<br />

to use the HII database or to use a passed-in set of data. This also<br />

establishes a pointer to the calling driver’s callback interface.<br />

This function allows the caller to put data into the configuration<br />

driver’s internal mailbox. This has the effect of allowing data to be<br />

posted as a key/value pair and have information be updated as an<br />

out-of-band transaction.<br />

Description<br />

This is the interface to call for drivers to leverage the EFI Configuration Driver interface.<br />

Related Definitions<br />

67


Setup Design Guide<br />

DRAFT<br />

7.2.1 EFI_FORM_CONFIGURATION_PROTOCOL.SendForm()<br />

Summary<br />

This function provides direction to the configuration driver whether to use the HII database or to use a<br />

passed-in set of data. This also establishes a pointer to the calling driver’s callback interface.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_SEND_FORM) (<br />

IN EFI_FORM_CONFIGURATION_PROTOCOL *This,<br />

IN BOOLEAN<br />

UseDatabase,<br />

IN EFI_IFR_PACKET<br />

*Packet,<br />

IN EFI_HANDLE<br />

CallbackHandle<br />

);<br />

Parameters<br />

This<br />

UseDatabase<br />

Packet<br />

CallbackHandle<br />

A pointer to the EFI_FORM_CONFIGURATION_PROTOCOL<br />

instance.<br />

Determine whether or not the HII database is to be used to gather<br />

information. If the value is FALSE then the configuration driver<br />

will get the information provided in the passed in Packet or<br />

Message parameters.<br />

A pointer to a set of data containing pointers to IFR, and/or String<br />

data.<br />

The handle to the calling driver’s callback interface.<br />

Related Definitions<br />

#define EFI_HII_FONT 1<br />

#define EFI_HII_STRING 2<br />

#define EFI_HII_IFR 3<br />

#define EFI_HII_KEYBOARD 4<br />

typedef struct _EFI_HII_PACKET {<br />

UINT32<br />

Length;<br />

UINT16<br />

Type;<br />

} EFI_HII_PACKET;<br />

typedef struct {<br />

EFI_HII_PACKET<br />

EFI_HII_PACKET<br />

} EFI_IFR_PACKET;<br />

*IfrData;<br />

*StringData;<br />

68


Setup Design Guide<br />

DRAFT<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_NOT_FOUND<br />

EFI_BUFFER_TOO_SMALL<br />

EFI_INVALID_PARAMETER<br />

EFI_DEVICE_ERROR<br />

The function completed successfully<br />

The variable was not found.<br />

The DataSize is too small for the result. DataSize has<br />

been updated with the size needed to complete the<br />

request.<br />

One of the parameters has an invalid value.<br />

The variable could not be saved due to a hardware failure.<br />

69


Setup Design Guide<br />

DRAFT<br />

7.2.2 EFI_FORM_CONFIGURATION_PROTOCOL.SendMessage()<br />

Summary<br />

This function allows the caller to put data into the configuration driver’s internal mailbox. This has the<br />

effect of allowing data to be posted as a key/value pair and have information be updated as an out-ofband<br />

transaction.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_SEND_MESSAGE) (<br />

IN EFI_FORM_CONFIGURATION_PROTOCOL *This,<br />

IN UINT16<br />

MessageKey,<br />

IN VOID<br />

*MessageData,<br />

IN UINTN<br />

MessageDataLength<br />

);<br />

Parameters<br />

This<br />

MessageKey<br />

MessageData<br />

MessageDataLength<br />

A pointer to the EFI_FORM_CONFIGURATION_PROTOCOL<br />

instance.<br />

A unique value which will have be associated with a particular opcode.<br />

The messaging services are typically to be used in an<br />

Interactive or Dynamic mode situation where a periodic event may<br />

occur that requires certain pieces of data to be updated. For<br />

instance, temperature sensor data might get dynamically updated<br />

based on events from the calling driver.<br />

A pointer to the data associated with the MessageKey.<br />

The length of the data in MessageData.<br />

Related Definitions<br />

The MessageData format will be based on the op-code type that the<br />

MessageKey references.<br />

If OneOf command:<br />

An array of option encodings.<br />

Each encoding is as follows:<br />

typedef struct _EFI_IFR_OP_HEADER {<br />

UINT8<br />

OpCode;<br />

UINT8<br />

Length;<br />

} EFI_IFR_OP_HEADER;<br />

typedef struct {<br />

EFI_IFR_OP_HEADER<br />

Header;<br />

70


Setup Design Guide<br />

DRAFT<br />

STRING_REF Option; // The string token describing the option<br />

UINT16 Value; // The value associated with this option that is stored in<br />

// the NVRAM if chosen<br />

UINT8 Flags; // For now, if non-zero, means that it is the default<br />

// option, - further definition likely above<br />

UINT16 Key; // Value to be passed to caller to identify this particular<br />

// op-code<br />

} EFI_IFR_ONE_OF_OPTION;<br />

If Text command:<br />

An update for the second text parameter<br />

Each encoding is as follows:<br />

CHAR16<br />

*UpdateString<br />

If StringOp command:<br />

Each encoding is as follows:<br />

typedef struct {<br />

CHAR16 *UpdateString; // String to print as a status (May be NULL)<br />

BOOLEAN PopUp; // Create a PopUp box for the UpdateString<br />

} EFI_IFR_STRING_MESSAGE;<br />

If NumericOp command:<br />

Each encoding is as follows:<br />

UINT16<br />

NumericValue;<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_NOT_FOUND<br />

EFI_BUFFER_TOO_SMALL<br />

EFI_INVALID_PARAMETER<br />

EFI_DEVICE_ERROR<br />

The function completed successfully<br />

The variable was not found.<br />

The DataSize is too small for the result. DataSize has<br />

been updated with the size needed to complete the<br />

request.<br />

One of the parameters has an invalid value.<br />

The variable could not be saved due to a hardware failure.<br />

•<br />

71


Setup Design Guide<br />

DRAFT<br />

7.3 EFI Form Callback Protocol<br />

Summary<br />

The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to custom NV storage<br />

devices as well as communication of user selections in a more interactive environment. This protocol<br />

should be published by hardware specific drivers which want to export access to custom hardware<br />

storage or publish IFR which has a requirement to call back the original driver.<br />

GUID<br />

#define EFI_FORM_CALLBACK_PROTOCOL_GUID \<br />

{ 0xf3e4543d, 0xcf35, 0x6cef, 0x35, 0xc4, 0x4f, 0xe6, \<br />

0x34, 0x4d, 0xfc, 0x54 }<br />

Protocol Interface Structure<br />

typedef struct _EFI_FORM_CALLBACK_PROTOCOL {<br />

EFI_NV_READ<br />

NvRead;<br />

EFI_NV_WRITE<br />

NvWrite;<br />

EFI_FORM_CALLBACK<br />

Callback;<br />

} EFI_FORM_CALLBACK_PROTOCOL;<br />

Parameters<br />

Read<br />

Write<br />

Callback<br />

This is the read operation to access the NV data serviced by a<br />

hardware specific driver.<br />

This is the write operation to access the NV data serviced by a<br />

hardware specific driver.<br />

This is the function that is called from the configuration browser to<br />

communicate key value pairs.<br />

Description<br />

This is the interface that is provided by hardware specific drivers that control access to non-system NV<br />

storage and support callbacks from the browser or HII.<br />

72


Setup Design Guide<br />

DRAFT<br />

7.3.1 EFI_FORM_CALLBACK_PROTOCOL.NvRead()<br />

Summary<br />

Returns the value of a variable.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_NV_READ) (<br />

IN EFI_FORM_CALLBACK_PROTOCOL *This,<br />

IN CHAR16<br />

*VariableName,<br />

IN EFI_GUID<br />

*VendorGuid,<br />

OUT UINT32<br />

*Attributes OPTIONAL,<br />

IN OUT UINTN<br />

*DataSize,<br />

OUT VOID<br />

*Buffer<br />

);<br />

Parameters<br />

This<br />

VariableName<br />

VendorGuid<br />

Attributes<br />

DataSize<br />

Buffer<br />

A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.<br />

A Null-terminated Unicode string that is the name of the vendor’s<br />

variable.<br />

A unique identifier for the vendor.<br />

If not NULL, a pointer to the memory location to return the attributes<br />

bit-mask for the variable. See “Related Definitions”.<br />

The size in bytes of the Buffer. A size of zero causes the variable<br />

to be deleted.<br />

The buffer to return the contents of the variable.<br />

Related Definitions<br />

//*********************************************************<br />

// Variable Attributes<br />

//*********************************************************<br />

#define EFI_VARIABLE_NON_VOLATILE<br />

0x0000000000000001<br />

#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002<br />

#define EFI_VARIABLE_RUNTIME_ACCESS<br />

0x0000000000000004<br />

Description<br />

Each vendor may create and manage its own variables with the risk of name conflicts by using a unique<br />

VendorGuid. When a variable is set its Attributes are supplied to indicate how the data variable<br />

should be stored and maintained by the system. Any attempts to access a variable that does not have<br />

the attribute set for runtime access will yield the EFI_NOT_FOUND error.<br />

Status Codes Returned<br />

73


Setup Design Guide<br />

DRAFT<br />

EFI_SUCCESS<br />

EFI_NOT_FOUND<br />

EFI_BUFFER_TOO_SMALL<br />

EFI_INVALID_PARAMETER<br />

EFI_DEVICE_ERROR<br />

The function completed successfully<br />

The variable was not found.<br />

The DataSize is too small for the result. DataSize has<br />

been updated with the size needed to complete the<br />

request.<br />

One of the parameters has an invalid value.<br />

The variable could not be saved due to a hardware failure.<br />

74


Setup Design Guide<br />

DRAFT<br />

7.3.2 EFI_FORM_CALLBACK_PROTOCOL.NvWrite()<br />

Summary<br />

Sets the value of a variable.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_NV_WRITE) (<br />

IN EFI_FORM_CALLBACK_PROTOCOL *This,<br />

IN CHAR16<br />

*VariableName,<br />

IN EFI_GUID<br />

*VendorGuid,<br />

OUT UINT32<br />

*Attributes OPTIONAL,<br />

IN OUT UINTN<br />

*DataSize,<br />

OUT VOID<br />

*Buffer<br />

);<br />

Parameters<br />

This<br />

VariableName<br />

VendorGuid<br />

A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.<br />

A Null-terminated Unicode string that is the name of the vendor’s<br />

variable. Each VariableName is unique for each VendorGuid.<br />

A unique identifier for the vendor.<br />

Attributes Attributes bitmask to set for the variable. See section 7.3.1<br />

DataSize<br />

Buffer<br />

Description<br />

The size in bytes of the Buffer. A size of zero causes the variable<br />

to be deleted.<br />

The buffer to return the contents of the variable.<br />

Variables are stored by the firmware and may maintain their values across power cycles. Each vendor<br />

may create and manage its own variables without the risk of name conflicts by using a unique<br />

VendorGuid.<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

EFI_OUT_OF_RESOURCES<br />

EFI_DEVICE_ERROR<br />

The firmware has successfully stored the variable and its<br />

data as defined by the Attributes.<br />

An invalid combination of Attribute bits was supplied, or<br />

the DataSize exceeds the maximum allowed.<br />

Not enough storage is available to hold the variable and its<br />

data.<br />

The variable could not be saved due to a hardware failure.<br />

75


Setup Design Guide<br />

DRAFT<br />

7.3.3 EFI_FORM_CALLBACK_PROTOCOL.CallBack()<br />

Summary<br />

This is the function that is called to provide results data to the driver. This data consists of a unique key<br />

which is used to identify what data is either being passed back or being asked for.<br />

Prototype<br />

EFI_STATUS<br />

(EFIAPI *EFI_FORM_CALLBACK) (<br />

IN EFI_FORM_CALLBACK_PROTOCOL *This,<br />

IN UINT16<br />

KeyValue,<br />

IN VOID<br />

*Data<br />

);<br />

Parameters<br />

This<br />

KeyValue<br />

Data<br />

A pointer to the EFI_NV_ACCESS_PROTOCOL instance.<br />

A unique value which is sent to the original exporting driver so that<br />

it can identify the type of data to expect. The format of the data<br />

tends to vary based on the op-code that generated the callback.<br />

A pointer to the data being sent to the original exporting driver.<br />

Related Definitions<br />

The Data format will be based on the op-code type that the KeyValue<br />

references.<br />

If OneOf op-code the following is being passed in the Data pointer:<br />

UINT16<br />

Value<br />

If Text op-code there is no user initiated data to be sent other<br />

than the KeyValue. There should be a reasonable expectation that a<br />

response to this callback will be that a message gets posted with a<br />

particular key value and string. This would be done in the<br />

EFI_FORM_CONFIGURATION_PROTOCOL.<br />

NULL<br />

If String op-code the following is being passed in the Data pointer:<br />

CHAR16<br />

*String<br />

If Numeric op-code the following is being passed in the Data<br />

pointer:<br />

UINT16<br />

Value<br />

76


Setup Design Guide<br />

DRAFT<br />

Status Codes Returned<br />

EFI_SUCCESS<br />

EFI_INVALID_PARAMETER<br />

EFI_OUT_OF_RESOURCES<br />

EFI_DEVICE_ERROR<br />

The firmware has successfully stored the variable and its<br />

data as defined by the Attributes.<br />

An invalid combination of Attribute bits was supplied, or<br />

the DataSize exceeds the maximum allowed.<br />

Not enough storage is available to hold the variable and its<br />

data.<br />

The variable could not be saved due to a hardware failure.<br />

77


Setup Design Guide<br />

DRAFT<br />

8<br />

Simple Input Modification<br />

Modifications have been made in the SIMPLE_INPUT protocol to support additional keys.<br />

8.1 Extending Simple Input<br />

The SIMPLE_INPUT protocol has some extensions that are being added. The following is a modified<br />

version of the Control Characters and EFI Scan Codes for the SIMPLE_INPUT protocol.<br />

The SIMPLE_INPUT protocol defines an input stream that contains Unicode characters and required<br />

EFI scan codes. Only the control characters defined in Table 3-1 have meaning in the Unicode input or<br />

output streams. The input stream does not support any software flow control.<br />

Table 3-1.<br />

Supported Unicode Control Characters<br />

Mnemonic Unicode Description<br />

Null U+0000 Null character ignored when received.<br />

BS U+0008 Backspace. Moves cursor left one column. If the cursor is at the left<br />

margin, no action is taken.<br />

TAB U+0x0009 Tab.<br />

LF U+000A Linefeed. Moves cursor to the next line.<br />

CR U+000D Carriage Return. Moves cursor to left margin of the current line.<br />

The input stream supports Scan Codes in addition to Unicode characters. If the Scan Code is set to<br />

0x00 then the Unicode character is valid and should be used. If the Scan Code is set to a non-0x00<br />

value it represents a special key as defined by Table 3-2.<br />

Table 3-2.<br />

EFI Scan Codes for SIMPLE_INPUT_INTERFACE<br />

EFI Scan Code<br />

0x0000<br />

0x0001<br />

0x0002<br />

0x0003<br />

0x0004<br />

0x0005<br />

0x0006<br />

0x0007<br />

0x0008<br />

0x0009<br />

0x000a<br />

Description<br />

Null scan code.<br />

Move cursor up 1 row.<br />

Move cursor down 1 row.<br />

Move cursor right 1 column.<br />

Move cursor left 1 column.<br />

Home.<br />

End.<br />

Insert.<br />

Delete.<br />

Page Up.<br />

Page Down.<br />

78


Setup Design Guide<br />

DRAFT<br />

Table 3-2. EFI Scan Codes for SIMPLE_INPUT_INTERFACE (continued)<br />

EFI Scan Code Description<br />

0x000b Function 1.<br />

0x000c Function 2.<br />

0x000d Function 3.<br />

0x000e Function 4.<br />

0x000f Function 5.<br />

0x0010 Function 6.<br />

0x0011 Function 7.<br />

0x0012 Function 8.<br />

0x0013 Function 9.<br />

0x0014 Function 10.<br />

0x0015 Function 11. (Newly Proposed)<br />

0x0016 Function 12. (Newly Proposed)<br />

0x0017 Escape.<br />

Table 3- 3 Additional EFI Scan Codes for SIMPLE_INPUT_INTERFACE<br />

0x2000 Shift. (Newly Proposed)<br />

0x4000 Control. (Newly Proposed)<br />

0x8000 Alternate. (Newly Proposed)<br />

The following example shows the new definitions for the EFI Scan Codes, and provides the facility to<br />

export varying modifier states on non-printing characters.<br />

#define SCAN_F11<br />

#define SCAN_F12<br />

0x0015<br />

0x0016<br />

//<br />

// Bit 13 on = Shift<br />

// Bit 14 on = Control<br />

// Bit 15 on = Alt<br />

//<br />

// This allows for interpretation of Shift F10 for<br />

// the scan code by seeing a scan code of 0x2014<br />

// As it allows a Shift-Alt-F10 yielding a scan code of 0xA014<br />

//<br />

// Additionally, a Shift-Tab would be interpreted by reading<br />

// the EFI Scan code as a 0x2000, and a Unicode value of 0x0009.<br />

//<br />

#define SCAN_SHIFT<br />

0x2000<br />

#define SCAN_CONTROL<br />

0x4000<br />

#define SCAN_ALT<br />

0x8000<br />

79


Setup Design Guide<br />

DRAFT<br />

9<br />

HII Keyboard Support<br />

9.1 Keyboard Mapping<br />

The keyboard mapping that is defined in EFI is loosely based on ISO 9995. The naming mechanism is<br />

illustrated in Figure 2. The keys that are highlighted in red are the keys that almost all keyboard layouts<br />

use for customizations. That does not necessarily mean that all the keys are different. In fact, most of<br />

the keys are likely to be the same, however when modifying the mapping one can normally reference<br />

the keys in red as the likely candidates to create modifications for.<br />

Instead of referencing keys in hardware specific ways such as scan codes or HID entries, EFI now<br />

defines an EFI_KEY enumeration that allows for a simple way to reference this hardware abstraction.<br />

It also provides a way to update the keyboard layout with a great deal of flexibility. Any of the keys<br />

can be mapped to any Unicode value or control code value.<br />

Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12<br />

Print SLck<br />

Pause<br />

E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12<br />

Backspace<br />

Ins<br />

Home PgUp<br />

NLck / *<br />

-<br />

Tab D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13*<br />

CapsLock C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12* Enter<br />

Del End PgDn<br />

7 8 9<br />

4 5 6<br />

+<br />

LShift B0* B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 RShift<br />

LCtrl A0 LAlt Space Bar A2 A3 A4 RCtrl<br />

1 2 3<br />

0 .<br />

Enter<br />

Figure 2<br />

When defining the values for a particular key, there are five elements that are pertinent to the key.<br />

Key Name:<br />

Unicode Value:<br />

The EFI_KEY enumeration (see Figure 1) defines the names of the above<br />

keys.<br />

This defines the Unicode value (if any) of the named key.<br />

Shifted Unicode Value: This defines the Unicode value (if any) of the named key while the shift<br />

modifier key is being pressed<br />

Alt-GR Unicode Value: This defines the Unicode value (if any) of the named key while the<br />

modifier key (if any) is being pressed.<br />

Alt-GR<br />

Shifted Alt-GR Unicode Value: This defines the Unicode value (if any) of the named key while the<br />

Shift and Alt-GR modifier key (if any) is being pressed.<br />

80


Setup Design Guide<br />

DRAFT<br />

Modifier Key Value:<br />

This defines the non-printable special function this key has assigned to it.<br />

Under normal circumstances, a key that has any Unicode definitions generally has a Control key value<br />

of SCAN_NULL. This means the key has no special function other than the printing of a character. If<br />

any of the Unicode values have a value of 0xFFFF this is the exception to the rule. Though rarely used,<br />

this is the one case which a key might have both a printable character and an active Control key value.<br />

An example of this would be the numeric keypad’s insert key. The definition for this key on a standard<br />

US keyboard is as follows:<br />

Key Name = ZERO_KEY<br />

Unicode Value = 0x0030 (basically a ‘0’)<br />

Shifted Unicode Value = 0xFFFF (the exception to the rule)<br />

Alt-GR Unicode Value = 0x0000<br />

Shifted Alt-GR Unicode Value = 0x0000<br />

Modifier Key Value = SCAN_INSERT<br />

This is one of the few keys that under normal circumstances prints something out, but also has a special<br />

function. These are generally limited to the numeric keypad, however this does not prevent someone<br />

from having the flexibility to define these types of variations.<br />

(Assuming for the implementation that the state of CapsLock and NumLock, etc will correctly handle<br />

the shift states since they do it already……just wanted to mention it and it was thought about)<br />

9.2 Modifier Key Definitions<br />

Modifier keys are defined to allow for special functionality that is not necessarily accomplished by a<br />

printable character. Many of these modifier keys are flags to toggle certain state bits on and off inside<br />

of a keyboard driver. An example is CAPS_LOCK_MODIFIER. This state being active could alter<br />

what the typing of a particular key produces. Other control keys affect the position of the cursor like<br />

LEFT_ARROW_MODIFIER, END_MODIFIER, etc. One modifier key is likely unfamiliar to most<br />

people who exclusively use US keyboards, and that key is the ALT_GR_MODIFIER key. This key’s<br />

primary purpose is to activate a secondary type of shift modifier that exposes additional printable<br />

characters on certain keys. In some keyboard layouts this key does not exist and is normally the<br />

RIGHT_ALT_MODIFIER key. None of the other modifier key functions should be a mystery to<br />

someone familiar with the usage of a standard computer keyboard.<br />

An example of a few descriptor entries would be as follows:<br />

Layout = {<br />

EfiKeyLCtrl,0,0,0,0,LEFT_CONTROL_MODIFIER, //(Left control key)<br />

EfiKeyA0,0,0,0,0,NULL_MODIFIER,<br />

//(Not defined windows key)<br />

EfiKeySpaceBar,0x0020,0x0020,0x0020,0x0020,NULL_MODIFIER //(Space Bar)<br />

}<br />

//<br />

// Define the Control modifier value information<br />

81


Setup Design Guide<br />

DRAFT<br />

//<br />

#define NULL_MODIFIER<br />

#define LEFT_CONTROL_MODIFIER<br />

#define RIGHT_CONTROL_MODIFIER<br />

#define LEFT_ALT_MODIFIER<br />

#define RIGHT_ALT_MODIFIER<br />

#define ALT_GR_MODIFIER<br />

#define INSERT_MODIFIER<br />

#define DELETE_MODIFIER<br />

#define PAGE_DOWN_MODIFIER<br />

#define PAGE_UP_MODIFIER<br />

#define HOME_MODIFIER<br />

#define END_MODIFIER<br />

#define LEFT_SHIFT_MODIFIER<br />

#define RIGHT_SHIFT_MODIFIER<br />

#define CAPS_LOCK_MODIFIER<br />

#define SHIFT_LOCK_MODIFIER<br />

#define NUM_LOCK _MODIFIER<br />

#define LEFT_ARROW_MODIFIER<br />

#define RIGHT_ARROW_MODIFIER<br />

#define DOWN_ARROW_MODIFIER<br />

#define UP_ARROW_MODIFIER<br />

0x0000<br />

0x0001<br />

0x0002<br />

0x0003<br />

0x0004<br />

0x0005<br />

0x0006<br />

0x0007<br />

0x0008<br />

0x0009<br />

0x000A<br />

0x000B<br />

0x000C<br />

0x000D<br />

0x000E<br />

0x000F<br />

0x0010<br />

0x0011<br />

0x0012<br />

0x0013<br />

0X0014<br />

//<br />

// For further explanations on Dead Keys see section 9.4<br />

//<br />

#define DEAD_KEY_MODIFIER<br />

0x0015<br />

#define DEAD_KEY_DEPENDENCY_MODIFIER 0x0016<br />

#define FUNCTION_KEY_ONE_MODIFIER 0x0017<br />

#define FUNCTION_KEY_TWO_MODIFIER 0x0018<br />

#define FUNCTION_KEY_THREE_MODIFIER 0x0019<br />

#define FUNCTION_KEY_FOUR_MODIFIER 0x001A<br />

#define FUNCTION_KEY_FIVE_MODIFIER 0x001B<br />

#define FUNCTION_KEY_SIX_MODIFIER 0x001C<br />

#define FUNCTION_KEY_SEVEN_MODIFIER 0x001D<br />

#define FUNCTION_KEY_EIGHT_MODIFIER 0x001E<br />

#define FUNCTION_KEY_NINE_MODIFIER 0x001F<br />

#define FUNCTION_KEY_TEN_MODIFIER 0x0020<br />

#define FUNCTION_KEY_ELEVEN_MODIFIER 0x0021<br />

#define FUNCTION_KEY_TWELVE_MODIFIER 0x0022<br />

//<br />

// Keys which have multiple Control functions based on modifier<br />

// settings are handled in the keyboard driver implementation.<br />

// For instance PRINT_KEY might have a modifier held down and<br />

// is still a non-printing character, but might have an alternate<br />

82


Setup Design Guide<br />

DRAFT<br />

// control function like SYSREQUEST<br />

//<br />

#define PRINT_MODIFIER<br />

#define SYS_REQUEST_MODIFIER<br />

#define SCROLL_LOCK_MODIFIER<br />

#define PAUSE_MODIFIER<br />

#define BREAK_MODIFIER<br />

0x0023<br />

0x0024<br />

0x0025<br />

0x0026<br />

0x0027<br />

9.3 Keyboard Layout Switching<br />

The need for switching from one keyboard layout to another is a very common implementation. A<br />

typical example would be for a user who needed to type in a language that did not have certain keys<br />

exposed (e.g. Typical Hebrew layout has no Latin characters). For these types of configurations, it<br />

would be common for the system to be aware of two completely different keyboard layouts and allow a<br />

hot key to switch between the default and the alternate layout.<br />

The way this would work in our given implementation would be that the firmware has some built-in<br />

keyboard layout. A driver installs the Hebrew layout. The user needs to switch modes and hits a hot<br />

key that forces the keyboard driver to switch from the Hebrew layout to the firmware’s Default layout.<br />

Hit the hot key again and the user mode switches again and the keyboard driver is now pointing to the<br />

Hebrew layout.<br />

//<br />

// To enable the ability to define what key combinations<br />

// designate a special function one could do some of the<br />

// following to allow for this flexibility.<br />

//<br />

//<br />

// This assumes that the driver implementation will not<br />

// assign a key definition if one of the following modifier<br />

// values is presented.<br />

//<br />

#define LAYOUT_SWITCH_MODIFIER<br />

0x0028<br />

#define LAYOUT_SWITCH_DEPENDENCY_MODIFIER 0x0029<br />

Layout = {<br />

EfiKeyLCtrl, 0, 0, 0, 0, LAYOUT_SWITCH_MODIFIER,<br />

EfiKeyLShift, 0, 0, 0, 0, LAYOUT_SWITCH_DEPENDENCY_MODIFIER<br />

}<br />

9.4 Dead Keys<br />

Dead keys are a concept that provides the ability to OR together an accent key and another printable<br />

character. Dead keys would be defined as a special type of Modifier character. They are typically<br />

83


Setup Design Guide<br />

DRAFT<br />

accent keys that do not advance the cursor and in essence are a type of modifier key in that they<br />

maintain some level of state.<br />

The way a person uses a dead key is that the dead key that maybe has the function of overlaying an<br />

umlaut (two dots) onto whatever the next character might be. The user presses the umlaut dead key and<br />

follows it with a capital A. This yields a “Ä”<br />

//<br />

// If it’s a dead key, we need to pass a list of physical key<br />

// names… each with a unicode, shifted, altgr, shiftedaltgr<br />

// value. Each key name will have a Modifier value of<br />

// DEAD_KEY_MODIFIER for first entry, and then the list of<br />

// DEAD_KEY_DEPENDENCY_MODIFIER physical key descriptions.<br />

// This eventually will lead to the next normal non-dead-key<br />

// definition.<br />

//<br />

// This requires defining an additional Modifier value of<br />

// DEAD_KEY_DEPENDENCY_MODIFIER to signify DEAD_KEY_MODIFIER<br />

// children definitions.<br />

//<br />

// The keyboard driver (consumer of the layouts) will know that<br />

// any key definitions with the DEAD_KEY_DEPENDENCY_MODIFIER<br />

// modifier do not redefine the value of the specified EFI_KEY.<br />

// They are simply used as a special case augmentation to the<br />

// original DEAD_KEY_MODIFIER.<br />

//<br />

// It is an error condition to define a DEAD_KEY_MODIFIER<br />

// without having all the DEAD_KEY_DEPENDENCY_MODIFIER<br />

// keys defined serially.<br />

//<br />

Layout = {<br />

EfiKeyE0, 0, 0, 0, 0, DEAD_KEY_MODIFIER,<br />

EfiKeyC1, 0x00E2, 0x00C2, 0, 0, DEAD_KEY_DEPENDENCY_MODIFIER,<br />

EfiKeyD3, 0x00EA, 0x00CA, 0, 0, DEAD_KEY_DEPENDENCY_MODIFIER,<br />

EfiKeyD8, 0x00EC, 0x00CC, 0, 0, DEAD_KEY_DEPENDENCY_MODIFIER,<br />

EfiKeyD9, 0x00F4, 0x00D4, 0, 0, DEAD_KEY_DEPENDENCY_MODIFIER,<br />

EfiKeyD7, 0x00FB, 0x00CB, 0, 0, DEAD_KEY_DEPENDENCY_MODIFIER,<br />

}<br />

In the above example, a key located at E0 is designated as a Dead Key. Using a common German<br />

keyboard layout as the example, at the E0 location a circumflex accent “^” is defined as a dead key.<br />

The valid keys that can be pressed after the dead key which will produce valid printable characters are<br />

the A, E, I, O, and U characters. These are located at C1, D3, D8, D9, and D7 respectively.<br />

The results of the Layout definition provided above would allow for the production of the following<br />

characters: âÂêÊîÎôÔûÛ.<br />

84


Setup Design Guide<br />

DRAFT<br />

9.4.1 Bi-directional Input (Reserved for future implementation)<br />

Many languages have left-to-right orientation, however some use right-to-left orientation for keyboard<br />

input. This requires the ability to handle both types of input. There are several issues to deal with<br />

when it comes to bi-directional input.<br />

There are some issues when it comes to the ability to type things in one orientation and in the middle of<br />

a set of words change directionality. This is common when typing in a right-to-left oriented language<br />

such as Hebrew and a word only makes sense to be typed in a non-right-to-left language.<br />

For instance, to type, “I love Intel too” one might type in Hebrew, גמ כן"‏ Intel אחוב ‏."אני To provide the<br />

ability to do switch orientation like this one needs to focus on some of the elements of bi-directional<br />

typing.<br />

9.4.1.1 Bi-directional segments<br />

Bi-directional text may consist of a main part that has one orientation (e.g. Hebrew text written from<br />

right-to-left), and portions that have opposite orientation (e.g. English text written left-to-right). The<br />

portion of text with different orientation is called a segment. Bi-directional text may have a body of<br />

right-to-left text with embedded left-to-right segments.<br />

There are two methods which support global orientation switching. One method requires manual<br />

intervention to switch between right-to-left and left-to-right, and the other automatically handles rightto-left<br />

orientation for characters that require them (e.g. Hebrew, Arabic, etc) and switch modes<br />

automatically for characters that require left-to-right handling (e.g. Arabic Numbers, English letters,<br />

etc.)<br />

For the EFI implementation, we will only support a manual method of orientation switching.<br />

9.4.1.2 Orientation Hot Keys<br />

For the EFI implementation, a hot key would be created to enable switching of keyboard orientation.<br />

When switching orientation this is called going into “Push” mode.<br />

The switching of orientation modes affects input direction. However we need to give some thought to<br />

the saving of text information in such a way as to allow for the appropriate readability when loaded in<br />

at a later time. One proposal might be that when typing from right to left, the data being saved is<br />

orientation agnostic. Meaning, that if I typed one through 4 and it displayed “4321” when that<br />

information is saved or redirected to a file it is stored as it is typed, not as it was displayed.<br />

The ability to switch orientations should be an easy task that allows for the minimum of effort. A<br />

simple two-key combination of two untranslatable keys would be the appropriate methodology. The<br />

suggested hot key combination would be holding down the EfiKeyRCtrl and the EfiKeyRShift<br />

to enable the orientation toggle.<br />

9.4.1.2.1 Push Mode<br />

When the orientation hot key is pressed the user enters push mode. Push mode is a keyboard input<br />

mode in which characters are “pushed” in the direction opposite to the base direction of the segment.<br />

The cursor does not move. When the orientation hot key is pressed again, the user enters into the<br />

previous bi-directional mode.<br />

אחוב“‏ was typed the user would have typed ‏”אני אחוב Intel גמ כן“‏ An example of this is when the phrase<br />

then they would have pressed the orientation hot key to enable push mode. This would have ‏”אני<br />

85


Setup Design Guide<br />

DRAFT<br />

proceeded to “push” the characters already typed to the right keeping the cursor in the same relative<br />

position to the originally typed phrase. The user would then press the orientation hot key again to<br />

enable left-to-right mode and then type Intel. This would yield the “Intel אחוב ‏”אני with the cursor<br />

between the word “Intel” and the phrase אחוב“‏ ‏.”אני The user would then press the orientation hot key<br />

again to switch off the push mode and likely hit the END key to go to the end of the line (in right-to-left<br />

‏.”אני אחוב Intel גמ כן“‏ orientation) and proceed to complete typing the complete phrase of<br />

86

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!