gxp: fix PAGE_* marco usages for non-4K support
Some usages of PAGE_SIZE in the driver is supposed to be exact 4K
instead of the page size being used on host. Fix these places.
Bug: 333336858
Change-Id: Ibd87d797e272eb48d818b7d2f0212c7a6de9ce51
Signed-off-by: David Chiang <[email protected]>
diff --git a/gcip-kernel-driver/include/gcip/gcip-image-config.h b/gcip-kernel-driver/include/gcip/gcip-image-config.h
index 93e8c04..d6e66ad 100644
--- a/gcip-kernel-driver/include/gcip/gcip-image-config.h
+++ b/gcip-kernel-driver/include/gcip/gcip-image-config.h
@@ -88,6 +88,7 @@
};
#define GCIP_IMG_CFG_ADDR_SHIFT 12
+#define GCIP_IMG_CFG_PAGE_SHIFT 12
#define GCIP_IMG_CFG_MB_SHIFT 20
#define GCIP_IMG_CFG_SIZE_MODE_BIT BIT(GCIP_IMG_CFG_ADDR_SHIFT - 1)
#define GCIP_IMG_CFG_SECURE_SIZE_MASK (GCIP_IMG_CFG_SIZE_MODE_BIT - 1u)
@@ -98,7 +99,7 @@
static inline u32 gcip_ns_config_to_size(u32 cfg)
{
if (cfg & GCIP_IMG_CFG_SIZE_MODE_BIT)
- return (cfg & GCIP_IMG_CFG_NS_SIZE_MASK) << PAGE_SHIFT;
+ return (cfg & GCIP_IMG_CFG_NS_SIZE_MASK) << GCIP_IMG_CFG_PAGE_SHIFT;
return (cfg & GCIP_IMG_CFG_NS_SIZE_MASK) << GCIP_IMG_CFG_MB_SHIFT;
}
@@ -107,9 +108,9 @@
static inline u32 gcip_config_to_size(u32 cfg)
{
if (cfg & GCIP_IMG_CFG_SIZE_MODE_BIT)
- return (cfg & GCIP_IMG_CFG_SECURE_SIZE_MASK) << PAGE_SHIFT;
+ return (cfg & GCIP_IMG_CFG_SECURE_SIZE_MASK) << GCIP_IMG_CFG_PAGE_SHIFT;
- return BIT(cfg & GCIP_IMG_CFG_SECURE_SIZE_MASK) << PAGE_SHIFT;
+ return BIT(cfg & GCIP_IMG_CFG_SECURE_SIZE_MASK) << GCIP_IMG_CFG_PAGE_SHIFT;
}
/*
diff --git a/gxp-firmware-data.c b/gxp-firmware-data.c
index ed79a30..4d1fd10 100644
--- a/gxp-firmware-data.c
+++ b/gxp-firmware-data.c
@@ -47,7 +47,7 @@
static void set_system_cfg_region(struct gxp_dev *gxp, void *sys_cfg)
{
struct gxp_system_descriptor_ro *des_ro = sys_cfg;
- struct gxp_system_descriptor_rw *des_rw = sys_cfg + PAGE_SIZE;
+ struct gxp_system_descriptor_rw *des_rw = sys_cfg + SZ_4K;
struct gxp_core_telemetry_descriptor *descriptor =
&gxp->data_mgr->core_telemetry_desc;
struct telemetry_descriptor_ro *ro;
diff --git a/gxp-vd.c b/gxp-vd.c
index 2dd6959..81237d6 100644
--- a/gxp-vd.c
+++ b/gxp-vd.c
@@ -183,7 +183,7 @@
{
struct gxp_dev *gxp = vd->gxp;
int ret;
- const size_t ro_size = PAGE_SIZE;
+ const size_t ro_size = GXP_FW_DATA_SYSCFG_SIZE / 2;
if (res->daddr == 0)
return 0;