Skip to content

Commit 46eb830

Browse files
Sahil-Malpekarchetan-rathore
authored andcommitted
fix(pal): introduce NOT_IMPLEMENTED returns and remove unused APIs
- Added NOT_IMPLEMENTED return for unimplemented PAL APIs. - Updated tests to skip when APIs return NOT_IMPLEMENTED. - Removed unused PAL APIs from the codebase. Signed-off-by: Sahil Shakil Malpekar <Sahil.ShakilMalpekar@arm.com> Change-Id: I2c4fbd37c392acb5beab506aeefde7d56ae508c1
1 parent 0da7d9f commit 46eb830

File tree

27 files changed

+393
-752
lines changed

27 files changed

+393
-752
lines changed

pal/baremetal/target/RDN2/src/pal_bsa.c

Lines changed: 48 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/** @file
3-
* Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved.
3+
* Copyright (c) 2025-2026, Arm Limited or its affiliates. All rights reserved.
44
* SPDX-License-Identifier : Apache-2.0
55
66
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,24 +58,6 @@ extern addr_t __BSS_START__, __BSS_END__;
5858
#define MAX_MMAP_REGION_COUNT 75
5959
memory_region_descriptor_t mmap_region_list[MAX_MMAP_REGION_COUNT];
6060

61-
62-
/** GIC PAL API's **/
63-
/**
64-
@brief Indicate that processing of interrupt is complete by writing to
65-
End of interrupt register in the GIC CPU Interface
66-
67-
@param int_id Interrupt ID which needs to be acknowledged that it is complete
68-
69-
@return Status of the operation
70-
**/
71-
uint32_t
72-
pal_gic_set_intr_trigger(uint32_t int_id, INTR_TRIGGER_INFO_TYPE_e trigger_type)
73-
{
74-
(void) int_id;
75-
(void) trigger_type;
76-
return 0;
77-
}
78-
7961
// Note that while creating a list of mem map, the size of mappings will vary across platforms.
8062
// The below mapping size is specific to FVP RDN2.
8163

@@ -644,28 +626,6 @@ pal_gic_end_of_interrupt(uint32_t int_id)
644626
return 0;
645627
}
646628

647-
648-
/**
649-
@Registers the interrupt handler for a given IRQ.
650-
651-
@param irq_num: hardware IRQ number
652-
@param mapped_irq_num: mapped IRQ number
653-
@param isr: interrupt service routine that returns the status
654-
655-
**/
656-
uint32_t
657-
pal_gic_request_irq (
658-
uint32_t IrqNum,
659-
uint32_t MappedIrqNum,
660-
void *Isr
661-
)
662-
{
663-
(void) IrqNum;
664-
(void) MappedIrqNum;
665-
(void) Isr;
666-
return 0;
667-
}
668-
669629
/**
670630
@Frees the registered interrupt handler for agiven IRQ.
671631
@@ -689,62 +649,43 @@ pal_gic_free_irq (
689649
#define SMMU_V3_IDR1_PASID_SHIFT 6
690650
#define SMMU_V3_IDR1_PASID_MASK 0x1f
691651

692-
/**
693-
@brief This API prepares the smmu page tables to support input PasId
694-
@param SmmuBase - Physical addr of the SMMU for which PasId support is needed
695-
@param PasId - Process Address Space identifier
696-
@return zero for success, one for failure
697-
**/
698-
uint32_t
699-
pal_smmu_create_pasid_entry (uint64_t SmmuBase, uint32_t PasId)
700-
{
701-
(void) SmmuBase;
702-
(void) PasId;
703-
704-
return 1;
705-
}
706-
707-
/**
708-
@brief This API globally disables the SMMU based on input base address
709-
@param SmmuBase - Physical addr of the SMMU that needs to be globally disabled
710-
@return zero for success, one for failure
711-
**/
712-
uint32_t
713-
pal_smmu_disable (uint64_t SmmuBase)
714-
{
715-
(void) SmmuBase;
716-
717-
return 0;
718-
}
719-
720-
721652
/**
722653
@brief This API converts physical address to IO virtual address
723-
@param SmmuBase - Physical addr of the SMMU for pa to iova conversion
724-
@param Pa - Physical address to use in conversion
725-
@return zero for success, one for failure
726-
*/
654+
@param SmmuBase - Physical addr of the SMMU for pa to iova conversion
655+
@param Pa - Physical address to use in conversion
656+
@param dram_buf_iova - IOVA addresses for DMA purposes
657+
658+
@return
659+
- 0 : Success
660+
- NOT_IMPLEMENTED : Feature not implemented
661+
- non-zero : Failure (implementation-specific error code)
662+
**/
727663
uint64_t
728-
pal_smmu_pa2iova (uint64_t SmmuBase, uint64_t Pa)
664+
pal_smmu_pa2iova(uint64_t SmmuBase, uint64_t Pa, uint64_t *dram_buf_iova)
729665
{
730666
(void) SmmuBase;
731667
(void) Pa;
668+
(void) dram_buf_iova;
732669

733-
return 0;
670+
return NOT_IMPLEMENTED;
734671
}
735672

