Unverified Commit 2bd038de authored by Shyam Sundar S K's avatar Shyam Sundar S K Committed by Ilpo Järvinen
Browse files

platform/x86/amd/pmf: Add BIOS_INPUTS_MAX macro to replace hardcoded array size



Define a new macro BIOS_INPUTS_MAX, to represent the maximum number of
BIOS input values. Replace hardcoded array sizes in relevant structures
with this macro to improve readability and maintainability.

Reviewed-by: default avatarMario Limonciello (AMD) <superm1@kernel.org>
Tested-by: default avatarYijun Shen <Yijun.Shen@Dell.com>
Co-developed-by: default avatarPatil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: default avatarPatil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: default avatarShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20251119085813.546813-1-Shyam-sundar.S-k@amd.com


Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 1d1b8b07
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ struct cookie_header {

#define APTS_MAX_STATES		16
#define CUSTOM_BIOS_INPUT_BITS	GENMASK(16, 7)
#define BIOS_INPUTS_MAX		10

/* amd_pmf_send_cmd() set/get */
#define SET_CMD		false
@@ -210,7 +211,7 @@ struct apmf_sbios_req_v1 {
	u8 skin_temp_apu;
	u8 skin_temp_hs2;
	u8 enable_cnqf;
	u32 custom_policy[10];
	u32 custom_policy[BIOS_INPUTS_MAX];
} __packed;

struct apmf_sbios_req_v2 {
@@ -222,7 +223,7 @@ struct apmf_sbios_req_v2 {
	u32 stt_min_limit;
	u8 skin_temp_apu;
	u8 skin_temp_hs2;
	u32 custom_policy[10];
	u32 custom_policy[BIOS_INPUTS_MAX];
} __packed;

struct apmf_fan_idx {
@@ -361,7 +362,7 @@ enum power_modes_v2 {
};

struct pmf_bios_inputs_prev {
	u32 custom_bios_inputs[10];
	u32 custom_bios_inputs[BIOS_INPUTS_MAX];
};

struct amd_pmf_dev {
@@ -457,7 +458,7 @@ struct os_power_slider {
struct amd_pmf_notify_smart_pc_update {
	u16 size;
	u32 pending_req;
	u32 custom_bios[10];
	u32 custom_bios[BIOS_INPUTS_MAX];
} __packed;

struct fan_table_control {