• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..28-Mar-2021-

AdvancedFeaturePkg/H28-Mar-2021-318281

Debugging/H28-Mar-2021-9,9426,267

Network/H28-Mar-2021-350291

OutOfBandManagement/H28-Mar-2021-4,1632,860

PowerManagement/H28-Mar-2021-392304

SystemInformation/H28-Mar-2021-1,222855

TemplateFeaturePkg/H28-Mar-2021-274224

UserInterface/H28-Mar-2021-9,9656,334

Readme.mdH A D28-Mar-202115.2 KiB239197

Readme.md

1# **EDK II Minimum Platform Firmware Advanced Features for Intel® Platforms**
2
3In the EDK II Minimum Platform, advanced features are non-essential features. Essential features are those required
4to achieve an earlier boot stage (Stage I through Stage V). The Minimum Platform boot stages are defined in the
5[EDK II Minimum Platform Draft Specification](https://edk2-docs.gitbooks.io/edk-ii-minimum-platform-specification/). A
6brief overview is also provided in the [Platform/Intel/Readme.md](https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Readme.md).
7
8An advanced feature must be implemented as highly cohesive and stand-alone software to only support a specific
9feature. Advanced features are the primary method to extend platform firmware capabilities in a modular fashion.
10
11If you would like to quickly get started creating a new advanced feature, you can jump ahead to the
12[Add New Advanced Feature Checklist](#Add-New-Advanced-Feature-Checklist) and reference other sections of this
13document as needed.
14
15## Overview
16
17### Advanced Feature Attributes
18Advanced features should be:
19* _Cohesive_, the feature should not contain any functionality unrelated to the feature.
20* _Complete_, the feature must have a complete design that minimizes dependencies. A feature package can only depend
21  on following packages:
22  * edk2 repo: `MdePkg`, `MdeModulePkg`, `UefiCpuPkg`, `FmpDevicePkg`, `SecurityPkg`, `NetworkPkg`, `ShellPkg`.
23  * edk2-platforms repo: `MinPlatformPkg`, `IntelSiliconPkg`.
24* _Easy to Integrate_, the feature should expose well-defined software interfaces to use and configure the feature.
25  * It should also present a set of simple and well-documented standard EDK II configuration options such as PCDs to
26  configure the feature.
27  * In general, features should be self-contained and started by the dispatcher. The board firmware should
28    be required to perform as few steps as possible to enable the feature.
29  * All features are required to have a feature enable PCD (`PcdFeatureEnable`). Any effort to enable the feature
30    besides this PCD should be carefully considered. Default configuration values should apply to the common case.
31* _Portable_, the feature is not allowed to depend on other advanced feature or board source code packages. For example,
32  if Feature A depends on output Feature B, a board integration module should use a generic interface in Feature A
33  to get the output and pass it to a generic interface in Feature B. Structures should not be shared between feature
34  packages. Most structures should be defined in a common package such as MdePkg if the structure is industry standard,
35  IntelSiliconPkg if the structure is specific to Intel silicon initialization, etc. Feature-specific structures are
36  of course allowed to be defined within a feature package and used by libraries and modules in that package.
37* _Self Documenting_, the feature should follow software best practices to allow others to debug the code and
38  contribute changes. In addition to source code, advanced features must have a Readme.md with sufficient
39  information for a newcomer to understand the feature.
40* _Single Instance_, the feature should not have more than one instance of a source solution. If an existing feature
41  package does not solve a specific instance of a problem for the feature, the feature package should be re-worked
42  to consider new requirements instead of duplicating feature code.
43
44  Features should be written for a specific feature technology. Outside of technology restrictions, the feature
45  should not make arbitrary assumptions about the type of board or system that may integrate the feature. Any
46  board or hardware-specific details that may vary in design should be given to the feature through a defined
47  and documented software interface.
48
49### Advanced Feature Packages
50Feature portability is a key aspect of board scalability. To maintain high cohesion within a feature package and
51reduce potential coupling between features, each feature is maintained in a dedicated package. Such encapsulation enables
52increased flexibility in implementation, rapid integration with board firmware, improved software maintenance by reducing
53coupling between features, and a better scope for feature-focused maintenance and testing over time.
54
55Two package types exist for advanced features:
56 * AdvancedFeaturePkg - A special package described further in [AdvancedFeaturePkg](#AdvancedFeaturePkg).
57 * XxxFeaturePkg - A specific feature package described further in [XxxFeaturePkg](#XxxFeaturePkg).
58
59#### AdvancedFeaturePkg
60A single package called `AdvancedFeaturePkg` exists with the following responsibilities:
611. Present a consolidated and simplified view of all available advanced features to board packages.
622. Provide a single package build for all available advanced features.
63  2.a. This can save time. Each feature package will send build output to a package-specific build output directory.
64       By building a features from a single package build object files can be reused across features.
65
66##### Template Resources
67A template for a new advanced feature package is provided in `TemplateFeaturePkg`. It is recommended to start
68a new advanced feature package using this template. The minimally required set of files for an advanced feature to
69be acceptable is defined in [Advanced Feature Collateral](#Advanced-Feature-Collateral). Apart from required files,
70the content organization within the files should follow the layout provided in the template files.
71
72##### Consolidated View of All Advanced Features to Board Packages
73A board package may consume any number of advanced features. In order to reduce the overall effort required to add
74advanced features, all available advanced features are consolidated into single includable files in `AdvancedFeaturePkg`.
75
76_DSC File_
77
78All advanced features are importable to a board package DSC file by simply including `AdvancedFeatures.dsc`.
79`AdvancedFeatures.dsc` already includes the conditional logic to only include features that are enabled by the board package.
80
81_FDF File_
82
83The EDK II Minimum Platform has two firmware volumes to contain advanced features.
84
851. `FvAdvancedPreMemory` - Contains advanced feature modules that should be dispatched before permanent memory is enabled.
86   Typically, these are PEI modules (PEIMs).
872. `FvAdvanced` - Contains advanced feature modules that do not need to be executed prior to permanent memory being
88   initialized. Typically, these are post-memory PEIMs or DXE modules.
89
90##### Single Build of All Advanced Features
91With many advanced feature packages, it is convenient to have a single build target that can build all advanced features.
92The `AdvancedFeaturePkg.dsc` enables all the advanced features for its package build.
93
94#### XxxFeaturePkg
95Each feature is maintained in its own feature package called `XxxFeaturePkg` where *Xxx* is replaced by the feature
96name.
97
98### Source Code Organization of Advanced Features
99All advanced feature code is maintained in `edk2-platforms/Features`. Features that are only tested on Intel systems
100are maintained in `edk2-platforms/Features/Intel`. These features are not intended to be constrained to Intel systems.
101
102A package resides at the root of `edk2-platforms/Features/Intel` called [AdvancedFeaturePkg](#AdvancedFeaturePkg).
103All feature packages are organized into directories by feature domain. Each feature domain directory is required to
104have a `Readme.md` that explains the scope of features for that domain. Each feature package is required to have a
105`Readme.md` that explain the feature. All feature packages are required to base their `Readme.md` on the
106[template](TemplateFeaturePkg/Readme.md) provided in `TemplateFeaturePkg`.
107
108A generic tree layout of the advanced features is illustrated below. The contents are shown at the time of writing but
109of course, are subject to change over time.
110
111  <pre>
112    WORKSPACE
113          |------edk2
114          |------edk2-non-osi
115          |------edk2-platforms
116          |       |---Features
117          |       |    |--Intel
118          |       |        |------AdvancedFeaturePkg
119          |       |        |
120          |       |        |------TemplateFeaturePkg
121          |       |        |
122          |       |        |------Debugging: Debug related advanced features
123          |       |        |       |------AcpiDebugFeaturePkg
124          |       |        |       |       |---AcpiDebugDxeSmm (module directories)
125          |       |        |       |       |---.  .  .
126          |       |        |       |       |---Include
127          |       |        |       |       |    |---AcpiDebugFeature.dsc (feature build DSC file)
128          |       |        |       |       |    |---PostMemory.fdf (post-memory feature modules)
129          |       |        |       |       |    |---PreMemory.fdf (pre-memory feature modules)
130          |       |        |       |       |    |---.  .  .
131          |       |        |       |       |---AcpiDebugFeaturePkg.dec (feature package DEC file)
132          |       |        |       |       |---AcpiDebugFeature.dsc (feature package build DSC file)
133          |       |        |       |
134          |       |        |       |------Usb3DebugFeaturePkg
135          |       |        |       |       |---.  .  .
136          |       |        |       |
137          |       |        |       |------.  .  .
138          |       |        |------Network: Network related advanced features
139          |       |        |       |------.  .  .
140          |       |        |
141          |       |        |------OutOfBandManagement: Out-of-Band Management related advanced features
142          |       |        |       |------.  .  .
143          |       |        |
144          |       |        |------PowerManagement: Power Management related advanced features
145          |       |        |       |------.  .  .
146          |       |        |
147          |       |        |------SystemInformation: System Information related advanced features
148          |       |        |       |------.  .  .
149          |       |        |
150          |       |        |------UserInterface: User Interface related advanced features
151          |       |        |       |------.  .  .
152          |       |        |
153          |------FSP
154  </pre>
155
156## Adding a New Advanced Feature
157
158### Advanced Feature Collateral
159At a minimum, an advanced feature must consist of the following elements:
1601. A feature package directory (`XxxFeaturePkg`)
1612. A `Readme.md` file in the feature package directory root to describe the feature
1623. Some advanced feature source code (e.g. a PEI or DXE module)
1634. A feature DSC file (`XxxFeaturePkg/Include/XxxFeature.dsc`)
1645. Feature pre-memory / post-memory FDF files (`XxxFeaturePkg/Include/PreMemory.fdf` & `XxxFeaturePkg/Include/PostMemory.fdf`)
1656. A feature package DSC file (`XxxFeaturePkg/XxxFeaturePkg.dsc`)
1667. A feature package DEC file (`XxxFeaturePkg/XxxFeaturePkg.dec`)
1678. A reference in the `AdvancedFeaturePkg` as described in the [checklist](#Add-New-Advanced-Feature-Checklist)
168
169### Add New Advanced Feature Checklist
1701. Check if a feature package already exists for your new feature.
171    * If it does, use the existing feature package. If changes are needed to meet your requirements, work with the
172      package maintainer to make any required updates to the existing package.
173
1742. Determine the functional domain of your feature. For example, "Debugging", "Power Management", etc. This should not be
175   very specific and abstracted so the feature is available alongside similar feature packages for the given domain. It
176   is preferred to keep the number of feature domain directories minimal but new directories can be created if needed.
177
1783. Decide on a succinct name for your feature package.
179    * The name should be descriptive enough to uniquely identify the feature from similar features in the same feature
180    domain.
181
182    * At this point, the feature package location is: `FeatureDomain/<Xxx>FeaturePkg`.
183
184    * For example, the ACPI Debug feature is located in `Debugging/AcpiDebugFeaturePkg` based on this naming pattern.
185
1864. Use the package template provided by `TemplateFeaturePkg` to create a new advanced feature package in the
187   feature location.
188
1895. Review the [advanced feature attributes](#Advanced-Feature-Attributes) to draft a feature design proposal.
190    * It is recommended to use the template in `TemplateFeaturePkg/Readme.md` to document the feature design for review.
191    Once the design review is approved, a subsequent review can be sent for the feature implementation. An advantage to
192    this approach is that the requirement to complete a Readme.md file for the feature and gain approval in a feature
193    design review are combined into a single step.
194
1956. Add the source code for the advanced feature.
196    * If the feature is large it is recommended to add libraries in one patch and then modules in a following patch.
197
1987. Update the feature DSC file. This file is in `XxxFeaturePkg/Include/XxxFeature.dsc`.
199    * In most cases, `XxxFeaturePkg/XxxFeaturePkg.dsc` should just `!include XxxFeaturePkg/Include/XxxFeature.dsc`.
200
2018. Update the feature FDF files. These files are `XxxFeaturePkg/Include/PreMemory.fdf` and
202   `XxxFeaturePkg/Include/PostMemory.fdf`.
203    * Each file should contain the feature pre-memory modules and post-memory modules respectively.
204
2059. Build the advanced feature package to ensure the build is successful:
206
207    From the workspace root:
208    1. cd edk2-platforms/edk2
209    2. Execute edksetup.bat (Windows) or edksetup.sh (Linux).
210    3. Verify the "WORKSPACE" environment variable is set to the edk2 directory in your workspace.
211    4. Set the "PACKAGES_PATH" environment variable to include the edk2-platforms/Platform/Intel, edk2-platforms/Silicon/Intel,
212       and edk2-platforms/Features/Intel directories.
213       * Windows example:
214         * set PACKAGES_PATH=c:\Edk2Workspace\edk2-platforms\Platform\Intel;
215                             c:\Edk2Workspace\edk2-platforms\Silicon\Intel;
216                             c:\Edk2Workspace\edk2-platforms\Features\Intel
217       * Linux example:
218         * export PACKAGES_PATH=~/Edk2Workspace/edk2-platforms/Platform/Intel:
219                                ~/Edk2Workspace/edk2-platforms/Silicon/Intel:
220                                ~/Edk2Workspace/edk2-platforms/Features/Intel
221    5. cd edk2-platforms/Features/Intel
222    6. <pre>build -p FeatureDomainDirectory/XxxFeaturePkg/XxxFeaturePkg.dsc -a IA32 -a X64</pre>
223
224       *Note:* -a specifies the architecture. Typically IA32 and X64 modules are built for 32-bit PEI and 64-bit
225       DXE though build for your specific requirements.
226
22710. Add the advanced feature to `AdvancedFeaturePkg` so it is available to board packages.
228    1. Add `XxxFeaturePkg/Include/XxxFeature.dsc` to `AdvancedFeatures.dsc`
229    2. Add `XxxFeaturePkg/Include/PreMemory.fdf` to `AdvancedFeaturePkg/Include/PreMemory.fdf`
230    3. Add `XxxFeaturePkg/Include/PostMemory.fdf` to `AdvancedFeaturePkg/Include/PostMemory.fdf`
231
23211. Build `AdvancedFeaturePkg` to ensure the build is successful.
233    1. Follow the steps in step #9 but change the build command to:
234
235    <pre>build -p AdvancedFeaturePkg/AdvancedFeaturePkg.dsc -a IA32 -a X64</pre>
236
23712. Before sending your patch series, ensure the `Readme.md` file in `XxxFeaturePkg` is completed so others can use it
238    during the feature review.
239