Commit ce27643c authored by Dave Airlie's avatar Dave Airlie Committed by Alex Deucher

amdgpu/pp: use array_size to size the pwrvirus tables.

This avoids fragile hardcoding of array size.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d81a2209
...@@ -35,8 +35,7 @@ struct PWR_Command_Table ...@@ -35,8 +35,7 @@ struct PWR_Command_Table
}; };
typedef struct PWR_Command_Table PWR_Command_Table; typedef struct PWR_Command_Table PWR_Command_Table;
#define PWR_VIRUS_TABLE_SIZE 10243 static const PWR_Command_Table PwrVirusTable[] =
static const PWR_Command_Table PwrVirusTable[PWR_VIRUS_TABLE_SIZE] =
{ {
{ 0x100100b6, mmPCIE_INDEX }, { 0x100100b6, mmPCIE_INDEX },
{ 0x00000000, mmPCIE_DATA }, { 0x00000000, mmPCIE_DATA },
......
...@@ -36,10 +36,7 @@ struct PWR_Command_Table { ...@@ -36,10 +36,7 @@ struct PWR_Command_Table {
typedef struct PWR_Command_Table PWR_Command_Table; typedef struct PWR_Command_Table PWR_Command_Table;
static const PWR_Command_Table pwr_virus_table[] = {
#define PWR_VIRUS_TABLE_SIZE 10031
static const PWR_Command_Table pwr_virus_table[PWR_VIRUS_TABLE_SIZE] = {
{ 0x00000000, mmRLC_CNTL }, { 0x00000000, mmRLC_CNTL },
{ 0x00000002, mmRLC_SRM_CNTL }, { 0x00000002, mmRLC_SRM_CNTL },
{ 0x15000000, mmCP_ME_CNTL }, { 0x15000000, mmCP_ME_CNTL },
......
...@@ -167,7 +167,7 @@ static int fiji_setup_pwr_virus(struct pp_hwmgr *hwmgr) ...@@ -167,7 +167,7 @@ static int fiji_setup_pwr_virus(struct pp_hwmgr *hwmgr)
const PWR_Command_Table *pvirus = PwrVirusTable; const PWR_Command_Table *pvirus = PwrVirusTable;
for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) { for (i = 0; i < ARRAY_SIZE(PwrVirusTable); i++) {
reg = pvirus->reg; reg = pvirus->reg;
data = pvirus->data; data = pvirus->data;
if (reg != 0xffffffff) if (reg != 0xffffffff)
......
...@@ -68,7 +68,7 @@ static int polaris10_setup_pwr_virus(struct pp_hwmgr *hwmgr) ...@@ -68,7 +68,7 @@ static int polaris10_setup_pwr_virus(struct pp_hwmgr *hwmgr)
const PWR_Command_Table *pvirus = pwr_virus_table; const PWR_Command_Table *pvirus = pwr_virus_table;
for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) { for (i = 0; i < ARRAY_SIZE(pwr_virus_table); i++) {
reg = pvirus->reg; reg = pvirus->reg;
data = pvirus->data; data = pvirus->data;
if (reg != 0xffffffff) { if (reg != 0xffffffff) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment