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
1 change: 0 additions & 1 deletion pal/baremetal/base/include/pal_common_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ typedef enum {

/* LibC functions declaration */

int32_t pal_mem_compare(void *Src, void *Dest, uint32_t Len);
void *pal_memcpy(void *DestinationBuffer, const void *SourceBuffer, uint32_t Length);
void *pal_strncpy(void *DestinationStr, const void *SourceStr, uint32_t Length);
uint32_t pal_strncmp(const char8_t *str1, const char8_t *str2, uint32_t len);
Expand Down
14 changes: 0 additions & 14 deletions pal/baremetal/base/src/pal_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,20 +417,6 @@ void *pal_strncpy(void *DestinationStr, const void *SourceStr, uint32_t Length)
return ptr;
}

int32_t
pal_mem_compare(void *Src, void *Dest, uint32_t Len)
{
if (Len != 0) {
register const unsigned char *p1 = Dest, *p2 = Src;

do {
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while (--Len != 0);
}
return (0);
}

void
pal_mem_set(void *buf, uint32_t size, uint8_t value)
{
Expand Down
75 changes: 0 additions & 75 deletions pal/uefi_acpi/src/pal_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,42 +293,6 @@ pal_mem_free(VOID *Buffer)
}
}

/**
@brief Compare the contents of the src and dest buffers
@param Src - source buffer to be compared
@param Dest - destination buffer to be compared
@param Len - Length of the comparison to be performed

@return Zero if the buffer contecnts are same, else Nonzero
**/
UINT32
pal_mem_compare (
VOID *Src,
VOID *Dest,
UINT32 Len
)
{
return CompareMem (Src, Dest, Len);
}

/**
@brie a buffer with a known specified input value
@param Buf - Pointer to the buffer to fill
@param Size - Number of bytes in buffer to fill
@param Value - Value to fill buffer with

@return None
**/
VOID
pal_mem_set (
VOID *Buf,
UINT32 Size,
UINT8 Value
)
{
SetMem(Buf, Size, Value);
}

/**
@brief Allocate memory which is to be used to share data across PEs

Expand Down Expand Up @@ -479,45 +443,6 @@ pal_mem_phys_to_virt (
return (VOID*)Pa;
}

/**
@brief Compares two strings

@param FirstString The pointer to a Null-terminated ASCII string.
@param SecondString The pointer to a Null-terminated ASCII string.
@param Length The maximum number of ASCII characters for compare.

@return Zero if strings are identical, else non-zero value
**/
UINT32
pal_strncmp (
CHAR8 *FirstString,
CHAR8 *SecondString,
UINT32 Length
)
{
return AsciiStrnCmp(FirstString, SecondString, Length);
}

/**
Copies a source buffer to a destination buffer, and returns the destination buffer.

@param DestinationBuffer The pointer to the destination buffer of the memory copy.
@param SourceBuffer The pointer to the source buffer of the memory copy.
@param Length The number of bytes to copy from SourceBuffer to DestinationBuffer.

@return DestinationBuffer.

**/
VOID *
pal_memcpy (
VOID *DestinationBuffer,
VOID *SourceBuffer,
UINT32 Length
)
{
return CopyMem (DestinationBuffer, SourceBuffer, Length);
}

/**
Stalls the CPU for the number of microseconds specified by MicroSeconds.

Expand Down
56 changes: 0 additions & 56 deletions pal/uefi_dt/src/pal_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,42 +293,6 @@ pal_mem_free(VOID *Buffer)
}
}

/**
@brief Compare the contents of the src and dest buffers
@param Src - source buffer to be compared
@param Dest - destination buffer to be compared
@param Len - Length of the comparison to be performed

@return Zero if the buffer contecnts are same, else Nonzero
**/
UINT32
pal_mem_compare (
VOID *Src,
VOID *Dest,
UINT32 Len
)
{
return CompareMem (Src, Dest, Len);
}

/**
@brie a buffer with a known specified input value
@param Buf - Pointer to the buffer to fill
@param Size - Number of bytes in buffer to fill
@param Value - Value to fill buffer with

@return None
**/
VOID
pal_mem_set (
VOID *Buf,
UINT32 Size,
UINT8 Value
)
{
SetMem(Buf, Size, Value);
}

