Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [6.2.4]

### Fixed
- EFI: fix print specifiers for callback2

### Changed
- samples: metee_gsc: enable EFI build
- samples: metee_basic: enable EFI build

### Added
- EFI: add support for CSC target
- EFI: add DEFINE_GUID
- EFI: add library configure

## [6.2.3]

### Fixed
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ include(GNUInstallDirs)
set(LICENSE Apache)
include(version.cmake)

if(WIN32)
if(EFI)
include(uefi.cmake)
elseif(WIN32)
include(win32.cmake)
else(WIN32)
else()
include(linux.cmake)
endif(WIN32)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER include/metee.h)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${TEE_VERSION_STRING})
Expand Down
18 changes: 18 additions & 0 deletions MeTeePkg/MeTeePkg.dec.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2026 Intel Corporation

[Defines]
DEC_SPECIFICATION = 0x00010005
PACKAGE_NAME = MeTeePkg
PACKAGE_GUID = 8e6a6715-9abc-4043-88ef-9e39c6f63e0f
PACKAGE_VERSION = 0.1

[Includes]
@METEE_INCLUDE_RELPATH@

[LibraryClasses]
## @libraryclass Provides MeTee interface functions
MeTeeLib|include/metee.h

[Guids]
gMeTeePkgTokenSpaceGuid = { 0x8e6a6715, 0x9abc, 0x4043, { 0x88, 0xef, 0x9e, 0x39, 0xc6, 0xf6, 0x3e, 0x0f }}
47 changes: 47 additions & 0 deletions MeTeePkg/MeTeePkg.dsc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024-2026 Intel Corporation
#
[Defines]
DSC_SPECIFICATION = 0x0001001A
PLATFORM_GUID = A4E6FE89-05EF-44DC-89F1-4EC07B513B10
PLATFORM_VERSION = 0.01
PLATFORM_NAME = MeTeePkg
SKUID_IDENTIFIER = DEFAULT
SUPPORTED_ARCHITECTURES = X64
BUILD_TARGETS = DEBUG|RELEASE
OUTPUT_DIRECTORY = BINARY_OUTPUT

!include MdePkg/MdeLibs.dsc.inc

[LibraryClasses]
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf

DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf

IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf

MeTeeLib|MeTeePkg/MeTeeLibrary/MeTeeLibrary.inf

[Components]
MeTeePkg/MeTeeLibrary/MeTeeLibrary.inf

@METEE_SAMPLES@

