From 3c8c53ca3aa0309d9a8edc42e5b3520eed7f2b4f Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Mon, 28 Mar 2022 11:27:31 +0300 Subject: Formatting fixes to lesson 72 readme Signed-off-by: Konstantin Aladyshev --- Lessons/Lesson_72/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'Lessons/Lesson_72') diff --git a/Lessons/Lesson_72/README.md b/Lessons/Lesson_72/README.md index 3d3de24..b28e0ea 100644 --- a/Lessons/Lesson_72/README.md +++ b/Lessons/Lesson_72/README.md @@ -6,7 +6,7 @@ For example it can help to display things like: - currently present memory - ... -All these things are determined in the UEFI boot process, and can differ from boot to boot depending on the current hardware configuration. Therefore if you want to add such information to the HII Forms you need to do it dynamically. +All these things are determined in the UEFI boot process and can differ from boot to boot depending on the current hardware configuration. Therefore if you want to add such information to the HII Forms you need to do it dynamically. For this operation EDKII uses labels mechanics. @@ -131,7 +131,7 @@ All this code would give us this form: Now let's try add content dynamically to our form. -Add 2 `label` elements to our form in `UefiLessonsPkg/HIIFormDataElements/Form.vfr`: +Add two `label` elements to our form in `UefiLessonsPkg/HIIFormDataElements/Form.vfr`: ``` formset guid = FORMSET_GUID, @@ -147,7 +147,7 @@ formset endformset; ``` -These two elements define a start and end of the section for the dynamic content. +These two elements define the start and the end of the section for the dynamic content. Values under `LABEL_START` and `LABEL_END` are just `UINT16` numbers. Place some defines for them to the `UefiLessonsPkg/HIIFormDataElements/Data.h`: ``` @@ -245,7 +245,7 @@ typedef struct _EFI_IFR_GUID_LABEL { # C code -To insert content from the C code into section defined by labels we need to utilize `HiiUpdateForm` function from the `HiiLib` +To insert content from the C code into the section defined by labels we need to utilize `HiiUpdateForm` function from the `HiiLib` https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Include/Library/HiiLib.h @@ -313,8 +313,8 @@ HiiUpdateForm ( ``` As you can see this function needs two opcode handles: -- `StartOpCodeHandle` - handle that contains IFR that marks a start of a replace section + all the opcodes that are needed to be inserted, -- `EndOpCodeHandle` - handle that contains IFR that marks an end of a replace section +- `StartOpCodeHandle` - handle to opcode buffer that contains IFR that marks a start of a replace section + all the opcodes that are needed to be inserted, +- `EndOpCodeHandle` - handle to opcode buffer that contains IFR that marks an end of a replace section How to create these OpCode Handles? `HiiLib` has a special function for that: @@ -332,7 +332,7 @@ HiiAllocateOpCodeHandle ( ); ``` -The important thing to note here, is that this function doesn't accept any size. Because in this operation the buffer is always fixed. `HiiAllocateOpCodeHandle` returns a pointer to the newly allocated structure `HII_LIB_OPCODE_BUFFER` that is defined as follow: +The important thing to note here is that this function doesn't accept any size. Because in this operation the buffer is always fixed. `HiiAllocateOpCodeHandle` returns a pointer to the newly allocated structure `HII_LIB_OPCODE_BUFFER` that is defined as follow: ``` #define HII_LIB_OPCODE_ALLOCATION_SIZE 0x200 // (=512) @@ -345,7 +345,7 @@ typedef struct { All our dynamically allocated opcodes should fit into the preallocated buffer. -Off course we need to free all the buffers allocated with `HiiAllocateOpCodeHandle`: +Off course we need to free all the buffers allocated with the `HiiAllocateOpCodeHandle`: ``` /** @@ -418,7 +418,7 @@ HiiCreateGuidOpCode ( ) ``` -This function returns a pointer to the opcode buffer. In our case it is a buffer for the `EFI_IFR_GUID_LABEL` opcode. So we need to cast the buffer to the `EFI_IFR_GUID_LABEL` structure and fill it with correct data. If `HiiCreateGuidOpCode` returns `NULL` we need to report an error and free all the previously allocated resources: +This function returns a pointer to the opcode buffer. In our case it is a buffer that starts with a `EFI_IFR_GUID_LABEL` opcode. So we need to cast the buffer to the `EFI_IFR_GUID_LABEL` structure and fill it with correct data. If `HiiCreateGuidOpCode` returns `NULL` we need to report an error and free all the previously allocated resources: ``` EFI_IFR_GUID_LABEL* StartLabel = (EFI_IFR_GUID_LABEL*) HiiCreateGuidOpCode(StartOpCodeHandle, &gEfiIfrTianoGuid, @@ -454,7 +454,7 @@ As we are using `gEfiIfrTianoGuid` here, don't forget to add `#include