/* * This function will validate Map info data provided by FW */ u8 MR_ValidateMapInfo(struct megasas_instance *instance) { struct fusion_context *fusion = instance->ctrl_context; struct MR_FW_RAID_MAP_ALL *map = fusion->ld_map[(instance->map_id & 1)]; struct LD_LOAD_BALANCE_INFO *lbInfo = fusion->load_balance_info; PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; struct MR_FW_RAID_MAP *pFwRaidMap = &map->raidMap; if (pFwRaidMap->totalSize != (sizeof(struct MR_FW_RAID_MAP) -sizeof(struct MR_LD_SPAN_MAP) + (sizeof(struct MR_LD_SPAN_MAP) *pFwRaidMap->ldCount))) { printk(KERN_ERR "megasas: map info structure size 0x%x is not matching with ld count\n", (unsigned int)((sizeof(struct MR_FW_RAID_MAP) - sizeof(struct MR_LD_SPAN_MAP)) + (sizeof(struct MR_LD_SPAN_MAP) * pFwRaidMap->ldCount))); printk(KERN_ERR "megasas: span map %x, pFwRaidMap->totalSize " ": %x\n", (unsigned int)sizeof(struct MR_LD_SPAN_MAP), pFwRaidMap->totalSize); return 0; } if (instance->UnevenSpanSupport) mr_update_span_set(map, ldSpanInfo); mr_update_load_balance_params(map, lbInfo); return 1; }
/* * This function will validate Map info data provided by FW */ u8 MR_ValidateMapInfo(struct megasas_instance *instance) { struct fusion_context *fusion = instance->ctrl_context; struct MR_FW_RAID_MAP_ALL *map = fusion->ld_map[(instance->map_id & 1)]; struct LD_LOAD_BALANCE_INFO *lbInfo = fusion->load_balance_info; PLD_SPAN_INFO ldSpanInfo = fusion->log_to_span; struct MR_FW_RAID_MAP *pFwRaidMap = &map->raidMap; struct MR_LD_RAID *raid; int ldCount, num_lds; u16 ld; if (le32_to_cpu(pFwRaidMap->totalSize) != (sizeof(struct MR_FW_RAID_MAP) -sizeof(struct MR_LD_SPAN_MAP) + (sizeof(struct MR_LD_SPAN_MAP) * le32_to_cpu(pFwRaidMap->ldCount)))) { printk(KERN_ERR "megasas: map info structure size 0x%x is not matching with ld count\n", (unsigned int)((sizeof(struct MR_FW_RAID_MAP) - sizeof(struct MR_LD_SPAN_MAP)) + (sizeof(struct MR_LD_SPAN_MAP) * le32_to_cpu(pFwRaidMap->ldCount)))); printk(KERN_ERR "megasas: span map %x, pFwRaidMap->totalSize " ": %x\n", (unsigned int)sizeof(struct MR_LD_SPAN_MAP), le32_to_cpu(pFwRaidMap->totalSize)); return 0; } if (instance->UnevenSpanSupport) mr_update_span_set(map, ldSpanInfo); mr_update_load_balance_params(map, lbInfo); num_lds = le32_to_cpu(map->raidMap.ldCount); /*Convert Raid capability values to CPU arch */ for (ldCount = 0; ldCount < num_lds; ldCount++) { ld = MR_TargetIdToLdGet(ldCount, map); raid = MR_LdRaidGet(ld, map); le32_to_cpus((u32 *)&raid->capability); } return 1; }
/* * This function will validate Map info data provided by FW */ U8 MR_ValidateMapInfo(MR_FW_RAID_MAP_ALL *map, PLD_LOAD_BALANCE_INFO lbInfo) { MR_FW_RAID_MAP *pFwRaidMap = &map->raidMap; U32 fwsize = sizeof (MR_FW_RAID_MAP) - sizeof (MR_LD_SPAN_MAP) + (sizeof (MR_LD_SPAN_MAP) * pFwRaidMap->ldCount); if (pFwRaidMap->totalSize != fwsize) { con_log(CL_ANN1, (CE_NOTE, "map info structure size 0x%x is " "not matching with ld count\n", fwsize)); /* sizeof (foo) returns size_t, which is *LONG*. */ con_log(CL_ANN1, (CE_NOTE, "span map 0x%x total size 0x%x\n",\ (int)sizeof (MR_LD_SPAN_MAP), pFwRaidMap->totalSize)); return (0); } mr_update_load_balance_params(map, lbInfo); return (1); }