2019-03-26 16:08:06 +01:00
|
|
|
## @file
|
|
|
|
# Dsc file for Dynamic Tables Framework.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2019, Linaro Limited. All rights reserved.<BR>
|
DynamicTablesPkg: Add SMBIOS String table helper library
The Section 6.1.3, SMBIOS specification version 3.6.0 describes the
handling of test strings in SMBIOS tables.
Text strings are added at the end of the formatted portion of the SMBIOS
structure and are referenced by index in the SMBIOS structure.
Therefore, introduce a SmbiosStringTableLib to simplify the publishing
of the string set.
SmbiosStringTableLib introduces a concept of string table which records
the references to the SMBIOS strings as they are added and returns an
string reference which is then assigned to the string field in the
formatted portion of the SMBIOS structure. Once all strings are added,
the library provides an interface to get the required size for the string
set. This allows sufficient memory to be allocated for the SMBIOS table.
The library also provides an interface to publish the string set in
accordance with the SMBIOS specification.
Example:
EFI_STATUS
BuildSmbiosType17Table () {
STRING_TABLE StrTable;
UINT8 DevLocatorRef;
UINT8 BankLocatorRef;
SMBIOS_TABLE_TYPE17 *SmbiosRecord;
CHAR8 *StringSet;
...
// Initialize string table for 7 strings
StringTableInitialize (&StrTable, 7);
StringTableAddString (&StrTable, "SIMM 3", &DevLocatorRef);
StringTableAddString (&StrTable, "Bank 0", &BankLocatorRef);
...
SmbiosRecord = AllocateZeroPool (
sizeof (SMBIOS_TABLE_TYPE17) +
StringTableGetStringSetSize (&StrTable)
);
...
SmbiosRecord->DeviceLocator = DevLocatorRef;
SmbiosRecord->BankLocator = BankLocatorRef;
...
// get the string set area
StringSet = (CHAR8*)(SmbiosRecord + 1);
// publish the string set
StringTablePublishStringSet (
&StrTable,
StringSet,
StringTableGetStringSetSize (&StrTable)
);
// free string table
StringTableFree (&StrTable);
return EFI_SUCCESS;
}
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Girish Mahadevan <gmahadevan@nvidia.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Cc: William Watson <wwatson@nvidia.com>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
2022-09-08 19:35:50 +02:00
|
|
|
# Copyright (c) 2019 - 2022, Arm Limited. All rights reserved.<BR>
|
2019-03-26 16:08:06 +01:00
|
|
|
#
|
2019-09-18 22:40:42 +02:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
2019-03-26 16:08:06 +01:00
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
[Defines]
|
|
|
|
PLATFORM_NAME = DynamicTables
|
|
|
|
PLATFORM_GUID = f39096a0-7a0a-442a-9413-cf584ef80cbb
|
|
|
|
PLATFORM_VERSION = 0.1
|
|
|
|
DSC_SPECIFICATION = 0x0001001a
|
|
|
|
OUTPUT_DIRECTORY = Build/DynamicTables
|
|
|
|
SUPPORTED_ARCHITECTURES = ARM|AARCH64
|
|
|
|
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
|
|
|
|
SKUID_IDENTIFIER = DEFAULT
|
|
|
|
|
|
|
|
!include DynamicTables.dsc.inc
|
|
|
|
|
2021-03-12 06:16:13 +01:00
|
|
|
!include MdePkg/MdeLibs.dsc.inc
|
|
|
|
|
2019-03-26 16:08:06 +01:00
|
|
|
[LibraryClasses]
|
|
|
|
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
|
|
|
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
|
|
|
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
|
|
|
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
|
|
|
|
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
|
|
|
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
|
|
|
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
|
|
|
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
|
|
|
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
|
|
|
|
|
|
|
[LibraryClasses.ARM, LibraryClasses.AARCH64]
|
2019-10-15 13:07:42 +02:00
|
|
|
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
|
2021-11-02 00:31:37 +01:00
|
|
|
NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
|
2019-03-26 16:08:06 +01:00
|
|
|
PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
|
|
|
|
|
|
|
|
[Components.common]
|
2021-09-30 09:48:12 +02:00
|
|
|
DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf
|
2020-08-05 17:19:26 +02:00
|
|
|
DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
|
2022-07-08 22:59:03 +02:00
|
|
|
DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf
|
2020-08-06 09:04:50 +02:00
|
|
|
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
|
2019-03-26 16:08:06 +01:00
|
|
|
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
|
2021-12-09 10:32:07 +01:00
|
|
|
DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
|
2021-12-09 10:32:51 +01:00
|
|
|
DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf
|
DynamicTablesPkg: Add SMBIOS String table helper library
The Section 6.1.3, SMBIOS specification version 3.6.0 describes the
handling of test strings in SMBIOS tables.
Text strings are added at the end of the formatted portion of the SMBIOS
structure and are referenced by index in the SMBIOS structure.
Therefore, introduce a SmbiosStringTableLib to simplify the publishing
of the string set.
SmbiosStringTableLib introduces a concept of string table which records
the references to the SMBIOS strings as they are added and returns an
string reference which is then assigned to the string field in the
formatted portion of the SMBIOS structure. Once all strings are added,
the library provides an interface to get the required size for the string
set. This allows sufficient memory to be allocated for the SMBIOS table.
The library also provides an interface to publish the string set in
accordance with the SMBIOS specification.
Example:
EFI_STATUS
BuildSmbiosType17Table () {
STRING_TABLE StrTable;
UINT8 DevLocatorRef;
UINT8 BankLocatorRef;
SMBIOS_TABLE_TYPE17 *SmbiosRecord;
CHAR8 *StringSet;
...
// Initialize string table for 7 strings
StringTableInitialize (&StrTable, 7);
StringTableAddString (&StrTable, "SIMM 3", &DevLocatorRef);
StringTableAddString (&StrTable, "Bank 0", &BankLocatorRef);
...
SmbiosRecord = AllocateZeroPool (
sizeof (SMBIOS_TABLE_TYPE17) +
StringTableGetStringSetSize (&StrTable)
);
...
SmbiosRecord->DeviceLocator = DevLocatorRef;
SmbiosRecord->BankLocator = BankLocatorRef;
...
// get the string set area
StringSet = (CHAR8*)(SmbiosRecord + 1);
// publish the string set
StringTablePublishStringSet (
&StrTable,
StringSet,
StringTableGetStringSetSize (&StrTable)
);
// free string table
StringTableFree (&StrTable);
return EFI_SUCCESS;
}
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Girish Mahadevan <gmahadevan@nvidia.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Cc: William Watson <wwatson@nvidia.com>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
2022-09-08 19:35:50 +02:00
|
|
|
DynamicTablesPkg/Library/Common/SmbiosStringTableLib/SmbiosStringTableLib.inf
|
2019-03-26 15:59:12 +01:00
|
|
|
|
|
|
|
[BuildOptions]
|
2020-06-26 19:20:36 +02:00
|
|
|
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
2019-08-16 17:24:22 +02:00
|
|
|
|
|
|
|
!ifdef STATIC_ANALYSIS
|
|
|
|
# Check all rules
|
|
|
|
# Inhibit C6305: Potential mismatch between sizeof and countof quantities.
|
|
|
|
*_VS2017_*_CC_FLAGS = /wd6305 /analyze
|
|
|
|
!endif
|