736673
/**
737674
@brief Check if input address is within the IOVA translation range for the device
738675
@param port - Pointer to the DMA port
739676
@param dma_addr - The input address to be checked
740-
@return Success if the input address is found in the range
677+
678+
@return
679+
- 0 : Success
680+
- NOT_IMPLEMENTED : Feature not implemented
681+
- non-zero : Failure (implementation-specific error code)
741682
**/
742683
uint32_t pal_smmu_check_device_iova(void *port, uint64_t dma_addr)
743684
{
744685
(void) port;
745686
(void) dma_addr;
746687

747-
return 0;
688+
return NOT_IMPLEMENTED;
748689
}
749690

750691
/**
@@ -808,26 +749,29 @@ pal_pcie_device_driver_present(uint32_t seg, uint32_t bus, uint32_t dev, uint32_
808749
}
809750

810751
/**
811-
@brief Create a list of MSI(X) vectors for a device
752+
@brief Create a list of MSI(X) vectors for a device
812753
813-
@param bus PCI bus address
814-
@param dev PCI device address
815-
@param fn PCI function number
816-
@param mvector pointer to a MSI(X) list address
754+
@param bus PCI bus address
755+
@param dev PCI device address
756+
@param fn PCI function number
757+
@param mvector pointer to a MSI(X) list address
817758
818-
@return mvector list of MSI(X) vectors
819-
@return number of MSI(X) vectors
759+
@return
760+
- 0 : Success
761+
- NOT_IMPLEMENTED : Feature not implemented
762+
- non-zero : Failure (implementation-specific error code)
820763
**/
821764
uint32_t
822-
pal_get_msi_vectors(uint32_t Seg, uint32_t Bus, uint32_t Dev, uint32_t Fn, PERIPHERAL_VECTOR_LIST **MVector)
765+
pal_get_msi_vectors(uint32_t Seg, uint32_t Bus, uint32_t Dev, uint32_t Fn,
766+
PERIPHERAL_VECTOR_LIST **MVector)
823767
{
824768
(void) Seg;
825769
(void) Bus;
826770
(void) Dev;
827771
(void) MVector;
828772
(void) Fn;
829773

830-
return 0;
774+
return NOT_IMPLEMENTED;
831775
}
832776