/**
@brief Allocate memory which is to be used to share data across PEs

Expand Down Expand Up @@ -553,26 +517,6 @@ pal_strncmp (
return AsciiStrnCmp(FirstString, SecondString, Length);
}

/**
Copies a source buffer to a destination buffer, and returns the destination buffer.

@param DestinationBuffer The pointer to the destination buffer of the memory copy.
@param SourceBuffer The pointer to the source buffer of the memory copy.
@param Length The number of bytes to copy from SourceBuffer to DestinationBuffer.

@return DestinationBuffer.

**/
VOID *
pal_memcpy (
VOID *DestinationBuffer,
VOID *SourceBuffer,
UINT32 Length
)
{
return CopyMem (DestinationBuffer, SourceBuffer, Length);
}

/**
Stalls the CPU for the number of microseconds specified by MicroSeconds.

Expand Down
6 changes: 3 additions & 3 deletions val/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bsa_acs_val-objs += $(VAL_SRC)/acs_status.o $(VAL_SRC)/acs_memory.o \
$(VAL_SRC)/acs_peripherals.o $(VAL_SRC)/acs_dma.o $(VAL_SRC)/acs_smmu.o \
$(VAL_SRC)/acs_test_infra.o $(VAL_SRC)/acs_pcie.o $(VAL_SRC)/acs_pe_infra.o \
$(VAL_SRC)/acs_iovirt.o $(VAL_SRC)/bsa_execute_test.o\
$(VAL_SRC)/val_status.o $(VAL_SRC)/val_logger.o \
$(VAL_SRC)/val_status.o $(VAL_SRC)/val_logger.o $(VAL_SRC)/val_libc.o \
$(VAL_SRC)/../driver/smmu_v3/smmu_v3.o $(VAL_SRC)/../driver/pcie/pcie.o \
$(VAL_SRC)/rule_based_execution_helpers.o \
$(VAL_SRC)/rule_based_orchestrator.o \
Expand All @@ -71,7 +71,7 @@ sbsa_acs_val-objs += $(VAL_SRC)/acs_status.o $(VAL_SRC)/acs_memory.o \
$(VAL_SRC)/acs_peripherals.o $(VAL_SRC)/acs_smmu.o $(VAL_SRC)/acs_dma.o \
$(VAL_SRC)/acs_test_infra.o $(VAL_SRC)/acs_pcie.o $(VAL_SRC)/acs_pe_infra.o \
$(VAL_SRC)/acs_iovirt.o $(VAL_SRC)/../driver/smmu_v3/smmu_v3.o \
$(VAL_SRC)/val_status.o $(VAL_SRC)/val_logger.o \
$(VAL_SRC)/val_status.o $(VAL_SRC)/val_logger.o $(VAL_SRC)/val_libc.o \
$(VAL_SRC)/sbsa_execute_test.o $(VAL_SRC)/../driver/pcie/pcie.o \
$(VAL_SRC)/rule_based_execution_helpers.o \
$(VAL_SRC)/rule_based_orchestrator.o \
Expand All @@ -85,7 +85,7 @@ pcbsa_acs_val-objs += $(VAL_SRC)/acs_status.o $(VAL_SRC)/acs_memory.o \
$(VAL_SRC)/acs_peripherals.o $(VAL_SRC)/acs_smmu.o $(VAL_SRC)/acs_dma.o\
$(VAL_SRC)/acs_test_infra.o $(VAL_SRC)/acs_pcie.o $(VAL_SRC)/acs_pe_infra.o \
$(VAL_SRC)/acs_iovirt.o $(VAL_SRC)/../driver/smmu_v3/smmu_v3.o \
$(VAL_SRC)/val_status.o $(VAL_SRC)/val_logger.o \
$(VAL_SRC)/val_status.o $(VAL_SRC)/val_logger.o $(VAL_SRC)/val_libc.o \
$(VAL_SRC)/pc_bsa_execute_test.o $(VAL_SRC)/../driver/pcie/pcie.o
endif

Expand Down
1 change: 1 addition & 0 deletions val/SbsaValNistLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
src/mpam_execute_test.c
src/drtm_execute_test.c
src/val_logger.c
src/val_libc.c

[Packages]
MdePkg/MdePkg.dec
Expand Down
1 change: 1 addition & 0 deletions val/ValLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
src/acs_pfdi.c
src/acs_msc_error.c
src/acs_tpm.c
src/val_libc.c
driver/smmu_v3/smmu_v3.c
driver/gic/gic.c
driver/gic/acs_exception.c
Expand Down
1 change: 1 addition & 0 deletions val/ValLibRB.inf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
src/rule_lookup.c
src/test_wrappers.c
src/val_logger.c
src/val_libc.c

[Packages]
MdePkg/MdePkg.dec
Expand Down
3 changes: 1 addition & 2 deletions val/include/acs_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define __ACS_MEMORY_H__

#include "val_sysreg.h"
#include "val_libc.h"

#define MEM_MAP_SUCCESS 0x0
#define MEM_MAP_NO_MEM 0x1
Expand All @@ -35,8 +36,6 @@ void val_memory_unmap(void *ptr);
void *val_memory_alloc(uint32_t size);
void *val_memory_calloc(uint32_t num, uint32_t size);
void val_memory_free(void *addr);
int val_memory_compare(void *src, void *dest, uint32_t len);
void val_memory_set(void *buf, uint32_t size, uint8_t value);
void *val_memory_virt_to_phys(void *va);
void *val_memory_phys_to_virt(uint64_t pa);
void *val_memory_alloc_pages(uint32_t num_pages);
Expand Down
3 changes: 1 addition & 2 deletions val/include/val_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "acs_pfdi.h"
#include "acs_cxl.h"
#include "val_status.h"
#include "val_libc.h"

extern uint32_t g_print_level;

Expand Down Expand Up @@ -112,7 +113,6 @@ void val_print_test_start(char8_t *string);
void val_print_test_end(uint32_t status, char8_t *string);
void val_set_test_data(uint32_t index, uint64_t addr, uint64_t test_data);
void val_get_test_data(uint32_t index, uint64_t *data0, uint64_t *data1);
void *val_memcpy(void *dest_buffer, void *src_buffer, uint32_t len);
void val_dump_dtb(void);
void view_print_info(uint32_t view);
void val_log_context(char8_t *file, char8_t *func, uint32_t line);
Expand All @@ -122,7 +122,6 @@ uint32_t val_exit_acs(void);
void val_print_acs_test_status_summary(void);

uint32_t execute_tests(void);
uint32_t val_strncmp(char8_t *str1, char8_t *str2, uint32_t len);
uint64_t val_time_delay_ms(uint64_t time_ms);

/* VAL PE APIs */
Expand Down
48 changes: 48 additions & 0 deletions val/include/val_libc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/** @file
* Copyright (c) 2026, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0

* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

#ifndef __VAL_LIBC_H__
#define __VAL_LIBC_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "pal_interface.h"
#include "pal_common_intf.h"

int val_memory_compare(void *s1, void *s2, uint32_t len);

void *val_memcpy(void *dst, void *src, uint32_t len);

void val_memory_set(void *dst, uint32_t size, uint8_t value);

uint32_t val_strncmp(char8_t *str1, char8_t *str2, uint32_t length);

char *val_strcat(char *dest, const char *src, size_t output_buff_size);

size_t val_strlen(char *str);

char *val_strcpy(char *dest, const char *src);

char *val_strncpy(char *dest, const char *src, size_t n);

#ifdef __cplusplus
}
#endif

#endif /* __VAL_LIBC_H__ */
31 changes: 0 additions & 31 deletions val/src/acs_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,37 +307,6 @@ val_memory_free(void *addr)
pal_mem_free(addr);
}

/**
@brief Compare two buffers of length len

@param *src Source Buffer
@param *dest Destination Buffer
@param len Length

@return 0 If contents are same
@return 1 Otherwise
**/
int
val_memory_compare(void *src, void *dest, uint32_t len)
{
return pal_mem_compare(src, dest, len);
}

/**
@brief Set buffer with value given in arguments

@param *buf Buffer
@param size size
@param value value to be written

@return None
**/
void
val_memory_set(void *buf, uint32_t size, uint8_t value)
{
pal_mem_set(buf, size, value);
}

/**
@brief Returns the physical address for virtual address space.

Expand Down
Loading
Loading