mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
IB/hfi1: Add flag for platform config scratch register read
Add flag in pport data structure to determine when platform config was read from scratch registers. Change conditions in parse_platform_config and get_platform_config_field to use the new flag. Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Jakub Byczkowski <jakub.byczkowski@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
55774d09b7
commit
9161860463
3 changed files with 9 additions and 2 deletions
|
@ -1789,6 +1789,7 @@ static int check_meta_version(struct hfi1_devdata *dd, u32 *system_table)
|
||||||
int parse_platform_config(struct hfi1_devdata *dd)
|
int parse_platform_config(struct hfi1_devdata *dd)
|
||||||
{
|
{
|
||||||
struct platform_config_cache *pcfgcache = &dd->pcfg_cache;
|
struct platform_config_cache *pcfgcache = &dd->pcfg_cache;
|
||||||
|
struct hfi1_pportdata *ppd = dd->pport;
|
||||||
u32 *ptr = NULL;
|
u32 *ptr = NULL;
|
||||||
u32 header1 = 0, header2 = 0, magic_num = 0, crc = 0, file_length = 0;
|
u32 header1 = 0, header2 = 0, magic_num = 0, crc = 0, file_length = 0;
|
||||||
u32 record_idx = 0, table_type = 0, table_length_dwords = 0;
|
u32 record_idx = 0, table_type = 0, table_length_dwords = 0;
|
||||||
|
@ -1800,7 +1801,7 @@ int parse_platform_config(struct hfi1_devdata *dd)
|
||||||
* scratch register bitmap, thus there is no platform config to parse.
|
* scratch register bitmap, thus there is no platform config to parse.
|
||||||
* Skip parsing in these situations.
|
* Skip parsing in these situations.
|
||||||
*/
|
*/
|
||||||
if (is_integrated(dd) && !platform_config_load)
|
if (ppd->config_from_scratch)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!dd->platform_config.data) {
|
if (!dd->platform_config.data) {
|
||||||
|
@ -2089,13 +2090,14 @@ int get_platform_config_field(struct hfi1_devdata *dd,
|
||||||
int ret = 0, wlen = 0, seek = 0;
|
int ret = 0, wlen = 0, seek = 0;
|
||||||
u32 field_len_bits = 0, field_start_bits = 0, *src_ptr = NULL;
|
u32 field_len_bits = 0, field_start_bits = 0, *src_ptr = NULL;
|
||||||
struct platform_config_cache *pcfgcache = &dd->pcfg_cache;
|
struct platform_config_cache *pcfgcache = &dd->pcfg_cache;
|
||||||
|
struct hfi1_pportdata *ppd = dd->pport;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
memset(data, 0, len);
|
memset(data, 0, len);
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (is_integrated(dd) && !platform_config_load) {
|
if (ppd->config_from_scratch) {
|
||||||
/*
|
/*
|
||||||
* Use saved configuration from ppd for integrated platforms
|
* Use saved configuration from ppd for integrated platforms
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -677,6 +677,9 @@ struct hfi1_pportdata {
|
||||||
u8 default_atten;
|
u8 default_atten;
|
||||||
u8 max_power_class;
|
u8 max_power_class;
|
||||||
|
|
||||||
|
/* did we read platform config from scratch registers? */
|
||||||
|
bool config_from_scratch;
|
||||||
|
|
||||||
/* GUIDs for this interface, in host order, guids[0] is a port guid */
|
/* GUIDs for this interface, in host order, guids[0] is a port guid */
|
||||||
u64 guids[HFI1_GUIDS_PER_PORT];
|
u64 guids[HFI1_GUIDS_PER_PORT];
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,8 @@ static void save_platform_config_fields(struct hfi1_devdata *dd)
|
||||||
|
|
||||||
ppd->max_power_class = (temp_scratch & QSFP_MAX_POWER_SMASK) >>
|
ppd->max_power_class = (temp_scratch & QSFP_MAX_POWER_SMASK) >>
|
||||||
QSFP_MAX_POWER_SHIFT;
|
QSFP_MAX_POWER_SHIFT;
|
||||||
|
|
||||||
|
ppd->config_from_scratch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_platform_config(struct hfi1_devdata *dd)
|
void get_platform_config(struct hfi1_devdata *dd)
|
||||||
|
|
Loading…
Reference in a new issue