Intel Extensible Firmware Interface manual

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494

Go to page of

A good user manual

The rules should oblige the seller to give the purchaser an operating instrucion of Intel Extensible Firmware Interface, along with an item. The lack of an instruction or false information given to customer shall constitute grounds to apply for a complaint because of nonconformity of goods with the contract. In accordance with the law, a customer can receive an instruction in non-paper form; lately graphic and electronic forms of the manuals, as well as instructional videos have been majorly used. A necessary precondition for this is the unmistakable, legible character of an instruction.

What is an instruction?

The term originates from the Latin word „instructio”, which means organizing. Therefore, in an instruction of Intel Extensible Firmware Interface one could find a process description. An instruction's purpose is to teach, to ease the start-up and an item's use or performance of certain activities. An instruction is a compilation of information about an item/a service, it is a clue.

Unfortunately, only a few customers devote their time to read an instruction of Intel Extensible Firmware Interface. A good user manual introduces us to a number of additional functionalities of the purchased item, and also helps us to avoid the formation of most of the defects.

What should a perfect user manual contain?

First and foremost, an user manual of Intel Extensible Firmware Interface should contain:
- informations concerning technical data of Intel Extensible Firmware Interface
- name of the manufacturer and a year of construction of the Intel Extensible Firmware Interface item
- rules of operation, control and maintenance of the Intel Extensible Firmware Interface item
- safety signs and mark certificates which confirm compatibility with appropriate standards

Why don't we read the manuals?

Usually it results from the lack of time and certainty about functionalities of purchased items. Unfortunately, networking and start-up of Intel Extensible Firmware Interface alone are not enough. An instruction contains a number of clues concerning respective functionalities, safety rules, maintenance methods (what means should be used), eventual defects of Intel Extensible Firmware Interface, and methods of problem resolution. Eventually, when one still can't find the answer to his problems, he will be directed to the Intel service. Lately animated manuals and instructional videos are quite popular among customers. These kinds of user manuals are effective; they assure that a customer will familiarize himself with the whole material, and won't skip complicated, technical information of Intel Extensible Firmware Interface.

Why one should read the manuals?

It is mostly in the manuals where we will find the details concerning construction and possibility of the Intel Extensible Firmware Interface item, and its use of respective accessory, as well as information concerning all the functions and facilities.

After a successful purchase of an item one should find a moment and get to know with every part of an instruction. Currently the manuals are carefully prearranged and translated, so they could be fully understood by its users. The manuals will serve as an informational aid.

