From 0628b51bb739c41f37b3d632a1cdb9750ea4cc0b Mon Sep 17 00:00:00 2001 From: cherat01 Date: Thu, 25 Jan 2024 17:03:51 +0530 Subject: [PATCH] Aliging uefi and linux sizes + check added for ata_port validity --- bsa-acs-drv/files/bsa_acs_drv.h | 17 +++++++---------- .../platform/pal_linux/files/src/pal_dma.c | 4 +++- .../platform/pal_linux/files/src/pal_dma.c | 4 +++- sbsa-acs-drv/files/sbsa_acs_drv.h | 17 +++++++---------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/bsa-acs-drv/files/bsa_acs_drv.h b/bsa-acs-drv/files/bsa_acs_drv.h index df42a0c..b19126b 100644 --- a/bsa-acs-drv/files/bsa_acs_drv.h +++ b/bsa-acs-drv/files/bsa_acs_drv.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * Copyright (C) 2016-2021 Arm Limited + * Copyright (C) 2016-2024 Arm Limited * * Author: Prasanth Pulla * @@ -39,15 +39,12 @@ #define DRV_STATUS_AVAILABLE 0x10000000 #define DRV_STATUS_PENDING 0x40000000 -#define PE_INFO_TBL_SZ 8192 -#define GIC_INFO_TBL_SZ 2048 -#define TIMER_INFO_TBL_SZ 1024 -#define WD_INFO_TBL_SZ 512 -#define MEM_INFO_TBL_SZ 4096 -#define IOVIRT_INFO_TBL_SZ 32768 -#define PERIPHERAL_INFO_TBL_SZ 2883584 -#define PCIE_INFO_TBL_SZ 1024 -#define DMA_INFO_TBL_SZ 1024 +/* Please MAKE SURE all table sizes are 16 bytes aligned */ +#define PE_INFO_TBL_SZ 16384 /* Supports maximum 400 PEs [40 B each + 4 B header] */ +#define IOVIRT_INFO_TBL_SZ 1048576 /* Supports maximum 2400 iort nodes [268+32*5 B each + 24 B header] */ +#define PERIPHERAL_INFO_TBL_SZ 8192 /* Supports maximum 145 PCIe peripheral device (anykind) [56 B each + 16 B header] */ +#define PCIE_INFO_TBL_SZ 512 /* Supports maximum 20 PCIe ECAM block [24 B each + 4 B header] */ +#define DMA_INFO_TBL_SZ 1024 /* Supports maximum 30 DMA ctrl [32 B each + 4 B header] */ #define ACS_PCIE_RCiEP_DISABLE 0 typedef diff --git a/bsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c b/bsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c index f87e6a1..383e9a6 100644 --- a/bsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c +++ b/bsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * Copyright (C) 2016-2018,2021,2023, Arm Limited + * Copyright (C) 2016-2018,2021,2023-2024 Arm Limited * * Author: Prasanth Pulla * @@ -121,6 +121,8 @@ pal_dma_create_info_table(DMA_INFO_TABLE *dma_info_table) ap = ata_shost_to_port(shost); if ((ap == NULL) || (ap->dev == NULL)) continue; //Not a ATA port + if ((ap->scsi_host == NULL) || (ap->scsi_host != shost)) + continue; //Not a valid ATA Port do { /* get the device connected to this host */ sdev = __scsi_iterate_devices(shost, sdev); diff --git a/sbsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c b/sbsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c index 95b6ef5..3f098bf 100644 --- a/sbsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c +++ b/sbsa-acs-drv/files/platform/pal_linux/files/src/pal_dma.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * Copyright (C) 2016-2018, 2021, 2023, Arm Limited + * Copyright (C) 2016-2018, 2021, 2023-2024 Arm Limited * * Author: Prasanth Pulla * @@ -121,6 +121,8 @@ pal_dma_create_info_table(DMA_INFO_TABLE *dma_info_table) ap = ata_shost_to_port(shost); if ((ap == NULL) || (ap->dev == NULL)) continue; //Not a ATA port + if ((ap->scsi_host == NULL) || (ap->scsi_host != shost)) + continue; //Not a valid ATA Port do { /* get the device connected to this host */ sdev = __scsi_iterate_devices(shost, sdev); diff --git a/sbsa-acs-drv/files/sbsa_acs_drv.h b/sbsa-acs-drv/files/sbsa_acs_drv.h index 46c1cf7..2564621 100644 --- a/sbsa-acs-drv/files/sbsa_acs_drv.h +++ b/sbsa-acs-drv/files/sbsa_acs_drv.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * Copyright (C) 2016-2020, 2023 Arm Limited + * Copyright (C) 2016-2020, 2023-2024 Arm Limited * * Author: Prasanth Pulla * @@ -37,15 +37,12 @@ #define DRV_STATUS_AVAILABLE 0x10000000 #define DRV_STATUS_PENDING 0x40000000 -#define PE_INFO_TBL_SZ 8192 -#define GIC_INFO_TBL_SZ 2048 -#define TIMER_INFO_TBL_SZ 1024 -#define WD_INFO_TBL_SZ 512 -#define MEM_INFO_TBL_SZ 4096 -#define IOVIRT_INFO_TBL_SZ 32768 -#define PERIPHERAL_INFO_TBL_SZ 2883584 -#define PCIE_INFO_TBL_SZ 1024 -#define DMA_INFO_TBL_SZ 1024 +/* Please MAKE SURE all table sizes are 16 bytes aligned */ +#define PE_INFO_TBL_SZ 16384 /* Supports maximum 400 PEs [40 B each + 4 B header] */ +#define IOVIRT_INFO_TBL_SZ 1048576 /* Supports maximum 2400 iort nodes [268+32*5 B each + 24 B header] */ +#define PERIPHERAL_INFO_TBL_SZ 8192 /* Supports maximum 145 PCIe peripheral device (anykind) [56 B each + 16 B header] */ +#define PCIE_INFO_TBL_SZ 512 /* Supports maximum 20 PCIe ECAM block [24 B each + 4 B header] */ +#define DMA_INFO_TBL_SZ 1024 /* Supports maximum 30 DMA ctrl [32 B each + 4 B header] */ typedef struct __TEST_PARAMS__ -- GitLab