Skip to content

Commit

Permalink
free file pointer if BSA run on incorrect platform (ARM-software#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan-rathore authored Oct 14, 2024
1 parent 8a45885 commit ca0eb12
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mem_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ handles memory synchronization, caching, and reordering. By analyzing the outcom
insights into the reliability of the memory model implementation and identify any subtle bugs or inconsistencies that
might lead to unpredictable behavior in concurrent programs.

- NOTE: Running and passing Memory Model consistenct tests are not required for SystemReady Certifications and they are not part of BSA Certification Image binary.
- NOTE: Running and passing Memory Model consistency tests are not required for SystemReady Certifications and they are not part of BSA Certification Image binary.

## Release details
- Code quality: v1.0.0 EAC
Expand Down
3 changes: 2 additions & 1 deletion pal/uefi_acpi/common/include/pal_uefi.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ typedef struct {
#define CONDUIT_HVC 1
#define CONDUIT_UNKNOWN -1
#define CONDUIT_NONE -2
#define CONDUIT_NO_TABLE -3

typedef struct {
UINT32 num_of_pe;
Expand Down Expand Up @@ -474,7 +475,7 @@ VOID pal_mem_free_cacheable(UINT32 bdf, UINT32 size, VOID *va, VOID *pa);
VOID *pal_mem_virt_to_phys(VOID *va);
VOID *pal_mem_phys_to_virt(UINT64 pa);
UINT64 pal_memory_get_unpopulated_addr(UINT64 *addr, UINT32 instance);

UINT64 pal_get_xsdt_ptr();
VOID pal_mem_free(VOID *buffer);
UINT32 pal_pe_get_num();

Expand Down
7 changes: 7 additions & 0 deletions pal/uefi_acpi/common/src/pal_pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,15 @@ pal_psci_get_conduit (
VOID
)
{
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
EFI_ACPI_6_1_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;

Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) pal_get_xsdt_ptr();
if (Xsdt == NULL) {
acs_print(ACS_PRINT_ERR, L" XSDT not found\n");
return CONDUIT_NO_TABLE;
}

Fadt = (EFI_ACPI_6_1_FIXED_ACPI_DESCRIPTION_TABLE *)pal_get_fadt_ptr ();
if (!Fadt) {
return CONDUIT_UNKNOWN;
Expand Down
1 change: 1 addition & 0 deletions pal/uefi_dt/bsa/include/pal_uefi.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ typedef struct {
#define CONDUIT_HVC 1
#define CONDUIT_UNKNOWN -1
#define CONDUIT_NONE -2
#define CONDUIT_NO_TABLE -3

typedef struct {
UINT32 num_of_pe;
Expand Down
2 changes: 1 addition & 1 deletion pal/uefi_dt/bsa/src/pal_pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pal_psci_get_conduit (
dt_ptr = pal_get_dt_ptr();
if (dt_ptr == 0) {
acs_print(ACS_PRINT_ERR, L" dt_ptr is NULL\n");
return CONDUIT_NONE;
return CONDUIT_NO_TABLE;
}

/* Search for psci node*/
Expand Down
17 changes: 10 additions & 7 deletions uefi_app/BsaAcsMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,16 +587,19 @@ ShellAppMain (
val_print(ACS_PRINT_TEST, "\n Creating Platform Information Tables\n", 0);





Status = createPeInfoTable();
if (Status)
return Status;
if (Status) {
if (g_acs_log_file_handle)
ShellCloseFile(&g_acs_log_file_handle);
return Status;
}

Status = createGicInfoTable();
if (Status)
return Status;
if (Status) {
if (g_acs_log_file_handle)
ShellCloseFile(&g_acs_log_file_handle);
return Status;
}

/* Initialise exception vector, so any unexpected exception gets handled by default
BSA exception handler */
Expand Down
1 change: 1 addition & 0 deletions val/common/include/pal_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
#define CONDUIT_HVC 1
#define CONDUIT_UNKNOWN -1
#define CONDUIT_NONE -2
#define CONDUIT_NO_TABLE -3
int32_t pal_psci_get_conduit(void);

/**
Expand Down
3 changes: 3 additions & 0 deletions val/common/src/acs_pe_infra.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ uint32_t
val_pe_create_info_table(uint64_t *pe_info_table)
{
gPsciConduit = pal_psci_get_conduit();
if (gPsciConduit == CONDUIT_NO_TABLE)
return ACS_STATUS_ERR;

if (gPsciConduit == CONDUIT_UNKNOWN) {
val_print(ACS_PRINT_WARN, " FADT not found, assuming SMC as PSCI conduit\n", 0);
gPsciConduit = CONDUIT_SMC;
Expand Down

0 comments on commit ca0eb12

Please sign in to comment.