--- Begin Message ---
Caution: This message originated from an External Source. Use proper caution
when opening attachments, clicking links, or responding.
From: Abner Chang <abner.ch...@amd.com>
Add file and directory naming guidelines for EDKII modules. Also
consider the processor architecture and vendor implementation.
This is the draft version to community for the wide discussion.
PR
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore-docs%2Fedk2-CCodingStandardsSpecification%2Fpull%2F2&data=05%7C01%7Cabner.chang%40amd.com%7C9a5163b4e0724bfac5ce08daa1600fa9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637999731204161847%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=O3PPK9Mfeh5HfDb%2FR5p3aLq1dh5X0eR80HbLGHxgD%2FM%3D&reserved=0
Signed-off-by: Abner Chang <abner.ch...@amd.com>
Cc: Ray Ni <ray...@intel.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Sunil V L <suni...@ventanamicro.com>
Cc: Abdul Lateef Attar <abdat...@amd.com>
---
4_naming_conventions/42_file_names.md | 124 +++++++++++++++++++++
4_naming_conventions/46_directory_names.md | 114 +++++++++++++++++++
2 files changed, 238 insertions(+)
create mode 100644 4_naming_conventions/46_directory_names.md
diff --git a/4_naming_conventions/42_file_names.md
b/4_naming_conventions/42_file_names.md
index f948763..e7c10b5 100644
--- a/4_naming_conventions/42_file_names.md
+++ b/4_naming_conventions/42_file_names.md
@@ -58,3 +58,127 @@ regular expression:
That is, a letter followed by zero, or more, letters, underscores, dashes, or
digits followed by a period followed by one or more letters or digits.
+
+### 4.2.5 File naming guidelines for modules
+
+Below sections are the file naming guidelines for EDK II meta files and source
files.
+
+#### 4.2.5.1 EDK II meta files within a package
+
+```
+<PackageName>Pkg.dec
+<PackageName>Pkg.dsc
+
+ <PackageName> REQUIRED *
+```
+
+#### 4.2.5.2 EDK II INF file within a Module instance
+* If the implementation supports >=2 or all CPU archs:
+```
+<ModuleName><Phase>.inf
+
+ <ModuleName> REQUIRED *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
StandaloneMm,
+ Smm, Uefi.
+
+Example:
+ CpuIo2Dxe.inf
+```
+
+* If the implementation of CPU arch or vendor shares some code in the module.
Or the implementation is only for the specific CPU arch or vendor.
+```
+<ModuleName><Phase><CpuArch><Vendor>.inf
+
+ <ModuleName> REQUIRED *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
+ StandaloneMm, Smm, Uefi.
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64, LoongArch64,
Ebc, X86
+ (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+
+Example:
+ CpuIo2DxeAmd.inf
+```
+
+If the implementation does not have any shared code between phases. The module
INF is located under \<Feature\>/\<Phase\> or
\<Feature\>/<Phase\>/<CpuArch\>/<Vendor\> (see section 4.6 Directory Names).
+
+* If the implementation supports >=2 or all CPU archs:
+```
+<Feature>/<Phase>/<ModuleName>.inf
+
+ <Feature> OPTIONAL *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
StandaloneMm, Smm,
+ Uefi.
+ <ModuleName> REQUIRED Same as <Feature>
+
+Example:
+ PCD/Dxe/Pcd.inf
+```
+
+* If the implementation of CPU arch or vendor shares some code in the module.
Or the implementation is only for the specific CPU arch or vendor.
+```
+<Feature>/<Phase>/<ModuleName><CpuArch><Vendor>.inf
+
+ <Feature> OPTIONAL *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
StandaloneMm, Smm,
+ Uefi.
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64, LoongArch64,
Ebc, X86
+ (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+ <ModuleName> REQUIRED Same as <Feature>
+
+```
+#### 4.2.5.3 EDK II INF file within a Library instance
+```
+<Phase><CpuArch><Vendor><LibraryClassName><Dependency>.inf
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
+ StandaloneMm, Smm, Uefi.
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64,
LoongArch64,
+ Ebc, X86 (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+ <LibraryClassName> REQUIRED *
+ <Dependency> OPTIONAL * (Typically name of PPI, Protocol,
LibraryClass
+ that the implementation is layered on
top of)
+
+Example:
+ SmmAmdSmmCpuFeaturesLib.inf
+ SmmIntelSmmCpuFeaturesLib.inf
+```
+
+#### 4.2.5.4 EDK II source files within a Library/Module instance
+
+```
+<FileName>.c
+<FileName>.h
+<CpuArch><Vendor><FileName>.c
+<CpuArch><Vendor><FileName>.h
+<CpuArch>/<FileName>.c
+<CpuArch>/<FileName>.h
+<CpuArch>/<FileName>.nasm
+<CpuArch>/<FileName>.S
+<CpuArch>/<Vendor>/<FileName>.c
+<CpuArch>/<Vendor>/<FileName>.h
+<CpuArch>/<Vendor>/<FileName>.nasm
+<CpuArch>/<Vendor>/<FileName>.S
+
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64, LoongArch64, Ebc, X86
+ (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+
+Example:
+ IA32/SmiException.nasm
+ X64/SmiException.nasm
+ SmmCpuFeatureLib.c
+ SmmCpuFeatureLibCommon.c
+ IntelSmmCpuFeaturesLib.c
+ AmdSmmCpuFeaturesLib.c
+
+ Or,
+ X86/IA32/SmiException.nasm
+ X86/X64/SmiException.nasm
+ X86/IntelSmmCpuFeaturesLib.c
+ X86/AmdSmmCpuFeaturesLib.c
+ RiscV64/JustAnExampleLib.c
+ SmmCpuFeatureLib.c
+ SmmCpuFeatureLibCommon.c
+```
diff --git a/4_naming_conventions/46_directory_names.md
b/4_naming_conventions/46_directory_names.md
new file mode 100644
index 0000000..e4df796
--- /dev/null
+++ b/4_naming_conventions/46_directory_names.md
@@ -0,0 +1,114 @@
+<!--- @file
+ 4.6 Directory Names
+
+ Copyright (c) 2006-2017, Intel Corporation. All rights reserved.<BR>
+
+ Redistribution and use in source (original document form) and 'compiled'
+ forms (converted to PDF, epub, HTML and other formats) with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1) Redistributions of source code (original document form) must retain the
+ above copyright notice, this list of conditions and the following
+ disclaimer as the first lines of this file unmodified.
+
+ 2) Redistributions in compiled form (transformed to other DTDs, converted to
+ PDF, epub, HTML and other formats) must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS DOCUMENTATION IS PROVIDED BY TIANOCORE PROJECT "AS IS" AND ANY EXPRESS
OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL TIANOCORE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+## 4.6 Directory Names
+Below sections are the directory naming guidelines for EDK II modules
+
+#### 4.6.1 EDKII package directory
+
+```
+<PackageName>Pkg
+
+ <PackageName> REQUIRED *
+```
+
+#### 4.6.2 EDKII Module directory
+
+* If the implementation supports >=2 or all CPU archs:
+```
+<ModuleName><Phase>
+
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
StandaloneMm, Smm,
+ Uefi.
+ <ModuleName> REQUIRED *
+
+Example:
+ CpuDxe/
+```
+
+* If the implementation is for the specific CPU arch or vendor:
+```
+<ModuleName><Phase><CpuArch><Vendor>
+
+ <ModuleName> REQUIRED *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
+ StandaloneMm, Smm, Uefi.
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64, LoongArch64,
Ebc, X86
+ (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+
+Example:
+ CpuDxeRiscv64/
+```
+
+* If the implementation does not have any shared code between phases (e.g.
+MdeModulePkg/Universal/PCD) and supports >=2 or all CPU archs:
+
+```
+<Feature>/<Phase>
+
+ <Feature> OPTIONAL *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
StandaloneMm, Smm,
+ Uefi.
+
+Example:
+ Pcd/Dxe/
+```
+
+* If the implementation does not have any shared code between phases (e.g.
+MdeModulePkg/Universal/PCD) and is for the specifc CPU arch or vendor:
+```
+<Feature>/<Phase>/<CpuArch>/<Vendor>
+
+ <Feature> OPTIONAL *
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
StandaloneMm, Smm,
+ Uefi.
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64, LoongArch64,
Ebc, X86
+ (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+```
+
+#### 4.6.2 EDKII Library directory
+```
+<Phase><CpuArch><Vendor><LibraryClassName><Dependency>
+
+ <Phase> REQUIRED Base, Sec, Pei, Dxe, DxeRuntime, Mm,
+ StandaloneMm, Smm, Uefi.
+ <CpuArch> OPTIONAL Ia32, X64, Arm, AArch64, RiscV64,
LoongArch64,
+ Ebc, X86 (X86 implies Ia32 and X64).
+ <Vendor> OPTIONAL *
+ <LibraryClassName> REQUIRED *
+ <Dependency> OPTIONAL * (Typically name of PPI, Protocol,
LibraryClass
+ that the implementation is layered on
top of).
+
+Example:
+ SmmAmdSmmCpuFeaturesLib/
+```
--
2.37.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94466):
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F94466&data=05%7C01%7Cabner.chang%40amd.com%7C9a5163b4e0724bfac5ce08daa1600fa9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637999731204161847%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KKnHsum9mc679b06mYD6s83ovN37LAulBdctW3pT86I%3D&reserved=0
Mute This Topic:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F93974077%2F7039027&data=05%7C01%7Cabner.chang%40amd.com%7C9a5163b4e0724bfac5ce08daa1600fa9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637999731204161847%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lpbs%2B0DO5HZJzktqu6juC%2FW%2BAOYyqJsOQg9lSe%2FUwRI%3D&reserved=0
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=05%7C01%7Cabner.chang%40amd.com%7C9a5163b4e0724bfac5ce08daa1600fa9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637999731204161847%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1grbxhLEwUuA%2BbEPu3%2BCEk5p4B4L5czqP%2FAIVhTVOhE%3D&reserved=0
[abner.ch...@amd.com]
-=-=-=-=-=-=-=-=-=-=-=-
--- End Message ---