833777
/**
@@ -1227,22 +1171,27 @@ pal_mem_free_cacheable(uint32_t Bdf, uint32_t Size, void *Va, void *Pa)
12271171
/**
12281172
@brief Allocate DMAable memory: (Aligned to 4K by default)
12291173
1230-
@param buffer - Pointer to return the buffer address
1231-
@param length - Number of bytes to allocate
1232-
@param dev - Pointer to the device structure
1233-
@param flag - Allocation flags
1174+
@param buffer - Pointer to return the buffer address
1175+
@param length - Number of bytes to allocate
1176+
@param dev - Pointer to the device structure
1177+
@param flag - Allocation flags
1178+
@param dma_addr - DMA address of memory allocated
12341179
1235-
@return DMA address of memory allocated
1180+
@return
1181+
- 0 : Success
1182+
- NOT_IMPLEMENTED : Feature not implemented
1183+
- non-zero : Failure (implementation-specific error code)
12361184
**/
12371185
uint64_t
1238-
pal_dma_mem_alloc(void **buffer, uint32_t length, void *dev, uint32_t flag)
1186+
pal_dma_mem_alloc(void **buffer, uint32_t length, void *dev, uint32_t flag, addr_t *dma_addr)
12391187
{
12401188

12411189
(void) dev;
12421190
(void) flag;
1191+
(void) dma_addr;
12431192
*buffer = (void *)pal_aligned_alloc(MEM_ALIGN_4K, length);
12441193

1245-
return 0;
1194+
return NOT_IMPLEMENTED;
12461195
}
12471196

12481197
/**
@@ -1266,27 +1215,6 @@ void pal_dma_mem_free(void *buffer, uint64_t mem_dma, unsigned int length, void
12661215
return;
12671216
}
12681217

1269-
/**
1270-
@brief Abstracts the functionality of performing a DMA
1271-
operation from the device to DDR memory
1272-
1273-
@param dma_target_buf is the target physical addressing
1274-
the memory where the DMA data is to bewritten.
1275-
@return 0 on success.
1276-
IMPLEMENTATION DEFINED on error.
1277-
**/
1278-
unsigned int
1279-
pal_dma_start_from_device(void *dma_target_buf, unsigned int length,
1280-
void *host, void *dev)
1281-
{
1282-
(void) dma_target_buf;
1283-
(void) length;
1284-
(void) host;
1285-
(void) dev;
1286-
1287-
return 0;
1288-
}
1289-
12901218
/**
12911219
@brief Get the DMA address used by the queried DMA controller port
12921220
@@ -1316,7 +1244,10 @@ pal_dma_scsi_get_dma_addr(void *port, void *dma_addr, unsigned int *dma_len)
13161244
@param attr - Variable to return the attributes
13171245
@param sh - Inner sharable domain or not
13181246
1319-
@return 0 on SUCCESS or 1 for FAIL
1247+
@return
1248+
- 0 : Success
1249+
- NOT_IMPLEMENTED : Feature not implemented
1250+
- non-zero : Failure (implementation-specific error code)
13201251
**/
13211252
int
13221253
pal_dma_mem_get_attrs(void *buf, uint32_t *attr, uint32_t *sh)
@@ -1329,5 +1260,5 @@ pal_dma_mem_get_attrs(void *buf, uint32_t *attr, uint32_t *sh)
13291260
(void) attr;
13301261
(void) sh;
13311262

1332-
return 1;
1263+
return NOT_IMPLEMENTED;
13331264
}

pal/baremetal/target/RDN2/src/pal_exerciser.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2026, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -632,23 +632,6 @@ uint32_t pal_exerciser_ops(EXERCISER_OPS Ops, uint64_t Param, uint32_t Bdf)
632632
return 1;
633633
}
634634

635-
636-
637-
/**
638-
@brief This API sets the state of the PCIe stimulus generation hardware
639-
@param State - State that needs to be set for the stimulus hadrware
640-
@param Value - Additional information associated with the state
641-
@param Instance - Stimulus hardware instance number
642-
@return Status - SUCCESS if the input state is successfully written to hardware
643-
**/
644-
uint32_t pal_exerciser_set_state (EXERCISER_STATE State, uint64_t *Value, uint32_t Instance)
645-
{
646-
(void) State;
647-
(void) Value;
648-
(void) Instance;
649-
return 0;
650-
}
651-
652635
/**
653636
@brief This API returns test specific data from the PCIe stimulus generation hardware
654637
@param type - data type for which the data needs to be returned

0 commit comments

Comments
 (0)