diff options
author | Elyes HAOUAS <ehaouas@noos.fr> | 2016-09-19 10:26:28 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2016-09-21 16:49:34 +0200 |
commit | b6a6bb53938c7e9f92237f22c52a02ab08a9d247 (patch) | |
tree | 461806c7e86c7e90d641592d90e1dd4a6b3ac54d /src/northbridge/amd/amdk8/coherent_ht.c | |
parent | e1606731b63bedd12398acb57a115aa5d280811e (diff) |
northbridge/amdk8: Improve code formatting
Change-Id: I1c2786dfb166904ff8b19a663c5e2e8156b7aedf
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/16644
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/northbridge/amd/amdk8/coherent_ht.c')
-rw-r--r-- | src/northbridge/amd/amdk8/coherent_ht.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/northbridge/amd/amdk8/coherent_ht.c b/src/northbridge/amd/amdk8/coherent_ht.c index 7e33feb61a..887a23b1f0 100644 --- a/src/northbridge/amd/amdk8/coherent_ht.c +++ b/src/northbridge/amd/amdk8/coherent_ht.c @@ -139,7 +139,7 @@ static void disable_probes(void) printk(BIOS_SPEW, "Disabling read/write/fill probes for UP... "); - val=pci_read_config32(NODE_HT(0), HT_TRANSACTION_CONTROL); + val = pci_read_config32(NODE_HT(0), HT_TRANSACTION_CONTROL); val |= HTTC_DIS_FILL_P | HTTC_DIS_RMT_MEM_C | HTTC_DIS_P_MEM_C | HTTC_DIS_MTS | HTTC_DIS_WR_DW_P | HTTC_DIS_WR_B_P | HTTC_DIS_RD_DW_P | HTTC_DIS_RD_B_P; @@ -193,7 +193,7 @@ static void enable_routing(u8 node) /* Enable routing table */ printk(BIOS_SPEW, "Enabling routing table for node %d", node); - val=pci_read_config32(NODE_HT(node), 0x6c); + val = pci_read_config32(NODE_HT(node), 0x6c); val &= ~((1<<1)|(1<<0)); pci_write_config32(NODE_HT(node), 0x6c, val); @@ -241,7 +241,7 @@ static void rename_temp_node(u8 node) printk(BIOS_SPEW, "Renaming current temporary node to %d", node); - val=pci_read_config32(NODE_HT(7), 0x60); + val = pci_read_config32(NODE_HT(7), 0x60); val &= (~7); /* clear low bits. */ val |= node; /* new node */ pci_write_config32(NODE_HT(7), 0x60, val); @@ -401,7 +401,7 @@ static void setup_row_local(u8 source, u8 row) /* source will be 7 when it is fo uint8_t linkn; uint32_t val; val = 1; - for (linkn = 0; linkn<3; linkn++) { + for (linkn = 0; linkn < 3; linkn++) { uint8_t regpos; uint32_t reg; regpos = 0x98 + 0x20 * linkn; @@ -423,10 +423,10 @@ static void setup_row_direct_x(u8 temp, u8 source, u8 dest, u8 linkn) if (((source &1)!=(dest &1)) #if CROSS_BAR_47_56 - && ( (source<4)||(source>5) ) //(6,7) (7,6) should still be here + && ((source < 4)||(source > 5)) //(6,7) (7,6) should still be here //(6,5) (7,4) should be here #endif - ){ + ) { val |= (1<<16); } else { /*for CROSS_BAR_47_56 47, 56, should be here too @@ -437,7 +437,7 @@ static void setup_row_direct_x(u8 temp, u8 source, u8 dest, u8 linkn) val |= ((val_s>>16) - (1<<(linkn+1)))<<16; } - fill_row(temp,dest, val ); + fill_row(temp,dest, val); } #if CROSS_BAR_47_56 @@ -453,7 +453,7 @@ static void opt_broadcast_rt_group(const u8 *conn, int num) { int i; - for (i=0; i<num; i+=3) { + for (i = 0; i < num; i+=3) { opt_broadcast_rt(conn[i], conn[i+1],conn[i+2]); } } @@ -470,7 +470,7 @@ static void opt_broadcast_rt_plus_group(const u8 *conn, int num) { int i; - for (i=0; i<num; i+=3) { + for (i = 0; i < num; i+=3) { opt_broadcast_rt_plus(conn[i], conn[i+1],conn[i+2]); } } @@ -535,7 +535,7 @@ static void setup_row_indirect_x(u8 temp, u8 source, u8 dest, u8 gateway, u8 dif #if !CROSS_BAR_47_56 u8 gateway; u8 diff; - if (source<dest) { + if (source < dest) { gateway = source + 2; } else { gateway = source - 2; @@ -552,7 +552,7 @@ static void setup_row_indirect_x(u8 temp, u8 source, u8 dest, u8 gateway, u8 dif diff = ((source&1)!=(dest &1)); #endif - if (diff && (val_s!=(val&0xff)) ) { /* use another connect as response*/ + if (diff && (val_s!=(val&0xff))) { /* use another connect as response*/ val_s -= val & 0xff; #if (CONFIG_MAX_PHYSICAL_CPUS > 4) || CONFIG_MAX_PHYSICAL_CPUS_4_BUT_MORE_INSTALLED uint8_t byte; @@ -562,14 +562,14 @@ static void setup_row_indirect_x(u8 temp, u8 source, u8 dest, u8 gateway, u8 dif byte = val_s; byte = get_linkn_last_count(byte); if ((byte>>2)>1) { /* make sure not the corner*/ - if (source<dest) { + if (source < dest) { val_s-=link_connection(temp, source-2); /* -down*/ } else { #if CROSS_BAR_47_56 #if 0 - if (source==7) { + if (source == 7) { val_s-=link_connection(temp, 6); // for 7,2 via 5 - } else if (source==6){ + } else if (source == 6) { val_s-=link_connection(temp, 7); // for 6,3 via 4 } else #endif @@ -614,10 +614,10 @@ static void setup_row_indirect_group(const u8 *conn, int num) int i; #if !CROSS_BAR_47_56 - for (i=0; i<num; i+=2) { + for (i = 0; i < num; i+=2) { setup_row_indirect(conn[i], conn[i+1]); #else - for (i=0; i<num; i+=4) { + for (i = 0; i < num; i+=4) { setup_row_indirect(conn[i], conn[i+1],conn[i+2], conn[i+3]); #endif @@ -641,10 +641,10 @@ static void setup_remote_row_indirect_group(const u8 *conn, int num) int i; #if !CROSS_BAR_47_56 - for (i=0; i<num; i+=2) { + for (i = 0; i < num; i+=2) { setup_remote_row_indirect(conn[i], conn[i+1]); #else - for (i=0; i<num; i+=4) { + for (i = 0; i < num; i+=4) { setup_remote_row_indirect(conn[i], conn[i+1],conn[i+2], conn[i+3]); #endif } @@ -658,7 +658,7 @@ static void setup_uniprocessor(void) printk(BIOS_SPEW, "Enabling UP settings\n"); #if CONFIG_LOGICAL_CPUS unsigned tmp = (pci_read_config32(NODE_MC(0), 0xe8) >> 12) & 3; - if (tmp>0) return; + if (tmp > 0) return; #endif disable_probes(); } @@ -668,10 +668,10 @@ static int optimize_connection_group(const u8 *opt_conn, int num) { int needs_reset = 0; int i; - for (i=0; i<num; i+=2) { + for (i = 0; i < num; i+=2) { needs_reset = optimize_connection( NODE_HT(opt_conn[i]), 0x80 + link_to_register(link_connection(opt_conn[i],opt_conn[i+1])), - NODE_HT(opt_conn[i+1]), 0x80 + link_to_register(link_connection(opt_conn[i+1],opt_conn[i])) ); + NODE_HT(opt_conn[i+1]), 0x80 + link_to_register(link_connection(opt_conn[i+1],opt_conn[i]))); } return needs_reset; } @@ -689,7 +689,7 @@ static unsigned setup_smp2(void) val = get_row(0,0); byte = (val>>16) & 0xfe; - if (byte<0x2) { /* no coherent connection so get out.*/ + if (byte < 0x2) { /* no coherent connection so get out.*/ nodes = 1; return nodes; } @@ -717,7 +717,7 @@ static unsigned setup_smp2(void) val = get_row(7,1); byte = (val>>16) & 0xfe; byte = get_linkn_last_count(byte); - if ((byte>>2)==3) { /* Oh! we need to treat it as node2. So use another link*/ + if ((byte>>2) == 3) { /* Oh! we need to treat it as node2. So use another link*/ val = get_row(0,0); byte = (val>>16) & 0xfe; #if TRY_HIGH_FIRST == 1 @@ -760,14 +760,14 @@ static unsigned setup_smp4(void) u8 byte; uint32_t val; - nodes=4; + nodes = 4; /* Setup and check temporary connection from Node 0 to Node 2 */ val = get_row(0,0); byte = ((val>>16) & 0xfe) - link_connection(0,1); byte = get_linkn_last_count(byte); - if ((byte>>2)==0) { /* We should have two coherent for 4p and above*/ + if ((byte>>2) == 0) { /* We should have two coherent for 4p and above*/ nodes = 2; return nodes; } @@ -841,7 +841,7 @@ static unsigned setup_smp4(void) #if (CONFIG_MAX_PHYSICAL_CPUS > 4) || CONFIG_MAX_PHYSICAL_CPUS_4_BUT_MORE_INSTALLED /* We need to find out which link is to node3 */ - if ((byte>>2)==2) { /* one to node3, one to node0, one to node4*/ + if ((byte>>2) == 2) { /* one to node3, one to node0, one to node4*/ val = get_row(7,3); if ((val>>16) == 1) { /* that link is to node4, because via node1 it has been set, recompute it*/ val = get_row(2,2); @@ -865,7 +865,7 @@ static unsigned setup_smp4(void) val = get_row(7,3); byte = ((val>>16) & 0xfe) - link_connection(7,2) - link_connection(7,1); byte = get_linkn_last_count(byte); - if ((byte>>2)==1) { /* We should have three coherent links on node 3 for 6p and above*/ + if ((byte>>2) == 1) { /* We should have three coherent links on node 3 for 6p and above*/ byte &= 3; /*bit [3,2] is count-2*/ print_linkn("(3,5) link=", byte); setup_remote_row_direct(3, 5, byte); @@ -875,7 +875,7 @@ static unsigned setup_smp4(void) byte = ((val>>16) & 0xfe) - link_connection(2,3) - link_connection(2,0); byte = get_linkn_last_count(byte); - if ((byte>>2)==1) { /* We should have three coherent link on node 2 for 6p and above*/ + if ((byte>>2) == 1) { /* We should have three coherent link on node 2 for 6p and above*/ byte &= 3; /* bit [3,2] is count-2*/ print_linkn("(2,4) link=", byte); setup_row_direct(2, 4, byte); @@ -931,14 +931,14 @@ static unsigned setup_smp6(void) u8 byte; uint32_t val; - nodes=6; + nodes = 6; /* Setup and check temporary connection from Node 0 to Node 4 through 2*/ val = get_row(2,2); byte = ((val>>16) & 0xfe) - link_connection(2,3) - link_connection(2,0); byte = get_linkn_last_count(byte); - if ((byte>>2)==0) { /* We should have three coherent link on node 2 for 6p and above*/ + if ((byte>>2) == 0) { /* We should have three coherent link on node 2 for 6p and above*/ nodes = 4; return nodes; } @@ -948,7 +948,7 @@ static unsigned setup_smp6(void) val = get_row(3,3); byte = ((val>>16) & 0xfe) - link_connection(3,2) - link_connection(3,1); byte = get_linkn_last_count(byte); - if ((byte>>2)==0) { /* We should have three coherent links on node 3 for 6p and above*/ + if ((byte>>2) == 0) { /* We should have three coherent links on node 3 for 6p and above*/ nodes = 4; return nodes; } @@ -975,7 +975,7 @@ static unsigned setup_smp6(void) setup_row_indirect_group(conn6_1, ARRAY_SIZE(conn6_1)); - for (byte=0; byte<4; byte+=2) { + for (byte = 0; byte < 4; byte+=2) { setup_temp_row(byte,byte+2); } verify_connection(7); @@ -1003,7 +1003,7 @@ static unsigned setup_smp6(void) enable_routing(4); setup_temp_row(0,1); - for (byte=0; byte<4; byte+=2) { + for (byte = 0; byte < 4; byte+=2) { setup_temp_row(byte+1,byte+3); } verify_connection(7); @@ -1031,7 +1031,7 @@ static unsigned setup_smp6(void) #if CONFIG_MAX_PHYSICAL_CPUS > 6 /* We need to find out which link is to node5 */ - if ((byte>>2)==2) { /* one to node5, one to node2, one to node6*/ + if ((byte>>2) == 2) { /* one to node5, one to node2, one to node6*/ val = get_row(7,5); if ((val>>16) == 1) { /* that link is to node6, because via node 3 node 5 has been set*/ val = get_row(4,4); @@ -1054,7 +1054,7 @@ static unsigned setup_smp6(void) val = get_row(7,5); byte = ((val>>16) & 0xfe) - link_connection(7,4) - link_connection(7,3); byte = get_linkn_last_count(byte); - if ((byte>>2)==1) { /* We should have three coherent links on node 5 for 6p and above*/ + if ((byte>>2) == 1) { /* We should have three coherent links on node 5 for 6p and above*/ byte &= 3; /*bit [3,2] is count-2*/ print_linkn("(5,7) link=", byte); setup_remote_row_direct(5, 7, byte); @@ -1065,7 +1065,7 @@ static unsigned setup_smp6(void) byte = ((val>>16) & 0xfe) - link_connection(4,5) - link_connection(4,2); byte = get_linkn_last_count(byte); - if ((byte>>2)==1) { /* We should have three coherent link on node 4 for 6p and above*/ + if ((byte>>2) == 1) { /* We should have three coherent link on node 4 for 6p and above*/ byte &= 3; /* bit [3,2] is count-2*/ print_linkn("(4,6) link=", byte); setup_row_direct(4, 6, byte); @@ -1115,7 +1115,7 @@ static unsigned setup_smp6(void) /* We need to do sth about reverse about setup_temp_row (0,1), (2,4), (1, 3), (3,5) * It will be done by clear_dead_links */ - for (byte=0; byte<4; byte++) { + for (byte = 0; byte < 4; byte++) { clear_temp_row(byte); } #endif @@ -1134,7 +1134,7 @@ static unsigned setup_smp8(void) u8 byte; uint32_t val; - nodes=8; + nodes = 8; /* Setup and check temporary connection from Node 0 to Node 6 via 2 and 4 to 7 */ val = get_row(4,4); @@ -1143,7 +1143,7 @@ static unsigned setup_smp8(void) #else byte = ((val>>16) & 0xfe) - link_connection(4,5) - link_connection(4,2); byte = get_linkn_last_count(byte); /* Max link to 6*/ - if ((byte>>2)==0) { /* We should have two or three coherent links on node 4 for 8p*/ + if ((byte>>2) == 0) { /* We should have two or three coherent links on node 4 for 8p*/ nodes = 6; return nodes; } @@ -1170,7 +1170,7 @@ static unsigned setup_smp8(void) val = get_row(5,5); byte = ((val>>16) & 0xfe) - link_connection(5,4) - link_connection(5,3); byte = get_linkn_last_count(byte); - if ((byte>>2)==0) { /* We should have three coherent links on node 5 for 6p and above*/ + if ((byte>>2) == 0) { /* We should have three coherent links on node 5 for 6p and above*/ nodes = 6; return nodes; } @@ -1203,7 +1203,7 @@ static unsigned setup_smp8(void) setup_row_indirect_group(conn8_1,ARRAY_SIZE(conn8_1)); - for (byte=0; byte<6; byte+=2) { + for (byte = 0; byte < 6; byte+=2) { setup_temp_row(byte,byte+2); } verify_connection(7); @@ -1241,7 +1241,7 @@ static unsigned setup_smp8(void) setup_row_direct(5, 6, byte); setup_temp_row(0,1); /* temp. link between nodes 0 and 1 */ - for (byte=0; byte<4; byte+=2) { + for (byte = 0; byte < 4; byte+=2) { setup_temp_row(byte+1,byte+3); } setup_temp_row(5,6); @@ -1249,7 +1249,7 @@ static unsigned setup_smp8(void) verify_connection(7); val = get_row(7,6); // to chect it if it is node6 before renaming - if ( (val>>16) == 1) { // it is real node 7 so swap it + if ((val>>16) == 1) { // it is real node 7 so swap it /* We need to recompute link to 6 */ val = get_row(5,5); byte = ((val>>16) & 0xfe) - link_connection(5,3); @@ -1262,7 +1262,7 @@ static unsigned setup_smp8(void) setup_row_direct(5, 6, byte); #if 0 setup_temp_row(0,1); /* temp. link between nodes 0 and 1 */ - for (byte=0; byte<4; byte+=2) { + for (byte = 0; byte < 4; byte+=2) { setup_temp_row(byte+1,byte+3); } #endif @@ -1282,7 +1282,7 @@ static unsigned setup_smp8(void) #if !CROSS_BAR_47_56 setup_temp_row(0,1); - for (byte=0; byte<6; byte+=2) { + for (byte = 0; byte < 6; byte+=2) { setup_temp_row(byte+1,byte+3); } @@ -1302,7 +1302,7 @@ static unsigned setup_smp8(void) setup_row_direct(4, 7, byte); /* Setup and check temporary connection from Node 0 to Node 7 through 2, and 4*/ - for (byte=0; byte<4; byte+=2) { + for (byte = 0; byte < 4; byte+=2) { setup_temp_row(byte,byte+2); } @@ -1327,7 +1327,7 @@ static unsigned setup_smp8(void) setup_row_direct(5, 7, byte); setup_temp_row(0,1); /* temp. link between nodes 0 and 1 */ - for (byte=0; byte<4; byte+=2) { + for (byte = 0; byte < 4; byte+=2) { setup_temp_row(byte+1,byte+3); } @@ -1511,7 +1511,7 @@ static unsigned verify_mp_capabilities(unsigned nodes) mask = 0x06; /* BigMPCap */ - for (node=0; node<nodes; node++) { + for (node = 0; node < nodes; node++) { mask &= pci_read_config32(NODE_MC(node), 0xe8); } @@ -1525,7 +1525,7 @@ static unsigned verify_mp_capabilities(unsigned nodes) break; #endif case 0x00: /* Non SMP */ - if (nodes >1 ) { + if (nodes >1) { printk(BIOS_ERR, "Going back to UP\n"); return 1; } @@ -1542,7 +1542,7 @@ static void clear_dead_routes(unsigned nodes) int last_row; int node, row; #if CONFIG_MAX_PHYSICAL_CPUS == 8 - if (nodes==8) return;/* don't touch (7,7)*/ + if (nodes == 8) return;/* don't touch (7,7)*/ #endif last_row = nodes; if (nodes == 1) { @@ -1555,9 +1555,9 @@ static void clear_dead_routes(unsigned nodes) } /* Update the local row */ - for ( node=0; node<nodes; node++) { + for (node = 0; node < nodes; node++) { uint32_t val = 0; - for (row =0; row<nodes; row++) { + for (row =0; row < nodes; row++) { val |= get_row(node, row); } fill_row(node, node, (((val & 0xff) | ((val >> 8) & 0xff)) << 16) | 0x0101); @@ -1571,7 +1571,7 @@ static unsigned verify_dualcore(unsigned nodes) unsigned node, totalcpus, tmp; totalcpus = 0; - for (node=0; node<nodes; node++) { + for (node = 0; node < nodes; node++) { tmp = (pci_read_config32(NODE_MC(node), 0xe8) >> 12) & 3 ; totalcpus += (tmp + 1); } @@ -1626,7 +1626,7 @@ static void coherent_ht_finalize(unsigned nodes) /* Only respond to real CPU pci configuration cycles * and optimize the HT settings */ - val=pci_read_config32(dev, HT_TRANSACTION_CONTROL); + val = pci_read_config32(dev, HT_TRANSACTION_CONTROL); val &= ~((HTTC_BUF_REL_PRI_MASK << HTTC_BUF_REL_PRI_SHIFT) | (HTTC_MED_PRI_BYP_CNT_MASK << HTTC_MED_PRI_BYP_CNT_SHIFT) | (HTTC_HI_PRI_BYP_CNT_MASK << HTTC_HI_PRI_BYP_CNT_SHIFT)); @@ -1666,14 +1666,14 @@ static int apply_cpu_errata_fixes(unsigned nodes) if ((cmd & (3 << 0)) != 2) { cmd &= ~(3<<0); cmd |= (2<<0); - pci_write_config32(dev, 0x70, cmd ); + pci_write_config32(dev, 0x70, cmd); needs_reset = 1; } cmd = pci_read_config32(dev, 0x7c); if ((cmd & (3 << 4)) != 0) { cmd &= ~(3<<4); cmd |= (0<<4); - pci_write_config32(dev, 0x7c, cmd ); + pci_write_config32(dev, 0x7c, cmd); needs_reset = 1; } /* Clock Power/Timing Low */ @@ -1694,7 +1694,7 @@ static int apply_cpu_errata_fixes(unsigned nodes) cmd_ref = 0x04e20707; /* Registered */ cmd = pci_read_config32(dev, 0xd4); if (cmd != cmd_ref) { - pci_write_config32(dev, 0xd4, cmd_ref ); + pci_write_config32(dev, 0xd4, cmd_ref); needs_reset = 1; /* Needed? */ } } @@ -1765,14 +1765,14 @@ static int optimize_link_coherent_ht(void) nodes = get_nodes(); #if CONFIG_MAX_PHYSICAL_CPUS > 1 - if (nodes>1) { + if (nodes > 1) { needs_reset |= optimize_connection( NODE_HT(0), 0x80 + link_to_register(link_connection(0,1)), - NODE_HT(1), 0x80 + link_to_register(link_connection(1,0)) ); + NODE_HT(1), 0x80 + link_to_register(link_connection(1,0))); } #if CONFIG_MAX_PHYSICAL_CPUS > 2 - if (nodes>2) { + if (nodes > 2) { /* optimize physical connections - by LYH */ static const u8 opt_conn4[] = { 0,2, @@ -1784,7 +1784,7 @@ static int optimize_link_coherent_ht(void) #endif #if CONFIG_MAX_PHYSICAL_CPUS > 4 - if (nodes>4) { + if (nodes > 4) { static const uint8_t opt_conn6[] ={ 2, 4, 3, 5, @@ -1797,7 +1797,7 @@ static int optimize_link_coherent_ht(void) #endif #if CONFIG_MAX_PHYSICAL_CPUS > 6 - if (nodes>6) { + if (nodes > 6) { static const uint8_t opt_conn8[] ={ 4, 6, #if CROSS_BAR_47_56 |