fix(intel): modify how configuration type is handled

This patch creates macros to handle different configuration
types. These changes will help in adding new configuration
types in the future.

Signed-off-by: Abdul Halim, Muhammad Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
Change-Id: I5826a8e5942228a9ed376212f0df43b1605c0199
This commit is contained in:
Abdul Halim, Muhammad Hadi Asyrafi 2020-05-29 12:13:17 +08:00 committed by Sieu Mun Tang
parent f0c40b897f
commit ec4f28ecec
2 changed files with 13 additions and 5 deletions

View File

@ -82,6 +82,11 @@ struct fpga_config_info {
int block_number;
};
typedef enum {
FULL_CONFIG = 0,
PARTIAL_CONFIG,
} config_type;
/* Function Definitions */
bool is_address_in_ddr_range(uint64_t addr, uint64_t size);

View File

@ -20,9 +20,10 @@
#define FPGA_CONFIG_BUFFER_SIZE 4
static int current_block, current_buffer;
static int read_block, max_blocks, is_partial_reconfig;
static int read_block, max_blocks;
static uint32_t send_id, rcv_id;
static uint32_t bytes_per_block, blocks_submitted;
static bool is_full_reconfig;
/* SiP Service UUID */
@ -97,7 +98,7 @@ static uint32_t intel_mailbox_fpga_config_isdone(uint32_t query_type)
if (query_type != 1) {
/* full reconfiguration */
if (!is_partial_reconfig)
if (is_full_reconfig)
socfpga_bridges_enable(); /* Enable bridge */
}
@ -184,7 +185,7 @@ static int intel_fpga_config_completed_write(uint32_t *completed_addr,
return status;
}
static int intel_fpga_config_start(uint32_t config_type)
static int intel_fpga_config_start(uint32_t type)
{
uint32_t argument = 0x1;
uint32_t response[3];
@ -192,7 +193,9 @@ static int intel_fpga_config_start(uint32_t config_type)
unsigned int size = 0;
unsigned int resp_len = ARRAY_SIZE(response);
is_partial_reconfig = config_type;
if ((config_type)type == FULL_CONFIG) {
is_full_reconfig = true;
}
mailbox_clear_response();
@ -223,7 +226,7 @@ static int intel_fpga_config_start(uint32_t config_type)
current_buffer = 0;
/* full reconfiguration */
if (!is_partial_reconfig) {
if (is_full_reconfig) {
/* Disable bridge */
socfpga_bridges_disable();
}