Table of contents for the manual

  • Page 1

    Extensible Firmware Interface Specification Version 1.02 December 12, 2000[...]

  • Page 2

    Extensible Firmwar e Interface Specifi cation ii 12/12/00 Version 1.02 THIS S PECIFIC ATION IS PR OVIDED "AS IS" W ITH NO WARR ANTIES WH ATSOE VER, INC LUDIN G AN Y WAR RANT Y OF MERCHANTABI LITY, FITNES S FOR ANY PART ICULAR PURPOSE, OR ANY WA RRANTY OTHERWI SE ARISING OUT OF ANY PROPO SAL, SPECIF ICAT ION OR SAM PLE. A license is hereby[...]

  • Page 3

    Version 1.02 12/12/00 iii Revision History Revision Revision Histor y Date 1.01 Original Is sue. 12/01/00 1.02 Update for l egal and tra demarking r equirements . 12/12/00[...]

  • Page 4

    Extensible Firmwar e Interface Specifi cation iv 12/12/00 Version 1.02[...]

  • Page 5

    Version 1.02 12/12/00 v T able of Content s 1 Introduction 1.1 Overview .................................................................................................... 2 1.2 Goals ......................................................................................................... 3 1.3 Target Audience .....................................[...]

  • Page 6

    Extensible Firmwar e Interface Specifi cation vi 12/12/00 Version 1.02 3 Services 3.1 Event, Timer, and Task Priority Services ................................................. 26 3.1.1 CreateEvent() .................................................................................. 29 3.1.2 CloseEvent() .............................................[...]

  • Page 7

    Contents Version 1.02 12/12/00 vii 3.5 Variable Services ..................................................................................... 77 3.5.1 GetVariable() ................................................................................... 78 3.5.2 GetNextVariableN ame() .................................................................. 8[...]

  • Page 8

    Extensible Firmwar e Interface Specifi cation viii 12/12/00 Version 1.02 5.3 Device Path Nodes ................................................................................ 119 5.3.1 Generic Device Pa th Structures .................................................... 119 5.3.2 Hardware Device Pat h ...............................................[...]

  • Page 9

    Contents Version 1.02 12/12/00 ix 5.4.4 Hardware vs. Messagin g Device Path Rules ................................. 135 5.4.5 Media Device Pat h Rules .............................................................. 136 5.4.6 Other Rules ................................................................................... 136 6 Device I/O Proto col 6.1[...]

  • Page 10

    Extensible Firmwar e Interface Specifi cation x 12/12/00 Version 1.02 8 Block I/O Protocol 8.1 BLOCK_IO Protocol............................................................................... 173 8.1.1 EFI_BLOCK_IO.Rese t() ................................................................ 176 8.1.2 EFI_BLOCK_IO.Rea dBlocks() ........................[...]

  • Page 11

    Contents Version 1.02 12/12/00 xi 12 Serial I/O Proto col 12.1 SERIAL_IO Protocol .............................................................................. 213 12.1.1 SERIAL_IO.Reset() ....................................................................... 217 12.1.2 SERIAL_IO.SetA ttributes() ..................................................[...]

  • Page 12

    Extensible Firmwar e Interface Specifi cation xii 12/12/00 Version 1.02 15 Simple Net work Protocol 15.1 EFI_SIMPLE_NETWORK Protoc ol........................................................ 277 15.1.1 EFI_SIMP LE_NETWORK.Start() ..................................................... 282 15.1.2 EF I_SIMPLE_NETWORK.Sto p() ............................[...]

  • Page 13

    Contents Version 1.02 12/12/00 xiii 17 Boot Manager 17.1 Firmwar e Boot Manager ........................................................................ 319 17.2 Globally-Defined Variables .................................................................... 323 17.3 Boot Option V ariables Defa ult Behavi or .........................................[...]

  • Page 14

    Extensible Firmwar e Interface Specifi cation xiv 12/12/ 00 Version 1.02 G 32/64-Bit UNDI Sp ecification G.1 Introduction ............................................................................................ 373 G.1.1 Definitions ...................................................................................... 373 G.1.2 Referenced Speci[...]

  • Page 15

    Contents Version 1.02 12/12/00 xv G.4.18 Transmit......................................................................................... 460 G.4.19 Receive.......................................................................................... 464 G.5 UNDI as an EFI Runtime Driver ............................................................. 46[...]

  • Page 16

    Extensible Firmwar e Interface Specifi cation xvi 12/12/ 00 Version 1.02 3-3. TPL Usage ............................................................................................... 27 3-5. TPL Restrictions ...................................................................................... 28 3-7. Memory Allocation Functions...................[...]

  • Page 17

    Contents Version 1.02 12/12/00 xvii 5-25. CD-ROM Media Device Path ................................................................. 131 5-26. Vendor-Defined Medi a Device Pat h....................................................... 131 5-27. File Path Media D evice Path ................................................................. 132 5-28. Me[...]

  • Page 18

    Extensible Firmwar e Interface Specifi cation xviii 12/12/00 Version 1.02 D-1. EFI_STATUS Codes Ranges ................................................................ 345 D-2. EFI_STATUS Succ ess Codes (High bit clear) ....................................... 345 D-3. EFI_STATUS Err or Codes (High bit set) ..........................................[...]

  • Page 19

    Version 1.02 12/12/00 1 1 Introduction This Extensib le Firm ware In terface (h ereafter known as EFI) Speci fication d escribes an interf ace between th e operating system (OS ) and the pl atform f irmware. Th e interfa ce is in th e for m of data tables tha t contain p latform-r elated infor mation, and boot and runt ime serv ice ca lls that a re[...]

  • Page 20

    Extensible Firmware Interface Specifi cation 2 12/12/00 Version 1.02 1.1 Overview This specif icatio n is organiz ed as fol lows: Table 1-1. Organization of EFI Spec ification Chapter/Appendix Description 1. Introduction Provides an ov erview of th e EFI Specific ation. 2. Overv iew Describes the major com ponents of E FI, includi ng the boot m ana[...]

  • Page 21

    Introduction Version 1.02 12/12/00 3 Table 1-1. Organization of EFI Spec ification (cont inued) Chapter/Appendix Description 15. Sim ple Network Protoc ol Defines the Sim ple Network Protocol, whic h provides a packet lev el interface to a network dev ice. Also defin es the Network Interfac e Identifier Pr otocol, whic h is an op tional pr otocol u[...]

  • Page 22

    Extensible Firmware Interface Specifi cation 4 12/12/00 Version 1.02 • Abstract ion of the OS from t he firmw are . The sp ecification defines in terfa ces to pla tform capabilit ies. Thro ugh the use o f abstrac t interfa ces, th e specific ation al lows the OS loade r to be constructed w ith far less knowledge of the platfo rm and firmware tha [...]

  • Page 23

    Introduction Version 1.02 12/12/00 5 • Compatibil ity by des ign . The de sign of the system pa rtition stru ctures also p reserves a ll the structu res that are curren tly used in the “ PC-AT ” boot envi ronment. Thu s it is a simple matter to construc t a single system th at is capab le of boot ing a legacy OS o r an EFI-aw are OS from the [...]

  • Page 24

    Extensible Firmware Interface Specifi cation 6 12/12/00 Version 1.02 1.4 Related In formatio n The follow ing publica tions an d sources of informati on may be use ful to you o r are refe rred to by this spec ific atio n: • ACPI Implementers’ Guide , Intel Corpor ation, Mic rosoft Corp oratio n, Toshiba Corpo ration, version 0.5, 1998 , http://[...]

  • Page 25

    Introduction Version 1.02 12/12/00 7 • Microso ft Extensible Fi rmware Initia tive FAT32 File Sy stem Specif ication , Versi on 1.03, Microsoft Corporation , December 6, 2000 • OSTA U niversa l Disk Form at Speci fication , Revis ion 2.00, Optical S torage Technology Association, 1 998, http:/ /www2.osta.o rg/osta/h tml/os tatech.html# udf • [...]

  • Page 26

    Extensible Firmware Interface Specifi cation 8 12/12/00 Version 1.02 1.5 Prerequisite Spec ifications In genera l, this sp ecification requir es that fu nctional ity defined in a numbe r of other ex isting specifica tions be present on a syste m that imp lements th is speci fication. Th is spe cificat ion require s that those s pecif ications b e i[...]

  • Page 27

    Introduction Version 1.02 12/12/00 9 1.5.3 Additional Consider ations for Ita nium ™ -based Plat forms Any infor mation or s ervic e that is a vailab le via It anium-ba sed firmw are arch itectu re speci fications supercedes an y require ment in the comm on IA-32 an d Itanium -based spec ificat ions liste d above. The It aniu m-bas ed fir mwar e [...]

  • Page 28

    Extensible Firmware Interface Specifi cation 10 12/12/00 Version 1.02 Figure 1-1 shows the princ ipal compon ents of EFI a nd their r elationsh ip to platform hardware and OS softw are. EFI BOOT SER VIC ES EFI RUNTIM E SERVI CES EFI OS LOAD ER OPER ATING SYSTEM INTE RFACES FROM OTHER REQUI RED SPECS ACPI SMBIOS [OTH ER] PLA TFORM HARDW A RE EFI OS [...]

  • Page 29

    Introduction Version 1.02 12/12/00 11 1.7 Migrati on Require ments Migration requir ements cove r the tr ansition p eriod from i nitia l imple menta tion of thi s spec ification to a futu re time wh en all pla tforms an d operating systems impleme nt to this specific ation. Duri ng this period, two major comp atib ility cons ideratio ns are imp ort[...]

  • Page 30

    Extensible Firmware Interface Specifi cation 12 12/12/00 Version 1.02 1.8 Conventions Used in Thi s Document This docu ment uses typogra phic an d illust rative conv entions des cribed belo w. 1.8.1 Data Structure Desc riptions The Intel ar chitectu re proces sors of t he IA-32 family a re “ little endia n ” machin es. This means that the low-o[...]

  • Page 31

    Version 1.02 12/12/00 13 2 Overview EFI allows the extension o f platform firmware b y loadin g EFI driver an d EFI app lication images. When EFI drive rs and EFI app lications are lo aded they hav e access to all EFI d efined runti me and boot service s. See Fig ure 2-1. Figure 2-1. Booting Sequence EFI allows the consolidat ion of boot menus f ro[...]

  • Page 32

    Extensible Firmware Interface Specifi cation 14 12/12/00 Version 1.02 2.1 Boot Manager EFI contains a boot manager that allows the loading of EFI app lications ( including OS 1s t stage loader) or EF I drive rs from a ny file on a n EFI defined file sys tem or th rough the use o f an EFI defined im age loading servic e. EFI defines NVRAM va riable [...]

  • Page 33

    Overview Version 1.02 12/12/00 15 Interface s added by this spec ification are divid ed into the follow ing categ ories and a re deta iled lat er in this document: • Runtime ser vices • Boot serv ices in terfaces, w ith the follow ing sub-c ategorie s:  Global boot se rvice int erfaces  Device hand le-based boo t serv ice inter faces  [...]

  • Page 34

    Extensible Firmware Interface Specifi cation 16 12/12/00 Version 1.02 2.3 Calling Conventions Unless oth erwise sta ted, all func tions de fined in th e EFI spec ificat ion are cal led through p ointer s in common, arc hitectural ly defined, cal ling conv entions fo und in C compi lers. Poin ters to th e various global EFI fun ctions are found in t[...]

  • Page 35

    Overview Version 1.02 12/12/00 17 Table 2-2. Common EFI Data Types (cont inued) Mnemonic Description UINT64 8 byte unsi gned value. CHAR8 1 byte Char acter. CHAR16 2 byte Char acter. Unles s otherwise spec ified all s trings are s tored i n the UTF-16 encoding format as defined by Unicode 2 .1 and ISO/IEC 1 0646 stand ards. VOID Undeclared type. EF[...]

  • Page 36

    Extensible Firmware Interface Specifi cation 18 12/12/00 Version 1.02 2.3.2 IA-32 Platforms All function s are cal led with the C lang uage cal ling conventio n. The genera l-purpos e registers that are vola tile acro ss functi on calls a re eax , ec x , and edx . All other gen eral-purp ose reg isters are non - volatile and a re preserve d by the [...]

  • Page 37

    Overview Version 1.02 12/12/00 19 The EFI Image may invok e both SAL and EFI p rocedures. On ce in virtu al mode, th e EFI OS must switch back to physica l mode to c all any boo t services. If SetVirtualAddressMap() has been used, then runtime serv ice calls are made in vir tual mode. Refer to the IA-64 Sys tem Abstract ion Layer Spe cificat ion fo[...]

  • Page 38

    Extensible Firmware Interface Specifi cation 20 12/12/00 Version 1.02 The follow ing C code fragm ent illustrate s the us e of protoco ls: // There is a global “EffectsDevice” structure. This // structure contains information pertinent to the device. // Connect to the ILLUSTRATION_PROTOCOL on the EffectsDevice, // by calling HandleProtocol with[...]

  • Page 39

    Overview Version 1.02 12/12/00 21 2.5 Requirements This docu ment is an a rchitect ural spec ificatio n. As such, car e has been tak en to spe cify architect ure in way s that al low maximu m flexib ility in imple mentati on. However, th ere are c ertain require ments on which e lements o f this specific ation mus t be implem ented to ensu re that [...]

  • Page 40

    Extensible Firmware Interface Specifi cation 22 12/12/00 Version 1.02 Table 2-5. Required EFI Implementation Elements (continu ed) Element Description SIMPLE_INPUT protoc ol Protoc ol interfac es for devic es that support s imple c onsole sty le text input. SIMPLE_TEXT_OUTPU T protocol Protocol interf aces for devic es that s upport cons ole style [...]

  • Page 41

    Overview Version 1.02 12/12/00 23 2.5.3 Appendixes The conten t of Append ixes B, C, D, E of this sp ecifica tion is la rgely int ended as info rmation al. In other word s, semant ic inform ation cont ained in th ese sec tions need no t be cons idered par t of the formal de finition o f either requir ed or option al ele ments of the spec ification.[...]

  • Page 42

    Extensible Firmware Interface Specifi cation 24 12/01/00 Version 1.02[...]

  • Page 43

    Version 1.02 12/12/00 25 3 Services This chap ter discus ses the fund amental s ervic es that are present in an EFI-co mplian t system. Th e service s are defined by inter face func tions that may be used b y code run ning in the EFI environmen t. Such cod e may inclu de proto cols that manage devi ce access o r extend platform capability , as well[...]

  • Page 44

    Extensible Firmware Interface Specifi cation 26 12/12/00 Version 1.02 The rest o f this chap ter discu sses in dividual f unction s. Global boo t services functions fall int o these catego ries : • Event, Timer, and Task Prio rity Servi ces (Sect ion 3.1) • Memory A llocat ion Serv ices (Sec tion 3.2) • Protocol H andler S ervices (S ection 3[...]

  • Page 45

    Services Version 1.02 12/12/00 27 Execution in the boot ser vices e nvironmen t occurs at differen t task prior ity lev els, or TPLs. The boot serv ices envi ronment expo ses only th ree of these leve ls to EFI applications and driv ers: • TPL_APPLICATION , the lowest pr iority l evel • TPL_CALLBACK , an inte rmedia te prior ity lev el • TPL_[...]

  • Page 46

    Extensible Firmware Interface Specifi cation 28 12/12/00 Version 1.02 Table 3-2 . TPL Usag e (cont inued) Task Priority Le vel Usage (Firmware Int errupts) This level is internal to t he firmw are. It is the level at whic h internal interrupts occur. Code ru nning at this level in terrupts c ode running at the TPL_NOTIFY level (or lower levels). If[...]

  • Page 47

    Services Version 1.02 12/12/00 29 3.1.1 CreateEvent() Summary Creates a n event. Prototype EFI_STATUS CreateEvent ( IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID * NotifyContext, OUT EFI_EVENT *Event ); Parameters Type The type of event to c reate an d its mode and attr ibutes. The “ #define ” stat ements in [...]

  • Page 48

    Extensible Firmware Interface Specifi cation 30 12/12/00 Version 1.02 Related Definitions //******************************************************* // EFI_EVENT //******************************************************* typedef VOID *EFI_EVENT //******************************************************* // Event Types //********************************[...]

  • Page 49

    Services Version 1.02 12/12/00 31 EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE The event is to be n otified by th e syste m when SetVirtualAddressMap() is perfo rmed. This type can not b e used with any o ther EVT bit type. Se e the d iscussion of EVT_RUNTIME . //******************************************************* // EFI_EVENT_NOTIFY //*******************[...]

  • Page 50

    Extensible Firmware Interface Specifi cation 32 12/12/00 Version 1.02 can ’ t clean up on behalf o f driv ers that h ave been loaded into the syste m. The driver s have to do that them selves by creating a n event w hose type is EVT_SIGNAL_EXIT_BOOT_SERVICES and whose notifi cation func tion is a function wit hin the dr iver itself. Then, when Ex[...]

  • Page 51

    Services Version 1.02 12/12/00 33 3.1.2 CloseEvent() Summary Closes an even t. Prototype EFI_STATUS CloseEvent ( IN EFI_EVENT Event ); Parameters Event The event to close. Type EFI_EVENT is d efined in Sec tion 3.1.1. Description The CloseEvent() function r emoves the calle r ’ s referen ce to th e event and c loses it. Once the event is clo sed,[...]

  • Page 52

    Extensible Firmware Interface Specifi cation 34 12/12/00 Version 1.02 3.1.3 SignalEvent() Summary Signals an event. Prototype EFI_STATUS SignalEvent ( IN EFI_EVENT Event ); Parameters Event The event to signal. Type EFI_EVENT i s defin ed in Sectio n 3.1.1. Description The supplied Event i s signaled and, if the event ha s a signal n otifica tion f[...]

  • Page 53

    Services Version 1.02 12/12/00 35 3.1.4 WaitForEvent() Summary Stops execut ion until an event i s signaled. Prototype EFI_STATUS WaitForEvent ( IN UINTN NumberOfEvents, IN EFI_EVENT *Event, OUT UINTN *Index ); Parameters NumberOfEvents The number of events in the Event array. Event An array of EFI_EVENT . Type EFI_EVENT is d efined in Section 3.1.[...]

  • Page 54

    Extensible Firmware Interface Specifi cation 36 12/12/00 Version 1.02 3.1.5 CheckEvent() Summary Checks whe ther an even t is in the signa led state. Prototype EFI_STATUS CheckEvent ( IN EFI_EVENT Event ); Parameters Event The event to check. Type EFI_EVENT i s defined in Section 3.1.1. Description The CheckEvent() func tio n c hecks to see whet he[...]

  • Page 55

    Services Version 1.02 12/12/00 37 3.1.6 SetTimer() Summary Sets the type of ti mer and the trigg er time for a t imer even t. Prototype EFI_STATUS SetTimer ( IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime ); Parameters Event The timer e vent th at is to be signaled a t the sp ecified time. Type EFI_EVENT is defined in Section 3.[...]

  • Page 56

    Extensible Firmware Interface Specifi cation 38 12/12/00 Version 1.02 Description The SetTimer() function c ancels any p revious time trigg er setti ng for the ev ent, and sets the new trigger time for the even t. This func tion can only be used o n events of type EVT_TIMER . Status Codes Return ed EFI_SUCCESS The event has been set t o be signa le[...]

  • Page 57

    Services Version 1.02 12/12/00 39 3.1.7 RaiseTPL() Summary Raises a task ’ s p riority level a nd returns its prev ious lev el. Prototype EFI_TPL RaiseTPL ( IN EFI_TPL NewTpl ); Parameters NewTpl The new task p rior ity level. It mu st be grea ter tha n or equal t o the current ta sk prio rity leve l. See “ Relat ed Definitions ” . Related De[...]

  • Page 58

    Extensible Firmware Interface Specifi cation 40 12/12/00 Version 1.02 Description The RaiseTPL() function raises the prior ity of the currently exec uting task and return s its previous prior ity level. Only three task prio rity leve ls are expo sed outs ide of the firmware d uring EFI boot services executio n. The firs t is TPL_APPLICATION where a[...]

  • Page 59

    Services Version 1.02 12/12/00 41 3.1.8 RestoreTPL() Summary Restores a task ’ s prio rity leve l to its p revious value. Prototype VOID RestoreTPL ( IN EFI_TPL OldTpl ) Parameters OldTpl The previou s task prio rity lev el to res tore (the valu e from a p revious, matching ca ll to RaiseTPL() ). Type EFI_TPL is def ined in Section 3.1.7. Descrip[...]

  • Page 60

    Extensible Firmware Interface Specifi cation 42 12/12/00 Version 1.02 3.2 Memory Allocat ion Services The functions that make up Memory A llocat ion Serv ices are us ed during pr e-boot to alloca te and free memo ry, and t o obtain th e syste m ’ s memory map. See Table 3-4. Table 3-4. Memory Allocation Functions Name Type Description AllocatePag[...]

  • Page 61

    Services Version 1.02 12/12/00 43 Table 3-5 . Memory Typ e Usag e Before E xitBootSe rvices() Mnemonic Description EfiReservedM emoryTy pe Not used. EfiLoaderCod e The code portions of a loade d EFI applic ation. (Note th at EFI OS loaders are EFI applicatio ns.) EfiLoaderData The data portio ns of a loa ded EFI ap plication and the defa ult data a[...]

  • Page 62

    Extensible Firmware Interface Specifi cation 44 12/12/00 Version 1.02 Table 3-6. Memory Type Usage After ExitBootServic es() Mnemonic Description EfiReservedM emoryTy pe N ot used. EfiLoaderCod e The Loader and/or OS may use this mem ory as they see fit. Note : the OS loader that calle d ExitBootServices() is utilizing one or more EfiLoaderCode ran[...]

  • Page 63

    Services Version 1.02 12/12/00 45 3.2.1 AllocatePages() Summary Allocate s memo ry pages f rom the sys tem. Prototype EFI_STATUS AllocatePages( IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS * Memory ); Parameters Type The type of al location to perform. See “ Related Defin itions ” . Memor[...]

  • Page 64

    Extensible Firmware Interface Specifi cation 46 12/12/00 Version 1.02 Related Definitions //******************************************************* //EFI_ALLOCATE_TYPE //******************************************************* // These types are discussed in the “ Description ” section below. typedef enum { AllocateAnyPages, AllocateMaxAddress, [...]

  • Page 65

    Services Version 1.02 12/12/00 47 Description The AllocatePages() function a lloca tes the requ ested nu mber of pag es and retu rns a po inter to the ba se address o f the page r ange in the location r eferenced b y Memory . The func tion scans the memory map to loc ate free p ages. When it find s a physica lly con tiguous b lock of page s that is[...]

  • Page 66

    Extensible Firmware Interface Specifi cation 48 12/12/00 Version 1.02 3.2.2 FreePages() Summary Frees memo ry pages. Prototype EFI_STATUS FreePages ( IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN Pages ); Parameters Memory The base physic al address of the p ages to be f reed. Type EFI_PHYSICAL_ADDRESS is defined i n Sectio n 3.2.1. Pages The number of [...]

  • Page 67

    Services Version 1.02 12/12/00 49 3.2.3 GetMemoryM ap() Summary Returns t he curr ent memo ry map. Prototype EFI_STATUS GetMemoryMap ( IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion ); Parameters MemoryMapSize A pointer to the size, in bytes, of t he [...]

  • Page 68

    Extensible Firmware Interface Specifi cation 50 12/12/00 Version 1.02 Related Definitions //******************************************************* //EFI_MEMORY_DESCRIPTOR //******************************************************* typedef struct { UINT32 Type; EFI_PHYSICAL_ADDRESS PhysicalStart; EFI_VIRTUAL_ADDRESS VirtualStart; UINT64 NumberOfPages[...]

  • Page 69

    Services Version 1.02 12/12/00 51 EFI_MEMORY_WB Memory cach eabil ity attr ibute: Me mory regi on is cachea ble with “ write back ” policy. Reads and writes that hit in the cache d o not propagate to main me mory. Dirty data is wri tten back to m ain memory when a new ca che line i s allo cated. EFI_MEMORY_UCE Memory cach eabil ity attr ibute: [...]

  • Page 70

    Extensible Firmware Interface Specifi cation 52 12/12/00 Version 1.02 The GetMemoryMap() function a lso return s the s ize and rev ision numbe r of the EFI_MEMORY_DESCRIPTOR . The DescriptorSize re prese nts the si ze in byt es o f an EFI_MEMORY_DESCRIPTOR array elem ent retur ned in MemoryMap . The size is r eturne d to allow for future exp ansion[...]

  • Page 71

    Services Version 1.02 12/12/00 53 3.2.4 AllocatePool() Summary Allocate s pool memory. Prototype EFI_STATUS AllocatePool ( IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer ); Parameters PoolType The type of pool to alloca te. The on ly suppo rted types a re EfiLoaderData, EfiBootServicesData, EfiRuntimeServicesData, EfiACPIReclaimMemor[...]

  • Page 72

    Extensible Firmware Interface Specifi cation 54 12/12/00 Version 1.02 3.2.5 FreePool() Summary Returns poo l memory to the syste m. Prototype EFI_STATUS FreePool ( IN VOID *Buffer ); Parameters Buffer Pointer to the buff er to free. Description The FreePool() funct ion returns the memo ry spec ified by Buffer to the system . On return, the memory ?[...]

  • Page 73

    Services Version 1.02 12/12/00 55 3.3 Protocol Handler Servi ces In the ab stract, a p rotocol con sists of a 128 -bit guaran teed un ique identi fier (GUID) and a Protoco l Interface structur e. The struc ture contains the functi ons and inst ance data t hat are use d to acc ess a device. The fun ctions tha t make up Proto col Handl er Service s a[...]

  • Page 74

    Extensible Firmware Interface Specifi cation 56 12/12/00 Version 1.02 Device Handle First Handle GUID Interf ace GUID Interf ace GUID Interface GUID Interface Protocol Interf ace Instance Data Protocol Interf ace Instance Data Protocol Interface Instance Data Protocol Interface Instance Data Device Handle GUID Interf ace GUID Interf ace Protocol In[...]

  • Page 75

    Services Version 1.02 12/12/00 57 3.3.1 InstallProtocolInterfa ce() Summary Installs a protocol interfac e on a device h andle. If the handle doe s not ex ist, it is c reated and ad ded to the lis t of handles in the sys tem. Prototype EFI_STATUS InstallProtocolInterface ( IN OUT EFI_HANDLE *Handle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE Inte[...]

  • Page 76

    Extensible Firmware Interface Specifi cation 58 12/12/00 Version 1.02 Related Definitions //******************************************************* //EFI_HANDLE //******************************************************* typedef VOID *EFI_HANDLE; //******************************************************* //EFI_GUID //**********************************[...]

  • Page 77

    Services Version 1.02 12/12/00 59 3.3.2 UninstallProtocolInt erface() Summary Removes a p rotoco l interf ace from a device h andle. Prototype EFI_STATUS UninstallProtocolInterface ( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *Interface ); Parameters Handle The handle o n which the int erface wa s instal led. Type EFI_HANDLE is defined in[...]

  • Page 78

    Extensible Firmware Interface Specifi cation 60 12/12/00 Version 1.02 3.3.3 ReinstallProtocolInte rface() Summary Reinstalls a protocol inter face on a dev ice handle. Prototype EFI_STATUS ReinstallProtocolInterface ( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *OldInterface, IN VOID *NewInterface ); Parameters Handle Handle on w hich th e[...]

  • Page 79

    Services Version 1.02 12/12/00 61 3.3.4 RegisterProtocolNot ify() Summary Creates a n event tha t is to be s ignaled whenever an interf ace is ins talled fo r a spec ified pro tocol. Prototype EFI_STATUS RegisterProtocolNotify ( IN EFI_GUID *Protocol, IN EFI_EVENT Event, OUT VOID **Registration ); Parameters Protocol The numeric ID of the pro tocol[...]

  • Page 80

    Extensible Firmware Interface Specifi cation 62 12/12/00 Version 1.02 3.3.5 LocateHandle( ) Summary Returns an array of ha ndles that supp ort a spec ified p rotocol. Prototype EFI_STATUS LocateHandle ( IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL , IN VOID *SearchKey OPTIONAL , IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buff[...]

  • Page 81

    Services Version 1.02 12/12/00 63 Related Definitions //******************************************************* // EFI_LOCATE_SEARCH_TYPE //******************************************************* typedef enum { AllHandles, ByRegisterNotify, ByProtocol } EFI_LOCATE_SEARCH_TYPE; AllHandles Protocol and SearchKey are ig nored and the funct ion returns[...]

  • Page 82

    Extensible Firmware Interface Specifi cation 64 12/12/00 Version 1.02 3.3.6 HandleProtocol() Summary Queries a handle to determ ine if it support s a specified protoco l. Prototype EFI_STATUS HandleProtocol ( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface ); Parameters Handle The handle b eing queri ed. Type EFI_HANDLE is def ine[...]

  • Page 83

    Services Version 1.02 12/12/00 65 3.3.7 LocateDevicePath() Summary Locates the h andle to a devi ce on the d evice path that suppor ts the specified protocol. Prototype EFI_STATUS LocateDevicePath ( IN EFI_GUID *Protocol, IN OUT EFI_DEVICE_PATH **DevicePath, OUT EFI_HANDLE *Device ); Parameters Protocol The protocol to search fo r. Type EFI_GUID is[...]

  • Page 84

    Extensible Firmware Interface Specifi cation 66 12/12/00 Version 1.02 Description The LocateDevicePath() function l ocates al l devices on DevicePath tha t support Protocol and retu rns the hand le to th e device th at is c losest to DevicePath . DevicePath is advanced over the device pa th nodes that were matched. This functio n is use ful for lo [...]

  • Page 85

    Services Version 1.02 12/12/00 67 3.4 Image Services Three types o f images c an be loaded: EFI Application s, EFI Boot S ervices Dri vers, and EFI Runtime Serv ices Drive rs. An EFI OS Loader is a typ e of EFI Applic ation. The most signifi cant difference between these ima ge types is the typ e of memo ry into wh ich they ar e loaded by the firmw[...]

  • Page 86

    Extensible Firmware Interface Specifi cation 68 12/12/00 Version 1.02 Most imag es are load ed by the boot manager. W hen an EFI applicat ion or drive r is instal led, the installa tion pro cedure reg isters i tself w ith the boo t manag er for load ing. Howeve r, in some c ases an applic ation or d river may w ant to p rogramma tically l oad and s[...]

  • Page 87

    Services Version 1.02 12/12/00 69 3.4.1 LoadImage() Summary Loads an EFI image into memory. Prototype EFI_STATUS LoadImage ( IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH *FilePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle ); Parameters BootPolicy If TRUE , indi cates tha t the re[...]

  • Page 88

    Extensible Firmware Interface Specifi cation 70 12/12/00 Version 1.02 Description The LoadImage() function loads an EF I image in to memor y and return s a hand le to th e image. The image is loaded in on e of two ways. I f SourceBuffer is not NULL , th e function is a memory -to-me mory load i n whic h SourceBuffer points to the image to b e loade[...]

  • Page 89

    Services Version 1.02 12/12/00 71 3.4.2 StartImage() Summary Transfers cont rol to a loaded image ’ s en try po int. Prototype EFI_STATUS StartImage ( IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL ); Parameters ImageHandle Handle of im age to be st arted. Type EFI_HANDLE i s defined i n Section 3.3.1 . ExitDat[...]

  • Page 90

    Extensible Firmware Interface Specifi cation 72 12/12/00 Version 1.02 3.4.3 UnloadImage() Summary Unloads an image. Prototype EFI_STATUS UnloadImage ( IN EFI_HANDLE ImageHandle ); Parameters ImageHandle Handle that i dentifie s the ima ge to be u nloaded. T ype EFI_HANDLE is defined in Section 3.3. 1 . Description The UnloadImage() function un load[...]

  • Page 91

    Services Version 1.02 12/12/00 73 3.4.4 EFI_IMAGE_ENTRY_ POINT Summary This is the d eclara tion of an EFI i mage entry point. Th is can be th e entry point to an EF I applicatio n, an EFI boo t serv ice drive r, or an EFI run time dr iver. Prototype typedef EFI_STATUS (EFIAPI *EFI_IMAGE_ENTRY_POINT) ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE[...]

  • Page 92

    Extensible Firmware Interface Specifi cation 74 12/12/00 Version 1.02 3.4.5 Exit() Summary Termina tes the cu rrent ly loaded E FI image a nd retu rns contro l to boo t services. Prototype EFI_STATUS Exit ( IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL ); Parameters ImageHandle Handle tha t[...]

  • Page 93

    Services Version 1.02 12/12/00 75 When an EFI application ex its, f irmware frees the memory used to hold the i mage. The fi rmware also frees its refe rences to the ImageHandle and th e handle itself. B efore e xiting, th e appli cation is responsi ble fo r freeing a ny resource s it allo cated. This inc ludes mem ory (pages a nd/or po ol), open f[...]

  • Page 94

    Extensible Firmware Interface Specifi cation 76 12/12/00 Version 1.02 3.4.6 ExitBootServices() Summary Terminate s all boot s ervic es. Prototype EFI_STATUS ExitBootServices ( IN EFI_HANDLE ImageHandle, IN UINTN MapKey ); Parameters ImageHandle Handle that i dentifie s the ex iting i mage. Type EFI_HANDLE is d efined in Section 3.3.1 . MapKey Key t[...]

  • Page 95

    Services Version 1.02 12/12/00 77 3.5 Variable Services Variable s are defi ned as key/va lue pairs that consi st of iden tifying in form ation plus attribut es (the key) and arbi trary dat a (the valu e). Vari ables are intended fo r use as a means to store data that is passed between the EFI en vironmen t implement ed in the pl atform and EFI OS [...]

  • Page 96

    Extensible Firmware Interface Specifi cation 78 12/12/00 Version 1.02 3.5.1 GetVariable() Summary Returns the va lue of a variable. Prototype EFI_STATUS GetVariable ( IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid , OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data ); Parameters VariableName A Null- termina ted Unicod e stri[...]

  • Page 97

    Services Version 1.02 12/12/00 79 Description Each vendor may create and manage its own variab les with out the ri sk of name c onflicts by using a unique VendorGuid . When a variab le is set its Attributes are sup plied to indi cate how the data variable shou ld be stored and maintaine d by the system. The attributes affect when the variable may b[...]

  • Page 98

    Extensible Firmware Interface Specifi cation 80 12/12/00 Version 1.02 3.5.2 GetNextVariableNam e() Summary Enumerates the cur rent variabl e names. Prototype EFI_STATUS GetNextVariableName ( IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VendorGuid ); Parameters VariableNameSize The size of th e VariableName buffe r. [...]

  • Page 99

    Services Version 1.02 12/12/00 81 Once ExitBootServices() is per formed, va riables th at are on ly visible during boot s ervices will no l onger be re turned. To o btain the d ata con tents or a ttribute for a va riable re turned by GetNextVariableName(), the GetVariable() inte rface is u sed. Status Codes Return ed EFI_SUCCESS The fu nction compl[...]

  • Page 100

    Extensible Firmware Interface Specifi cation 82 12/12/00 Version 1.02 3.5.3 SetVariable() Summary Sets the v alue of a va riable. Prototype EFI_STATUS SetVariable ( IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data ); Parameters VariableName A Null- termina ted Unicod e string that is th e name[...]

  • Page 101

    Services Version 1.02 12/12/00 83 EFI_VARIABLE_NON_VOLATILE variable s are sto red in fixed hardware th at has a limite d storage capa city; so metimes a severely limite d capacity. Software shou ld only u se a non-vol atile variable when absolutely necessary. In additi on, if softw are use s a non-vola tile variabl e it should use a variab le tha [...]

  • Page 102

    Extensible Firmware Interface Specifi cation 84 12/12/00 Version 1.02 3.6 Time Serv ices This section contains f unction definitions for tim e-relate d function s that are typica lly nee ded by operating sy stems at runtime to access un derlying ha rdware tha t manages t ime inform ation and service s. The purp ose of thes e inte rfaces is to provi[...]

  • Page 103

    Services Version 1.02 12/12/00 85 3.6.1 GetTime() Summary Returns th e current time and d ate in formation, and the ti me-keep ing capabil ities of the h ardware platfo rm. Prototype EFI_STATUS GetTime ( OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL ); Parameters Time A pointer to storage to receive a snapshot o f the cu rren[...]

  • Page 104

    Extensible Firmware Interface Specifi cation 86 12/12/00 Version 1.02 //******************************************************* // Bit Definitions for EFI_TIME. Daylight . See below. //******************************************************* #define EFI_TIME_ADJUST_DAYLIGHT 0x01 #define EFI_TIME_IN_DAYLIGHT 0x02 //***********************************[...]

  • Page 105

    Services Version 1.02 12/12/00 87 //******************************************************* // EFI_TIME_CAPABILITIES //******************************************************* // This provides the capabilities of the // real time clock device as exposed through the EFI interfaces. typedef struct { UINT32 Resolution; UINT32 Accuracy; BOOLEAN SetsToZe[...]

  • Page 106

    Extensible Firmware Interface Specifi cation 88 12/12/00 Version 1.02 3.6.2 SetTime() Summary Sets the current lo cal tim e and date i nform ation. Prototype EFI_STATUS SetTime ( IN EFI_TIME *Time ); Parameters Time A pointer to the current time. Type EFI_TIME is defined in Section 3.6.1. Fu ll error c hecking is performed on the dif ferent fi elds[...]

  • Page 107

    Services Version 1.02 12/12/00 89 3.6.3 GetWakeupTime() Summary Returns the cu rrent w akeup alar m clock set ting. Prototype EFI_STATUS GetWakeupTime ( OUT BOOLEAN *Enabled, OUT BOOLEAN *Pending, OUT EFI_TIME *Time ); Parameters Enabled Indicates if the ala rm is currentl y enable d or disabl ed. Pending Indicates if the ala rm signal is pending a[...]

  • Page 108

    Extensible Firmware Interface Specifi cation 90 12/12/00 Version 1.02 3.6.4 SetWakeupTime() Summary Sets the sys tem wakeup a larm cloc k time. Prototype EFI_STATUS SetWakeupTime ( IN BOOLEAN Enable, IN EFI_TIME *Time OPTIONAL ); Parameters Enable Enable or d isable th e wakeup alar m. Time If Enable is TRUE , the t ime to s et the wak eup alarm fo[...]

  • Page 109

    Services Version 1.02 12/12/00 91 3.7 Virtual Memory Servic es This section contains f unction definitions for th e virtual me mory su pport tha t may be opt ionally used by an op erating system at runtime. If an operatin g system ch ooses to m ake EFI ru ntime service calls in a virtual addressing mode in stead of t he flat phy sical mod e, then t[...]

  • Page 110

    Extensible Firmware Interface Specifi cation 92 12/12/00 Version 1.02 3.7.1 SetVirtualAddressM ap() Summary Changes the run time addr essing mod e of EFI firmwa re from phy sical to vir tual. Prototype EFI_STATUS SetVirtualAddressMap ( IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, IN EFI_MEMORY_DESCRIPTOR *VirtualMap[...]

  • Page 111

    Services Version 1.02 12/12/00 93 A virtual add ress map may only b e applied on e time. Once th e runt ime system i s in virt ual mode, calls to this fun ction return EFI_UNSUPPORTED . Status Codes Return ed EFI_SUCCESS The virtual a ddress map has been appl ied. EFI_UNSUPPORTED EFI firmware is n ot at runtime, or t he EFI firmware is already in v[...]

  • Page 112

    Extensible Firmware Interface Specifi cation 94 12/12/00 Version 1.02 3.7.2 ConvertPointer() Summary Determ ines the new virtual add ress th at is to b e used on s ubsequent m emory acce sses. Prototype EFI_STATUS ConvertPointer ( IN UINTN DebugDisposition, IN VOID **Address ); Parameters DebugDisposition Supplies type infor mation fo r the point e[...]

  • Page 113

    Services Version 1.02 12/12/00 95 3.8 Miscellaneous Serv ices This section contains the remain ing fun ction defi nitions fo r service s not defin ed elsewh ere but which are requ ired to complete th e defin ition of the EFI environme nt. Table 3-13 l ist s the Miscellan eous Servic es Functions. Table 3-13. Miscellaneous Services Functions Name Ty[...]

  • Page 114

    Extensible Firmware Interface Specifi cation 96 12/12/00 Version 1.02 3.8.1 ResetSystem() Summary Resets th e enti re platfo rm. Prototype VOID ResetSystem ( IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN CHAR16 *ResetData OPTIONAL ); Parameters ResetType The type of reset to p erform. Ty pe EFI_RESET_TYPE is defined [...]

  • Page 115

    Services Version 1.02 12/12/00 97 Description The ResetSystem() function r esets the entire pl atform, inc luding all p rocessors a nd devices, and reboots the sys tem. Calling this inte rface w ith ResetType of EfiResetCold causes a syst em-wid e rese t. This sets all circu itry withi n the system to its initial state . This type o f reset i s asy[...]

  • Page 116

    Extensible Firmware Interface Specifi cation 98 12/12/00 Version 1.02 3.8.2 SetWatchdogTimer() Summary Sets the syste m ’ s watchdog timer. Prototype EFI_STATUS SetWatchdogTimer ( IN UINTN Timeout, IN UINT64 WatchdogCode, IN UINTN DataSize, IN CHAR16 *WatchdogData OPTIONAL ); Parameters Timeout The number of seconds to set the wa tchdog ti mer to[...]

  • Page 117

    Services Version 1.02 12/12/00 99 Status Codes Return ed EFI_SUCCESS The timeout has been set. EFI_INVALID_PARAMETER The supp lied WatchdogCode is inv alid. EFI_UNSUP PORTED Th e system does not have a watchd og timer. EFI_DEVICE_ERRO R The watch dog t imer could not be pr ogrammed due t o a hardware error.[...]

  • Page 118

    Extensible Firmware Interface Specifi cation 100 12/12/00 Version 1.02 3.8.3 Stall() Summary Induces a fine-gra ined stall. Prototype EFI_STATUS Stall ( IN UINTN Microseconds ) Parameters Microseconds The number of micro seconds to s tall exec ution. Description The Stall() function s talls exe cution on th e processo r for a t least th e reque ste[...]

  • Page 119

    Services Version 1.02 12/12/00 101 3.8.4 GetNextMonoton icCount() Summary Returns a monotonica lly incre asing count for the pl atform. Prototype EFI_STATUS GetNextMonotonicCount ( OUT UINT64 *Count ); Parameters Count Pointer to returne d value. Description The GetNextMonotonicCount() function r eturns a 64 bit val ue that is numerica lly large r [...]

  • Page 120

    Extensible Firmware Interface Specifi cation 102 12/12/00 Version 1.02 3.8.5 GetNextHighMonotoni cCount() Summary Returns the ne xt high 3 2 bits of the platfo rm ’ s monotoni c counter. Prototype EFI_STATUS GetNextHighMonotonicCount ( OUT UINT32 *HighCount ); Parameters HighCount Pointer to returne d value. Description The GetNextHighMonotonicCo[...]

  • Page 121

    Services Version 1.02 12/12/00 103 3.8.6 InstallConfigurationT able() Summary Adds, updates, or remov es a configu ration tab le entry from the EFI System Tab le. Prototype EFI_STATUS InstallConfigurationTable ( IN EFI_GUID *Guid, IN VOID *Table ); Parameters Guid A pointer to the GUID for the entry to add, update, or remove. Table A pointer to the[...]

  • Page 122

    Extensible Firmware Interface Specifi cation 104 12/12/00 Version 1.02 If an add, modify, or re move ope ration is com pleted, then EFI_SUCCESS is returned. Note: If the re is n ot enough me mory t o perfo rm an add ope ration , then EFI_OUT_OF_RESOURCES is returned. Status Codes Return ed EFI_SUCCESS The ( Guid , Table ) pair was added, u pdated, [...]

  • Page 123

    Version 1.02 12/12/00 105 4 EFI Image This chap ter defines EFI image s, a class o f files that con tain execut able code. W e begin by describ ing the EFI_LOADED_IMAGE protocol, and the n discuss EFI image head ers, applicat ions, OS loaders, and driv ers. 4.1 LOADED_IMAGE Protocol This section provide s a detail ed descrip tion of the EFI_LOADED_[...]

  • Page 124

    Extensible Firmware Interface Specifi cation 106 12/12/00 Version 1.02 Protocol Interface Structu re typedef struct { UINT32 Revision ; EFI_HANDLE ParentHandle ; EFI_SYSTEM_TABLE *SystemTable ; // Source location of the image EFI_HANDLE DeviceHandle ; EFI_DEVICE_PATH *FilePath ; VOID *Reserved; // Image’s load options UINT32 LoadOptionsSize ; VOI[...]

  • Page 125

    EFI Image Version 1.02 12/12/00 107 LoadOptions A pointer to the image ’ s binary lo ad options. ImageBase The base addres s at whi ch the imag e was loaded. ImageSize The size in bytes of the loaded imag e. ImageCodeType The memory type tha t the code sect ions wer e loaded as. Typ e EFI_MEMORY_TYPE is defined i n Chapter 3. ImageDataType The me[...]

  • Page 126

    Extensible Firmware Interface Specifi cation 108 12/12/00 Version 1.02 4.1.1 LOADED_IMAGE.Unl oad() Summary Unloads an image fro m memory . Prototype typedef EFI_STATUS (EFIAPI *EFI_UNLOAD_IMAGE) ( IN EFI_HANDLE ImageHandle, ); Parameters ImageHandle The handle to the image to unload. Type EFI_HANDLE is defined in Chapter 3. Description The Unload([...]

  • Page 127

    EFI Image Version 1.02 12/12/00 109 4.2 EFI Image Header EFI Images a re a class o f files d efined by EFI tha t conta in executab le code. The most disting uishing fe ature o f EFI Image s is that the firs t set o f bytes in the EF I Imag e file con tains an image heade r that defines th e encoding of the execut able image. EFI uses a subse t of t[...]

  • Page 128

    Extensible Firmware Interface Specifi cation 110 12/12/00 Version 1.02 4.3 EFI Applicati ons Applications are loaded by the boo t manager in the EF I firmwa re, or by othe r applica tions. To load an application the fi rmware al locates enough me mory to hold the image, cop ies the sections within the applica tion to the allocate d memory and appli[...]

  • Page 129

    EFI Image Version 1.02 12/12/00 111 When the b oot manage r loads a driver, the image h andle may be used to loc ate the “ load opti ons ” for the d river. The load options are those op tions tha t were stored in the LoadOptions field of the EFI_LOADED_IMAGE informati on for the driver. 4.5.1 EFI Image Handoff S tate Control i s transfe rred to[...]

  • Page 130

    Extensible Firmware Interface Specifi cation 112 12/12/00 Version 1.02 // // EFI System Table // #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 #define EFI_SYSTEM_TABLE_REVISION (1<<16) | (99) typedef struct _EFI_SYSTEM_TABLE { EFI_TABLE_HEADER Hdr; CHAR16 *FirmwareVendor; UINT32 FirmwareRevision; EFI_HANDLE ConsoleInHandle; SIMPLE_INP[...]

  • Page 131

    EFI Image Version 1.02 12/12/00 113 typedef struct_EFI_CONFIGURATION_TABLE { EFI_GUID VendorGuid; VOID *VendorTable; } EFI_CONFIGURATION_TABLE; The EFI system table con tains point ers to the runtime and boot serv ices tabl es. The defin ition s for these table s are shown in the fo llowing code fragm ents. Except for the ta ble header, all ele men[...]

  • Page 132

    Extensible Firmware Interface Specifi cation 114 12/12/00 Version 1.02 EFI_GET_VARIABLE GetVariable; EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; EFI_SET_VARIABLE SetVariable; // // Miscellaneous Services // EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; EFI_RESET_SYSTEM ResetSystem; } EFI_RUNTIME_SERVICES; // // EFI Boot Services Table[...]

  • Page 133

    EFI Image Version 1.02 12/12/00 115 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; EFI_HANDLE_PROTOCOL HandleProtocol; EFI_HANDLE_PROTOCOL PCHandleProtocol; EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; EFI_LOCA[...]

  • Page 134

    Extensible Firmware Interface Specifi cation 116 12/12/00 Version 1.02 4.5.1.2 Handoff Stat e, Itanium-ba sed Operat ing Systems EFI uses the s tandard P 64 C calling conventions that are defi ned for It anium-bas ed operati ng systems. Figur e 4-2 shows t he stack a fter ImageEntryPoint has b een called on Itanium-bas ed systems. The argument s ar[...]

  • Page 135

    Version 1.02 12/12/00 117 5 Device Path Protocol This chap ter contain s the defi nition of the devi ce path pro tocol and th e infor mation needed to construct an d manage dev ice paths in the EFI env ironment. A d evice path is construc ted and used by the fir mware to conve y the lo cation of importan t devices, su ch as the boo t device and con[...]

  • Page 136

    Extensible Firmware Interface Specifi cation 118 12/12/00 Version 1.02 5.2 EFI_DEVICE_PATH Pr otocol This section provide s a detail ed descrip tion of the EFI_DEVICE_PATH protocol. Summary Can be used on any d evice handl e to obtain g eneric pa th/location i nformat ion concern ing the physical dev ice or logi cal device. If the hand le does not [...]

  • Page 137

    Device Path Protoc ol Version 1.02 12/12/00 119 5.3 Device Path Nodes There are six majo r types of Dev ice Path node s: • Hardware De vice Path . Thi s Device Path defines how a device is attached t o the re source domain of a system, wher e resource domain is simply th e share d memory, memory mapped I/O, and I /O space o f the syste m. • ACP[...]

  • Page 138

    Extensible Firmware Interface Specifi cation 120 12/12/00 Version 1.02 A Device Path is a seri es of gener ic Device Path node s. The firs t Device Path node star ts at byte offset zer o of the D evice Path. Th e next Device P ath node sta rts at th e end of the previou s Device Path node. Th erefore all n odes ar e byte packed d ata structu res th[...]

  • Page 139

    Device Path Protoc ol Version 1.02 12/12/00 121 5.3.2.1 PCI Device Path The Device Pa th for PC I defines the p ath to the PCI con figurati on space addr ess for a PCI device. There is o ne PCI Device Pat h entry fo r each devic e and fun ction numb er that de fines the pa th from the root PC I bus to the device. B ecause the PCI bus numb er of a d[...]

  • Page 140

    Extensible Firmware Interface Specifi cation 122 12/12/00 Version 1.02 5.3.2.3 Memory Mapped Device Path Table 5-5. Memory Mapped Device P ath Mnemonic Byte Offset Byte Length Description Type 0 1 Type 1 – Hardware Device Path Sub-Type 1 1 Sub-Type 3 – Mem ory Mapped Length 2 2 Length of this s tructure in by tes. Lengt h is 24 by tes. Memory T[...]

  • Page 141

    Device Path Protoc ol Version 1.02 12/12/00 123 5.3.3 ACPI Device Path This Device Pat h contains ACPI D evice ID s that rep resent a device ’ s P lug and P lay Hardware ID and its corresp onding unique p ersisten t ID. The ACPI IDs a re stored in the ACPI _H ID and _UID device ident ification ob jects tha t are asso ciated with a device. The ACP[...]

  • Page 142

    Extensible Firmware Interface Specifi cation 124 12/12/00 Version 1.02 5.3.4.1 ATAPI Device Path Table 5-9. ATAPI Devi ce Path Mnemonic Byte Offset Byte Length Description Type 0 1 Type 3 – Messagi ng Devi ce Pat h Sub-Type 1 1 Sub-Type 1 – ATAPI Length 2 2 Length of this s tructure in by tes. Lengt h is 8 by tes. PrimarySec ondary 4 1 Set to z[...]

  • Page 143

    Device Path Protoc ol Version 1.02 12/12/00 125 5.3.4.4 1394 Device Path Table 5-1 2. 1394 Dev ice Path Mnemonic Byte Offset Byte Length Description Type 0 1 Type 3 – Messagi ng Devi ce Pat h Sub-Type 1 1 Sub-Type 4 – 13 94 Length 2 2 Length of this s tructure in by tes. Lengt h is 16 by tes. Reserved 4 4 Reserve d GUID 1 8 8 1394 Global Unique[...]

  • Page 144

    Extensible Firmware Interface Specifi cation 126 12/12/00 Version 1.02 5.3.4.6 USB Class Device Path Table 5-1 4. USB Clas s Device Pat h Mnemonic Byte Offset Byte Length Description Type 0 1 Type 3 - Mess aging Devic e Path Sub-Type 1 1 Sub-Type 15 - USB Class Length 2 2 Length of this structure in bytes. L ength is 11 bytes. Vendor ID 4 2 Vendor [...]

  • Page 145

    Device Path Protoc ol Version 1.02 12/12/00 127 5.3.4.9 IPv4 Device Path Table 5-1 7. IPv4 Dev ice Pat h Mnemonic Byte Offset Byte Length Description Type 0 1 Type 3 – Messagi ng Devi ce Pat h Sub-Type 1 1 Sub-Type 12 – IPv4 Length 2 2 Length of this s tructure in by tes. Lengt h is 19 by tes. Local IP Addres s 4 4 The local IPv4 address Remote[...]

  • Page 146

    Extensible Firmware Interface Specifi cation 128 12/12/00 Version 1.02 5.3.4.11 InfiniBand † Devi ce Path Table 5-19. InfiniBand † Device Pat h Mnemonic Byte Offset Byte Length Description Type 0 1 Type 3 – Messagi ng Devi ce Pat h Sub-Type 1 1 Sub-Type 9 – InfiniB and † Length 2 2 Length of this s tructure in by tes Reserved 4 4 Reserve [...]

  • Page 147

    Device Path Protoc ol Version 1.02 12/12/00 129 5.3.4.13 Vendor-Defined Messagin g Device P ath Table 5-21. Vendor-Defined Me ssaging Devi ce Path Mnemonic Byte Offset Byte Length Description Type 0 1 Type 3 – Messagi ng Devi ce Pat h Sub-Type 1 1 Sub-Type 10 – Vendor Length 2 2 Length of this s tructure in by tes. Lengt h is 20 + n by tes. Ven[...]

  • Page 148

    Extensible Firmware Interface Specifi cation 130 12/12/00 Version 1.02 Table 5-2 2. Hard D rive Medi a Device P ath Mnemonic Byte Offset Byte Length Description Type 0 1 Type 4 – Media De vice P ath Sub-Type 1 1 Sub-Type 1 – Hard Drive Length 2 2 Length of this s tructure in by tes. Lengt h is 42 by tes. Partition Number 4 4 Partition Number of[...]

  • Page 149

    Device Path Protoc ol Version 1.02 12/12/00 131 5.3.5.2 CD-ROM Media Device P ath The CD-ROM Media Dev ice Path is u sed to d efine a syste m partition that exis ts on a CD-ROM. The CD-ROM is assu med to conta in an ISO -9660 file syst em and fol low the CD-ROM “ El Torito ” format. The Boot En try num ber from the B oot Cata log is how the “[...]

  • Page 150

    Extensible Firmware Interface Specifi cation 132 12/12/00 Version 1.02 5.3.5.4 File Path Media Device P ath Table 5-2 5. File Path Media De vice Path Mnemonic Byte Offset Byte Length Description Type 0 1 Type 4 – Media De vice P ath. Sub-Type 1 1 Sub-Type 4 – Fi le Path. Length 2 2 Length of this s tructure in by tes. Lengt h is 4 + n bytes. Pa[...]

  • Page 151

    Device Path Protoc ol Version 1.02 12/12/00 133 5.3.6 BIOS Boot Specifica tion Device Path This Device Pat h is used to d escribe the booting o f non-EFI-aware op erating sy stems. This Dev ice Path is based on the IPL and BCV table entry d ata structu res defined in Appendix A of the BIOS Boot Specifi cation . The BIOS Boo t Specification De vice [...]

  • Page 152

    Extensible Firmware Interface Specifi cation 134 12/12/00 Version 1.02 Device Path structu re in the s tream. Any fu ture ad ditions t o the Device Pa th struc ture types wi ll always star t with the cu rrent standa rd heade r. The size of a Dev ice Path c an be dete rmined by traversing the gene ric Device P ath struc tures in ea ch header and add[...]

  • Page 153

    Device Path Protoc ol Version 1.02 12/12/00 135 5.4.3 Rules with ACPI _AD R If a dev ice in the AC PI name sp ace can b e comp letely desc ribed by a _A DR ob ject then i t will ma p to an EFI ACPI, Ha rdware, or Mess age Device Pat h structure. A _ADR me thod imp lies a bus wi th a standard en umeratio n algorit hm. If the ACPI device has a _ADR a[...]

  • Page 154

    Extensible Firmware Interface Specifi cation 136 12/12/00 Version 1.02 5.4.5 Media Device Path R ules The Media D evice Path i s used to de fine the lo cation of infor mation on a med ium. Hard Dr ives are subdivided in to parti tions by the MBR and a Medi a Device Path is used to de fine which pa rtition is being used. A CD-ROM has boot pa rtition[...]

  • Page 155

    Version 1.02 12/12/00 137 6 Device I/O Protocol This chap ter defines th e Device I/O protoco l. This protocol is used by code, typi cally driv ers, running in th e EFI boot services e nvironmen t to access memory a nd I/O. In pa rticular, functions for man aging PCI buses are defin ed here a lthough oth er bus types may be supported in a similar f[...]

  • Page 156

    Extensible Firmwar e Interface Specifi cation 138 12/12/00 Version 1.02 6.2 DEVICE_IO Protocol Summary Provides the b asic Mem ory, I/O, and PCI inte rfaces that are used to abstrac t accesses to devices. GUID #define DEVICE_IO_PROTOCOL { af6ac311-84c3-11d2-8e3c-00a0c969723b } Protocol Interface St ructure typedef struct _EFI_DEVICE_IO_INTERFACE [...]

  • Page 157

    Device I/O Pr otocol Version 1.02 12/12/00 139 Description The DEVICE_IO protoco l provides the basic Memory, I /O, and PCI in terfaces that a re used to abstract a ccesses to devices. A driver that contro ls a physic al device ob tains the proper DEVICE_IO pr otocol in terface by checking for the suppo rted proto col on t he program matic pa rent([...]

  • Page 158

    Extensible Firmwar e Interface Specifi cation 140 12/12/00 Version 1.02 Related Definitions //******************************************************* // EFI_IO_WIDTH //******************************************************* typedef enum { IO_UINT8 = 0, IO_UINT16 = 1, IO_UINT32 = 2, IO_UINT64 = 3 } EFI_IO_WIDTH; //***********************************[...]

  • Page 159

    Device I/O Pr otocol Version 1.02 12/12/00 141 6.2.1 DEVICE_IO.Mem(), .I o(), and .Pc i() Summary Enable a d river to ac cess dev ice regis ters in th e appropri ate memo ry or I /O space. Prototype typedef EFI_STATUS (EFIAPI *EFI_DEVICE_IO) ( IN struct EFI_DEVICE_IO_INTERFACE *This, IN EFI_IO_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT [...]

  • Page 160

    Extensible Firmwar e Interface Specifi cation 142 12/12/00 Version 1.02 Table 6-1. PCI Address Mnemonic Byte Offset Byte Length Description Register 0 1 The register n umber on the function. Function 1 1 The function on the dev ice. Device 2 1 T he de vice o n the bu s. Bus 3 1 The bus. Segment 4 1 The segment number. Reserve d 5 3 Must b e zer o. [...]

  • Page 161

    Device I/O Pr otocol Version 1.02 12/12/00 143 6.2.2 DEVICE_IO.PciDev icePath() Summary Provides an EFI D evice Pa th for a PC I device wi th the given PC I config uration sp ace address. Prototype typedef EFI_STATUS (EFIAPI *EFI_PCI_DEVICE_PATH) ( IN EFI_DEVICE_IO_INTERFACE *This, IN UINT64 PciAddress, IN OUT EFI_DEVICE_PATH **PciDevicePath ); Par[...]

  • Page 162

    Extensible Firmwar e Interface Specifi cation 144 12/12/00 Version 1.02 6.2.3 DEVICE_IO.Map() Summary Provides the d evice sp ecific a ddresses ne eded to a ccess syst em memo ry. Prototype typedef EFI_STATUS (EFIAPI *EFI_IO_MAP) ( IN EFI_DEVICE_IO_INTERFACE *This, IN EFI_IO_OPERATION_TYPE Operation, IN EFI_PHYSICAL_ADDRESS *HostAddress, IN OUT UIN[...]

  • Page 163

    Device I/O Pr otocol Version 1.02 12/12/00 145 Related Definitions //******************************************************* // EFI_IO_OPERATION_TYPE //******************************************************* typedef enum { EfiBusMasterRead, EfiBusMasterWrite, EfiBusMasterCommonBuffer } EFI_IO_OPERATION_TYPE; EfiBusMasterRead A read oper ation fro m[...]

  • Page 164

    Extensible Firmwar e Interface Specifi cation 146 12/12/00 Version 1.02 6.2.4 DEVICE_IO.Unmap() Summary Complete s the Map() op eration and releases any corresp onding resou rces. Prototype typedef EFI_STATUS (EFIAPI *EFI_IO_UNMAP) ( IN EFI_DEVICE_IO_INTERFACE *This, IN VOID *Mapping ); Parameters This A pointer to the EFI_DEVICE_IO_INTERFACE insta[...]

  • Page 165

    Device I/O Pr otocol Version 1.02 12/12/00 147 6.2.5 DEVICE_IO.Allocate Buffer() Summary Allocate s pages that are su itable fo r an EFIBusMasterCommonBuffer map ping. Prototype typedef EFI_STATUS (EFIAPI *EFI_IO_ALLOCATE_BUFFER) ( IN EFI_DEVICE_IO_INTERFACE *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI[...]

  • Page 166

    Extensible Firmwar e Interface Specifi cation 148 12/12/00 Version 1.02 Allocation reque sts of Type AllocateMaxAddress will allocat e any avail able range o f pages that sati sfies the reques t that are below or e qual to the value po inted to by HostAddress on input. On su ccess, the v alue pointe d to by HostAddress contains the base of the rang[...]

  • Page 167

    Device I/O Pr otocol Version 1.02 12/12/00 149 6.2.6 DEVICE_IO.Flush() Summary Flushes an y posted w rite data to the device. Prototype typedef EFI_STATUS (EFIAPI *EFI_IO_FLUSH) ( IN EFI_DEVICE_IO_INTERFACE *This ); Parameters This A pointer to the EFI_DEVICE_IO_INTERFACE instance. Type EFI_DEVICE_IO_INTERFACE is defined i n Sectio n 6.2. Descripti[...]

  • Page 168

    Extensible Firmwar e Interface Specifi cation 150 12/12/00 Version 1.02 6.2.7 DEVICE_IO.FreeBuff er() Summary Frees pages t hat were allocated with AllocateBuffer() . Prototype typedef EFI_STATUS (EFIAPI *EFI_IO_FREE_BUFFER) ( IN EFI_DEVICE_IO_INTERFACE *This, IN UINTN Pages, IN EFI_PHYSICAL_ADDRESS HostAddress ); Parameters This A pointer to the E[...]

  • Page 169

    Version 1.02 12/12/00 151 7 Console I/O Protocol This chap ter defines th e Console I/O protoco l. This protocol is used to h andle input and outpu t of text-based informa tion in tended for the system user durin g the ope ration of code in t he EFI boo t service s environment. Also in cluded here are the definitions of three co nsole device s: one[...]

  • Page 170

    Extensible Firmwar e Interface Specifi cation 152 12/12/00 Version 1.02 7.2 ConsoleIn Definiti on The SIMPLE_INPUT protoco l defines an i nput strea m that con tains Unicod e characte rs and require d EFI scan code s. Only the con trol c haracters de fined in Table 7-1 hav e meaning in the Unicode inp ut or outpu t stream s. The contro l characte r[...]

  • Page 171

    Console I/O Protocol Version 1.02 12/12/00 153 Table 7-2. EFI Scan Cod es for SIMPLE_IN PUT_INTERF ACE ( continued) EFI Scan Code Description 0x0b Function 1. 0x0c Function 2. 0x0d Function 3. 0x0e Function 4. 0x0f Function 5. 0x10 Function 6. 0x11 Function 7. 0x12 Function 8. 0x13 Function 9. 0x14 Function 10. 0x17 Esc ape.[...]

  • Page 172

    Extensible Firmwar e Interface Specifi cation 154 12/12/00 Version 1.02 7.3 SIMPLE_INPUT Pr otocol Summary This protoco l is used to obtain inpu t fro m the ConsoleIn device. GUID #define SIMPLE_INPUT_PROTOCOL { 387477c1-69c7-11d2-8e39-00a0c969723b } Protocol Interface St ructure typedef struct _SIMPLE_INPUT_INTERFACE { EFI_INPUT_RESET Reset ; EF[...]

  • Page 173

    Console I/O Protocol Version 1.02 12/12/00 155 7.3.1 SIMPLE_INPUT.Rese t() Summary Resets the in put dev ice hardware. Prototype EFI_STATUS (EFIAPI *EFI_INPUT_RESET) ( IN SIMPLE_INPUT_INTERFACE *This, IN BOOLEAN ExtendedVerification ); Parameters This A pointer to the SIMPLE_INPUT_INTERFACE instance. Type SIMPLE_INPUT_INTERFACE is defined i n Secti[...]

  • Page 174

    Extensible Firmwar e Interface Specifi cation 156 12/12/00 Version 1.02 7.3.2 SIMPLE_INPUT.Read KeyStroke Summary Reads the n ext keystro ke from the i nput device. Prototype EFI_STATUS (EFIAPI *EFI_INPUT_READ_KEY) ( IN SIMPLE_INPUT_INTERFACE *This , OUT EFI_INPUT_KEY *Key ); Parameters This A pointer to the SIMPLE_INPUT_INTERFACE instance. Type SI[...]

  • Page 175

    Console I/O Protocol Version 1.02 12/12/00 157 7.4 ConsoleOut or Standar dError The SIMPLE_TEXT_OUTPUT protoco l must imp lement th e same Unicod e code pag es as the SIMPLE_INPUT protocol. The protoco l must al so support t he Unicode con trol ch aracters defined in Tab le 7-1. The SIMPLE_TEXT_OUTPUT protoc ol supports speci al manipulat ion of th[...]

  • Page 176

    Extensible Firmwar e Interface Specifi cation 158 12/12/00 Version 1.02 SetAttribute Sets the for eground and ba ckground colo r of the te xt tha t is output. See Section 7.5.6. ClearScreen Clears the s creen with th e currently set backg round color. See Section 7.5.7. SetCursorPosition Sets the cur rent cu rsor position. See Sect ion 7.5.8. Enabl[...]

  • Page 177

    Console I/O Protocol Version 1.02 12/12/00 159 Description The SIMPLE_TEXT_OUTPUT protoco l is used to con trol text-based output d evices. It is the minimum requi red protoco l for any hand le supp lied as the ConsoleOut or StandardError device. In add ition, the minimu m supported text mode o f such devi ces is at least 80 x 25 characters . A vid[...]

  • Page 178

    Extensible Firmwar e Interface Specifi cation 160 12/12/00 Version 1.02 7.5.1 SIMPLE_TEXT_OUT PUT.Reset() Summary Resets the t ext output d evice hardwa re. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_RESET) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN BOOLEAN ExtendedVerification ); Parameters This A pointer to the SIMPLE_TEXT_OUTPUT_INTERFACE instance.[...]

  • Page 179

    Console I/O Protocol Version 1.02 12/12/00 161 7.5.2 SIMPLE_TEXT_OUT PUT.Output String() Summary Writes a Un icode stri ng to the out put device. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_STRING) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN CHAR16 *String ); Parameters This A pointer to the SIMPLE_TEXT_OUTPUT_INTERFACE instance. Type SIMPLE_TEXT_OUTPUT[...]

  • Page 180

    Extensible Firmwar e Interface Specifi cation 162 12/12/00 Version 1.02 #define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555 #define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556 #define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557 #define BOXDRAW_UP_RIGHT_DOUBLE 0x2558 #define BOXDRAW_UP_DOUBLE_RIGHT 0x2559 #define BOXDRAW_DOUBLE_UP_RIGHT 0x255a #define BOXDRAW_UP_LEFT_DOUBLE 0x255b #de[...]

  • Page 181

    Console I/O Protocol Version 1.02 12/12/00 163 //******************************************************* // EFI Required Arrow shapes //******************************************************* #define ARROW_UP 0x2191 #define ARROW_DOWN 0x2193 Description The OutputString() function wr ites a Unicod e string to t he outpu t device. This i s the most [...]

  • Page 182

    Extensible Firmwar e Interface Specifi cation 164 12/12/00 Version 1.02 7.5.3 SIMPLE_TEXT_OUT PUT.TestStr ing() Summary Verifies th at all ch aracte rs in a Unico de string can be output to the target dev ice. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_TEST_STRING) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN CHAR16 *String ); Parameters This A pointer [...]

  • Page 183

    Console I/O Protocol Version 1.02 12/12/00 165 7.5.4 SIMPLE_TEXT_OUT PUT.Query Mode() Summary Returns info rmation for an av ailable t ext mode t hat the out put device (s) support s. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_QUERY_MODE) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows ); Parameters Thi[...]

  • Page 184

    Extensible Firmwar e Interface Specifi cation 166 12/12/00 Version 1.02 7.5.5 SIMPLE_TEXT_OUT PUT.SetMod e() Summary Sets the output devi ce(s) to a specified mod e. Prototype EFI_STATUS (* EFIAPI EFI_TEXT_SET_MODE) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN UINTN ModeNumber ); Parameters This A pointer to the SIMPLE_TEXT_OUTPUT_INTERFACE instance[...]

  • Page 185

    Console I/O Protocol Version 1.02 12/12/00 167 7.5.6 SIMPLE_TEXT_OUT PUT.SetAttri bute() Summary Sets the backgroun d and foreground colors for the OutputString() and ClearScreen() function s. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN UINTN Attribute ); Parameters This A pointer to the SIMPLE_[...]

  • Page 186

    Extensible Firmwar e Interface Specifi cation 168 12/12/00 Version 1.02 #define EFI_BACKGROUND_BLACK 0x00 #define EFI_BACKGROUND_BLUE 0x10 #define EFI_BACKGROUND_GREEN 0x20 #define EFI_BACKGROUND_CYAN 0x30 #define EFI_BACKGROUND_RED 0x40 #define EFI_BACKGROUND_MAGENTA 0x50 #define EFI_BACKGROUND_BROWN 0x60 #define EFI_BACKGROUND_LIGHTGRAY 0x70 #def[...]

  • Page 187

    Console I/O Protocol Version 1.02 12/12/00 169 7.5.7 SIMPLE_TEXT_OUT PUT.ClearS creen() Summary Clears the ou tput dev ice(s) displ ay to th e current ly selected ba ckground co lor. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This ); Parameters This A pointer to the SIMPLE_TEXT_OUTPUT_INTERFACE instance.[...]

  • Page 188

    Extensible Firmwar e Interface Specifi cation 170 12/12/00 Version 1.02 7.5.8 SIMPLE_TEXT_OUT PUT.SetCur sorPosition() Summary Sets the current coo rdinates o f the c ursor po sition. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN UINTN Column, IN UINTN Row ); Parameters This A pointer to the[...]

  • Page 189

    Console I/O Protocol Version 1.02 12/12/00 171 7.5.9 SIMPLE_TEXT_OUT PUT.Enable Cursor() Summary Makes th e cursor vi sible or i nvisible. Prototype EFI_STATUS (EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( IN SIMPLE_TEXT_OUTPUT_INTERFACE *This, IN BOOLEAN Visible ); Parameters This A pointer to the SIMPLE_TEXT_OUTPUT_INTERFACE instance. Type SIMPLE_TEXT_OUTPU[...]

  • Page 190

    Extensible Firmwar e Interface Specifi cation 172 12/12/00 Version 1.02[...]

  • Page 191

    Version 1.02 12/12/00 173 8 Block I/O Protocol This chap ter defines th e Block I /O protocol. T his pro tocol is u sed to abst ract mass storage dev ices to allow code running in the EFI boot services environmen t to acces s them w ithout sp ecific knowledge of th e type of device or c ontroller th at man ages the dev ice. Functi ons are def ined [...]

  • Page 192

    Extensible Firmwar e Interface Specifi cation 174 12/12/00 Version 1.02 Parameters Revision The revision to which the block IO inte rface adheres. All fu ture revisions must be backwards co mpatib le. If a fu ture vers ion is not back wards c ompatibl e it is not th e same GUID. Media A pointer to the EFI_BLOCK_IO_MEDIA data for this devi ce. Type [...]

  • Page 193

    Block I/O Protocol Version 1.02 12/12/00 175 Related Definitions //******************************************************* // EFI_BLOCK_IO_MEDIA //******************************************************* typedef struct { UINT32 MediaId; BOOLEAN RemovableMedia; BOOLEAN MediaPresent; BOOLEAN LogicalPartition; BOOLEAN ReadOnly; BOOLEAN WriteCaching; UI[...]

  • Page 194

    Extensible Firmwar e Interface Specifi cation 176 12/12/00 Version 1.02 8.1.1 EFI_BLOCK_IO.Rese t() Summary Resets the bl ock device ha rdware. Prototype EFI_STATUS (EFIAPI *EFI_BLOCK_RESET) ( IN EFI_BLOCK_IO *This, IN BOOLEAN ExtendedVerification ); Parameters This Indicates a pointer to th e calling context. Type EFI_BLOCK_IO is defined in Sectio[...]

  • Page 195

    Block I/O Protocol Version 1.02 12/12/00 177 8.1.2 EFI_BLOCK_IO.Read Blocks() Summary Reads the requested number of blocks from the device. Prototype EFI_STATUS (EFIAPI *EFI_BLOCK_READ) ( IN EFI_BLOCK_IO *This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINTN BufferSize, OUT VOID *Buffer ); Parameters This Indicates a pointer to th e calling context. Ty[...]

  • Page 196

    Extensible Firmwar e Interface Specifi cation 178 12/12/00 Version 1.02 Status Codes Return ed EFI_SUCCESS The data was re ad correctly from the devic e. EFI_DEVICE_ERRO R The dev ice reported an err or while at tempting to perf orm the read operation. EFI_NO_MED IA There is no medi a in the dev ice. EFI_MEDIA_CHANGED The MediaId is not for the c u[...]

  • Page 197

    Block I/O Protocol Version 1.02 12/12/00 179 8.1.3 EFI_BLOCK_IO.Writ eBlocks() Summary Wr ites a spe cifi ed num ber of bl ocks to the de vic e. Prototype EFI_STATUS (EFIAPI *EFI_BLOCK_WRITE) ( IN EFI_BLOCK_IO *This, IN UINT32 MediaId, IN EFI_LBA LBA, IN UINTN BufferSize, IN VOID *Buffer ); Parameters This Indicates a pointer to th e calling contex[...]

  • Page 198

    Extensible Firmwar e Interface Specifi cation 180 12/12/00 Version 1.02 Status Codes Return ed EFI_SUCCESS The data were writt en correctly to the dev ice. EFI_WRITE_PROTECTED The device cannot be written to . EFI_NO_MED IA There is no medi a in the dev ice. EFI_MEDIA_CHANGED The MediaId is not for the c urrent med ia. EFI_DEVICE_ERRO R The device [...]

  • Page 199

    Block I/O Protocol Version 1.02 12/12/00 181 8.1.4 BLOCK_IO.FlushBlo cks() Summary Flushes all mod ified data to a physical block devic e. Prototype EFI_STATUS (EFIAPI *EFI_BLOCK_FLUSH) ( IN EFI_BLOCK_IO *This ); Parameters This Indicates a pointer to th e calling context. Type EFI_BLOCK_IO is defined in Se ction 8.1. Description The FlushBlocks() [...]

  • Page 200

    Extensible Firmwar e Interface Specifi cation 182 12/12/00 Version 1.02[...]

  • Page 201

    Version 1.02 12/12/00 183 9 Disk I/O Protocol This chap ter defines th e Disk I/O pro tocol. This protoco l is used to abs tract the bl ock accesse s of the Block I/O p rotocol to a more gene ral offse t-length p rotocol. The firmware i s responsib le for adding th is protoco l to any Block I/O inter face that a ppears in the system that does no t [...]

  • Page 202

    Extensible Firmwar e Interface Specifi cation 184 12/12/00 Version 1.02 Description The EFI_DISK_IO prot oc ol is use d to cont rol blo ck I /O int erf ace s. The disk I/O funct ions allow I/O ope rations that need not be on the unde rlying dev ice’s block boundaries or alignmen t requ irements. This is done by copying the data to/from interna l [...]

  • Page 203

    Disk I/O Protocol Version 1.02 12/12/00 185 9.1.1 EFI_DISK_IO.ReadD isk() Summary Reads a spe cified nu mber of byte s fro m a device. Prototype EFI_STATUS (EFIAPI *EFI_DISK_READ) ( IN EFI_DISK_IO *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, OUT VOID *Buffer ); Parameters This Indicates a pointer to th e calling context. Type EF[...]

  • Page 204

    Extensible Firmwar e Interface Specifi cation 186 12/12/00 Version 1.02 9.1.2 EFI_DISK_IO.WriteD isk() Summary Writes a s pecified n umber o f bytes to a device. Prototype EFI_STATUS (EFIAPI *EFI_DISK_WRITE) ( IN EFI_DISK_IO *This, IN UINT32 MediaId, IN UINT64 Offset, IN UNITN BufferSize, IN VOID *Buffer ); Parameters This Indicates a pointer to th[...]

  • Page 205

    Version 1.02 12/12/00 187 10 File System Protocol This chap ter defines th e File Sy stem pro tocol. This p rotocol allows code running in the EF I boot service s environment to obta in file ba sed acc ess to a dev ice. The S imple F ile System pr otocol is used to open a d evice vo lume and re turn an EFI_FILE tha t provides interfaces to access f[...]

  • Page 206

    Extensible Firmwar e Interface Specifi cation 188 12/12/00 Version 1.02 Description The Simple Fi le System protocol p rovides a m inimal interface fo r file-ty pe acce ss to a devi ce. This protocol is only supp orted on so me devic es. Devices th at support the Simpl e File Syst em pro tocol retu rn an EFI_FILE_IO_INTERFACE . The only funct ion o[...]

  • Page 207

    File System Protocol Version 1.02 12/12/00 189 10.1.1 EFI_FILE_IO_INTERF ACE.Open Volume() Summary Opens the root d irectory on a volume. Prototype typedef EFI_STATUS (EFIAPI *EFI_VOLUME_OPEN) ( IN EFI_FILE_IO_INTERFACE *This, OUT EFI_FILE **Root ); Parameters This A pointer to the volu me to open th e root d irectory of. Ty pe EFI_FILE_IO_INTERFAC[...]

  • Page 208

    Extensible Firmwar e Interface Specifi cation 190 12/12/00 Version 1.02 10.2 EFI_FILE Pr otocol Summary Provides file based acc ess to supported file systems. Revision Numb er #define EFI_FILE_REVISION 0x00010000 Protocol Interface St ructure typedef struct _EFI _ FILE { UINT64 Revision ; EFI_FILE_OPEN Open ; EFI_FILE_CLOSE Close ; EFI_FILE_DELETE [...]

  • Page 209

    File System Protocol Version 1.02 12/12/00 191 Description The EFI_FILE provide s file IO acce ss to su pported file systems. An EFI_FILE provides access to a file ’ s or di rec tor y ’ s contents, and is also a referen ce to a locatio n in the di rectory tree of the fi le system in which the file resides. W ith any given f ile hand le, other f[...]

  • Page 210

    Extensible Firmwar e Interface Specifi cation 192 12/12/00 Version 1.02 10.2.1 EFI_FILE.Open() Summary Opens a n ew file relativ e to the source fi le ’ s l ocatio n. Prototype EFI_STATUS (EFIAPI *EFI_FILE_OPEN) ( IN EFI_FILE *This, OUT EFI_FILE **NewHandle, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes ); Parameters This A pointe[...]

  • Page 211

    File System Protocol Version 1.02 12/12/00 193 Related Definitions //******************************************************* // Open Modes //******************************************************* #define EFI_FILE_MODE_READ 0x0000000000000001 #define EFI_FILE_MODE_WRITE 0x0000000000000002 #define EFI_FILE_MODE_CREATE 0x8000000000000000 //**********[...]

  • Page 212

    Extensible Firmwar e Interface Specifi cation 194 12/12/00 Version 1.02 Status Codes Return ed EFI_SUCCESS The file was o pened. EFI_NOT_FOUN D The specifi ed file cou ld not be fo und on the d evice. EFI_NO_MEDIA The devic e has no medium . EFI_MEDIA_CH ANGED The device has a d ifferent med ium in it or the m edium is no longer suppor ted. EFI_DEV[...]

  • Page 213

    File System Protocol Version 1.02 12/12/00 195 10.2.2 EFI_FILE.Close() Summary Closes a spec ified file handle. Prototype EFI_STATUS (EFIAPI *EFI_FILE_CLOSE) ( IN EFI_FILE *This ); Parameters This A pointer to the EFI_FILE instance that is the file hand le to close. Type EFI_FILE is defin ed in Sec tion 10.2. Description The Close() function c lose[...]

  • Page 214

    Extensible Firmwar e Interface Specifi cation 196 12/12/00 Version 1.02 10.2.3 EFI_FILE.Delete() Summary Closes and d eletes a file. Prototype EFI_STATUS (EFIAPI *EFI_FILE_DELETE) ( IN EFI_FILE *This ); Parameters This A pointer to the EFI_FILE instance th at is the h andle t o the fil e to delete. Type EFI_FILE is defined in Section 10.2. Descript[...]

  • Page 215

    File System Protocol Version 1.02 12/12/00 197 10.2.4 EFI_FILE.Read() Summary Reads data from a file . Prototype EFI_STATUS (EFIAPI *EFI_FILE_READ) ( IN EFI_FILE *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer ); Parameters This A pointer to the EFI_FILE instance th at is the file hand le to re ad data from. Typ e EFI_FILE is defin ed in Sec tion[...]

  • Page 216

    Extensible Firmwar e Interface Specifi cation 198 12/12/00 Version 1.02 10.2.5 EFI_FILE.Write() Summary Writes da ta to a fi le. EFI_STATUS (EFIAPI *EFI_FILE_WRITE) ( IN EFI_FILE *This, IN OUT UINTN *BufferSize, IN VOID *Buffer ); Parameters This A pointer to the EFI_FILE instance that is the file hand le to write data to. Type EFI_FILE is defi ned[...]

  • Page 217

    File System Protocol Version 1.02 12/12/00 199 10.2.6 EFI_FILE.Set Position() Summary Sets a file ’ s cur rent position. Prototype EFI_STATUS (EFIAPI *EFI_FILE_SET_POSITION) ( IN EFI_FILE *This, IN UINT64 Position ); Parameters This A pointer to the EFI_FILE instance that is the he file handle to set the requested pos ition on. Type EFI_FILE is d[...]

  • Page 218

    Extensible Firmwar e Interface Specifi cation 200 12/12/00 Version 1.02 10.2.7 EFI_FILE.Get Position() Summary Return s a file ’ s current position. Prototype EFI_STATUS (EFIAPI *EFI_GET_POSITION) ( IN EFI_FILE *This, OUT UINT64 *Position ); Parameters This A pointer to the EFI_FILE instance th at is the file hand le to ge t the current pos ition[...]

  • Page 219

    File System Protocol Version 1.02 12/12/00 201 10.2.8 EFI_FILE.GetInfo() Summary Returns in format ion about a f ile. Prototype EFI_STATUS (EFIAPI *EFI_FILE_GET_INFO) ( IN EFI_FILE *This, IN EFI_GUID *InformationType, IN OUT UINTN *BufferSize, OUT VOID *Buffer ); Parameters This A pointer to the EFI_FILE instance that is the file hand le the reques[...]

  • Page 220

    Extensible Firmwar e Interface Specifi cation 202 12/12/00 Version 1.02 10.2.9 EFI_FILE.SetInfo() Summary Sets infor mation about a file. Prototype EFI_STATUS (EFIAPI *EFI_FILE_SET_INFO) ( IN EFI_FILE *This, IN EFI_GUID *InformationType, IN UINTN BufferSize, OUT VOID *Buffer ); Parameters This A pointer to the EFI_FILE instance that is the file han[...]

  • Page 221

    File System Protocol Version 1.02 12/12/00 203 10.2.10 EFI_FILE.Flush() Summary Flushes a ll modif ied data ass ociated wi th a file to a device. Prototype EFI_STATUS (EFIAPI *EFI_FILE_FLUSH) ( IN EFI_FILE *This ); Parameters This A pointer to the EFI_FILE instance that is the file hand le to flush. Type EFI_FILE is defin ed in Sec tion 10.2. Descr[...]

  • Page 222

    Extensible Firmwar e Interface Specifi cation 204 12/12/00 Version 1.02 10.2.11 EFI_FILE_INFO Summary Provides a GUID and a data str ucture tha t can be used w ith EFI_FILE.SetInfo() and EFI_FILE.GetInfo() to set or ge t gener ic file info rmation. GUID #define EFI_FILE_INFO_ID { 09576e92-6d3f-11d2-8e39-00a0c969723b } Related Definitions typedef [...]

  • Page 223

    File System Protocol Version 1.02 12/12/00 205 ModificationTime The ti me when th e file ’ s con tents w ere last modified. Attribute The attribu te bits fo r the file . See “ Relat ed Definition s ” . FileName The Null-terminat ed Unicode na me of the f ile. Description The EFI_FILE_INFO data s tructure s upports GetInfo() and SetInfo() r eq[...]

  • Page 224

    Extensible Firmwar e Interface Specifi cation 206 12/12/00 Version 1.02 10.2.12 EFI_FILE_SYSTEM_ INFO Summary Provides a GUID and a data str ucture tha t can be used w ith EFI_FILE.GetInfo() to get informat ion abou t the system volume, and EFI_FILE.SetInfo() to se t the sy stem v olume ’ s volume label. GUID #define EFI_FILE_SYSTEM_INFO_ID { 0[...]

  • Page 225

    File System Protocol Version 1.02 12/12/00 207 10.2.13 EFI_FILE_SYSTEM_ VOLUME_L ABEL Summary Provides a GUID and a data str ucture tha t can be used w ith EFI_FILE.GetInfo() or EFI_FILE.SetInfo() to get or set informa tion abou t the sys tem ’ s vol um e l abel . GUID #define EFI_FILE_SYSTEM_VOLUME_LABEL_ID { DB47D7D3-FE81-11d3-9A35-0090273FC1[...]

  • Page 226

    Extensible Firmwar e Interface Specifi cation 208 12/12/00 Version 1.02[...]

  • Page 227

    Version 1.02 12/12/00 209 11 Load File Protocol This chap ter defines th e Load Fi le protocol. This protoc ol is desi gned to all ow code running in the EFI boot se rvices env ironment to find and load other modules of c ode. 11.1 LOAD_FILE Protocol Summary Is used to ob tain file s from ar bitrary d evices. GUID #define LOAD_FILE_PROTOCOL {56EC[...]

  • Page 228

    Extensible Firmwar e Interface Specifi cation 210 12/12/00 Version 1.02 11.1.1 LOAD_FILE.LoadFile () Summary Causes the drive r to load a spec ified file. Prototype EFI_STATUS (EFIAPI *EFI_LOAD_FILE) ( IN EFI_LOAD_FILE_INTERFACE *This, IN EFI_DEVICE_PATH *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL ); Paramet[...]

  • Page 229

    Load File Protocol Version 1.02 12/12/00 211 If BootPolicy is FALSE the FilePath must match an e xact file t o be load ed. If no such file exists, EFI_NOT_FOUND is retu rned. If BootPolicy is FALSE , and an at tempt is b eing m ade to perform a network boo t throug h the PXE Base Code p rotocol, EFI_UNSUPPORTED is returned. If BootPolicy is TRUE th[...]

  • Page 230

    Extensible Firmwar e Interface Specifi cation 212 12/12/00 Version 1.02[...]

  • Page 231

    Version 1.02 12/12/00 213 12 Serial I/O Protocol This chap ter defines th e Seria l I/O protocol. This protoc ol is u sed to abst ract byte st ream dev ices. 12.1 SERIAL_IO Protocol Summary This protoco l is used to communic ate with any type of char acter-ba sed I/O devi ce. GUID #define SERIAL_IO_PROTOCOL { BB25CF6F-F1D4-11D2-9A0C-0090273FC1FD [...]

  • Page 232

    Extensible Firmwar e Interface Specifi cation 214 12/12/00 Version 1.02 SetControl Set the cont rol bits on a serial d evice. These includ e Request to Send and Data T erminal R eady. GetControl Read the stat us of the con trol b its on a seria l device. Th ese inc lude Clear to Send, Da ta Set Read y, Ring Indic ator, and Carr ier Detect. Write Se[...]

  • Page 233

    Serial I/O Protocol Version 1.02 12/12/00 215 Parity If applicab le, this is the EFI_PARITY_TYPE that is computed or checked as each charac ter is t ransmit ted or rece ived. If t he device does not su pport pari ty the valu e is th e defau lt parity value. StopBits If applicab le, the EFI_STOP_BITS_TYPE n umber of s top bits pe r character. If the[...]

  • Page 234

    Extensible Firmwar e Interface Specifi cation 216 12/12/00 Version 1.02 The default a ttributes fo r all UART-style serial de vice inte rfaces ar e: 115,200 baud, a 1 byte receive F IFO, a 1,000,000 m icrosecond ti meout p er charac ter, no pari ty, 8 data b its, and 1 stop bit. Flow control i s the respo nsibili ty of th e software that uses t he [...]

  • Page 235

    Serial I/O Protocol Version 1.02 12/12/00 217 12.1.1 SERIAL_IO.Reset() Summary Resets th e serial d evice. Prototype EFI_STATUS (EFIAPI *EFI_SERIAL_RESET) ( IN SERIAL_IO_INTERFACE *This ); Parameters This A pointer to the SERIAL_IO_INTERFACE instance. Type SERIAL_IO_INTERFACE is defined i n Section 12.1. Description The Reset() function resets the [...]

  • Page 236

    Extensible Firmwar e Interface Specifi cation 218 12/12/00 Version 1.02 12.1.2 SERIAL_IO.SetAttrib utes() Summary Sets the b aud rate, rece ive FIFO dep th, transmi t/receive t ime out, pa rity, data bits, and s top bits on a serial dev ice. EFI_STATUS (EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) ( IN SERIAL_IO_INTERFACE *This, IN UINT64 BaudRate, IN UINT32[...]

  • Page 237

    Serial I/O Protocol Version 1.02 12/12/00 219 Description The SetAttributes() funct ion sets th e baud rate, r eceive-FI FO depth, tran smit/r eceive ti me out, parity, d ata bits, and stop bi ts on a seri al device. The contro ller for a serial de vice is p rogramme d with th e specifi ed attrib utes. If the Parity , DataBits , or StopBits values [...]

  • Page 238

    Extensible Firmwar e Interface Specifi cation 220 12/12/00 Version 1.02 12.1.3 SERIAL_IO.SetContr ol() Summary Sets the cont rol bits o n a seri al device. Prototype EFI_STATUS (EFIAPI *EFI_SERIAL_SET_CONTROL) ( IN SERIAL_IO_INTERFACE *This, IN UINT32 Control ); Parameters This A pointer to the SERIAL_IO_INTERFACE instance. Type SERIAL_IO_INTERFACE[...]

  • Page 239

    Serial I/O Protocol Version 1.02 12/12/00 221 Only th e REQUEST_TO_SEND , DATA_TERMINAL_READY , HARDWARE_LOOPBACK_ENABLE , SOFTWARE_LOOPBACK_ENABLE , and HARDWARE_FLOW_CONTROL_ENABLE bits can be set with SetControl() . A ll the b its can be read w ith GetControl() . Status Codes Return ed EFI_SUCCESS The new control bits wer e set on the s erial de[...]

  • Page 240

    Extensible Firmwar e Interface Specifi cation 222 12/12/00 Version 1.02 12.1.4 SERIAL_IO.GetContr ol() Summary Retrieves t he status o f the cont rol bits on a serial d evice. Prototype EFI_STATUS (EFIAPI *EFI_SERIAL_GET_CONTROL) ( IN SERIAL_IO_INTERFACE *This, OUT UINT32 *Control ); Parameters This A pointer to the SERIAL_IO_INTERFACE instance. Ty[...]

  • Page 241

    Serial I/O Protocol Version 1.02 12/12/00 223 12.1.5 SERIAL_IO.Write() Summary Writes da ta to a ser ial device. Prototype EFI_STATUS (EFIAPI *EFI_SERIAL_WRITE) ( IN SERIAL_IO_INTERFACE *This, IN OUT UINTN *BufferSize, IN VOID *Buffer ); Parameters This A pointer to the SERIAL_IO_INTERFACE instance. Type SERIAL_IO_INTERFACE is defined i n Section 1[...]

  • Page 242

    Extensible Firmwar e Interface Specifi cation 224 12/12/00 Version 1.02 12.1.6 SERIAL_IO.Read() Summary Reads data from a se rial de vice. Prototype EFI_STATUS (EFIAPI *EFI_SERIAL_READ) ( IN SERIAL_IO_INTERFACE *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer ); Parameters This A pointer to the SERIAL_IO_INTERFACE instance. Type SERIAL_IO_INTERFAC[...]

  • Page 243

    Version 1.02 12/12/00 225 13 Unicode Collation Protocol This chap ter defines th e Unicode Coll ation prot ocol. This proto col is used to allow code running in the boot s ervices en viron ment to per form lex ical compa rison func tions on Unico de string s for given languages. 13.1 UNICODE_COLLATION Pr otocol Summary Is used to pe rform cas e-ins[...]

  • Page 244

    Extensible Firmwar e Interface Specifi cation 226 12/12/00 Version 1.02 StrUpr Converts all the Unicode cha racters in a Null-t erminated Unicode stri ng to upper ca se Unicod e characte rs. See Section 13.1.4 . FatToStr Converts an 8.3 FAT fi le name usi ng an OEM ch aracter set to a Null-term inated Unico de string. S ee Section 13 .1.5. StrToFat[...]

  • Page 245

    Unicode Collation Protocol Version 1.02 12/12/00 227 13.1.1 UNICODE_COLLATI ON.StriColl() Summary Performs a case-inse nsitive co mpar ison of tw o Null-term inated U nicode st rings. Prototype INTN (EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) ( IN UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *s1, IN CHAR16 *s2 ); Parameters This A pointer to the UNICO[...]

  • Page 246

    Extensible Firmwar e Interface Specifi cation 228 12/12/00 Version 1.02 13.1.2 UNICODE_COLLATI ON.MetaiMat ch() Summary Performs a case-inse nsitive co mparison of a Null-t erminat ed Unicode pat tern string and a Nu ll- terminated Uni code stri ng. Prototype BOOLEAN (EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) ( IN UNICODE_COLLATION_INTERFACE *This, I[...]

  • Page 247

    Unicode Collation Protocol Version 1.02 12/12/00 229 Examples pa tterns (fo r English ): *.FW Matches al l strings tha t end in “ .FW ” or “ .fw ” or “ .Fw ” or “ .fW ” . [a-z] Match any lett er in the a lphabet. [!@#$%^ &*()] Match a ny on e of the se sy mbol s. z Match the ch aract er ‘ z ’ or ‘ Z ’ . D?.* Match the ch[...]

  • Page 248

    Extensible Firmwar e Interface Specifi cation 230 12/12/00 Version 1.02 13.1.3 UNICODE_COLLATI ON.StrLwr() Summary Converts all the Unicode cha racters in a Null-ter minated Unicod e string to lower case Un icode characters . Prototype VOID (EFIAPI *EFI_UNICODE_COLLATION_STRLWR) ( IN UNICODE_COLLATION_INTERFACE *This, IN OUT CHAR16 *String ); Param[...]

  • Page 249

    Unicode Collation Protocol Version 1.02 12/12/00 231 13.1.4 UNICODE_COLLATI ON.StrUpr() Summary Converts all the Unicode cha racters in a Null-ter minated Un icode string t o upper case Un icode characters . Prototype VOID (EFIAPI *EFI_UNICODE_COLLATION_STRUPR) ( IN UNICODE_COLLATION_INTERFACE *This, IN OUT CHAR16 *String ); Parameters This A point[...]

  • Page 250

    Extensible Firmwar e Interface Specifi cation 232 12/12/00 Version 1.02 13.1.5 UNICODE_COLLATI ON.FatToStr() Summary Converts an 8.3 FAT f ile name in a n OEM char acter set to a Null-term inated Unicod e string. Prototype VOID (EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) ( IN UNICODE_COLLATION_INTERFACE *This, IN UINTN FatSize, IN CHAR8 *Fat, OUT CHAR[...]

  • Page 251

    Unicode Collation Protocol Version 1.02 12/12/00 233 13.1.6 UNICODE_COLLATI ON.StrToFat() Summary Converts a Null -terminat ed Unicode strin g to leg al charac ters in a FAT fil ename usin g an OEM character set. Prototype BOOLEAN (EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) ( IN UNICODE_COLLATION_INTERFACE *This, IN CHAR16 *String, IN UINTN FatSize, O[...]

  • Page 252

    Extensible Firmwar e Interface Specifi cation 234 12/12/00 Version 1.02[...]

  • Page 253

    Version 1.02 12/12/00 235 14 PXE Base Code Protocol This chap ter defines th e Preboot Exec ution Env ironment (PXE) Ba se Code pro tocol, which is used to access PXE-co mpat ible devices f or network ac cess and netwo rk booting. More in formation about PXE can be fou nd in th e Preboot Execut ion Environment (PXE) Spec ification at: ftp://down lo[...]

  • Page 254

    Extensible Firmwar e Interface Specifi cation 236 12/12/00 Version 1.02 Parameters Revision The re visi on of the EFI_PXE_BASE_CODE Protocol. All future revisions must be backw ards co mpatib le. If a f uture version is no t backwa rds compat ible it is no t the same GUID. Start Starts the P XE Base Code Pro tocol. Mode structur e inform ation is n[...]

  • Page 255

    PXE Base Code Protocol Version 1.02 12/12/00 237 Related Definitions //******************************************************* // Maximum ARP and Route Entries //******************************************************* #define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 #define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 //****************************************[...]

  • Page 256

    Extensible Firmwar e Interface Specifi cation 238 12/12/00 Version 1.02 EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[ EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES ]; UINT32 RouteTableEntries; EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[ EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES ]; EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError; EFI_PXE_BASE_CODE_TFTP_ERROR TftpError; } EFI_PXE_BASE_C[...]

  • Page 257

    PXE Base Code Protocol Version 1.02 12/12/00 239 ProxyOfferReceived This field is ini tialized to FALSE by t he Start() function and set to TRUE when th e Dhcp() function c omple tes succes sfully and a proxy DHCP offe r packet was received. W hen TRUE , the ProxyOffer packet field is va lid. This f ield can also be changed by the SetPackets() f un[...]

  • Page 258

    Extensible Firmwar e Interface Specifi cation 240 12/12/00 Version 1.02 StationIp The device ’ s curren t IP addr ess. This f ield is in itializ ed to a z ero address by Start() . This field is se t when th e Dhcp() function co mpletes su ccessf ully. This field can a lso be set by th e SetStationIp() function. SubnetMask The device ’ s curren [...]

  • Page 259

    PXE Base Code Protocol Version 1.02 12/12/00 241 RouteTableEntries The number of v alid entr ies in the curren t route table . This fie ld is reset t o zero by the Start() f uncti on. RouteTable Array of rout e table en tries. IcmpError ICMP error pa cket. Th is field is upd ated when an IC MP erro r is received and is undef ined unti l the fir st [...]

  • Page 260

    Extensible Firmwar e Interface Specifi cation 242 12/12/00 Version 1.02 //******************************************************* // This section defines the data types for DHCP packets, ICMP // error packets, and TFTP error packets. All of these are byte // packed data structures. //******************************************************* //*******[...]

  • Page 261

    PXE Base Code Protocol Version 1.02 12/12/00 243 //******************************************************* // EFI_PXE_BASE_CODE_ICMP_ERROR //******************************************************* typedef struct { UINT8 Type; UINT8 Code; UINT16 Checksum; union { UINT32 reserved; UINT32 Mtu; UINT32 Pointer; struct { UINT16 Identifier; UINT16 Sequenc[...]

  • Page 262

    Extensible Firmwar e Interface Specifi cation 244 12/12/00 Version 1.02 //******************************************************* // This section defines the data types for ARP cache entries, // and route table entries. //******************************************************* //******************************************************* // EFI_PXE_BAS[...]

  • Page 263

    PXE Base Code Protocol Version 1.02 12/12/00 245 //******************************************************* // The following table defines values for the PXE DHCP and // Bootserver Discover packet tags that are specific to the EFI // environment. Complete definitions of all PXE tags are defined // in Table 2-1 PXE DHCP Options (Full List), in the PX[...]

  • Page 264

    Extensible Firmwar e Interface Specifi cation 246 12/12/00 Version 1.02 Description The basic me chanis ms and flow fo r remote booting in EF I are i dentical to the remote boo t function ality descr ibed in detail in the PXE Specification . However, the actu al execution environmen t, linkage, a nd calling conventions are replac ed and enhance d f[...]

  • Page 265

    PXE Base Code Protocol Version 1.02 12/12/00 247 14.1.1 EFI_PXE_BASE_CO DE.Start() Summary Enables the us e of the PXE Base Co de Protocol functions. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_START) ( IN EFI_PXE_BASE_CODE *This, IN BOOLEAN UseIpv6 ); Parameters This Pointer to the EFI_PXE_BASE_CODE insta nce. UseIpv6 Specifies the type of IP [...]

  • Page 266

    Extensible Firmwar e Interface Specifi cation 248 12/12/00 Version 1.02 ToS Set to DEFAULT_ToS . DhcpCompleted Set to FALSE . ProxyOfferReceived Set to FALSE . StationIp Set to an addr ess of all zeros. SubnetMask Set to a subne t mask of a ll ze ros. DhcpDiscover Zero-f illed . DhcpAck Zero-f illed . ProxyOffer Zero-f illed . PxeDiscoverValid Set [...]

  • Page 267

    PXE Base Code Protocol Version 1.02 12/12/00 249 Status Codes Return ed EFI_SUCCESS The PXE Base Code Protocol was starte d. EFI_INVALID_PARAMETER One of the par ameters is not valid. EFI_UNSUPPORTED UseIpv6 is TRUE , but the Ipv6Supported f ield of the EFI_BASE_CODE_MODE struct ure is FALSE . EFI_ALREADY_STARTED The PXE Base Code Protocol is a lre[...]

  • Page 268

    Extensible Firmwar e Interface Specifi cation 250 12/12/00 Version 1.02 14.1.2 EFI_PXE_BASE_CO DE.Stop() Summary Disables the use of the PXE Bas e Code Protoco l functions. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_STOP) ( IN EFI_PXE_BASE_CODE *This ); Parameters This Pointer to the EFI_PXE_BASE_CODE insta nce. Description This func tion stop[...]

  • Page 269

    PXE Base Code Protocol Version 1.02 12/12/00 251 14.1.3 EFI_PXE_BASE_CO DE.Dhcp() Summary Attempts t o complet e a DHCPv4 D.O.R.A. (discov er / offer / r equest / a cknowledg e) or DHCPv6 S.A.R.R (solicit / adverti se / request / reply ) sequence. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_DHCP) ( IN EFI_PXE_BASE_CODE *This, IN BOOLEAN SortOff[...]

  • Page 270

    Extensible Firmwar e Interface Specifi cation 252 12/12/00 Version 1.02 Status Codes Return ed EFI_SUCCESS Valid DHCP has comp leted. EFI_NOT_STARTED The PXE Base Code Pro tocol is i n the stopped s tate. EFI_INVALID_PARAMETER One of the par ameters is not valid. EFI_DEVICE_ERRO R The network dev ice enco untered an error during t his operati on. E[...]

  • Page 271

    PXE Base Code Protocol Version 1.02 12/12/00 253 14.1.4 EFI_PXE_BASE_CO DE.Discov er() Summary Attempts t o complet e the PXE Boot Serv er and/or b oot im age discov ery sequence. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) ( IN EFI_PXE_BASE_CODE *This, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN EFI_PXE_BASE_CODE_DISCOVER[...]

  • Page 272

    Extensible Firmwar e Interface Specifi cation 254 12/12/00 Version 1.02 Related Definitions //******************************************************* // Bootstrap Types //******************************************************* #define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 #define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1 #define EFI_PXE_BASE_COD[...]

  • Page 273

    PXE Base Code Protocol Version 1.02 12/12/00 255 //******************************************************* // EFI_PXE_BASE_CODE_DISCOVER_INFO //******************************************************* typedef struct { BOOLEAN UseMCast; BOOLEAN UseBCast; BOOLEAN UseUCast; BOOLEAN MustUseList; EFI_IP_ADDRESS ServerMCastIp; UINT16 IpCnt; EFI_PXE_BASE_C[...]

  • Page 274

    Extensible Firmwar e Interface Specifi cation 256 12/12/00 Version 1.02 Description This func tion attem pts to comple te the PXE Boo t Server and /or boo t imag e discovery sequ ence. If this sequ ence is com plete d, the n EFI_SUCCESS is retu rned, and the PxeDiscoverValid , PxeDiscover , PxeReplyReceived , and PxeReply fields o f the EFI_PXE_BAS[...]

  • Page 275

    PXE Base Code Protocol Version 1.02 12/12/00 257 14.1.5 EFI_PXE_BASE_CO DE.Mtftp() Summary Used to perfo rm TFTP and M TFTP serv ices. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_MTFTP) ( IN EFI_PXE_BASE_CODE *This, IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, IN OUT VOID *BufferPtr, OPTIONAL IN BOOLEAN Overwrite, IN OUT UINTN *BufferSize, IN UI[...]

  • Page 276

    Extensible Firmwar e Interface Specifi cation 258 12/12/00 Version 1.02 Info Pointer to the MTFTP informa tion. This information is requ ired to start or join a multic ast TFTP ses sion. It is a lso requir ed to pe rform th e “ get file size ” and “ read d irecto ry ” ope rations of MTFTP. Se e "Rela ted Definitions " for the desc[...]

  • Page 277

    PXE Base Code Protocol Version 1.02 12/12/00 259 MCastIp File mult icast IP addre ss. This is the IP address to whic h the server will send th e requested file. CPort Client multicas t listen ing port. Th is is th e UDP por t to whic h the server will send th e requested file. SPort Server multi cast listen ing port. Thi s is the UDP port on wh ich[...]

  • Page 278

    Extensible Firmwar e Interface Specifi cation 260 12/12/00 Version 1.02 The format o f the da ta return ed from a TFTP read direct ory opera tion i s a null-te rminat ed filena me followed by a nu ll-ter minate d info rmation s tring, of the form “ siz e year-mo nth-day hour:minu te:second ” (i.e. %d %d -%d-% d %d:%d :%f - not e that the second[...]

  • Page 279

    PXE Base Code Protocol Version 1.02 12/12/00 261 14.1.6 EFI_PXE_BASE_CO DE.UdpWrit e() Summary Writes a UD P pack et to the ne twork int erface. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) ( IN EFI_PXE_BASE_CODE *This, IN UINT16 OpFlags, IN EFI_IP_ADDRESS *DestIp, IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, IN EFI_IP_ADDRESS *GatewayIp,[...]

  • Page 280

    Extensible Firmwar e Interface Specifi cation 262 12/12/00 Version 1.02 HeaderPtr If HeaderSize is no t NULL , a pointe r to a he ader to be p repended to the data at BufferPtr . BufferSize A pointer to the size of the data a t BufferPtr . BufferPtr A pointer to the data to be w ritten. Description This func tion write s a UDP packet spe cified by [...]

  • Page 281

    PXE Base Code Protocol Version 1.02 12/12/00 263 14.1.7 EFI_PXE_BASE_CO DE.UdpRea d() Summary Reads a UDP packet f rom the ne twork in terfa ce. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) ( IN EFI_PXE_BASE_CODE *This IN UINT16 OpFlags, IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL IN OU[...]

  • Page 282

    Extensible Firmwar e Interface Specifi cation 264 12/12/00 Version 1.02 Description This functio n reads a UDP pack et from a netwo rk interface . The dat a contents a re return ed in (the optional HeaderPtr and ) BufferPtr , and the si ze of the bu ffer r eceived is retur ned in BufferSize . If the input BufferSize is smalle r than the UDP packet [...]

  • Page 283

    PXE Base Code Protocol Version 1.02 12/12/00 265 Table 14-4. Sourc e IP Filter Op eration OpFlags ANY_SRC_IP SrcIp Action 0 NULL Re turn EFI_INVALID_PARAMETER . 1 NULL Receive a pac ket sent fr om any IP addres s. 0 not NULL Receiv e a packet whos e source IP address matches SrcIp . 1 not NULL Receiv e a packet sent fr om any IP ad dress, and r etu[...]

  • Page 284

    Extensible Firmwar e Interface Specifi cation 266 12/12/00 Version 1.02 14.1.8 EFI_PXE_BASE_CO DE.SetIpFil ter() Summary Updates th e IP receiv e filters o f a network dev ice and enab les sof tware filterin g. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) ( IN EFI_PXE_BASE_CODE *This, IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter ); P[...]

  • Page 285

    PXE Base Code Protocol Version 1.02 12/12/00 267 14.1.9 EFI_PXE_BASE_CO DE.Arp() Summary Uses the ARP protoc ol to reso lve a MAC ad dress. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_ARP) ( IN EFI_PXE_BASE_CODE *This, IN EFI_IP_ADDRESS *IpAddr, IN EFI_MAC_ADDRESS *MacAddr OPTIONAL ); Parameters This Pointer to the EFI_PXE_BASE_CODE insta nce. [...]

  • Page 286

    Extensible Firmwar e Interface Specifi cation 268 12/12/00 Version 1.02 14.1.10 EFI_PXE_BASE_CO DE.SetPar ameters() Summary Updates th e paramet ers that affect th e operation of the PXE Base Cod e Protoco l. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) ( IN EFI_PXE_BASE_CODE *This, IN BOOLEAN *NewAutoArp, OPTIONAL IN BOOLEAN *Ne[...]

  • Page 287

    PXE Base Code Protocol Version 1.02 12/12/00 269 Description This functio n sets p arameter s that af fect the o peration of the PXE Base Code P rotocol. The parame ter speci fied by NewAutoArp is used to con trol the g eneration of ARP protocol packets. I f NewAutoArp is TRUE , then ARP Proto col packets will be gene rated as r equired by the PXE [...]

  • Page 288

    Extensible Firmwar e Interface Specifi cation 270 12/12/00 Version 1.02 14.1.11 EFI_PXE_BASE_CO DE.SetStat ionIp() Summary Updates th e station IP ad dress a nd/or subne t mask value s of a n etwork devic e. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) ( IN EFI_PXE_BASE_CODE *This, IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL IN EFI[...]

  • Page 289

    PXE Base Code Protocol Version 1.02 12/12/00 271 14.1.12 EFI_PXE_BASE_CO DE.SetPac kets() Summary Updates th e contents o f the c ached DHC P and Discov er packets. Prototype EFI_STATUS (EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) ( IN EFI_PXE_BASE_CODE *This, IN BOOLEAN *NewDhcpDiscoverValid , OPTIONAL IN BOOLEAN *NewDhcpAckReceived , OPTIONAL IN BOOLE[...]

  • Page 290

    Extensible Firmwar e Interface Specifi cation 272 12/12/00 Version 1.02 NewPxeBisReplyReceived If not NULL , a pointer to a value tha t specif ies wheth er to replace the curren t value of PxeBisReplyReceived field. If NULL , this para meter is ignored. NewDhcpDiscover Pointer to the new cach ed DHCP D iscover packet . NewDhcpAck Pointer to the new[...]

  • Page 291

    PXE Base Code Protocol Version 1.02 12/12/00 273 14.2 EFI_PXE_BASE_CODE_CALLBACK Protocol Summary This is a spe cific ins tance of th e PXE Base Code Call back Pro tocol that is invoked when the PXE Base Code Protoco l is about to transm it, has recei ved, or is wai ting to rece ive a packet. Th e PXE Base Code Callbac k Protocol must be on th e sa[...]

  • Page 292

    Extensible Firmwar e Interface Specifi cation 274 12/12/00 Version 1.02 14.2.1 EFI_PXE_BASE_CO DE_CALLB ACK.Callback() Summary Callback function th at is invok ed when the PXE Base Code Proto col is abou t to tr ansmit, has received, or is waiting to rec eive a packe t. Prototype EFI_PXE_BASE_CODE_CALLBACK_STATUS (*EFI_PXE_CALLBACK) ( IN EFI_PXE_BA[...]

  • Page 293

    PXE Base Code Protocol Version 1.02 12/12/00 275 Related Definitions //******************************************************* // EFI_PXE_BASE_CODE_CALLBACK_STATUS //******************************************************* typedef enum { EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST, EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, EFI_PXE_BASE_CODE_CALLBACK_S[...]

  • Page 294

    Extensible Firmwar e Interface Specifi cation 276 12/12/00 Version 1.02[...]

  • Page 295

    Version 1.02 12/12/00 277 15 Simple Network Protocol This chap ter defines th e Simp le Network Pro tocol. This p rotocol pro vides a p acket level int erface to a netwo rk adapt er. 15.1 EFI_SIMPLE_NETWORK Pr otocol Summary The EFI_SIMPLE_NETWORK protoco l provides ser vices to initia lize a netwo rk inter face, trans mit packets, rec eive pac ket[...]

  • Page 296

    Extensible Firmwar e Interface Specifi cation 278 12/12/00 Version 1.02 Parameters Revision Revision of th e EFI_SIMPLE_NETWORK Protocol. All futu re revis ions must be backwa rds co mpatible. If a fu ture vers ion is not ba ckwards compatibl e it is no t the sa me GUID . Start Prepares the network interface fo r furt her comm and operati ons. No o[...]

  • Page 297

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 279 Related Definitions //******************************************************* // EFI_SIMPLE_NETWORK_MODE // // Note that the fields in this data structure are read-only and // are updated by the code that produces the EFI_SIMPLE_NETWORK // protocol functions. All these fields must be discovered // d[...]

  • Page 298

    Extensible Firmwar e Interface Specifi cation 280 12/12/00 Version 1.02 State Reports t he current state of t he netw ork inte rface (se e EFI_SIMPLE_NETWORK_STATE below). When an EFI_SIMPLE_NETWORK driver has i nitiali zed a network interface, it is left in the EfiSimpleNetworkStopped stat e. HwAddressSize The size, in bytes, of the netw ork inte [...]

  • Page 299

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 281 MediaPresentSupported TRUE if the p resence of media can b e determ ined; o therwise FALSE . If FALSE , MediaPresent cannot be used. MediaPresent TRUE if med ia are connecte d to the network int erface;othe rwise FALSE . This fi eld is on ly valid immedia tely afte r calling Initialize() . //*******[...]

  • Page 300

    Extensible Firmwar e Interface Specifi cation 282 12/12/00 Version 1.02 15.1.1 EFI_SIMPLE_NETWO R K . S tart() Summary Changes the state of a network interface from “ stopped ” “ sta rted ” . Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_START) ( IN EFI_SIMPLE_NETWORK *This ); Parameters This A pointer to the EFI_SIMPLE_NETWORK instance.[...]

  • Page 301

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 283 15.1.2 EFI_SIMPLE_NETWO R K . S top() Summary Changes the state of a network interfac e from “ st arte d ” to “ stopp ed ” . Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STOP) ( IN EFI_SIMPLE_NETWORK *This ); Parameters This A pointer to the EFI_SIMPLE_NETWORK instance. Description This [...]

  • Page 302

    Extensible Firmwar e Interface Specifi cation 284 12/12/00 Version 1.02 15.1.3 EFI_SIMPLE_NETWO R K . I nitializ e() Summary Resets a netwo rk adapter an d allo cates the trans mit and recei ve buffers requir ed by the netwo rk interface ; optio nally, als o reques ts alloca tion of add itional transmit and receiv e buffe rs. Prototype EFI_STATUS ([...]

  • Page 303

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 285 15.1.4 EFI_SIMPLE_NETW O R K . Reset() Summary Resets a n etwork ad apter an d re-initi alizes i t with th e parame ters that w ere p rovided in the prev ious call to Initialize() . Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RESET) ( IN EFI_SIMPLE_NETWORK *This, IN BOOLEAN ExtendedVerification[...]

  • Page 304

    Extensible Firmwar e Interface Specifi cation 286 12/12/00 Version 1.02 15.1.5 EFI_SIMPLE_NETWO R K . S hutdo wn() Summary Resets a netwo rk adapter an d leave s it in a sta te that is sa fe for another drive r to in itialize. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) ( IN EFI_SIMPLE_NETWORK *This ); Parameters This A pointer to th[...]

  • Page 305

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 287 15.1.6 EFI_SIMPLE_NETWO R K . R eceiv eFilters() Summary Manages the mu lticast rec eive fil ters of a network inte rface. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) ( IN EFI_SIMPLE_NETWORK *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN Mcast[...]

  • Page 306

    Extensible Firmwar e Interface Specifi cation 288 12/12/00 Version 1.02 If ResetMCastFilter is TRUE , then the mu lticast rec eive filter li st on the network interface will be r eset to the defau lt mu lticast receiv e filter list. If ResetMCastFilter is FALSE , and this network int erface allows the mu ltica st receive fil ter list to be modified[...]

  • Page 307

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 289 15.1.7 EFI_SIMPLE_NETWO R K . S tation Address() Summary Modifies o r resets the curren t station address, if supported. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) ( IN EFI_SIMPLE_NETWORK *This, IN BOOLEAN Reset, IN EFI_MAC_ADDRESS *New OPTIONAL ); Parameters This A pointer to[...]

  • Page 308

    Extensible Firmwar e Interface Specifi cation 290 12/12/00 Version 1.02 15.1.8 EFI_SIMPLE_NETWO R K . S tatisti cs() Summary Resets or collects the stat istics on a network interfac e. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) ( IN EFI_SIMPLE_NETWORK *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL , OUT EFI_NETWORK[...]

  • Page 309

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 291 UINT64 RxDroppedFrames; UINT64 RxUnicastFrames; UINT64 RxBroadcastFrames; UINT64 RxMulticastFrames; UINT64 RxCrcErrorFrames; UINT64 RxTotalBytes; UINT64 TxTotalFrames; UINT64 TxGoodFrames; UINT64 TxUndersizeFrames; UINT64 TxOversizeFrames; UINT64 TxDroppedFrames; UINT64 TxUnicastFrames; UINT64 TxBro[...]

  • Page 310

    Extensible Firmwar e Interface Specifi cation 292 12/12/00 Version 1.02 TxOversizeFrames Number of frames longe r than the maxminu m length for the media. This wou ld be gr eater than 1500 for eth ernet. TxDroppedFrames Valid fram es that were dropped b ecause rec eive buffe rs were full. TxUnicastFrames Number of val id unicast frames transmi tted[...]

  • Page 311

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 293 15.1.9 EFI_SIMPLE_NETWO R K . M CastI PtoMAC() Summary Converts a mu lticast IP addre ss to a mu lticast HW MAC address. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) ( IN EFI_SIMPLE_NETWORK *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC ); Parameters Thi[...]

  • Page 312

    Extensible Firmwar e Interface Specifi cation 294 12/12/00 Version 1.02 15.1.10 EFI_SIMPLE_NETWO R K .N vData () Summary Performs r ead and write ope ration s on the NVRAM devi ce attached to a network interface. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) ( IN EFI_SIMPLE_NETWORK *This IN BOOLEAN ReadWrite, IN UINTN Offset, IN UINTN Bu[...]

  • Page 313

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 295 Status Codes Return ed EFI_SUCCESS The NVRAM ac cess was performed. EFI_NOT_STARTED The network interfac e has not been s tarted. EFI_INVALID_PARAMETER One or m ore of the par ameters has an unsupporte d value. EFI_DEVICE_ERRO R The com mand coul d not be sen t to the network interface. EFI_UNSUPPOR[...]

  • Page 314

    Extensible Firmwar e Interface Specifi cation 296 12/12/00 Version 1.02 15.1.11 EFI_SIMPLE_NETWO R K .G etStat us() Summary Reads the cu rrent inte rrupt s tatus and recyc led trans mit buff er status from a ne twork in terface. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) ( IN EFI_SIMPLE_NETWORK *This, OUT UINT32 *InterruptStatus O[...]

  • Page 315

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 297 Description This func tion ge ts the curr ent in terrupt an d recyc led trans mit buffe r status from the netwo rk interface. The int errupt statu s is re turned as a bit mask i n InterruptStatus . If InterruptStatus is NULL , the inte rrupt st atus will no t be read. I f TxBuf is not NULL , a recyc[...]

  • Page 316

    Extensible Firmwar e Interface Specifi cation 298 12/12/00 Version 1.02 15.1.12 EFI_SIMPLE_NETWO R K .T rans mit() Summary Places a p acket in t he transm it queue of a network interfac e. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) ( IN EFI_SIMPLE_NETWORK *This IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_AD[...]

  • Page 317

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 299 Description This functio n place s the packet specifie d by Header and Buffer on the transmi t queue. If HeaderSize is non-zero a nd HeaderSize is not equ al to This->Mode- >MediaHeaderSize , then EFI_INVALID_PARAMETER will be r eturned. I f BufferSize is less th an This->Mode->MediaHead[...]

  • Page 318

    Extensible Firmwar e Interface Specifi cation 300 12/12/00 Version 1.02 15.1.13 EFI_SIMPLE_NETWO R K .R eceiv e() Summary Receives a packet from a ne twork int erface. Prototype EFI_STATUS (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) ( IN EFI_SIMPLE_NETWORK *This OUT UINTN *HeaderSize OPTIONAL , IN OUT UINTN *BufferSize , OUT VOID *Buffer, OUT EFI_MAC_ADDR[...]

  • Page 319

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 301 Description This functio n retr ieves on e packet from the re ceive queue o f a netwo rk interf ace. If the re are no packets on th e rece ive queue, then EFI_NOT_READY will be returned. If there is a pack et on th e receive queu e, and the size of th e packet is smalle r than BufferSize , th en the[...]

  • Page 320

    Extensible Firmwar e Interface Specifi cation 302 12/12/00 Version 1.02 15.2 NETWORK_INTERFACE_IDENTIFI ER Protocol Summary This is an optional p rotocol th at is u sed to desc ribe de tails abou t the softwa re lay er that i s used to produce the Si mple Network P rotoco l. This protoco l is only requi red if the underlying n etwork interface is 1[...]

  • Page 321

    SIMPLE_NETWORK Protocol Version 1.02 12/12/00 303 16-bit UNDI and 32/64-bi t S/W UNDI: Id contains th e addres s of the f irst byte o f the copy of the !PXE structure i n the r elocated UNDI code segment. See the Preboot Execution E nvironmen t (PXE) Sp ecification and Appendix G. H/W UNDI: Id contains th e addres s of the !PXE st ructure. ImageAdd[...]

  • Page 322

    Extensible Firmwar e Interface Specifi cation 304 12/12/00 Version 1.02 MajorVer Major ve rsion nu mber. 16-bit UNDI: MajorVer comes fro m the th ird byte o f the UNDIRev field in the UNDI ROM ID structu re. Refe r to th e Preboot Executi on Environment (PXE) Specification . 32/64-bit S/W UNDI and H/ W UNDI: MajorVer comes fro m the Major fie ld in[...]

  • Page 323

    Version 1.02 12/12/00 305 16 File System Format The file sys tem suppor ted by the Ext ensible Fir mware Inter face is based o n the FAT f ile syste m. EFI defines a specific v ersion of FAT that is exp licitly d ocumen ted and tes table. Conforma nce to the EFI spe cification and its ass ociate refe rence doc uments is the only de finition o f FAT[...]

  • Page 324

    Extensible Firmwar e Interface Specifi cation 306 12/12/00 Version 1.02 16.1.1 File System Format The first b lock (secto r) of a partition co ntains a data st ructure ca lled th e BIOS Parame ter Block, BPB, that define s the type an d location of FAT fi le system on the driv e. The BPB contain s a data structu re that de fines the size of th e me[...]

  • Page 325

    File System F ormat Version 1.02 12/12/00 307 This direct ory contain s EFI image s that aid e in rec overy if th e boot sel ections fo r the so ftware installed on the EFI sys tem part ition are ever lost. Any addition al EFI execut ables mus t be in sub directori es below the v endor sub di rectory. The following is a sample direc tory structu re[...]

  • Page 326

    Extensible Firmwar e Interface Specifi cation 308 12/12/00 Version 1.02 16.2 Partition D iscovery EFI requi res the fi rmware to be ab le to pars e legacy master bo ot records , the new GUID Pa rtitio n Table (GPT), and El Torito log ical devic e volumes. T he EFI fir mware produces a logical BLOCK_IO device for e ach EFI Pa rtition En try, El Tori[...]

  • Page 327

    File System F ormat Version 1.02 12/12/00 309 EFI supports t he nesting o f legacy MBR par titions, by al lowing any leg acy MBR parti tion to contain mo re legacy MBR pa rtition s. This is accompl ished by suppo rting the same pa rtition discovery al gorithm o n every logical block d evice. It should be n oted th at the GUID Par tition Table does [...]

  • Page 328

    Extensible Firmwar e Interface Specifi cation 310 12/12/00 Version 1.02 Partition En try array is the P artitionEnt rySize mu ltiplied b y NumberO fPartitionEntri es. When a GUID Partition Entry is updated the PartitionEntryArrayCRC must be updated. When the PartitionEntryArrayCRC is updated the GUID Partition Table Header CRC must also be updated,[...]

  • Page 329

    File System F ormat Version 1.02 12/12/00 311 Table 16-1. GUID Partition Table Header Mnemonic Byte Offset Byte Length Description Signature 0 8 Identifies EFI-compat ible partiti on table he ader. This value mus t contain t he string “EFI PAR T”, 0x545241502 049464 5. Revision 8 4 The specific ation r evision num ber that t his header complies[...]

  • Page 330

    Extensible Firmwar e Interface Specifi cation 312 12/12/00 Version 1.02 If the GUID Part ition Tabl e is the pr imary ta ble, stored at LBA 1: • Check the A lterna teLBA to see if it is a valid GUID Partition T able If the p rimary GUID Partit ion Table is corrupt: • Check the las t LBA of the device to see if i t has a valid GUID Pa rtition Ta[...]

  • Page 331

    File System F ormat Version 1.02 12/12/00 313 The SizeOfPa rtitionEn try variab le in the G UID Part ition Tabl e Header d efines th e size of a G UID Partition E ntry. T he GUID P artitio n Entry s tarts in the firs t byte o f the GUID Part ition Entry and any unused sp ace at the end of the de fined par tition en try is res erved sp ace and mus t[...]

  • Page 332

    Extensible Firmwar e Interface Specifi cation 314 12/12/00 Version 1.02 16.2.2 ISO-9660 and El Torito IS0-9660 is the industry standard low level format used on CD-ROM and DVD-ROM. CD-ROM format is co mpletely d escrib ed by the “ El T orito ” Bootable CD-ROM Fo rmat S pecificatio n Version 1.0. To boot from a CD-ROM or DVD-ROM in the boot serv[...]

  • Page 333

    File System F ormat Version 1.02 12/12/00 315 Table 16- 5. Legacy Master Boo t Reco rd Mnemonic Byte Offset Byte Length Description BootCode 0 440 Code us ed on legac y Intel arc hitecture system to sel ect a partition rec ord and loa d the first b lock (sec tor) of the partition poi nted to by th e partit ion record. Th is code is not execu ted o [...]

  • Page 334

    Extensible Firmwar e Interface Specifi cation 316 12/12/00 Version 1.02 Table 16- 6. Legacy Master Bo ot Reco rd Pa rtition Reco rd (c ontinu ed) Mnemonic Byte Offset Byte Length Description End Track 7 1 End of partition in CH S address , not used by EFI firmware. Starting LBA 8 4 Starting LBA address of th e partition on the dis k. Used by EFI fi[...]

  • Page 335

    File System F ormat Version 1.02 12/12/00 317 16.3 Media Formats This section descr ibes how booting from diffe rent types of removab le media is handled. In general the rules a re cons istent reg ardle ss of a med ia ’ s physical typ e and whether it is removab le or not. 16.3.1 Removable Media Removable me dia may cont ain a standa rd FAT-12, F[...]

  • Page 336

    Extensible Firmwar e Interface Specifi cation 318 12/12/00 Version 1.02 16.3.4 CD-ROM and DVD-RO M A CD-ROM or DVD-ROM may contain multiple partitions as defined Sec tions 16.1 and 16.2 an d in the “ El To ri to ” specifica tion. EFI code does not assume a fixed block size. Since the EF I file sy stem de finition do es not us e the same Init ia[...]

  • Page 337

    Version 1.02 12/12/00 319 17 Boot Manager The EFI boot manager i s a firmware po licy engin e that c an be config ured by modifying architect urally de fined globa l NVRAM variable s. The boot ma nager will attempt to load EF I drivers and EF I appli cations (inc luding EFI OS boo t loade rs) in an or der defined by the globa l NVRAM variables. Th [...]

  • Page 338

    Extensible Firmwar e Interface Specifi cation 320 12/12/00 Version 1.02 Programma tic inte ractio n with the boo t mana ger is acco mplished through g lobally defin ed variables. On initial ization the bo ot man ager reads the valu es which compri se al l of the published load options among the EFI environ ment var iables. By using the SetVariable([...]

  • Page 339

    Boot Manager Version 1.02 12/12/00 321 and fixed media types. This sea rch occurs when the device path of the boot image list ed in any boot option point s directly to a SIMPLE_FILE_SYSTEM device and do es not s pecify the exact file to load. The f ile discovery method is explained in “ Boot Opti on Varia bles Def ault Be havio r ” startin g on[...]

  • Page 340

    Extensible Firmwar e Interface Specifi cation 322 12/12/00 Version 1.02 FilePathList A packed array o f EFI dev ice paths. The first e lement of the array is an EFI device pat h that d escrib es the devi ce and loca tion of the Image for this load op tion. The FilePathList[0] is specif ic to the de vice type. Othe r device pa ths may opt ionally ex[...]

  • Page 341

    Boot Manager Version 1.02 12/12/00 323 17.2 Globally-Defined Vari ables This section defines a set of v ariables that have a rchitectu rally defined mean ings. In a ddition to the defined data conten t, each such va riable ha s an archite ctural ly defined a ttribute t hat indi cates when the data var iable may be acce ssed. The var iables with a n[...]

  • Page 342

    Extensible Firmwar e Interface Specifi cation 324 12/12/00 Version 1.02 The LangCodes variable c ontains an array o f 3-characte r (8-bi t ASCII chara cters) ISO-639-2 language c odes tha t the firmware c an support. A t init ializat ion time the firmw are computes th e suppor ted language s and creat es this da ta variable. S ince the firmware cr [...]

  • Page 343

    Boot Manager Version 1.02 12/12/00 325 DriverOrder list is us ed by the firmware ’ s boot manager as the de fault load o rder fo r EFI drivers that it should exp licitly load. 17.3 Boot Option Variables Default Behavior The default s tate of globa lly-defin ed variabl es is fir mware vendo r specific. Howeve r the boo t options requ ire a stand a[...]

  • Page 344

    Extensible Firmwar e Interface Specifi cation 326 12/12/00 Version 1.02 removable media devi ce will point to a device that “ speak s ” the SIMPLE_FILE_SYSTEM protocol. The FilePath wi ll not con tain a file na me or sub directo ries. The system fir mware will attempt to b oot fr om a remova ble media FilePath by a dding a defa ult file name in[...]

  • Page 345

    Version 1.02 12/12/00 327 18 PCI Exp ansion ROM The PCI Local Bu s Specificat ion defines how to discove r expans ion ROM code th at comes f rom a ROM on a PCI Card. The expansion RO M can be ex ecuted to initialize a specific dev ice or, possibly, to b oot a sy stem. PCI a llows the ROM to conta in several d ifferent i mages to accommoda te differ[...]

  • Page 346

    Extensible Firmwar e Interface Specifi cation 328 12/12/00 Version 1.02 EFI will coord inate with a future r evision of the PCI spe cification to alloca te the code type of 0x03 to represen t EFI image s. This code type will s ignify tha t EFI extensions are pre sent in th e standard PCI expansion ROM h eader. Table 18-2. PCI Data Structure Offset [...]

  • Page 347

    PCI Expansion ROM Version 1.02 12/12/00 329 Table 18-3 defi nes the layo ut o f an EFI PCI expa nsion ROM. Missi ng values wi ll be suppl ied in a later version of the spec ifica tion. Table 18-3. EFI PCI Expansion ROM Header Offset Byte Length Value Description 0x00 1 0x55 ROM Signature, byte 1 0x01 1 0xAA ROM Signature, byte 2 0x02 2 XXXX Initial[...]

  • Page 348

    Extensible Firmwar e Interface Specifi cation 330 12/01/00 Version 1.01[...]

  • Page 349

    Version 1.02 12/12/00 331 A GUID and Time Formats All EFI GUIDs (G lobally Unique Id entifiers) have the fo rmat desc ribed in Appen dix J of the Wired for Management Base line S pe cificat ion . This document r eferen ces the form at of t he GUID, but imple menters must refer ence t he Wired f or Managem ent speci fications for a lgorithms to gene[...]

  • Page 350

    Extensible Firmwar e Interface Specifi cation 332 12/12/00 Version 1.02[...]

  • Page 351

    Version 1.02 12/12/00 333 B Console The EFI console wa s designed so that it c ould ma p to commo n console dev ices. This a ppendix explains how an EFI conso le could map to a VGA with PC AT 101/102, PCANSI, o r ANSI X3.64 consoles. B.1 SIMPLE_I NPUT Table B-1 g ives examples of how an EFI scan code can be mapped to ANSI X3.64 termina l, PCANSI te[...]

  • Page 352

    Extensible Firmwar e Interface Specifi cation 334 12/12/00 Version 1.02 Table B-1. EFI S can Codes f or SIM PLE_INPUT ( contin ued) EFI Scan Code Description ANSI X3.64 Codes PCANSI Codes AT 101/102 Ke yboard Scan Codes 0x0e Function 4 CSI O x ESC [ O x 0x3e 0x0f Function 5 CSI O t ESC [ O t 0x3f 0x10 Function 6 CSI O u ESC [ O u 0x40 0x11 Function[...]

  • Page 353

    Console Version 1.02 12/12/00 335 Table B-2. Control Sequ ences th at Can Be Used to Implem ent SIMPLE_TEX T_OUTPUT (continued) PCANSI Codes ANSI X3.64 Codes Description ESC [ 41 m CSI 41 m Red background, c ompliant wit h ISO Standar d 6429. ESC [ 42 m CSI 42 m Green backgrou nd, compliant w ith ISO Standar d 6429. ESC [ 43 m CSI 43 m Yellow back [...]

  • Page 354

    Extensible Firmwar e Interface Specifi cation 336 12/12/00 Version 1.02[...]

  • Page 355

    Version 1.02 12/12/00 337 C Device Path Examples This appendix p resents an example EFI De vice Path and explains its rela tionship t o the ACPI name space. An exa mple sys tem design is p resented a long with its correspo nding A CPI name space. These physica l examples are mapped back to EF I Device Path s. C.1 Example Computer System Figure C-1 [...]

  • Page 356

    Extensible Firmwar e Interface Specifi cation 338 12/12/00 Version 1.02 The remainde r of th is appen dix descri bes how to construct a device pat h for t hree examp le devices from the sy stem in Figure C-1. The followin g is a lis t of the exa mples use d: • Legacy floppy • IDE D isk • Secondary root PCI bus with PCI to PCI bridge Figure C-[...]

  • Page 357

    Device Path Ex amples Version 1.02 12/12/00 339 Table C-1. Legacy Fl oppy De vice Path Byte Offset Byte Length Data Description 0 1 0x02 Gener ic Device Pat h Header – Ty pe ACPI Device Path 1 1 0x01 Sub type – ACPI Device Path 2 2 0x0C Lengt h 4 4 0x41D0, 0x0A03 _HID PNP0A03 – 0x 41D0 repres ents a compres sed strin g ‘PNP’ and is in the[...]

  • Page 358

    Extensible Firmwar e Interface Specifi cation 340 12/12/00 Version 1.02 The EFI Dev ice Pat h for th e PCI ID E control ler would c ontain ent ries for the fo llowing thing s: • Root PCI Bridg e. ACPI Devic e Path _HID PNP0A 03, _UID 0. A CPI name sp ace _SB PCI0 • PCI IDE control ler. PCI Device Pat h with device and function of the IDE co n[...]

  • Page 359

    Device Path Ex amples Version 1.02 12/12/00 341 C.4 Secondar y Root PCI Bus with PCI to PCI Bridge The secondary PCI host bridge materi alizes a s econd set of PCI buses in to the sy stem. Th e PCI buses on th e secondary PC I host b ridge are totally indepe ndent of the PCI buses on the root PC I host bridge. Th e only rela tionship b etween the t[...]

  • Page 360

    Extensible Firmwar e Interface Specifi cation 342 12/12/00 Version 1.02 C.5 ACPI Terms Names in the ACP I name spac e that sta rt with an undersco re ( “ _ ” ) ar e reserved by the AC PI specifica tion and have archi tectural meanin g. All AC PI name s in the na me space ar e four characters in length. T he fol lowing four ACPI n ames are u sed[...]

  • Page 361

    Device Path Ex amples Version 1.02 12/12/00 343 C.6 EFI Device Path as a Name Space Figure C-3 show s the EF I Device P ath for th e example s ystem rep resented a s a name sp ace. The Device Path can be repr esented as a name s pace, but EFI d oes suppo rt man ipulating the Device Path as a nam e space. You can only access D evice Path informat io[...]

  • Page 362

    Extensible Firmwar e Interface Specifi cation 344 12/12/00 Version 1.02[...]

  • Page 363

    Version 1.02 12/12/00 345 D Stat us C odes EFI in terfaces return an EFI_STATUS code. Ta bles D-2, D-3, a nd D-4 list these codes for success, err ors, and wa rnings, re spectiv ely. Error codes a lso have the ir highest bit set, s o all erro r codes have nega tive va lues. The ran ge of st atus codes that have th e highes t bit se t and the nex t [...]

  • Page 364

    Extensible Firmware Interface Specifi cation 346 12/12/00 Version 1.02 Table D-3. E FI_STATUS Error Codes (High bit set) (continu ed) Mnemonic Value Description EFI_NOT_READY 6 There is no data p ending upon return. EFI_DEVICE_ERRO R 7 The physic al device repor ted an err or while attem pting the operation. EFI_WRITE_PROTECTED 8 The device c annot[...]

  • Page 365

    Version 1.02 12/12/00 347 E Alphabetic Function Lists This append ix contain s two tables tha t list a ll EFI f unction s alphabet ically. Tab le E-1 lis ts the functions i n pure alphab etic order. Fun ctions tha t have the sam e name can b e distingu ished by the associated service or protocol (column 2). F or exa mple, there ar e two “Flu sh?[...]

  • Page 366

    Extensible Firmware Interface Specifi cation 348 12/12/00 Version 1.02 Table E-1. Functions Listed in Alphabetic Order (con tinued) Function Name Service or Protocol Sub-Service Function Descript ion EFI_PXE_BASE_CODE_CAL LBACK PXE Base Code Protocol Callback func tion that is invok ed when the PXE Base Cod e Protocol is wai ting for an ev ent. EFI[...]

  • Page 367

    Alphabetic Function L ists Version 1.02 12/12/00 349 Table E-1. Functions Listed in Alphabetic Order (con tinued) Function Name Service or Protocol Sub-Service Function Descript ion GetTime Runtime Services Time Servic es Returns the curr ent time and dat e, and the time-k eeping c apabilities of the platform . GetVariable Runtime Servic es Variabl[...]

  • Page 368

    Extensible Firmware Interface Specifi cation 350 12/12/00 Version 1.02 Table E-1. Functions Listed in Alphabetic Order (con tinued) Function Name Service or Protocol Sub-Service Function Descript ion MetaiMatc h Unicode Collat ion Protocol Performs a c ase insensitiv e comparis on between a U nicode pattern string and a Unicode string. Mtftp PXE Ba[...]

  • Page 369

    Alphabetic Function L ists Version 1.02 12/12/00 351 Table E-1. Functions Listed in Alphabetic Order (con tinued) Function Name Service or Protocol Sub-Service Function Descript ion ReinstallPr otocolInterf ace Boot Services Protocol Handler Services Replaces a pr otocol interface. Reset Block I/O Protocol Resets the block device hardware. Reset Se[...]

  • Page 370

    Extensible Firmware Interface Specifi cation 352 12/12/00 Version 1.02 Table E-1. Functions Listed in Alphabetic Order (con tinued) Function Name Service or Protocol Sub-Service Function Descript ion SetTime Runtime Serv ices Time Services Sets the c urrent local time and date information. SetTimer Boot Services Event Services Sets an event to be s[...]

  • Page 371

    Alphabetic Function L ists Version 1.02 12/12/00 353 Table E-1. Functions Listed in Alphabetic Order (con tinued) Function Name Service or Protocol Sub-Service Function Descript ion StrLwr Unicode Col lation Protocol Converts all t he Unico de characters in a Null-term inated Unicode strin g to lower c ase Unicode charac ters. StrToFat Unicode Coll[...]

  • Page 372

    Extensible Firmware Interface Specifi cation 354 12/12/00 Version 1.02 Table E-2. Functions Listed Alphabetically Within Service or Protocol Service or Prot ocol Function Function Description Block I/O Protoc ol FlushBloc ks Flushes any cached b lo cks. ReadBlocks Reads the requeste d number of blo cks fro m the d evice . Reset Resets the bl ock de[...]

  • Page 373

    Alphabetic Function L ists Version 1.02 12/12/00 355 Table E-2. Functions Listed Alphabetically Within Service or Protocol (continued) Service or Prot ocol Function Function Description Boot Services (cont.) Stall Stalls the proces sor. StartImage Function to trans fer control to the Image ’ s entry point. UninstallPr otocolInterf ace Removes a p[...]

  • Page 374

    Extensible Firmware Interface Specifi cation 356 12/12/00 Version 1.02 Table E-2. Functions Listed Alphabetically Within Service or Protocol (continued) Service or Prot ocol Function Function Description PXE Base Code Protocol Arp Uses the ARP protoc ol to resolv e a MAC addres s. Dhcp Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / requ[...]

  • Page 375

    Alphabetic Function L ists Version 1.02 12/12/00 357 Table E-2. Functions Listed Alphabetically Within Service or Protocol (continued) Service or Prot ocol Function Function Description Serial I/O Protoc ol GetControl Reads the stat us of the c ontrol bits on a serial device. Read Receives a buffer of c haracters fr om a serial dev ice. Reset Reset[...]

  • Page 376

    Extensible Firmware Interface Specifi cation 358 12/12/00 Version 1.02 Table E-2. Functions Listed Alphabetically Within Service or Protocol (continued) Service or Prot ocol Function Function Description Simple Text Out put Protocol ClearScreen Clears the screen w ith the curren tly set bac kground colo r. EnableCurs or Turns the visibility o f the[...]

  • Page 377

    Version 1.02 12/12/00 359 F Glossary _ADR A reserved nam e in ACPI name spac e. It ref ers to an ad dress on a bus that h as standar d enumerati on. An exam ple would be PCI , where the enum eratio n method is de scribed in the PCI Local Bus spec ificat ion. _CRS A reserved nam e in ACPI name spac e. It ref ers to the c urrent r esource se tting of[...]

  • Page 378

    Extensible Firmware Interface Specifi cation 360 12/12/00 Version 1.02 BIOS Boot Specifica tion Device Pa th A Device Path that is use d to point to boot legacy opera ting system s; it is b ased on the BIOS Boot Specif ication, Versi on 1.01. BIOS Paramet er Block (BPB) The firs t block (se ctor) of a part ition. I t defines th e type and lo cation[...]

  • Page 379

    Glossary Version 1.02 12/12/00 361 Boot Services Ti me The period of tim e between p latform initialization a nd the c all to ExitBootServices() . During th is tim e, EFI driv ers and applica tions are loaded iterativ ely and the sy stem boots from an ord ered lis t of EFI OS loade rs. BPB See BIOS Para meter Block . CIM See Comm on I nf ormat i on[...]

  • Page 380

    Extensible Firmware Interface Specifi cation 362 12/12/00 Version 1.02 Desktop Management Task F orce (DMTF ) The DMTF is a standards org anizat ion compri sed of com panies from all areas o f the computer i ndustry. I ts purpose is to crea te the stan dards and in frastruc ture for c ost- effectiv e manag ement of PC syst ems. Device Hand le A han[...]

  • Page 381

    Glossary Version 1.02 12/12/00 363 DMTF See Desktop M anagement Task Force . Dynamic Host Con figuration P rotocol (DHCP) A protocol that is us ed to get i nform ation from a config uration se rver. DHCP is defined by the Desktop Mana gement Task Force , not EFI . EFI Ap plication Modular code tha t may be loaded in the boot services env ironment t[...]

  • Page 382

    Extensible Firmware Interface Specifi cation 364 12/12/00 Version 1.02 Event An EFI data stru cture tha t describ es an “ ev ent ” — for example, t he expira tion of a timer. Event Servi ces The set of functions used to m anage events. I ncludes CheckEvent() , CreateEvent() , CloseEvent() , SignalEvent() , and WaitForEvent() . FAT See File Al[...]

  • Page 383

    Glossary Version 1.02 12/12/00 365 GUID Pa rtition Ta ble Hea der Th e head er in a GUID Pa rtition Tab le . Among other things, it c ontains th e number of partition entries in the tab le and th e first and l ast block s that can be used fo r the entr ies. GUID Partition Entry A dat a str uctu re t hat char ac terize s a GUID Part ition . Am ong o[...]

  • Page 384

    Extensible Firmware Interface Specifi cation 366 12/12/00 Version 1.02 Intel I tanium Arch itecture A new Intel arc hitectur e that has 6 4-bit ins truction capabiliti es, new perform ance- enhancing features, and support for the I A-32 inst ruction se t. This a rchitec ture is describ ed in the IA -64 Archite cture So ftware Develo per ’ s Manua[...]

  • Page 385

    Glossary Version 1.02 12/12/00 367 MCA See Machin e Check Abort . Media Devi ce Path A Device Path that is use d to descr ibe the por tion of a medium that is be ing abstracte d by a boot serv ice. For example, a Media Device Pa th could def ine which par tition on a hard drive was being used. Memory Alloc ation Services The set of functions used t[...]

  • Page 386

    Extensible Firmware Interface Specifi cation 368 12/12/00 Version 1.02 NBP See Network Boot Program . Network Boot Program A remote boot imag e downloaded by a PXE client using the Triv ial File Trans fer Protocol or the Mult icast T rivial File T rans fer Protoco l . Page Memo ry A set of cont iguous pag es. Page m emory is alloc ated by AllocateP[...]

  • Page 387

    Glossary Version 1.02 12/12/00 369 Protocol Hand ler Services The set of functions used to m anipulate ha ndles, prot ocols, and pr otocol in terfaces. Includes InstallProtocolInterface() , UninstallProtocolInterface() , ReInstallProtocolInterface() , HandleProtocol() , RegisterProtocolNotify() , LocateHandle() ,and LocateDevicePath() . Protocol In[...]

  • Page 388

    Extensible Firmware Interface Specifi cation 370 12/12/00 Version 1.02 Simple F ile System Protocol A component of the File Syst em Pr oto col . It prov ides a m inim al interfa ce for file- type access to a d evice. Simple In put Protocol A protocol that is us ed to obta in input from the ConsoleIn d evice. I t is one of two protocols t hat m ake [...]

  • Page 389

    Glossary Version 1.02 12/12/00 371 Sys tem P artit ion A section of a block device that is treat ed as a log ical whole. Fo r a hard disk with a legacy partition ing scheme, i t is a cont iguous groupi ng of secto rs whose start ing sector and size are defined by the Master Boot Record . For an EFI Hard Disk , it is a contiguous g rouping of sec to[...]

  • Page 390

    Extensible Firmware Interface Specifi cation 372 12/12/00 Version 1.02 Trivial F ile T ransport P rotocol (TFTP) A protocol used to downlo ad a Netw ork Boot P rogr am from a TFTP se rver. Unicode An industry standard internationa lized character set used fo r human re adable m essage display . Unicode Colla tion Protocol A protocol that is us ed d[...]

  • Page 391

    Version 1.02 12/12/00 373 G 32/64-Bit UNDI Specification G.1 Introduction This appendix defi nes the 32/64-bit H/W and S/W Universal Net work Driver Int erfaces (UNDIs) . These inter faces provi de one metho d for writ ing a network d river; o ther implem entations are possible. NOTE This is the Be ta-1 ve rsion of th e 32/64-b it UNDI Specific ati[...]

  • Page 392

    Extensible Firmwar e Interface Specifi cation 374 12/12/00 Version 1.02 Table G-1. Definitions (continued) Term Definition PXE Preboot Execution Environm ent The complet e PXE specificat ion covers thre e areas; the c lient, the network and t he server. Client • Mak es network dev ices into bo otable dev ices. • Provides APIs for PXE protocol m[...]

  • Page 393

    32/64-bit UNDI Specification Version 1.02 12/12/00 375 Table G- 2. Referenced Specifi cation ( continu ed) Acronym Protocol/Specification BOOTP Bootstrap Protocol – http://www.ietf.org/rfc/rfc0951.txt - This refer ence is included for backward co mpatibili ty. BC protocol su pports DHCP and BOOTP. Required readin g for those implement ing the BC [...]

  • Page 394

    Extensible Firmwar e Interface Specifi cation 376 12/12/00 Version 1.02 Table G- 2. Referenced Specifi cation ( continu ed) Acronym Protocol/Specification TCP Transmission Control Protoc ol TCPv4: http://www.ietf.org/rfc/rfc0793.txt TCPv6: ftp://ftp.i pv6.org/pub/r fc/rfc2147.tx t Required readin g for those implementing the BC protocol . TFTP Triv[...]

  • Page 395

    32/64-bit UNDI Specification Version 1.02 12/12/00 377 Table G-3. Driver Ty pes: Pros and Cons Driver Pro Con Custom • Can be very fas t and effic ient. NIC vendor tu nes driver t o OS & device. • OS v endor does not h ave to write NIC driver. • New driv er for each OS /architecture m ust be maintained by NIC v endor. • OS v endor must [...]

  • Page 396

    Extensible Firmwar e Interface Specifi cation 378 12/12/00 Version 1.02 G.2 Overview There are three major design changes between this specific ation and the 16-bit UNDI in versi on 2.1 of the PX E Specif ication: • A new arch itectur al hardware interfac e has been adde d. • All UNDI c ommands use t he same command form at. • BC is no longer[...]

  • Page 397

    32/64-bit UNDI Specification Version 1.02 12/12/00 379 The !PXE str ucture for S/W UNDI ca n be loaded into system memory fr om one of three places; ROM on a NIC, syste m non-volatil e storage, o r external storage. S ince th ere are no d irect me mory or I/O ports available in the S/W UNDI !PXE structure, an indirect calla ble entry point is provi[...]

  • Page 398

    Extensible Firmwar e Interface Specifi cation 380 12/12/00 Version 1.02 Table G-4. !PXE Structure Field Definitions (continued) Identifier Value Description Implementat ion Varies Ident ifies type of UNDI (S/W or H/W, 32 b it or 64 bit) a nd what f eatures hav e been imp lemented. The implem entation bits are def ined below. U ndefine d bits mus t [...]

  • Page 399

    32/64-bit UNDI Specification Version 1.02 12/12/00 381 Table G-4. !PXE Structure Field Definitions (continued) Identifier Value Description Status Varies UNDI operation, com mand and interrupt stat us fla gs. This is a re ad-only port. Undefine d status bits must be s et to zero. Rea ding this port does NOT clear t he status . Bit 0x00 : Comm and c[...]

  • Page 400

    Extensible Firmwar e Interface Specifi cation 382 12/12/00 Version 1.02 Table G-4. !PXE Structure Field Definitions (continued) Identifier Value Description S/W UNDI Fields EntryPoint Varies S/W UNDI API entry p oint addr ess. This is either a v irtual addres s or an offset from the start of the !PXE struc ture. Protoco l drivers will push the 64-b[...]

  • Page 401

    32/64-bit UNDI Specification Version 1.02 12/12/00 383 G.2.1.1 Issuing UNDI Commands How comman ds are written and st atus is checked var ies a little depending on the type of UNDI (H/W or S /W) implement ation being used. The com mand flowch art below is a h igh level d iagram on how commands are written to both H/W and S/W UNDI. Step 1. Fill in C[...]

  • Page 402

    Extensible Firmwar e Interface Specifi cation 384 12/12/00 Version 1.02 G.2.2 UNDI Command Format The format of the CDB i s the same for all UNDI commands. Some of the c ommands do not use or always requ ire the use o f all of th e fields in t he CDB. When fie lds are not used they must be initia lized to zer o or the UNDI will return an error. The[...]

  • Page 403

    32/64-bit UNDI Specification Version 1.02 12/12/00 385 Table G-5. UNDI CDB Field Definitions (cont inued) Identifier Description CPBsize Command P arameter B lock Size This field s hould be s et to a num ber that is e qual to the number of by tes that w ill be read from CPB struc ture during com mand executi on. Setti ng this fie ld to a num ber th[...]

  • Page 404

    Extensible Firmwar e Interface Specifi cation 386 12/12/00 Version 1.02 Table G-5. UNDI CDB Field Definitions (cont inued) Identifier Description IFnum Interface Number This field is used to identify which network adapter (S/W UNDI) or network connector (H/W UNDI) this comm and is being s ent to. If a n invalid interface num ber is giv en, the comm[...]

  • Page 405

    32/64-bit UNDI Specification Version 1.02 12/12/00 387 G.3.1.3 PXE_BUSTYPE Used to conv ert a 4-cha racter A SCII id entifier to a 32-bit uns igned in teger. #if PXE_INTEL_ORDER # define PXE_BUSTYPE(a,b,c,d) ((((PXE_UINT32)(d) & 0xFF) << 24) | (((PXE_UINT32)(c) & 0xFF) << 16) | (((PXE_UINT32)(b) & 0xFF) << 8) | [...]

  • Page 406

    Extensible Firmwar e Interface Specifi cation 388 12/12/00 Version 1.02 G.3.1.4 PXE_SWAP_UINT16 This macro sw aps byte s in a 16 -bit word. #ifdef PXE_INTEL_ORDER # define PXE_SWAP_UINT16(n) ((((PXE_UINT16)(n) & 0x00FF) << 8) | (((PXE_UINT16)(n) & 0xFF00) >> 8)) #else # define PXE_SWAP_UINT16(n) (n) #endif G.3.1.5 PXE_SWAP_U[...]

  • Page 407

    32/64-bit UNDI Specification Version 1.02 12/12/00 389 G.3.1.6 PXE_SWAP_UINT64 This macro sw aps byte s in a 64 -bit word fo r compile rs tha t support 64 -bit words. #if PXE_UINT64_SUPPORT != 0 # ifdef PXE_INTEL_ORDER # define PXE_SWAP_UINT64(n) ((((PXE_UINT64)(n) & 0x00000000000000FF) << 56) | (((PXE_UINT64)(n) & 0x000000000000F[...]

  • Page 408

    Extensible Firmwar e Interface Specifi cation 390 12/12/00 Version 1.02 G.3.2 Miscellaneous Macros G.3.2.1 Miscellaneous #define PXE_CPBSIZE_NOT_USED 0 // zero #define PXE_DBSIZE_NOT_USED 0 // zero #define PXE_CPBADDR_NOT_USED (PXE_UINT64)0 // zero #define PXE_DBADDR_NOT_USED (PXE_UINT64)0 // zero G.3.3 Portability Types The examples given below a [...]

  • Page 409

    32/64-bit UNDI Specification Version 1.02 12/12/00 391 G.3.3.3 PXE_VOID The void type doe s not alloc ate stor age. This typ e is used onl y to protot ype function s that do no t return a ny inform ation and/o r do not tak e any param eters. typedef void PXE_VOID; G.3.3.4 PXE_UINT8 Unsigned 8-bi t integ er. typedef unsigned char PXE_UINT8; G.3.3.5 [...]

  • Page 410

    Extensible Firmwar e Interface Specifi cation 392 12/12/00 Version 1.02 G.3.4 Simple Types The PXE simple types are de fined us ing one o f the porta bility types from the previou s section. G.3.4.1 PXE_BOOL Boolean (true /false) dat a type. For PXE ze ro is a lways false and non-zero is always true. typedef PXE_UINT8 PXE_BOOL; #define PXE_FALSE 0 [...]

  • Page 411

    32/64-bit UNDI Specification Version 1.02 12/12/00 393 // Change the UNDI operational state from Initialized to Started. #define PXE_OPCODE_SHUTDOWN 0x0007 // Read & change state of external interrupt enables. #define PXE_OPCODE_INTERRUPT_ENABLES 0x0008 // Read & change state of packet receive filters. #define PXE_OPCODE_RECEIVE_FILTERS 0x0[...]

  • Page 412

    Extensible Firmwar e Interface Specifi cation 394 12/12/00 Version 1.02 G.3.4.3 PXE_OPFLAGS typedef PXE_UINT16 PXE_OPFLAGS; #define PXE_OPFLAGS_NOT_USED 0x0000 //******************************************************* // UNDI Get State //******************************************************* // No OpFlags //****************************************[...]

  • Page 413

    32/64-bit UNDI Specification Version 1.02 12/12/00 395 //******************************************************* // UNDI Initialize //******************************************************* #define PXE_OPFLAGS_INITIALIZE_CABLE_DETECT_MASK 0x0001 #define PXE_OPFLAGS_INITIALIZE_DETECT_CABLE 0x0000 #define PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE 0x[...]

  • Page 414

    Extensible Firmwar e Interface Specifi cation 396 12/12/00 Version 1.02 // Enable receive interrupts. An external interrupt will be // generated after a complete non-error packet has been received. #define PXE_OPFLAGS_INTERRUPT_RECEIVE 0x0001 // Enable transmit interrupts. An external interrupt will be // generated after a complete non-error packet[...]

  • Page 415

    32/64-bit UNDI Specification Version 1.02 12/12/00 397 #define PXE_OPFLAGS_RECEIVE_FILTER_OPMASK 0xC000 #define PXE_OPFLAGS_RECEIVE_FILTER_ENABLE 0x8000 #define PXE_OPFLAGS_RECEIVE_FILTER_DISABLE 0x4000 #define PXE_OPFLAGS_RECEIVE_FILTER_READ 0x0000 // To reset the contents of the multicast MAC address filter list, // set this OpFlag: #define PXE_O[...]

  • Page 416

    Extensible Firmwar e Interface Specifi cation 398 12/12/00 Version 1.02 // Enable promiscuous packet receiving. All packets will be // received. #define PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008 // Enable promiscuous multicast packet receiving. All multicast // packets will be received. #define PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010 //[...]

  • Page 417

    32/64-bit UNDI Specification Version 1.02 12/12/00 399 // UNDI NvData //******************************************************* // Select the type of non-volatile data operation. #define PXE_OPFLAGS_NVDATA_OPMASK 0x0001 #define PXE_OPFLAGS_NVDATA_READ 0x0000 #define PXE_OPFLAGS_NVDATA_WRITE 0x0001 //*************************************************[...]

  • Page 418

    Extensible Firmwar e Interface Specifi cation 400 12/12/00 Version 1.02 // UNDI Transmit //******************************************************* // S/W UNDI only. Return after the packet has been transmitted. // A transmit complete interrupt will still be generated and the // transmit buffer will have to be recycled. #define PXE_OPFLAGS_SWUNDI_TR[...]

  • Page 419

    32/64-bit UNDI Specification Version 1.02 12/12/00 401 #define PXE_STATFLAGS_COMMAND_QUEUED 0x4000 //******************************************************* // UNDI Get State //******************************************************* #define PXE_STATFLAGS_GET_STATE_MASK 0x0003 #define PXE_STATFLAGS_GET_STATE_INITIALIZED 0x0002 #define PXE_STATFLAGS_[...]

  • Page 420

    Extensible Firmwar e Interface Specifi cation 402 12/12/00 Version 1.02 //******************************************************* // UNDI Shutdown //******************************************************* // No additional StatFlags //******************************************************* // UNDI Interrupt Enables //********************************[...]

  • Page 421

    32/64-bit UNDI Specification Version 1.02 12/12/00 403 // If set, all multicast packets will be received. #define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010 //******************************************************* // UNDI Station Address //******************************************************* // No additional StatFlags //*****************[...]

  • Page 422

    Extensible Firmwar e Interface Specifi cation 404 12/12/00 Version 1.02 // If set, at least one receive interrupt occurred. #define PXE_STATFLAGS_GET_STATUS_RECEIVE 0x0001 // If set, at least one transmit interrupt occurred. #define PXE_STATFLAGS_GET_STATUS_TRANSMIT 0x0002 // If set, at least one command interrupt occurred. #define PXE_STATFLAGS_GE[...]

  • Page 423

    32/64-bit UNDI Specification Version 1.02 12/12/00 405 G.3.4.5 PXE_STATCODE typedef PXE_UINT16 PXE_STATCODE; #define PXE_STATCODE_INITIALIZE 0x0000 //******************************************************* // Common StatCodes returned by all UNDI commands, UNDI protocol // functions and BC protocol functions. //*************************************[...]

  • Page 424

    Extensible Firmwar e Interface Specifi cation 406 12/12/00 Version 1.02 G.3.4.6 PXE_IFNUM typedef PXE_UINT16 PXE_IFNUM; // This interface number must be passed to the S/W UNDI Start // command. #define PXE_IFNUM_START 0x0000 // This interface number is returned by the S/W UNDI Get State and // Start commands if information in the CDB, CPB or DB is [...]

  • Page 425

    32/64-bit UNDI Specification Version 1.02 12/12/00 407 G.3.4.8 PXE_FRAME_TYPE typedef PXE_UINT8 PXE_FRAME_TYPE; #define PXE_FRAME_TYPE_NONE 0x00 #define PXE_FRAME_TYPE_UNICAST 0x01 #define PXE_FRAME_TYPE_BROADCAST 0x02 #define PXE_FRAME_TYPE_FILTERED_MULTICAST 0x03 #define PXE_FRAME_TYPE_PROMISCUOUS 0x04 #define PXE_FRAME_TYPE_PROMISCUOUS_MULTICAST[...]

  • Page 426

    Extensible Firmwar e Interface Specifi cation 408 12/12/00 Version 1.02 G.3.4.12 PXE_IFTYPE The interfa ce type is returned by the Get I nitiali zation In formatio n command a nd is used by the BC DHCP protocol func tion. This f ield is also u sed for th e low order 8-bi ts of th e H/W type f ield in ARP packets. The hig h order 8-b its of the H /W[...]

  • Page 427

    32/64-bit UNDI Specification Version 1.02 12/12/00 409 G.3.5 Compound Types All PXE s tructu res must b e byte p acked. G.3.5.1 PXE_HW_UND I This sect ion defines t he C structures and #defines for the ! PXE H/W UNDI interfa ce. #pragma pack(1) typedef struct s_pxe_hw_undi { PXE_UINT32 Signature; // PXE_ROMID_SIGNATURE PXE_UINT8 Len; // sizeof(PXE_[...]

  • Page 428

    Extensible Firmwar e Interface Specifi cation 410 12/12/00 Version 1.02 // If set, last command failed #define PXE_HWSTAT_COMMAND_FAILED 0x20000000 // If set, identifies enabled receive filters #define PXE_HWSTAT_PROMISCUOUS_MULTICAST_RX_ENABLED 0x00001000 #define PXE_HWSTAT_PROMISCUOUS_RX_ENABLED 0x00000800 #define PXE_HWSTAT_BROADCAST_RX_ENABLED [...]

  • Page 429

    32/64-bit UNDI Specification Version 1.02 12/12/00 411 // Use these to enable/disable receive filters. #define PXE_HWCMD_PROMISCUOUS_MULTICAST_RX_ENABLE 0x00001000 #define PXE_HWCMD_PROMISCUOUS_RX_ENABLE 0x00000800 #define PXE_HWCMD_BROADCAST_RX_ENABLE 0x00000400 #define PXE_HWCMD_MULTICAST_RX_ENABLE 0x00000200 #define PXE_HWCMD_UNICAST_RX_ENABLE 0[...]

  • Page 430

    Extensible Firmwar e Interface Specifi cation 412 12/12/00 Version 1.02 PXE_UINT64 EntryPoint; // API entry point PXE_UINT8 reserved2[3]; // zero, not used PXE_UINT8 BusCnt; // number of bustypes supported PXE_UINT32 BusType[1]; // list of supported bustypes } PXE_SW_UNDI; #pragma pack() G.3.5.3 PXE_UNDI PXE_UNDI combin es both the H/W and S/W UNDI[...]

  • Page 431

    32/64-bit UNDI Specification Version 1.02 12/12/00 413 #define PXE_ROMID_IMP_64BIT_DEVICE 0x00010000 #define PXE_ROMID_IMP_FRAG_SUPPORTED 0x00008000 #define PXE_ROMID_IMP_CMD_LINK_SUPPORTED 0x00004000 #define PXE_ROMID_IMP_CMD_QUEUE_SUPPORTED 0x00002000 #define PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED 0x00001000 #define PXE_ROMID_IMP_NVDATA_SUPPORT_MASK[...]

  • Page 432

    Extensible Firmwar e Interface Specifi cation 414 12/12/00 Version 1.02 G.3.5.4 PXE_CDB PXE UNDI comma nd descriptor block. #pragma pack(1) typedef struct s_pxe_cdb { PXE_OPCODE OpCode; PXE_OPFLAGS OpFlags; PXE_UINT16 CPBsize; PXE_UINT16 DBsize; PXE_UINT64 CPBaddr; PXE_UINT64 DBaddr; PXE_STATCODE StatCode; PXE_STATFLAGS StatFlags; PXE_UINT16 IFnum;[...]

  • Page 433

    32/64-bit UNDI Specification Version 1.02 12/12/00 415 G.3.5.6 PXE_DEVICE This typedef is used to identif y the network device that is being used by the UNDI. This informat ion is return ed by the Get Con fig Info command. #pragma pack(1) typedef union pxe_device { // PCI and PC Card NICs are both identified using bus, device // and function number[...]

  • Page 434

    Extensible Firmwar e Interface Specifi cation 416 12/12/00 Version 1.02 G.4 UNDI Commands All 32/64-bit UNDI commands use the same basic command format, the CDB (Command Descriptor B lock). CDB field s that are not used by a pa rticular c ommand mu st be in itial ized to zero by th e applica tion/drive r that i s issuing th e command. All UNDI impl[...]

  • Page 435

    32/64-bit UNDI Specification Version 1.02 12/12/00 417 G.4.1 Command Linking & Queu ing When linking co mmands, the CDBs must be stored consecu tively in system me mory without any gaps in betw een. Do no t set th e Link bit in the las t CDB in the list. T he Link bit mus t be set in all other CD Bs in the list. Linke d CDBs CDB Set Link bit. C[...]

  • Page 436

    Extensible Firmwar e Interface Specifi cation 418 12/12/00 Version 1.02 Queue d CDBs 0x00 0x1F 0x40 0x5F 0x20 0x3F CDB Set Queue bit. Set Link bit. CDB Do not set Queue bit. Set Link bit. CDB Do not set Queue bit. Do not set Link bi t. Figure G-8. Queued CDBs When a comm and is qu eued a StatF lag of PXE_STATFLAG_COMMAND_QUEUED is se t (if li nked [...]

  • Page 437

    32/64-bit UNDI Specification Version 1.02 12/12/00 419 G.4.2.1 Issuing th e Command To issue a Get S tate com mand, create a CDB and f ill it in as shows i n the table be low: CDB Field How to initialize the CDB structure for a Get State command OpCode PXE_OPCODE_GET_STATE OpFlags PXE_OPFLAGS_NOT_USED CPBsize PXE_CPBSIZE_NOT_USED DBsize PXE_DBSIZE_[...]

  • Page 438

    Extensible Firmwar e Interface Specifi cation 420 12/12/00 Version 1.02 G.4.3 Start This comma nd is used to change the UNDI oper ational stat e from stopped to star ted. No other operational ch ecks are made by this command. If t his is a S/W UNDI, the Dela y() and Virt2Phys() function s will n ot be call ed by th is command . G.4.3.1 Issuing th e[...]

  • Page 439

    32/64-bit UNDI Specification Version 1.02 12/12/00 421 Preparing the CPB The CPB for the S/W UNDI Start command (shown below) must be filled in and the size and address of t he CPB must be given in the CDB. #pragma pack(1) typedef struct s_pxe_cpb_start { // PXE_VOID Delay(PXE_UINT64 microseconds); // UNDI will never request a delay smaller than 10[...]

  • Page 440

    Extensible Firmwar e Interface Specifi cation 422 12/12/00 Version 1.02 // This field can be set to zero if virtual and physical // addresses are equal. PXE_UINT64 Virt2Phys; PXE_UINT64 Mem_IO; } PXE_CPB_START; #pragma pack() #define PXE_DELAY_MILLISECOND 1000 #define PXE_DELAY_SECOND 1000000 #define PXE_IO_READ 0 #define PXE_IO_WRITE 1 #define PXE[...]

  • Page 441

    32/64-bit UNDI Specification Version 1.02 12/12/00 423 G.4.4.1 Issuing th e Command To issue a S top command, c reate a CDB and fil l it in as shows in the tab le below : CDB Field How to initialize the CDB structure for a Stop command OpCode PXE_OPCODE_STOP OpFlags PXE_OPFLAGS_NOT_USED CPBsize PXE_CPBSIZE_NOT_USED DBsize PXE_DBSIZE_NOT_USED CPBadd[...]

  • Page 442

    Extensible Firmwar e Interface Specifi cation 424 12/12/00 Version 1.02 G.4.5.1 Issuing th e Command To issue a Get Init Info c ommand, c reate a CDB and f ill it in as shows in the table below: CDB Field How to initialize the CDB structure for a Get Init Inf o command OpCode PXE_OPCODE_GET_INIT_INFO OpFlags PXE_OPFLAGS_NOT_USED CPBsize PXE_CPBSIZE[...]

  • Page 443

    32/64-bit UNDI Specification Version 1.02 12/12/00 425 DB #pragma pack(1) typedef struct s_pxe_db_get_init_info { // Minimum length of locked memory buffer that must be given to // the Initialize command. Giving UNDI more memory will // generally give better performance. // If MemoryRequired is zero, the UNDI does not need and will not // use syste[...]

  • Page 444

    Extensible Firmwar e Interface Specifi cation 426 12/12/00 Version 1.02 // Number of bytes in the NIC hardware (MAC) address. PXE_UINT16 HWaddrLen; // Maximum number of multicast MAC addresses in the multicast // MAC address filter list. PXE_UINT16 MCastFilterCnt; // Default number and size of transmit and receive buffers that // will be allocated [...]

  • Page 445

    32/64-bit UNDI Specification Version 1.02 12/12/00 427 #define PXE_MAX_TXRX_UNIT_ETHER 1500 #define PXE_HWADDR_LEN_ETHER 0x0006 #define PXE_DUPLEX_ENABLE_FULL_SUPPORTED 1 #define PXE_DUPLEX_FORCE_FULL_SUPPORTED 2 #define PXE_LOOPBACK_INTERNAL_SUPPORTED 1 #define PXE_LOOPBACK_EXTERNAL_SUPPORTED 2 G.4.6 Get Config Info This comman d is used to retrie[...]

  • Page 446

    Extensible Firmwar e Interface Specifi cation 428 12/12/00 Version 1.02 G.4.6.3 Checking Com mand Exe cution Results After co mmand execu tion comp letes, either suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Command completed suc cess fully. DB has be en written. INVALID_CDB O[...]

  • Page 447

    32/64-bit UNDI Specification Version 1.02 12/12/00 429 typedef struct s_pxe_pcc_config_info { // This is the flag field for the PXE_DB_GET_CONFIG_INFO union. // For PCC bus devices, this field is set to PXE_BUSTYPE_PCC. PXE_UINT32 BusType; // This identifies the PCC network device that this UNDI // interface is bound to. PXE_UINT16 Bus; PXE_UINT8 D[...]

  • Page 448

    Extensible Firmwar e Interface Specifi cation 430 12/12/00 Version 1.02 G.4.7 Initialize This comma nd resets the network adapter a nd initializes UNDI using the parame ters supplied in the CPB. Th e Initia lize co mmand must be issued bef ore the network a dapter can be setup to trans mit and receive p ackets. T his co mmand will not enab le the r[...]

  • Page 449

    32/64-bit UNDI Specification Version 1.02 12/12/00 431 Preparing the CPB If the MemoryRequired field retu rned in the PXE_DB_GET_INIT_INFO structur e is zero, t he Initial ize command doe s not need to be given a m emory buf fer or even a CPB structure. I f the MemoryRequired field is non -zero, the Initial ize command do es need a memory bu ffer. [...]

  • Page 450

    Extensible Firmwar e Interface Specifi cation 432 12/12/00 Version 1.02 // The following configuration parameters are optional and must // be zero to use the default values. PXE_UINT8 Duplex; PXE_UINT8 LoopBack; } PXE_CPB_INITIALIZE; #pragma pack() #define PXE_DUPLEX_DEFAULT 0x00 #define PXE_FORCE_FULL_DUPLEX 0x01 #define PXE_ENABLE_FULL_DUPLEX 0x0[...]

  • Page 451

    32/64-bit UNDI Specification Version 1.02 12/12/00 433 G.4.7.3 Checking Com mand Exe cution Results After co mmand execu tion comp letes, either suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Command c ompleted succes sfully. UNDI and network device is now initialize d. DB has [...]

  • Page 452

    Extensible Firmwar e Interface Specifi cation 434 12/12/00 Version 1.02 G.4.8 Reset This comma nd resets the network a dapter and re-initi alizes th e UNDI with the s ame parameters provided in t he Initia lize comman d. The trans mit and re ceive queue s are emptied and any pe nding interrupt s are clea red. Depend ing on th e state of the OpFlag [...]

  • Page 453

    32/64-bit UNDI Specification Version 1.02 12/12/00 435 G.4.8.3 Checking Com mand Exe cution Results After co mmand execu tion comp letes, either suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Command c ompleted succes sfully. UNDI and network device hav e been reset. Check Stat[...]

  • Page 454

    Extensible Firmwar e Interface Specifi cation 436 12/12/00 Version 1.02 G.4.9.1 Issuing th e Command To issue a S hutdown comma nd, cre ate a CDB and fi ll it in a s shown in the table b elow: CDB Field How to initialize the CDB structure for a Shutdown c ommand OpCode PXE_OPCODE_SHUTDOWN OpFlags PXE_OPFLAGS_NOT_USED CPBsize PXE_CPBSIZE_NOT_USED DB[...]

  • Page 455

    32/64-bit UNDI Specification Version 1.02 12/12/00 437 G.4.10 Interrupt Enables The Interrup t Enable s command can be use d to read and /or cha nge the cur rent ex ternal in terrupt enable sett ings. Disab ling an ex ternal i nterru pt enable p revents an externa l (hardware ) interru pt from be ing signal ed by the netwo rk devic e, interna lly t[...]

  • Page 456

    Extensible Firmwar e Interface Specifi cation 438 12/12/00 Version 1.02 G.4.10.2 Waiting for the Command t o Execute Monitor th e upper two bits (14 & 15 ) in the CDB.StatFlags field. Unt il these bi ts chan ge to report PXE_STATFLAGS_COMMAND_COMPLETE or PXE_STATFLAGS_COMMAND_FAILED , the comma nd has not been executed by the UNDI. StatFlags Re[...]

  • Page 457

    32/64-bit UNDI Specification Version 1.02 12/12/00 439 G.4.11 Receive Filters This comman d is used to read and change rece ive filt ers and, if support ed, read and ch ange the multicas t MAC a ddress fi lter li st. G.4.11.1 Issuing the Command To issue a R eceive F ilters com mand, create a C DB and fi ll it in as shows in t he table be low: CDB [...]

  • Page 458

    Extensible Firmwar e Interface Specifi cation 440 12/12/00 Version 1.02 Preparing the CPB The receive f ilter CPB is used to change th e contents mult icast MAC address f ilter lis t. To leave the multicas t MAC address filter li st unchanged, set the CDB.CPBsize field to PXE_CPBSIZE_NOT_USED and CDB.CPBaddr to PXE_CPBADDR_NOT_USED . To change th e[...]

  • Page 459

    32/64-bit UNDI Specification Version 1.02 12/12/00 441 G.4.11.3 Checking Command Exe cution Resul ts After co mmand execu tion comp letes, either suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Command com pleted succes sfully. Chec k StatFlags. D B is writt en. INVALID_CDB One [...]

  • Page 460

    Extensible Firmwar e Interface Specifi cation 442 12/12/00 Version 1.02 G.4.12 Station Address This comman d is used to get curren t station and broad cast MAC addr esses and, i f supported, to change the cur rent s tation MA C address. G.4.12.1 Issuing the Command To issue a S tation Address c ommand, c reate a CDB and f ill it in as shows in the [...]

  • Page 461

    32/64-bit UNDI Specification Version 1.02 12/12/00 443 G.4.12.2 Waiting for the Command t o Execute Monitor th e upper two bits (14 & 15 ) in the CDB.StatFlags field. Unt il these bi ts chan ge to report PXE_STATFLAGS_COMMAND_COMPLETE or PXE_STATFLAGS_COMMAND_FAILED , the comma nd has not been executed by the UNDI. StatFlags Reason COMM AND_COM[...]

  • Page 462

    Extensible Firmwar e Interface Specifi cation 444 12/12/00 Version 1.02 G.4.13 Statistics This comman d is used to read and clear the N IC traffi c statisti cs. Before us ing this co mmand chec k to see if s tatisti cs is suppo rted in the !PXE.Implementation flags . G.4.13.1 Issuing the Command To issue a S tatistics command, c reate a CD B and fi[...]

  • Page 463

    32/64-bit UNDI Specification Version 1.02 12/12/00 445 G.4.13.2 Waiting for the Command t o Execute Monitor th e upper two bits (14 & 15 ) in the CDB.StatFlags field. Unt il these bi ts chan ge to report PXE_STATFLAGS_COMMAND_COMPLETE or PXE_STATFLAGS_COMMAND_FAILED , the comma nd has not been executed by the UNDI. StatFlags Reason COMM AND_COM[...]

  • Page 464

    Extensible Firmwar e Interface Specifi cation 446 12/12/00 Version 1.02 PXE_UINT64 Data[64]; } PXE_DB_STATISTICS; // Total number of frames received. Includes frames with errors // and dropped frames. #define PXE_STATISTICS_RX_TOTAL_FRAMES 0x00 // Number of valid frames received and copied into receive // buffers. #define PXE_STATISTICS_RX_GOOD_FRA[...]

  • Page 465

    32/64-bit UNDI Specification Version 1.02 12/12/00 447 // Transmit statistics. #define PXE_STATISTICS_TX_TOTAL_FRAMES 0x0A #define PXE_STATISTICS_TX_GOOD_FRAMES 0x0B #define PXE_STATISTICS_TX_UNDERSIZE_FRAMES 0x0C #define PXE_STATISTICS_TX_OVERSIZE_FRAMES 0x0D #define PXE_STATISTICS_TX_DROPPED_FRAMES 0x0E #define PXE_STATISTICS_TX_UNICAST_FRAMES 0x[...]

  • Page 466

    Extensible Firmwar e Interface Specifi cation 448 12/12/00 Version 1.02 G.4.14 MCast IP To M AC Translate a multica st IPv4 o r IPv6 addre ss to a mul ticast MAC address. G.4.14.1 Issuing the Command To issue a MCast IP To MAC com mand, crea te a CDB and fill i t in as show s in the table below : CDB Field How to initialize the CDB structure for a [...]

  • Page 467

    32/64-bit UNDI Specification Version 1.02 12/12/00 449 G.4.14.2 Waiting for the Command t o Execute Monitor th e upper two bits (14 & 15 ) in the CDB.StatFlags field. Unt il these bi ts chan ge to report PXE_STATFLAGS_COMMAND_COMPLETE or PXE_STATFLAGS_COMMAND_FAILED , the comma nd has not been executed by the UNDI. StatFlags Reason COMM AND_COM[...]

  • Page 468

    Extensible Firmwar e Interface Specifi cation 450 12/12/00 Version 1.02 G.4.15.1 Issuing the Command To issue a NvData command, c reate a CDB and f ill it in a s shows in the table below : CDB Field How to initialize the CDB structure for a NvData command OpCode PXE_OPCODE_NVDATA OpFlags Set as needed. CPBsize sizeof(PXE_CPB_NVDATA) DBsize sizeof(P[...]

  • Page 469

    32/64-bit UNDI Specification Version 1.02 12/12/00 451 Sparse NvData CPB typedef struct s_pxe_cpb_nvdata_sparse { // NvData item list. Only items in this list will be updated. struct { // Non-volatile storage address to be changed. PXE_UINT32 Addr; // Data item to write into above storage address. union { PXE_UINT8 Byte; PXE_UINT16 Word; PXE_UINT32[...]

  • Page 470

    Extensible Firmwar e Interface Specifi cation 452 12/12/00 Version 1.02 Bulk NvData CPB // When using bulk update, the size of the CPB structure must be // the same size as the non-volatile NIC storage. typedef union u_pxe_cpb_nvdata_bulk { // Array of byte-wide data items. PXE_UINT8 Byte[n]; // Array of word-wide data items. PXE_UINT16 Word[n]; //[...]

  • Page 471

    32/64-bit UNDI Specification Version 1.02 12/12/00 453 G.4.15.3 Checking Command Exe cution Resul ts After co mmand execu tion comp letes, e ither suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Comm and completed suc cessfully . Non-volatil e data is u pdated from CPB and/or wr[...]

  • Page 472

    Extensible Firmwar e Interface Specifi cation 454 12/12/00 Version 1.02 G.4.16 Get Status This comman d retu rns the cu rrent in terrupt s tatus and/ or the tra nsmitt ed buffe r addresse s. If the current in terrupt s tatus is returne d, pending in terrupts wi ll be acknow ledged by this com mand. Transmitted bu ffer a ddresses th at are writ ten [...]

  • Page 473

    32/64-bit UNDI Specification Version 1.02 12/12/00 455 G.4.16.3 Checking Command Exe cution Resul ts After co mmand execu tion comp letes, either suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Com mand completed s uccess fully. StatFlags and/or DB are updated. INVALID_CDB One o[...]

  • Page 474

    Extensible Firmwar e Interface Specifi cation 456 12/12/00 Version 1.02 Using the DB When read ing the tr ansmitte d buffer a ddresse s there sho uld be ro om for at least one 64-bit address in the DB . Once a co mplete transm itted buffer addres s is writt en into the D B, the address is removed from the tr ansmitte d buffer queue. If the transmi [...]

  • Page 475

    32/64-bit UNDI Specification Version 1.02 12/12/00 457 G.4.17.1 Issuing the Command To issue a F ill Header co mmand, crea te a CDB and fi ll it in as show s in the table below : CDB Field How to initialize t he CDB structure for a Fill Header command OpCode PXE_OPCODE_FILL_HEADER OpFlags Set as needed. CPBsize PXE_CPB_FILL_HEADER DBsize PXE_DBSIZE[...]

  • Page 476

    Extensible Firmwar e Interface Specifi cation 458 12/12/00 Version 1.02 // Length of packet data in bytes (not including the media // header). PXE_UINT32 PacketLen; // Protocol type. This will be copied into the media header // without doing byte swapping. Protocol type numbers can be // obtained from the Assigned Numbers RFC 1700. PXE_UINT16 Proto[...]

  • Page 477

    32/64-bit UNDI Specification Version 1.02 12/12/00 459 // Number of packet fragment descriptors. PXE_UINT16 FragCnt; // Reserved, must be set to zero. PXE_UINT16 reserved; // Array of packet fragment descriptors. The first byte of the // media header is the first byte of the first fragment. struct { // Address of this packet fragment. PXE_UINT64 Fr[...]

  • Page 478

    Extensible Firmwar e Interface Specifi cation 460 12/12/00 Version 1.02 G.4.17.3 Checking Command Exe cution Resul ts After co mmand execu tion comp letes, either suc cessfully or not, the CDB.StatCode field contains th e result o f the comm and execut ion. StatCode Reason SUCCESS Com mand completed s uccess fully. Frame is re ady to tr ansmit. INV[...]

  • Page 479

    32/64-bit UNDI Specification Version 1.02 12/12/00 461 OpFlags Check the !PXE.Implementation flag s to see if the ne twork device s upport frag mente d packets. Select one o f the OpFlags below so the UNDI know s what type of CPB is being used. • PXE_OPFLAGS_TRANSMIT_WHOLE • PXE_OPFLAGS_TRANSMIT_FRAGMENTED In additi on to selecting whether or n[...]

  • Page 480

    Extensible Firmwar e Interface Specifi cation 462 12/12/00 Version 1.02 Fragmented Frame #pragma pack(1) typedef struct s_pxe_cpb_transmit_fragments { // Length of packet data in bytes (not including the media // header). PXE_UINT32 FrameLen; // Length of the media header in bytes. PXE_UINT16 MediaheaderLen; // Number of packet fragment descriptors[...]

  • Page 481

    32/64-bit UNDI Specification Version 1.02 12/12/00 463 G.4.18.2 Waiting for the Command t o Execute Monitor th e upper two bits (14 & 15 ) in the CDB.StatFlags field. Unt il these bi ts chan ge to report PXE_STATFLAGS_COMMAND_COMPLETE or PXE_STATFLAGS_COMMAND_FAILED , the comma nd has not been executed by the UNDI. StatFlags Reason COMM AND_COM[...]

  • Page 482

    Extensible Firmwar e Interface Specifi cation 464 12/12/00 Version 1.02 G.4.19 Receive When the n etwork adapt er has received a frame, this com mand is used to copy the frame into driver/app lication storag e. Once a fra me has been co pied, it i s removed from the receive queue. G.4.19.1 Issuing the Command To issue a R eceive com mand, crea te a[...]

  • Page 483

    32/64-bit UNDI Specification Version 1.02 12/12/00 465 G.4.19.2 Waiting for the Command t o Execute Monitor th e upper two bits (14 & 15 ) in the CDB.StatFlags field. Until these bits change to report PXE_STATFLAGS_COMMAND_COMPLETE or PXE_STATFLAGS_COMMAND_FAILED , the comma nd has not been executed by the UNDI. StatFlags Reason COMM AND_COMPLE[...]

  • Page 484

    Extensible Firmwar e Interface Specifi cation 466 12/12/00 Version 1.02 // Protocol type from media header. PXE_PROTOCOL Protocol; // Length of media header in received frame. PXE_UINT16 MediaHeaderLen; // Type of receive frame. PXE_FRAME_TYPE Type; // Reserved, must be zero. PXE_UINT8 reserved[7]; } PXE_DB_RECEIVE; #pragma pack() G.5 UNDI as an EF[...]

  • Page 485

    32/64-bit UNDI Specification Version 1.02 12/12/00 467 } NII_en try[n]; // the length o f this array is g iven in the N umbe rOfInterf aces fie ld } UNDI_CONFIG_TABLE; Since there can only b e one configu ration ta ble associ ated with any GUID and there c an be more than one UNDI loaded, every insta nce of UNDI must check for any previous installa[...]

  • Page 486

    Extensible Firmwar e Interface Specifi cation 468 12/12/00 Version 1.02[...]

  • Page 487

    Version 1.02 12/12/00 469 H Index _HID, 123 _UID, 123 A ACPI, 8 ACPI name space, 337 , 342 ACPI S ource Lang uage , 117 Adva nced C onf igur ati on and P ower Inte rfa ce specification, 8. See also rel ated information Alphab etic Fun ction Lists, 34 7 ANSI 3.64 t erminals, and SIMPLE_TEXT_OUTPUT, 3 34 Appli cati on, EFI, 110 ARP cache entries, 244[...]

  • Page 488

    Extensible Firmwar e Interface Specifi cation 470 12/12/00 Version 1.02 Device I/O Pr otoc ol, 137 Functi ons Alloca te Buff er ( ), 147, 150 Flush (), 149 Io(), 141 Map(), 144 Mem(), 141 Pci(), 141 PciDevicePath (), 143 Unmap(), 146 GUID, 138 Interface Structure, 138 Device I/O, overview, 13 7 Device Path for IDE di sk, 339 for leg acy floppy , 33[...]

  • Page 489

    Index Version 1.02 12/12/00 471 EFI Directory Structure, 30 6 EFI D river , 11 0, 30 5 EFI D river , def init ion of, 36 3 EFI Fi le, def init ion of, 3 63 EFI I mage , 105, 109, 305 EFI Image ha ndoff state IA-32, 115 Itanium -ba sed, 116 over view, 111 EFI Image Header, 10 9 PE32+ image fo rmat, 109 EFI Image, d efinition o f, 365 EFI OS Load er,[...]

  • Page 490

    Extensible Firmwar e Interface Specifi cation 472 12/12/00 Version 1.02 Image Services (cont.) StartI mage( ), 71 UnloadImage(), 7 2 over view, 67 images, loading, 13 implementation requireme nts gener al, 21 optional elements, 22 required elemen ts, 21, 23 informat ion, resources, 6 Intel Architecture Platform Architecture, defini tio n of, 366 in[...]

  • Page 491

    Index Version 1.02 12/12/00 473 PCANSI term inals, and SIMPLE_TEXT_OUTPUT, 3 34 PCI Ex pansi on ROM , 32 7 driver fo r EFI, 329 image types, 329 PCI Ex pansi on ROM Hea der EFI, 328 standa rd, 32 7 PE32+ image fo rmat, 109 plug a nd pla y opt io n ROMs and boot se rvice s, 14 PMBR. See Protective MBR prerequisite specifications, 8 Protective MBR, 3[...]

  • Page 492

    Extensible Firmwar e Interface Specifi cation 474 12/12/00 Version 1.02 Simple F ile S ystem Pr otoc ol, 18 7 functi ons OpenVolume(), 189 GUID, 187 Interface Structure, 187 Revisi on N umbe r, 187 Simple I np ut Protoc ol, 152, 154 Functi ons ReadDisk(), 155 ReadKeyStroke(), 156 GUID, 154 Interface Structure, 154 Scan Cod es for, 152 Simple Netw o[...]

  • Page 493

    Index Version 1.02 12/12/00 475 U UNDI Specification, 32/64-Bit, 373 Unic ode Coll ation Pr otoc ol, 225 Functi ons FatToStr(), 2 32 MetaiMatch(), 228 StriCo ll(), 227 StrLwr(), 23 0 StrToF at(), 233 StrUpr(), 2 31 GUID, 225 Interface Structure, 225 Unicode control characters, suppo rted, 152 Unic ode, de fini tion of , 372 V Variable Services func[...]

  • Page 494

    Extensible Firmwar e Interface Specifi cation 476 12/12/00 Version 1.02[...]