[PcdsFixedAtBuild]
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000043
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.3
6.2.4
7 changes: 6 additions & 1 deletion include/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ extern "C" {

#ifdef EFI
#define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%a:%a():%d) "
#ifdef METEE_EFI_STDLIB_SUPPORT
#define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) "
#else
#define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%a:%a():%d) "
#endif /* METEE_EFI_STDLIB_SUPPORT */
#else /* EFI */
#define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%s:%s():%d) "
#define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) "
#endif /* EFI */
#define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) "

#ifdef _WIN32
#include <windows.h>
Expand Down
8 changes: 6 additions & 2 deletions include/metee.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2014-2025 Intel Corporation
* Copyright (C) 2014-2026 Intel Corporation
*/
/*! \file metee.h
* \brief metee library API
Expand Down Expand Up @@ -39,9 +39,13 @@ extern "C" {
#define TEE_DEVICE_HANDLE void *
#define TEE_INVALID_DEVICE_HANDLE ((void*)-1)

#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }

// when calling TeeInitFull
// TEE_DEVICE_TYPE_BDF - HECI device Bus Device Function

#else /* _WIN32 */
#ifndef METEE_DLL
#define METEE_DLL_API
Expand Down
18 changes: 16 additions & 2 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2014-2024 Intel Corporation
# Copyright (C) 2014-2026 Intel Corporation
cmake_minimum_required(VERSION 3.15)
project(metee_sample)

Expand All @@ -14,6 +14,13 @@ add_executable(metee-gsc metee_gsc.c)
target_link_libraries(metee-gsc metee)
install(TARGETS metee-gsc RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if(EFI)
configure_file (
"${PROJECT_SOURCE_DIR}/MeTeeGsc.inf.in"
"${CMAKE_BINARY_DIR}/MeTeePkg/Samples/MeTeeGsc/MeTeeGsc.inf"
)
endif(EFI)

if(UNIX)
add_executable(metee-connect metee_connect.c meiuuid.c)

Expand All @@ -30,10 +37,17 @@ add_executable(metee-basic metee_basic.c)
target_link_libraries(metee-basic metee)
install(TARGETS metee-basic RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if(EFI)
configure_file (
"${PROJECT_SOURCE_DIR}/MeTeeBasic.inf.in"
"${CMAKE_BINARY_DIR}/MeTeePkg/Samples/MeTeeBasic/MeTeeBasic.inf"
)
endif(EFI)

add_executable(meteepp-basic meteepp_basic.cpp)
target_link_libraries(meteepp-basic metee)
install(TARGETS meteepp-basic RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

if(BUILD_SHARED_LIBS AND WIN32)
add_subdirectory(csharp)
endif(BUILD_SHARED_LIBS AND WIN32)
endif(BUILD_SHARED_LIBS AND WIN32)
30 changes: 30 additions & 0 deletions samples/MeTeeBasic.inf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2026 Intel Corporation

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = MeTeeBasic
FILE_GUID = 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = @TEE_VERSION_STRING@
ENTRY_POINT = UefiMain

[Sources]
../samples/metee_basic.c
../samples/MeTeeBasicMain.c

[Packages]
MdePkg/MdePkg.dec
MeTeePkg/MeTeePkg.dec

[LibraryClasses]
UefiApplicationEntryPoint
UefiLib
BaseLib
BaseMemoryLib
MemoryAllocationLib
MeTeeLib

[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /GS- /D EFI /U _WIN32 /W4 /WX /wd4201
GCC:*_*_*_CC_FLAGS = -D EFI
37 changes: 37 additions & 0 deletions samples/MeTeeBasicMain.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2026 Intel Corporation
*/

#include <Uefi.h>
#include <Library/UefiLib.h>

extern int main(int argc, char* argv[]);

/**
UEFI application entry point which has an interface similar to a
standard C main function.

@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.

@retval EFI_SUCCESS The entry point executed successfully.
@retval other Some error occurred when executing this entry point.

**/
EFI_STATUS
EFIAPI
UefiMain(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
int ret;

(void)ImageHandle;
(void)SystemTable;

ret = main(0, NULL);

return (ret == 0) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
}
31 changes: 31 additions & 0 deletions samples/MeTeeGsc.inf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2026 Intel Corporation

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = MeTeeGsc
FILE_GUID = 3c4d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = @TEE_VERSION_STRING@
ENTRY_POINT = UefiMain

[Sources]
../samples/metee_gsc.c
../samples/MeTeeGscMain.c

[Packages]
MdePkg/MdePkg.dec
MeTeePkg/MeTeePkg.dec
StdLib/StdLib.dec

[LibraryClasses]
UefiApplicationEntryPoint
UefiLib
BaseLib
BaseMemoryLib
MemoryAllocationLib
MeTeeLib

[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /GS- /D EFI /U _WIN32 /W4 /WX /wd4201 /D _CRT_SECURE_NO_WARNINGS
GCC:*_*_*_CC_FLAGS = -D EFI
37 changes: 37 additions & 0 deletions samples/MeTeeGscMain.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2026 Intel Corporation
*/

#include <Uefi.h>
#include <Library/UefiLib.h>

extern int main(int argc, char* argv[]);

/**
UEFI application entry point which has an interface similar to a
standard C main function.

@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.

@retval EFI_SUCCESS The entry point executed successfully.
@retval other Some error occurred when executing this entry point.

**/
EFI_STATUS
EFIAPI
UefiMain(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
int ret;

(void)ImageHandle;
(void)SystemTable;

ret = main(0, NULL);

return (ret == 0) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
}
Loading
Loading